summaryrefslogtreecommitdiffabout
path: root/libkdepim/categoryselectdialog.cpp
Unidiff
Diffstat (limited to 'libkdepim/categoryselectdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/categoryselectdialog.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp
index 7b0aced..943d35c 100644
--- a/libkdepim/categoryselectdialog.cpp
+++ b/libkdepim/categoryselectdialog.cpp
@@ -1,173 +1,173 @@
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 29
30 30
31#include <libkdepim/categoryeditdialog.h> 31#include <libkdepim/categoryeditdialog.h>
32#include "categoryselectdialog.h" 32#include "categoryselectdialog.h"
33 33
34#include "kpimprefs.h" 34#include "kpimprefs.h"
35 35
36using namespace KPIM; 36using namespace KPIM;
37 37
38CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, 38CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent,
39 const char* name, 39 const char* name,
40 bool modal, WFlags fl ) 40 bool modal, WFlags fl )
41 : CategorySelectDialog_base( parent, name, true, fl ), 41 : CategorySelectDialog_base( parent, name, true, fl ),
42 mPrefs( prefs ) 42 mPrefs( prefs )
43{ 43{
44 mCategories->header()->hide(); 44 mCategories->header()->hide();
45 45
46 setCategories(); 46 setCategories();
47 47
48 connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog())); 48 connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog()));
49 if ( qApp->desktop()->height() < 321 ) 49 if ( qApp->desktop()->height() < 321 )
50 setMaximumHeight( QApplication::desktop()->height() - 50 ); 50 setMaximumHeight( QApplication::desktop()->height() - 50 );
51 else 51 else
52 setMaximumHeight( QApplication::desktop()->height() - 80 ); 52 setMaximumHeight( QApplication::desktop()->height() - 80 );
53 if ( QApplication::desktop()->width() > 460 ) 53 if ( QApplication::desktop()->width() > 460 )
54 resize( 260, 360 ); 54 resize( 260, 360 );
55} 55}
56void CategorySelectDialog::editCategoriesDialog() 56void CategorySelectDialog::editCategoriesDialog()
57{ 57{
58 KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); 58 KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this );
59 59
60 ced->exec(); 60 ced->exec();
61 delete ced; 61 delete ced;
62 setCategories(); 62 setCategories();
63} 63}
64void CategorySelectDialog::setCategories() 64void CategorySelectDialog::setCategories()
65{ 65{
66 mCategories->clear(); 66 mCategories->clear();
67 mCategoryList.clear(); 67 mCategoryList.clear();
68 68
69 QStringList::Iterator it; 69 QStringList::Iterator it;
70 70
71 for (it = mPrefs->mCustomCategories.begin(); 71 for (it = mPrefs->mCustomCategories.begin();
72 it != mPrefs->mCustomCategories.end(); ++it ) { 72 it != mPrefs->mCustomCategories.end(); ++it ) {
73 new QCheckListItem(mCategories,*it,QCheckListItem::CheckBox); 73 new QCheckListItem(mCategories,*it,QCheckListItem::CheckBox);
74 } 74 }
75} 75}
76 76
77CategorySelectDialog::~CategorySelectDialog() 77CategorySelectDialog::~CategorySelectDialog()
78{ 78{
79} 79}
80 80
81void CategorySelectDialog::setSelected(const QStringList &selList) 81void CategorySelectDialog::setSelected(const QStringList &selList)
82{ 82{
83 clear(); 83 clear();
84 84
85 QStringList::ConstIterator it; 85 QStringList::ConstIterator it;
86 QStringList notFound; 86 QStringList notFound;
87 bool found = false; 87 bool found = false;
88 for (it=selList.begin();it!=selList.end();++it) { 88 for (it=selList.begin();it!=selList.end();++it) {
89 //qDebug(" CategorySelectDialog::setSelected("); 89 //qDebug(" CategorySelectDialog::setSelected(");
90 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 90 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
91 while (item) { 91 while (item) {
92 if (item->text() == *it) { 92 if (item->text() == *it) {
93 item->setOn(true); 93 item->setOn(true);
94 found = true; 94 found = true;
95 break; 95 break;
96 } 96 }
97 item = (QCheckListItem *)item->nextSibling(); 97 item = (QCheckListItem *)item->nextSibling();
98 } 98 }
99// if ( ! found ) { 99// if ( ! found ) {
100 100
101//emit updateCategoriesGlobal(); 101//emit updateCategoriesGlobal();
102// QMessageBox::information( this, "KO/E: Information!", 102// QMessageBox::information( this, "KO/E: Information!",
103// "Categories found, which were not\n" 103// "Categories found, which were not\n"
104// "in list of categories!\n" 104// "in list of categories!\n"
105// "message", 105// "message",
106// "OK", "", 0, 106// "OK", "", 0,
107// 0, 1 ); 107// 0, 1 );
108// setSelected(selList); 108// setSelected(selList);
109// return; 109// return;
110// } 110// }
111 } 111 }
112} 112}
113 113
114QStringList CategorySelectDialog::selectedCategories() const 114QStringList CategorySelectDialog::selectedCategories() const
115{ 115{
116 return mCategoryList; 116 return mCategoryList;
117} 117}
118 118
119void CategorySelectDialog::slotApply() 119void CategorySelectDialog::slotApply()
120{ 120{
121 QStringList categories; 121 QStringList categories;
122 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 122 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
123 while (item) { 123 while (item) {
124 if (item->isOn()) { 124 if (item->isOn()) {
125 categories.append(item->text()); 125 categories.append(item->text());
126 } 126 }
127 item = (QCheckListItem *)item->nextSibling(); 127 item = (QCheckListItem *)item->nextSibling();
128 } 128 }
129 129
130 QString categoriesStr = categories.join(","); 130 QString categoriesStr = categories.join(",");
131 131
132 mCategoryList = categories; 132 mCategoryList = categories;
133 133
134 emit categoriesSelected(categories); 134 emit categoriesSelected(categories);
135 emit categoriesSelected(categoriesStr); 135 emit categoriesSelected(categoriesStr);
136} 136}
137void CategorySelectDialog::accept() 137void CategorySelectDialog::accept()
138{ 138{
139 slotOk(); 139 slotOk();
140} 140}
141 141
142void CategorySelectDialog::slotOk() 142void CategorySelectDialog::slotOk()
143{ 143{
144 slotApply(); 144 slotApply();
145 QDialog::accept(); 145 QDialog::accept();
146} 146}
147 147
148void CategorySelectDialog::clear() 148void CategorySelectDialog::clear()
149{ 149{
150 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 150 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
151 while (item) { 151 while (item) {
152 item->setOn(false); 152 item->setOn(false);
153 item = (QCheckListItem *)item->nextSibling(); 153 item = (QCheckListItem *)item->nextSibling();
154 } 154 }
155} 155}
156 156
157void CategorySelectDialog::updateCategoryConfig() 157void CategorySelectDialog::updateCategoryConfig()
158{ 158{
159 QStringList selected; 159 QStringList selected;
160 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 160 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
161 while (item) { 161 while (item) {
162 if (item->isOn()) { 162 if (item->isOn()) {
163 selected.append(item->text()); 163 selected.append(item->text());
164 } 164 }
165 item = (QCheckListItem *)item->nextSibling(); 165 item = (QCheckListItem *)item->nextSibling();
166 } 166 }
167 167
168 setCategories(); 168 setCategories();
169 169
170 setSelected(selected); 170 setSelected(selected);
171} 171}
172 172
173#include "categoryselectdialog.moc" 173//#include "categoryselectdialog.moc"