author | zautrix <zautrix> | 2005-11-26 12:38:58 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-26 12:38:58 (UTC) |
commit | 854d4a0c686962cd73ac7418b5fbf4b2d73adab7 (patch) (unidiff) | |
tree | 864a872db7d3787bac151da8257ae132b04ec5e3 /libkdepim/categoryselectdialog.cpp | |
parent | 85bd9f05564e566b296c949ce6e214ebdbf573ac (diff) | |
download | kdepimpi-854d4a0c686962cd73ac7418b5fbf4b2d73adab7.zip kdepimpi-854d4a0c686962cd73ac7418b5fbf4b2d73adab7.tar.gz kdepimpi-854d4a0c686962cd73ac7418b5fbf4b2d73adab7.tar.bz2 |
sync
Diffstat (limited to 'libkdepim/categoryselectdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkdepim/categoryselectdialog.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp index a4e0024..2a9b43e 100644 --- a/libkdepim/categoryselectdialog.cpp +++ b/libkdepim/categoryselectdialog.cpp | |||
@@ -1,140 +1,141 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
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 | ||
37 | using namespace KPIM; | 37 | using namespace KPIM; |
38 | 38 | ||
39 | CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, | 39 | CategorySelectDialog::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 | Q_UNUSED( modal ); | ||
45 | mColorItem = 0; | 46 | mColorItem = 0; |
46 | mColorEnabled = false; | 47 | mColorEnabled = false; |
47 | mCategories->header()->hide(); | 48 | mCategories->header()->hide(); |
48 | 49 | ||
49 | setCategories(); | 50 | setCategories(); |
50 | 51 | ||
51 | connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog())); | 52 | connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog())); |
52 | if ( QApplication::desktop()->width() > 460 ) | 53 | if ( QApplication::desktop()->width() > 460 ) |
53 | resize( 300, 360 ); | 54 | resize( 300, 360 ); |
54 | else | 55 | else |
55 | showMaximized(); | 56 | showMaximized(); |
56 | connect( mSetColorCat, SIGNAL( clicked() ), this, SLOT( setColorCat() ) ); | 57 | connect( mSetColorCat, SIGNAL( clicked() ), this, SLOT( setColorCat() ) ); |
57 | // connect( mCategories, SIGNAL( clicked(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); | 58 | // connect( mCategories, SIGNAL( clicked(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); |
58 | #ifndef DESKTOP_VERSION | 59 | #ifndef DESKTOP_VERSION |
59 | mButtonOk->hide(); | 60 | mButtonOk->hide(); |
60 | mButtonCancel->hide(); | 61 | mButtonCancel->hide(); |
61 | #endif | 62 | #endif |
62 | } | 63 | } |
63 | void CategorySelectDialog::editCategoriesDialog() | 64 | void CategorySelectDialog::editCategoriesDialog() |
64 | { | 65 | { |
65 | KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); | 66 | KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); |
66 | 67 | ||
67 | ced->exec(); | 68 | ced->exec(); |
68 | delete ced; | 69 | delete ced; |
69 | slotApply(); | 70 | slotApply(); |
70 | QStringList temp = mCategoryList; | 71 | QStringList temp = mCategoryList; |
71 | setCategories(); | 72 | setCategories(); |
72 | setSelected( temp ); | 73 | setSelected( temp ); |
73 | } | 74 | } |
74 | void CategorySelectDialog::setCategories() | 75 | void CategorySelectDialog::setCategories() |
75 | { | 76 | { |
76 | mColorItem = 0; | 77 | mColorItem = 0; |
77 | mCategories->clear(); | 78 | mCategories->clear(); |
78 | mCategoryList.clear(); | 79 | mCategoryList.clear(); |
79 | 80 | ||
80 | QStringList::Iterator it; | 81 | QStringList::Iterator it; |
81 | for (it = mPrefs->mCustomCategories.begin(); | 82 | for (it = mPrefs->mCustomCategories.begin(); |
82 | it != mPrefs->mCustomCategories.end(); ++it ) { | 83 | it != mPrefs->mCustomCategories.end(); ++it ) { |
83 | CategorySelectItem * item = new CategorySelectItem(mCategories,*it,QCheckListItem::CheckBox); | 84 | CategorySelectItem * item = new CategorySelectItem(mCategories,*it,QCheckListItem::CheckBox); |
84 | QObject::connect( item, SIGNAL( stateChanged(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); | 85 | QObject::connect( item, SIGNAL( stateChanged(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); |
85 | 86 | ||
86 | } | 87 | } |
87 | } | 88 | } |
88 | 89 | ||
89 | CategorySelectDialog::~CategorySelectDialog() | 90 | CategorySelectDialog::~CategorySelectDialog() |
90 | { | 91 | { |
91 | } | 92 | } |
92 | 93 | ||
93 | void CategorySelectDialog::setSelected(const QStringList &selList) | 94 | void CategorySelectDialog::setSelected(const QStringList &selList) |
94 | { | 95 | { |
95 | clear(); | 96 | clear(); |
96 | 97 | ||
97 | QStringList::ConstIterator it; | 98 | QStringList::ConstIterator it; |
98 | QStringList notFound; | 99 | QStringList notFound; |
99 | bool found = false; | 100 | bool found = false; |
100 | for (it=selList.begin();it!=selList.end();++it) { | 101 | for (it=selList.begin();it!=selList.end();++it) { |
101 | //qDebug(" CategorySelectDialog::setSelected("); | 102 | //qDebug(" CategorySelectDialog::setSelected("); |
102 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 103 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); |
103 | while (item) { | 104 | while (item) { |
104 | if (item->text() == *it) { | 105 | if (item->text() == *it) { |
105 | item->setOn(true); | 106 | item->setOn(true); |
106 | if ( ! found ) | 107 | if ( ! found ) |
107 | setColorItem( item ); | 108 | setColorItem( item ); |
108 | found = true; | 109 | found = true; |
109 | break; | 110 | break; |
110 | } | 111 | } |
111 | item = (QCheckListItem *)item->nextSibling(); | 112 | item = (QCheckListItem *)item->nextSibling(); |
112 | } | 113 | } |
113 | // if ( ! found ) { | 114 | // if ( ! found ) { |
114 | 115 | ||
115 | //emit updateCategoriesGlobal(); | 116 | //emit updateCategoriesGlobal(); |
116 | // QMessageBox::information( this, "KO/E: Information!", | 117 | // QMessageBox::information( this, "KO/E: Information!", |
117 | // "Categories found, which were not\n" | 118 | // "Categories found, which were not\n" |
118 | // "in list of categories!\n" | 119 | // "in list of categories!\n" |
119 | // "message", | 120 | // "message", |
120 | // "OK", "", 0, | 121 | // "OK", "", 0, |
121 | // 0, 1 ); | 122 | // 0, 1 ); |
122 | // setSelected(selList); | 123 | // setSelected(selList); |
123 | // return; | 124 | // return; |
124 | // } | 125 | // } |
125 | } | 126 | } |
126 | } | 127 | } |
127 | 128 | ||
128 | QStringList CategorySelectDialog::selectedCategories() const | 129 | QStringList CategorySelectDialog::selectedCategories() const |
129 | { | 130 | { |
130 | return mCategoryList; | 131 | return mCategoryList; |
131 | } | 132 | } |
132 | void CategorySelectDialog::setColorEnabled() | 133 | void CategorySelectDialog::setColorEnabled() |
133 | { | 134 | { |
134 | mColorEnabled = true; | 135 | mColorEnabled = true; |
135 | mSetColorCat->show(); | 136 | mSetColorCat->show(); |
136 | } | 137 | } |
137 | void CategorySelectDialog::setColorCat() | 138 | void CategorySelectDialog::setColorCat() |
138 | { | 139 | { |
139 | QCheckListItem * newColorItem = (QCheckListItem * )mCategories->currentItem (); | 140 | QCheckListItem * newColorItem = (QCheckListItem * )mCategories->currentItem (); |
140 | if ( !newColorItem ) { | 141 | if ( !newColorItem ) { |