summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/categoryselectdialog.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp
index 4d80726..974752c 100644
--- a/libkdepim/categoryselectdialog.cpp
+++ b/libkdepim/categoryselectdialog.cpp
@@ -41,49 +41,52 @@ CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent,
41 bool modal, WFlags fl ) 41 bool modal, WFlags fl )
42 : CategorySelectDialog_base( parent, name, true, fl ), 42 : CategorySelectDialog_base( parent, name, true, fl ),
43 mPrefs( prefs ) 43 mPrefs( prefs )
44{ 44{
45 mColorItem = 0; 45 mColorItem = 0;
46 mColorEnabled = false; 46 mColorEnabled = false;
47 mCategories->header()->hide(); 47 mCategories->header()->hide();
48 48
49 setCategories(); 49 setCategories();
50 50
51 connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog())); 51 connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog()));
52 if ( QApplication::desktop()->width() > 460 ) 52 if ( QApplication::desktop()->width() > 460 )
53 resize( 300, 360 ); 53 resize( 300, 360 );
54 else 54 else
55 showMaximized(); 55 showMaximized();
56 connect( mSetColorCat, SIGNAL( clicked() ), this, SLOT( setColorCat() ) ); 56 connect( mSetColorCat, SIGNAL( clicked() ), this, SLOT( setColorCat() ) );
57 // connect( mCategories, SIGNAL( clicked(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); 57 // connect( mCategories, SIGNAL( clicked(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) );
58} 58}
59void CategorySelectDialog::editCategoriesDialog() 59void CategorySelectDialog::editCategoriesDialog()
60{ 60{
61 KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); 61 KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this );
62 62
63 ced->exec(); 63 ced->exec();
64 delete ced; 64 delete ced;
65 slotApply();
66 QStringList temp = mCategoryList;
65 setCategories(); 67 setCategories();
68 setSelected( temp );
66} 69}
67void CategorySelectDialog::setCategories() 70void CategorySelectDialog::setCategories()
68{ 71{
69 mColorItem = 0; 72 mColorItem = 0;
70 mCategories->clear(); 73 mCategories->clear();
71 mCategoryList.clear(); 74 mCategoryList.clear();
72 75
73 QStringList::Iterator it; 76 QStringList::Iterator it;
74 for (it = mPrefs->mCustomCategories.begin(); 77 for (it = mPrefs->mCustomCategories.begin();
75 it != mPrefs->mCustomCategories.end(); ++it ) { 78 it != mPrefs->mCustomCategories.end(); ++it ) {
76 CategorySelectItem * item = new CategorySelectItem(mCategories,*it,QCheckListItem::CheckBox); 79 CategorySelectItem * item = new CategorySelectItem(mCategories,*it,QCheckListItem::CheckBox);
77 QObject::connect( item, SIGNAL( stateChanged(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); 80 QObject::connect( item, SIGNAL( stateChanged(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) );
78 81
79 } 82 }
80} 83}
81 84
82CategorySelectDialog::~CategorySelectDialog() 85CategorySelectDialog::~CategorySelectDialog()
83{ 86{
84} 87}
85 88
86void CategorySelectDialog::setSelected(const QStringList &selList) 89void CategorySelectDialog::setSelected(const QStringList &selList)
87{ 90{
88 clear(); 91 clear();
89 92
@@ -171,63 +174,63 @@ void CategorySelectDialog::setColorItem( QCheckListItem * newColorItem )
171 if ( newColorItem ) { 174 if ( newColorItem ) {
172 QPixmap pix (newColorItem->height()/2, newColorItem->height()/2 ); 175 QPixmap pix (newColorItem->height()/2, newColorItem->height()/2 );
173 pix.fill(Qt::red ); 176 pix.fill(Qt::red );
174 newColorItem->setPixmap ( 0, pix ); 177 newColorItem->setPixmap ( 0, pix );
175 mColorItem = newColorItem; 178 mColorItem = newColorItem;
176 } 179 }
177} 180}
178void CategorySelectDialog::slotApply() 181void CategorySelectDialog::slotApply()
179{ 182{
180 QStringList categories; 183 QStringList categories;
181 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 184 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
182 QString colcat; 185 QString colcat;
183 while (item) { 186 while (item) {
184 if (item->isOn()) { 187 if (item->isOn()) {
185 if ( item == mColorItem) 188 if ( item == mColorItem)
186 colcat = item->text(); 189 colcat = item->text();
187 else 190 else
188 categories.append(item->text()); 191 categories.append(item->text());
189 } 192 }
190 item = (QCheckListItem *)item->nextSibling(); 193 item = (QCheckListItem *)item->nextSibling();
191 } 194 }
192 categories.sort(); 195 categories.sort();
193 if ( ! colcat.isEmpty() ) 196 if ( ! colcat.isEmpty() )
194 categories.prepend( colcat ); 197 categories.prepend( colcat );
195 QString categoriesStr = categories.join(","); 198 // QString categoriesStr = categories.join(",");
196 199
197 mCategoryList = categories; 200 mCategoryList = categories;
198 201
199 emit categoriesSelected(categories);
200 emit categoriesSelected(categoriesStr);
201} 202}
202void CategorySelectDialog::accept() 203void CategorySelectDialog::accept()
203{ 204{
204 slotOk(); 205 slotOk();
205} 206}
206 207
207void CategorySelectDialog::slotOk() 208void CategorySelectDialog::slotOk()
208{ 209{
209 slotApply(); 210 slotApply();
211 emit categoriesSelected(mCategoryList);
212 emit categoriesSelected(mCategoryList.join(","));
210 QDialog::accept(); 213 QDialog::accept();
211} 214}
212 215
213void CategorySelectDialog::clear() 216void CategorySelectDialog::clear()
214{ 217{
215 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 218 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
216 while (item) { 219 while (item) {
217 item->setOn(false); 220 item->setOn(false);
218 item = (QCheckListItem *)item->nextSibling(); 221 item = (QCheckListItem *)item->nextSibling();
219 } 222 }
220} 223}
221 224
222void CategorySelectDialog::updateCategoryConfig() 225void CategorySelectDialog::updateCategoryConfig()
223{ 226{
224 QStringList selected; 227 QStringList selected;
225 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 228 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
226 while (item) { 229 while (item) {
227 if (item->isOn()) { 230 if (item->isOn()) {
228 selected.append(item->text()); 231 selected.append(item->text());
229 } 232 }
230 item = (QCheckListItem *)item->nextSibling(); 233 item = (QCheckListItem *)item->nextSibling();
231 } 234 }
232 235
233 setCategories(); 236 setCategories();