Diffstat (limited to 'libkdepim/categoryselectdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkdepim/categoryselectdialog.cpp | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp index 2a9b43e..4f72880 100644 --- a/libkdepim/categoryselectdialog.cpp +++ b/libkdepim/categoryselectdialog.cpp | |||
@@ -18,30 +18,33 @@ | |||
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlistview.h> | 24 | #include <q3listview.h> |
25 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
26 | #include <qheader.h> | 26 | #include <q3header.h> |
27 | #include <qapp.h> | 27 | #include <qapplication.h> |
28 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
29 | //Added by qt3to4: | ||
30 | #include <QPixmap> | ||
31 | #include <QDesktopWidget> | ||
29 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
30 | 33 | ||
31 | 34 | ||
32 | #include "categoryeditdialog.h" | 35 | #include "categoryeditdialog.h" |
33 | #include "categoryselectdialog.h" | 36 | #include "categoryselectdialog.h" |
34 | 37 | ||
35 | #include "kpimprefs.h" | 38 | #include "kpimprefs.h" |
36 | 39 | ||
37 | using namespace KPIM; | 40 | using namespace KPIM; |
38 | 41 | ||
39 | CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, | 42 | CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, |
40 | const char* name, | 43 | const char* name, |
41 | bool modal, WFlags fl ) | 44 | bool modal, Qt::WFlags fl ) |
42 | : CategorySelectDialog_base( parent, name, true, fl ), | 45 | : CategorySelectDialog_base( parent, name, true, fl ), |
43 | mPrefs( prefs ) | 46 | mPrefs( prefs ) |
44 | { | 47 | { |
45 | Q_UNUSED( modal ); | 48 | Q_UNUSED( modal ); |
46 | mColorItem = 0; | 49 | mColorItem = 0; |
47 | mColorEnabled = false; | 50 | mColorEnabled = false; |
@@ -78,14 +81,14 @@ void CategorySelectDialog::setCategories() | |||
78 | mCategories->clear(); | 81 | mCategories->clear(); |
79 | mCategoryList.clear(); | 82 | mCategoryList.clear(); |
80 | 83 | ||
81 | QStringList::Iterator it; | 84 | QStringList::Iterator it; |
82 | for (it = mPrefs->mCustomCategories.begin(); | 85 | for (it = mPrefs->mCustomCategories.begin(); |
83 | it != mPrefs->mCustomCategories.end(); ++it ) { | 86 | it != mPrefs->mCustomCategories.end(); ++it ) { |
84 | CategorySelectItem * item = new CategorySelectItem(mCategories,*it,QCheckListItem::CheckBox); | 87 | CategorySelectItem * item = new CategorySelectItem(mCategories,*it,Q3CheckListItem::CheckBox); |
85 | QObject::connect( item, SIGNAL( stateChanged(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); | 88 | QObject::connect( item, SIGNAL( stateChanged(Q3ListViewItem *) ), this, SLOT( clicked(Q3ListViewItem *) ) ); |
86 | 89 | ||
87 | } | 90 | } |
88 | } | 91 | } |
89 | 92 | ||
90 | CategorySelectDialog::~CategorySelectDialog() | 93 | CategorySelectDialog::~CategorySelectDialog() |
91 | { | 94 | { |
@@ -97,22 +100,22 @@ void CategorySelectDialog::setSelected(const QStringList &selList) | |||
97 | 100 | ||
98 | QStringList::ConstIterator it; | 101 | QStringList::ConstIterator it; |
99 | QStringList notFound; | 102 | QStringList notFound; |
100 | bool found = false; | 103 | bool found = false; |
101 | for (it=selList.begin();it!=selList.end();++it) { | 104 | for (it=selList.begin();it!=selList.end();++it) { |
102 | //qDebug(" CategorySelectDialog::setSelected("); | 105 | //qDebug(" CategorySelectDialog::setSelected("); |
103 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 106 | Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild(); |
104 | while (item) { | 107 | while (item) { |
105 | if (item->text() == *it) { | 108 | if (item->text() == *it) { |
106 | item->setOn(true); | 109 | item->setOn(true); |
107 | if ( ! found ) | 110 | if ( ! found ) |
108 | setColorItem( item ); | 111 | setColorItem( item ); |
109 | found = true; | 112 | found = true; |
110 | break; | 113 | break; |
111 | } | 114 | } |
112 | item = (QCheckListItem *)item->nextSibling(); | 115 | item = (Q3CheckListItem *)item->nextSibling(); |
113 | } | 116 | } |
114 | // if ( ! found ) { | 117 | // if ( ! found ) { |
115 | 118 | ||
116 | //emit updateCategoriesGlobal(); | 119 | //emit updateCategoriesGlobal(); |
117 | // QMessageBox::information( this, "KO/E: Information!", | 120 | // QMessageBox::information( this, "KO/E: Information!", |
118 | // "Categories found, which were not\n" | 121 | // "Categories found, which were not\n" |
@@ -134,42 +137,42 @@ void CategorySelectDialog::setColorEnabled() | |||
134 | { | 137 | { |
135 | mColorEnabled = true; | 138 | mColorEnabled = true; |
136 | mSetColorCat->show(); | 139 | mSetColorCat->show(); |
137 | } | 140 | } |
138 | void CategorySelectDialog::setColorCat() | 141 | void CategorySelectDialog::setColorCat() |
139 | { | 142 | { |
140 | QCheckListItem * newColorItem = (QCheckListItem * )mCategories->currentItem (); | 143 | Q3CheckListItem * newColorItem = (Q3CheckListItem * )mCategories->currentItem (); |
141 | if ( !newColorItem ) { | 144 | if ( !newColorItem ) { |
142 | KMessageBox::error(this,i18n("There is no current item.")); | 145 | KMessageBox::error(this,i18n("There is no current item.")); |
143 | return; | 146 | return; |
144 | } | 147 | } |
145 | if ( !newColorItem->isOn() ) | 148 | if ( !newColorItem->isOn() ) |
146 | newColorItem->setOn( true ); | 149 | newColorItem->setOn( true ); |
147 | setColorItem( newColorItem ); | 150 | setColorItem( newColorItem ); |
148 | 151 | ||
149 | } | 152 | } |
150 | void CategorySelectDialog::clicked ( QListViewItem * it ) | 153 | void CategorySelectDialog::clicked ( Q3ListViewItem * it ) |
151 | { | 154 | { |
152 | if ( ! it ) | 155 | if ( ! it ) |
153 | return; | 156 | return; |
154 | QCheckListItem *i = (QCheckListItem *) it; | 157 | Q3CheckListItem *i = (Q3CheckListItem *) it; |
155 | if ( !i->isOn() && i==mColorItem) { | 158 | if ( !i->isOn() && i==mColorItem) { |
156 | setColorItem( 0); | 159 | setColorItem( 0); |
157 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 160 | Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild(); |
158 | while (item) { | 161 | while (item) { |
159 | if (item->isOn()) { | 162 | if (item->isOn()) { |
160 | setColorItem( item ); | 163 | setColorItem( item ); |
161 | break; | 164 | break; |
162 | } | 165 | } |
163 | item = (QCheckListItem *)item->nextSibling(); | 166 | item = (Q3CheckListItem *)item->nextSibling(); |
164 | } | 167 | } |
165 | } else if ( i->isOn() && !mColorItem) { | 168 | } else if ( i->isOn() && !mColorItem) { |
166 | setColorItem( i); | 169 | setColorItem( i); |
167 | } | 170 | } |
168 | } | 171 | } |
169 | void CategorySelectDialog::setColorItem( QCheckListItem * newColorItem ) | 172 | void CategorySelectDialog::setColorItem( Q3CheckListItem * newColorItem ) |
170 | { | 173 | { |
171 | if ( !mColorEnabled ) | 174 | if ( !mColorEnabled ) |
172 | return; | 175 | return; |
173 | if ( mColorItem == newColorItem) | 176 | if ( mColorItem == newColorItem) |
174 | return; | 177 | return; |
175 | if ( mColorItem ) { | 178 | if ( mColorItem ) { |
@@ -183,22 +186,22 @@ void CategorySelectDialog::setColorItem( QCheckListItem * newColorItem ) | |||
183 | mColorItem = newColorItem; | 186 | mColorItem = newColorItem; |
184 | } | 187 | } |
185 | } | 188 | } |
186 | void CategorySelectDialog::slotApply() | 189 | void CategorySelectDialog::slotApply() |
187 | { | 190 | { |
188 | QStringList categories; | 191 | QStringList categories; |
189 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 192 | Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild(); |
190 | QString colcat; | 193 | QString colcat; |
191 | while (item) { | 194 | while (item) { |
192 | if (item->isOn()) { | 195 | if (item->isOn()) { |
193 | if ( item == mColorItem) | 196 | if ( item == mColorItem) |
194 | colcat = item->text(); | 197 | colcat = item->text(); |
195 | else | 198 | else |
196 | categories.append(item->text()); | 199 | categories.append(item->text()); |
197 | } | 200 | } |
198 | item = (QCheckListItem *)item->nextSibling(); | 201 | item = (Q3CheckListItem *)item->nextSibling(); |
199 | } | 202 | } |
200 | categories.sort(); | 203 | categories.sort(); |
201 | if ( ! colcat.isEmpty() ) | 204 | if ( ! colcat.isEmpty() ) |
202 | categories.prepend( colcat ); | 205 | categories.prepend( colcat ); |
203 | // QString categoriesStr = categories.join(","); | 206 | // QString categoriesStr = categories.join(","); |
204 | 207 | ||
@@ -217,28 +220,28 @@ void CategorySelectDialog::slotOk() | |||
217 | emit categoriesSelected(mCategoryList.join(",")); | 220 | emit categoriesSelected(mCategoryList.join(",")); |
218 | QDialog::accept(); | 221 | QDialog::accept(); |
219 | } | 222 | } |
220 | 223 | ||
221 | void CategorySelectDialog::clear() | 224 | void CategorySelectDialog::clear() |
222 | { | 225 | { |
223 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 226 | Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild(); |
224 | while (item) { | 227 | while (item) { |
225 | item->setOn(false); | 228 | item->setOn(false); |
226 | item = (QCheckListItem *)item->nextSibling(); | 229 | item = (Q3CheckListItem *)item->nextSibling(); |
227 | } | 230 | } |
228 | } | 231 | } |
229 | 232 | ||
230 | void CategorySelectDialog::updateCategoryConfig() | 233 | void CategorySelectDialog::updateCategoryConfig() |
231 | { | 234 | { |
232 | QStringList selected; | 235 | QStringList selected; |
233 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 236 | Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild(); |
234 | while (item) { | 237 | while (item) { |
235 | if (item->isOn()) { | 238 | if (item->isOn()) { |
236 | selected.append(item->text()); | 239 | selected.append(item->text()); |
237 | } | 240 | } |
238 | item = (QCheckListItem *)item->nextSibling(); | 241 | item = (Q3CheckListItem *)item->nextSibling(); |
239 | } | 242 | } |
240 | 243 | ||
241 | setCategories(); | 244 | setCategories(); |
242 | 245 | ||
243 | setSelected(selected); | 246 | setSelected(selected); |
244 | } | 247 | } |