author | zautrix <zautrix> | 2005-07-03 08:42:34 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-03 08:42:34 (UTC) |
commit | 971bfd3cf502fbbafc96bef70e21beb545e450b5 (patch) (unidiff) | |
tree | 2d4b2d0d291c5a23bb39e3f448403acbe86cc071 /korganizer/koeventpopupmenu.cpp | |
parent | 914c795a77d8bb28fc8c2155cfc9524f3effdde1 (diff) | |
download | kdepimpi-971bfd3cf502fbbafc96bef70e21beb545e450b5.zip kdepimpi-971bfd3cf502fbbafc96bef70e21beb545e450b5.tar.gz kdepimpi-971bfd3cf502fbbafc96bef70e21beb545e450b5.tar.bz2 |
fixes
Diffstat (limited to 'korganizer/koeventpopupmenu.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeventpopupmenu.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp index 0b0fe8e..77322e7 100644 --- a/korganizer/koeventpopupmenu.cpp +++ b/korganizer/koeventpopupmenu.cpp | |||
@@ -52,74 +52,80 @@ KOEventPopupMenu::KOEventPopupMenu(): QPopupMenu() | |||
52 | #endif | 52 | #endif |
53 | mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"), | 53 | mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"), |
54 | this,SLOT(popupCancel()))); | 54 | this,SLOT(popupCancel()))); |
55 | isDisabled = false; | 55 | isDisabled = false; |
56 | mCatPopup = new QPopupMenu ( this ); | 56 | mCatPopup = new QPopupMenu ( this ); |
57 | mCatPopup->setCheckable (true); | 57 | mCatPopup->setCheckable (true); |
58 | connect(mCatPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCatPopup())); | 58 | connect(mCatPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCatPopup())); |
59 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCatPopup( int ))); | 59 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCatPopup( int ))); |
60 | mCalPopup = new QPopupMenu ( this ); | 60 | mCalPopup = new QPopupMenu ( this ); |
61 | mCalPopup->setCheckable (true); | 61 | mCalPopup->setCheckable (true); |
62 | connect(mCalPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCalPopup())); | 62 | connect(mCalPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCalPopup())); |
63 | connect(mCalPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCalPopup( int ))); | 63 | connect(mCalPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCalPopup( int ))); |
64 | mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup )); | 64 | //mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup )); |
65 | mEditOnlyItems.append(insertItem (i18n("Calendar"),mCalPopup )); | 65 | //mEditOnlyItems.append(insertItem (i18n("Calendar"),mCalPopup )); |
66 | insertItem (i18n("Categories"),mCatPopup ); | ||
67 | insertItem (i18n("Calendar"),mCalPopup ); | ||
66 | QValueList<int>::Iterator it; | 68 | QValueList<int>::Iterator it; |
67 | for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { | 69 | for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { |
68 | mSingleOnlyItems.append(*it); | 70 | mSingleOnlyItems.append(*it); |
69 | } | 71 | } |
70 | 72 | ||
71 | } | 73 | } |
72 | void KOEventPopupMenu::enableDefault( bool enable ) | 74 | void KOEventPopupMenu::enableDefault( bool enable ) |
73 | { | 75 | { |
74 | isDisabled = !enable; | 76 | isDisabled = !enable; |
75 | QValueList<int>::Iterator it; | 77 | QValueList<int>::Iterator it; |
76 | for( it = mSingleOnlyItems.begin(); it != mSingleOnlyItems.end(); ++it ) { | 78 | for( it = mSingleOnlyItems.begin(); it != mSingleOnlyItems.end(); ++it ) { |
77 | setItemEnabled(*it,enable); | 79 | setItemEnabled(*it,enable); |
78 | } | 80 | } |
79 | 81 | ||
80 | } | 82 | } |
81 | 83 | ||
82 | void KOEventPopupMenu::fillCalPopup() // CAL | 84 | void KOEventPopupMenu::fillCalPopup() // CAL |
83 | { | 85 | { |
84 | mCalPopup->clear(); | 86 | mCalPopup->clear(); |
85 | if (!mCurrentIncidence) return; | 87 | if (!mCurrentIncidence) return; |
88 | bool readO = mCurrentIncidence->isReadOnly()|| isDisabled; | ||
86 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 89 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
87 | while ( kkf ) { | 90 | while ( kkf ) { |
88 | int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); | 91 | int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); |
89 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) | 92 | if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) |
90 | mCalPopup->setItemEnabled( index, false ); | 93 | mCalPopup->setItemEnabled( index, false ); |
91 | mCalPopup->setItemChecked (index, kkf->mCalNumber == mCurrentIncidence->calID()); | 94 | mCalPopup->setItemChecked (index, kkf->mCalNumber == mCurrentIncidence->calID()); |
92 | kkf = KOPrefs::instance()->mCalendars.next(); | 95 | kkf = KOPrefs::instance()->mCalendars.next(); |
93 | } | 96 | } |
94 | } | 97 | } |
95 | void KOEventPopupMenu::computeCalPopup( int index ) // CAL | 98 | void KOEventPopupMenu::computeCalPopup( int index ) // CAL |
96 | { | 99 | { |
97 | if (!mCurrentIncidence) return; | 100 | if (!mCurrentIncidence) return; |
98 | mCurrentIncidence->setCalID( index ); | 101 | mCurrentIncidence->setCalID( index ); |
99 | emit categoryChanged( mCurrentIncidence ); | 102 | emit categoryChanged( mCurrentIncidence ); |
100 | } | 103 | } |
101 | void KOEventPopupMenu::fillCatPopup() | 104 | void KOEventPopupMenu::fillCatPopup() |
102 | { | 105 | { |
103 | mCatPopup->clear(); | 106 | mCatPopup->clear(); |
104 | if (!mCurrentIncidence) return; | 107 | if (!mCurrentIncidence) return; |
108 | bool readO = mCurrentIncidence->isReadOnly() || isDisabled; | ||
105 | QStringList checkedCategories = mCurrentIncidence->categories(); | 109 | QStringList checkedCategories = mCurrentIncidence->categories(); |
106 | int index = 0; | 110 | int index = 0; |
107 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 111 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
108 | it != KOPrefs::instance()->mCustomCategories.end (); | 112 | it != KOPrefs::instance()->mCustomCategories.end (); |
109 | ++it) { | 113 | ++it) { |
110 | mCatPopup->insertItem (*it, index ); | 114 | mCatPopup->insertItem (*it, index ); |
111 | if (checkedCategories.find (*it) != checkedCategories.end ()) { | 115 | if (checkedCategories.find (*it) != checkedCategories.end ()) { |
112 | mCatPopup->setItemChecked (index, true); | 116 | mCatPopup->setItemChecked (index, true); |
113 | } | 117 | } |
118 | if ( readO ) | ||
119 | mCatPopup->setItemEnabled( index, false ); | ||
114 | ++index; | 120 | ++index; |
115 | } | 121 | } |
116 | } | 122 | } |
117 | void KOEventPopupMenu::computeCatPopup( int index ) | 123 | void KOEventPopupMenu::computeCatPopup( int index ) |
118 | { | 124 | { |
119 | if (!mCurrentIncidence) return; | 125 | if (!mCurrentIncidence) return; |
120 | QStringList categories = mCurrentIncidence->categories(); | 126 | QStringList categories = mCurrentIncidence->categories(); |
121 | QString colcat = categories.first(); | 127 | QString colcat = categories.first(); |
122 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) | 128 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) |
123 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); | 129 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); |
124 | else | 130 | else |
125 | categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); | 131 | categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); |