summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-17 17:29:12 (UTC)
committer zautrix <zautrix>2005-04-17 17:29:12 (UTC)
commite3e76014e70643b0828f30f5c5277e212495d37c (patch) (unidiff)
tree6c1b65d08bbecf7f5d83db636cebe3425b1521e8 /korganizer
parent70b45fe97813c4fd336b7ca8fdedab13f9c2e039 (diff)
downloadkdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.zip
kdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.tar.gz
kdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.tar.bz2
fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp13
-rw-r--r--korganizer/searchdialog.cpp3
2 files changed, 8 insertions, 8 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index e1b393d..a1bf9ff 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1,359 +1,361 @@
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
99 bool ok = false; 98 bool ok = false;
100 QString start, end; 99 QString start, end;
101 QDate ds, de; 100 QDate ds, de;
102 if ( e->doesRecur() ) { 101 if ( e->doesRecur() ) {
103 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 102 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
104 if ( ok ) { 103 if ( ok ) {
105 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 104 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
106 start = KGlobal::locale()->formatDate(ds,true); 105 start = KGlobal::locale()->formatDate(ds,true);
107 de = ds.addDays( days); 106 de = ds.addDays( days);
108 end = KGlobal::locale()->formatDate(de,true); 107 end = KGlobal::locale()->formatDate(de,true);
109 } 108 }
110 109
111 } 110 }
112 if ( ! ok ) { 111 if ( ! ok ) {
113 start =e->dtStartDateStr(); 112 start =e->dtStartDateStr();
114 end = e->dtEndDateStr(); 113 end = e->dtEndDateStr();
115 ds = e->dtStart().date(); 114 ds = e->dtStart().date();
116 de = e->dtEnd().date(); 115 de = e->dtEnd().date();
117 } 116 }
118 mItem->setText(0,e->summary()); 117 mItem->setText(0,e->summary());
119 mItem->setText(1,start); 118 mItem->setText(1,start);
120 mItem->setText(2,e->dtStartTimeStr()); 119 mItem->setText(2,e->dtStartTimeStr());
121 mItem->setText(3,end); 120 mItem->setText(3,end);
122 mItem->setText(4,e->dtEndTimeStr()); 121 mItem->setText(4,e->dtEndTimeStr());
123 if ( e->isAlarmEnabled() ) { 122 if ( e->isAlarmEnabled() ) {
124 mItem->setText(5,e->alarms().first()->offsetText() ); 123 mItem->setText(5,e->alarms().first()->offsetText() );
125 } else { 124 } else {
126 mItem->setText(5, i18n("No")); 125 mItem->setText(5, i18n("No"));
127 } 126 }
128 mItem->setText(6, e->recurrence()->recurrenceText()); 127 mItem->setText(6, e->recurrence()->recurrenceText());
128 if( ! e->doesRecur() )
129 mItem->setSortKey( 6, "-" );
129 mItem->setText(7,"---"); 130 mItem->setText(7,"---");
130 mItem->setText(8,"---"); 131 mItem->setText(8,"---");
131 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 132 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
132 mItem->setText(10,e->categoriesStr()); 133 mItem->setText(10,e->categoriesStr());
133 134
134 QString key; 135 QString key;
135 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 136 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()); 137 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
137 mItem->setSortKey(1,key); 138 mItem->setSortKey(1,key);
138 139
139 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 140 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()); 141 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
141 mItem->setSortKey(3,key); 142 mItem->setSortKey(3,key);
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->doesRecur() )
169 mItem->setSortKey( 6, "-" );
168 if (t->hasDueDate()) { 170 if (t->hasDueDate()) {
169 mItem->setText(7,t->dtDueDateStr()); 171 mItem->setText(7,t->dtDueDateStr());
170 if (t->doesFloat()) { 172 if (t->doesFloat()) {
171 mItem->setText(8,"---"); 173 mItem->setText(8,"---");
172 } else { 174 } else {
173 mItem->setText(8,t->dtDueTimeStr()); 175 mItem->setText(8,t->dtDueTimeStr());
174 } 176 }
175 } else { 177 } else {
176 mItem->setText(7,"---"); 178 mItem->setText(7,"---");
177 mItem->setText(8,"---"); 179 mItem->setText(8,"---");
178 } 180 }
179 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 181 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
180 mItem->setText(10,t->categoriesStr()); 182 mItem->setText(10,t->categoriesStr());
181 183
182 QString key; 184 QString key;
183 QDate d; 185 QDate d;
184 if (t->hasDueDate()) { 186 if (t->hasDueDate()) {
185 d = t->dtDue().date(); 187 d = t->dtDue().date();
186 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 188 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()); 189 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
188 mItem->setSortKey(7,key); 190 mItem->setSortKey(7,key);
189 } 191 }
190 if ( t->hasStartDate() ) { 192 if ( t->hasStartDate() ) {
191 d = t->dtStart().date(); 193 d = t->dtStart().date();
192 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 194 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()); 195 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
194 mItem->setSortKey(1,key); 196 mItem->setSortKey(1,key);
195 } 197 }
196 return true; 198 return true;
197} 199}
198 200
199bool ListItemVisitor::visit(Journal * j) 201bool ListItemVisitor::visit(Journal * j)
200{ 202{
201 QString des = j->description().left(30); 203 QString des = j->description().left(30);
202 des = des.simplifyWhiteSpace (); 204 des = des.simplifyWhiteSpace ();
203 des.replace (QRegExp ("\\n"),"" ); 205 des.replace (QRegExp ("\\n"),"" );
204 des.replace (QRegExp ("\\r"),"" ); 206 des.replace (QRegExp ("\\r"),"" );
205 mItem->setText(0,i18n("Journal: ")+des.left(25)); 207 mItem->setText(0,i18n("Journal: ")+des.left(25));
206 mItem->setText(1,j->dtStartDateStr()); 208 mItem->setText(1,j->dtStartDateStr());
207 mItem->setText(2,"---"); 209 mItem->setText(2,"---");
208 mItem->setText(3,"---"); 210 mItem->setText(3,"---");
209 mItem->setText(4,"---"); 211 mItem->setText(4,"---");
210 mItem->setText(5,"---"); 212 mItem->setText(5,"---");
211 mItem->setText(6,"---"); 213 mItem->setText(6,"---");
212 mItem->setText(7,j->dtStartDateStr()); 214 mItem->setText(7,j->dtStartDateStr());
213 mItem->setText(8,"---"); 215 mItem->setText(8,"---");
214 mItem->setText(9,"---"); 216 mItem->setText(9,"---");
215 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 217 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
216 218
217 QString key; 219 QString key;
218 QDate d = j->dtStart().date(); 220 QDate d = j->dtStart().date();
219 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 221 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
220 mItem->setSortKey(1,key); 222 mItem->setSortKey(1,key);
221 mItem->setSortKey(7,key); 223 mItem->setSortKey(7,key);
222 224
223 return true; 225 return true;
224} 226}
225 227
226KOListView::KOListView(Calendar *calendar, QWidget *parent, 228KOListView::KOListView(Calendar *calendar, QWidget *parent,
227 const char *name) 229 const char *name)
228 : KOEventView(calendar, parent, name) 230 : KOEventView(calendar, parent, name)
229{ 231{
230 mActiveItem = 0; 232 mActiveItem = 0;
231 mListView = new KOListViewListView(this); 233 mListView = new KOListViewListView(this);
232 mListView->addColumn(i18n("Summary")); 234 mListView->addColumn(i18n("Summary"));
233 mListView->addColumn(i18n("Start Date")); 235 mListView->addColumn(i18n("Start Date"));
234 mListView->addColumn(i18n("Start Time")); 236 mListView->addColumn(i18n("Start Time"));
235 mListView->addColumn(i18n("End Date")); 237 mListView->addColumn(i18n("End Date"));
236 mListView->addColumn(i18n("End Time")); 238 mListView->addColumn(i18n("End Time"));
237 mListView->addColumn(i18n("Alarm")); // alarm set? 239 mListView->addColumn(i18n("Alarm")); // alarm set?
238 mListView->addColumn(i18n("Recurs")); // recurs? 240 mListView->addColumn(i18n("Recurs")); // recurs?
239 mListView->addColumn(i18n("Due Date")); 241 mListView->addColumn(i18n("Due Date"));
240 mListView->addColumn(i18n("Due Time")); 242 mListView->addColumn(i18n("Due Time"));
241 mListView->addColumn(i18n("Cancelled")); 243 mListView->addColumn(i18n("Cancelled"));
242 mListView->addColumn(i18n("Categories")); 244 mListView->addColumn(i18n("Categories"));
243 245
244 mListView->setColumnAlignment(0,AlignLeft); 246 mListView->setColumnAlignment(0,AlignLeft);
245 mListView->setColumnAlignment(1,AlignLeft); 247 mListView->setColumnAlignment(1,AlignLeft);
246 mListView->setColumnAlignment(2,AlignHCenter); 248 mListView->setColumnAlignment(2,AlignHCenter);
247 mListView->setColumnAlignment(3,AlignLeft); 249 mListView->setColumnAlignment(3,AlignLeft);
248 mListView->setColumnAlignment(4,AlignHCenter); 250 mListView->setColumnAlignment(4,AlignHCenter);
249 mListView->setColumnAlignment(5,AlignLeft); 251 mListView->setColumnAlignment(5,AlignLeft);
250 mListView->setColumnAlignment(6,AlignLeft); 252 mListView->setColumnAlignment(6,AlignLeft);
251 mListView->setColumnAlignment(7,AlignLeft); 253 mListView->setColumnAlignment(7,AlignLeft);
252 mListView->setColumnAlignment(8,AlignLeft); 254 mListView->setColumnAlignment(8,AlignLeft);
253 mListView->setColumnAlignment(9,AlignLeft); 255 mListView->setColumnAlignment(9,AlignLeft);
254 mListView->setColumnAlignment(10,AlignLeft); 256 mListView->setColumnAlignment(10,AlignLeft);
255 mListView->setColumnWidthMode(10, QListView::Manual); 257 mListView->setColumnWidthMode(10, QListView::Manual);
256 new KOListViewWhatsThis(mListView->viewport(),this); 258 new KOListViewWhatsThis(mListView->viewport(),this);
257 259
258 int iii = 0; 260 int iii = 0;
259 for ( iii = 0; iii< 10 ; ++iii ) 261 for ( iii = 0; iii< 10 ; ++iii )
260 mListView->setColumnWidthMode( iii, QListView::Manual ); 262 mListView->setColumnWidthMode( iii, QListView::Manual );
261 263
262 QBoxLayout *layoutTop = new QVBoxLayout(this); 264 QBoxLayout *layoutTop = new QVBoxLayout(this);
263 layoutTop->addWidget(mListView); 265 layoutTop->addWidget(mListView);
264 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 266 mListView->setFont ( KOPrefs::instance()->mListViewFont );
265 mPopupMenu = eventPopup(); 267 mPopupMenu = eventPopup();
266 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 268 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
267 i18n("Select all"),this, 269 i18n("Select all"),this,
268 SLOT(allSelection()),true); 270 SLOT(allSelection()),true);
269 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 271 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
270 i18n("Deselect all"),this, 272 i18n("Deselect all"),this,
271 SLOT(clearSelection()),true); 273 SLOT(clearSelection()),true);
272 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 274 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
273 i18n("Delete all selected"),this, 275 i18n("Delete all selected"),this,
274 SLOT(deleteAll()),true); 276 SLOT(deleteAll()),true);
275 mPopupMenu->insertSeparator(); 277 mPopupMenu->insertSeparator();
276 QPopupMenu * exportPO = new QPopupMenu ( this ); 278 QPopupMenu * exportPO = new QPopupMenu ( this );
277 mPopupMenu->insertItem( i18n("Export selected"), exportPO ); 279 mPopupMenu->insertItem( i18n("Export selected"), exportPO );
278 exportPO->insertItem( i18n("As iCal (ics) file..."),this, 280 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
279 SLOT(saveToFile())); 281 SLOT(saveToFile()));
280 exportPO->insertItem( i18n("As vCal (vcs) file..."),this, 282 exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
281 SLOT(saveToFileVCS())); 283 SLOT(saveToFileVCS()));
282 exportPO->insertItem( i18n("Journal/Details..."),this, 284 exportPO->insertItem( i18n("Journal/Details..."),this,
283 SLOT(saveDescriptionToFile())); 285 SLOT(saveDescriptionToFile()));
284 // mPopupMenu->insertSeparator(); 286 // mPopupMenu->insertSeparator();
285 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 287 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
286 i18n("Add Categ. to selected..."),this, 288 i18n("Add Categ. to selected..."),this,
287 SLOT(addCat()),true); 289 SLOT(addCat()),true);
288 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 290 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
289 i18n("Set Categ. for selected..."),this, 291 i18n("Set Categ. for selected..."),this,
290 SLOT(setCat()),true); 292 SLOT(setCat()),true);
291 //mPopupMenu->insertSeparator(); 293 //mPopupMenu->insertSeparator();
292 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 294 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
293 i18n("Set alarm for selected..."),this, 295 i18n("Set alarm for selected..."),this,
294 SLOT(setAlarm()),true); 296 SLOT(setAlarm()),true);
295 297
296 298
297#ifndef DESKTOP_VERSION 299#ifndef DESKTOP_VERSION
298 mPopupMenu->insertSeparator(); 300 mPopupMenu->insertSeparator();
299 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 301 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
300 i18n("Beam selected via IR"),this, 302 i18n("Beam selected via IR"),this,
301 SLOT(beamSelected()),true); 303 SLOT(beamSelected()),true);
302#endif 304#endif
303 /* 305 /*
304 mPopupMenu = new QPopupMenu; 306 mPopupMenu = new QPopupMenu;
305 mPopupMenu->insertItem(i18n("Edit Event"), this, 307 mPopupMenu->insertItem(i18n("Edit Event"), this,
306 SLOT (editEvent())); 308 SLOT (editEvent()));
307 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 309 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
308 SLOT (deleteEvent())); 310 SLOT (deleteEvent()));
309 mPopupMenu->insertSeparator(); 311 mPopupMenu->insertSeparator();
310 mPopupMenu->insertItem(i18n("Show Dates"), this, 312 mPopupMenu->insertItem(i18n("Show Dates"), this,
311 SLOT(showDates())); 313 SLOT(showDates()));
312 mPopupMenu->insertItem(i18n("Hide Dates"), this, 314 mPopupMenu->insertItem(i18n("Hide Dates"), this,
313 SLOT(hideDates())); 315 SLOT(hideDates()));
314 */ 316 */
315 QObject::connect(mListView,SIGNAL( newEvent()), 317 QObject::connect(mListView,SIGNAL( newEvent()),
316 this,SIGNAL(signalNewEvent())); 318 this,SIGNAL(signalNewEvent()));
317 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 319 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
318 this,SLOT(defaultItemAction(QListViewItem *))); 320 this,SLOT(defaultItemAction(QListViewItem *)));
319 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, 321 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
320 const QPoint &, int )), 322 const QPoint &, int )),
321 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 323 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
322 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 324 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
323 SLOT(processSelectionChange(QListViewItem *))); 325 SLOT(processSelectionChange(QListViewItem *)));
324 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 326 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
325 SIGNAL(showIncidenceSignal(Incidence *)) ); 327 SIGNAL(showIncidenceSignal(Incidence *)) );
326 328
327 readSettings(KOGlobals::config(),"KOListView Layout"); 329 readSettings(KOGlobals::config(),"KOListView Layout");
328} 330}
329 331
330KOListView::~KOListView() 332KOListView::~KOListView()
331{ 333{
332 delete mPopupMenu; 334 delete mPopupMenu;
333} 335}
334 336
335QString KOListView::getWhatsThisText(QPoint p) 337QString KOListView::getWhatsThisText(QPoint p)
336{ 338{
337 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 339 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
338 if ( item ) 340 if ( item )
339 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 341 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
340 KOPrefs::instance()->mWTshowDetails, 342 KOPrefs::instance()->mWTshowDetails,
341 KOPrefs::instance()->mWTshowCreated, 343 KOPrefs::instance()->mWTshowCreated,
342 KOPrefs::instance()->mWTshowChanged); 344 KOPrefs::instance()->mWTshowChanged);
343 return i18n("That is the list view" ); 345 return i18n("That is the list view" );
344 346
345} 347}
346 348
347void KOListView::updateList() 349void KOListView::updateList()
348{ 350{
349 // qDebug(" KOListView::updateList() "); 351 // qDebug(" KOListView::updateList() ");
350 352
351} 353}
352 354
353void KOListView::addCat( ) 355void KOListView::addCat( )
354{ 356{
355 setCategories( false ); 357 setCategories( false );
356} 358}
357void KOListView::setCat() 359void KOListView::setCat()
358{ 360{
359 setCategories( true ); 361 setCategories( true );
@@ -691,426 +693,427 @@ void KOListView::writeToFile( bool iCal )
691 } 693 }
692 if ( iCal ) { 694 if ( iCal ) {
693 ICalFormat format; 695 ICalFormat format;
694 format.save( &cal, fn ); 696 format.save( &cal, fn );
695 } else { 697 } else {
696 698
697 VCalFormat format; 699 VCalFormat format;
698 format.save( &cal, fn ); 700 format.save( &cal, fn );
699 } 701 }
700 mes = i18n("KO/Pi:Saved %1").arg(fn ); 702 mes = i18n("KO/Pi:Saved %1").arg(fn );
701 KOPrefs::instance()->mLastSaveFile = fn; 703 KOPrefs::instance()->mLastSaveFile = fn;
702 topLevelWidget()->setCaption(mes); 704 topLevelWidget()->setCaption(mes);
703 } 705 }
704 } 706 }
705 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 707 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
706} 708}
707void KOListView::deleteAll() 709void KOListView::deleteAll()
708{ 710{
709 int icount = 0; 711 int icount = 0;
710 QPtrList<Incidence> delSel ; 712 QPtrList<Incidence> delSel ;
711 QListViewItem *item = mListView->firstChild (); 713 QListViewItem *item = mListView->firstChild ();
712 while ( item ) { 714 while ( item ) {
713 if ( item->isSelected() ) { 715 if ( item->isSelected() ) {
714 delSel.append(((KOListViewItem *)item)->data()); 716 delSel.append(((KOListViewItem *)item)->data());
715 ++icount; 717 ++icount;
716 } 718 }
717 719
718 item = item->nextSibling(); 720 item = item->nextSibling();
719 } 721 }
720 if ( icount ) { 722 if ( icount ) {
721 Incidence *incidence = delSel.first(); 723 Incidence *incidence = delSel.first();
722 Incidence *toDelete; 724 Incidence *toDelete;
723 KOPrefs *p = KOPrefs::instance(); 725 KOPrefs *p = KOPrefs::instance();
724 bool confirm = p->mConfirm; 726 bool confirm = p->mConfirm;
725 QString mess; 727 QString mess;
726 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); 728 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
727 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")) ) { 729 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")) ) {
728 p->mConfirm = false; 730 p->mConfirm = false;
729 int delCounter = 0; 731 int delCounter = 0;
730 QDialog dia ( this, "p-dialog", true ); 732 QDialog dia ( this, "p-dialog", true );
731 QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); 733 QLabel lab (i18n("Close dialog to abort deletion!"), &dia );
732 QVBoxLayout lay( &dia ); 734 QVBoxLayout lay( &dia );
733 lay.setMargin(7); 735 lay.setMargin(7);
734 lay.setSpacing(7); 736 lay.setSpacing(7);
735 lay.addWidget( &lab); 737 lay.addWidget( &lab);
736 QProgressBar bar( icount, &dia ); 738 QProgressBar bar( icount, &dia );
737 lay.addWidget( &bar); 739 lay.addWidget( &bar);
738 int w = 220; 740 int w = 220;
739 int h = 50; 741 int h = 50;
740 int dw = QApplication::desktop()->width(); 742 int dw = QApplication::desktop()->width();
741 int dh = QApplication::desktop()->height(); 743 int dh = QApplication::desktop()->height();
742 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 744 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
743 //dia.resize( 240,50 ); 745 //dia.resize( 240,50 );
744 dia.show(); 746 dia.show();
745 747
746 while ( incidence ) { 748 while ( incidence ) {
747 bar.setProgress( delCounter ); 749 bar.setProgress( delCounter );
748 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); 750 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter );
749 dia.setCaption( mess ); 751 dia.setCaption( mess );
750 qApp->processEvents(); 752 qApp->processEvents();
751 toDelete = (incidence); 753 toDelete = (incidence);
752 incidence = delSel.next(); 754 incidence = delSel.next();
753 emit deleteIncidenceSignal(toDelete ); 755 emit deleteIncidenceSignal(toDelete );
754 if ( dia.result() != 0 ) 756 if ( dia.result() != 0 )
755 break; 757 break;
756 758
757 } 759 }
758 mess = mess.sprintf( i18n("%d items remaining in list."), count() ); 760 mess = mess.sprintf( i18n("%d items remaining in list."), count() );
759 topLevelWidget ()->setCaption( mess ); 761 topLevelWidget ()->setCaption( mess );
760 p->mConfirm = confirm; 762 p->mConfirm = confirm;
761 } 763 }
762 } 764 }
763 765
764 766
765} 767}
766int KOListView::maxDatesHint() 768int KOListView::maxDatesHint()
767{ 769{
768 return 0; 770 return 0;
769} 771}
770 772
771int KOListView::currentDateCount() 773int KOListView::currentDateCount()
772{ 774{
773 return 0; 775 return 0;
774} 776}
775 777
776QPtrList<Incidence> KOListView::selectedIncidences() 778QPtrList<Incidence> KOListView::selectedIncidences()
777{ 779{
778 QPtrList<Incidence> eventList; 780 QPtrList<Incidence> eventList;
779 QListViewItem *item = mListView->firstChild (); 781 QListViewItem *item = mListView->firstChild ();
780 while ( item ) { 782 while ( item ) {
781 if ( item->isSelected() ) { 783 if ( item->isSelected() ) {
782 eventList.append(((KOListViewItem *)item)->data()); 784 eventList.append(((KOListViewItem *)item)->data());
783 } 785 }
784 786
785 item = item->nextSibling(); 787 item = item->nextSibling();
786 } 788 }
787 789
788 // // QListViewItem *item = mListView->selectedItem(); 790 // // QListViewItem *item = mListView->selectedItem();
789 //if (item) eventList.append(((KOListViewItem *)item)->data()); 791 //if (item) eventList.append(((KOListViewItem *)item)->data());
790 792
791 return eventList; 793 return eventList;
792} 794}
793 795
794DateList KOListView::selectedDates() 796DateList KOListView::selectedDates()
795{ 797{
796 DateList eventList; 798 DateList eventList;
797 return eventList; 799 return eventList;
798} 800}
799 801
800void KOListView::showDates(bool show) 802void KOListView::showDates(bool show)
801{ 803{
802 // Shouldn't we set it to a value greater 0? When showDates is called with 804 // Shouldn't we set it to a value greater 0? When showDates is called with
803 // show == true at first, then the columnwidths are set to zero. 805 // show == true at first, then the columnwidths are set to zero.
804 static int oldColWidth1 = 0; 806 static int oldColWidth1 = 0;
805 static int oldColWidth3 = 0; 807 static int oldColWidth3 = 0;
806 808
807 if (!show) { 809 if (!show) {
808 oldColWidth1 = mListView->columnWidth(1); 810 oldColWidth1 = mListView->columnWidth(1);
809 oldColWidth3 = mListView->columnWidth(3); 811 oldColWidth3 = mListView->columnWidth(3);
810 mListView->setColumnWidth(1, 0); 812 mListView->setColumnWidth(1, 0);
811 mListView->setColumnWidth(3, 0); 813 mListView->setColumnWidth(3, 0);
812 } else { 814 } else {
813 mListView->setColumnWidth(1, oldColWidth1); 815 mListView->setColumnWidth(1, oldColWidth1);
814 mListView->setColumnWidth(3, oldColWidth3); 816 mListView->setColumnWidth(3, oldColWidth3);
815 } 817 }
816 mListView->repaint(); 818 mListView->repaint();
817} 819}
818 820
819void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, 821void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd,
820 const QDate &td) 822 const QDate &td)
821{ 823{
822#ifndef KORG_NOPRINTER 824#ifndef KORG_NOPRINTER
823 calPrinter->preview(CalPrinter::Day, fd, td); 825 calPrinter->preview(CalPrinter::Day, fd, td);
824#endif 826#endif
825} 827}
826 828
827void KOListView::showDates() 829void KOListView::showDates()
828{ 830{
829 showDates(true); 831 showDates(true);
830} 832}
831 833
832void KOListView::hideDates() 834void KOListView::hideDates()
833{ 835{
834 showDates(false); 836 showDates(false);
835} 837}
836 838
837void KOListView::resetFocus() 839void KOListView::resetFocus()
838{ 840{
839 topLevelWidget()->setActiveWindow(); 841 topLevelWidget()->setActiveWindow();
840 topLevelWidget()->raise(); 842 topLevelWidget()->raise();
841 mListView->setFocus(); 843 mListView->setFocus();
842} 844}
843void KOListView::updateView() 845void KOListView::updateView()
844{ 846{
845 mListView->setFocus(); 847 mListView->setFocus();
846 if ( mListView->firstChild () ) 848 if ( mListView->firstChild () )
847 mListView->setCurrentItem( mListView->firstChild () ); 849 mListView->setCurrentItem( mListView->firstChild () );
848} 850}
849void KOListView::updateConfig() 851void KOListView::updateConfig()
850{ 852{
851 853
852 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 854 mListView->setFont ( KOPrefs::instance()->mListViewFont );
853 updateView(); 855 updateView();
854 856
855} 857}
856void KOListView::setStartDate(const QDate &start) 858void KOListView::setStartDate(const QDate &start)
857{ 859{
858 mStartDate = start; 860 mStartDate = start;
859} 861}
860 862
861void KOListView::showDates(const QDate &start, const QDate &end) 863void KOListView::showDates(const QDate &start, const QDate &end)
862{ 864{
863 clear(); 865 clear();
864 mStartDate = start; 866 mStartDate = start;
865 QDate date = start; 867 QDate date = start;
866 QPtrList<Journal> j_list; 868 QPtrList<Journal> j_list;
867 while( date <= end ) { 869 while( date <= end ) {
868 addEvents(calendar()->events(date)); 870 addEvents(calendar()->events(date));
869 addTodos(calendar()->todos(date)); 871 addTodos(calendar()->todos(date));
870 Journal* jo = calendar()->journal(date); 872 Journal* jo = calendar()->journal(date);
871 if ( jo ) 873 if ( jo )
872 j_list.append( jo ); 874 j_list.append( jo );
873 date = date.addDays( 1 ); 875 date = date.addDays( 1 );
874 } 876 }
875 addJournals(j_list); 877 addJournals(j_list);
876 emit incidenceSelected( 0 ); 878 emit incidenceSelected( 0 );
877 updateView(); 879 updateView();
878 880
879} 881}
880 882
881void KOListView::addEvents(QPtrList<Event> eventList) 883void KOListView::addEvents(QPtrList<Event> eventList)
882{ 884{
885
883 Event *ev; 886 Event *ev;
884 for(ev = eventList.first(); ev; ev = eventList.next()) { 887 for(ev = eventList.first(); ev; ev = eventList.next()) {
885 addIncidence(ev); 888 addIncidence(ev);
886 } 889 }
887 if ( !mListView->currentItem() ){ 890 if ( !mListView->currentItem() ){
888 updateView(); 891 updateView();
889 } 892 }
890} 893}
891 894
892void KOListView::addTodos(QPtrList<Todo> eventList) 895void KOListView::addTodos(QPtrList<Todo> eventList)
893{ 896{
894 Todo *ev; 897 Todo *ev;
895 for(ev = eventList.first(); ev; ev = eventList.next()) { 898 for(ev = eventList.first(); ev; ev = eventList.next()) {
896 addIncidence(ev); 899 addIncidence(ev);
897 } 900 }
898 if ( !mListView->currentItem() ){ 901 if ( !mListView->currentItem() ){
899 updateView(); 902 updateView();
900 } 903 }
901} 904}
902void KOListView::addJournals(QPtrList<Journal> eventList) 905void KOListView::addJournals(QPtrList<Journal> eventList)
903{ 906{
904 Journal *ev; 907 Journal *ev;
905 for(ev = eventList.first(); ev; ev = eventList.next()) { 908 for(ev = eventList.first(); ev; ev = eventList.next()) {
906 addIncidence(ev); 909 addIncidence(ev);
907 } 910 }
908 if ( !mListView->currentItem() ){ 911 if ( !mListView->currentItem() ){
909 updateView(); 912 updateView();
910 } 913 }
911} 914}
912 915
913void KOListView::addIncidence(Incidence *incidence) 916void KOListView::addIncidence(Incidence *incidence)
914{ 917{
915 if ( mUidDict.find( incidence->uid() ) ) return; 918 if ( mUidDict.find( incidence->uid() ) ) return;
916 919
917 // mListView->setFont ( KOPrefs::instance()->mListViewFont ); 920 // mListView->setFont ( KOPrefs::instance()->mListViewFont );
918 mUidDict.insert( incidence->uid(), incidence ); 921 mUidDict.insert( incidence->uid(), incidence );
919
920 KOListViewItem *item = new KOListViewItem( incidence, mListView ); 922 KOListViewItem *item = new KOListViewItem( incidence, mListView );
921 ListItemVisitor v(item, mStartDate ); 923 ListItemVisitor v(item, mStartDate );
922 if (incidence->accept(v)) return; 924 if (incidence->accept(v)) {
925 return;
926 }
923 else delete item; 927 else delete item;
924 //qDebug("delete item ");
925} 928}
926 929
927void KOListView::showEvents(QPtrList<Event> eventList) 930void KOListView::showEvents(QPtrList<Event> eventList)
928{ 931{
929 clear(); 932 clear();
930 933
931 addEvents(eventList); 934 addEvents(eventList);
932 935
933 // After new creation of list view no events are selected. 936 // After new creation of list view no events are selected.
934 emit incidenceSelected( 0 ); 937 emit incidenceSelected( 0 );
935} 938}
936int KOListView::count() 939int KOListView::count()
937{ 940{
938 return mListView->childCount(); 941 return mListView->childCount();
939} 942}
940 943
941void KOListView::changeEventDisplay(Event *event, int action) 944void KOListView::changeEventDisplay(Event *event, int action)
942{ 945{
943 KOListViewItem *item; 946 KOListViewItem *item;
944 947
945 switch(action) { 948 switch(action) {
946 case KOGlobals::EVENTADDED: 949 case KOGlobals::EVENTADDED:
947 addIncidence( event ); 950 addIncidence( event );
948 break; 951 break;
949 case KOGlobals::EVENTEDITED: 952 case KOGlobals::EVENTEDITED:
950 item = getItemForEvent(event); 953 item = getItemForEvent(event);
951 if (item) { 954 if (item) {
952 mUidDict.remove( event->uid() ); 955 mUidDict.remove( event->uid() );
953 delete item; 956 delete item;
954 addIncidence( event ); 957 addIncidence( event );
955 } 958 }
956 break; 959 break;
957 case KOGlobals::EVENTDELETED: 960 case KOGlobals::EVENTDELETED:
958 item = getItemForEvent(event); 961 item = getItemForEvent(event);
959 if (item) { 962 if (item) {
960 mUidDict.remove( event->uid() ); 963 mUidDict.remove( event->uid() );
961 delete item; 964 delete item;
962 } 965 }
963 break; 966 break;
964 default: 967 default:
965 ; 968 ;
966 } 969 }
967} 970}
968 971
969KOListViewItem *KOListView::getItemForEvent(Event *event) 972KOListViewItem *KOListView::getItemForEvent(Event *event)
970{ 973{
971 KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); 974 KOListViewItem *item = (KOListViewItem *)mListView->firstChild();
972 while (item) { 975 while (item) {
973 if (item->data() == event) return item; 976 if (item->data() == event) return item;
974 item = (KOListViewItem *)item->nextSibling(); 977 item = (KOListViewItem *)item->nextSibling();
975 } 978 }
976 return 0; 979 return 0;
977} 980}
978 981
979void KOListView::defaultItemAction(QListViewItem *i) 982void KOListView::defaultItemAction(QListViewItem *i)
980{ 983{
981 KOListViewItem *item = static_cast<KOListViewItem *>( i ); 984 KOListViewItem *item = static_cast<KOListViewItem *>( i );
982 if ( item ) defaultAction( item->data() ); 985 if ( item ) defaultAction( item->data() );
983 986
984} 987}
985 988
986void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) 989void KOListView::popupMenu(QListViewItem *item,const QPoint &,int)
987{ 990{
988 mActiveItem = (KOListViewItem *)item; 991 mActiveItem = (KOListViewItem *)item;
989 if (mActiveItem) { 992 if (mActiveItem) {
990 Incidence *incidence = mActiveItem->data(); 993 Incidence *incidence = mActiveItem->data();
991 mPopupMenu->showIncidencePopup(incidence); 994 mPopupMenu->showIncidencePopup(incidence);
992 995
993 /* 996 /*
994 if ( incidence && incidence->type() == "Event" ) { 997 if ( incidence && incidence->type() == "Event" ) {
995 Event *event = static_cast<Event *>( incidence ); 998 Event *event = static_cast<Event *>( incidence );
996 mPopupMenu->showEventPopup(event); 999 mPopupMenu->showEventPopup(event);
997 } 1000 }
998 */ 1001 */
999 } 1002 }
1000} 1003}
1001 1004
1002void KOListView::readSettings(KConfig *config, QString setting) 1005void KOListView::readSettings(KConfig *config, QString setting)
1003{ 1006{
1004 // qDebug("KOListView::readSettings "); 1007 // qDebug("KOListView::readSettings ");
1005 mListView->restoreLayout(config,setting); 1008 mListView->restoreLayout(config,setting);
1006} 1009}
1007 1010
1008void KOListView::writeSettings(KConfig *config, QString setting) 1011void KOListView::writeSettings(KConfig *config, QString setting)
1009{ 1012{
1010 // qDebug("KOListView::writeSettings "); 1013 // qDebug("KOListView::writeSettings ");
1011 mListView->saveLayout(config, setting); 1014 mListView->saveLayout(config, setting);
1012} 1015}
1013 1016
1014void KOListView::processSelectionChange(QListViewItem *) 1017void KOListView::processSelectionChange(QListViewItem *)
1015{ 1018{
1016 1019
1017 KOListViewItem *item = 1020 KOListViewItem *item =
1018 static_cast<KOListViewItem *>( mListView->currentItem() ); 1021 static_cast<KOListViewItem *>( mListView->currentItem() );
1019 1022
1020 if ( !item ) { 1023 if ( !item ) {
1021 emit incidenceSelected( 0 ); 1024 emit incidenceSelected( 0 );
1022 } else { 1025 } else {
1023 emit incidenceSelected( item->data() ); 1026 emit incidenceSelected( item->data() );
1024 } 1027 }
1025} 1028}
1026 1029
1027void KOListView::clearSelection() 1030void KOListView::clearSelection()
1028{ 1031{
1029 mListView->selectAll( false ); 1032 mListView->selectAll( false );
1030} 1033}
1031void KOListView::allSelection() 1034void KOListView::allSelection()
1032{ 1035{
1033 mListView->selectAll( true ); 1036 mListView->selectAll( true );
1034} 1037}
1035 1038
1036void KOListView::clear() 1039void KOListView::clear()
1037{ 1040{
1038 mListView->clear(); 1041 mListView->clear();
1039 mUidDict.clear(); 1042 mUidDict.clear();
1040} 1043}
1041 1044
1042Incidence* KOListView::currentItem() 1045Incidence* KOListView::currentItem()
1043{ 1046{
1044 if ( mListView->currentItem() ) 1047 if ( mListView->currentItem() )
1045 return ((KOListViewItem*) mListView->currentItem())->data(); 1048 return ((KOListViewItem*) mListView->currentItem())->data();
1046 return 0; 1049 return 0;
1047} 1050}
1048void KOListView::keyPressEvent ( QKeyEvent *e) 1051void KOListView::keyPressEvent ( QKeyEvent *e)
1049{ 1052{
1050 1053
1051 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { 1054 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) {
1052 deleteAll(); 1055 deleteAll();
1053 return; 1056 return;
1054 } 1057 }
1055 1058
1056 e->ignore(); 1059 e->ignore();
1057} 1060}
1058void KOListViewListView::keyPressEvent ( QKeyEvent *e) 1061void KOListViewListView::keyPressEvent ( QKeyEvent *e)
1059{ 1062{
1060 1063
1061 switch ( e->key() ) { 1064 switch ( e->key() ) {
1062 case Qt::Key_Down: 1065 case Qt::Key_Down:
1063 if ( e->state() == ShiftButton ) { 1066 if ( e->state() == ShiftButton ) {
1064 QListViewItem* cn = currentItem(); 1067 QListViewItem* cn = currentItem();
1065 if ( !cn ) 1068 if ( !cn )
1066 cn = firstChild(); 1069 cn = firstChild();
1067 if ( !cn ) 1070 if ( !cn )
1068 return; 1071 return;
1069 while ( cn->nextSibling() ) 1072 while ( cn->nextSibling() )
1070 cn = cn->nextSibling(); 1073 cn = cn->nextSibling();
1071 setCurrentItem ( cn ); 1074 setCurrentItem ( cn );
1072 ensureItemVisible ( cn ); 1075 ensureItemVisible ( cn );
1073 1076
1074 e->accept(); 1077 e->accept();
1075 return; 1078 return;
1076 } 1079 }
1077 if ( e->state() == ControlButton ) { 1080 if ( e->state() == ControlButton ) {
1078 int count = childCount (); 1081 int count = childCount ();
1079 int jump = count / 5; 1082 int jump = count / 5;
1080 QListViewItem* cn; 1083 QListViewItem* cn;
1081 cn = currentItem(); 1084 cn = currentItem();
1082 if ( ! cn ) 1085 if ( ! cn )
1083 return; 1086 return;
1084 if ( jump == 0 ) 1087 if ( jump == 0 )
1085 jump = 1; 1088 jump = 1;
1086 while ( jump && cn->nextSibling() ) { 1089 while ( jump && cn->nextSibling() ) {
1087 cn = cn->nextSibling(); 1090 cn = cn->nextSibling();
1088 --jump; 1091 --jump;
1089 } 1092 }
1090 setCurrentItem ( cn ); 1093 setCurrentItem ( cn );
1091 ensureItemVisible ( cn ); 1094 ensureItemVisible ( cn );
1092 1095
1093 } else 1096 } else
1094 QListView::keyPressEvent ( e ) ; 1097 QListView::keyPressEvent ( e ) ;
1095 e->accept(); 1098 e->accept();
1096 break; 1099 break;
1097 1100
1098 case Qt::Key_Up: 1101 case Qt::Key_Up:
1099 if ( e->state() == ShiftButton ) { 1102 if ( e->state() == ShiftButton ) {
1100 QListViewItem* cn = firstChild(); 1103 QListViewItem* cn = firstChild();
1101 if ( cn ) { 1104 if ( cn ) {
1102 setCurrentItem ( cn ); 1105 setCurrentItem ( cn );
1103 ensureItemVisible ( cn ); 1106 ensureItemVisible ( cn );
1104 } 1107 }
1105 e->accept(); 1108 e->accept();
1106 return; 1109 return;
1107 } 1110 }
1108 if ( e->state() == ControlButton ) { 1111 if ( e->state() == ControlButton ) {
1109 int count = childCount (); 1112 int count = childCount ();
1110 int jump = count / 5; 1113 int jump = count / 5;
1111 QListViewItem* cn; 1114 QListViewItem* cn;
1112 cn = currentItem(); 1115 cn = currentItem();
1113 if ( ! cn ) 1116 if ( ! cn )
1114 return; 1117 return;
1115 if ( jump == 0 ) 1118 if ( jump == 0 )
1116 jump = 1; 1119 jump = 1;
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index de65b53..007d1f3 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -34,392 +34,389 @@
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 QString st = searchEdit->text(); 209 QString st = searchEdit->text();
210 if ( st.right(1) != "*") 210 if ( st.right(1) != "*")
211 st += "*"; 211 st += "*";
212 re.setPattern(st); 212 re.setPattern(st);
213 if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { 213 if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) {
214 KMessageBox::sorry(this, 214 KMessageBox::sorry(this,
215 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"));
216 return; 216 return;
217 } 217 }
218 if (!re.isValid() ) { 218 if (!re.isValid() ) {
219 KMessageBox::sorry(this, 219 KMessageBox::sorry(this,
220 i18n("Invalid search expression,\ncannot perform " 220 i18n("Invalid search expression,\ncannot perform "
221 "the search.\nPlease enter a search expression\n" 221 "the search.\nPlease enter a search expression\n"
222 "using the wildcard characters\n '*' and '?'" 222 "using the wildcard characters\n '*' and '?'"
223 "where needed.")); 223 "where needed."));
224 return; 224 return;
225 } 225 }
226
227 search(re); 226 search(re);
228
229 listView->setStartDate( mStartDate->date() ); 227 listView->setStartDate( mStartDate->date() );
230 listView->showEvents(mMatchedEvents); 228 listView->showEvents(mMatchedEvents);
231 listView->addTodos(mMatchedTodos); 229 listView->addTodos(mMatchedTodos);
232 listView->addJournals(mMatchedJournals); 230 listView->addJournals(mMatchedJournals);
233
234 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { 231 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) {
235 setCaption(i18n("No items found. Use '*' and '?' where needed.")); 232 setCaption(i18n("No items found. Use '*' and '?' where needed."));
236 } else { 233 } else {
237 QString mess; 234 QString mess;
238 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); 235 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() );
239 setCaption( i18n("KO/Pi Find: ") + mess); 236 setCaption( i18n("KO/Pi Find: ") + mess);
240 237
241 } 238 }
242 searchEdit->setFocus(); 239 searchEdit->setFocus();
243} 240}
244void SearchDialog::updateConfig() 241void SearchDialog::updateConfig()
245{ 242{
246 listView->updateConfig(); 243 listView->updateConfig();
247} 244}
248void SearchDialog::updateView() 245void SearchDialog::updateView()
249{ 246{
250 //qDebug("SearchDialog::updateView() %d ", isVisible()); 247 //qDebug("SearchDialog::updateView() %d ", isVisible());
251 QRegExp re; 248 QRegExp re;
252 re.setWildcard(true); // most people understand these better. 249 re.setWildcard(true); // most people understand these better.
253 re.setCaseSensitive(false); 250 re.setCaseSensitive(false);
254 QString st = searchEdit->text(); 251 QString st = searchEdit->text();
255 if ( st.right(1) != "*") 252 if ( st.right(1) != "*")
256 st += "*"; 253 st += "*";
257 re.setPattern(st); 254 re.setPattern(st);
258 if (re.isValid()) { 255 if (re.isValid()) {
259 search(re); 256 search(re);
260 } else { 257 } else {
261 mMatchedEvents.clear(); 258 mMatchedEvents.clear();
262 mMatchedTodos.clear(); 259 mMatchedTodos.clear();
263 mMatchedJournals.clear(); 260 mMatchedJournals.clear();
264 } 261 }
265 listView->setStartDate( mStartDate->date() ); 262 listView->setStartDate( mStartDate->date() );
266 listView->showEvents(mMatchedEvents); 263 listView->showEvents(mMatchedEvents);
267 listView->addTodos(mMatchedTodos); 264 listView->addTodos(mMatchedTodos);
268 listView->addJournals(mMatchedJournals); 265 listView->addJournals(mMatchedJournals);
269} 266}
270 267
271void SearchDialog::search(const QRegExp &re) 268void SearchDialog::search(const QRegExp &re)
272{ 269{
273 QPtrList<Event> events = mCalendar->events( mStartDate->date(), 270 QPtrList<Event> events = mCalendar->events( mStartDate->date(),
274 mEndDate->date(), 271 mEndDate->date(),
275 false /*mInclusiveCheck->isChecked()*/ ); 272 false /*mInclusiveCheck->isChecked()*/ );
276 273
277 mMatchedEvents.clear(); 274 mMatchedEvents.clear();
278 if ( mSearchEvent->isChecked() ) { 275 if ( mSearchEvent->isChecked() ) {
279 Event *ev; 276 Event *ev;
280 for(ev=events.first();ev;ev=events.next()) { 277 for(ev=events.first();ev;ev=events.next()) {
281 if (mSummaryCheck->isChecked()) { 278 if (mSummaryCheck->isChecked()) {
282#if QT_VERSION >= 0x030000 279#if QT_VERSION >= 0x030000
283 if (re.search(ev->summary()) != -1) 280 if (re.search(ev->summary()) != -1)
284#else 281#else
285 if (re.match(ev->summary()) != -1) 282 if (re.match(ev->summary()) != -1)
286#endif 283#endif
287 { 284 {
288 mMatchedEvents.append(ev); 285 mMatchedEvents.append(ev);
289 continue; 286 continue;
290 } 287 }
291#if QT_VERSION >= 0x030000 288#if QT_VERSION >= 0x030000
292 if (re.search(ev->location()) != -1) 289 if (re.search(ev->location()) != -1)
293#else 290#else
294 if (re.match(ev->location()) != -1) 291 if (re.match(ev->location()) != -1)
295#endif 292#endif
296 { 293 {
297 mMatchedEvents.append(ev); 294 mMatchedEvents.append(ev);
298 continue; 295 continue;
299 } 296 }
300 } 297 }
301 if (mDescriptionCheck->isChecked()) { 298 if (mDescriptionCheck->isChecked()) {
302#if QT_VERSION >= 0x030000 299#if QT_VERSION >= 0x030000
303 if (re.search(ev->description()) != -1) 300 if (re.search(ev->description()) != -1)
304#else 301#else
305 if (re.match(ev->description()) != -1) 302 if (re.match(ev->description()) != -1)
306#endif 303#endif
307 { 304 {
308 mMatchedEvents.append(ev); 305 mMatchedEvents.append(ev);
309 continue; 306 continue;
310 } 307 }
311 } 308 }
312 if (mCategoryCheck->isChecked()) { 309 if (mCategoryCheck->isChecked()) {
313#if QT_VERSION >= 0x030000 310#if QT_VERSION >= 0x030000
314 if (re.search(ev->categoriesStr()) != -1) 311 if (re.search(ev->categoriesStr()) != -1)
315#else 312#else
316 if (re.match(ev->categoriesStr()) != -1) 313 if (re.match(ev->categoriesStr()) != -1)
317#endif 314#endif
318 { 315 {
319 mMatchedEvents.append(ev); 316 mMatchedEvents.append(ev);
320 continue; 317 continue;
321 } 318 }
322 } 319 }
323 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 320 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
324 QPtrList<Attendee> tmpAList = ev->attendees(); 321 QPtrList<Attendee> tmpAList = ev->attendees();
325 Attendee *a; 322 Attendee *a;
326 for (a = tmpAList.first(); a; a = tmpAList.next()) { 323 for (a = tmpAList.first(); a; a = tmpAList.next()) {
327 if (mSearchAName->isChecked()) { 324 if (mSearchAName->isChecked()) {
328#if QT_VERSION >= 0x030000 325#if QT_VERSION >= 0x030000
329 if (re.search(a->name()) != -1) 326 if (re.search(a->name()) != -1)
330#else 327#else
331 if (re.match(a->name()) != -1) 328 if (re.match(a->name()) != -1)
332#endif 329#endif
333 { 330 {
334 mMatchedEvents.append(ev); 331 mMatchedEvents.append(ev);
335 break; 332 break;
336 } 333 }
337 } 334 }
338 if (mSearchAEmail->isChecked()) { 335 if (mSearchAEmail->isChecked()) {
339#if QT_VERSION >= 0x030000 336#if QT_VERSION >= 0x030000
340 if (re.search(a->email()) != -1) 337 if (re.search(a->email()) != -1)
341#else 338#else
342 if (re.match(a->email()) != -1) 339 if (re.match(a->email()) != -1)
343#endif 340#endif
344 { 341 {
345 mMatchedEvents.append(ev); 342 mMatchedEvents.append(ev);
346 break; 343 break;
347 } 344 }
348 } 345 }
349 } 346 }
350 } 347 }
351 } 348 }
352 } 349 }
353 QPtrList<Todo> todos = mCalendar->todos( ); 350 QPtrList<Todo> todos = mCalendar->todos( );
354 mMatchedTodos.clear(); 351 mMatchedTodos.clear();
355 if ( mSearchTodo->isChecked() ) { 352 if ( mSearchTodo->isChecked() ) {
356 Todo *tod; 353 Todo *tod;
357 for(tod=todos.first();tod;tod=todos.next()) { 354 for(tod=todos.first();tod;tod=todos.next()) {
358 if (mSummaryCheck->isChecked()) { 355 if (mSummaryCheck->isChecked()) {
359#if QT_VERSION >= 0x030000 356#if QT_VERSION >= 0x030000
360 if (re.search(tod->summary()) != -1) 357 if (re.search(tod->summary()) != -1)
361#else 358#else
362 if (re.match(tod->summary()) != -1) 359 if (re.match(tod->summary()) != -1)
363#endif 360#endif
364 { 361 {
365 mMatchedTodos.append(tod); 362 mMatchedTodos.append(tod);
366 continue; 363 continue;
367 } 364 }
368 } 365 }
369 if (mDescriptionCheck->isChecked()) { 366 if (mDescriptionCheck->isChecked()) {
370#if QT_VERSION >= 0x030000 367#if QT_VERSION >= 0x030000
371 if (re.search(tod->description()) != -1) 368 if (re.search(tod->description()) != -1)
372#else 369#else
373 if (re.match(tod->description()) != -1) 370 if (re.match(tod->description()) != -1)
374#endif 371#endif
375 { 372 {
376 mMatchedTodos.append(tod); 373 mMatchedTodos.append(tod);
377 continue; 374 continue;
378 } 375 }
379 } 376 }
380 if (mCategoryCheck->isChecked()) { 377 if (mCategoryCheck->isChecked()) {
381#if QT_VERSION >= 0x030000 378#if QT_VERSION >= 0x030000
382 if (re.search(tod->categoriesStr()) != -1) 379 if (re.search(tod->categoriesStr()) != -1)
383#else 380#else
384 if (re.match(tod->categoriesStr()) != -1) 381 if (re.match(tod->categoriesStr()) != -1)
385#endif 382#endif
386 { 383 {
387 mMatchedTodos.append(tod); 384 mMatchedTodos.append(tod);
388 continue; 385 continue;
389 } 386 }
390 } 387 }
391 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 388 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
392 QPtrList<Attendee> tmpAList = tod->attendees(); 389 QPtrList<Attendee> tmpAList = tod->attendees();
393 Attendee *a; 390 Attendee *a;
394 for (a = tmpAList.first(); a; a = tmpAList.next()) { 391 for (a = tmpAList.first(); a; a = tmpAList.next()) {
395 if (mSearchAName->isChecked()) { 392 if (mSearchAName->isChecked()) {
396#if QT_VERSION >= 0x030000 393#if QT_VERSION >= 0x030000
397 if (re.search(a->name()) != -1) 394 if (re.search(a->name()) != -1)
398#else 395#else
399 if (re.match(a->name()) != -1) 396 if (re.match(a->name()) != -1)
400#endif 397#endif
401 { 398 {
402 mMatchedTodos.append(tod); 399 mMatchedTodos.append(tod);
403 break; 400 break;
404 } 401 }
405 } 402 }
406 if (mSearchAEmail->isChecked()) { 403 if (mSearchAEmail->isChecked()) {
407#if QT_VERSION >= 0x030000 404#if QT_VERSION >= 0x030000
408 if (re.search(a->email()) != -1) 405 if (re.search(a->email()) != -1)
409#else 406#else
410 if (re.match(a->email()) != -1) 407 if (re.match(a->email()) != -1)
411#endif 408#endif
412 { 409 {
413 mMatchedTodos.append(tod); 410 mMatchedTodos.append(tod);
414 break; 411 break;
415 } 412 }
416 } 413 }
417 } 414 }
418 } 415 }
419 } 416 }
420 } 417 }
421 mMatchedJournals.clear(); 418 mMatchedJournals.clear();
422 if (mSearchJournal->isChecked() ) { 419 if (mSearchJournal->isChecked() ) {
423 QPtrList<Journal> journals = mCalendar->journals( ); 420 QPtrList<Journal> journals = mCalendar->journals( );
424 Journal* journ; 421 Journal* journ;
425 422