summaryrefslogtreecommitdiffabout
path: root/libkdepim/categoryselectdialog.cpp
Unidiff
Diffstat (limited to 'libkdepim/categoryselectdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/categoryselectdialog.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp
index 974752c..a4e0024 100644
--- a/libkdepim/categoryselectdialog.cpp
+++ b/libkdepim/categoryselectdialog.cpp
@@ -10,96 +10,100 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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 <qlistview.h>
25#include <qpushbutton.h> 25#include <qpushbutton.h>
26#include <qheader.h> 26#include <qheader.h>
27#include <qapp.h> 27#include <qapp.h>
28#include <qmessagebox.h> 28#include <qmessagebox.h>
29#include <kmessagebox.h> 29#include <kmessagebox.h>
30 30
31 31
32#include "categoryeditdialog.h" 32#include "categoryeditdialog.h"
33#include "categoryselectdialog.h" 33#include "categoryselectdialog.h"
34 34
35#include "kpimprefs.h" 35#include "kpimprefs.h"
36 36
37using namespace KPIM; 37using namespace KPIM;
38 38
39CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, 39CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent,
40 const char* name, 40 const char* name,
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#ifndef DESKTOP_VERSION
59 mButtonOk->hide();
60 mButtonCancel->hide();
61#endif
58} 62}
59void CategorySelectDialog::editCategoriesDialog() 63void CategorySelectDialog::editCategoriesDialog()
60{ 64{
61 KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); 65 KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this );
62 66
63 ced->exec(); 67 ced->exec();
64 delete ced; 68 delete ced;
65 slotApply(); 69 slotApply();
66 QStringList temp = mCategoryList; 70 QStringList temp = mCategoryList;
67 setCategories(); 71 setCategories();
68 setSelected( temp ); 72 setSelected( temp );
69} 73}
70void CategorySelectDialog::setCategories() 74void CategorySelectDialog::setCategories()
71{ 75{
72 mColorItem = 0; 76 mColorItem = 0;
73 mCategories->clear(); 77 mCategories->clear();
74 mCategoryList.clear(); 78 mCategoryList.clear();
75 79
76 QStringList::Iterator it; 80 QStringList::Iterator it;
77 for (it = mPrefs->mCustomCategories.begin(); 81 for (it = mPrefs->mCustomCategories.begin();
78 it != mPrefs->mCustomCategories.end(); ++it ) { 82 it != mPrefs->mCustomCategories.end(); ++it ) {
79 CategorySelectItem * item = new CategorySelectItem(mCategories,*it,QCheckListItem::CheckBox); 83 CategorySelectItem * item = new CategorySelectItem(mCategories,*it,QCheckListItem::CheckBox);
80 QObject::connect( item, SIGNAL( stateChanged(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); 84 QObject::connect( item, SIGNAL( stateChanged(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) );
81 85
82 } 86 }
83} 87}
84 88
85CategorySelectDialog::~CategorySelectDialog() 89CategorySelectDialog::~CategorySelectDialog()
86{ 90{
87} 91}
88 92
89void CategorySelectDialog::setSelected(const QStringList &selList) 93void CategorySelectDialog::setSelected(const QStringList &selList)
90{ 94{
91 clear(); 95 clear();
92 96
93 QStringList::ConstIterator it; 97 QStringList::ConstIterator it;
94 QStringList notFound; 98 QStringList notFound;
95 bool found = false; 99 bool found = false;
96 for (it=selList.begin();it!=selList.end();++it) { 100 for (it=selList.begin();it!=selList.end();++it) {
97 //qDebug(" CategorySelectDialog::setSelected("); 101 //qDebug(" CategorySelectDialog::setSelected(");
98 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 102 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
99 while (item) { 103 while (item) {
100 if (item->text() == *it) { 104 if (item->text() == *it) {
101 item->setOn(true); 105 item->setOn(true);
102 if ( ! found ) 106 if ( ! found )
103 setColorItem( item ); 107 setColorItem( item );
104 found = true; 108 found = true;
105 break; 109 break;