summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--korganizer/koeditorgeneral.cpp1
-rw-r--r--korganizer/kotodoview.cpp7
-rw-r--r--libkdepim/categoryselectdialog.cpp88
-rw-r--r--libkdepim/categoryselectdialog.h8
-rw-r--r--libkdepim/categoryselectdialog_base.cpp9
-rw-r--r--libkdepim/categoryselectdialog_base.h1
7 files changed, 103 insertions, 15 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 523c054..ee37492 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1203,28 +1203,32 @@
1203{ "Display all opened","Zeige alle geöffnet" }, 1203{ "Display all opened","Zeige alle geöffnet" },
1204{ "Display all closed","Zeige alle geschlossen" }, 1204{ "Display all closed","Zeige alle geschlossen" },
1205{ "Display all flat","Zeige alle flach" }, 1205{ "Display all flat","Zeige alle flach" },
1206{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, 1206{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" },
1207{ "Default todo done color:","Standard Todo erledigt Farbe" }, 1207{ "Default todo done color:","Standard Todo erledigt Farbe" },
1208{ "Select week %1-%2","Wähle Woche %1-%2" }, 1208{ "Select week %1-%2","Wähle Woche %1-%2" },
1209{ "Select Week","Wähle Woche" }, 1209{ "Select Week","Wähle Woche" },
1210{ "Set alarm for selected...","Setze Alarm für Selekt..." }, 1210{ "Set alarm for selected...","Setze Alarm für Selekt..." },
1211{ "Set Alarm!","Setze Alarm!" }, 1211{ "Set Alarm!","Setze Alarm!" },
1212{ "Canged alarm for %1 items","Alarm für %1 Items geändert" }, 1212{ "Canged alarm for %1 items","Alarm für %1 Items geändert" },
1213{ " and "," und " }, 1213{ " and "," und " },
1214{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, 1214{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" },
1215{ "Mail to selected","Mail an Ausgewählte" }, 1215{ "Mail to selected","Mail an Ausgewählte" },
1216{ "Mail to all","Mail an Alle" }, 1216{ "Mail to all","Mail an Alle" },
1217{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, 1217{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" },
1218{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, 1218{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" },
1219{ " on"," am" }, 1219{ " on"," am" },
1220{ " completed on "," erledigt am " }, 1220{ " completed on "," erledigt am " },
1221{ "Save as Event template","Speichere als Vorlage" }, 1221{ "Save as Event template","Speichere als Vorlage" },
1222{ "Load Event template","Lade Termin Vorlage" }, 1222{ "Load Event template","Lade Termin Vorlage" },
1223{ "Save as Journal template","Speichere als Journal Vorlage" }, 1223{ "Save as Journal template","Speichere als Journal Vorlage" },
1224{ "Insert Journal template","Füge Journal Vorlage ein" }, 1224{ "Insert Journal template","Füge Journal Vorlage ein" },
1225{ "Sub todos:<br>","Unter Todos:<br>" }, 1225{ "Sub todos:<br>","Unter Todos:<br>" },
1226{ "Parent todo:<br>","Über Todo:<br>" }, 1226{ "Parent todo:<br>","Über Todo:<br>" },
1227{ "Set current as color category","Setze Gewählte als Farbkategorie" },
1228{ "","" },
1229{ "","" },
1230{ "","" },
1227{ "","" }, 1231{ "","" },
1228{ "","" }, 1232{ "","" },
1229{ "","" }, 1233{ "","" },
1230{ "","" }, 1234{ "","" },
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index f5eb52e..496f125 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -100,48 +100,49 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
100 100
101 // mLocationEdit = new QLineEdit(parent); 101 // mLocationEdit = new QLineEdit(parent);
102 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 102 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
103 headerLayout->addWidget(mLocationEdit,2,1); 103 headerLayout->addWidget(mLocationEdit,2,1);
104 headerLayout->setColStretch( 1, 10); 104 headerLayout->setColStretch( 1, 10);
105} 105}
106void KOEditorGeneral::setFocusOn( int i ) 106void KOEditorGeneral::setFocusOn( int i )
107{ 107{
108 qApp->processEvents(); 108 qApp->processEvents();
109 if ( i == 1 ) { 109 if ( i == 1 ) {
110 mDescriptionEdit->setFocus(); 110 mDescriptionEdit->setFocus();
111 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 111 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
112 } 112 }
113 if ( i == 2 ) { 113 if ( i == 2 ) {
114 mSummaryEdit->setFocus(); 114 mSummaryEdit->setFocus();
115 } 115 }
116 116
117} 117}
118void KOEditorGeneral::editCategories() 118void KOEditorGeneral::editCategories()
119{ 119{
120 // qDebug("KOEditorGeneral::editCategories() "); 120 // qDebug("KOEditorGeneral::editCategories() ");
121 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 121 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
122 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 122 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
123 //KOGlobals::fitDialogToScreen( csd ); 123 //KOGlobals::fitDialogToScreen( csd );
124 csd->setColorEnabled();
124 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 125 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
125 csd->exec(); 126 csd->exec();
126 delete csd; 127 delete csd;
127} 128}
128void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 129void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
129{ 130{
130 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 131 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
131 132
132 mCategoriesButton = new QPushButton(parent); 133 mCategoriesButton = new QPushButton(parent);
133 mCategoriesButton->setText(i18n("Categories...")); 134 mCategoriesButton->setText(i18n("Categories..."));
134 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 135 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
135 categoriesLayout->addWidget(mCategoriesButton); 136 categoriesLayout->addWidget(mCategoriesButton);
136 137
137 mCategoriesLabel = new QLabel(parent); 138 mCategoriesLabel = new QLabel(parent);
138 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 139 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
139 categoriesLayout->addWidget(mCategoriesLabel,1); 140 categoriesLayout->addWidget(mCategoriesLabel,1);
140} 141}
141 142
142void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 143void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
143{ 144{
144 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 145 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
145 146
146 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 147 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
147 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 148 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 1a1bce5..3011458 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -940,53 +940,60 @@ void KOTodoView::setNewPercentage(int index)
940 940
941QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) 941QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
942{ 942{
943 QPopupMenu* tempMenu = new QPopupMenu (this); 943 QPopupMenu* tempMenu = new QPopupMenu (this);
944 QStringList checkedCategories = todoItem->todo()->categories (); 944 QStringList checkedCategories = todoItem->todo()->categories ();
945 945
946 tempMenu->setCheckable (true); 946 tempMenu->setCheckable (true);
947 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 947 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
948 it != KOPrefs::instance()->mCustomCategories.end (); 948 it != KOPrefs::instance()->mCustomCategories.end ();
949 ++it) { 949 ++it) {
950 int index = tempMenu->insertItem (*it); 950 int index = tempMenu->insertItem (*it);
951 mCategory[index] = *it; 951 mCategory[index] = *it;
952 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); 952 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
953 } 953 }
954 954
955 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 955 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
956 return tempMenu; 956 return tempMenu;
957 957
958 958
959} 959}
960void KOTodoView::changedCategories(int index) 960void KOTodoView::changedCategories(int index)
961{ 961{
962 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 962 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
963 QStringList categories = mActiveItem->todo()->categories (); 963 QStringList categories = mActiveItem->todo()->categories ();
964 QString colcat = categories.first();
964 if (categories.find (mCategory[index]) != categories.end ()) 965 if (categories.find (mCategory[index]) != categories.end ())
965 categories.remove (mCategory[index]); 966 categories.remove (mCategory[index]);
966 else 967 else
967 categories.insert (categories.end(), mCategory[index]); 968 categories.insert (categories.end(), mCategory[index]);
968 categories.sort (); 969 categories.sort ();
970 if ( !colcat.isEmpty() ) {
971 if ( categories.find ( colcat ) != categories.end () ) {
972 categories.remove( colcat );
973 categories.prepend( colcat );
974 }
975 }
969 mActiveItem->todo()->setCategories (categories); 976 mActiveItem->todo()->setCategories (categories);
970 mActiveItem->construct(); 977 mActiveItem->construct();
971 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 978 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
972 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 979 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
973 } 980 }
974} 981}
975void KOTodoView::itemDoubleClicked(QListViewItem *item) 982void KOTodoView::itemDoubleClicked(QListViewItem *item)
976{ 983{
977 if ( pendingSubtodo != 0 ) { 984 if ( pendingSubtodo != 0 ) {
978 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 985 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
979 } 986 }
980 pendingSubtodo = 0; 987 pendingSubtodo = 0;
981 if (!item) { 988 if (!item) {
982 newTodo(); 989 newTodo();
983 return; 990 return;
984 } 991 }
985 if ( KOPrefs::instance()->mEditOnDoubleClick ) 992 if ( KOPrefs::instance()->mEditOnDoubleClick )
986 editItem( item ); 993 editItem( item );
987 else 994 else
988 showItem( item , QPoint(), 0 ); 995 showItem( item , QPoint(), 0 );
989} 996}
990void KOTodoView::itemClicked(QListViewItem *item) 997void KOTodoView::itemClicked(QListViewItem *item)
991{ 998{
992 999
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp
index 7df9154..8b2bc4e 100644
--- a/libkdepim/categoryselectdialog.cpp
+++ b/libkdepim/categoryselectdialog.cpp
@@ -5,147 +5,213 @@
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 30
30 31
31#include "categoryeditdialog.h" 32#include "categoryeditdialog.h"
32#include "categoryselectdialog.h" 33#include "categoryselectdialog.h"
33 34
34#include "kpimprefs.h" 35#include "kpimprefs.h"
35 36
36using namespace KPIM; 37using namespace KPIM;
37 38
38CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, 39CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent,
39 const char* name, 40 const char* name,
40 bool modal, WFlags fl ) 41 bool modal, WFlags fl )
41 : CategorySelectDialog_base( parent, name, true, fl ), 42 : CategorySelectDialog_base( parent, name, true, fl ),
42 mPrefs( prefs ) 43 mPrefs( prefs )
43{ 44{
44 mCategories->header()->hide(); 45 mColorItem = 0;
46 mColorEnabled = false;
47 mCategories->header()->hide();
45 48
46 setCategories(); 49 setCategories();
47 50
48 connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog())); 51 connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog()));
49 if ( QApplication::desktop()->width() > 460 ) 52 if ( QApplication::desktop()->width() > 460 )
50 resize( 300, 360 ); 53 resize( 300, 360 );
51 else 54 else
52 showMaximized(); 55 showMaximized();
56 connect( mSetColorCat, SIGNAL( clicked() ), this, SLOT( setColorCat() ) );
57 connect( mCategories, SIGNAL( clicked(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) );
53} 58}
54void CategorySelectDialog::editCategoriesDialog() 59void CategorySelectDialog::editCategoriesDialog()
55{ 60{
56 KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); 61 KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this );
57 62
58 ced->exec(); 63 ced->exec();
59 delete ced; 64 delete ced;
60 setCategories(); 65 setCategories();
61} 66}
62void CategorySelectDialog::setCategories() 67void CategorySelectDialog::setCategories()
63{ 68{
69 mColorItem = 0;
64 mCategories->clear(); 70 mCategories->clear();
65 mCategoryList.clear(); 71 mCategoryList.clear();
66 72
67 QStringList::Iterator it; 73 QStringList::Iterator it;
68
69 for (it = mPrefs->mCustomCategories.begin(); 74 for (it = mPrefs->mCustomCategories.begin();
70 it != mPrefs->mCustomCategories.end(); ++it ) { 75 it != mPrefs->mCustomCategories.end(); ++it ) {
71 new QCheckListItem(mCategories,*it,QCheckListItem::CheckBox); 76 new QCheckListItem(mCategories,*it,QCheckListItem::CheckBox);
72 } 77 }
73} 78}
74 79
75CategorySelectDialog::~CategorySelectDialog() 80CategorySelectDialog::~CategorySelectDialog()
76{ 81{
77} 82}
78 83
79void CategorySelectDialog::setSelected(const QStringList &selList) 84void CategorySelectDialog::setSelected(const QStringList &selList)
80{ 85{
81 clear(); 86 clear();
82 87
83 QStringList::ConstIterator it; 88 QStringList::ConstIterator it;
84 QStringList notFound; 89 QStringList notFound;
85 bool found = false; 90 bool found = false;
86 for (it=selList.begin();it!=selList.end();++it) { 91 for (it=selList.begin();it!=selList.end();++it) {
87 //qDebug(" CategorySelectDialog::setSelected("); 92 //qDebug(" CategorySelectDialog::setSelected(");
88 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 93 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
89 while (item) { 94 while (item) {
90 if (item->text() == *it) { 95 if (item->text() == *it) {
91 item->setOn(true); 96 item->setOn(true);
97 if ( ! found )
98 setColorItem( item );
92 found = true; 99 found = true;
93 break; 100 break;
94 } 101 }
95 item = (QCheckListItem *)item->nextSibling(); 102 item = (QCheckListItem *)item->nextSibling();
96 } 103 }
97// if ( ! found ) { 104// if ( ! found ) {
98 105
99//emit updateCategoriesGlobal(); 106//emit updateCategoriesGlobal();
100// QMessageBox::information( this, "KO/E: Information!", 107// QMessageBox::information( this, "KO/E: Information!",
101// "Categories found, which were not\n" 108// "Categories found, which were not\n"
102// "in list of categories!\n" 109// "in list of categories!\n"
103// "message", 110// "message",
104// "OK", "", 0, 111// "OK", "", 0,
105// 0, 1 ); 112// 0, 1 );
106// setSelected(selList); 113// setSelected(selList);
107// return; 114// return;
108// } 115// }
109 } 116 }
110} 117}
111 118
112QStringList CategorySelectDialog::selectedCategories() const 119QStringList CategorySelectDialog::selectedCategories() const
113{ 120{
114 return mCategoryList; 121 return mCategoryList;
115} 122}
123void CategorySelectDialog::setColorEnabled()
124{
125 mColorEnabled = true;
126 mSetColorCat->show();
127}
128void CategorySelectDialog::setColorCat()
129{
130 QCheckListItem * newColorItem = (QCheckListItem * )mCategories->currentItem ();
131 if ( !newColorItem ) {
132 KMessageBox::error(this,i18n("There is no current item."));
133 return;
134 }
135 if ( !newColorItem->isOn() )
136 newColorItem->setOn( true );
137 setColorItem( newColorItem );
116 138
139}
140void CategorySelectDialog::clicked ( QListViewItem * it )
141{
142 if ( ! it )
143 return;
144 QCheckListItem *i = (QCheckListItem *) it;
145 qDebug("click %d ", i->isOn());
146 if ( !i->isOn() && i==mColorItem) {
147 setColorItem( 0);
148 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
149 while (item) {
150 if (item->isOn()) {
151 setColorItem( item );
152 break;
153 }
154 item = (QCheckListItem *)item->nextSibling();
155 }
156 } else if ( i->isOn() && !mColorItem) {
157 setColorItem( i);
158 }
159}
160void CategorySelectDialog::setColorItem( QCheckListItem * newColorItem )
161{
162 if ( !mColorEnabled )
163 return;
164 if ( mColorItem == newColorItem)
165 return;
166 if ( mColorItem ) {
167 mColorItem->setPixmap ( 0, QPixmap() );
168 mColorItem = 0;
169 }
170 if ( newColorItem ) {
171 QPixmap pix (newColorItem->height()/2, newColorItem->height()/2 );
172 pix.fill(Qt::blue );
173 newColorItem->setPixmap ( 0, pix );
174 mColorItem = newColorItem;
175 }
176}
117void CategorySelectDialog::slotApply() 177void CategorySelectDialog::slotApply()
118{ 178{
119 QStringList categories; 179 QStringList categories;
120 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 180 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
181 QString colcat;
121 while (item) { 182 while (item) {
122 if (item->isOn()) { 183 if (item->isOn()) {
123 categories.append(item->text()); 184 if ( item == mColorItem)
185 colcat = item->text();
186 else
187 categories.append(item->text());
124 } 188 }
125 item = (QCheckListItem *)item->nextSibling(); 189 item = (QCheckListItem *)item->nextSibling();
126 } 190 }
127 191 categories.sort();
192 if ( ! colcat.isEmpty() )
193 categories.prepend( colcat );
128 QString categoriesStr = categories.join(","); 194 QString categoriesStr = categories.join(",");
129 195
130 mCategoryList = categories; 196 mCategoryList = categories;
131 197
132 emit categoriesSelected(categories); 198 emit categoriesSelected(categories);
133 emit categoriesSelected(categoriesStr); 199 emit categoriesSelected(categoriesStr);
134} 200}
135void CategorySelectDialog::accept() 201void CategorySelectDialog::accept()
136{ 202{
137 slotOk(); 203 slotOk();
138} 204}
139 205
140void CategorySelectDialog::slotOk() 206void CategorySelectDialog::slotOk()
141{ 207{
142 slotApply(); 208 slotApply();
143 QDialog::accept(); 209 QDialog::accept();
144} 210}
145 211
146void CategorySelectDialog::clear() 212void CategorySelectDialog::clear()
147{ 213{
148 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); 214 QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
149 while (item) { 215 while (item) {
150 item->setOn(false); 216 item->setOn(false);
151 item = (QCheckListItem *)item->nextSibling(); 217 item = (QCheckListItem *)item->nextSibling();
diff --git a/libkdepim/categoryselectdialog.h b/libkdepim/categoryselectdialog.h
index 9b6261c..680a093 100644
--- a/libkdepim/categoryselectdialog.h
+++ b/libkdepim/categoryselectdialog.h
@@ -5,65 +5,71 @@
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#ifndef KPIM_CATEGORYSELECTDIALOG_H 23#ifndef KPIM_CATEGORYSELECTDIALOG_H
24#define KPIM_CATEGORYSELECTDIALOG_H 24#define KPIM_CATEGORYSELECTDIALOG_H
25 25
26#include <categoryselectdialog_base.h> 26#include <categoryselectdialog_base.h>
27 27
28class KPimPrefs; 28class KPimPrefs;
29class QCheckListItem;
29 30
30namespace KPIM { 31namespace KPIM {
31 32
32class CategorySelectDialog : public CategorySelectDialog_base 33class CategorySelectDialog : public CategorySelectDialog_base
33{ 34{
34 Q_OBJECT 35 Q_OBJECT
35 public: 36 public:
36 CategorySelectDialog( KPimPrefs *prefs, QWidget* parent = 0, 37 CategorySelectDialog( KPimPrefs *prefs, QWidget* parent = 0,
37 const char* name = 0, 38 const char* name = 0,
38 bool modal = FALSE, WFlags fl = 0 ); 39 bool modal = FALSE, WFlags fl = 0 );
39 ~CategorySelectDialog(); 40 ~CategorySelectDialog();
40 41
41 void setCategories(); 42 void setCategories();
43 void setColorEnabled();
42 void setSelected(const QStringList &selList); 44 void setSelected(const QStringList &selList);
43 45
44 QStringList selectedCategories() const; 46 QStringList selectedCategories() const;
45 47
46 public slots: 48 public slots:
47 void slotOk(); 49 void slotOk();
48 void slotApply(); 50 void slotApply();
49 void clear(); 51 void clear();
50 void accept(); 52 void accept();
51 void editCategoriesDialog(); 53 void editCategoriesDialog();
52 void updateCategoryConfig(); 54 void updateCategoryConfig();
53 55 void setColorCat();
56 void clicked ( QListViewItem * );
54 signals: 57 signals:
55 void categoriesSelected(const QString &); 58 void categoriesSelected(const QString &);
56 void categoriesSelected(const QStringList &); 59 void categoriesSelected(const QStringList &);
57 void editCategories(); 60 void editCategories();
58 61
59 private: 62 private:
63 bool mColorEnabled;
60 KPimPrefs *mPrefs; 64 KPimPrefs *mPrefs;
61 QStringList mCategoryList; 65 QStringList mCategoryList;
66 QCheckListItem *mColorItem;
67 void setColorItem( QCheckListItem * );
62 68
63 class CategorySelectDialogPrivate; 69 class CategorySelectDialogPrivate;
64 CategorySelectDialogPrivate *d; 70 CategorySelectDialogPrivate *d;
65}; 71};
66 72
67} 73}
68 74
69#endif 75#endif
diff --git a/libkdepim/categoryselectdialog_base.cpp b/libkdepim/categoryselectdialog_base.cpp
index 3f050cf..4793fd7 100644
--- a/libkdepim/categoryselectdialog_base.cpp
+++ b/libkdepim/categoryselectdialog_base.cpp
@@ -15,114 +15,117 @@
15#include <qlistview.h> 15#include <qlistview.h>
16#include <qpushbutton.h> 16#include <qpushbutton.h>
17#include <qlayout.h> 17#include <qlayout.h>
18#include <qtooltip.h> 18#include <qtooltip.h>
19#include <qwhatsthis.h> 19#include <qwhatsthis.h>
20 20
21/* 21/*
22 * Constructs a CategorySelectDialog_base as a child of 'parent', with the 22 * Constructs a CategorySelectDialog_base as a child of 'parent', with the
23 * name 'name' and widget flags set to 'f'. 23 * name 'name' and widget flags set to 'f'.
24 * 24 *
25 * The dialog will by default be modeless, unless you set 'modal' to 25 * The dialog will by default be modeless, unless you set 'modal' to
26 * TRUE to construct a modal dialog. 26 * TRUE to construct a modal dialog.
27 */ 27 */
28CategorySelectDialog_base::CategorySelectDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) 28CategorySelectDialog_base::CategorySelectDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl )
29 : QDialog( parent, name, modal, fl ) 29 : QDialog( parent, name, modal, fl )
30 30
31{ 31{
32 if ( !name ) 32 if ( !name )
33 setName( "CategorySelectDialog_base" ); 33 setName( "CategorySelectDialog_base" );
34 CategorySelectDialog_baseLayout = new QVBoxLayout( this, 11, 6, "CategorySelectDialog_baseLayout"); 34 CategorySelectDialog_baseLayout = new QVBoxLayout( this, 11, 6, "CategorySelectDialog_baseLayout");
35 35
36 mCategories = new QListView( this, "mCategories" ); 36 mCategories = new QListView( this, "mCategories" );
37 mCategories->addColumn( i18n( "Category" ) ); 37 mCategories->addColumn( i18n( "Category" ) );
38 CategorySelectDialog_baseLayout->addWidget( mCategories ); 38 CategorySelectDialog_baseLayout->addWidget( mCategories );
39 39 mSetColorCat = new QPushButton( this, "msetColor" );
40 Layout12 = new QHBoxLayout( 0, 0, 6, "Layout12"); 40 CategorySelectDialog_baseLayout->addWidget( mSetColorCat );
41 Layout12 = new QHBoxLayout( 0, 0, 4, "Layout12");
41 42
42 mClear = new QPushButton( this, "mClear" ); 43 mClear = new QPushButton( this, "mClear" );
43 Layout12->addWidget( mClear ); 44 Layout12->addWidget( mClear );
44 // QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); 45 // QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
45 //Layout12->addItem( spacer ); 46 //Layout12->addItem( spacer );
46 47
47 mButtonEdit = new QPushButton( this, "mButtonEdit" ); 48 mButtonEdit = new QPushButton( this, "mButtonEdit" );
48 Layout12->addWidget( mButtonEdit ); 49 Layout12->addWidget( mButtonEdit );
49 CategorySelectDialog_baseLayout->addLayout( Layout12 ); 50 CategorySelectDialog_baseLayout->addLayout( Layout12 );
50 51
51 Layout11 = new QHBoxLayout( 0, 0, 6, "Layout11"); 52 Layout11 = new QHBoxLayout( 0, 0, 4, "Layout11");
52 53
53 //mButtonHelp = new QPushButton( this, "mButtonHelp" ); 54 //mButtonHelp = new QPushButton( this, "mButtonHelp" );
54 //Layout11->addWidget( mButtonHelp ); 55 //Layout11->addWidget( mButtonHelp );
55 //QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); 56 //QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
56 // Layout11->addItem( spacer_2 ); 57 // Layout11->addItem( spacer_2 );
57 58
58 //mApply = new QPushButton( this, "mApply" ); 59 //mApply = new QPushButton( this, "mApply" );
59 // Layout11->addWidget( mApply ); 60 // Layout11->addWidget( mApply );
60 61
61 mButtonOk = new QPushButton( this, "mButtonOk" ); 62 mButtonOk = new QPushButton( this, "mButtonOk" );
62 mButtonOk->setOn( FALSE ); 63 mButtonOk->setOn( FALSE );
63 mButtonOk->setDefault( TRUE ); 64 mButtonOk->setDefault( TRUE );
64 Layout11->addWidget( mButtonOk ); 65 Layout11->addWidget( mButtonOk );
65 66
66 mButtonCancel = new QPushButton( this, "mButtonCancel" ); 67 mButtonCancel = new QPushButton( this, "mButtonCancel" );
67 Layout11->addWidget( mButtonCancel ); 68 Layout11->addWidget( mButtonCancel );
68 CategorySelectDialog_baseLayout->addLayout( Layout11 ); 69 CategorySelectDialog_baseLayout->addLayout( Layout11 );
69 languageChange(); 70 languageChange();
70 // resize( sizeHint() ); 71 // resize( sizeHint() );
71 72
72 // signals and slots connections 73 // signals and slots connections
73 connect( mButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); 74 connect( mButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
74 connect( mButtonOk, SIGNAL( clicked() ), this, SLOT( slotOk() ) ); 75 connect( mButtonOk, SIGNAL( clicked() ), this, SLOT( slotOk() ) );
75 connect( mClear, SIGNAL( clicked() ), this, SLOT( clear() ) ); 76 connect( mClear, SIGNAL( clicked() ), this, SLOT( clear() ) );
76 //connect( mApply, SIGNAL( clicked() ), this, SLOT( slotApply() ) ); 77 //connect( mApply, SIGNAL( clicked() ), this, SLOT( slotApply() ) );
77 78
78 // tab order 79 // tab order
79 setTabOrder( mCategories, mClear ); 80 setTabOrder( mCategories, mClear );
80 setTabOrder( mClear, mButtonEdit ); 81 setTabOrder( mClear, mButtonEdit );
81 setTabOrder( mButtonEdit, mButtonOk );//mButtonHelp ); 82 setTabOrder( mButtonEdit, mButtonOk );//mButtonHelp );
82 // setTabOrder( mButtonHelp, mApply ); 83 // setTabOrder( mButtonHelp, mApply );
83 // setTabOrder( mApply, mButtonOk ); 84 // setTabOrder( mApply, mButtonOk );
84 setTabOrder( mButtonOk, mButtonCancel ); 85 setTabOrder( mButtonOk, mButtonCancel );
85 // showMaximized(); 86 // showMaximized();
86 //raise(); 87 //raise();
88 mSetColorCat->hide();
87} 89}
88 90
89/* 91/*
90 * Destroys the object and frees any allocated resources 92 * Destroys the object and frees any allocated resources
91 */ 93 */
92CategorySelectDialog_base::~CategorySelectDialog_base() 94CategorySelectDialog_base::~CategorySelectDialog_base()
93{ 95{
94 // no need to delete child widgets, Qt does it all for us 96 // no need to delete child widgets, Qt does it all for us
95} 97}
96 98
97/* 99/*
98 * Sets the strings of the subwidgets using the current 100 * Sets the strings of the subwidgets using the current
99 * language. 101 * language.
100 */ 102 */
101void CategorySelectDialog_base::languageChange() 103void CategorySelectDialog_base::languageChange()
102{ 104{
103 setCaption( i18n( "Select Categories" ) ); 105 setCaption( i18n( "Select Categories" ) );
104 mCategories->header()->setLabel( 0, tr2i18n( "Category" ) ); 106 mCategories->header()->setLabel( 0, tr2i18n( "Category" ) );
105 mClear->setText( i18n( " &Deselect All " ) ); 107 mClear->setText( i18n( " &Deselect All " ) );
106 mButtonEdit->setText( i18n( " &Edit Categories " ) ); 108 mButtonEdit->setText( i18n( " &Edit Categories " ) );
107 // mButtonHelp->setText( tr2i18n( "&Help" ) ); 109 // mButtonHelp->setText( tr2i18n( "&Help" ) );
108 //mApply->setText( i18n( "&Apply" ) ); 110 //mApply->setText( i18n( "&Apply" ) );
109 mButtonOk->setText( i18n( "&OK" ) ); 111 mButtonOk->setText( i18n( "&OK" ) );
112 mSetColorCat->setText( i18n( "Set current as color category" ) );
110 mButtonCancel->setText( i18n( "&Cancel" ) ); 113 mButtonCancel->setText( i18n( "&Cancel" ) );
111} 114}
112 115
113void CategorySelectDialog_base::clear() 116void CategorySelectDialog_base::clear()
114{ 117{
115 qWarning( "CategorySelectDialog_base::clear(): Not implemented yet" ); 118 qWarning( "CategorySelectDialog_base::clear(): Not implemented yet" );
116} 119}
117 120
118void CategorySelectDialog_base::slotApply() 121void CategorySelectDialog_base::slotApply()
119{ 122{
120 qWarning( "CategorySelectDialog_base::slotApply(): Not implemented yet" ); 123 qWarning( "CategorySelectDialog_base::slotApply(): Not implemented yet" );
121} 124}
122 125
123void CategorySelectDialog_base::slotOk() 126void CategorySelectDialog_base::slotOk()
124{ 127{
125 qWarning( "CategorySelectDialog_base::slotOk(): Not implemented yet" ); 128 qWarning( "CategorySelectDialog_base::slotOk(): Not implemented yet" );
126} 129}
127 130
128//US#include "categoryselectdialog_base.moc" 131//US#include "categoryselectdialog_base.moc"
diff --git a/libkdepim/categoryselectdialog_base.h b/libkdepim/categoryselectdialog_base.h
index af905ed..59ffa22 100644
--- a/libkdepim/categoryselectdialog_base.h
+++ b/libkdepim/categoryselectdialog_base.h
@@ -14,40 +14,41 @@
14#include <qdialog.h> 14#include <qdialog.h>
15 15
16class QVBoxLayout; 16class QVBoxLayout;
17class QHBoxLayout; 17class QHBoxLayout;
18class QGridLayout; 18class QGridLayout;
19class QListView; 19class QListView;
20class QListViewItem; 20class QListViewItem;
21class QPushButton; 21class QPushButton;
22 22
23class CategorySelectDialog_base : public QDialog 23class CategorySelectDialog_base : public QDialog
24{ 24{
25 Q_OBJECT 25 Q_OBJECT
26 26
27public: 27public:
28 CategorySelectDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 28 CategorySelectDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
29 ~CategorySelectDialog_base(); 29 ~CategorySelectDialog_base();
30 30
31 QListView* mCategories; 31 QListView* mCategories;
32 QPushButton* mClear; 32 QPushButton* mClear;
33 QPushButton* mButtonEdit; 33 QPushButton* mButtonEdit;
34 QPushButton* mButtonHelp; 34 QPushButton* mButtonHelp;
35 QPushButton* mApply; 35 QPushButton* mApply;
36 QPushButton* mButtonOk; 36 QPushButton* mButtonOk;
37 QPushButton* mButtonCancel; 37 QPushButton* mButtonCancel;
38 QPushButton* mSetColorCat;
38 39
39public slots: 40public slots:
40 virtual void clear(); 41 virtual void clear();
41 virtual void slotApply(); 42 virtual void slotApply();
42 virtual void slotOk(); 43 virtual void slotOk();
43 44
44protected: 45protected:
45 QVBoxLayout* CategorySelectDialog_baseLayout; 46 QVBoxLayout* CategorySelectDialog_baseLayout;
46 QHBoxLayout* Layout12; 47 QHBoxLayout* Layout12;
47 QHBoxLayout* Layout11; 48 QHBoxLayout* Layout11;
48 49
49protected slots: 50protected slots:
50 virtual void languageChange(); 51 virtual void languageChange();
51}; 52};
52 53
53#endif // CATEGORYSELECTDIALOG_BASE_H 54#endif // CATEGORYSELECTDIALOG_BASE_H