author | zautrix <zautrix> | 2005-04-17 17:29:12 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-17 17:29:12 (UTC) |
commit | e3e76014e70643b0828f30f5c5277e212495d37c (patch) (unidiff) | |
tree | 6c1b65d08bbecf7f5d83db636cebe3425b1521e8 /korganizer | |
parent | 70b45fe97813c4fd336b7ca8fdedab13f9c2e039 (diff) | |
download | kdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.zip kdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.tar.gz kdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.tar.bz2 |
fixes
-rw-r--r-- | korganizer/kolistview.cpp | 13 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 3 |
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 | |||
@@ -2,262 +2,264 @@ | |||
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 | ||
70 | class KOListViewWhatsThis :public QWhatsThis | 70 | class KOListViewWhatsThis :public QWhatsThis |
71 | { | 71 | { |
72 | public: | 72 | public: |
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 | ||
75 | protected: | 75 | protected: |
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 | } |
80 | private: | 80 | private: |
81 | QWidget* _wid; | 81 | QWidget* _wid; |
82 | KOListView * _view; | 82 | KOListView * _view; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | 85 | ||
86 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 86 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
87 | { | 87 | { |
88 | mItem = item; | 88 | mItem = item; |
89 | mDate = date; | 89 | mDate = date; |
90 | } | 90 | } |
91 | 91 | ||
92 | ListItemVisitor::~ListItemVisitor() | 92 | ListItemVisitor::~ListItemVisitor() |
93 | { | 93 | { |
94 | } | 94 | } |
95 | 95 | ||
96 | bool ListItemVisitor::visit(Event *e) | 96 | bool 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 | ||
146 | bool ListItemVisitor::visit(Todo *t) | 146 | bool 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 | ||
199 | bool ListItemVisitor::visit(Journal * j) | 201 | bool 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 | ||
226 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 228 | KOListView::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); |
@@ -787,234 +789,235 @@ QPtrList<Incidence> KOListView::selectedIncidences() | |||
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 | ||
794 | DateList KOListView::selectedDates() | 796 | DateList KOListView::selectedDates() |
795 | { | 797 | { |
796 | DateList eventList; | 798 | DateList eventList; |
797 | return eventList; | 799 | return eventList; |
798 | } | 800 | } |
799 | 801 | ||
800 | void KOListView::showDates(bool show) | 802 | void 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 | ||
819 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 821 | void 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 | ||
827 | void KOListView::showDates() | 829 | void KOListView::showDates() |
828 | { | 830 | { |
829 | showDates(true); | 831 | showDates(true); |
830 | } | 832 | } |
831 | 833 | ||
832 | void KOListView::hideDates() | 834 | void KOListView::hideDates() |
833 | { | 835 | { |
834 | showDates(false); | 836 | showDates(false); |
835 | } | 837 | } |
836 | 838 | ||
837 | void KOListView::resetFocus() | 839 | void KOListView::resetFocus() |
838 | { | 840 | { |
839 | topLevelWidget()->setActiveWindow(); | 841 | topLevelWidget()->setActiveWindow(); |
840 | topLevelWidget()->raise(); | 842 | topLevelWidget()->raise(); |
841 | mListView->setFocus(); | 843 | mListView->setFocus(); |
842 | } | 844 | } |
843 | void KOListView::updateView() | 845 | void 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 | } |
849 | void KOListView::updateConfig() | 851 | void 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 | } |
856 | void KOListView::setStartDate(const QDate &start) | 858 | void KOListView::setStartDate(const QDate &start) |
857 | { | 859 | { |
858 | mStartDate = start; | 860 | mStartDate = start; |
859 | } | 861 | } |
860 | 862 | ||
861 | void KOListView::showDates(const QDate &start, const QDate &end) | 863 | void 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 | ||
881 | void KOListView::addEvents(QPtrList<Event> eventList) | 883 | void 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 | ||
892 | void KOListView::addTodos(QPtrList<Todo> eventList) | 895 | void 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 | } |
902 | void KOListView::addJournals(QPtrList<Journal> eventList) | 905 | void 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 | ||
913 | void KOListView::addIncidence(Incidence *incidence) | 916 | void 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 | ||
927 | void KOListView::showEvents(QPtrList<Event> eventList) | 930 | void 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 | } |
936 | int KOListView::count() | 939 | int KOListView::count() |
937 | { | 940 | { |
938 | return mListView->childCount(); | 941 | return mListView->childCount(); |
939 | } | 942 | } |
940 | 943 | ||
941 | void KOListView::changeEventDisplay(Event *event, int action) | 944 | void 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 | ||
969 | KOListViewItem *KOListView::getItemForEvent(Event *event) | 972 | KOListViewItem *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 | ||
979 | void KOListView::defaultItemAction(QListViewItem *i) | 982 | void 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 | ||
986 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) | 989 | void 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 | ||
1002 | void KOListView::readSettings(KConfig *config, QString setting) | 1005 | void 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 | ||
1008 | void KOListView::writeSettings(KConfig *config, QString setting) | 1011 | void 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 | ||
1014 | void KOListView::processSelectionChange(QListViewItem *) | 1017 | void 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 ) { |
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index de65b53..007d1f3 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -130,200 +130,197 @@ SearchDialog::~SearchDialog() | |||
130 | 130 | ||
131 | } | 131 | } |
132 | void SearchDialog::raiseAndSelect() | 132 | void 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 | } |
175 | void SearchDialog::setFocusToList() | 175 | void SearchDialog::setFocusToList() |
176 | { | 176 | { |
177 | listView->resetFocus(); | 177 | listView->resetFocus(); |
178 | } | 178 | } |
179 | void SearchDialog::accept() | 179 | void SearchDialog::accept() |
180 | { | 180 | { |
181 | doSearch(); | 181 | doSearch(); |
182 | } | 182 | } |
183 | void SearchDialog::updateList() | 183 | void 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 | } |
196 | void SearchDialog::searchTextChanged( const QString &_text ) | 196 | void 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 | ||
203 | void SearchDialog::doSearch() | 203 | void 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 | } |
244 | void SearchDialog::updateConfig() | 241 | void SearchDialog::updateConfig() |
245 | { | 242 | { |
246 | listView->updateConfig(); | 243 | listView->updateConfig(); |
247 | } | 244 | } |
248 | void SearchDialog::updateView() | 245 | void 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 | ||
271 | void SearchDialog::search(const QRegExp &re) | 268 | void 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) |