author | zautrix <zautrix> | 2005-02-07 13:03:38 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-07 13:03:38 (UTC) |
commit | 7de846e9f01ce27b622541493e6a02e26e37bf2c (patch) (unidiff) | |
tree | df59c7803b1e171b08d3c387f49b1239d1adc3b5 /libkdepim | |
parent | afc19166fcdc09d3d5b757a84abfeb0b2746f35f (diff) | |
download | kdepimpi-7de846e9f01ce27b622541493e6a02e26e37bf2c.zip kdepimpi-7de846e9f01ce27b622541493e6a02e26e37bf2c.tar.gz kdepimpi-7de846e9f01ce27b622541493e6a02e26e37bf2c.tar.bz2 |
fixxxx
-rw-r--r-- | libkdepim/categoryselectdialog.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp index 8b2bc4e..8038934 100644 --- a/libkdepim/categoryselectdialog.cpp +++ b/libkdepim/categoryselectdialog.cpp | |||
@@ -121,76 +121,75 @@ QStringList CategorySelectDialog::selectedCategories() const | |||
121 | return mCategoryList; | 121 | return mCategoryList; |
122 | } | 122 | } |
123 | void CategorySelectDialog::setColorEnabled() | 123 | void CategorySelectDialog::setColorEnabled() |
124 | { | 124 | { |
125 | mColorEnabled = true; | 125 | mColorEnabled = true; |
126 | mSetColorCat->show(); | 126 | mSetColorCat->show(); |
127 | } | 127 | } |
128 | void CategorySelectDialog::setColorCat() | 128 | void CategorySelectDialog::setColorCat() |
129 | { | 129 | { |
130 | QCheckListItem * newColorItem = (QCheckListItem * )mCategories->currentItem (); | 130 | QCheckListItem * newColorItem = (QCheckListItem * )mCategories->currentItem (); |
131 | if ( !newColorItem ) { | 131 | if ( !newColorItem ) { |
132 | KMessageBox::error(this,i18n("There is no current item.")); | 132 | KMessageBox::error(this,i18n("There is no current item.")); |
133 | return; | 133 | return; |
134 | } | 134 | } |
135 | if ( !newColorItem->isOn() ) | 135 | if ( !newColorItem->isOn() ) |
136 | newColorItem->setOn( true ); | 136 | newColorItem->setOn( true ); |
137 | setColorItem( newColorItem ); | 137 | setColorItem( newColorItem ); |
138 | 138 | ||
139 | } | 139 | } |
140 | void CategorySelectDialog::clicked ( QListViewItem * it ) | 140 | void CategorySelectDialog::clicked ( QListViewItem * it ) |
141 | { | 141 | { |
142 | if ( ! it ) | 142 | if ( ! it ) |
143 | return; | 143 | return; |
144 | QCheckListItem *i = (QCheckListItem *) it; | 144 | QCheckListItem *i = (QCheckListItem *) it; |
145 | qDebug("click %d ", i->isOn()); | ||
146 | if ( !i->isOn() && i==mColorItem) { | 145 | if ( !i->isOn() && i==mColorItem) { |
147 | setColorItem( 0); | 146 | setColorItem( 0); |
148 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 147 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); |
149 | while (item) { | 148 | while (item) { |
150 | if (item->isOn()) { | 149 | if (item->isOn()) { |
151 | setColorItem( item ); | 150 | setColorItem( item ); |
152 | break; | 151 | break; |
153 | } | 152 | } |
154 | item = (QCheckListItem *)item->nextSibling(); | 153 | item = (QCheckListItem *)item->nextSibling(); |
155 | } | 154 | } |
156 | } else if ( i->isOn() && !mColorItem) { | 155 | } else if ( i->isOn() && !mColorItem) { |
157 | setColorItem( i); | 156 | setColorItem( i); |
158 | } | 157 | } |
159 | } | 158 | } |
160 | void CategorySelectDialog::setColorItem( QCheckListItem * newColorItem ) | 159 | void CategorySelectDialog::setColorItem( QCheckListItem * newColorItem ) |
161 | { | 160 | { |
162 | if ( !mColorEnabled ) | 161 | if ( !mColorEnabled ) |
163 | return; | 162 | return; |
164 | if ( mColorItem == newColorItem) | 163 | if ( mColorItem == newColorItem) |
165 | return; | 164 | return; |
166 | if ( mColorItem ) { | 165 | if ( mColorItem ) { |
167 | mColorItem->setPixmap ( 0, QPixmap() ); | 166 | mColorItem->setPixmap ( 0, QPixmap() ); |
168 | mColorItem = 0; | 167 | mColorItem = 0; |
169 | } | 168 | } |
170 | if ( newColorItem ) { | 169 | if ( newColorItem ) { |
171 | QPixmap pix (newColorItem->height()/2, newColorItem->height()/2 ); | 170 | QPixmap pix (newColorItem->height()/2, newColorItem->height()/2 ); |
172 | pix.fill(Qt::blue ); | 171 | pix.fill(Qt::red ); |
173 | newColorItem->setPixmap ( 0, pix ); | 172 | newColorItem->setPixmap ( 0, pix ); |
174 | mColorItem = newColorItem; | 173 | mColorItem = newColorItem; |
175 | } | 174 | } |
176 | } | 175 | } |
177 | void CategorySelectDialog::slotApply() | 176 | void CategorySelectDialog::slotApply() |
178 | { | 177 | { |
179 | QStringList categories; | 178 | QStringList categories; |
180 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 179 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); |
181 | QString colcat; | 180 | QString colcat; |
182 | while (item) { | 181 | while (item) { |
183 | if (item->isOn()) { | 182 | if (item->isOn()) { |
184 | if ( item == mColorItem) | 183 | if ( item == mColorItem) |
185 | colcat = item->text(); | 184 | colcat = item->text(); |
186 | else | 185 | else |
187 | categories.append(item->text()); | 186 | categories.append(item->text()); |
188 | } | 187 | } |
189 | item = (QCheckListItem *)item->nextSibling(); | 188 | item = (QCheckListItem *)item->nextSibling(); |
190 | } | 189 | } |
191 | categories.sort(); | 190 | categories.sort(); |
192 | if ( ! colcat.isEmpty() ) | 191 | if ( ! colcat.isEmpty() ) |
193 | categories.prepend( colcat ); | 192 | categories.prepend( colcat ); |
194 | QString categoriesStr = categories.join(","); | 193 | QString categoriesStr = categories.join(","); |
195 | 194 | ||
196 | mCategoryList = categories; | 195 | mCategoryList = categories; |