summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-05 15:46:34 (UTC)
committer zautrix <zautrix>2005-04-05 15:46:34 (UTC)
commit8734ae4789ed411cb546edd304816a77c431a2bf (patch) (unidiff)
tree8fc66d9dfb9baf6ef62278dd58d49f6156c0414f /korganizer
parent637415693af8fe9974b45c355ecfdd0745617ac3 (diff)
downloadkdepimpi-8734ae4789ed411cb546edd304816a77c431a2bf.zip
kdepimpi-8734ae4789ed411cb546edd304816a77c431a2bf.tar.gz
kdepimpi-8734ae4789ed411cb546edd304816a77c431a2bf.tar.bz2
urgs. bug fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp10
-rw-r--r--korganizer/koprefsdialog.cpp17
-rw-r--r--korganizer/searchdialog.cpp12
3 files changed, 21 insertions, 18 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index e0e138e..341f473 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1,1250 +1,1250 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1999 Preston Brown 3 Copyright (c) 1999 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlistview.h> 25#include <qlistview.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qprogressbar.h> 29#include <qprogressbar.h>
30#include <qfileinfo.h> 30#include <qfileinfo.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qwhatsthis.h> 35#include <qwhatsthis.h>
36#include <qregexp.h> 36#include <qregexp.h>
37 37
38#include <klocale.h> 38#include <klocale.h>
39#include <kdebug.h> 39#include <kdebug.h>
40#include <kiconloader.h> 40#include <kiconloader.h>
41#include <kglobal.h> 41#include <kglobal.h>
42 42
43#include <libkdepim/kpimglobalprefs.h> 43#include <libkdepim/kpimglobalprefs.h>
44#include <libkcal/calendar.h> 44#include <libkcal/calendar.h>
45#include <libkcal/calendarlocal.h> 45#include <libkcal/calendarlocal.h>
46#include <libkcal/icalformat.h> 46#include <libkcal/icalformat.h>
47#include <libkcal/vcalformat.h> 47#include <libkcal/vcalformat.h>
48#include <libkcal/recurrence.h> 48#include <libkcal/recurrence.h>
49#include <libkcal/filestorage.h> 49#include <libkcal/filestorage.h>
50#include <libkdepim/categoryselectdialog.h> 50#include <libkdepim/categoryselectdialog.h>
51#include <libkcal/kincidenceformatter.h> 51#include <libkcal/kincidenceformatter.h>
52#ifndef DESKTOP_VERSION 52#ifndef DESKTOP_VERSION
53#include <qpe/qpeapplication.h> 53#include <qpe/qpeapplication.h>
54#else 54#else
55#include <qapplication.h> 55#include <qapplication.h>
56#endif 56#endif
57 57
58#ifndef KORG_NOPRINTER 58#ifndef KORG_NOPRINTER
59#include "calprinter.h" 59#include "calprinter.h"
60#endif 60#endif
61#include "koglobals.h" 61#include "koglobals.h"
62#include "koprefs.h" 62#include "koprefs.h"
63#include "kfiledialog.h" 63#include "kfiledialog.h"
64 64
65#include "kolistview.h" 65#include "kolistview.h"
66 66
67 67
68 68
69 69
70class KOListViewWhatsThis :public QWhatsThis 70class KOListViewWhatsThis :public QWhatsThis
71{ 71{
72public: 72public:
73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
74 74
75protected: 75protected:
76 virtual QString text( const QPoint& p) 76 virtual QString text( const QPoint& p)
77 { 77 {
78 return _view->getWhatsThisText(p) ; 78 return _view->getWhatsThisText(p) ;
79 } 79 }
80private: 80private:
81 QWidget* _wid; 81 QWidget* _wid;
82 KOListView * _view; 82 KOListView * _view;
83}; 83};
84 84
85 85
86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
87{ 87{
88 mItem = item; 88 mItem = item;
89 mDate = date; 89 mDate = date;
90} 90}
91 91
92ListItemVisitor::~ListItemVisitor() 92ListItemVisitor::~ListItemVisitor()
93{ 93{
94} 94}
95 95
96bool ListItemVisitor::visit(Event *e) 96bool ListItemVisitor::visit(Event *e)
97{ 97{
98 98
99 bool ok = false; 99 bool ok = false;
100 QString start, end; 100 QString start, end;
101 QDate ds, de; 101 QDate ds, de;
102 if ( e->doesRecur() ) { 102 if ( e->doesRecur() ) {
103 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 103 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
104 if ( ok ) { 104 if ( ok ) {
105 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 105 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
106 start = KGlobal::locale()->formatDate(ds,true); 106 start = KGlobal::locale()->formatDate(ds,true);
107 de = ds.addDays( days); 107 de = ds.addDays( days);
108 end = KGlobal::locale()->formatDate(de,true); 108 end = KGlobal::locale()->formatDate(de,true);
109 } 109 }
110 110
111 } 111 }
112 if ( ! ok ) { 112 if ( ! ok ) {
113 start =e->dtStartDateStr(); 113 start =e->dtStartDateStr();
114 end = e->dtEndDateStr(); 114 end = e->dtEndDateStr();
115 ds = e->dtStart().date(); 115 ds = e->dtStart().date();
116 de = e->dtEnd().date(); 116 de = e->dtEnd().date();
117 } 117 }
118 mItem->setText(0,e->summary()); 118 mItem->setText(0,e->summary());
119 mItem->setText(1,start); 119 mItem->setText(1,start);
120 mItem->setText(2,e->dtStartTimeStr()); 120 mItem->setText(2,e->dtStartTimeStr());
121 mItem->setText(3,end); 121 mItem->setText(3,end);
122 mItem->setText(4,e->dtEndTimeStr()); 122 mItem->setText(4,e->dtEndTimeStr());
123 if ( e->isAlarmEnabled() ) { 123 if ( e->isAlarmEnabled() ) {
124 mItem->setText(5,e->alarms().first()->offsetText() ); 124 mItem->setText(5,e->alarms().first()->offsetText() );
125 } else { 125 } else {
126 mItem->setText(5, i18n("No")); 126 mItem->setText(5, i18n("No"));
127 } 127 }
128 mItem->setText(6, e->recurrence()->recurrenceText()); 128 mItem->setText(6, e->recurrence()->recurrenceText());
129 mItem->setText(7,"---"); 129 mItem->setText(7,"---");
130 mItem->setText(8,"---"); 130 mItem->setText(8,"---");
131 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 131 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
132 mItem->setText(10,e->categoriesStr()); 132 mItem->setText(10,e->categoriesStr());
133 133
134 QString key; 134 QString key;
135 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 135 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
136 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); 136 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
137 mItem->setSortKey(1,key); 137 mItem->setSortKey(1,key);
138 138
139 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 139 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
140 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); 140 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
141 mItem->setSortKey(3,key); 141 mItem->setSortKey(3,key);
142 142
143 return true; 143 return true;
144} 144}
145 145
146bool ListItemVisitor::visit(Todo *t) 146bool ListItemVisitor::visit(Todo *t)
147{ 147{
148 mItem->setText(0,i18n("Todo: %1").arg(t->summary())); 148 mItem->setText(0,i18n("Todo: %1").arg(t->summary()));
149 if (t->hasStartDate()) { 149 if (t->hasStartDate()) {
150 mItem->setText(1,t->dtStartDateStr()); 150 mItem->setText(1,t->dtStartDateStr());
151 if (t->doesFloat()) { 151 if (t->doesFloat()) {
152 mItem->setText(2,"---"); 152 mItem->setText(2,"---");
153 } else { 153 } else {
154 mItem->setText(2,t->dtStartTimeStr()); 154 mItem->setText(2,t->dtStartTimeStr());
155 } 155 }
156 } else { 156 } else {
157 mItem->setText(1,"---"); 157 mItem->setText(1,"---");
158 mItem->setText(2,"---"); 158 mItem->setText(2,"---");
159 } 159 }
160 mItem->setText(3,"---"); 160 mItem->setText(3,"---");
161 mItem->setText(4,"---"); 161 mItem->setText(4,"---");
162 if ( t->isAlarmEnabled() ) { 162 if ( t->isAlarmEnabled() ) {
163 mItem->setText(5,t->alarms().first()->offsetText() ); 163 mItem->setText(5,t->alarms().first()->offsetText() );
164 } else { 164 } else {
165 mItem->setText(5, i18n("No")); 165 mItem->setText(5, i18n("No"));
166 } 166 }
167 mItem->setText(6, t->recurrence()->recurrenceText()); 167 mItem->setText(6, t->recurrence()->recurrenceText());
168 if (t->hasDueDate()) { 168 if (t->hasDueDate()) {
169 mItem->setText(7,t->dtDueDateStr()); 169 mItem->setText(7,t->dtDueDateStr());
170 if (t->doesFloat()) { 170 if (t->doesFloat()) {
171 mItem->setText(8,"---"); 171 mItem->setText(8,"---");
172 } else { 172 } else {
173 mItem->setText(8,t->dtDueTimeStr()); 173 mItem->setText(8,t->dtDueTimeStr());
174 } 174 }
175 } else { 175 } else {
176 mItem->setText(7,"---"); 176 mItem->setText(7,"---");
177 mItem->setText(8,"---"); 177 mItem->setText(8,"---");
178 } 178 }
179 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 179 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
180 mItem->setText(10,t->categoriesStr()); 180 mItem->setText(10,t->categoriesStr());
181 181
182 QString key; 182 QString key;
183 QDate d; 183 QDate d;
184 if (t->hasDueDate()) { 184 if (t->hasDueDate()) {
185 d = t->dtDue().date(); 185 d = t->dtDue().date();
186 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 186 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
187 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 187 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
188 mItem->setSortKey(7,key); 188 mItem->setSortKey(7,key);
189 } 189 }
190 if ( t->hasStartDate() ) { 190 if ( t->hasStartDate() ) {
191 d = t->dtStart().date(); 191 d = t->dtStart().date();
192 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 192 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
193 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 193 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
194 mItem->setSortKey(1,key); 194 mItem->setSortKey(1,key);
195 } 195 }
196 return true; 196 return true;
197} 197}
198 198
199bool ListItemVisitor::visit(Journal * j) 199bool ListItemVisitor::visit(Journal * j)
200{ 200{
201 QString des = j->description().left(30); 201 QString des = j->description().left(30);
202 des = des.simplifyWhiteSpace (); 202 des = des.simplifyWhiteSpace ();
203 des.replace (QRegExp ("\\n"),"" ); 203 des.replace (QRegExp ("\\n"),"" );
204 des.replace (QRegExp ("\\r"),"" ); 204 des.replace (QRegExp ("\\r"),"" );
205 mItem->setText(0,i18n("Journal: ")+des.left(25)); 205 mItem->setText(0,i18n("Journal: ")+des.left(25));
206 mItem->setText(1,j->dtStartDateStr()); 206 mItem->setText(1,j->dtStartDateStr());
207 mItem->setText(2,"---"); 207 mItem->setText(2,"---");
208 mItem->setText(3,"---"); 208 mItem->setText(3,"---");
209 mItem->setText(4,"---"); 209 mItem->setText(4,"---");
210 mItem->setText(5,"---"); 210 mItem->setText(5,"---");
211 mItem->setText(6,"---"); 211 mItem->setText(6,"---");
212 mItem->setText(7,j->dtStartDateStr()); 212 mItem->setText(7,j->dtStartDateStr());
213 mItem->setText(8,"---"); 213 mItem->setText(8,"---");
214 mItem->setText(9,"---"); 214 mItem->setText(9,"---");
215 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 215 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
216 216
217 QString key; 217 QString key;
218 QDate d = j->dtStart().date(); 218 QDate d = j->dtStart().date();
219 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 219 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
220 mItem->setSortKey(1,key); 220 mItem->setSortKey(1,key);
221 mItem->setSortKey(7,key); 221 mItem->setSortKey(7,key);
222 222
223 return true; 223 return true;
224} 224}
225 225
226KOListView::KOListView(Calendar *calendar, QWidget *parent, 226KOListView::KOListView(Calendar *calendar, QWidget *parent,
227 const char *name) 227 const char *name)
228 : KOEventView(calendar, parent, name) 228 : KOEventView(calendar, parent, name)
229{ 229{
230 mActiveItem = 0; 230 mActiveItem = 0;
231 mListView = new KOListViewListView(this); 231 mListView = new KOListViewListView(this);
232 mListView->addColumn(i18n("Summary")); 232 mListView->addColumn(i18n("Summary"));
233 mListView->addColumn(i18n("Start Date")); 233 mListView->addColumn(i18n("Start Date"));
234 mListView->addColumn(i18n("Start Time")); 234 mListView->addColumn(i18n("Start Time"));
235 mListView->addColumn(i18n("End Date")); 235 mListView->addColumn(i18n("End Date"));
236 mListView->addColumn(i18n("End Time")); 236 mListView->addColumn(i18n("End Time"));
237 mListView->addColumn(i18n("Alarm")); // alarm set? 237 mListView->addColumn(i18n("Alarm")); // alarm set?
238 mListView->addColumn(i18n("Recurs")); // recurs? 238 mListView->addColumn(i18n("Recurs")); // recurs?
239 mListView->addColumn(i18n("Due Date")); 239 mListView->addColumn(i18n("Due Date"));
240 mListView->addColumn(i18n("Due Time")); 240 mListView->addColumn(i18n("Due Time"));
241 mListView->addColumn(i18n("Cancelled")); 241 mListView->addColumn(i18n("Cancelled"));
242 mListView->addColumn(i18n("Categories")); 242 mListView->addColumn(i18n("Categories"));
243 243
244 mListView->setColumnAlignment(0,AlignLeft); 244 mListView->setColumnAlignment(0,AlignLeft);
245 mListView->setColumnAlignment(1,AlignLeft); 245 mListView->setColumnAlignment(1,AlignLeft);
246 mListView->setColumnAlignment(2,AlignHCenter); 246 mListView->setColumnAlignment(2,AlignHCenter);
247 mListView->setColumnAlignment(3,AlignLeft); 247 mListView->setColumnAlignment(3,AlignLeft);
248 mListView->setColumnAlignment(4,AlignHCenter); 248 mListView->setColumnAlignment(4,AlignHCenter);
249 mListView->setColumnAlignment(5,AlignLeft); 249 mListView->setColumnAlignment(5,AlignLeft);
250 mListView->setColumnAlignment(6,AlignLeft); 250 mListView->setColumnAlignment(6,AlignLeft);
251 mListView->setColumnAlignment(7,AlignLeft); 251 mListView->setColumnAlignment(7,AlignLeft);
252 mListView->setColumnAlignment(8,AlignLeft); 252 mListView->setColumnAlignment(8,AlignLeft);
253 mListView->setColumnAlignment(9,AlignLeft); 253 mListView->setColumnAlignment(9,AlignLeft);
254 mListView->setColumnAlignment(10,AlignLeft); 254 mListView->setColumnAlignment(10,AlignLeft);
255 mListView->setColumnWidthMode(10, QListView::Manual); 255 mListView->setColumnWidthMode(10, QListView::Manual);
256 new KOListViewWhatsThis(mListView->viewport(),this); 256 new KOListViewWhatsThis(mListView->viewport(),this);
257 257
258 int iii = 0; 258 int iii = 0;
259 for ( iii = 0; iii< 10 ; ++iii ) 259 for ( iii = 0; iii< 10 ; ++iii )
260 mListView->setColumnWidthMode( iii, QListView::Manual ); 260 mListView->setColumnWidthMode( iii, QListView::Manual );
261 261
262 QBoxLayout *layoutTop = new QVBoxLayout(this); 262 QBoxLayout *layoutTop = new QVBoxLayout(this);
263 layoutTop->addWidget(mListView); 263 layoutTop->addWidget(mListView);
264 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 264 mListView->setFont ( KOPrefs::instance()->mListViewFont );
265 mPopupMenu = eventPopup(); 265 mPopupMenu = eventPopup();
266 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 266 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
267 i18n("Select all"),this, 267 i18n("Select all"),this,
268 SLOT(allSelection()),true); 268 SLOT(allSelection()),true);
269 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 269 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
270 i18n("Deselect all"),this, 270 i18n("Deselect all"),this,
271 SLOT(clearSelection()),true); 271 SLOT(clearSelection()),true);
272 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 272 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
273 i18n("Delete all selected"),this, 273 i18n("Delete all selected"),this,
274 SLOT(deleteAll()),true); 274 SLOT(deleteAll()),true);
275 mPopupMenu->insertSeparator(); 275 mPopupMenu->insertSeparator();
276 QPopupMenu * exportPO = new QPopupMenu ( this ); 276 QPopupMenu * exportPO = new QPopupMenu ( this );
277 mPopupMenu->insertItem( i18n("Export selected"), exportPO ); 277 mPopupMenu->insertItem( i18n("Export selected"), exportPO );
278 exportPO->insertItem( i18n("As iCal (ics) file..."),this, 278 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
279 SLOT(saveToFile())); 279 SLOT(saveToFile()));
280 exportPO->insertItem( i18n("As vCal (vcs) file..."),this, 280 exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
281 SLOT(saveToFileVCS())); 281 SLOT(saveToFileVCS()));
282 exportPO->insertItem( i18n("Journal/Details..."),this, 282 exportPO->insertItem( i18n("Journal/Details..."),this,
283 SLOT(saveDescriptionToFile())); 283 SLOT(saveDescriptionToFile()));
284 // mPopupMenu->insertSeparator(); 284 // mPopupMenu->insertSeparator();
285 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 285 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
286 i18n("Add Categ. to selected..."),this, 286 i18n("Add Categ. to selected..."),this,
287 SLOT(addCat()),true); 287 SLOT(addCat()),true);
288 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 288 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
289 i18n("Set Categ. for selected..."),this, 289 i18n("Set Categ. for selected..."),this,
290 SLOT(setCat()),true); 290 SLOT(setCat()),true);
291 //mPopupMenu->insertSeparator(); 291 //mPopupMenu->insertSeparator();
292 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 292 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
293 i18n("Set alarm for selected..."),this, 293 i18n("Set alarm for selected..."),this,
294 SLOT(setAlarm()),true); 294 SLOT(setAlarm()),true);
295 295
296 296
297#ifndef DESKTOP_VERSION 297#ifndef DESKTOP_VERSION
298 mPopupMenu->insertSeparator(); 298 mPopupMenu->insertSeparator();
299 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 299 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
300 i18n("Beam selected via IR"),this, 300 i18n("Beam selected via IR"),this,
301 SLOT(beamSelected()),true); 301 SLOT(beamSelected()),true);
302#endif 302#endif
303 /* 303 /*
304 mPopupMenu = new QPopupMenu; 304 mPopupMenu = new QPopupMenu;
305 mPopupMenu->insertItem(i18n("Edit Event"), this, 305 mPopupMenu->insertItem(i18n("Edit Event"), this,
306 SLOT (editEvent())); 306 SLOT (editEvent()));
307 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 307 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
308 SLOT (deleteEvent())); 308 SLOT (deleteEvent()));
309 mPopupMenu->insertSeparator(); 309 mPopupMenu->insertSeparator();
310 mPopupMenu->insertItem(i18n("Show Dates"), this, 310 mPopupMenu->insertItem(i18n("Show Dates"), this,
311 SLOT(showDates())); 311 SLOT(showDates()));
312 mPopupMenu->insertItem(i18n("Hide Dates"), this, 312 mPopupMenu->insertItem(i18n("Hide Dates"), this,
313 SLOT(hideDates())); 313 SLOT(hideDates()));
314 */ 314 */
315 QObject::connect(mListView,SIGNAL( newEvent()), 315 QObject::connect(mListView,SIGNAL( newEvent()),
316 this,SIGNAL(signalNewEvent())); 316 this,SIGNAL(signalNewEvent()));
317 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 317 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
318 this,SLOT(defaultItemAction(QListViewItem *))); 318 this,SLOT(defaultItemAction(QListViewItem *)));
319 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, 319 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
320 const QPoint &, int )), 320 const QPoint &, int )),
321 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 321 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
322 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 322 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
323 SLOT(processSelectionChange(QListViewItem *))); 323 SLOT(processSelectionChange(QListViewItem *)));
324 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 324 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
325 SIGNAL(showIncidenceSignal(Incidence *)) ); 325 SIGNAL(showIncidenceSignal(Incidence *)) );
326 326
327 readSettings(KOGlobals::config(),"KOListView Layout"); 327 readSettings(KOGlobals::config(),"KOListView Layout");
328} 328}
329 329
330KOListView::~KOListView() 330KOListView::~KOListView()
331{ 331{
332 delete mPopupMenu; 332 delete mPopupMenu;
333} 333}
334QString KOListView::getWhatsThisText(QPoint p) 334QString KOListView::getWhatsThisText(QPoint p)
335{ 335{
336 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 336 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
337 if ( item ) 337 if ( item )
338 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 338 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
339 KOPrefs::instance()->mWTshowDetails, 339 KOPrefs::instance()->mWTshowDetails,
340 KOPrefs::instance()->mWTshowCreated, 340 KOPrefs::instance()->mWTshowCreated,
341 KOPrefs::instance()->mWTshowChanged); 341 KOPrefs::instance()->mWTshowChanged);
342 return i18n("That is the list view" ); 342 return i18n("That is the list view" );
343 343
344} 344}
345 345
346void KOListView::updateList() 346void KOListView::updateList()
347{ 347{
348 // qDebug(" KOListView::updateList() "); 348 // qDebug(" KOListView::updateList() ");
349 349
350} 350}
351 351
352void KOListView::addCat( ) 352void KOListView::addCat( )
353{ 353{
354 setCategories( false ); 354 setCategories( false );
355} 355}
356void KOListView::setCat() 356void KOListView::setCat()
357{ 357{
358 setCategories( true ); 358 setCategories( true );
359} 359}
360void KOListView::setAlarm() 360void KOListView::setAlarm()
361{ 361{
362 KOAlarmPrefs kap( this); 362 KOAlarmPrefs kap( this);
363 if ( !kap.exec() ) 363 if ( !kap.exec() )
364 return; 364 return;
365 365
366 366
367 QStringList itemList; 367 QStringList itemList;
368 QPtrList<KOListViewItem> sel ; 368 QPtrList<KOListViewItem> sel ;
369 QListViewItem *qitem = mListView->firstChild (); 369 QListViewItem *qitem = mListView->firstChild ();
370 while ( qitem ) { 370 while ( qitem ) {
371 if ( qitem->isSelected() ) { 371 if ( qitem->isSelected() ) {
372 Incidence* inc = ((KOListViewItem *) qitem)->data(); 372 Incidence* inc = ((KOListViewItem *) qitem)->data();
373 if ( inc->type() != "Journal" ) { 373 if ( inc->type() != "Journal" ) {
374 if ( inc->type() == "Todo" ) { 374 if ( inc->type() == "Todo" ) {
375 if ( ((Todo*)inc)->hasDueDate() ) 375 if ( ((Todo*)inc)->hasDueDate() )
376 sel.append(((KOListViewItem *)qitem)); 376 sel.append(((KOListViewItem *)qitem));
377 } else 377 } else
378 sel.append(((KOListViewItem *)qitem)); 378 sel.append(((KOListViewItem *)qitem));
379 } 379 }
380 } 380 }
381 qitem = qitem->nextSibling(); 381 qitem = qitem->nextSibling();
382 } 382 }
383 int count = 0; 383 int count = 0;
384 KOListViewItem * item, *temp; 384 KOListViewItem * item, *temp;
385 item = sel.first(); 385 item = sel.first();
386 Incidence* inc; 386 Incidence* inc;
387 while ( item ) { 387 while ( item ) {
388 inc = item->data(); 388 inc = item->data();
389 ++count; 389 ++count;
390 if (kap.mAlarmButton->isChecked()) { 390 if (kap.mAlarmButton->isChecked()) {
391 if (inc->alarms().count() == 0) 391 if (inc->alarms().count() == 0)
392 inc->newAlarm(); 392 inc->newAlarm();
393 QPtrList<Alarm> alarms = inc->alarms(); 393 QPtrList<Alarm> alarms = inc->alarms();
394 Alarm *alarm; 394 Alarm *alarm;
395 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 395 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
396 alarm->setEnabled(true); 396 alarm->setEnabled(true);
397 int j = kap.mAlarmTimeEdit->value()* -60; 397 int j = kap.mAlarmTimeEdit->value()* -60;
398 if (kap.mAlarmIncrCombo->currentItem() == 1) 398 if (kap.mAlarmIncrCombo->currentItem() == 1)
399 j = j * 60; 399 j = j * 60;
400 else if (kap.mAlarmIncrCombo->currentItem() == 2) 400 else if (kap.mAlarmIncrCombo->currentItem() == 2)
401 j = j * (60 * 24); 401 j = j * (60 * 24);
402 alarm->setStartOffset( j ); 402 alarm->setStartOffset( j );
403 403
404 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { 404 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
405 alarm->setProcedureAlarm(kap.mAlarmProgram); 405 alarm->setProcedureAlarm(kap.mAlarmProgram);
406 } 406 }
407 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 407 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
408 alarm->setAudioAlarm(kap.mAlarmSound); 408 alarm->setAudioAlarm(kap.mAlarmSound);
409 else 409 else
410 alarm->setType(Alarm::Invalid); 410 alarm->setType(Alarm::Invalid);
411 //alarm->setAudioAlarm("default"); 411 //alarm->setAudioAlarm("default");
412 // TODO: Deal with multiple alarms 412 // TODO: Deal with multiple alarms
413 break; // For now, stop after the first alarm 413 break; // For now, stop after the first alarm
414 } 414 }
415 } else { 415 } else {
416 Alarm* alarm = inc->alarms().first(); 416 Alarm* alarm = inc->alarms().first();
417 if ( alarm ) { 417 if ( alarm ) {
418 alarm->setEnabled(false); 418 alarm->setEnabled(false);
419 alarm->setType(Alarm::Invalid); 419 alarm->setType(Alarm::Invalid);
420 } 420 }
421 } 421 }
422 temp = item; 422 temp = item;
423 item = sel.next(); 423 item = sel.next();
424 mUidDict.remove( inc->uid() ); 424 mUidDict.remove( inc->uid() );
425 delete temp;; 425 delete temp;;
426 addIncidence( inc ); 426 addIncidence( inc );
427 } 427 }
428 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); 428 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) );
429 qDebug("KO: Set alarm for %d items", count); 429 qDebug("KO: Set alarm for %d items", count);
430 calendar()->reInitAlarmSettings(); 430 calendar()->reInitAlarmSettings();
431} 431}
432void KOListView::setCategories( bool removeOld ) 432void KOListView::setCategories( bool removeOld )
433{ 433{
434 434
435 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 435 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
436 if (! csd->exec()) { 436 if (! csd->exec()) {
437 delete csd; 437 delete csd;
438 return; 438 return;
439 } 439 }
440 QStringList catList = csd->selectedCategories(); 440 QStringList catList = csd->selectedCategories();
441 delete csd; 441 delete csd;
442 // if ( catList.count() == 0 ) 442 // if ( catList.count() == 0 )
443 // return; 443 // return;
444 catList.sort(); 444 catList.sort();
445 QString categoriesStr = catList.join(","); 445 QString categoriesStr = catList.join(",");
446 int i; 446 int i;
447 QStringList itemList; 447 QStringList itemList;
448 QPtrList<KOListViewItem> sel ; 448 QPtrList<KOListViewItem> sel ;
449 QListViewItem *qitem = mListView->firstChild (); 449 QListViewItem *qitem = mListView->firstChild ();
450 while ( qitem ) { 450 while ( qitem ) {
451 if ( qitem->isSelected() ) { 451 if ( qitem->isSelected() ) {
452 sel.append(((KOListViewItem *)qitem)); 452 sel.append(((KOListViewItem *)qitem));
453 } 453 }
454 qitem = qitem->nextSibling(); 454 qitem = qitem->nextSibling();
455 } 455 }
456 KOListViewItem * item, *temp; 456 KOListViewItem * item, *temp;
457 item = sel.first(); 457 item = sel.first();
458 Incidence* inc; 458 Incidence* inc;
459 while ( item ) { 459 while ( item ) {
460 inc = item->data(); 460 inc = item->data();
461 if ( removeOld ) { 461 if ( removeOld ) {
462 inc->setCategories( categoriesStr ); 462 inc->setCategories( categoriesStr );
463 } else { 463 } else {
464 itemList = QStringList::split (",", inc->categoriesStr() ); 464 itemList = QStringList::split (",", inc->categoriesStr() );
465 for( i = 0; i< catList.count(); ++i ) { 465 for( i = 0; i< catList.count(); ++i ) {
466 if ( !itemList.contains (catList[i])) 466 if ( !itemList.contains (catList[i]))
467 itemList.append( catList[i] ); 467 itemList.append( catList[i] );
468 } 468 }
469 itemList.sort(); 469 itemList.sort();
470 inc->setCategories( itemList.join(",") ); 470 inc->setCategories( itemList.join(",") );
471 } 471 }
472 temp = item; 472 temp = item;
473 item = sel.next(); 473 item = sel.next();
474 mUidDict.remove( inc->uid() ); 474 mUidDict.remove( inc->uid() );
475 delete temp;; 475 delete temp;;
476 addIncidence( inc ); 476 addIncidence( inc );
477 } 477 }
478} 478}
479 479
480void KOListView::beamSelected() 480void KOListView::beamSelected()
481{ 481{
482 int icount = 0; 482 int icount = 0;
483 QPtrList<Incidence> delSel ; 483 QPtrList<Incidence> delSel ;
484 QListViewItem *item = mListView->firstChild (); 484 QListViewItem *item = mListView->firstChild ();
485 while ( item ) { 485 while ( item ) {
486 if ( item->isSelected() ) { 486 if ( item->isSelected() ) {
487 delSel.append(((KOListViewItem *)item)->data()); 487 delSel.append(((KOListViewItem *)item)->data());
488 ++icount; 488 ++icount;
489 } 489 }
490 490
491 item = item->nextSibling(); 491 item = item->nextSibling();
492 } 492 }
493 if ( icount ) { 493 if ( icount ) {
494 emit beamIncidenceList( delSel ); 494 emit beamIncidenceList( delSel );
495 return; 495 return;
496 QString fn ; 496 QString fn ;
497 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 497 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
498 QString mes; 498 QString mes;
499 bool createbup = true; 499 bool createbup = true;
500 if ( createbup ) { 500 if ( createbup ) {
501 QString description = "\n"; 501 QString description = "\n";
502 CalendarLocal* cal = new CalendarLocal(); 502 CalendarLocal* cal = new CalendarLocal();
503 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 503 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
504 Incidence *incidence = delSel.first(); 504 Incidence *incidence = delSel.first();
505 while ( incidence ) { 505 while ( incidence ) {
506 Incidence *in = incidence->clone(); 506 Incidence *in = incidence->clone();
507 description += in->summary() + "\n"; 507 description += in->summary() + "\n";
508 cal->addIncidence( in ); 508 cal->addIncidence( in );
509 incidence = delSel.next(); 509 incidence = delSel.next();
510 } 510 }
511 FileStorage storage( cal, fn, new VCalFormat ); 511 FileStorage storage( cal, fn, new VCalFormat );
512 storage.save(); 512 storage.save();
513 delete cal; 513 delete cal;
514 mes = i18n("KO/Pi: Ready for beaming"); 514 mes = i18n("KO/Pi: Ready for beaming");
515 topLevelWidget()->setCaption(mes); 515 topLevelWidget()->setCaption(mes);
516 516
517#ifndef DESKTOP_VERSION 517#ifndef DESKTOP_VERSION
518 Ir *ir = new Ir( this ); 518 Ir *ir = new Ir( this );
519 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 519 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
520 ir->send( fn, description, "text/x-vCalendar" ); 520 ir->send( fn, description, "text/x-vCalendar" );
521#endif 521#endif
522 } 522 }
523 } 523 }
524} 524}
525void KOListView::beamDone( Ir *ir ) 525void KOListView::beamDone( Ir *ir )
526{ 526{
527#ifndef DESKTOP_VERSION 527#ifndef DESKTOP_VERSION
528 delete ir; 528 delete ir;
529#endif 529#endif
530 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); 530 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done"));
531} 531}
532 532
533void KOListView::saveDescriptionToFile() 533void KOListView::saveDescriptionToFile()
534{ 534{
535 535
536 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), 536 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
537 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 537 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
538 i18n("Continue"), i18n("Cancel"), 0, 538 i18n("Continue"), i18n("Cancel"), 0,
539 0, 1 ); 539 0, 1 );
540 if ( result != 0 ) { 540 if ( result != 0 ) {
541 return; 541 return;
542 } 542 }
543 int icount = 0; 543 int icount = 0;
544 QPtrList<Incidence> delSel ; 544 QPtrList<Incidence> delSel ;
545 QListViewItem *item = mListView->firstChild (); 545 QListViewItem *item = mListView->firstChild ();
546 while ( item ) { 546 while ( item ) {
547 if ( item->isSelected() ) { 547 if ( item->isSelected() ) {
548 delSel.append(((KOListViewItem *)item)->data()); 548 delSel.append(((KOListViewItem *)item)->data());
549 ++icount; 549 ++icount;
550 } 550 }
551 551
552 item = item->nextSibling(); 552 item = item->nextSibling();
553 } 553 }
554 if ( icount ) { 554 if ( icount ) {
555 QString fn = KOPrefs::instance()->mLastSaveFile; 555 QString fn = KOPrefs::instance()->mLastSaveFile;
556 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 556 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
557 557
558 if ( fn == "" ) 558 if ( fn == "" )
559 return; 559 return;
560 QFileInfo info; 560 QFileInfo info;
561 info.setFile( fn ); 561 info.setFile( fn );
562 QString mes; 562 QString mes;
563 bool createbup = true; 563 bool createbup = true;
564 if ( info. exists() ) { 564 if ( info. exists() ) {
565 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 565 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
566 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 566 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
567 i18n("Overwrite!"), i18n("Cancel"), 0, 567 i18n("Overwrite!"), i18n("Cancel"), 0,
568 0, 1 ); 568 0, 1 );
569 if ( result != 0 ) { 569 if ( result != 0 ) {
570 createbup = false; 570 createbup = false;
571 } 571 }
572 } 572 }
573 if ( createbup ) { 573 if ( createbup ) {
574 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + 574 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") +
575 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); 575 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
576 Incidence *incidence = delSel.first(); 576 Incidence *incidence = delSel.first();
577 icount = 0; 577 icount = 0;
578 while ( incidence ) { 578 while ( incidence ) {
579 if ( incidence->type() == "Journal" ) { 579 if ( incidence->type() == "Journal" ) {
580 text += "\n************************************\n"; 580 text += "\n************************************\n";
581 text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); 581 text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
582 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 582 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
583 text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); 583 text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
584 ++icount; 584 ++icount;
585 585
586 } else { 586 } else {
587 if ( !incidence->description().isEmpty() ) { 587 if ( !incidence->description().isEmpty() ) {
588 text += "\n************************************\n"; 588 text += "\n************************************\n";
589 if ( incidence->type() == "Todo" ) 589 if ( incidence->type() == "Todo" )
590 text += i18n("To-Do: "); 590 text += i18n("To-Do: ");
591 text += incidence->summary(); 591 text += incidence->summary();
592 if ( incidence->hasStartDate() ) 592 if ( incidence->hasStartDate() )
593 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); 593 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
594 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 594 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
595 if ( !incidence->location().isEmpty() ) 595 if ( !incidence->location().isEmpty() )
596 text += "\n" +i18n("Location: ") + incidence->location(); 596 text += "\n" +i18n("Location: ") + incidence->location();
597 text += "\n" + i18n("Description: ") + "\n" + incidence->description(); 597 text += "\n" + i18n("Description: ") + "\n" + incidence->description();
598 ++icount; 598 ++icount;
599 599
600 } 600 }
601 } 601 }
602 incidence = delSel.next(); 602 incidence = delSel.next();
603 } 603 }
604 QFile file( fn ); 604 QFile file( fn );
605 if (!file.open( IO_WriteOnly ) ) { 605 if (!file.open( IO_WriteOnly ) ) {
606 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); 606 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") );
607 return; 607 return;
608 } 608 }
609 QTextStream ts( &file ); 609 QTextStream ts( &file );
610 ts << text; 610 ts << text;
611 file.close(); 611 file.close();
612 //qDebug("%s ", text.latin1()); 612 //qDebug("%s ", text.latin1());
613 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); 613 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount );
614 KOPrefs::instance()->mLastSaveFile = fn; 614 KOPrefs::instance()->mLastSaveFile = fn;
615 topLevelWidget()->setCaption(mes); 615 topLevelWidget()->setCaption(mes);
616 } 616 }
617 } 617 }
618} 618}
619void KOListView::saveToFileVCS() 619void KOListView::saveToFileVCS()
620{ 620{
621 writeToFile( false ); 621 writeToFile( false );
622} 622}
623void KOListView::saveToFile() 623void KOListView::saveToFile()
624{ 624{
625 writeToFile( true ); 625 writeToFile( true );
626} 626}
627void KOListView::writeToFile( bool iCal ) 627void KOListView::writeToFile( bool iCal )
628{ 628{
629 629
630 int icount = 0; 630 int icount = 0;
631 QPtrList<Incidence> delSel ; 631 QPtrList<Incidence> delSel ;
632 QListViewItem *item = mListView->firstChild (); 632 QListViewItem *item = mListView->firstChild ();
633 bool journal = iCal; // warn only for vCal 633 bool journal = iCal; // warn only for vCal
634 while ( item ) { 634 while ( item ) {
635 if ( item->isSelected() ) { 635 if ( item->isSelected() ) {
636 if ( !journal ) 636 if ( !journal )
637 if ( ((KOListViewItem *)item)->data()->type() == "Journal") 637 if ( ((KOListViewItem *)item)->data()->type() == "Journal")
638 journal = true; 638 journal = true;
639 delSel.append(((KOListViewItem *)item)->data()); 639 delSel.append(((KOListViewItem *)item)->data());
640 ++icount; 640 ++icount;
641 } 641 }
642 642
643 item = item->nextSibling(); 643 item = item->nextSibling();
644 } 644 }
645 if ( !iCal && journal ) { 645 if ( !iCal && journal ) {
646 int result = KMessageBox::warningContinueCancel(this, 646 int result = KMessageBox::warningContinueCancel(this,
647 i18n("The journal entries can not be\nexported to a vCalendar file."), 647 i18n("The journal entries can not be\nexported to a vCalendar file."),
648 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 648 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
649 true); 649 true);
650 if (result != KMessageBox::Continue) return; 650 if (result != KMessageBox::Continue) return;
651 } 651 }
652 if ( icount ) { 652 if ( icount ) {
653 QString fn = KOPrefs::instance()->mLastSaveFile; 653 QString fn = KOPrefs::instance()->mLastSaveFile;
654 QString extension; 654 QString extension;
655 if ( iCal ) { 655 if ( iCal ) {
656 if ( fn.right( 4 ).lower() == ".vcs" ) { 656 if ( fn.right( 4 ).lower() == ".vcs" ) {
657 fn = fn.left( fn.length() -3) + "ics"; 657 fn = fn.left( fn.length() -3) + "ics";
658 } 658 }
659 } else { 659 } else {
660 if ( fn.right( 4 ).lower() == ".ics" ) { 660 if ( fn.right( 4 ).lower() == ".ics" ) {
661 fn = fn.left( fn.length() -3) + "vcs"; 661 fn = fn.left( fn.length() -3) + "vcs";
662 } 662 }
663 } 663 }
664 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 664 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
665 665
666 if ( fn == "" ) 666 if ( fn == "" )
667 return; 667 return;
668 QFileInfo info; 668 QFileInfo info;
669 info.setFile( fn ); 669 info.setFile( fn );
670 QString mes; 670 QString mes;
671 bool createbup = true; 671 bool createbup = true;
672 if ( info. exists() ) { 672 if ( info. exists() ) {
673 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 673 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
674 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 674 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
675 i18n("Overwrite!"), i18n("Cancel"), 0, 675 i18n("Overwrite!"), i18n("Cancel"), 0,
676 0, 1 ); 676 0, 1 );
677 if ( result != 0 ) { 677 if ( result != 0 ) {
678 createbup = false; 678 createbup = false;
679 } 679 }
680 } 680 }
681 if ( createbup ) { 681 if ( createbup ) {
682 CalendarLocal cal; 682 CalendarLocal cal;
683 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 683 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
684 Incidence *incidence = delSel.first(); 684 Incidence *incidence = delSel.first();
685 while ( incidence ) { 685 while ( incidence ) {
686 cal.addIncidence( incidence->clone() ); 686 cal.addIncidence( incidence->clone() );
687 incidence = delSel.next(); 687 incidence = delSel.next();
688 } 688 }
689 if ( iCal ) { 689 if ( iCal ) {
690 ICalFormat format; 690 ICalFormat format;
691 format.save( &cal, fn ); 691 format.save( &cal, fn );
692 } else { 692 } else {
693 693
694 VCalFormat format; 694 VCalFormat format;
695 format.save( &cal, fn ); 695 format.save( &cal, fn );
696 } 696 }
697 mes = i18n("KO/Pi:Saved %1").arg(fn ); 697 mes = i18n("KO/Pi:Saved %1").arg(fn );
698 KOPrefs::instance()->mLastSaveFile = fn; 698 KOPrefs::instance()->mLastSaveFile = fn;
699 topLevelWidget()->setCaption(mes); 699 topLevelWidget()->setCaption(mes);
700 } 700 }
701 } 701 }
702} 702}
703void KOListView::deleteAll() 703void KOListView::deleteAll()
704{ 704{
705 int icount = 0; 705 int icount = 0;
706 QPtrList<Incidence> delSel ; 706 QPtrList<Incidence> delSel ;
707 QListViewItem *item = mListView->firstChild (); 707 QListViewItem *item = mListView->firstChild ();
708 while ( item ) { 708 while ( item ) {
709 if ( item->isSelected() ) { 709 if ( item->isSelected() ) {
710 delSel.append(((KOListViewItem *)item)->data()); 710 delSel.append(((KOListViewItem *)item)->data());
711 ++icount; 711 ++icount;
712 } 712 }
713 713
714 item = item->nextSibling(); 714 item = item->nextSibling();
715 } 715 }
716 if ( icount ) { 716 if ( icount ) {
717 Incidence *incidence = delSel.first(); 717 Incidence *incidence = delSel.first();
718 Incidence *toDelete; 718 Incidence *toDelete;
719 KOPrefs *p = KOPrefs::instance(); 719 KOPrefs *p = KOPrefs::instance();
720 bool confirm = p->mConfirm; 720 bool confirm = p->mConfirm;
721 QString mess; 721 QString mess;
722 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); 722 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
723 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { 723 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) {
724 p->mConfirm = false; 724 p->mConfirm = false;
725 int delCounter = 0; 725 int delCounter = 0;
726 QDialog dia ( this, "p-dialog", true ); 726 QDialog dia ( this, "p-dialog", true );
727 QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); 727 QLabel lab (i18n("Close dialog to abort deletion!"), &dia );
728 QVBoxLayout lay( &dia ); 728 QVBoxLayout lay( &dia );
729 lay.setMargin(7); 729 lay.setMargin(7);
730 lay.setSpacing(7); 730 lay.setSpacing(7);
731 lay.addWidget( &lab); 731 lay.addWidget( &lab);
732 QProgressBar bar( icount, &dia ); 732 QProgressBar bar( icount, &dia );
733 lay.addWidget( &bar); 733 lay.addWidget( &bar);
734 int w = 220; 734 int w = 220;
735 int h = 50; 735 int h = 50;
736 int dw = QApplication::desktop()->width(); 736 int dw = QApplication::desktop()->width();
737 int dh = QApplication::desktop()->height(); 737 int dh = QApplication::desktop()->height();
738 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 738 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
739 //dia.resize( 240,50 ); 739 //dia.resize( 240,50 );
740 dia.show(); 740 dia.show();
741 741
742 while ( incidence ) { 742 while ( incidence ) {
743 bar.setProgress( delCounter ); 743 bar.setProgress( delCounter );
744 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); 744 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter );
745 dia.setCaption( mess ); 745 dia.setCaption( mess );
746 qApp->processEvents(); 746 qApp->processEvents();
747 toDelete = (incidence); 747 toDelete = (incidence);
748 incidence = delSel.next(); 748 incidence = delSel.next();
749 emit deleteIncidenceSignal(toDelete ); 749 emit deleteIncidenceSignal(toDelete );
750 if ( dia.result() != 0 ) 750 if ( dia.result() != 0 )
751 break; 751 break;
752 752
753 } 753 }
754 mess = mess.sprintf( i18n("%d items remaining in list."), count() ); 754 mess = mess.sprintf( i18n("%d items remaining in list."), count() );
755 topLevelWidget ()->setCaption( mess ); 755 topLevelWidget ()->setCaption( mess );
756 p->mConfirm = confirm; 756 p->mConfirm = confirm;
757 } 757 }
758 } 758 }
759 759
760 760
761} 761}
762int KOListView::maxDatesHint() 762int KOListView::maxDatesHint()
763{ 763{
764 return 0; 764 return 0;
765} 765}
766 766
767int KOListView::currentDateCount() 767int KOListView::currentDateCount()
768{ 768{
769 return 0; 769 return 0;
770} 770}
771 771
772QPtrList<Incidence> KOListView::selectedIncidences() 772QPtrList<Incidence> KOListView::selectedIncidences()
773{ 773{
774 QPtrList<Incidence> eventList; 774 QPtrList<Incidence> eventList;
775 QListViewItem *item = mListView->firstChild (); 775 QListViewItem *item = mListView->firstChild ();
776 while ( item ) { 776 while ( item ) {
777 if ( item->isSelected() ) { 777 if ( item->isSelected() ) {
778 eventList.append(((KOListViewItem *)item)->data()); 778 eventList.append(((KOListViewItem *)item)->data());
779 } 779 }
780 780
781 item = item->nextSibling(); 781 item = item->nextSibling();
782 } 782 }
783 783
784 // // QListViewItem *item = mListView->selectedItem(); 784 // // QListViewItem *item = mListView->selectedItem();
785 //if (item) eventList.append(((KOListViewItem *)item)->data()); 785 //if (item) eventList.append(((KOListViewItem *)item)->data());
786 786
787 return eventList; 787 return eventList;
788} 788}
789 789
790DateList KOListView::selectedDates() 790DateList KOListView::selectedDates()
791{ 791{
792 DateList eventList; 792 DateList eventList;
793 return eventList; 793 return eventList;
794} 794}
795 795
796void KOListView::showDates(bool show) 796void KOListView::showDates(bool show)
797{ 797{
798 // Shouldn't we set it to a value greater 0? When showDates is called with 798 // Shouldn't we set it to a value greater 0? When showDates is called with
799 // show == true at first, then the columnwidths are set to zero. 799 // show == true at first, then the columnwidths are set to zero.
800 static int oldColWidth1 = 0; 800 static int oldColWidth1 = 0;
801 static int oldColWidth3 = 0; 801 static int oldColWidth3 = 0;
802 802
803 if (!show) { 803 if (!show) {
804 oldColWidth1 = mListView->columnWidth(1); 804 oldColWidth1 = mListView->columnWidth(1);
805 oldColWidth3 = mListView->columnWidth(3); 805 oldColWidth3 = mListView->columnWidth(3);
806 mListView->setColumnWidth(1, 0); 806 mListView->setColumnWidth(1, 0);
807 mListView->setColumnWidth(3, 0); 807 mListView->setColumnWidth(3, 0);
808 } else { 808 } else {
809 mListView->setColumnWidth(1, oldColWidth1); 809 mListView->setColumnWidth(1, oldColWidth1);
810 mListView->setColumnWidth(3, oldColWidth3); 810 mListView->setColumnWidth(3, oldColWidth3);
811 } 811 }
812 mListView->repaint(); 812 mListView->repaint();
813} 813}
814 814
815void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, 815void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd,
816 const QDate &td) 816 const QDate &td)
817{ 817{
818#ifndef KORG_NOPRINTER 818#ifndef KORG_NOPRINTER
819 calPrinter->preview(CalPrinter::Day, fd, td); 819 calPrinter->preview(CalPrinter::Day, fd, td);
820#endif 820#endif
821} 821}
822 822
823void KOListView::showDates() 823void KOListView::showDates()
824{ 824{
825 showDates(true); 825 showDates(true);
826} 826}
827 827
828void KOListView::hideDates() 828void KOListView::hideDates()
829{ 829{
830 showDates(false); 830 showDates(false);
831} 831}
832void KOListView::resetFocus() 832void KOListView::resetFocus()
833{ 833{
834 mListView->setFocus(); 834 mListView->setFocus();
835} 835}
836void KOListView::updateView() 836void KOListView::updateView()
837{ 837{
838 mListView->setFocus(); 838 mListView->setFocus();
839 if ( mListView->firstChild () ) 839 if ( mListView->firstChild () )
840 mListView->setCurrentItem( mListView->firstChild () ); 840 mListView->setCurrentItem( mListView->firstChild () );
841} 841}
842void KOListView::updateConfig() 842void KOListView::updateConfig()
843{ 843{
844 844
845 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 845 mListView->setFont ( KOPrefs::instance()->mListViewFont );
846 updateView(); 846 updateView();
847 847
848} 848}
849void KOListView::setStartDate(const QDate &start) 849void KOListView::setStartDate(const QDate &start)
850{ 850{
851 mStartDate = start; 851 mStartDate = start;
852} 852}
853 853
854void KOListView::showDates(const QDate &start, const QDate &end) 854void KOListView::showDates(const QDate &start, const QDate &end)
855{ 855{
856 clear(); 856 clear();
857 mStartDate = start; 857 mStartDate = start;
858 QDate date = start; 858 QDate date = start;
859 QPtrList<Journal> j_list; 859 QPtrList<Journal> j_list;
860 while( date <= end ) { 860 while( date <= end ) {
861 addEvents(calendar()->events(date)); 861 addEvents(calendar()->events(date));
862 addTodos(calendar()->todos(date)); 862 addTodos(calendar()->todos(date));
863 Journal* jo = calendar()->journal(date); 863 Journal* jo = calendar()->journal(date);
864 if ( jo ) 864 if ( jo )
865 j_list.append( jo ); 865 j_list.append( jo );
866 date = date.addDays( 1 ); 866 date = date.addDays( 1 );
867 } 867 }
868 addJournals(j_list); 868 addJournals(j_list);
869 emit incidenceSelected( 0 ); 869 emit incidenceSelected( 0 );
870 updateView(); 870 updateView();
871 871
872} 872}
873 873
874void KOListView::addEvents(QPtrList<Event> eventList) 874void KOListView::addEvents(QPtrList<Event> eventList)
875{ 875{
876 Event *ev; 876 Event *ev;
877 for(ev = eventList.first(); ev; ev = eventList.next()) { 877 for(ev = eventList.first(); ev; ev = eventList.next()) {
878 addIncidence(ev); 878 addIncidence(ev);
879 } 879 }
880 if ( !mListView->currentItem() ){ 880 if ( !mListView->currentItem() ){
881 updateView(); 881 updateView();
882 } 882 }
883} 883}
884 884
885void KOListView::addTodos(QPtrList<Todo> eventList) 885void KOListView::addTodos(QPtrList<Todo> eventList)
886{ 886{
887 Todo *ev; 887 Todo *ev;
888 for(ev = eventList.first(); ev; ev = eventList.next()) { 888 for(ev = eventList.first(); ev; ev = eventList.next()) {
889 addIncidence(ev); 889 addIncidence(ev);
890 } 890 }
891 if ( !mListView->currentItem() ){ 891 if ( !mListView->currentItem() ){
892 updateView(); 892 updateView();
893 } 893 }
894} 894}
895void KOListView::addJournals(QPtrList<Journal> eventList) 895void KOListView::addJournals(QPtrList<Journal> eventList)
896{ 896{
897 Journal *ev; 897 Journal *ev;
898 for(ev = eventList.first(); ev; ev = eventList.next()) { 898 for(ev = eventList.first(); ev; ev = eventList.next()) {
899 addIncidence(ev); 899 addIncidence(ev);
900 } 900 }
901 if ( !mListView->currentItem() ){ 901 if ( !mListView->currentItem() ){
902 updateView(); 902 updateView();
903 } 903 }
904} 904}
905 905
906void KOListView::addIncidence(Incidence *incidence) 906void KOListView::addIncidence(Incidence *incidence)
907{ 907{
908 if ( mUidDict.find( incidence->uid() ) ) return; 908 if ( mUidDict.find( incidence->uid() ) ) return;
909 909
910 // mListView->setFont ( KOPrefs::instance()->mListViewFont ); 910 // mListView->setFont ( KOPrefs::instance()->mListViewFont );
911 mUidDict.insert( incidence->uid(), incidence ); 911 mUidDict.insert( incidence->uid(), incidence );
912 912
913 KOListViewItem *item = new KOListViewItem( incidence, mListView ); 913 KOListViewItem *item = new KOListViewItem( incidence, mListView );
914 ListItemVisitor v(item, mStartDate ); 914 ListItemVisitor v(item, mStartDate );
915 if (incidence->accept(v)) return; 915 if (incidence->accept(v)) return;
916 else delete item; 916 else delete item;
917 //qDebug("delete item "); 917 //qDebug("delete item ");
918} 918}
919 919
920void KOListView::showEvents(QPtrList<Event> eventList) 920void KOListView::showEvents(QPtrList<Event> eventList)
921{ 921{
922 clear(); 922 clear();
923 923
924 addEvents(eventList); 924 addEvents(eventList);
925 925
926 // After new creation of list view no events are selected. 926 // After new creation of list view no events are selected.
927 emit incidenceSelected( 0 ); 927 emit incidenceSelected( 0 );
928} 928}
929int KOListView::count() 929int KOListView::count()
930{ 930{
931 return mListView->childCount(); 931 return mListView->childCount();
932} 932}
933 933
934void KOListView::changeEventDisplay(Event *event, int action) 934void KOListView::changeEventDisplay(Event *event, int action)
935{ 935{
936 KOListViewItem *item; 936 KOListViewItem *item;
937 937
938 switch(action) { 938 switch(action) {
939 case KOGlobals::EVENTADDED: 939 case KOGlobals::EVENTADDED:
940 addIncidence( event ); 940 addIncidence( event );
941 break; 941 break;
942 case KOGlobals::EVENTEDITED: 942 case KOGlobals::EVENTEDITED:
943 item = getItemForEvent(event); 943 item = getItemForEvent(event);
944 if (item) { 944 if (item) {
945 mUidDict.remove( event->uid() ); 945 mUidDict.remove( event->uid() );
946 delete item; 946 delete item;
947 addIncidence( event ); 947 addIncidence( event );
948 } 948 }
949 break; 949 break;
950 case KOGlobals::EVENTDELETED: 950 case KOGlobals::EVENTDELETED:
951 item = getItemForEvent(event); 951 item = getItemForEvent(event);
952 if (item) { 952 if (item) {
953 mUidDict.remove( event->uid() ); 953 mUidDict.remove( event->uid() );
954 delete item; 954 delete item;
955 } 955 }
956 break; 956 break;
957 default: 957 default:
958 ; 958 ;
959 } 959 }
960} 960}
961 961
962KOListViewItem *KOListView::getItemForEvent(Event *event) 962KOListViewItem *KOListView::getItemForEvent(Event *event)
963{ 963{
964 KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); 964 KOListViewItem *item = (KOListViewItem *)mListView->firstChild();
965 while (item) { 965 while (item) {
966 if (item->data() == event) return item; 966 if (item->data() == event) return item;
967 item = (KOListViewItem *)item->nextSibling(); 967 item = (KOListViewItem *)item->nextSibling();
968 } 968 }
969 return 0; 969 return 0;
970} 970}
971 971
972void KOListView::defaultItemAction(QListViewItem *i) 972void KOListView::defaultItemAction(QListViewItem *i)
973{ 973{
974 KOListViewItem *item = static_cast<KOListViewItem *>( i ); 974 KOListViewItem *item = static_cast<KOListViewItem *>( i );
975 if ( item ) defaultAction( item->data() ); 975 if ( item ) defaultAction( item->data() );
976 976
977} 977}
978 978
979void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) 979void KOListView::popupMenu(QListViewItem *item,const QPoint &,int)
980{ 980{
981 mActiveItem = (KOListViewItem *)item; 981 mActiveItem = (KOListViewItem *)item;
982 if (mActiveItem) { 982 if (mActiveItem) {
983 Incidence *incidence = mActiveItem->data(); 983 Incidence *incidence = mActiveItem->data();
984 mPopupMenu->showIncidencePopup(incidence); 984 mPopupMenu->showIncidencePopup(incidence);
985 985
986 /* 986 /*
987 if ( incidence && incidence->type() == "Event" ) { 987 if ( incidence && incidence->type() == "Event" ) {
988 Event *event = static_cast<Event *>( incidence ); 988 Event *event = static_cast<Event *>( incidence );
989 mPopupMenu->showEventPopup(event); 989 mPopupMenu->showEventPopup(event);
990 } 990 }
991 */ 991 */
992 } 992 }
993} 993}
994 994
995void KOListView::readSettings(KConfig *config, QString setting) 995void KOListView::readSettings(KConfig *config, QString setting)
996{ 996{
997 // qDebug("KOListView::readSettings "); 997 // qDebug("KOListView::readSettings ");
998 mListView->restoreLayout(config,setting); 998 mListView->restoreLayout(config,setting);
999} 999}
1000 1000
1001void KOListView::writeSettings(KConfig *config, QString setting) 1001void KOListView::writeSettings(KConfig *config, QString setting)
1002{ 1002{
1003 // qDebug("KOListView::writeSettings "); 1003 // qDebug("KOListView::writeSettings ");
1004 mListView->saveLayout(config, setting); 1004 mListView->saveLayout(config, setting);
1005} 1005}
1006 1006
1007void KOListView::processSelectionChange(QListViewItem *) 1007void KOListView::processSelectionChange(QListViewItem *)
1008{ 1008{
1009 1009
1010 KOListViewItem *item = 1010 KOListViewItem *item =
1011 static_cast<KOListViewItem *>( mListView->currentItem() ); 1011 static_cast<KOListViewItem *>( mListView->currentItem() );
1012 1012
1013 if ( !item ) { 1013 if ( !item ) {
1014 emit incidenceSelected( 0 ); 1014 emit incidenceSelected( 0 );
1015 } else { 1015 } else {
1016 emit incidenceSelected( item->data() ); 1016 emit incidenceSelected( item->data() );
1017 } 1017 }
1018} 1018}
1019 1019
1020void KOListView::clearSelection() 1020void KOListView::clearSelection()
1021{ 1021{
1022 mListView->selectAll( false ); 1022 mListView->selectAll( false );
1023} 1023}
1024void KOListView::allSelection() 1024void KOListView::allSelection()
1025{ 1025{
1026 mListView->selectAll( true ); 1026 mListView->selectAll( true );
1027} 1027}
1028 1028
1029void KOListView::clear() 1029void KOListView::clear()
1030{ 1030{
1031 mListView->clear(); 1031 mListView->clear();
1032 mUidDict.clear(); 1032 mUidDict.clear();
1033} 1033}
1034 1034
1035Incidence* KOListView::currentItem() 1035Incidence* KOListView::currentItem()
1036{ 1036{
1037 if ( mListView->currentItem() ) 1037 if ( mListView->currentItem() )
1038 return ((KOListViewItem*) mListView->currentItem())->data(); 1038 return ((KOListViewItem*) mListView->currentItem())->data();
1039 return 0; 1039 return 0;
1040} 1040}
1041void KOListView::keyPressEvent ( QKeyEvent *e) 1041void KOListView::keyPressEvent ( QKeyEvent *e)
1042{ 1042{
1043 1043
1044 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { 1044 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) {
1045 deleteAll(); 1045 deleteAll();
1046 return; 1046 return;
1047 } 1047 }
1048 1048
1049 e->ignore(); 1049 e->ignore();
1050} 1050}
1051void KOListViewListView::keyPressEvent ( QKeyEvent *e) 1051void KOListViewListView::keyPressEvent ( QKeyEvent *e)
1052{ 1052{
1053 1053
1054 switch ( e->key() ) { 1054 switch ( e->key() ) {
1055 case Qt::Key_Down: 1055 case Qt::Key_Down:
1056 if ( e->state() == ShiftButton ) { 1056 if ( e->state() == ShiftButton ) {
1057 QListViewItem* cn = currentItem(); 1057 QListViewItem* cn = currentItem();
1058 if ( !cn ) 1058 if ( !cn )
1059 cn = firstChild(); 1059 cn = firstChild();
1060 if ( !cn ) 1060 if ( !cn )
1061 return; 1061 return;
1062 while ( cn->nextSibling() ) 1062 while ( cn->nextSibling() )
1063 cn = cn->nextSibling(); 1063 cn = cn->nextSibling();
1064 setCurrentItem ( cn ); 1064 setCurrentItem ( cn );
1065 ensureItemVisible ( cn ); 1065 ensureItemVisible ( cn );
1066 1066
1067 e->accept(); 1067 e->accept();
1068 return; 1068 return;
1069 } 1069 }
1070 if ( e->state() == ControlButton ) { 1070 if ( e->state() == ControlButton ) {
1071 int count = childCount (); 1071 int count = childCount ();
1072 int jump = count / 5; 1072 int jump = count / 5;
1073 QListViewItem* cn; 1073 QListViewItem* cn;
1074 cn = currentItem(); 1074 cn = currentItem();
1075 if ( ! cn ) 1075 if ( ! cn )
1076 return; 1076 return;
1077 if ( jump == 0 ) 1077 if ( jump == 0 )
1078 jump = 1; 1078 jump = 1;
1079 while ( jump && cn->nextSibling() ) { 1079 while ( jump && cn->nextSibling() ) {
1080 cn = cn->nextSibling(); 1080 cn = cn->nextSibling();
1081 --jump; 1081 --jump;
1082 } 1082 }
1083 setCurrentItem ( cn ); 1083 setCurrentItem ( cn );
1084 ensureItemVisible ( cn ); 1084 ensureItemVisible ( cn );
1085 1085
1086 } else 1086 } else
1087 QListView::keyPressEvent ( e ) ; 1087 QListView::keyPressEvent ( e ) ;
1088 e->accept(); 1088 e->accept();
1089 break; 1089 break;
1090 1090
1091 case Qt::Key_Up: 1091 case Qt::Key_Up:
1092 if ( e->state() == ShiftButton ) { 1092 if ( e->state() == ShiftButton ) {
1093 QListViewItem* cn = firstChild(); 1093 QListViewItem* cn = firstChild();
1094 if ( cn ) { 1094 if ( cn ) {
1095 setCurrentItem ( cn ); 1095 setCurrentItem ( cn );
1096 ensureItemVisible ( cn ); 1096 ensureItemVisible ( cn );
1097 } 1097 }
1098 e->accept(); 1098 e->accept();
1099 return; 1099 return;
1100 } 1100 }
1101 if ( e->state() == ControlButton ) { 1101 if ( e->state() == ControlButton ) {
1102 int count = childCount (); 1102 int count = childCount ();
1103 int jump = count / 5; 1103 int jump = count / 5;
1104 QListViewItem* cn; 1104 QListViewItem* cn;
1105 cn = currentItem(); 1105 cn = currentItem();
1106 if ( ! cn ) 1106 if ( ! cn )
1107 return; 1107 return;
1108 if ( jump == 0 ) 1108 if ( jump == 0 )
1109 jump = 1; 1109 jump = 1;
1110 while ( jump && cn->itemAbove ()) { 1110 while ( jump && cn->itemAbove ()) {
1111 cn = cn->itemAbove (); 1111 cn = cn->itemAbove ();
1112 --jump; 1112 --jump;
1113 } 1113 }
1114 setCurrentItem ( cn ); 1114 setCurrentItem ( cn );
1115 ensureItemVisible ( cn ); 1115 ensureItemVisible ( cn );
1116 } else 1116 } else
1117 QListView::keyPressEvent ( e ) ; 1117 QListView::keyPressEvent ( e ) ;
1118 e->accept(); 1118 e->accept();
1119 break; 1119 break;
1120 case Qt::Key_I: { 1120 case Qt::Key_I: {
1121 QListViewItem* cn; 1121 QListViewItem* cn;
1122 cn = currentItem(); 1122 cn = currentItem();
1123 if ( cn ) { 1123 if ( cn ) {
1124 KOListViewItem* ci = (KOListViewItem*)( cn ); 1124 KOListViewItem* ci = (KOListViewItem*)( cn );
1125 if ( ci ){ 1125 if ( ci ){
1126 //emit showIncidence( ci->data()); 1126 //emit showIncidence( ci->data());
1127 cn = cn->nextSibling(); 1127 cn = cn->nextSibling();
1128 if ( cn ) { 1128 if ( cn ) {
1129 setCurrentItem ( cn ); 1129 setCurrentItem ( cn );
1130 ensureItemVisible ( cn ); 1130 ensureItemVisible ( cn );
1131 } 1131 }
1132 emit showIncidence( ci->data()); 1132 emit showIncidence( ci->data());
1133 } 1133 }
1134 } 1134 }
1135 e->accept(); 1135 e->accept();
1136 } 1136 }
1137 break; 1137 break;
1138 case Qt::Key_Return: 1138 case Qt::Key_Return:
1139 case Qt::Key_Enter: 1139 case Qt::Key_Enter:
1140 { 1140 {
1141 QListViewItem* cn; 1141 QListViewItem* cn;
1142 cn = currentItem(); 1142 cn = currentItem();
1143 if ( cn ) { 1143 if ( cn ) {
1144 KOListViewItem* ci = (KOListViewItem*)( cn ); 1144 KOListViewItem* ci = (KOListViewItem*)( cn );
1145 if ( ci ){ 1145 if ( ci ){
1146 if ( e->state() == ShiftButton ) 1146 if ( e->state() == ShiftButton )
1147 ci->setSelected( false ); 1147 ci->setSelected( false );
1148 else 1148 else
1149 ci->setSelected( true ); 1149 ci->setSelected( true );
1150 cn = cn->nextSibling(); 1150 cn = cn->nextSibling();
1151 if ( cn ) { 1151 if ( cn ) {
1152 setCurrentItem ( cn ); 1152 setCurrentItem ( cn );
1153 ensureItemVisible ( cn ); 1153 ensureItemVisible ( cn );
1154 } 1154 }
1155 } 1155 }
1156 } 1156 }
1157 e->accept(); 1157 e->accept();
1158 } 1158 }
1159 break; 1159 break;
1160 default: 1160 default:
1161 e->ignore(); 1161 e->ignore();
1162 } 1162 }
1163} 1163}
1164KOListViewListView::KOListViewListView(KOListView * lv ) 1164KOListViewListView::KOListViewListView(KOListView * lv )
1165 : KListView( lv, "kolistlistview", false ) 1165 : KListView( lv, "kolistlistview", false )
1166{ 1166{
1167 mPopupTimer = new QTimer(this); 1167 mPopupTimer = new QTimer(this);
1168 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); 1168 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
1169#ifndef DESKTOP_VERSION 1169#ifndef DESKTOP_VERSION
1170 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 1170 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
1171#endif 1171#endif
1172 setSelectionMode( QListView::Multi ); 1172 setSelectionMode( QListView::Multi );
1173 setMultiSelection( true); 1173 setMultiSelection( true);
1174} 1174}
1175void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 1175void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
1176{ 1176{
1177 if (!e) return; 1177 if (!e) return;
1178 QPoint vp = contentsToViewport(e->pos()); 1178 QPoint vp = contentsToViewport(e->pos());
1179 QListViewItem *item = itemAt(vp); 1179 QListViewItem *item = itemAt(vp);
1180 if (!item) { 1180 if (!item) {
1181 emit newEvent(); 1181 emit newEvent();
1182 return; 1182 return;
1183 } 1183 }
1184 KListView::contentsMouseDoubleClickEvent(e); 1184 KListView::contentsMouseDoubleClickEvent(e);
1185} 1185}
1186#if 0 1186#if 0
1187void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1187void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1188{ 1188{
1189 //qDebug("contentsMousePressEvent++++ "); 1189 //qDebug("contentsMousePressEvent++++ ");
1190 KListView::contentsMousePressEvent( e ); 1190 KListView::contentsMousePressEvent( e );
1191 if ( e->button() == RightButton ) { 1191 if ( e->button() == RightButton ) {
1192 QListViewItem* ci = currentItem(); 1192 QListViewItem* ci = currentItem();
1193 clearSelection () ; 1193 clearSelection () ;
1194 if ( ci ) 1194 if ( ci )
1195 ci->setSelected( true ); 1195 ci->setSelected( true );
1196 } 1196 }
1197} 1197}
1198void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1198void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1199{ 1199{
1200 KListView::contentsMouseReleaseEvent(e); 1200 KListView::contentsMouseReleaseEvent(e);
1201} 1201}
1202void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1202void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1203{ 1203{
1204 KListView::contentsMouseMoveEvent(e); 1204 KListView::contentsMouseMoveEvent(e);
1205} 1205}
1206#endif 1206#endif
1207void KOListViewListView::popupMenu() 1207void KOListViewListView::popupMenu()
1208{ 1208{
1209 mPopupTimer->stop(); 1209 mPopupTimer->stop();
1210 //qDebug("HUUUUUUUUUUUUUUUUUUUU ");
1211 QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); 1210 QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton );
1212 QApplication::postEvent( this->viewport(), e ); 1211 QApplication::postEvent( this->viewport(), e );
1212
1213} 1213}
1214void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1214void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1215{ 1215{
1216 //qDebug("contentsMousePressEvent++++ "); 1216 //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y());
1217 mYMousePos = mapToGlobal( (e->pos())).y(); 1217 mYMousePos = mapToGlobal( (e->pos())).y();
1218 if ( e->button() == LeftButton ) { 1218 if ( e->button() == LeftButton ) {
1219 mPopupTimer->start( 600 ); 1219 mPopupTimer->start( 600 );
1220 mEventPos = e->pos(); 1220 mEventPos = contentsToViewport(e->pos());
1221 mEventGlobalPos = e->globalPos(); 1221 mEventGlobalPos = e->globalPos();
1222 } 1222 }
1223 KListView::contentsMousePressEvent( e ); 1223 KListView::contentsMousePressEvent( e );
1224 if ( e->button() == RightButton ) { 1224 if ( e->button() == RightButton ) {
1225 QListViewItem* ci = currentItem(); 1225 QListViewItem* ci = currentItem();
1226 //clearSelection(); 1226 //clearSelection();
1227 if ( ci ) 1227 if ( ci )
1228 ci->setSelected( true ); 1228 ci->setSelected( true );
1229 } 1229 }
1230} 1230}
1231void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1231void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1232{ 1232{
1233 mPopupTimer->stop(); 1233 mPopupTimer->stop();
1234 KListView::contentsMouseReleaseEvent(e); 1234 KListView::contentsMouseReleaseEvent(e);
1235} 1235}
1236void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1236void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1237{ 1237{
1238 // qDebug("contentsMouseMoveEv....... "); 1238 // qDebug("contentsMouseMoveEv....... ");
1239 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); 1239 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() );
1240 int diff = mYMousePos - mapToGlobal( (e->pos())).y(); 1240 int diff = mYMousePos - mapToGlobal( (e->pos())).y();
1241 if ( diff < 0 ) diff = -diff; 1241 if ( diff < 0 ) diff = -diff;
1242 if ( diff > 15 ) 1242 if ( diff > 15 )
1243 mPopupTimer->stop(); 1243 mPopupTimer->stop();
1244 else { 1244 else {
1245 mEventPos = e->pos(); 1245 mEventPos = contentsToViewport(e->pos());
1246 mEventGlobalPos = e->globalPos(); 1246 mEventGlobalPos = e->globalPos();
1247 } 1247 }
1248 KListView::contentsMouseMoveEvent(e); 1248 KListView::contentsMouseMoveEvent(e);
1249} 1249}
1250 1250
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 8439b81..e72f94b 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -1,1727 +1,1724 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 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 <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qfont.h> 29#include <qfont.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qvbox.h> 34#include <qvbox.h>
35#include <qhbox.h> 35#include <qhbox.h>
36#include <qregexp.h> 36#include <qregexp.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qradiobutton.h> 40#include <qradiobutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qstrlist.h> 42#include <qstrlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44 44
45#include <kcolorbutton.h> 45#include <kcolorbutton.h>
46#include <kdebug.h> 46#include <kdebug.h>
47#include <klocale.h> 47#include <klocale.h>
48#include <kglobal.h> 48#include <kglobal.h>
49#include <kfontdialog.h> 49#include <kfontdialog.h>
50#include <kfiledialog.h> 50#include <kfiledialog.h>
51#include <kmessagebox.h> 51#include <kmessagebox.h>
52#include <kcolordialog.h> 52#include <kcolordialog.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54#include <kemailsettings.h> 54#include <kemailsettings.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56#include <kglobalsettings.h> 56#include <kglobalsettings.h>
57 57
58#include <kurlrequester.h> 58#include <kurlrequester.h>
59#include <klineedit.h> 59#include <klineedit.h>
60 60
61#if defined(USE_SOLARIS) 61#if defined(USE_SOLARIS)
62#include <sys/param.h> 62#include <sys/param.h>
63 63
64#define ZONEINFODIR "/usr/share/lib/zoneinfo" 64#define ZONEINFODIR "/usr/share/lib/zoneinfo"
65#define INITFILE "/etc/default/init" 65#define INITFILE "/etc/default/init"
66#endif 66#endif
67 67
68#include "koprefs.h" 68#include "koprefs.h"
69 69
70#include "koprefsdialog.h" 70#include "koprefsdialog.h"
71#include "kpimglobalprefs.h" 71#include "kpimglobalprefs.h"
72 72
73 73
74KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : 74KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
75 KPrefsDialog(KOPrefs::instance(),parent,name,true) 75 KPrefsDialog(KOPrefs::instance(),parent,name,true)
76{ 76{
77 77
78 setFont( KGlobalSettings::generalFont() ); 78 setFont( KGlobalSettings::generalFont() );
79 setCaption( i18n("Preferences - some settings need a restart (nr)")); 79 setCaption( i18n("Preferences - some settings need a restart (nr)"));
80 mCategoryDict.setAutoDelete(true); 80 mCategoryDict.setAutoDelete(true);
81 81
82 KGlobal::locale()->insertCatalogue("timezones"); 82 KGlobal::locale()->insertCatalogue("timezones");
83 mSpacingHint = spacingHintSmall(); 83 mSpacingHint = spacingHintSmall();
84 mMarginHint = marginHintSmall(); 84 mMarginHint = marginHintSmall();
85#ifndef DESKTOP_VERSION 85#ifndef DESKTOP_VERSION
86 if ( QApplication::desktop()->height() == 480 ) 86 if ( QApplication::desktop()->height() == 480 )
87 hideButtons(); 87 hideButtons();
88#endif 88#endif
89 89
90 setupGlobalTab(); 90 setupGlobalTab();
91 setupMainTab(); 91 setupMainTab();
92 // setupLocaleTab(); 92 // setupLocaleTab();
93 //setupTimeZoneTab(); 93 //setupTimeZoneTab();
94 setupTimeTab(); 94 setupTimeTab();
95 //setupLocaleDateTab(); 95 //setupLocaleDateTab();
96 setupFontsTab(); 96 setupFontsTab();
97 setupColorsTab(); 97 setupColorsTab();
98 setupViewsTab(); 98 setupViewsTab();
99 //setupSyncTab(); 99 //setupSyncTab();
100 //setupSyncAlgTab(); 100 //setupSyncAlgTab();
101 //setupPrinterTab(); 101 //setupPrinterTab();
102 //setupGroupSchedulingTab(); 102 //setupGroupSchedulingTab();
103 //setupGroupAutomationTab(); 103 //setupGroupAutomationTab();
104 104
105 105
106} 106}
107 107
108 108
109KOPrefsDialog::~KOPrefsDialog() 109KOPrefsDialog::~KOPrefsDialog()
110{ 110{
111} 111}
112void KOPrefsDialog::setupGlobalTab() 112void KOPrefsDialog::setupGlobalTab()
113{ 113{
114 QFrame *topFrame = addPage(i18n("Global"),0,0); 114 QFrame *topFrame = addPage(i18n("Global"),0,0);
115 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); 115 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" );
116 QVBoxLayout *topLayout = new QVBoxLayout(topFrame); 116 QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
117 topLayout->addWidget( kdelibcfg ); 117 topLayout->addWidget( kdelibcfg );
118 118
119 119
120} 120}
121void KOPrefsDialog::setupLocaleDateTab() 121void KOPrefsDialog::setupLocaleDateTab()
122{ 122{
123#if 0 123#if 0
124QFrame *topFrame = addPage(i18n("Date Format"),0,0); 124QFrame *topFrame = addPage(i18n("Date Format"),0,0);
125 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 125 QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
126 topLayout->setSpacing(mSpacingHint); 126 topLayout->setSpacing(mSpacingHint);
127 topLayout->setMargin(mMarginHint); 127 topLayout->setMargin(mMarginHint);
128 int iii = 0; 128 int iii = 0;
129 129
130 130
131 KPrefsDialogWidRadios *syncPrefsGroup = 131 KPrefsDialogWidRadios *syncPrefsGroup =
132 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 132 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
133 QString format; 133 QString format;
134 if ( QApplication::desktop()->width() < 480 ) 134 if ( QApplication::desktop()->width() < 480 )
135 format = "(%d.%m.%Y)"; 135 format = "(%d.%m.%Y)";
136 else 136 else
137 format = "(%d.%m.%Y|%A %d %B %Y)"; 137 format = "(%d.%m.%Y|%A %d %B %Y)";
138 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 138 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
139 if ( QApplication::desktop()->width() < 480 ) 139 if ( QApplication::desktop()->width() < 480 )
140 format = "(%m.%d.%Y)"; 140 format = "(%m.%d.%Y)";
141 else 141 else
142 format = "(%m.%d.%Y|%A %B %d %Y)"; 142 format = "(%m.%d.%Y|%A %B %d %Y)";
143 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 143 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
144 if ( QApplication::desktop()->width() < 480 ) 144 if ( QApplication::desktop()->width() < 480 )
145 format = "(%Y-%m-%d)"; 145 format = "(%Y-%m-%d)";
146 else 146 else
147 format = "(%Y-%m-%d|%A %Y %B %d)"; 147 format = "(%Y-%m-%d|%A %Y %B %d)";
148 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 148 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
149 syncPrefsGroup->addRadio(i18n("User defined")); 149 syncPrefsGroup->addRadio(i18n("User defined"));
150 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 150 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
151 ++iii; 151 ++iii;
152 ++iii; 152 ++iii;
153 QLabel * lab; 153 QLabel * lab;
154 mUserDateFormatLong = new QLineEdit(topFrame); 154 mUserDateFormatLong = new QLineEdit(topFrame);
155 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 155 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
156 topLayout->addWidget(lab ,iii,0); 156 topLayout->addWidget(lab ,iii,0);
157 topLayout->addWidget(mUserDateFormatLong,iii,1); 157 topLayout->addWidget(mUserDateFormatLong,iii,1);
158 ++iii; 158 ++iii;
159 mUserDateFormatShort = new QLineEdit(topFrame); 159 mUserDateFormatShort = new QLineEdit(topFrame);
160 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 160 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
161 topLayout->addWidget(lab ,iii,0); 161 topLayout->addWidget(lab ,iii,0);
162 topLayout->addWidget(mUserDateFormatShort,iii,1); 162 topLayout->addWidget(mUserDateFormatShort,iii,1);
163 ++iii; 163 ++iii;
164 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 164 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
165 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 165 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
166 ++iii; 166 ++iii;
167 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 167 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
168 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 168 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
169 ++iii; 169 ++iii;
170 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 170 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
171 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 171 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
172 ++iii; 172 ++iii;
173#endif 173#endif
174 174
175} 175}
176 176
177void KOPrefsDialog::setupLocaleTab() 177void KOPrefsDialog::setupLocaleTab()
178{ 178{
179#if 0 179#if 0
180 QFrame *topFrame = addPage(i18n("Locale"),0,0); 180 QFrame *topFrame = addPage(i18n("Locale"),0,0);
181 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 181 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
182 topLayout->setSpacing(mSpacingHint); 182 topLayout->setSpacing(mSpacingHint);
183 topLayout->setMargin(mMarginHint); 183 topLayout->setMargin(mMarginHint);
184 int iii = 0; 184 int iii = 0;
185 KPrefsDialogWidRadios *syncPrefsGroup = 185 KPrefsDialogWidRadios *syncPrefsGroup =
186 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); 186 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame);
187 syncPrefsGroup->addRadio(i18n("English")); 187 syncPrefsGroup->addRadio(i18n("English"));
188 syncPrefsGroup->addRadio(i18n("German")); 188 syncPrefsGroup->addRadio(i18n("German"));
189 syncPrefsGroup->addRadio(i18n("French")); 189 syncPrefsGroup->addRadio(i18n("French"));
190 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 190 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
191 if ( QApplication::desktop()->width() < 300 ) 191 if ( QApplication::desktop()->width() < 300 )
192 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 192 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
193 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 193 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
194 ++iii; 194 ++iii;
195 195
196 syncPrefsGroup = 196 syncPrefsGroup =
197 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); 197 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame);
198 if ( QApplication::desktop()->width() > 300 ) 198 if ( QApplication::desktop()->width() > 300 )
199 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 199 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
200 syncPrefsGroup->addRadio(i18n("24:00")); 200 syncPrefsGroup->addRadio(i18n("24:00"));
201 syncPrefsGroup->addRadio(i18n("12:00am")); 201 syncPrefsGroup->addRadio(i18n("12:00am"));
202 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 202 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
203 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 203 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
204 ++iii; 204 ++iii;
205 KPrefsDialogWidBool *sb; 205 KPrefsDialogWidBool *sb;
206 if ( QApplication::desktop()->width() < 300 ) { 206 if ( QApplication::desktop()->width() < 300 ) {
207 sb = 207 sb =
208 addWidBool(i18n("Week starts on Sunday"), 208 addWidBool(i18n("Week starts on Sunday"),
209 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); 209 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame);
210 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 210 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
211 ++iii; 211 ++iii;
212 sb = 212 sb =
213 addWidBool(i18n("Use short date in (WN/E) view"), 213 addWidBool(i18n("Use short date in (WN/E) view"),
214 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 214 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
215 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 215 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
216 } 216 }
217 else { 217 else {
218 QWidget * hb = new QWidget( topFrame ); 218 QWidget * hb = new QWidget( topFrame );
219 QHBoxLayout *hbLayout = new QHBoxLayout(hb); 219 QHBoxLayout *hbLayout = new QHBoxLayout(hb);
220 sb = 220 sb =
221 addWidBool(i18n("Week starts on Sunday"), 221 addWidBool(i18n("Week starts on Sunday"),
222 &(KOPrefs::instance()->mWeekStartsOnSunday),hb); 222 &(KOPrefs::instance()->mWeekStartsOnSunday),hb);
223 hbLayout->addWidget(sb->checkBox() ); 223 hbLayout->addWidget(sb->checkBox() );
224 sb = 224 sb =
225 addWidBool(i18n("Use short date in (WN/E) view"), 225 addWidBool(i18n("Use short date in (WN/E) view"),
226 &(KOPrefs::instance()->mShortDateInViewer),hb); 226 &(KOPrefs::instance()->mShortDateInViewer),hb);
227 hbLayout->addWidget(sb->checkBox() ); 227 hbLayout->addWidget(sb->checkBox() );
228 topLayout->addMultiCellWidget(hb, iii,iii,0,1); 228 topLayout->addMultiCellWidget(hb, iii,iii,0,1);
229 229
230 } 230 }
231 // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION 231 // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION
232#if 0 232#if 0
233 ++iii; 233 ++iii;
234 sb = 234 sb =
235 addWidBool(i18n("Quick load/save (w/o Unicode)"), 235 addWidBool(i18n("Quick load/save (w/o Unicode)"),
236 &(KOPrefs::instance()->mUseQuicksave),topFrame); 236 &(KOPrefs::instance()->mUseQuicksave),topFrame);
237 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 237 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
238#endif 238#endif
239#endif 239#endif
240} 240}
241void KOPrefsDialog::showSyncPage() 241void KOPrefsDialog::showSyncPage()
242{ 242{
243 showPage ( 0 ) ; 243 showPage ( 0 ) ;
244 kdelibcfg->showTimeZoneTab() ; 244 kdelibcfg->showTimeZoneTab() ;
245 245
246} 246}
247void KOPrefsDialog::setupSyncAlgTab() 247void KOPrefsDialog::setupSyncAlgTab()
248{ 248{
249#if 0 249#if 0
250 QLabel * lab; 250 QLabel * lab;
251 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); 251 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0);
252 mSetupSyncAlgTab = topFrame; 252 mSetupSyncAlgTab = topFrame;
253 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 253 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
254 topLayout->setSpacing(mSpacingHint); 254 topLayout->setSpacing(mSpacingHint);
255 topLayout->setMargin(mMarginHint); 255 topLayout->setMargin(mMarginHint);
256 int iii = 0; 256 int iii = 0;
257 257
258 KPrefsDialogWidBool *sb = 258 KPrefsDialogWidBool *sb =
259 addWidBool(i18n("Ask for preferences before syncing"), 259 addWidBool(i18n("Ask for preferences before syncing"),
260 &(KOPrefs::instance()->mAskForPreferences),topFrame); 260 &(KOPrefs::instance()->mAskForPreferences),topFrame);
261 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 261 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
262 262
263 ++iii; 263 ++iii;
264 264
265 KPrefsDialogWidRadios *syncPrefsGroup = 265 KPrefsDialogWidRadios *syncPrefsGroup =
266 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), 266 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs),
267 topFrame); 267 topFrame);
268 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 268 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
269 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 269 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
270 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 270 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
271 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 271 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
272 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 272 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
273 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 273 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
274 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 274 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
275 ++iii; 275 ++iii;
276 sb = 276 sb =
277 addWidBool(i18n("Show summary after syncing"), 277 addWidBool(i18n("Show summary after syncing"),
278 &(KOPrefs::instance()->mShowSyncSummary),topFrame); 278 &(KOPrefs::instance()->mShowSyncSummary),topFrame);
279 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 279 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
280 280
281 ++iii; 281 ++iii;
282#endif 282#endif
283 283
284 284
285 285
286} 286}
287 287
288 288
289void KOPrefsDialog::setupSyncTab() 289void KOPrefsDialog::setupSyncTab()
290{ 290{
291#if 0 291#if 0
292 QLabel * lab; 292 QLabel * lab;
293 QFrame *topFrame = addPage(i18n("Sync Network"),0,0); 293 QFrame *topFrame = addPage(i18n("Sync Network"),0,0);
294 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 294 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
295 topLayout->setSpacing(mSpacingHint); 295 topLayout->setSpacing(mSpacingHint);
296 topLayout->setMargin(mMarginHint); 296 topLayout->setMargin(mMarginHint);
297 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); 297 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame);
298 int iii = 0; 298 int iii = 0;
299 topLayout->addMultiCellWidget(lab , iii,iii,0,1); 299 topLayout->addMultiCellWidget(lab , iii,iii,0,1);
300 ++iii; 300 ++iii;
301 301
302 mRemoteIPEdit = new QLineEdit(topFrame); 302 mRemoteIPEdit = new QLineEdit(topFrame);
303 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); 303 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame);
304 topLayout->addWidget(lab ,iii,0); 304 topLayout->addWidget(lab ,iii,0);
305 topLayout->addWidget(mRemoteIPEdit,iii,1); 305 topLayout->addWidget(mRemoteIPEdit,iii,1);
306 ++iii; 306 ++iii;
307 mRemoteUser = new QLineEdit(topFrame); 307 mRemoteUser = new QLineEdit(topFrame);
308 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); 308 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame);
309 topLayout->addWidget(lab ,iii,0); 309 topLayout->addWidget(lab ,iii,0);
310 topLayout->addWidget(mRemoteUser, iii,1); 310 topLayout->addWidget(mRemoteUser, iii,1);
311 ++iii; 311 ++iii;
312 312
313 mRemoteFile = new QLineEdit(topFrame); 313 mRemoteFile = new QLineEdit(topFrame);
314 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); 314 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame);
315 topLayout->addWidget(lab ,iii,0); 315 topLayout->addWidget(lab ,iii,0);
316 topLayout->addWidget(mRemoteFile,iii,1); 316 topLayout->addWidget(mRemoteFile,iii,1);
317 ++iii; 317 ++iii;
318 318
319 mLocalTempFile = new QLineEdit(topFrame); 319 mLocalTempFile = new QLineEdit(topFrame);
320 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); 320 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame);
321 topLayout->addWidget(lab ,iii,0); 321 topLayout->addWidget(lab ,iii,0);
322 topLayout->addWidget(mLocalTempFile,iii,1); 322 topLayout->addWidget(mLocalTempFile,iii,1);
323 ++iii; 323 ++iii;
324 324
325 KPrefsDialogWidBool *wb = 325 KPrefsDialogWidBool *wb =
326 addWidBool(i18n("Write back synced file"), 326 addWidBool(i18n("Write back synced file"),
327 &(KOPrefs::instance()->mWriteBackFile),topFrame); 327 &(KOPrefs::instance()->mWriteBackFile),topFrame);
328 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); 328 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
329 ++iii; 329 ++iii;
330 wb = 330 wb =
331 addWidBool(i18n("Write back existing entries only"), 331 addWidBool(i18n("Write back existing entries only"),
332 &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); 332 &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame);
333 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); 333 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
334 ++iii; 334 ++iii;
335 335
336#endif 336#endif
337} 337}
338 338
339void KOPrefsDialog::setupMainTab() 339void KOPrefsDialog::setupMainTab()
340{ 340{
341 QFrame *topFrame = addPage(i18n("General"),0,0); 341 QFrame *topFrame = addPage(i18n("General"),0,0);
342 // DesktopIcon("identity",KIcon::SizeMedium)); 342 // DesktopIcon("identity",KIcon::SizeMedium));
343 343
344 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 344 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
345 topLayout->setSpacing(mSpacingHint); 345 topLayout->setSpacing(mSpacingHint);
346 topLayout->setMargin(mMarginHint); 346 topLayout->setMargin(mMarginHint);
347 347
348 // KPrefsDialogWidBool *emailControlCenter = 348 // KPrefsDialogWidBool *emailControlCenter =
349// addWidBool(i18n("&Use email settings from Control Center"), 349// addWidBool(i18n("&Use email settings from Control Center"),
350// &(KOPrefs::instance()->mEmailControlCenter),topFrame); 350// &(KOPrefs::instance()->mEmailControlCenter),topFrame);
351// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); 351// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1);
352 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), 352 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)),
353 // SLOT(toggleEmailSettings(bool))); 353 // SLOT(toggleEmailSettings(bool)));
354 354
355 mNameEdit = new QLineEdit(topFrame); 355 mNameEdit = new QLineEdit(topFrame);
356 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 356 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
357 topLayout->addWidget(mNameLabel,0,0); 357 topLayout->addWidget(mNameLabel,0,0);
358 topLayout->addWidget(mNameEdit,0,1); 358 topLayout->addWidget(mNameEdit,0,1);
359 359
360 mEmailEdit = new QLineEdit(topFrame); 360 mEmailEdit = new QLineEdit(topFrame);
361 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); 361 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
362 topLayout->addWidget(mEmailLabel,1,0); 362 topLayout->addWidget(mEmailLabel,1,0);
363 topLayout->addWidget(mEmailEdit,1,1); 363 topLayout->addWidget(mEmailEdit,1,1);
364 KPrefsDialogWidBool *wb; 364 KPrefsDialogWidBool *wb;
365 365
366 366
367 367
368 KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"), 368 KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"),
369 &(KOPrefs::instance()->mShowFullMenu),topFrame); 369 &(KOPrefs::instance()->mShowFullMenu),topFrame);
370 topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1); 370 topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1);
371 371
372 372
373 widbool = addWidBool(i18n("Mini icons in toolbar(nr)"), 373 widbool = addWidBool(i18n("Mini icons in toolbar(nr)"),
374 &(KOPrefs::instance()->mToolBarMiniIcons),topFrame); 374 &(KOPrefs::instance()->mToolBarMiniIcons),topFrame);
375 topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1); 375 topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1);
376 376
377 377
378 KPrefsDialogWidBool *verticalScreen = 378 KPrefsDialogWidBool *verticalScreen =
379 addWidBool(i18n("Show vertical screen (Needs restart)"), 379 addWidBool(i18n("Show vertical screen (Needs restart)"),
380 &(KOPrefs::instance()->mVerticalScreen),topFrame); 380 &(KOPrefs::instance()->mVerticalScreen),topFrame);
381 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); 381 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0);
382 topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1); 382 topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1);
383 383
384 384
385 QHBox *dummy = new QHBox(topFrame); 385 QHBox *dummy = new QHBox(topFrame);
386 new QLabel(i18n("Days in Next-X-Days:"),dummy); 386 new QLabel(i18n("Days in Next-X-Days:"),dummy);
387 mNextXDaysSpin = new QSpinBox(2,14,1,dummy); 387 mNextXDaysSpin = new QSpinBox(2,14,1,dummy);
388 388
389 topLayout->addMultiCellWidget(dummy,5,5,0,1); 389 topLayout->addMultiCellWidget(dummy,5,5,0,1);
390 390
391 391
392 392
393 // KPrefsDialogWidBool *bcc = 393 // KPrefsDialogWidBool *bcc =
394// addWidBool(i18n("Send copy to owner when mailing events"), 394// addWidBool(i18n("Send copy to owner when mailing events"),
395// &(KOPrefs::instance()->mBcc),topFrame); 395// &(KOPrefs::instance()->mBcc),topFrame);
396// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); 396// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1);
397 397
398 398
399 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); 399 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame);
400 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); 400 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1);
401 401
402 // addWidBool(i18n("Enable automatic saving of calendar"), 402 // addWidBool(i18n("Enable automatic saving of calendar"),
403 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); 403 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup);
404 404
405 QHBox *intervalBox = new QHBox(topFrame); 405 QHBox *intervalBox = new QHBox(topFrame);
406 // intervalBox->setSpacing(mSpacingHint); 406 // intervalBox->setSpacing(mSpacingHint);
407 topLayout->addMultiCellWidget(intervalBox,6,6,0,1); 407 topLayout->addMultiCellWidget(intervalBox,6,6,0,1);
408 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); 408 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox);
409 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); 409 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox);
410 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); 410 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin);
411 /* 411 /*
412 QHBox * agendasize = new QHBox ( topFrame ); 412 QHBox * agendasize = new QHBox ( topFrame );
413 413
414 new QLabel (i18n("AllDayAgenda Height:"), agendasize ); 414 new QLabel (i18n("AllDayAgenda Height:"), agendasize );
415 415
416 416
417 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); 417 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize);
418 topLayout->addMultiCellWidget(agendasize,7,7,0,1); 418 topLayout->addMultiCellWidget(agendasize,7,7,0,1);
419 */ 419 */
420 420
421 421
422 KPrefsDialogWidBool *ask = 422 KPrefsDialogWidBool *ask =
423 addWidBool(i18n("Ask for quit when closing KO/Pi"), 423 addWidBool(i18n("Ask for quit when closing KO/Pi"),
424 &(KOPrefs::instance()->mAskForQuit),topFrame); 424 &(KOPrefs::instance()->mAskForQuit),topFrame);
425 topLayout->addMultiCellWidget(ask->checkBox(),7,7,0,1); 425 topLayout->addMultiCellWidget(ask->checkBox(),7,7,0,1);
426 426
427 427
428 /* 428 /*
429 KPrefsDialogWidBool *confirmCheck = 429 KPrefsDialogWidBool *confirmCheck =
430 addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), 430 addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm),
431 topFrame); 431 topFrame);
432 topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); 432 topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1);
433 433
434 434
435 mEnableGroupScheduling = 435 mEnableGroupScheduling =
436 addWidBool(i18n("Enable group scheduling"), 436 addWidBool(i18n("Enable group scheduling"),
437 &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); 437 &(KOPrefs::instance()->mEnableGroupScheduling),topFrame);
438 topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); 438 topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0);
439 connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), 439 connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()),
440 SLOT(warningGroupScheduling())); 440 SLOT(warningGroupScheduling()));
441 441
442 mEnableProjectView = 442 mEnableProjectView =
443 addWidBool(i18n("Enable project view"), 443 addWidBool(i18n("Enable project view"),
444 &(KOPrefs::instance()->mEnableProjectView),topFrame); 444 &(KOPrefs::instance()->mEnableProjectView),topFrame);
445 topLayout->addWidget(mEnableProjectView->checkBox(),9,0); 445 topLayout->addWidget(mEnableProjectView->checkBox(),9,0);
446 connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), 446 connect(mEnableProjectView->checkBox(),SIGNAL(clicked()),
447 SLOT(warningProjectView())); 447 SLOT(warningProjectView()));
448 448
449 // Can't be disabled anymore 449 // Can't be disabled anymore
450 mEnableGroupScheduling->checkBox()->hide(); 450 mEnableGroupScheduling->checkBox()->hide();
451 451
452 // Disable setting, because this feature now becomes stable 452 // Disable setting, because this feature now becomes stable
453 mEnableProjectView->checkBox()->hide(); 453 mEnableProjectView->checkBox()->hide();
454 454
455 KPrefsDialogWidRadios *defaultFormatGroup = 455 KPrefsDialogWidRadios *defaultFormatGroup =
456 addWidRadios(i18n("Default Calendar Format"), 456 addWidRadios(i18n("Default Calendar Format"),
457 &(KOPrefs::instance()->mDefaultFormat),topFrame); 457 &(KOPrefs::instance()->mDefaultFormat),topFrame);
458 defaultFormatGroup->addRadio(i18n("vCalendar")); 458 defaultFormatGroup->addRadio(i18n("vCalendar"));
459 defaultFormatGroup->addRadio(i18n("iCalendar")); 459 defaultFormatGroup->addRadio(i18n("iCalendar"));
460 460
461 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); 461 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1);
462 462
463 // Default format unconditionally is iCalendar 463 // Default format unconditionally is iCalendar
464 defaultFormatGroup->groupBox()->hide(); 464 defaultFormatGroup->groupBox()->hide();
465 465
466 KPrefsDialogWidRadios *mailClientGroup = 466 KPrefsDialogWidRadios *mailClientGroup =
467 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), 467 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient),
468 topFrame); 468 topFrame);
469 mailClientGroup->addRadio(i18n("KMail")); 469 mailClientGroup->addRadio(i18n("KMail"));
470 mailClientGroup->addRadio(i18n("Sendmail")); 470 mailClientGroup->addRadio(i18n("Sendmail"));
471 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); 471 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1);
472 472
473 KPrefsDialogWidBool *htmlsave = 473 KPrefsDialogWidBool *htmlsave =
474 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), 474 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave),
475 topFrame); 475 topFrame);
476 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); 476 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1);
477 477
478 KPrefsDialogWidRadios *destinationGroup = 478 KPrefsDialogWidRadios *destinationGroup =
479 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), 479 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination),
480 topFrame); 480 topFrame);
481 destinationGroup->addRadio(i18n("be added to the standard resource")); 481 destinationGroup->addRadio(i18n("be added to the standard resource"));
482 destinationGroup->addRadio(i18n("be asked which resource to use")); 482 destinationGroup->addRadio(i18n("be asked which resource to use"));
483 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); 483 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1);
484 484
485 topLayout->setRowStretch(14,1); 485 topLayout->setRowStretch(14,1);
486 */ 486 */
487} 487}
488 488
489 489
490void KOPrefsDialog::setupTimeTab() 490void KOPrefsDialog::setupTimeTab()
491{ 491{
492 QFrame *topFrame = addPage(i18n("Time"),0,0); 492 QFrame *topFrame = addPage(i18n("Time"),0,0);
493 // DesktopIcon("clock",KIcon::SizeMedium)); 493 // DesktopIcon("clock",KIcon::SizeMedium));
494 494
495 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 495 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
496 topLayout->setSpacing(mSpacingHint); 496 topLayout->setSpacing(mSpacingHint);
497 topLayout->setMargin(mMarginHint); 497 topLayout->setMargin(mMarginHint);
498 498
499 QHBox *dummy = new QHBox(topFrame); 499 QHBox *dummy = new QHBox(topFrame);
500 KPrefsDialogWidTime *dayBegins = 500 KPrefsDialogWidTime *dayBegins =
501 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 501 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
502 dummy); 502 dummy);
503 //topLayout->addWidget(dayBegins->label(),2,0); 503 //topLayout->addWidget(dayBegins->label(),2,0);
504 504
505 //topLayout->addWidget(dayBegins->spinBox(),2,1); 505 //topLayout->addWidget(dayBegins->spinBox(),2,1);
506 topLayout->addMultiCellWidget(dummy,0,0,0,1); 506 topLayout->addMultiCellWidget(dummy,0,0,0,1);
507 507
508 topLayout->addWidget(new QLabel(i18n("Default appointment time:"), 508 topLayout->addWidget(new QLabel(i18n("Default appointment time:"),
509 topFrame),1,0); 509 topFrame),1,0);
510 mStartTimeSpin = new QSpinBox(0,23,1,topFrame); 510 mStartTimeSpin = new QSpinBox(0,23,1,topFrame);
511 mStartTimeSpin->setSuffix(":00"); 511 mStartTimeSpin->setSuffix(":00");
512 topLayout->addWidget(mStartTimeSpin,1,1); 512 topLayout->addWidget(mStartTimeSpin,1,1);
513 513
514 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), 514 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"),
515 topFrame),2,0); 515 topFrame),2,0);
516 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); 516 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame);
517 mDefaultDurationSpin->setSuffix(":00"); 517 mDefaultDurationSpin->setSuffix(":00");
518 topLayout->addWidget(mDefaultDurationSpin,2,1); 518 topLayout->addWidget(mDefaultDurationSpin,2,1);
519 519
520 QStringList alarmList; 520 QStringList alarmList;
521 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") 521 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes")
522 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; 522 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ;
523 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), 523 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame),
524 3,0); 524 3,0);
525 mAlarmTimeCombo = new QComboBox(topFrame); 525 mAlarmTimeCombo = new QComboBox(topFrame);
526 mAlarmTimeCombo->insertStringList(alarmList); 526 mAlarmTimeCombo->insertStringList(alarmList);
527 topLayout->addWidget(mAlarmTimeCombo,3,1); 527 topLayout->addWidget(mAlarmTimeCombo,3,1);
528 528
529 529
530 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, 530 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal,
531 i18n("Working Hours"), 531 i18n("Working Hours"),
532 topFrame); 532 topFrame);
533 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); 533 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1);
534 workingHoursGroup->layout()->setSpacing( 0 ); 534 workingHoursGroup->layout()->setSpacing( 0 );
535 workingHoursGroup->layout()->setMargin( 4 ); 535 workingHoursGroup->layout()->setMargin( 4 );
536 QHBox *workStartBox = new QHBox(workingHoursGroup); 536 QHBox *workStartBox = new QHBox(workingHoursGroup);
537 // workStartBox->setMargin( 0 ); 537 // workStartBox->setMargin( 0 );
538 addWidTime(i18n("Daily starting hour:"), 538 addWidTime(i18n("Daily starting hour:"),
539 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); 539 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox);
540 540
541 QHBox *workEndBox = new QHBox(workingHoursGroup); 541 QHBox *workEndBox = new QHBox(workingHoursGroup);
542 //workEndBox->setMargin( 0 ); 542 //workEndBox->setMargin( 0 );
543 addWidTime(i18n("Daily ending hour:"), 543 addWidTime(i18n("Daily ending hour:"),
544 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); 544 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox);
545 QVBox *excludeBox = new QVBox(workingHoursGroup); 545 QVBox *excludeBox = new QVBox(workingHoursGroup);
546 //excludeBox->setMargin( 0 ); 546 //excludeBox->setMargin( 0 );
547 addWidBool(i18n("Exclude holidays"), 547 addWidBool(i18n("Exclude holidays"),
548 &(KOPrefs::instance()->mExcludeHolidays),excludeBox); 548 &(KOPrefs::instance()->mExcludeHolidays),excludeBox);
549 549
550 addWidBool(i18n("Exclude Saturdays"), 550 addWidBool(i18n("Exclude Saturdays"),
551 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); 551 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox);
552 552
553// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), 553// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"),
554 // &(KOPrefs::instance()->mMarcusBainsShowSeconds), 554 // &(KOPrefs::instance()->mMarcusBainsShowSeconds),
555 // topFrame); 555 // topFrame);
556// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); 556// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0);
557 557
558 // topLayout->setRowStretch(6,1); 558 // topLayout->setRowStretch(6,1);
559} 559}
560 560
561 561
562void KOPrefsDialog::setupViewsTab() 562void KOPrefsDialog::setupViewsTab()
563{ 563{
564 564
565 QFrame *topFrame = addPage(i18n("Views"),0,0); 565 QFrame *topFrame = addPage(i18n("Views"),0,0);
566 // DesktopIcon("viewmag",KIcon::SizeMedium)); 566 // DesktopIcon("viewmag",KIcon::SizeMedium));
567 567
568 QGridLayout *topLayout = new QGridLayout(topFrame,6,1); 568 QGridLayout *topLayout = new QGridLayout(topFrame,6,1);
569 topLayout->setSpacing(mSpacingHint); 569 topLayout->setSpacing(mSpacingHint);
570 topLayout->setMargin(mMarginHint); 570 topLayout->setMargin(mMarginHint);
571 571
572// QBoxLayout *dayBeginsLayout = new QHBoxLayout; 572// QBoxLayout *dayBeginsLayout = new QHBoxLayout;
573// topLayout->addLayout(dayBeginsLayout,0,0); 573// topLayout->addLayout(dayBeginsLayout,0,0);
574 574
575// KPrefsDialogWidTime *dayBegins = 575// KPrefsDialogWidTime *dayBegins =
576// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 576// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
577// topFrame); 577// topFrame);
578// dayBeginsLayout->addWidget(dayBegins->label()); 578// dayBeginsLayout->addWidget(dayBegins->label());
579// dayBeginsLayout->addStretch(1); 579// dayBeginsLayout->addStretch(1);
580// dayBeginsLayout->addWidget(dayBegins->spinBox()); 580// dayBeginsLayout->addWidget(dayBegins->spinBox());
581 581
582// QBoxLayout *nextDaysLayout = new QHBoxLayout; 582// QBoxLayout *nextDaysLayout = new QHBoxLayout;
583// topLayout->addLayout(nextDaysLayout,1,0); 583// topLayout->addLayout(nextDaysLayout,1,0);
584// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); 584// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame));
585// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); 585// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame);
586// nextDaysLayout->addStretch(1); 586// nextDaysLayout->addStretch(1);
587// nextDaysLayout->addWidget(mNextXDaysSpin); 587// nextDaysLayout->addWidget(mNextXDaysSpin);
588 588
589 589
590 int ii = 0; 590 int ii = 0;
591 KPrefsDialogWidBool *dummy = 591 KPrefsDialogWidBool *dummy =
592 addWidBool(i18n("Edit item on doubleclick (if not, show)"), 592 addWidBool(i18n("Edit item on doubleclick (if not, show)"),
593 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); 593 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame);
594 topLayout->addWidget(dummy->checkBox(),ii++,0); 594 topLayout->addWidget(dummy->checkBox(),ii++,0);
595 595
596 596
597 597
598 598
599 599
600 600
601 // topLayout->addWidget(hourSizeGroup,ii++,0); 601 // topLayout->addWidget(hourSizeGroup,ii++,0);
602 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); 602 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0);
603 //topLayout->setRowStretch(11,1); 603 //topLayout->setRowStretch(11,1);
604 604
605 605
606 606
607 607
608#if 0 608#if 0
609 609
610 topFrame = addPage(i18n("ViewChange"),0,0); 610 topFrame = addPage(i18n("ViewChange"),0,0);
611 // DesktopIcon("viewmag",KIcon::SizeMedium)); 611 // DesktopIcon("viewmag",KIcon::SizeMedium));
612 612
613 topLayout = new QGridLayout(topFrame,6,1); 613 topLayout = new QGridLayout(topFrame,6,1);
614 topLayout->setSpacing(mSpacingHint); 614 topLayout->setSpacing(mSpacingHint);
615 topLayout->setMargin(mMarginHint); 615 topLayout->setMargin(mMarginHint);
616 ii = 0; 616 ii = 0;
617 617
618#endif 618#endif
619 619
620 dummy = 620 dummy =
621 addWidBool(i18n("Hold fullscreen on view change"), 621 addWidBool(i18n("Hold fullscreen on view change"),
622 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); 622 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame);
623 topLayout->addWidget(dummy->checkBox(),ii++,0); 623 topLayout->addWidget(dummy->checkBox(),ii++,0);
624 624
625 dummy = 625 dummy =
626 addWidBool(i18n("Hold non-fullscreen on view change"), 626 addWidBool(i18n("Hold non-fullscreen on view change"),
627 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); 627 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame);
628 topLayout->addWidget(dummy->checkBox(),ii++,0); 628 topLayout->addWidget(dummy->checkBox(),ii++,0);
629 629
630 630
631 631
632 KPrefsDialogWidBool *fullViewMonth = 632 KPrefsDialogWidBool *fullViewMonth =
633 addWidBool(i18n("Next days view uses full window"), 633 addWidBool(i18n("Next days view uses full window"),
634 &(KOPrefs::instance()->mFullViewMonth),topFrame); 634 &(KOPrefs::instance()->mFullViewMonth),topFrame);
635 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); 635 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0);
636 636
637 637
638 KPrefsDialogWidBool *fullViewTodo = 638 KPrefsDialogWidBool *fullViewTodo =
639 addWidBool(i18n("Event list view uses full window"), 639 addWidBool(i18n("Event list view uses full window"),
640 &(KOPrefs::instance()->mFullViewTodo),topFrame); 640 &(KOPrefs::instance()->mFullViewTodo),topFrame);
641 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); 641 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0);
642 dummy = 642 dummy =
643 addWidBool(i18n("Listview uses monthly timespan"), 643 addWidBool(i18n("Listview uses monthly timespan"),
644 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); 644 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame);
645 topLayout->addWidget(dummy->checkBox(),ii++,0); 645 topLayout->addWidget(dummy->checkBox(),ii++,0);
646 dummy = 646 dummy =
647 addWidBool(i18n("Highlight selection in Time Edit"), 647 addWidBool(i18n("Highlight selection in Time Edit"),
648 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); 648 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame);
649 topLayout->addWidget( dummy->checkBox(), ii++,0); 649 topLayout->addWidget( dummy->checkBox(), ii++,0);
650 650
651 KPrefsDialogWidBool *dailyRecur = 651 KPrefsDialogWidBool *dailyRecur =
652 addWidBool(i18n("Show events that recur daily in date nav."), 652 addWidBool(i18n("Show events that recur daily in date nav."),
653 &(KOPrefs::instance()->mDailyRecur),topFrame); 653 &(KOPrefs::instance()->mDailyRecur),topFrame);
654 topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 654 topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
655 655
656 KPrefsDialogWidBool *weeklyRecur = 656 KPrefsDialogWidBool *weeklyRecur =
657 addWidBool(i18n("Show ev. that recur weekly in date nav."), 657 addWidBool(i18n("Show ev. that recur weekly in date nav."),
658 &(KOPrefs::instance()->mWeeklyRecur),topFrame); 658 &(KOPrefs::instance()->mWeeklyRecur),topFrame);
659 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); 659 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0);
660 660
661#ifdef DESKTOP_VERSION 661#ifdef DESKTOP_VERSION
662 KPrefsDialogWidBool *enableToolTips = 662 KPrefsDialogWidBool *enableToolTips =
663 addWidBool(i18n("Enable tooltips displaying summary of ev."), 663 addWidBool(i18n("Enable tooltips displaying summary of ev."),
664 &(KOPrefs::instance()->mEnableToolTips),topFrame); 664 &(KOPrefs::instance()->mEnableToolTips),topFrame);
665 topLayout->addWidget(enableToolTips->checkBox(),ii++,0); 665 topLayout->addWidget(enableToolTips->checkBox(),ii++,0);
666#endif 666#endif
667 // ********************************************************* 667 // *********************************************************
668 668
669 topFrame = addPage(i18n("Agenda View"),0,0); 669 topFrame = addPage(i18n("Agenda View"),0,0);
670 // DesktopIcon("viewmag",KIcon::SizeMedium)); 670 // DesktopIcon("viewmag",KIcon::SizeMedium));
671 671
672 topLayout = new QGridLayout(topFrame,5,1); 672 topLayout = new QGridLayout(topFrame,5,1);
673 topLayout->setSpacing(mSpacingHint); 673 topLayout->setSpacing(mSpacingHint);
674 topLayout->setMargin(mMarginHint); 674 topLayout->setMargin(mMarginHint);
675 ii = 0; 675 ii = 0;
676 676
677 677
678 dummy = 678 dummy =
679 addWidBool(i18n("Show time in agenda items"), 679 addWidBool(i18n("Show time in agenda items"),
680 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); 680 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame);
681 topLayout->addWidget(dummy->checkBox(),ii++,0); 681 topLayout->addWidget(dummy->checkBox(),ii++,0);
682 682
683 dummy = 683 dummy =
684 addWidBool(i18n("Highlight current day in agenda"), 684 addWidBool(i18n("Highlight current day in agenda"),
685 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); 685 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame);
686 topLayout->addWidget(dummy->checkBox(),ii++,0); 686 topLayout->addWidget(dummy->checkBox(),ii++,0);
687 687
688 dummy = 688 dummy =
689 addWidBool(i18n("Use light color for highlight current day"), 689 addWidBool(i18n("Use light color for highlight current day"),
690 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); 690 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame);
691 topLayout->addWidget(dummy->checkBox(),ii++,0); 691 topLayout->addWidget(dummy->checkBox(),ii++,0);
692 692
693 693
694 KPrefsDialogWidBool *marcusBainsEnabled = 694 KPrefsDialogWidBool *marcusBainsEnabled =
695 addWidBool(i18n("Show current time"), 695 addWidBool(i18n("Show current time"),
696 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); 696 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame);
697 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); 697 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0);
698 698
699 699
700 dummy = 700 dummy =
701 addWidBool(i18n("Set agenda to DayBeginsAt on change"), 701 addWidBool(i18n("Set agenda to DayBeginsAt on change"),
702 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); 702 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame);
703 topLayout->addWidget(dummy->checkBox(),ii++,0); 703 topLayout->addWidget(dummy->checkBox(),ii++,0);
704 704
705 dummy = 705 dummy =
706 addWidBool(i18n("Set agenda to current time on change"), 706 addWidBool(i18n("Set agenda to current time on change"),
707 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); 707 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame);
708 topLayout->addWidget(dummy->checkBox(),ii++,0); 708 topLayout->addWidget(dummy->checkBox(),ii++,0);
709 709
710 710
711 711
712 712
713 713
714 714
715 715
716 topFrame = addPage(i18n("Month View"),0,0); 716 topFrame = addPage(i18n("Month View"),0,0);
717 // DesktopIcon("viewmag",KIcon::SizeMedium)); 717 // DesktopIcon("viewmag",KIcon::SizeMedium));
718 718
719 topLayout = new QGridLayout(topFrame,5,1); 719 topLayout = new QGridLayout(topFrame,5,1);
720 topLayout->setSpacing(mSpacingHint); 720 topLayout->setSpacing(mSpacingHint);
721 topLayout->setMargin(mMarginHint); 721 topLayout->setMargin(mMarginHint);
722 qDebug("%d %d ",mSpacingHint, mMarginHint ); 722 qDebug("%d %d ",mSpacingHint, mMarginHint );
723 ii = 0; 723 ii = 0;
724 QLabel *lab; 724 QLabel *lab;
725 QHBox *habo = new QHBox( topFrame ); 725 QHBox *habo = new QHBox( topFrame );
726 if ( QApplication::desktop()->width() <= 480 ) { 726 if ( QApplication::desktop()->width() <= 480 ) {
727 lab = new QLabel ( i18n("Show events that recur "), topFrame ); 727 lab = new QLabel ( i18n("Show events that recur "), topFrame );
728 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 728 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
729 ii++; 729 ii++;
730 } else { 730 } else {
731 new QLabel ( i18n("Show events that recur "), habo ); 731 new QLabel ( i18n("Show events that recur "), habo );
732 } 732 }
733 dailyRecur = 733 dailyRecur =
734 addWidBool(i18n("daily"), 734 addWidBool(i18n("daily"),
735 &(KOPrefs::instance()->mMonthDailyRecur),habo); 735 &(KOPrefs::instance()->mMonthDailyRecur),habo);
736 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 736 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
737 737
738 weeklyRecur = 738 weeklyRecur =
739 addWidBool(i18n("weekly"), 739 addWidBool(i18n("weekly"),
740 &(KOPrefs::instance()->mMonthWeeklyRecur),habo); 740 &(KOPrefs::instance()->mMonthWeeklyRecur),habo);
741 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 741 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
742 ii++; 742 ii++;
743 743
744 744
745 habo = new QHBox( topFrame ); 745 habo = new QHBox( topFrame );
746 if ( QApplication::desktop()->width() <= 480 ) { 746 if ( QApplication::desktop()->width() <= 480 ) {
747 lab = new QLabel (i18n("Show in every cell ") , topFrame ); 747 lab = new QLabel (i18n("Show in every cell ") , topFrame );
748 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 748 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
749 ii++; 749 ii++;
750 750
751 } else { 751 } else {
752 new QLabel ( i18n("Show in every cell "), habo ); 752 new QLabel ( i18n("Show in every cell "), habo );
753 } 753 }
754 weeklyRecur = 754 weeklyRecur =
755 addWidBool(i18n("short month"), 755 addWidBool(i18n("short month"),
756 &(KOPrefs::instance()->mMonthShowShort),habo); 756 &(KOPrefs::instance()->mMonthShowShort),habo);
757 weeklyRecur = 757 weeklyRecur =
758 addWidBool(i18n("icons"), 758 addWidBool(i18n("icons"),
759 &(KOPrefs::instance()->mMonthShowIcons),habo); 759 &(KOPrefs::instance()->mMonthShowIcons),habo);
760 760
761 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 761 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
762 ii++; 762 ii++;
763#ifdef DESKTOP_VERSION 763#ifdef DESKTOP_VERSION
764 KPrefsDialogWidBool *enableMonthScroll = 764 KPrefsDialogWidBool *enableMonthScroll =
765 addWidBool(i18n("Enable scrollbars in month view cells"), 765 addWidBool(i18n("Enable scrollbars in month view cells"),
766 &(KOPrefs::instance()->mEnableMonthScroll),topFrame); 766 &(KOPrefs::instance()->mEnableMonthScroll),topFrame);
767 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); 767 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0);
768#endif 768#endif
769 dummy = 769 dummy =
770 addWidBool(i18n("Week view mode uses bigger font"), 770 addWidBool(i18n("Week view mode uses bigger font"),
771 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); 771 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame);
772 topLayout->addWidget(dummy->checkBox(),ii++,0); 772 topLayout->addWidget(dummy->checkBox(),ii++,0);
773 dummy = 773 dummy =
774 addWidBool(i18n("Show Sat/Sun together"), 774 addWidBool(i18n("Show Sat/Sun together"),
775 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); 775 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame);
776 topLayout->addWidget(dummy->checkBox(),ii++,0); 776 topLayout->addWidget(dummy->checkBox(),ii++,0);
777 777
778 KPrefsDialogWidBool *coloredCategoriesInMonthView = 778 KPrefsDialogWidBool *coloredCategoriesInMonthView =
779 addWidBool(i18n("Month view uses category colors"), 779 addWidBool(i18n("Month view uses category colors"),
780 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); 780 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
781 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 781 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
782 782
783 dummy = 783 dummy =
784 addWidBool(i18n("Categorie colors are applied to text"), 784 addWidBool(i18n("Categorie colors are applied to text"),
785 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); 785 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
786 topLayout->addWidget(dummy->checkBox(),ii++,0); 786 topLayout->addWidget(dummy->checkBox(),ii++,0);
787 coloredCategoriesInMonthView = 787 coloredCategoriesInMonthView =
788 addWidBool(i18n("Month view uses day colors"), 788 addWidBool(i18n("Month view uses day colors"),
789 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); 789 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
790 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 790 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
791 791
792 KPrefsDialogWidColor *holidayColor = 792 KPrefsDialogWidColor *holidayColor =
793 addWidColor(i18n("Day color odd months"), 793 addWidColor(i18n("Day color odd months"),
794 &(KOPrefs::instance()->mMonthViewOddColor),topFrame); 794 &(KOPrefs::instance()->mMonthViewOddColor),topFrame);
795 topLayout->addWidget(holidayColor->label(),ii,0); 795 topLayout->addWidget(holidayColor->label(),ii,0);
796 topLayout->addWidget(holidayColor->button(),ii++,1); 796 topLayout->addWidget(holidayColor->button(),ii++,1);
797 797
798 holidayColor = 798 holidayColor =
799 addWidColor(i18n("Day color even months"), 799 addWidColor(i18n("Day color even months"),
800 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); 800 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame);
801 topLayout->addWidget(holidayColor->label(),ii,0); 801 topLayout->addWidget(holidayColor->label(),ii,0);
802 topLayout->addWidget(holidayColor->button(),ii++,1); 802 topLayout->addWidget(holidayColor->button(),ii++,1);
803 803
804 804
805 holidayColor = 805 holidayColor =
806 addWidColor(i18n("Color for Sundays + category \"Holiday\""), 806 addWidColor(i18n("Color for Sundays + category \"Holiday\""),
807 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); 807 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame);
808 topLayout->addWidget(holidayColor->label(),ii,0); 808 topLayout->addWidget(holidayColor->label(),ii,0);
809 topLayout->addWidget(holidayColor->button(),ii++,1); 809 topLayout->addWidget(holidayColor->button(),ii++,1);
810 // *********************** What'sNext View 810 // *********************** What'sNext View
811 topFrame = addPage(i18n("What's Next View"),0,0); 811 topFrame = addPage(i18n("What's Next View"),0,0);
812 // DesktopIcon("viewmag",KIcon::SizeMedium)); 812 // DesktopIcon("viewmag",KIcon::SizeMedium));
813 813
814 topLayout = new QGridLayout(topFrame,4,1); 814 topLayout = new QGridLayout(topFrame,4,1);
815 topLayout->setSpacing(mSpacingHint); 815 topLayout->setSpacing(mSpacingHint);
816 topLayout->setMargin(mMarginHint); 816 topLayout->setMargin(mMarginHint);
817 ii = 0; 817 ii = 0;
818 818
819 819
820 QHBox* hdummy = new QHBox(topFrame); 820 QHBox* hdummy = new QHBox(topFrame);
821 new QLabel(i18n("Days in What's Next:"),hdummy); 821 new QLabel(i18n("Days in What's Next:"),hdummy);
822 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); 822 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy);
823 823
824 topLayout->addWidget(hdummy,ii++,0); 824 topLayout->addWidget(hdummy,ii++,0);
825 825
826 QHBox *prioBox = new QHBox(topFrame); 826 QHBox *prioBox = new QHBox(topFrame);
827 // intervalBox->setSpacing(mSpacingHint); 827 // intervalBox->setSpacing(mSpacingHint);
828 topLayout->addWidget(prioBox,ii++,0); 828 topLayout->addWidget(prioBox,ii++,0);
829 QString messa = i18n("Show topmost todo prios in What's Next:"); 829
830 830 QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox);
831 if ( QApplication::desktop()->width() < 300 )
832 messa = i18n("Show topmost todo prios in What's N.:");
833 QLabel *prioLabel = new QLabel(messa, prioBox);
834 mPrioSpin = new QSpinBox(0,5,1,prioBox); 831 mPrioSpin = new QSpinBox(0,5,1,prioBox);
835 if ( QApplication::desktop()->width() < 300 ) 832 if ( QApplication::desktop()->width() < 300 )
836 mPrioSpin->setFixedWidth( 40 ); 833 mPrioSpin->setFixedWidth( 40 );
837 834
838 KPrefsDialogWidBool *passwdk = 835 KPrefsDialogWidBool *passwdk =
839 836
840 addWidBool(i18n("Show events, that are done in \nWhat's Next view"), 837 addWidBool(i18n("Show events, that are done"),
841 &(KOPrefs::instance()->mWNViewShowsPast),topFrame); 838 &(KOPrefs::instance()->mWNViewShowsPast),topFrame);
842 topLayout->addWidget(passwdk->checkBox(), ii++,0); 839 topLayout->addWidget(passwdk->checkBox(), ii++,0);
843 passwdk = 840 passwdk =
844 addWidBool(i18n("Show parent To-Do's in What's Next view"), 841 addWidBool(i18n("Show parent To-Do's"),
845 &(KOPrefs::instance()->mWNViewShowsParents),topFrame); 842 &(KOPrefs::instance()->mWNViewShowsParents),topFrame);
846 topLayout->addWidget(passwdk->checkBox(), ii++,0); 843 topLayout->addWidget(passwdk->checkBox(), ii++,0);
847 844
848 passwdk = 845 passwdk =
849 addWidBool(i18n("Show location in What's Next view"), 846 addWidBool(i18n("Show location"),
850 &(KOPrefs::instance()->mWNViewShowLocation),topFrame); 847 &(KOPrefs::instance()->mWNViewShowLocation),topFrame);
851 topLayout->addWidget(passwdk->checkBox(), ii++,0); 848 topLayout->addWidget(passwdk->checkBox(), ii++,0);
852 849
853 passwdk = 850 passwdk =
854 addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"), 851 addWidBool(i18n("Show Sync Events in WN+Agenda"),
855 &(KOPrefs::instance()->mShowSyncEvents),topFrame); 852 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
856 topLayout->addWidget(passwdk->checkBox(), ii++,0); 853 topLayout->addWidget(passwdk->checkBox(), ii++,0);
857 passwdk = 854 passwdk =
858 addWidBool(i18n("Use short date in \nWhat's Next/Event view"), 855 addWidBool(i18n("Use short date in WN+Event view"),
859 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 856 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
860 topLayout->addWidget(passwdk->checkBox(), ii++,0); 857 topLayout->addWidget(passwdk->checkBox(), ii++,0);
861 858
862 859
863 860
864 861
865 // *********************** Todo View 862 // *********************** Todo View
866 863
867 topFrame = addPage(i18n("Todo View"),0,0); 864 topFrame = addPage(i18n("Todo View"),0,0);
868 // DesktopIcon("viewmag",KIcon::SizeMedium)); 865 // DesktopIcon("viewmag",KIcon::SizeMedium));
869 866
870 topLayout = new QGridLayout(topFrame,4,1); 867 topLayout = new QGridLayout(topFrame,4,1);
871 topLayout->setSpacing(mSpacingHint); 868 topLayout->setSpacing(mSpacingHint);
872 topLayout->setMargin(mMarginHint); 869 topLayout->setMargin(mMarginHint);
873 ii = 0; 870 ii = 0;
874dummy = 871dummy =
875 addWidBool(i18n("Hide not running Todos in To-do view"), 872 addWidBool(i18n("Hide not running Todos in To-do view"),
876 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); 873 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame);
877 topLayout->addWidget(dummy->checkBox(),ii++,0); 874 topLayout->addWidget(dummy->checkBox(),ii++,0);
878 875
879 876
880 KPrefsDialogWidBool *showCompletedTodo = 877 KPrefsDialogWidBool *showCompletedTodo =
881 addWidBool(i18n("To-do view shows completed Todos"), 878 addWidBool(i18n("To-do view shows completed Todos"),
882 &(KOPrefs::instance()->mShowCompletedTodo),topFrame); 879 &(KOPrefs::instance()->mShowCompletedTodo),topFrame);
883 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); 880 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0);
884 dummy = 881 dummy =
885 addWidBool(i18n("To-do view shows complete as 'xx %'"), 882 addWidBool(i18n("To-do view shows complete as 'xx %'"),
886 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); 883 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame);
887 topLayout->addWidget(dummy->checkBox(),ii++,0); 884 topLayout->addWidget(dummy->checkBox(),ii++,0);
888 885
889 dummy = 886 dummy =
890 addWidBool(i18n("Small To-do view uses smaller font"), 887 addWidBool(i18n("Small To-do view uses smaller font"),
891 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); 888 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
892 topLayout->addWidget(dummy->checkBox(),ii++,0); 889 topLayout->addWidget(dummy->checkBox(),ii++,0);
893 890
894 891
895 892
896 dummy = 893 dummy =
897 addWidBool(i18n("Todo view uses category colors"), 894 addWidBool(i18n("Todo view uses category colors"),
898 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); 895 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
899 topLayout->addWidget(dummy->checkBox(),ii++,0); 896 topLayout->addWidget(dummy->checkBox(),ii++,0);
900 897
901 898
902 QWidget* wid = new QWidget( topFrame ); 899 QWidget* wid = new QWidget( topFrame );
903 // Todo due today color 900 // Todo due today color
904 KPrefsDialogWidColor *todoDueTodayColor = 901 KPrefsDialogWidColor *todoDueTodayColor =
905 addWidColor(i18n("Todo due today color:"), 902 addWidColor(i18n("Todo due today color:"),
906 &(KOPrefs::instance()->mTodoDueTodayColor),wid); 903 &(KOPrefs::instance()->mTodoDueTodayColor),wid);
907 QHBoxLayout *widLayout = new QHBoxLayout(wid); 904 QHBoxLayout *widLayout = new QHBoxLayout(wid);
908 widLayout->addWidget( todoDueTodayColor->label() ); 905 widLayout->addWidget( todoDueTodayColor->label() );
909 widLayout->addWidget( todoDueTodayColor->button() ); 906 widLayout->addWidget( todoDueTodayColor->button() );
910 topLayout->addWidget(wid,ii++,0); 907 topLayout->addWidget(wid,ii++,0);
911 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); 908 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
912 909
913 // Todo overdue color 910 // Todo overdue color
914 wid = new QWidget( topFrame ); 911 wid = new QWidget( topFrame );
915 widLayout = new QHBoxLayout(wid); 912 widLayout = new QHBoxLayout(wid);
916 KPrefsDialogWidColor *todoOverdueColor = 913 KPrefsDialogWidColor *todoOverdueColor =
917 addWidColor(i18n("Todo overdue color:"), 914 addWidColor(i18n("Todo overdue color:"),
918 &(KOPrefs::instance()->mTodoOverdueColor),wid); 915 &(KOPrefs::instance()->mTodoOverdueColor),wid);
919 widLayout->addWidget(todoOverdueColor->label()); 916 widLayout->addWidget(todoOverdueColor->label());
920 widLayout->addWidget(todoOverdueColor->button()); 917 widLayout->addWidget(todoOverdueColor->button());
921 topLayout->addWidget(wid,ii++,0); 918 topLayout->addWidget(wid,ii++,0);
922 919
923 dummy = 920 dummy =
924 addWidBool(i18n("Colors are applied to text"), 921 addWidBool(i18n("Colors are applied to text"),
925 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); 922 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame);
926 topLayout->addWidget(dummy->checkBox(),ii++,0); 923 topLayout->addWidget(dummy->checkBox(),ii++,0);
927 924
928 dummy = 925 dummy =
929 addWidBool(i18n("Allday Agenda view shows todos"), 926 addWidBool(i18n("Allday Agenda view shows todos"),
930 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); 927 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame);
931 topLayout->addWidget(dummy->checkBox(),ii++,0); 928 topLayout->addWidget(dummy->checkBox(),ii++,0);
932 929
933 930
934 topFrame = addPage(i18n("View Options"),0,0); 931 topFrame = addPage(i18n("View Options"),0,0);
935 932
936 topLayout = new QGridLayout(topFrame,4,1); 933 topLayout = new QGridLayout(topFrame,4,1);
937 topLayout->setSpacing(mSpacingHint); 934 topLayout->setSpacing(mSpacingHint);
938 topLayout->setMargin(mMarginHint); 935 topLayout->setMargin(mMarginHint);
939 ii = 0; 936 ii = 0;
940 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); 937 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame);
941 topLayout->addWidget(lab ,ii++,0); 938 topLayout->addWidget(lab ,ii++,0);
942 939
943 dummy = addWidBool(i18n("Details"), 940 dummy = addWidBool(i18n("Details"),
944 &(KOPrefs::instance()->mEVshowDetails),topFrame); 941 &(KOPrefs::instance()->mEVshowDetails),topFrame);
945 topLayout->addWidget(dummy->checkBox(),ii++,0); 942 topLayout->addWidget(dummy->checkBox(),ii++,0);
946 dummy = addWidBool(i18n("Created time"), 943 dummy = addWidBool(i18n("Created time"),
947 &(KOPrefs::instance()->mEVshowCreated),topFrame); 944 &(KOPrefs::instance()->mEVshowCreated),topFrame);
948 topLayout->addWidget(dummy->checkBox(),ii++,0); 945 topLayout->addWidget(dummy->checkBox(),ii++,0);
949 dummy = addWidBool(i18n("Last modified time"), 946 dummy = addWidBool(i18n("Last modified time"),
950 &(KOPrefs::instance()->mEVshowChanged),topFrame); 947 &(KOPrefs::instance()->mEVshowChanged),topFrame);
951 topLayout->addWidget(dummy->checkBox(),ii++,0); 948 topLayout->addWidget(dummy->checkBox(),ii++,0);
952 949
953 950
954 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); 951 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame);
955 topLayout->addWidget(lab ,ii++,0); 952 topLayout->addWidget(lab ,ii++,0);
956 953
957 dummy = addWidBool(i18n("Details"), 954 dummy = addWidBool(i18n("Details"),
958 &(KOPrefs::instance()->mWTshowDetails),topFrame); 955 &(KOPrefs::instance()->mWTshowDetails),topFrame);
959 topLayout->addWidget(dummy->checkBox(),ii++,0); 956 topLayout->addWidget(dummy->checkBox(),ii++,0);
960 dummy = addWidBool(i18n("Created time"), 957 dummy = addWidBool(i18n("Created time"),
961 &(KOPrefs::instance()->mWTshowCreated),topFrame); 958 &(KOPrefs::instance()->mWTshowCreated),topFrame);
962 topLayout->addWidget(dummy->checkBox(),ii++,0); 959 topLayout->addWidget(dummy->checkBox(),ii++,0);
963 dummy = addWidBool(i18n("Last modified time"), 960 dummy = addWidBool(i18n("Last modified time"),
964 &(KOPrefs::instance()->mWTshowChanged),topFrame); 961 &(KOPrefs::instance()->mWTshowChanged),topFrame);
965 topLayout->addWidget(dummy->checkBox(),ii++,0); 962 topLayout->addWidget(dummy->checkBox(),ii++,0);
966 963
967 964
968 topFrame = addPage(i18n("Alarm"),0,0); 965 topFrame = addPage(i18n("Alarm"),0,0);
969 // DesktopIcon("viewmag",KIcon::SizeMedium)); 966 // DesktopIcon("viewmag",KIcon::SizeMedium));
970 967
971 topLayout = new QGridLayout(topFrame,2,1); 968 topLayout = new QGridLayout(topFrame,2,1);
972 topLayout->setSpacing(mSpacingHint); 969 topLayout->setSpacing(mSpacingHint);
973 topLayout->setMargin(mMarginHint); 970 topLayout->setMargin(mMarginHint);
974 int iii = 0; 971 int iii = 0;
975 972
976 dummy = 973 dummy =
977 addWidBool(i18n("Use internal alarm notification"), 974 addWidBool(i18n("Use internal alarm notification"),
978 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); 975 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
979 topLayout->addWidget(dummy->checkBox(),iii++,0); 976 topLayout->addWidget(dummy->checkBox(),iii++,0);
980 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); 977 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame);
981 978
982 topLayout->addWidget(lab ,iii++,0); 979 topLayout->addWidget(lab ,iii++,0);
983#ifndef DESKTOP_VERSION 980#ifndef DESKTOP_VERSION
984 lab->setAlignment( AlignLeft|WordBreak|AlignTop); 981 lab->setAlignment( AlignLeft|WordBreak|AlignTop);
985#else 982#else
986 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 983 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
987 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 984 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
988#endif 985#endif
989 986
990 QHBox* dummyBox = new QHBox(topFrame); 987 QHBox* dummyBox = new QHBox(topFrame);
991 new QLabel(i18n("Play beeps count:"),dummyBox); 988 new QLabel(i18n("Play beeps count:"),dummyBox);
992 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); 989 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox);
993 topLayout->addWidget(dummyBox,iii++,0); 990 topLayout->addWidget(dummyBox,iii++,0);
994 991
995 dummyBox = new QHBox(topFrame); 992 dummyBox = new QHBox(topFrame);
996 new QLabel(i18n("Beeps interval in sec:"),dummyBox); 993 new QLabel(i18n("Beeps interval in sec:"),dummyBox);
997 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); 994 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox);
998 topLayout->addWidget(dummyBox,iii++,0); 995 topLayout->addWidget(dummyBox,iii++,0);
999 996
1000 dummyBox = new QHBox(topFrame); 997 dummyBox = new QHBox(topFrame);
1001 new QLabel(i18n("Default suspend time in min:"),dummyBox); 998 new QLabel(i18n("Default suspend time in min:"),dummyBox);
1002 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); 999 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox);
1003 topLayout->addWidget(dummyBox,iii++,0); 1000 topLayout->addWidget(dummyBox,iii++,0);
1004 1001
1005 dummyBox = new QHBox(topFrame); 1002 dummyBox = new QHBox(topFrame);
1006 new QLabel(i18n("Auto suspend count:"),dummyBox); 1003 new QLabel(i18n("Auto suspend count:"),dummyBox);
1007 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); 1004 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox);
1008 topLayout->addWidget(dummyBox,iii++,0); 1005 topLayout->addWidget(dummyBox,iii++,0);
1009 1006
1010 1007
1011 1008
1012 1009
1013 1010
1014 1011
1015 1012
1016 QHBox* hbo = new QHBox ( topFrame ); 1013 QHBox* hbo = new QHBox ( topFrame );
1017 mDefaultAlarmFile = new QLineEdit(hbo); 1014 mDefaultAlarmFile = new QLineEdit(hbo);
1018 QPushButton * loadTemplate = new QPushButton(hbo); 1015 QPushButton * loadTemplate = new QPushButton(hbo);
1019 QPixmap icon; 1016 QPixmap icon;
1020 if ( QApplication::desktop()->width() < 321 ) 1017 if ( QApplication::desktop()->width() < 321 )
1021 icon = SmallIcon("fileimport16"); 1018 icon = SmallIcon("fileimport16");
1022 else 1019 else
1023 icon = SmallIcon("fileimport"); 1020 icon = SmallIcon("fileimport");
1024 loadTemplate->setIconSet (icon ) ; 1021 loadTemplate->setIconSet (icon ) ;
1025 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); 1022 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) );
1026 int size = loadTemplate->sizeHint().height(); 1023 int size = loadTemplate->sizeHint().height();
1027 loadTemplate->setFixedSize( size, size ); 1024 loadTemplate->setFixedSize( size, size );
1028 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); 1025 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame);
1029 // topLayout->addWidget(lab ,iii++,0); 1026 // topLayout->addWidget(lab ,iii++,0);
1030 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); 1027 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame);
1031 topLayout->addWidget(lab ,iii++,0); 1028 topLayout->addWidget(lab ,iii++,0);
1032 topLayout->addWidget(hbo,iii++,0); 1029 topLayout->addWidget(hbo,iii++,0);
1033 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); 1030 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame);
1034 1031
1035// topLayout->addWidget(lab ,iii++,0); 1032// topLayout->addWidget(lab ,iii++,0);
1036// #ifndef DESKTOP_VERSION 1033// #ifndef DESKTOP_VERSION
1037// lab->setAlignment( AlignLeft|WordBreak|AlignTop); 1034// lab->setAlignment( AlignLeft|WordBreak|AlignTop);
1038// #else 1035// #else
1039// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 1036// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
1040// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 1037// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
1041// #endif 1038// #endif
1042 1039
1043 1040
1044} 1041}
1045 1042
1046void KOPrefsDialog::selectSoundFile() 1043void KOPrefsDialog::selectSoundFile()
1047{ 1044{
1048 QString fileName = mDefaultAlarmFile->text(); 1045 QString fileName = mDefaultAlarmFile->text();
1049 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); 1046 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this );
1050 if ( fileName.length() > 0 ) 1047 if ( fileName.length() > 0 )
1051 mDefaultAlarmFile->setText( fileName ); 1048 mDefaultAlarmFile->setText( fileName );
1052} 1049}
1053void KOPrefsDialog::setupFontsTab() 1050void KOPrefsDialog::setupFontsTab()
1054{ 1051{
1055 1052
1056 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 1053 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
1057 // DesktopIcon("fonts",KIcon::SizeMedium)); 1054 // DesktopIcon("fonts",KIcon::SizeMedium));
1058 1055
1059 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 1056 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
1060 topLayout->setSpacing(1); 1057 topLayout->setSpacing(1);
1061 topLayout->setMargin(3); 1058 topLayout->setMargin(3);
1062 KPrefsDialogWidFont * tVFont; 1059 KPrefsDialogWidFont * tVFont;
1063 int i = 0; 1060 int i = 0;
1064 KPrefsDialogWidFont *timeLabelsFont = 1061 KPrefsDialogWidFont *timeLabelsFont =
1065 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), 1062 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"),
1066 &(KOPrefs::instance()->mDateNavigatorFont),topFrame); 1063 &(KOPrefs::instance()->mDateNavigatorFont),topFrame);
1067 topLayout->addWidget(timeLabelsFont->label(),i,0); 1064 topLayout->addWidget(timeLabelsFont->label(),i,0);
1068 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1065 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1069 topLayout->addWidget(timeLabelsFont->button(),i,2); 1066 topLayout->addWidget(timeLabelsFont->button(),i,2);
1070 ++i; 1067 ++i;
1071 1068
1072 1069
1073 timeLabelsFont = 1070 timeLabelsFont =
1074 addWidFont(i18n("Mon 15"),i18n("Date Labels:"), 1071 addWidFont(i18n("Mon 15"),i18n("Date Labels:"),
1075 &(KOPrefs::instance()->mTimeLabelsFont),topFrame); 1072 &(KOPrefs::instance()->mTimeLabelsFont),topFrame);
1076 topLayout->addWidget(timeLabelsFont->label(),i,0); 1073 topLayout->addWidget(timeLabelsFont->label(),i,0);
1077 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1074 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1078 topLayout->addWidget(timeLabelsFont->button(),i,2); 1075 topLayout->addWidget(timeLabelsFont->button(),i,2);
1079 ++i; 1076 ++i;
1080 1077
1081 KPrefsDialogWidFont *timeBarFont = 1078 KPrefsDialogWidFont *timeBarFont =
1082 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), 1079 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"),
1083 &(KOPrefs::instance()->mTimeBarFont),topFrame); 1080 &(KOPrefs::instance()->mTimeBarFont),topFrame);
1084 topLayout->addWidget(timeBarFont->label(),i,0); 1081 topLayout->addWidget(timeBarFont->label(),i,0);
1085 topLayout->addWidget(timeBarFont->preview(),i,1); 1082 topLayout->addWidget(timeBarFont->preview(),i,1);
1086 topLayout->addWidget(timeBarFont->button(),i,2); 1083 topLayout->addWidget(timeBarFont->button(),i,2);
1087 ++i; 1084 ++i;
1088 1085
1089 1086
1090 KPrefsDialogWidFont *marcusBainsFont = 1087 KPrefsDialogWidFont *marcusBainsFont =
1091 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), 1088 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"),
1092 &(KOPrefs::instance()->mMarcusBainsFont),topFrame); 1089 &(KOPrefs::instance()->mMarcusBainsFont),topFrame);
1093 topLayout->addWidget(marcusBainsFont->label(),i,0); 1090 topLayout->addWidget(marcusBainsFont->label(),i,0);
1094 topLayout->addWidget(marcusBainsFont->preview(),i,1); 1091 topLayout->addWidget(marcusBainsFont->preview(),i,1);
1095 topLayout->addWidget(marcusBainsFont->button(),i,2); 1092 topLayout->addWidget(marcusBainsFont->button(),i,2);
1096 ++i; 1093 ++i;
1097 1094
1098 tVFont = 1095 tVFont =
1099 addWidFont(i18n("Summary"),i18n("Event Viewer:"), 1096 addWidFont(i18n("Summary"),i18n("Event Viewer:"),
1100 &(KOPrefs::instance()->mEventViewFont),topFrame); 1097 &(KOPrefs::instance()->mEventViewFont),topFrame);
1101 topLayout->addWidget(tVFont->label(),i,0); 1098 topLayout->addWidget(tVFont->label(),i,0);
1102 topLayout->addWidget(tVFont->preview(),i,1); 1099 topLayout->addWidget(tVFont->preview(),i,1);
1103 topLayout->addWidget(tVFont->button(),i,2); 1100 topLayout->addWidget(tVFont->button(),i,2);
1104 ++i; 1101 ++i;
1105 1102
1106 1103
1107 1104
1108 tVFont = 1105 tVFont =
1109 addWidFont(i18n("Details"),i18n("EditorBox:"), 1106 addWidFont(i18n("Details"),i18n("EditorBox:"),
1110 &(KOPrefs::instance()->mEditBoxFont),topFrame); 1107 &(KOPrefs::instance()->mEditBoxFont),topFrame);
1111 topLayout->addWidget(tVFont->label(),i,0); 1108 topLayout->addWidget(tVFont->label(),i,0);
1112 topLayout->addWidget(tVFont->preview(),i,1); 1109 topLayout->addWidget(tVFont->preview(),i,1);
1113 topLayout->addWidget(tVFont->button(),i,2); 1110 topLayout->addWidget(tVFont->button(),i,2);
1114 ++i; 1111 ++i;
1115 1112
1116 1113
1117 1114
1118 topLayout->setColStretch(1,1); 1115 topLayout->setColStretch(1,1);
1119 topLayout->setRowStretch(4,1); 1116 topLayout->setRowStretch(4,1);
1120 1117
1121 1118
1122 i = 0; 1119 i = 0;
1123 topFrame = addPage(i18n("View Fonts"),0, 1120 topFrame = addPage(i18n("View Fonts"),0,
1124 DesktopIcon("fonts",KIcon::SizeMedium)); 1121 DesktopIcon("fonts",KIcon::SizeMedium));
1125 1122
1126 topLayout = new QGridLayout(topFrame,7,3); 1123 topLayout = new QGridLayout(topFrame,7,3);
1127 topLayout->setSpacing(1); 1124 topLayout->setSpacing(1);
1128 topLayout->setMargin(3); 1125 topLayout->setMargin(3);
1129 1126
1130 tVFont = 1127 tVFont =
1131 addWidFont(i18n("Configure KO"),i18n("What's Next View:"), 1128 addWidFont(i18n("Configure KO"),i18n("What's Next View:"),
1132 &(KOPrefs::instance()->mWhatsNextFont),topFrame); 1129 &(KOPrefs::instance()->mWhatsNextFont),topFrame);
1133 topLayout->addWidget(tVFont->label(),i,0); 1130 topLayout->addWidget(tVFont->label(),i,0);
1134 topLayout->addWidget(tVFont->preview(),i,1); 1131 topLayout->addWidget(tVFont->preview(),i,1);
1135 topLayout->addWidget(tVFont->button(),i,2); 1132 topLayout->addWidget(tVFont->button(),i,2);
1136 ++i; 1133 ++i;
1137 KPrefsDialogWidFont *agendaViewFont = 1134 KPrefsDialogWidFont *agendaViewFont =
1138 addWidFont(i18n("Event text"),i18n("Agenda view:"), 1135 addWidFont(i18n("Event text"),i18n("Agenda view:"),
1139 &(KOPrefs::instance()->mAgendaViewFont),topFrame); 1136 &(KOPrefs::instance()->mAgendaViewFont),topFrame);
1140 topLayout->addWidget(agendaViewFont->label(),i,0); 1137 topLayout->addWidget(agendaViewFont->label(),i,0);
1141 topLayout->addWidget(agendaViewFont->preview(),i,1); 1138 topLayout->addWidget(agendaViewFont->preview(),i,1);
1142 topLayout->addWidget(agendaViewFont->button(),i,2); 1139 topLayout->addWidget(agendaViewFont->button(),i,2);
1143 ++i; 1140 ++i;
1144 1141
1145 1142
1146 KPrefsDialogWidFont *monthViewFont = 1143 KPrefsDialogWidFont *monthViewFont =
1147 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), 1144 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"),
1148 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); 1145 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame);
1149 topLayout->addWidget(monthViewFont->label(),i,0); 1146 topLayout->addWidget(monthViewFont->label(),i,0);
1150 topLayout->addWidget(monthViewFont->preview(),i,1); 1147 topLayout->addWidget(monthViewFont->preview(),i,1);
1151 topLayout->addWidget(monthViewFont->button(),i,2); 1148 topLayout->addWidget(monthViewFont->button(),i,2);
1152 ++i; 1149 ++i;
1153 1150
1154 1151
1155 KPrefsDialogWidFont *lVFont = 1152 KPrefsDialogWidFont *lVFont =
1156 addWidFont(i18n("Event"),i18n("List View:"), 1153 addWidFont(i18n("Event"),i18n("List View:"),
1157 &(KOPrefs::instance()->mListViewFont),topFrame); 1154 &(KOPrefs::instance()->mListViewFont),topFrame);
1158 topLayout->addWidget(lVFont->label(),i,0); 1155 topLayout->addWidget(lVFont->label(),i,0);
1159 topLayout->addWidget(lVFont->preview(),i,1); 1156 topLayout->addWidget(lVFont->preview(),i,1);
1160 topLayout->addWidget(lVFont->button(),i,2); 1157 topLayout->addWidget(lVFont->button(),i,2);
1161 ++i; 1158 ++i;
1162 1159
1163 1160
1164 tVFont = 1161 tVFont =
1165 addWidFont(i18n("ToDo"),i18n("ToDoView:"), 1162 addWidFont(i18n("ToDo"),i18n("ToDoView:"),
1166 &(KOPrefs::instance()->mTodoViewFont),topFrame); 1163 &(KOPrefs::instance()->mTodoViewFont),topFrame);
1167 topLayout->addWidget(tVFont->label(),i,0); 1164 topLayout->addWidget(tVFont->label(),i,0);
1168 topLayout->addWidget(tVFont->preview(),i,1); 1165 topLayout->addWidget(tVFont->preview(),i,1);
1169 topLayout->addWidget(tVFont->button(),i,2); 1166 topLayout->addWidget(tVFont->button(),i,2);
1170 ++i; 1167 ++i;
1171 1168
1172 1169
1173 tVFont = 1170 tVFont =
1174 addWidFont(i18n("Today"),i18n("JournalView:"), 1171 addWidFont(i18n("Today"),i18n("JournalView:"),
1175 &(KOPrefs::instance()->mJornalViewFont),topFrame); 1172 &(KOPrefs::instance()->mJornalViewFont),topFrame);
1176 topLayout->addWidget(tVFont->label(),i,0); 1173 topLayout->addWidget(tVFont->label(),i,0);
1177 topLayout->addWidget(tVFont->preview(),i,1); 1174 topLayout->addWidget(tVFont->preview(),i,1);
1178 topLayout->addWidget(tVFont->button(),i,2); 1175 topLayout->addWidget(tVFont->button(),i,2);
1179 ++i; 1176 ++i;
1180 1177
1181 1178
1182 1179
1183 1180
1184 topLayout->setColStretch(1,1); 1181 topLayout->setColStretch(1,1);
1185 topLayout->setRowStretch(4,1); 1182 topLayout->setRowStretch(4,1);
1186 1183
1187 1184
1188 1185
1189 1186
1190} 1187}
1191 1188
1192void KOPrefsDialog::setupColorsTab() 1189void KOPrefsDialog::setupColorsTab()
1193{ 1190{
1194 QFrame *topFrame = addPage(i18n("Colors"),0,0); 1191 QFrame *topFrame = addPage(i18n("Colors"),0,0);
1195 // DesktopIcon("colorize",KIcon::SizeMedium)); 1192 // DesktopIcon("colorize",KIcon::SizeMedium));
1196 1193
1197 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1194 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1198 // topLayout->setSpacing(mSpacingHint); 1195 // topLayout->setSpacing(mSpacingHint);
1199 // topLayout->setMargin(mMarginHint); 1196 // topLayout->setMargin(mMarginHint);
1200 1197
1201 topLayout->setSpacing(2); 1198 topLayout->setSpacing(2);
1202 topLayout->setMargin(3); 1199 topLayout->setMargin(3);
1203 1200
1204 int ii = 1; 1201 int ii = 1;
1205 QGroupBox *categoryGroup ; 1202 QGroupBox *categoryGroup ;
1206 1203
1207 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), 1204 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"),
1208 topFrame); 1205 topFrame);
1209 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); 1206 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1);
1210 1207
1211 mCategoryCombo = new QComboBox(categoryGroup); 1208 mCategoryCombo = new QComboBox(categoryGroup);
1212 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1209 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1213 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); 1210 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
1214 1211
1215 mCategoryButton = new KColorButton(categoryGroup); 1212 mCategoryButton = new KColorButton(categoryGroup);
1216 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); 1213 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
1217 updateCategoryColor(); 1214 updateCategoryColor();
1218 1215
1219 1216
1220 // Holiday Color 1217 // Holiday Color
1221 1218
1222 KPrefsDialogWidColor *holidayColor = 1219 KPrefsDialogWidColor *holidayColor =
1223 addWidColor(i18n("Holiday color:"), 1220 addWidColor(i18n("Holiday color:"),
1224 &(KOPrefs::instance()->mHolidayColor),topFrame); 1221 &(KOPrefs::instance()->mHolidayColor),topFrame);
1225 topLayout->addWidget(holidayColor->label(),ii,0); 1222 topLayout->addWidget(holidayColor->label(),ii,0);
1226 topLayout->addWidget(holidayColor->button(),ii++,1); 1223 topLayout->addWidget(holidayColor->button(),ii++,1);
1227 1224
1228 // Highlight Color 1225 // Highlight Color
1229 KPrefsDialogWidColor *highlightColor = 1226 KPrefsDialogWidColor *highlightColor =
1230 addWidColor(i18n("Highlight color:"), 1227 addWidColor(i18n("Highlight color:"),
1231 &(KOPrefs::instance()->mHighlightColor),topFrame); 1228 &(KOPrefs::instance()->mHighlightColor),topFrame);
1232 topLayout->addWidget(highlightColor->label(),ii,0); 1229 topLayout->addWidget(highlightColor->label(),ii,0);
1233 topLayout->addWidget(highlightColor->button(),ii++,1); 1230 topLayout->addWidget(highlightColor->button(),ii++,1);
1234 1231
1235 // Event color 1232 // Event color
1236 KPrefsDialogWidColor *eventColor = 1233 KPrefsDialogWidColor *eventColor =
1237 addWidColor(i18n("Default event color:"), 1234 addWidColor(i18n("Default event color:"),
1238 &(KOPrefs::instance()->mEventColor),topFrame); 1235 &(KOPrefs::instance()->mEventColor),topFrame);
1239 topLayout->addWidget(eventColor->label(),ii,0); 1236 topLayout->addWidget(eventColor->label(),ii,0);
1240 topLayout->addWidget(eventColor->button(),ii++,1); 1237 topLayout->addWidget(eventColor->button(),ii++,1);
1241 eventColor = 1238 eventColor =
1242 addWidColor(i18n("Default todo done color:"), 1239 addWidColor(i18n("Default todo done color:"),
1243 &(KOPrefs::instance()->mTodoDoneColor),topFrame); 1240 &(KOPrefs::instance()->mTodoDoneColor),topFrame);
1244 topLayout->addWidget(eventColor->label(),ii,0); 1241 topLayout->addWidget(eventColor->label(),ii,0);
1245 topLayout->addWidget(eventColor->button(),ii++,1); 1242 topLayout->addWidget(eventColor->button(),ii++,1);
1246 1243
1247 1244
1248 // agenda view background color 1245 // agenda view background color
1249 KPrefsDialogWidColor *agendaBgColor = 1246 KPrefsDialogWidColor *agendaBgColor =
1250 addWidColor(i18n("Agenda view background color:"), 1247 addWidColor(i18n("Agenda view background color:"),
1251 &(KOPrefs::instance()->mAgendaBgColor),topFrame); 1248 &(KOPrefs::instance()->mAgendaBgColor),topFrame);
1252 topLayout->addWidget(agendaBgColor->label(),ii,0); 1249 topLayout->addWidget(agendaBgColor->label(),ii,0);
1253 topLayout->addWidget(agendaBgColor->button(),ii++,1); 1250 topLayout->addWidget(agendaBgColor->button(),ii++,1);
1254 1251
1255 // working hours color 1252 // working hours color
1256 KPrefsDialogWidColor *workingHoursColor = 1253 KPrefsDialogWidColor *workingHoursColor =
1257 addWidColor(i18n("Working hours color:"), 1254 addWidColor(i18n("Working hours color:"),
1258 &(KOPrefs::instance()->mWorkingHoursColor),topFrame); 1255 &(KOPrefs::instance()->mWorkingHoursColor),topFrame);
1259 topLayout->addWidget(workingHoursColor->label(),ii,0); 1256 topLayout->addWidget(workingHoursColor->label(),ii,0);
1260 topLayout->addWidget(workingHoursColor->button(),ii++,1); 1257 topLayout->addWidget(workingHoursColor->button(),ii++,1);
1261 1258
1262 KPrefsDialogWidBool *sb = 1259 KPrefsDialogWidBool *sb =
1263 addWidBool(i18n("Use colors for application:"), 1260 addWidBool(i18n("Use colors for application:"),
1264 &(KOPrefs::instance()->mUseAppColors),topFrame); 1261 &(KOPrefs::instance()->mUseAppColors),topFrame);
1265 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); 1262 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 );
1266 1263
1267 ii++; 1264 ii++;
1268 KPrefsDialogWidColor * workingHoursColor1 = 1265 KPrefsDialogWidColor * workingHoursColor1 =
1269 addWidColor(i18n("Buttons, menus, etc.:"), 1266 addWidColor(i18n("Buttons, menus, etc.:"),
1270 &(KOPrefs::instance()->mAppColor1),topFrame); 1267 &(KOPrefs::instance()->mAppColor1),topFrame);
1271 topLayout->addWidget(workingHoursColor1->label(),ii,0); 1268 topLayout->addWidget(workingHoursColor1->label(),ii,0);
1272 topLayout->addWidget(workingHoursColor1->button(),ii++,1); 1269 topLayout->addWidget(workingHoursColor1->button(),ii++,1);
1273 1270
1274 KPrefsDialogWidColor * workingHoursColor2 = 1271 KPrefsDialogWidColor * workingHoursColor2 =
1275 addWidColor(i18n("Frames, labels, etc.:"), 1272 addWidColor(i18n("Frames, labels, etc.:"),
1276 &(KOPrefs::instance()->mAppColor2),topFrame); 1273 &(KOPrefs::instance()->mAppColor2),topFrame);
1277 topLayout->addWidget(workingHoursColor2->label(),ii,0); 1274 topLayout->addWidget(workingHoursColor2->label(),ii,0);
1278 topLayout->addWidget(workingHoursColor2->button(),ii++,1); 1275 topLayout->addWidget(workingHoursColor2->button(),ii++,1);
1279 1276
1280 1277
1281 1278
1282} 1279}
1283 1280
1284void KOPrefsDialog::setCategoryColor() 1281void KOPrefsDialog::setCategoryColor()
1285{ 1282{
1286 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); 1283 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color()));
1287} 1284}
1288 1285
1289void KOPrefsDialog::updateCategoryColor() 1286void KOPrefsDialog::updateCategoryColor()
1290{ 1287{
1291 QString cat = mCategoryCombo->currentText(); 1288 QString cat = mCategoryCombo->currentText();
1292 QColor *color = mCategoryDict.find(cat); 1289 QColor *color = mCategoryDict.find(cat);
1293 if (!color) { 1290 if (!color) {
1294 color = KOPrefs::instance()->categoryColor(cat); 1291 color = KOPrefs::instance()->categoryColor(cat);
1295 } 1292 }
1296 if (color) { 1293 if (color) {
1297 mCategoryButton->setColor(*color); 1294 mCategoryButton->setColor(*color);
1298 } 1295 }
1299} 1296}
1300 1297
1301void KOPrefsDialog::setupPrinterTab() 1298void KOPrefsDialog::setupPrinterTab()
1302{ 1299{
1303 mPrinterTab = addPage(i18n("Printing"),0, 1300 mPrinterTab = addPage(i18n("Printing"),0,
1304 DesktopIcon("fileprint",KIcon::SizeMedium)); 1301 DesktopIcon("fileprint",KIcon::SizeMedium));
1305 1302
1306 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); 1303 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2);
1307 topLayout->setSpacing(mSpacingHint); 1304 topLayout->setSpacing(mSpacingHint);
1308 topLayout->setMargin(mMarginHint); 1305 topLayout->setMargin(mMarginHint);
1309 1306
1310 topLayout->setRowStretch(4,1); 1307 topLayout->setRowStretch(4,1);
1311} 1308}
1312 1309
1313void KOPrefsDialog::setupGroupSchedulingTab() 1310void KOPrefsDialog::setupGroupSchedulingTab()
1314{ 1311{
1315#if 0 1312#if 0
1316 QFrame *topFrame = addPage(i18n("Group Scheduling"),0, 1313 QFrame *topFrame = addPage(i18n("Group Scheduling"),0,
1317 DesktopIcon("personal",KIcon::SizeMedium)); 1314 DesktopIcon("personal",KIcon::SizeMedium));
1318 1315
1319 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 1316 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
1320 topLayout->setSpacing(mSpacingHint); 1317 topLayout->setSpacing(mSpacingHint);
1321 topLayout->setMargin(mMarginHint); 1318 topLayout->setMargin(mMarginHint);
1322 1319
1323#if 0 1320#if 0
1324 KPrefsDialogWidRadios *schedulerGroup = 1321 KPrefsDialogWidRadios *schedulerGroup =
1325 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), 1322 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler),
1326 topFrame); 1323 topFrame);
1327 schedulerGroup->addRadio("Dummy"); // Only for debugging 1324 schedulerGroup->addRadio("Dummy"); // Only for debugging
1328 schedulerGroup->addRadio(i18n("Mail client")); 1325 schedulerGroup->addRadio(i18n("Mail client"));
1329 1326
1330 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); 1327 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1);
1331#endif 1328#endif
1332 1329
1333 KPrefsDialogWidRadios *sendGroup = 1330 KPrefsDialogWidRadios *sendGroup =
1334 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), 1331 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend),
1335 topFrame); 1332 topFrame);
1336 sendGroup->addRadio(i18n("Send to outbox")); 1333 sendGroup->addRadio(i18n("Send to outbox"));
1337 sendGroup->addRadio(i18n("Send directly")); 1334 sendGroup->addRadio(i18n("Send directly"));
1338 1335
1339 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); 1336 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1);
1340 1337
1341 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); 1338 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1);
1342 mAMails = new QListView(topFrame); 1339 mAMails = new QListView(topFrame);
1343 mAMails->addColumn(i18n("Email"),300); 1340 mAMails->addColumn(i18n("Email"),300);
1344 topLayout->addMultiCellWidget(mAMails,3,3,0,1); 1341 topLayout->addMultiCellWidget(mAMails,3,3,0,1);
1345 1342
1346 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); 1343 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0);
1347 aEmailsEdit = new QLineEdit(topFrame); 1344 aEmailsEdit = new QLineEdit(topFrame);
1348 aEmailsEdit->setEnabled(false); 1345 aEmailsEdit->setEnabled(false);
1349 topLayout->addWidget(aEmailsEdit,4,1); 1346 topLayout->addWidget(aEmailsEdit,4,1);
1350 1347
1351 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); 1348 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
1352 topLayout->addWidget(add,5,0); 1349 topLayout->addWidget(add,5,0);
1353 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); 1350 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
1354 topLayout->addWidget(del,5,1); 1351 topLayout->addWidget(del,5,1);
1355 1352
1356 //topLayout->setRowStretch(2,1); 1353 //topLayout->setRowStretch(2,1);
1357 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); 1354 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
1358 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); 1355 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
1359 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); 1356 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
1360 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); 1357 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput()));
1361#endif 1358#endif
1362} 1359}
1363 1360
1364void KOPrefsDialog::setupGroupAutomationTab() 1361void KOPrefsDialog::setupGroupAutomationTab()
1365{ 1362{
1366 return; 1363 return;
1367 QFrame *topFrame = addPage(i18n("Group Automation"),0, 1364 QFrame *topFrame = addPage(i18n("Group Automation"),0,
1368 DesktopIcon("personal",KIcon::SizeMedium)); 1365 DesktopIcon("personal",KIcon::SizeMedium));
1369 1366
1370 QGridLayout *topLayout = new QGridLayout(topFrame,5,1); 1367 QGridLayout *topLayout = new QGridLayout(topFrame,5,1);
1371 topLayout->setSpacing(mSpacingHint); 1368 topLayout->setSpacing(mSpacingHint);
1372 topLayout->setMargin(mMarginHint); 1369 topLayout->setMargin(mMarginHint);
1373 1370
1374 KPrefsDialogWidRadios *autoRefreshGroup = 1371 KPrefsDialogWidRadios *autoRefreshGroup =
1375 addWidRadios(i18n("Auto Send Refresh"), 1372 addWidRadios(i18n("Auto Send Refresh"),
1376 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); 1373 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame);
1377 autoRefreshGroup->addRadio(i18n("Never")); 1374 autoRefreshGroup->addRadio(i18n("Never"));
1378 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); 1375 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook"));
1379 //autoRefreshGroup->addRadio(i18n("selected emails")); 1376 //autoRefreshGroup->addRadio(i18n("selected emails"));
1380 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); 1377 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0);
1381 1378
1382 KPrefsDialogWidRadios *autoInsertGroup = 1379 KPrefsDialogWidRadios *autoInsertGroup =
1383 addWidRadios(i18n("Auto Insert IMIP Replies"), 1380 addWidRadios(i18n("Auto Insert IMIP Replies"),
1384 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); 1381 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame);
1385 autoInsertGroup->addRadio(i18n("Never")); 1382 autoInsertGroup->addRadio(i18n("Never"));
1386 autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); 1383 autoInsertGroup->addRadio(i18n("If attendee is in addressbook"));
1387 //autoInsertGroup->addRadio(i18n("selected emails")); 1384 //autoInsertGroup->addRadio(i18n("selected emails"));
1388 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); 1385 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0);
1389 1386
1390 KPrefsDialogWidRadios *autoRequestGroup = 1387 KPrefsDialogWidRadios *autoRequestGroup =
1391 addWidRadios(i18n("Auto Insert IMIP Requests"), 1388 addWidRadios(i18n("Auto Insert IMIP Requests"),
1392 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); 1389 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame);
1393 autoRequestGroup->addRadio(i18n("Never")); 1390 autoRequestGroup->addRadio(i18n("Never"));
1394 autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); 1391 autoRequestGroup->addRadio(i18n("If organizer is in addressbook"));
1395 //autoInsertGroup->addRadio(i18n("selected emails")); 1392 //autoInsertGroup->addRadio(i18n("selected emails"));
1396 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); 1393 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0);
1397 1394
1398 KPrefsDialogWidRadios *autoFreeBusyGroup = 1395 KPrefsDialogWidRadios *autoFreeBusyGroup =
1399 addWidRadios(i18n("Auto Send FreeBusy Information"), 1396 addWidRadios(i18n("Auto Send FreeBusy Information"),
1400 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); 1397 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame);
1401 autoFreeBusyGroup->addRadio(i18n("Never")); 1398 autoFreeBusyGroup->addRadio(i18n("Never"));
1402 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); 1399 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook"));
1403 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1400 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1404 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); 1401 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0);
1405 1402
1406 KPrefsDialogWidRadios *autoFreeBusyReplyGroup = 1403 KPrefsDialogWidRadios *autoFreeBusyReplyGroup =
1407 addWidRadios(i18n("Auto Save FreeBusy Replies"), 1404 addWidRadios(i18n("Auto Save FreeBusy Replies"),
1408 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); 1405 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame);
1409 autoFreeBusyReplyGroup->addRadio(i18n("Never")); 1406 autoFreeBusyReplyGroup->addRadio(i18n("Never"));
1410 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); 1407 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook"));
1411 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1408 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1412 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); 1409 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0);
1413} 1410}
1414 1411
1415void KOPrefsDialog::showPrinterTab() 1412void KOPrefsDialog::showPrinterTab()
1416{ 1413{
1417 showPage(pageIndex(mPrinterTab)); 1414 showPage(pageIndex(mPrinterTab));
1418} 1415}
1419 1416
1420 1417
1421void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, 1418void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text,
1422 const QStringList *tags) 1419 const QStringList *tags)
1423{ 1420{
1424 if (tags) { 1421 if (tags) {
1425 int i = tags->findIndex(text); 1422 int i = tags->findIndex(text);
1426 if (i > 0) combo->setCurrentItem(i); 1423 if (i > 0) combo->setCurrentItem(i);
1427 } else { 1424 } else {
1428 for(int i=0;i<combo->count();++i) { 1425 for(int i=0;i<combo->count();++i) {
1429 if (combo->text(i) == text) { 1426 if (combo->text(i) == text) {
1430 combo->setCurrentItem(i); 1427 combo->setCurrentItem(i);
1431 break; 1428 break;
1432 } 1429 }
1433 } 1430 }
1434 } 1431 }
1435} 1432}
1436 1433
1437void KOPrefsDialog::usrReadConfig() 1434void KOPrefsDialog::usrReadConfig()
1438{ 1435{
1439 kdelibcfg->readConfig(); 1436 kdelibcfg->readConfig();
1440 mNameEdit->setText(KOPrefs::instance()->fullName()); 1437 mNameEdit->setText(KOPrefs::instance()->fullName());
1441 mEmailEdit->setText(KOPrefs::instance()->email()); 1438 mEmailEdit->setText(KOPrefs::instance()->email());
1442 1439
1443 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); 1440 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval);
1444 // QDate current ( 2001, 1,1); 1441 // QDate current ( 2001, 1,1);
1445 //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); 1442 //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1));
1446 //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); 1443 //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1));
1447 //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); 1444 //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId));
1448 //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); 1445 //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
1449 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); 1446 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime);
1450 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); 1447 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration);
1451 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); 1448 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime);
1452 // if (KOPrefs::instance()->mAllDaySize > 47 ) 1449 // if (KOPrefs::instance()->mAllDaySize > 47 )
1453 // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; 1450 // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2;
1454 //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); 1451 //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize);
1455 1452
1456 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); 1453 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays);
1457 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); 1454 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays);
1458 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); 1455 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios);
1459 // mAMails->clear(); 1456 // mAMails->clear();
1460 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); 1457 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin();
1461// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { 1458// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) {
1462// QListViewItem *item = new QListViewItem(mAMails); 1459// QListViewItem *item = new QListViewItem(mAMails);
1463// item->setText(0,*it); 1460// item->setText(0,*it);
1464// mAMails->insertItem(item); 1461// mAMails->insertItem(item);
1465// } 1462// }
1466 1463
1467 // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); 1464 // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP);
1468 //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); 1465 //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser);
1469 //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); 1466 //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd);
1470 //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); 1467 //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile);
1471 1468
1472 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); 1469 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile);
1473 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); 1470 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile);
1474 //QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1471 //QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1475 //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 1472 //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
1476 //dummy = KOPrefs::instance()->mUserDateFormatShort; 1473 //dummy = KOPrefs::instance()->mUserDateFormatShort;
1477 //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 1474 //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
1478 updateCategories(); 1475 updateCategories();
1479 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); 1476 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps );
1480 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); 1477 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime );
1481 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); 1478 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount );
1482 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); 1479 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval );
1483} 1480}
1484 1481
1485 1482
1486void KOPrefsDialog::usrWriteConfig() 1483void KOPrefsDialog::usrWriteConfig()
1487{ 1484{
1488 1485
1489 kdelibcfg->writeConfig(); 1486 kdelibcfg->writeConfig();
1490 // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); 1487 // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text();
1491 //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); 1488 //KOPrefs::instance()->mRemoteUser = mRemoteUser->text();
1492 //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); 1489 //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text();
1493 //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); 1490 //KOPrefs::instance()->mRemoteFile= mRemoteFile->text();
1494 //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); 1491 //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text();
1495 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); 1492 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text();
1496 1493
1497 //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 1494 //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
1498 //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 1495 //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
1499 KOPrefs::instance()->setFullName(mNameEdit->text()); 1496 KOPrefs::instance()->setFullName(mNameEdit->text());
1500 KOPrefs::instance()->setEmail(mEmailEdit->text()); 1497 KOPrefs::instance()->setEmail(mEmailEdit->text());
1501 1498
1502 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); 1499 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
1503 1500
1504 // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); 1501 // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText();
1505 //QDate date; 1502 //QDate date;
1506 //date = mStartDateSavingEdit->date(); 1503 //date = mStartDateSavingEdit->date();
1507 //int sub = 0; 1504 //int sub = 0;
1508 //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 1505 //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
1509 // sub = 1; 1506 // sub = 1;
1510// KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; 1507// KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub;
1511// date = mEndDateSavingEdit->date(); 1508// date = mEndDateSavingEdit->date();
1512// if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 1509// if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
1513// sub = 1; 1510// sub = 1;
1514// else 1511// else
1515// sub = 0; 1512// sub = 0;
1516// KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; 1513// KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub;
1517// // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); 1514// // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value();
1518 1515
1519 KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); 1516 KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
1520 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); 1517 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
1521 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); 1518 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
1522 1519
1523 //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); 1520 //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value();
1524 1521
1525 QDictIterator<QColor> it(mCategoryDict); 1522 QDictIterator<QColor> it(mCategoryDict);
1526 while (it.current()) { 1523 while (it.current()) {
1527 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); 1524 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current());
1528 ++it; 1525 ++it;
1529 } 1526 }
1530 1527
1531 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); 1528 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value();
1532 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); 1529 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value();
1533 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); 1530 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value();
1534 1531
1535 KOPrefs::instance()->mAdditionalMails.clear(); 1532 KOPrefs::instance()->mAdditionalMails.clear();
1536 // QListViewItem *item; 1533 // QListViewItem *item;
1537 // item = mAMails->firstChild(); 1534 // item = mAMails->firstChild();
1538 // while (item) 1535 // while (item)
1539 // { 1536 // {
1540 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); 1537 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
1541 // item = item->nextSibling(); 1538 // item = item->nextSibling();
1542 // } 1539 // }
1543 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); 1540 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value();
1544 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; 1541 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ;
1545 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; 1542 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ;
1546 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; 1543 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ;
1547 1544
1548} 1545}
1549 1546
1550void KOPrefsDialog::updateCategories() 1547void KOPrefsDialog::updateCategories()
1551{ 1548{
1552 mCategoryCombo->clear(); 1549 mCategoryCombo->clear();
1553 mCategoryDict.clear(); 1550 mCategoryDict.clear();
1554 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1551 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1555 updateCategoryColor(); 1552 updateCategoryColor();
1556} 1553}
1557 1554
1558void KOPrefsDialog::warningGroupScheduling() 1555void KOPrefsDialog::warningGroupScheduling()
1559{ 1556{
1560 warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); 1557 warningExperimental(mEnableGroupScheduling->checkBox()->isChecked());
1561} 1558}
1562 1559
1563void KOPrefsDialog::warningProjectView() 1560void KOPrefsDialog::warningProjectView()
1564{ 1561{
1565 warningExperimental(mEnableProjectView->checkBox()->isChecked()); 1562 warningExperimental(mEnableProjectView->checkBox()->isChecked());
1566} 1563}
1567 1564
1568void KOPrefsDialog::warningExperimental(bool on) 1565void KOPrefsDialog::warningExperimental(bool on)
1569{ 1566{
1570 if (on) { 1567 if (on) {
1571 KMessageBox::information(this,i18n("This is an experimental feature. " 1568 KMessageBox::information(this,i18n("This is an experimental feature. "
1572 "It may not work, it may do nothing useful and it may cause data loss. " 1569 "It may not work, it may do nothing useful and it may cause data loss. "
1573 "Use with care.\n" 1570 "Use with care.\n"
1574 "You have to restart KOrganizer for this setting to take effect.")); 1571 "You have to restart KOrganizer for this setting to take effect."));
1575 } else { 1572 } else {
1576 KMessageBox::information(this, 1573 KMessageBox::information(this,
1577 i18n("You have to restart KOrganizer for this setting to take effect.")); 1574 i18n("You have to restart KOrganizer for this setting to take effect."));
1578 } 1575 }
1579} 1576}
1580 1577
1581void KOPrefsDialog::toggleEmailSettings(bool on) 1578void KOPrefsDialog::toggleEmailSettings(bool on)
1582{ 1579{
1583 if (on) { 1580 if (on) {
1584 mEmailEdit->setEnabled(false); 1581 mEmailEdit->setEnabled(false);
1585 mNameEdit->setEnabled(false); 1582 mNameEdit->setEnabled(false);
1586 mEmailLabel->setEnabled(false); 1583 mEmailLabel->setEnabled(false);
1587 mNameLabel->setEnabled(false); 1584 mNameLabel->setEnabled(false);
1588 1585
1589 KEMailSettings settings; 1586 KEMailSettings settings;
1590 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); 1587 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName));
1591 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); 1588 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress));
1592 } else { 1589 } else {
1593 mEmailEdit->setEnabled(true); 1590 mEmailEdit->setEnabled(true);
1594 mNameEdit->setEnabled(true); 1591 mNameEdit->setEnabled(true);
1595 mEmailLabel->setEnabled(true); 1592 mEmailLabel->setEnabled(true);
1596 mNameLabel->setEnabled(true); 1593 mNameLabel->setEnabled(true);
1597 } 1594 }
1598} 1595}
1599 1596
1600void KOPrefsDialog::addItem() 1597void KOPrefsDialog::addItem()
1601{ 1598{
1602 // aEmailsEdit->setEnabled(true); 1599 // aEmailsEdit->setEnabled(true);
1603// QListViewItem *item = new QListViewItem(mAMails); 1600// QListViewItem *item = new QListViewItem(mAMails);
1604// mAMails->insertItem(item); 1601// mAMails->insertItem(item);
1605// mAMails->setSelected(item,true); 1602// mAMails->setSelected(item,true);
1606// aEmailsEdit->setText(i18n("(EmptyEmail)")); 1603// aEmailsEdit->setText(i18n("(EmptyEmail)"));
1607} 1604}
1608 1605
1609void KOPrefsDialog::removeItem() 1606void KOPrefsDialog::removeItem()
1610{ 1607{
1611// QListViewItem *item; 1608// QListViewItem *item;
1612// item = mAMails->selectedItem(); 1609// item = mAMails->selectedItem();
1613// if (!item) return; 1610// if (!item) return;
1614// mAMails->takeItem(item); 1611// mAMails->takeItem(item);
1615// item = mAMails->selectedItem(); 1612// item = mAMails->selectedItem();
1616// if (!item) { 1613// if (!item) {
1617// aEmailsEdit->setText(""); 1614// aEmailsEdit->setText("");
1618// aEmailsEdit->setEnabled(false); 1615// aEmailsEdit->setEnabled(false);
1619// } 1616// }
1620// if (mAMails->childCount() == 0) { 1617// if (mAMails->childCount() == 0) {
1621// aEmailsEdit->setEnabled(false); 1618// aEmailsEdit->setEnabled(false);
1622// } 1619// }
1623} 1620}
1624 1621
1625void KOPrefsDialog::updateItem() 1622void KOPrefsDialog::updateItem()
1626{ 1623{
1627 // QListViewItem *item; 1624 // QListViewItem *item;
1628// item = mAMails->selectedItem(); 1625// item = mAMails->selectedItem();
1629// if (!item) return; 1626// if (!item) return;
1630// item->setText(0,aEmailsEdit->text()); 1627// item->setText(0,aEmailsEdit->text());
1631} 1628}
1632 1629
1633void KOPrefsDialog::updateInput() 1630void KOPrefsDialog::updateInput()
1634{ 1631{
1635// QListViewItem *item; 1632// QListViewItem *item;
1636// item = mAMails->selectedItem(); 1633// item = mAMails->selectedItem();
1637// if (!item) return; 1634// if (!item) return;
1638// aEmailsEdit->setEnabled(true); 1635// aEmailsEdit->setEnabled(true);
1639// aEmailsEdit->setText(item->text(0)); 1636// aEmailsEdit->setText(item->text(0));
1640} 1637}
1641void KOPrefsDialog::updateTimezoneOffset( int index ) 1638void KOPrefsDialog::updateTimezoneOffset( int index )
1642{ 1639{
1643 /* 1640 /*
1644 qDebug("updateTimezoneOffset %d ", index); 1641 qDebug("updateTimezoneOffset %d ", index);
1645 if ( index < 24 ) { 1642 if ( index < 24 ) {
1646 mTimezoneOffsetSpin->setEnabled ( false ); 1643 mTimezoneOffsetSpin->setEnabled ( false );
1647 mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); 1644 mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 );
1648 1645
1649 1646
1650 } else { 1647 } else {
1651 if ( index == 24 ) { 1648 if ( index == 24 ) {
1652 mTimezoneOffsetSpin->setEnabled ( true ); 1649 mTimezoneOffsetSpin->setEnabled ( true );
1653 mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); 1650 mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
1654 1651
1655 } else { 1652 } else {
1656 mTimezoneOffsetSpin->setEnabled ( false ); 1653 mTimezoneOffsetSpin->setEnabled ( false );
1657 mTimezoneOffsetSpin->setValue( 0 ); 1654 mTimezoneOffsetSpin->setValue( 0 );
1658 } 1655 }
1659 } 1656 }
1660 */ 1657 */
1661} 1658}
1662 1659
1663void KOPrefsDialog::setupTimeZoneTab() 1660void KOPrefsDialog::setupTimeZoneTab()
1664{ 1661{
1665#if 0 1662#if 0
1666 QFrame *topFrame = addPage(i18n("Time Zone"),0,0); 1663 QFrame *topFrame = addPage(i18n("Time Zone"),0,0);
1667 // DesktopIcon("clock",KIcon::SizeMedium)); 1664 // DesktopIcon("clock",KIcon::SizeMedium));
1668 1665
1669 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1666 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1670 topLayout->setSpacing(mSpacingHint); 1667 topLayout->setSpacing(mSpacingHint);
1671 topLayout->setMargin(mMarginHint); 1668 topLayout->setMargin(mMarginHint);
1672 1669
1673 QHBox *timeZoneBox = new QHBox( topFrame ); 1670 QHBox *timeZoneBox = new QHBox( topFrame );
1674 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); 1671 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
1675 1672
1676 new QLabel( i18n("Timezone:"), timeZoneBox ); 1673 new QLabel( i18n("Timezone:"), timeZoneBox );
1677 mTimeZoneCombo = new QComboBox( timeZoneBox ); 1674 mTimeZoneCombo = new QComboBox( timeZoneBox );
1678 if ( QApplication::desktop()->width() < 300 ) { 1675 if ( QApplication::desktop()->width() < 300 ) {
1679 mTimeZoneCombo->setMaximumWidth(150); 1676 mTimeZoneCombo->setMaximumWidth(150);
1680 } 1677 }
1681 1678
1682 QStringList list; 1679 QStringList list;
1683 list = KGlobal::locale()->timeZoneList(); 1680 list = KGlobal::locale()->timeZoneList();
1684 mTimeZoneCombo->insertStringList(list); 1681 mTimeZoneCombo->insertStringList(list);
1685 1682
1686 // find the currently set time zone and select it 1683 // find the currently set time zone and select it
1687 QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; 1684 QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId;
1688 int nCurrentlySet = 11; 1685 int nCurrentlySet = 11;
1689 for (int i = 0; i < mTimeZoneCombo->count(); i++) 1686 for (int i = 0; i < mTimeZoneCombo->count(); i++)
1690 { 1687 {
1691 if (mTimeZoneCombo->text(i) == sCurrentlySet) 1688 if (mTimeZoneCombo->text(i) == sCurrentlySet)
1692 { 1689 {
1693 nCurrentlySet = i; 1690 nCurrentlySet = i;
1694 break; 1691 break;
1695 } 1692 }
1696 } 1693 }
1697 mTimeZoneCombo->setCurrentItem(nCurrentlySet); 1694 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
1698 int iii = 1; 1695 int iii = 1;
1699 KPrefsDialogWidBool *sb = 1696 KPrefsDialogWidBool *sb =
1700 addWidBool(i18n("Timezone has daylight saving"), 1697 addWidBool(i18n("Timezone has daylight saving"),
1701 &(KOPrefs::instance()->mUseDaylightsaving),topFrame); 1698 &(KOPrefs::instance()->mUseDaylightsaving),topFrame);
1702 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 1699 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
1703 ++iii; 1700 ++iii;
1704 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); 1701 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
1705 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 1702 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
1706 ++iii; 1703 ++iii;
1707 lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); 1704 lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
1708 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 1705 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
1709 ++iii; 1706 ++iii;
1710 lab = new QLabel( i18n("Daylight start:"), topFrame ); 1707 lab = new QLabel( i18n("Daylight start:"), topFrame );
1711 topLayout->addWidget(lab, iii,0); 1708 topLayout->addWidget(lab, iii,0);
1712 mStartDateSavingEdit = new KDateEdit(topFrame); 1709 mStartDateSavingEdit = new KDateEdit(topFrame);
1713 topLayout->addWidget(mStartDateSavingEdit, iii,1); 1710 topLayout->addWidget(mStartDateSavingEdit, iii,1);
1714 ++iii; 1711 ++iii;
1715 1712
1716 lab = new QLabel( i18n("Daylight end:"), topFrame ); 1713 lab = new QLabel( i18n("Daylight end:"), topFrame );
1717 topLayout->addWidget(lab, iii,0); 1714 topLayout->addWidget(lab, iii,0);
1718 mEndDateSavingEdit = new KDateEdit(topFrame); 1715 mEndDateSavingEdit = new KDateEdit(topFrame);
1719 topLayout->addWidget(mEndDateSavingEdit, iii,1); 1716 topLayout->addWidget(mEndDateSavingEdit, iii,1);
1720 ++iii; 1717 ++iii;
1721 QDate current ( 2001, 1,1); 1718 QDate current ( 2001, 1,1);
1722 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); 1719 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1));
1723 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); 1720 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1));
1724#endif 1721#endif
1725 1722
1726} 1723}
1727 1724
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index db60383..7a945e3 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -1,460 +1,466 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qcheckbox.h> 26#include <qcheckbox.h>
27#include <qgroupbox.h> 27#include <qgroupbox.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qlistview.h> 29#include <qlistview.h>
30#include <qwhatsthis.h> 30#include <qwhatsthis.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qpushbutton.h> 32#include <qpushbutton.h>
33 33
34#include <klocale.h> 34#include <klocale.h>
35#include <kmessagebox.h> 35#include <kmessagebox.h>
36 36
37#include <libkdepim/kdateedit.h> 37#include <libkdepim/kdateedit.h>
38 38
39#include "koglobals.h" 39#include "koglobals.h"
40#include "koprefs.h" 40#include "koprefs.h"
41#include "klineedit.h" 41#include "klineedit.h"
42 42
43#include "calendarview.h" 43#include "calendarview.h"
44#include "koviewmanager.h" 44#include "koviewmanager.h"
45#include "searchdialog.h" 45#include "searchdialog.h"
46 46
47SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) 47SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
48 : QVBox( 0 ) 48 : QVBox( 0 )
49 49
50{ 50{
51 mCalendar = calendar; 51 mCalendar = calendar;
52 QFrame *topFrame = new QFrame( this ) ;//plainPage(); 52 QFrame *topFrame = new QFrame( this ) ;//plainPage();
53 QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); 53 QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint());
54 54
55 // Search expression 55 // Search expression
56 QHBoxLayout *subLayout = new QHBoxLayout(); 56 QHBoxLayout *subLayout = new QHBoxLayout();
57 layout->addLayout(subLayout); 57 layout->addLayout(subLayout);
58 searchLabel = new QLabel(topFrame); 58 searchLabel = new QLabel(topFrame);
59 searchLabel->setText(i18n("Search for:")); 59 searchLabel->setText(i18n("Search for:"));
60 subLayout->addWidget(searchLabel); 60 subLayout->addWidget(searchLabel);
61 61
62 searchEdit = new KLineEdit(topFrame); 62 searchEdit = new KLineEdit(topFrame);
63 subLayout->addWidget(searchEdit); 63 subLayout->addWidget(searchEdit);
64 QPushButton *OkButton = new QPushButton( i18n("&Find"), topFrame ); 64 QPushButton *OkButton = new QPushButton( i18n("&Find"), topFrame );
65 //OkButton->setDefault( true ); 65 //OkButton->setDefault( true );
66 connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); 66 connect(OkButton,SIGNAL(clicked()),SLOT(doSearch()));
67 subLayout->addWidget(OkButton); 67 subLayout->addWidget(OkButton);
68 searchEdit->setText("*"); // Find all events by default 68 searchEdit->setText("*"); // Find all events by default
69 searchEdit->setFocus(); 69 searchEdit->setFocus();
70 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); 70 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & )));
71 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); 71 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch()));
72 // Subjects to search 72 // Subjects to search
73 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), 73 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"),
74 // topFrame); 74 // topFrame);
75 75
76 QHBox *incidenceGroup = new QHBox( topFrame ); 76 QHBox *incidenceGroup = new QHBox( topFrame );
77 layout->addWidget(incidenceGroup); 77 layout->addWidget(incidenceGroup);
78 78
79 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); 79 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup);
80 //mSearchEvent->setChecked(true); 80 //mSearchEvent->setChecked(true);
81 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); 81 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup);
82 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); 82 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup);
83 83
84 QHBox *subjectGroup = new QHBox( topFrame ); 84 QHBox *subjectGroup = new QHBox( topFrame );
85 layout->addWidget(subjectGroup); 85 layout->addWidget(subjectGroup);
86 86
87 mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); 87 mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup);
88 mSummaryCheck->setChecked(true); 88 mSummaryCheck->setChecked(true);
89 mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); 89 mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup);
90 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); 90 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup);
91 91
92 QHBox *attendeeGroup = new QHBox( topFrame ); 92 QHBox *attendeeGroup = new QHBox( topFrame );
93 layout->addWidget(attendeeGroup ); 93 layout->addWidget(attendeeGroup );
94 new QLabel( i18n("Attendee:"),attendeeGroup ); 94 new QLabel( i18n("Attendee:"),attendeeGroup );
95 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); 95 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup );
96 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); 96 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup );
97 // Date range 97 // Date range
98 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), 98 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"),
99 // topFrame); 99 // topFrame);
100 // layout->addWidget(rangeGroup); 100 // layout->addWidget(rangeGroup);
101 101
102 QWidget *rangeWidget = new QWidget(topFrame); 102 QWidget *rangeWidget = new QWidget(topFrame);
103 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); 103 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint());
104 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); 104 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget));
105 mStartDate = new KDateEdit(rangeWidget); 105 mStartDate = new KDateEdit(rangeWidget);
106 rangeLayout->addWidget(mStartDate); 106 rangeLayout->addWidget(mStartDate);
107 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); 107 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget));
108 mEndDate = new KDateEdit(rangeWidget); 108 mEndDate = new KDateEdit(rangeWidget);
109 mEndDate->setDate(QDate::currentDate().addDays(365)); 109 mEndDate->setDate(QDate::currentDate().addDays(365));
110 rangeLayout->addWidget(mEndDate); 110 rangeLayout->addWidget(mEndDate);
111 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); 111 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget );
112 rangeLayout->addWidget( (QWidget*)wt ); 112 rangeLayout->addWidget( (QWidget*)wt );
113 layout->addWidget(rangeWidget); 113 layout->addWidget(rangeWidget);
114 // Results list view 114 // Results list view
115 listView = new KOListView(mCalendar,topFrame); 115 listView = new KOListView(mCalendar,topFrame);
116 layout->addWidget(listView); 116 layout->addWidget(listView);
117 117
118 listView->readSettings(KOGlobals::config(),"SearchListView Layout"); 118 listView->readSettings(KOGlobals::config(),"SearchListView Layout");
119 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); 119 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList()));
120 120
121 setCaption( i18n("KO/Pi Find: ")); 121 setCaption( i18n("KO/Pi Find: "));
122#ifdef DESKTOP_VERSION 122#ifdef DESKTOP_VERSION
123 OkButton = new QPushButton( i18n("Close"), this ); 123 OkButton = new QPushButton( i18n("Close"), this );
124 connect(OkButton,SIGNAL(clicked()),SLOT(hide())); 124 connect(OkButton,SIGNAL(clicked()),SLOT(hide()));
125#endif 125#endif
126} 126}
127 127
128SearchDialog::~SearchDialog() 128SearchDialog::~SearchDialog()
129{ 129{
130 130
131} 131}
132void SearchDialog::raiseAndSelect() 132void SearchDialog::raiseAndSelect()
133{ 133{
134 134
135 static int currentState = 0; 135 static int currentState = 0;
136 136
137 if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) 137 if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() )
138 currentState = 0; 138 currentState = 0;
139 int newState = 0; 139 int newState = 0;
140 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { 140 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
141 newState = VIEW_J_VIEW; 141 newState = VIEW_J_VIEW;
142 } 142 }
143 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { 143 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
144 newState = VIEW_T_VIEW; 144 newState = VIEW_T_VIEW;
145 } 145 }
146 else { 146 else {
147 newState = VIEW_A_VIEW; 147 newState = VIEW_A_VIEW;
148 } 148 }
149 if ( newState != currentState ) { 149 if ( newState != currentState ) {
150 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { 150 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
151 if ( ! mSearchJournal->isChecked() ) { 151 if ( ! mSearchJournal->isChecked() ) {
152 mSearchJournal->setChecked( true ); 152 mSearchJournal->setChecked( true );
153 mSearchTodo->setChecked( false ); 153 mSearchTodo->setChecked( false );
154 mSearchEvent->setChecked( false ); 154 mSearchEvent->setChecked( false );
155 } 155 }
156 } 156 }
157 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { 157 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
158 if ( ! mSearchTodo->isChecked() ) { 158 if ( ! mSearchTodo->isChecked() ) {
159 mSearchTodo->setChecked( true ); 159 mSearchTodo->setChecked( true );
160 mSearchJournal->setChecked( false ); 160 mSearchJournal->setChecked( false );
161 mSearchEvent->setChecked( false ); 161 mSearchEvent->setChecked( false );
162 } 162 }
163 } 163 }
164 else { 164 else {
165 if ( ! mSearchEvent->isChecked() ) { 165 if ( ! mSearchEvent->isChecked() ) {
166 mSearchEvent->setChecked( true ); 166 mSearchEvent->setChecked( true );
167 mSearchJournal->setChecked( false ); 167 mSearchJournal->setChecked( false );
168 mSearchTodo->setChecked( false ); 168 mSearchTodo->setChecked( false );
169 } 169 }
170 } 170 }
171 } 171 }
172 currentState = newState; 172 currentState = newState;
173 raise(); 173 raise();
174} 174}
175void SearchDialog::setFocusToList() 175void SearchDialog::setFocusToList()
176{ 176{
177 listView->resetFocus(); 177 listView->resetFocus();
178} 178}
179void SearchDialog::accept() 179void SearchDialog::accept()
180{ 180{
181 doSearch(); 181 doSearch();
182} 182}
183void SearchDialog::updateList() 183void SearchDialog::updateList()
184{ 184{
185 //listView->updateList(); 185 //listView->updateList();
186 if ( isVisible() ) { 186 if ( isVisible() ) {
187 updateView(); 187 updateView();
188 //qDebug("SearchDialog::updated "); 188 //qDebug("SearchDialog::updated ");
189 } 189 }
190 else { 190 else {
191 listView->clear(); 191 listView->clear();
192 //qDebug("SearchDialog::cleared "); 192 //qDebug("SearchDialog::cleared ");
193 193
194 } 194 }
195} 195}
196void SearchDialog::searchTextChanged( const QString &_text ) 196void SearchDialog::searchTextChanged( const QString &_text )
197{ 197{
198#if 0 198#if 0
199 enableButton( KDialogBase::User1, !_text.isEmpty() ); 199 enableButton( KDialogBase::User1, !_text.isEmpty() );
200#endif 200#endif
201} 201}
202 202
203void SearchDialog::doSearch() 203void SearchDialog::doSearch()
204{ 204{
205 QRegExp re; 205 QRegExp re;
206 206
207 re.setWildcard(true); // most people understand these better. 207 re.setWildcard(true); // most people understand these better.
208 re.setCaseSensitive(false); 208 re.setCaseSensitive(false);
209 re.setPattern(searchEdit->text()); 209 QString st = searchEdit->text();
210 if ( st.right(1) != "*")
211 st += "*";
212 re.setPattern(st);
210 if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { 213 if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) {
211 KMessageBox::sorry(this, 214 KMessageBox::sorry(this,
212 i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); 215 i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals"));
213 return; 216 return;
214 } 217 }
215 if (!re.isValid() ) { 218 if (!re.isValid() ) {
216 KMessageBox::sorry(this, 219 KMessageBox::sorry(this,
217 i18n("Invalid search expression,\ncannot perform " 220 i18n("Invalid search expression,\ncannot perform "
218 "the search.\nPlease enter a search expression\n" 221 "the search.\nPlease enter a search expression\n"
219 "using the wildcard characters\n '*' and '?'" 222 "using the wildcard characters\n '*' and '?'"
220 "where needed.")); 223 "where needed."));
221 return; 224 return;
222 } 225 }
223 226
224 search(re); 227 search(re);
225 228
226 listView->setStartDate( mStartDate->date() ); 229 listView->setStartDate( mStartDate->date() );
227 listView->showEvents(mMatchedEvents); 230 listView->showEvents(mMatchedEvents);
228 listView->addTodos(mMatchedTodos); 231 listView->addTodos(mMatchedTodos);
229 listView->addJournals(mMatchedJournals); 232 listView->addJournals(mMatchedJournals);
230 233
231 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { 234 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) {
232 setCaption(i18n("No items found. Use '*' and '?' where needed.")); 235 setCaption(i18n("No items found. Use '*' and '?' where needed."));
233 } else { 236 } else {
234 QString mess; 237 QString mess;
235 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); 238 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() );
236 setCaption( i18n("KO/Pi Find: ") + mess); 239 setCaption( i18n("KO/Pi Find: ") + mess);
237 240
238 } 241 }
239 searchEdit->setFocus(); 242 searchEdit->setFocus();
240} 243}
241void SearchDialog::updateConfig() 244void SearchDialog::updateConfig()
242{ 245{
243 listView->updateConfig(); 246 listView->updateConfig();
244} 247}
245void SearchDialog::updateView() 248void SearchDialog::updateView()
246{ 249{
247 //qDebug("SearchDialog::updateView() %d ", isVisible()); 250 //qDebug("SearchDialog::updateView() %d ", isVisible());
248 QRegExp re; 251 QRegExp re;
249 re.setWildcard(true); // most people understand these better. 252 re.setWildcard(true); // most people understand these better.
250 re.setCaseSensitive(false); 253 re.setCaseSensitive(false);
251 re.setPattern(searchEdit->text()); 254 QString st = searchEdit->text();
255 if ( st.right(1) != "*")
256 st += "*";
257 re.setPattern(st);
252 if (re.isValid()) { 258 if (re.isValid()) {
253 search(re); 259 search(re);
254 } else { 260 } else {
255 mMatchedEvents.clear(); 261 mMatchedEvents.clear();
256 mMatchedTodos.clear(); 262 mMatchedTodos.clear();
257 mMatchedJournals.clear(); 263 mMatchedJournals.clear();
258 } 264 }
259 listView->setStartDate( mStartDate->date() ); 265 listView->setStartDate( mStartDate->date() );
260 listView->showEvents(mMatchedEvents); 266 listView->showEvents(mMatchedEvents);
261 listView->addTodos(mMatchedTodos); 267 listView->addTodos(mMatchedTodos);
262 listView->addJournals(mMatchedJournals); 268 listView->addJournals(mMatchedJournals);
263} 269}
264 270
265void SearchDialog::search(const QRegExp &re) 271void SearchDialog::search(const QRegExp &re)
266{ 272{
267 QPtrList<Event> events = mCalendar->events( mStartDate->date(), 273 QPtrList<Event> events = mCalendar->events( mStartDate->date(),
268 mEndDate->date(), 274 mEndDate->date(),
269 false /*mInclusiveCheck->isChecked()*/ ); 275 false /*mInclusiveCheck->isChecked()*/ );
270 276
271 mMatchedEvents.clear(); 277 mMatchedEvents.clear();
272 if ( mSearchEvent->isChecked() ) { 278 if ( mSearchEvent->isChecked() ) {
273 Event *ev; 279 Event *ev;
274 for(ev=events.first();ev;ev=events.next()) { 280 for(ev=events.first();ev;ev=events.next()) {
275 if (mSummaryCheck->isChecked()) { 281 if (mSummaryCheck->isChecked()) {
276#if QT_VERSION >= 0x030000 282#if QT_VERSION >= 0x030000
277 if (re.search(ev->summary()) != -1) 283 if (re.search(ev->summary()) != -1)
278#else 284#else
279 if (re.match(ev->summary()) != -1) 285 if (re.match(ev->summary()) != -1)
280#endif 286#endif
281 { 287 {
282 mMatchedEvents.append(ev); 288 mMatchedEvents.append(ev);
283 continue; 289 continue;
284 } 290 }
285#if QT_VERSION >= 0x030000 291#if QT_VERSION >= 0x030000
286 if (re.search(ev->location()) != -1) 292 if (re.search(ev->location()) != -1)
287#else 293#else
288 if (re.match(ev->location()) != -1) 294 if (re.match(ev->location()) != -1)
289#endif 295#endif
290 { 296 {
291 mMatchedEvents.append(ev); 297 mMatchedEvents.append(ev);
292 continue; 298 continue;
293 } 299 }
294 } 300 }
295 if (mDescriptionCheck->isChecked()) { 301 if (mDescriptionCheck->isChecked()) {
296#if QT_VERSION >= 0x030000 302#if QT_VERSION >= 0x030000
297 if (re.search(ev->description()) != -1) 303 if (re.search(ev->description()) != -1)
298#else 304#else
299 if (re.match(ev->description()) != -1) 305 if (re.match(ev->description()) != -1)
300#endif 306#endif
301 { 307 {
302 mMatchedEvents.append(ev); 308 mMatchedEvents.append(ev);
303 continue; 309 continue;
304 } 310 }
305 } 311 }
306 if (mCategoryCheck->isChecked()) { 312 if (mCategoryCheck->isChecked()) {
307#if QT_VERSION >= 0x030000 313#if QT_VERSION >= 0x030000
308 if (re.search(ev->categoriesStr()) != -1) 314 if (re.search(ev->categoriesStr()) != -1)
309#else 315#else
310 if (re.match(ev->categoriesStr()) != -1) 316 if (re.match(ev->categoriesStr()) != -1)
311#endif 317#endif
312 { 318 {
313 mMatchedEvents.append(ev); 319 mMatchedEvents.append(ev);
314 continue; 320 continue;
315 } 321 }
316 } 322 }
317 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 323 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
318 QPtrList<Attendee> tmpAList = ev->attendees(); 324 QPtrList<Attendee> tmpAList = ev->attendees();
319 Attendee *a; 325 Attendee *a;
320 for (a = tmpAList.first(); a; a = tmpAList.next()) { 326 for (a = tmpAList.first(); a; a = tmpAList.next()) {
321 if (mSearchAName->isChecked()) { 327 if (mSearchAName->isChecked()) {
322#if QT_VERSION >= 0x030000 328#if QT_VERSION >= 0x030000
323 if (re.search(a->name()) != -1) 329 if (re.search(a->name()) != -1)
324#else 330#else
325 if (re.match(a->name()) != -1) 331 if (re.match(a->name()) != -1)
326#endif 332#endif
327 { 333 {
328 mMatchedEvents.append(ev); 334 mMatchedEvents.append(ev);
329 break; 335 break;
330 } 336 }
331 } 337 }
332 if (mSearchAEmail->isChecked()) { 338 if (mSearchAEmail->isChecked()) {
333#if QT_VERSION >= 0x030000 339#if QT_VERSION >= 0x030000
334 if (re.search(a->email()) != -1) 340 if (re.search(a->email()) != -1)
335#else 341#else
336 if (re.match(a->email()) != -1) 342 if (re.match(a->email()) != -1)
337#endif 343#endif
338 { 344 {
339 mMatchedEvents.append(ev); 345 mMatchedEvents.append(ev);
340 break; 346 break;
341 } 347 }
342 } 348 }
343 } 349 }
344 } 350 }
345 } 351 }
346 } 352 }
347 QPtrList<Todo> todos = mCalendar->todos( ); 353 QPtrList<Todo> todos = mCalendar->todos( );
348 mMatchedTodos.clear(); 354 mMatchedTodos.clear();
349 if ( mSearchTodo->isChecked() ) { 355 if ( mSearchTodo->isChecked() ) {
350 Todo *tod; 356 Todo *tod;
351 for(tod=todos.first();tod;tod=todos.next()) { 357 for(tod=todos.first();tod;tod=todos.next()) {
352 if (mSummaryCheck->isChecked()) { 358 if (mSummaryCheck->isChecked()) {
353#if QT_VERSION >= 0x030000 359#if QT_VERSION >= 0x030000
354 if (re.search(tod->summary()) != -1) 360 if (re.search(tod->summary()) != -1)
355#else 361#else
356 if (re.match(tod->summary()) != -1) 362 if (re.match(tod->summary()) != -1)
357#endif 363#endif
358 { 364 {
359 mMatchedTodos.append(tod); 365 mMatchedTodos.append(tod);
360 continue; 366 continue;
361 } 367 }
362 } 368 }
363 if (mDescriptionCheck->isChecked()) { 369 if (mDescriptionCheck->isChecked()) {
364#if QT_VERSION >= 0x030000 370#if QT_VERSION >= 0x030000
365 if (re.search(tod->description()) != -1) 371 if (re.search(tod->description()) != -1)
366#else 372#else
367 if (re.match(tod->description()) != -1) 373 if (re.match(tod->description()) != -1)
368#endif 374#endif
369 { 375 {
370 mMatchedTodos.append(tod); 376 mMatchedTodos.append(tod);
371 continue; 377 continue;
372 } 378 }
373 } 379 }
374 if (mCategoryCheck->isChecked()) { 380 if (mCategoryCheck->isChecked()) {
375#if QT_VERSION >= 0x030000 381#if QT_VERSION >= 0x030000
376 if (re.search(tod->categoriesStr()) != -1) 382 if (re.search(tod->categoriesStr()) != -1)
377#else 383#else
378 if (re.match(tod->categoriesStr()) != -1) 384 if (re.match(tod->categoriesStr()) != -1)
379#endif 385#endif
380 { 386 {
381 mMatchedTodos.append(tod); 387 mMatchedTodos.append(tod);
382 continue; 388 continue;
383 } 389 }
384 } 390 }
385 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 391 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
386 QPtrList<Attendee> tmpAList = tod->attendees(); 392 QPtrList<Attendee> tmpAList = tod->attendees();
387 Attendee *a; 393 Attendee *a;
388 for (a = tmpAList.first(); a; a = tmpAList.next()) { 394 for (a = tmpAList.first(); a; a = tmpAList.next()) {
389 if (mSearchAName->isChecked()) { 395 if (mSearchAName->isChecked()) {
390#if QT_VERSION >= 0x030000 396#if QT_VERSION >= 0x030000
391 if (re.search(a->name()) != -1) 397 if (re.search(a->name()) != -1)
392#else 398#else
393 if (re.match(a->name()) != -1) 399 if (re.match(a->name()) != -1)
394#endif 400#endif
395 { 401 {
396 mMatchedTodos.append(tod); 402 mMatchedTodos.append(tod);
397 break; 403 break;
398 } 404 }
399 } 405 }
400 if (mSearchAEmail->isChecked()) { 406 if (mSearchAEmail->isChecked()) {
401#if QT_VERSION >= 0x030000 407#if QT_VERSION >= 0x030000
402 if (re.search(a->email()) != -1) 408 if (re.search(a->email()) != -1)
403#else 409#else
404 if (re.match(a->email()) != -1) 410 if (re.match(a->email()) != -1)
405#endif 411#endif
406 { 412 {
407 mMatchedTodos.append(tod); 413 mMatchedTodos.append(tod);
408 break; 414 break;
409 } 415 }
410 } 416 }
411 } 417 }
412 } 418 }
413 } 419 }
414 } 420 }
415 mMatchedJournals.clear(); 421 mMatchedJournals.clear();
416 if (mSearchJournal->isChecked() ) { 422 if (mSearchJournal->isChecked() ) {
417 QPtrList<Journal> journals = mCalendar->journals( ); 423 QPtrList<Journal> journals = mCalendar->journals( );
418 Journal* journ; 424 Journal* journ;
419 425
420 for(journ=journals.first();journ;journ=journals.next()) { 426 for(journ=journals.first();journ;journ=journals.next()) {
421 if ( journ->dtStart().date() <= mEndDate->date() 427 if ( journ->dtStart().date() <= mEndDate->date()
422 &&journ->dtStart().date() >= mStartDate->date()) { 428 &&journ->dtStart().date() >= mStartDate->date()) {
423#if QT_VERSION >= 0x030000 429#if QT_VERSION >= 0x030000
424 if (re.search(journ->description()) != -1) 430 if (re.search(journ->description()) != -1)
425#else 431#else
426 if (re.match(journ->description()) != -1) 432 if (re.match(journ->description()) != -1)
427#endif 433#endif
428 { 434 {
429 mMatchedJournals.append(journ); 435 mMatchedJournals.append(journ);
430 continue; 436 continue;
431 } 437 }
432 } 438 }
433 } 439 }
434 } 440 }
435 441
436} 442}
437 443
438void SearchDialog::keyPressEvent ( QKeyEvent *e) 444void SearchDialog::keyPressEvent ( QKeyEvent *e)
439{ 445{
440 switch ( e->key() ) { 446 switch ( e->key() ) {
441 case Qt::Key_Escape: 447 case Qt::Key_Escape:
442 hide(); 448 hide();
443 break; 449 break;
444 case Qt::Key_F: 450 case Qt::Key_F:
445 if ( e->state() == Qt::ControlButton ) { 451 if ( e->state() == Qt::ControlButton ) {
446 qDebug("full "); 452 qDebug("full ");
447 453
448 } 454 }
449 break; 455 break;
450 case Qt::Key_Return: 456 case Qt::Key_Return:
451 case Qt::Key_Enter: 457 case Qt::Key_Enter:
452 doSearch(); 458 doSearch();
453 break; 459 break;
454 460
455 default: 461 default:
456 e->ignore(); 462 e->ignore();
457 } 463 }
458} 464}
459 465
460//mMatchedJournals; 466//mMatchedJournals;