summaryrefslogtreecommitdiffabout
path: root/libkdepim/categoryselectdialog.cpp
Unidiff
Diffstat (limited to 'libkdepim/categoryselectdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/categoryselectdialog.cpp43
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
@@ -20,13 +20,16 @@
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"
@@ -37,9 +40,9 @@
37using namespace KPIM; 40using namespace KPIM;
38 41
39CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, 42CategorySelectDialog::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 );
@@ -80,10 +83,10 @@ void CategorySelectDialog::setCategories()
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
@@ -99,18 +102,18 @@ void CategorySelectDialog::setSelected(const QStringList &selList)
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();
@@ -136,9 +139,9 @@ void CategorySelectDialog::setColorEnabled()
136 mSetColorCat->show(); 139 mSetColorCat->show();
137} 140}
138void CategorySelectDialog::setColorCat() 141void 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 }
@@ -146,28 +149,28 @@ void CategorySelectDialog::setColorCat()
146 newColorItem->setOn( true ); 149 newColorItem->setOn( true );
147 setColorItem( newColorItem ); 150 setColorItem( newColorItem );
148 151
149} 152}
150void CategorySelectDialog::clicked ( QListViewItem * it ) 153void 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}
169void CategorySelectDialog::setColorItem( QCheckListItem * newColorItem ) 172void CategorySelectDialog::setColorItem( Q3CheckListItem * newColorItem )
170{ 173{
171 if ( !mColorEnabled ) 174 if ( !mColorEnabled )
172 return; 175 return;
173 if ( mColorItem == newColorItem) 176 if ( mColorItem == newColorItem)
@@ -185,18 +188,18 @@ void CategorySelectDialog::setColorItem( QCheckListItem * newColorItem )
185} 188}
186void CategorySelectDialog::slotApply() 189void 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 );
@@ -219,24 +222,24 @@ void CategorySelectDialog::slotOk()
219} 222}
220 223
221void CategorySelectDialog::clear() 224void 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
230void CategorySelectDialog::updateCategoryConfig() 233void 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