summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-25 02:44:17 (UTC)
committer zautrix <zautrix>2005-06-25 02:44:17 (UTC)
commitdcc7c9ed932ec2ef521aa04b929d0319f65c8bdc (patch) (unidiff)
treef61360b8f883a6e5fe007c5a24cd35d7cc29ffc0
parent1d0b53abc70e66708d93b7081a21a7689b1a1303 (diff)
downloadkdepimpi-dcc7c9ed932ec2ef521aa04b929d0319f65c8bdc.zip
kdepimpi-dcc7c9ed932ec2ef521aa04b929d0319f65c8bdc.tar.gz
kdepimpi-dcc7c9ed932ec2ef521aa04b929d0319f65c8bdc.tar.bz2
serach fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/searchdialog.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 2390520..0e9f64c 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -80,439 +80,437 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
80 mSubItems->setFont( fo ); 80 mSubItems->setFont( fo );
81 mRefineItems->setFont( fo ); 81 mRefineItems->setFont( fo );
82 connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool ))); 82 connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool )));
83 connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool ))); 83 connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool )));
84 connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); 84 connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool )));
85 85
86 QPushButton *togButton = new QPushButton( "", topFrame ); 86 QPushButton *togButton = new QPushButton( "", topFrame );
87 subLayout->addWidget(togButton); 87 subLayout->addWidget(togButton);
88 connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); 88 connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes()));
89 togButton->setPixmap(SmallIcon("1updownarrow")); 89 togButton->setPixmap(SmallIcon("1updownarrow"));
90 togButton->setMinimumWidth( togButton->sizeHint().height() ); 90 togButton->setMinimumWidth( togButton->sizeHint().height() );
91 91
92 searchEdit->setText("*"); // Find all events by default 92 searchEdit->setText("*"); // Find all events by default
93 searchEdit->setFocus(); 93 searchEdit->setFocus();
94 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); 94 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & )));
95 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); 95 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch()));
96 // Subjects to search 96 // Subjects to search
97 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), 97 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"),
98 // topFrame); 98 // topFrame);
99 99
100 incidenceGroup = new QHBox( topFrame ); 100 incidenceGroup = new QHBox( topFrame );
101 layout->addWidget(incidenceGroup); 101 layout->addWidget(incidenceGroup);
102 102
103 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); 103 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup);
104 //mSearchEvent->setChecked(true); 104 //mSearchEvent->setChecked(true);
105 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); 105 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup);
106 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); 106 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup);
107 107
108 subjectGroup = new QHBox( topFrame ); 108 subjectGroup = new QHBox( topFrame );
109 layout->addWidget(subjectGroup); 109 layout->addWidget(subjectGroup);
110 110
111 mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); 111 mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup);
112 mSummaryCheck->setChecked(true); 112 mSummaryCheck->setChecked(true);
113 mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); 113 mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup);
114 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); 114 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup);
115 115
116 attendeeGroup = new QHBox( topFrame ); 116 attendeeGroup = new QHBox( topFrame );
117 layout->addWidget(attendeeGroup ); 117 layout->addWidget(attendeeGroup );
118 new QLabel( i18n("Attendee:"),attendeeGroup ); 118 new QLabel( i18n("Attendee:"),attendeeGroup );
119 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); 119 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup );
120 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); 120 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup );
121 // Date range 121 // Date range
122 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), 122 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"),
123 // topFrame); 123 // topFrame);
124 // layout->addWidget(rangeGroup); 124 // layout->addWidget(rangeGroup);
125 125
126 QWidget *rangeWidget = new QWidget(topFrame); 126 QWidget *rangeWidget = new QWidget(topFrame);
127 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); 127 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint());
128 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); 128 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget));
129 mStartDate = new KDateEdit(rangeWidget); 129 mStartDate = new KDateEdit(rangeWidget);
130 rangeLayout->addWidget(mStartDate); 130 rangeLayout->addWidget(mStartDate);
131 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); 131 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget));
132 mEndDate = new KDateEdit(rangeWidget); 132 mEndDate = new KDateEdit(rangeWidget);
133 mEndDate->setDate(QDate::currentDate().addDays(365)); 133 mEndDate->setDate(QDate::currentDate().addDays(365));
134 rangeLayout->addWidget(mEndDate); 134 rangeLayout->addWidget(mEndDate);
135 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); 135 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget );
136 rangeLayout->addWidget( (QWidget*)wt ); 136 rangeLayout->addWidget( (QWidget*)wt );
137 layout->addWidget(rangeWidget); 137 layout->addWidget(rangeWidget);
138 // Results list view 138 // Results list view
139 listView = new KOListView(mCalendar,topFrame); 139 listView = new KOListView(mCalendar,topFrame);
140 layout->addWidget(listView); 140 layout->addWidget(listView);
141 listView->showCompletedTodos(); 141 listView->showCompletedTodos();
142 //layout->setStretchFactor( listView, 333 ); 142 //layout->setStretchFactor( listView, 333 );
143 //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); 143 //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) );
144 //listView->setMaximumHeight( 50 ); 144 //listView->setMaximumHeight( 50 );
145 listView->readSettings(KOGlobals::config(),"SearchListView Layout"); 145 listView->readSettings(KOGlobals::config(),"SearchListView Layout");
146 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); 146 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList()));
147 147
148 setCaption( i18n("KO/Pi Find: ")); 148 setCaption( i18n("KO/Pi Find: "));
149#ifdef DESKTOP_VERSION 149#ifdef DESKTOP_VERSION
150 OkButton = new QPushButton( i18n("Close"), this ); 150 OkButton = new QPushButton( i18n("Close"), this );
151 connect(OkButton,SIGNAL(clicked()),SLOT(hide())); 151 connect(OkButton,SIGNAL(clicked()),SLOT(hide()));
152#endif 152#endif
153} 153}
154 154
155SearchDialog::~SearchDialog() 155SearchDialog::~SearchDialog()
156{ 156{
157 157
158} 158}
159void SearchDialog::slot_add( bool b ) 159void SearchDialog::slot_add( bool b )
160{ 160{
161 if ( b ) { 161 if ( b ) {
162 if ( mSubItems->isOn() ) mSubItems->toggle(); 162 if ( mSubItems->isOn() ) mSubItems->toggle();
163 if ( mRefineItems->isOn() ) mRefineItems->toggle(); 163 if ( mRefineItems->isOn() ) mRefineItems->toggle();
164 setCaption( i18n("Matching items will be added to list")); 164 setCaption( i18n("Matching items will be added to list"));
165 } else 165 } else
166 setCaption( i18n("List will be cleared before search")); 166 setCaption( i18n("List will be cleared before search"));
167} 167}
168void SearchDialog::slot_sub( bool b) 168void SearchDialog::slot_sub( bool b)
169{ 169{
170 if ( b ) { 170 if ( b ) {
171 if ( mRefineItems->isOn() ) mRefineItems->toggle(); 171 if ( mRefineItems->isOn() ) mRefineItems->toggle();
172 if ( mAddItems->isOn() ) mAddItems->toggle(); 172 if ( mAddItems->isOn() ) mAddItems->toggle();
173 setCaption( i18n("Matching items will be removed from list")); 173 setCaption( i18n("Matching items will be removed from list"));
174 } else 174 } else
175 setCaption( i18n("List will be cleared before search")); 175 setCaption( i18n("List will be cleared before search"));
176} 176}
177void SearchDialog::slot_refine( bool b) 177void SearchDialog::slot_refine( bool b)
178{ 178{
179 if ( b ) { 179 if ( b ) {
180 if ( mSubItems->isOn() ) mSubItems->toggle(); 180 if ( mSubItems->isOn() ) mSubItems->toggle();
181 if ( mAddItems->isOn() ) mAddItems->toggle(); 181 if ( mAddItems->isOn() ) mAddItems->toggle();
182 setCaption( i18n("Search on displayed list only")); 182 setCaption( i18n("Search on displayed list only"));
183 } else 183 } else
184 setCaption( i18n("List will be cleared before search")); 184 setCaption( i18n("List will be cleared before search"));
185} 185}
186void SearchDialog::toggleCheckboxes() 186void SearchDialog::toggleCheckboxes()
187{ 187{
188 if ( incidenceGroup->isVisible() ) { 188 if ( incidenceGroup->isVisible() ) {
189 incidenceGroup->hide() ; 189 incidenceGroup->hide() ;
190 subjectGroup->hide() ; 190 subjectGroup->hide() ;
191 attendeeGroup->hide() ; 191 attendeeGroup->hide() ;
192 } else { 192 } else {
193 incidenceGroup->show() ; 193 incidenceGroup->show() ;
194 subjectGroup->show() ; 194 subjectGroup->show() ;
195 attendeeGroup->show() ; 195 attendeeGroup->show() ;
196 } 196 }
197} 197}
198void SearchDialog::raiseAndSelect() 198void SearchDialog::raiseAndSelect()
199{ 199{
200 200
201 static int currentState = 0; 201 static int currentState = 0;
202 202
203 if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) 203 if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() )
204 currentState = 0; 204 currentState = 0;
205 int newState = 0; 205 int newState = 0;
206 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { 206 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
207 newState = VIEW_J_VIEW; 207 newState = VIEW_J_VIEW;
208 } 208 }
209 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { 209 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
210 newState = VIEW_T_VIEW; 210 newState = VIEW_T_VIEW;
211 } 211 }
212 else { 212 else {
213 newState = VIEW_A_VIEW; 213 newState = VIEW_A_VIEW;
214 } 214 }
215 if ( newState != currentState ) { 215 if ( newState != currentState ) {
216 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { 216 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
217 if ( ! mSearchJournal->isChecked() ) { 217 if ( ! mSearchJournal->isChecked() ) {
218 mSearchJournal->setChecked( true ); 218 mSearchJournal->setChecked( true );
219 mSearchTodo->setChecked( false ); 219 mSearchTodo->setChecked( false );
220 mSearchEvent->setChecked( false ); 220 mSearchEvent->setChecked( false );
221 } 221 }
222 } 222 }
223 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { 223 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
224 if ( ! mSearchTodo->isChecked() ) { 224 if ( ! mSearchTodo->isChecked() ) {
225 mSearchTodo->setChecked( true ); 225 mSearchTodo->setChecked( true );
226 mSearchJournal->setChecked( false ); 226 mSearchJournal->setChecked( false );
227 mSearchEvent->setChecked( false ); 227 mSearchEvent->setChecked( false );
228 } 228 }
229 } 229 }
230 else { 230 else {
231 if ( ! mSearchEvent->isChecked() ) { 231 if ( ! mSearchEvent->isChecked() ) {
232 mSearchEvent->setChecked( true ); 232 mSearchEvent->setChecked( true );
233 mSearchJournal->setChecked( false ); 233 mSearchJournal->setChecked( false );
234 mSearchTodo->setChecked( false ); 234 mSearchTodo->setChecked( false );
235 } 235 }
236 } 236 }
237 } 237 }
238 currentState = newState; 238 currentState = newState;
239 raise(); 239 raise();
240} 240}
241void SearchDialog::setFocusToList() 241void SearchDialog::setFocusToList()
242{ 242{
243 listView->resetFocus(); 243 listView->resetFocus();
244} 244}
245void SearchDialog::accept() 245void SearchDialog::accept()
246{ 246{
247 doSearch(); 247 doSearch();
248} 248}
249void SearchDialog::updateList() 249void SearchDialog::updateList()
250{ 250{
251 //listView->updateList(); 251 //listView->updateList();
252 if ( isVisible() ) { 252 if ( isVisible() ) {
253 updateView(); 253 updateView();
254 //qDebug("SearchDialog::updated "); 254 //qDebug("SearchDialog::updated ");
255 } 255 }
256 else { 256 else {
257 listView->clear(); 257 listView->clear();
258 //qDebug("SearchDialog::cleared "); 258 //qDebug("SearchDialog::cleared ");
259 259
260 } 260 }
261} 261}
262void SearchDialog::searchTextChanged( const QString &_text ) 262void SearchDialog::searchTextChanged( const QString &_text )
263{ 263{
264#if 0 264#if 0
265 enableButton( KDialogBase::User1, !_text.isEmpty() ); 265 enableButton( KDialogBase::User1, !_text.isEmpty() );
266#endif 266#endif
267} 267}
268 268
269void SearchDialog::doSearch() 269void SearchDialog::doSearch()
270{ 270{
271 QRegExp re; 271 QRegExp re;
272
273 re.setWildcard(true); // most people understand these better. 272 re.setWildcard(true); // most people understand these better.
274 re.setCaseSensitive(false); 273 re.setCaseSensitive(false);
275 QString st = searchEdit->text(); 274 QString st = searchEdit->text();
276 if ( st.right(1) != "*") 275 if ( st.right(1) != "*")
277 st += "*"; 276 st += "*";
278 re.setPattern(st); 277 re.setPattern(st);
279 if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { 278 if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) {
280 KMessageBox::sorry(this, 279 KMessageBox::sorry(this,
281 i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); 280 i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals"));
282 return; 281 return;
283 } 282 }
284 if (!re.isValid() ) { 283 if (!re.isValid() ) {
285 KMessageBox::sorry(this, 284 KMessageBox::sorry(this,
286 i18n("Invalid search expression,\ncannot perform " 285 i18n("Invalid search expression,\ncannot perform "
287 "the search.\nPlease enter a search expression\n" 286 "the search.\nPlease enter a search expression\n"
288 "using the wildcard characters\n '*' and '?'" 287 "using the wildcard characters\n '*' and '?'"
289 "where needed.")); 288 "where needed."));
290 return; 289 return;
291 } 290 }
292 search(re); 291 search(re);
293 listView->setStartDate( mStartDate->date() ); 292 listView->setStartDate( mStartDate->date() );
294 listView->showEvents(mMatchedEvents); 293 listView->showEvents(mMatchedEvents);
295 listView->addTodos(mMatchedTodos); 294 listView->addTodos(mMatchedTodos);
296 listView->addJournals(mMatchedJournals); 295 listView->addJournals(mMatchedJournals);
297 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { 296 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) {
298 setCaption(i18n("No items found. Use '*' and '?' where needed.")); 297 setCaption(i18n("No items found. Use '*' and '?' where needed."));
299 } else { 298 } else {
300 QString mess; 299 QString mess;
301 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); 300 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() );
302 setCaption( i18n("KO/Pi Find: ") + mess); 301 setCaption( i18n("KO/Pi Find: ") + mess);
303 302
304 } 303 }
305 searchEdit->setFocus(); 304 searchEdit->setFocus();
306} 305}
307void SearchDialog::updateConfig() 306void SearchDialog::updateConfig()
308{ 307{
309 listView->updateConfig(); 308 listView->updateConfig();
310} 309}
311void SearchDialog::updateView() 310void SearchDialog::updateView()
312{ 311{
313 //qDebug("SearchDialog::updateView() %d ", isVisible()); 312 //qDebug("SearchDialog::updateView() %d ", isVisible());
314 QRegExp re; 313 QRegExp re;
315 re.setWildcard(true); // most people understand these better. 314 re.setWildcard(true); // most people understand these better.
316 re.setCaseSensitive(false); 315 re.setCaseSensitive(false);
317 QString st = searchEdit->text(); 316 QString st = searchEdit->text();
318 if ( st.right(1) != "*") 317 if ( st.right(1) != "*")
319 st += "*"; 318 st += "*";
320 re.setPattern(st); 319 re.setPattern(st);
320 mMatchedEvents.clear();
321 mMatchedTodos.clear();
322 mMatchedJournals.clear();
321 if (re.isValid()) { 323 if (re.isValid()) {
322 search(re); 324 search(re);
323 } else {
324 mMatchedEvents.clear();
325 mMatchedTodos.clear();
326 mMatchedJournals.clear();
327 } 325 }
328 listView->setStartDate( mStartDate->date() ); 326 listView->setStartDate( mStartDate->date() );
329 listView->showEvents(mMatchedEvents); 327 listView->showEvents(mMatchedEvents);
330 listView->addTodos(mMatchedTodos); 328 listView->addTodos(mMatchedTodos);
331 listView->addJournals(mMatchedJournals); 329 listView->addJournals(mMatchedJournals);
332} 330}
333 331
334void SearchDialog::search(const QRegExp &re) 332void SearchDialog::search(const QRegExp &re)
335{ 333{
336 QPtrList<Event> events; 334 QPtrList<Event> events;
337 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { 335 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
338 if ( mRefineItems->isChecked() ) events = mMatchedEvents; 336 if ( mRefineItems->isChecked() ) events = mMatchedEvents;
339 mMatchedEvents.clear(); 337 mMatchedEvents.clear();
340 } 338 }
341 if ( mSearchEvent->isChecked() ) { 339 if ( mSearchEvent->isChecked() ) {
342 if ( !mRefineItems->isChecked() ) 340 if ( !mRefineItems->isChecked() )
343 events = mCalendar->events( mStartDate->date(), 341 events = mCalendar->events( mStartDate->date(),
344 mEndDate->date(), 342 mEndDate->date(),
345 false /*mInclusiveCheck->isChecked()*/ ); 343 false /*mInclusiveCheck->isChecked()*/ );
346 344
347 345
348 Event *ev; 346 Event *ev;
349 for(ev=events.first();ev;ev=events.next()) { 347 for(ev=events.first();ev;ev=events.next()) {
350 if (mSummaryCheck->isChecked()) { 348 if (mSummaryCheck->isChecked()) {
351#if QT_VERSION >= 0x030000 349#if QT_VERSION >= 0x030000
352 if (re.search(ev->summary()) != -1) 350 if (re.search(ev->summary()) != -1)
353#else 351#else
354 if (re.match(ev->summary()) != -1) 352 if (re.match(ev->summary()) != -1)
355#endif 353#endif
356 { 354 {
357 if ( mSubItems->isChecked() ) 355 if ( mSubItems->isChecked() )
358 mMatchedEvents.remove(ev); 356 mMatchedEvents.remove(ev);
359 else { 357 else {
360 if ( !mMatchedEvents.contains( ev ) ) 358 if ( !mMatchedEvents.contains( ev ) )
361 mMatchedEvents.append(ev); 359 mMatchedEvents.append(ev);
362 } 360 }
363 continue; 361 continue;
364 } 362 }
365#if QT_VERSION >= 0x030000 363#if QT_VERSION >= 0x030000
366 if (re.search(ev->location()) != -1) 364 if (re.search(ev->location()) != -1)
367#else 365#else
368 if (re.match(ev->location()) != -1) 366 if (re.match(ev->location()) != -1)
369#endif 367#endif
370 { 368 {
371 if ( mSubItems->isChecked() ) 369 if ( mSubItems->isChecked() )
372 mMatchedEvents.remove(ev); 370 mMatchedEvents.remove(ev);
373 else{ 371 else{
374 if ( !mMatchedEvents.contains( ev ) ) 372 if ( !mMatchedEvents.contains( ev ) )
375 mMatchedEvents.append(ev); 373 mMatchedEvents.append(ev);
376 } 374 }
377 continue; 375 continue;
378 } 376 }
379 } 377 }
380 if (mDescriptionCheck->isChecked()) { 378 if (mDescriptionCheck->isChecked()) {
381#if QT_VERSION >= 0x030000 379#if QT_VERSION >= 0x030000
382 if (re.search(ev->description()) != -1) 380 if (re.search(ev->description()) != -1)
383#else 381#else
384 if (re.match(ev->description()) != -1) 382 if (re.match(ev->description()) != -1)
385#endif 383#endif
386 { 384 {
387 if ( mSubItems->isChecked() ) 385 if ( mSubItems->isChecked() )
388 mMatchedEvents.remove(ev); 386 mMatchedEvents.remove(ev);
389 else{ 387 else{
390 if ( !mMatchedEvents.contains( ev ) ) 388 if ( !mMatchedEvents.contains( ev ) )
391 mMatchedEvents.append(ev); 389 mMatchedEvents.append(ev);
392 } 390 }
393 continue; 391 continue;
394 } 392 }
395 } 393 }
396 if (mCategoryCheck->isChecked()) { 394 if (mCategoryCheck->isChecked()) {
397#if QT_VERSION >= 0x030000 395#if QT_VERSION >= 0x030000
398 if (re.search(ev->categoriesStr()) != -1) 396 if (re.search(ev->categoriesStr()) != -1)
399#else 397#else
400 if (re.match(ev->categoriesStr()) != -1) 398 if (re.match(ev->categoriesStr()) != -1)
401#endif 399#endif
402 { 400 {
403 401
404 if ( mSubItems->isChecked() ) 402 if ( mSubItems->isChecked() )
405 mMatchedEvents.remove(ev); 403 mMatchedEvents.remove(ev);
406 else{ 404 else{
407 if ( !mMatchedEvents.contains( ev ) ) 405 if ( !mMatchedEvents.contains( ev ) )
408 mMatchedEvents.append(ev); 406 mMatchedEvents.append(ev);
409 } 407 }
410 continue; 408 continue;
411 } 409 }
412 } 410 }
413 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 411 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
414 QPtrList<Attendee> tmpAList = ev->attendees(); 412 QPtrList<Attendee> tmpAList = ev->attendees();
415 Attendee *a; 413 Attendee *a;
416 for (a = tmpAList.first(); a; a = tmpAList.next()) { 414 for (a = tmpAList.first(); a; a = tmpAList.next()) {
417 if (mSearchAName->isChecked()) { 415 if (mSearchAName->isChecked()) {
418#if QT_VERSION >= 0x030000 416#if QT_VERSION >= 0x030000
419 if (re.search(a->name()) != -1) 417 if (re.search(a->name()) != -1)
420#else 418#else
421 if (re.match(a->name()) != -1) 419 if (re.match(a->name()) != -1)
422#endif 420#endif
423 { 421 {
424 if ( mSubItems->isChecked() ) 422 if ( mSubItems->isChecked() )
425 mMatchedEvents.remove(ev); 423 mMatchedEvents.remove(ev);
426 else{ 424 else{
427 if ( !mMatchedEvents.contains( ev ) ) 425 if ( !mMatchedEvents.contains( ev ) )
428 mMatchedEvents.append(ev); 426 mMatchedEvents.append(ev);
429 } 427 }
430 break; 428 break;
431 } 429 }
432 } 430 }
433 if (mSearchAEmail->isChecked()) { 431 if (mSearchAEmail->isChecked()) {
434#if QT_VERSION >= 0x030000 432#if QT_VERSION >= 0x030000
435 if (re.search(a->email()) != -1) 433 if (re.search(a->email()) != -1)
436#else 434#else
437 if (re.match(a->email()) != -1) 435 if (re.match(a->email()) != -1)
438#endif 436#endif
439 { 437 {
440 if ( mSubItems->isChecked() ) 438 if ( mSubItems->isChecked() )
441 mMatchedEvents.remove(ev); 439 mMatchedEvents.remove(ev);
442 else{ 440 else{
443 if ( !mMatchedEvents.contains( ev ) ) 441 if ( !mMatchedEvents.contains( ev ) )
444 mMatchedEvents.append(ev); 442 mMatchedEvents.append(ev);
445 } 443 }
446 break; 444 break;
447 } 445 }
448 } 446 }
449 } 447 }
450 } 448 }
451 } 449 }
452 } 450 }
453 QPtrList<Todo> todos; 451 QPtrList<Todo> todos;
454 452
455 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { 453 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
456 if ( mRefineItems->isChecked() ) todos = mMatchedTodos ; 454 if ( mRefineItems->isChecked() ) todos = mMatchedTodos ;
457 mMatchedTodos.clear(); 455 mMatchedTodos.clear();
458 } 456 }
459 457
460 if ( mSearchTodo->isChecked() ) { 458 if ( mSearchTodo->isChecked() ) {
461 if ( !mRefineItems->isChecked() ) todos = mCalendar->todos( ); 459 if ( !mRefineItems->isChecked() ) todos = mCalendar->todos( );
462 Todo *tod; 460 Todo *tod;
463 for(tod=todos.first();tod;tod=todos.next()) { 461 for(tod=todos.first();tod;tod=todos.next()) {
464 if (mSummaryCheck->isChecked()) { 462 if (mSummaryCheck->isChecked()) {
465#if QT_VERSION >= 0x030000 463#if QT_VERSION >= 0x030000
466 if (re.search(tod->summary()) != -1) 464 if (re.search(tod->summary()) != -1)
467#else 465#else
468 if (re.match(tod->summary()) != -1) 466 if (re.match(tod->summary()) != -1)
469#endif 467#endif
470 { 468 {
471 if ( mSubItems->isChecked() ) 469 if ( mSubItems->isChecked() )
472 mMatchedTodos.remove(tod); 470 mMatchedTodos.remove(tod);
473 else if (!mMatchedTodos.contains( tod )) 471 else if (!mMatchedTodos.contains( tod ))
474 mMatchedTodos.append(tod); 472 mMatchedTodos.append(tod);
475 continue; 473 continue;
476 } 474 }
477 } 475 }
478 if (mDescriptionCheck->isChecked()) { 476 if (mDescriptionCheck->isChecked()) {
479#if QT_VERSION >= 0x030000 477#if QT_VERSION >= 0x030000
480 if (re.search(tod->description()) != -1) 478 if (re.search(tod->description()) != -1)
481#else 479#else
482 if (re.match(tod->description()) != -1) 480 if (re.match(tod->description()) != -1)
483#endif 481#endif
484 { 482 {
485 if ( mSubItems->isChecked() ) 483 if ( mSubItems->isChecked() )
486 mMatchedTodos.remove(tod); 484 mMatchedTodos.remove(tod);
487 else if (!mMatchedTodos.contains( tod )) 485 else if (!mMatchedTodos.contains( tod ))
488 mMatchedTodos.append(tod); 486 mMatchedTodos.append(tod);
489 continue; 487 continue;
490 } 488 }
491 } 489 }
492 if (mCategoryCheck->isChecked()) { 490 if (mCategoryCheck->isChecked()) {
493#if QT_VERSION >= 0x030000 491#if QT_VERSION >= 0x030000
494 if (re.search(tod->categoriesStr()) != -1) 492 if (re.search(tod->categoriesStr()) != -1)
495#else 493#else
496 if (re.match(tod->categoriesStr()) != -1) 494 if (re.match(tod->categoriesStr()) != -1)
497#endif 495#endif
498 { 496 {
499 if ( mSubItems->isChecked() ) 497 if ( mSubItems->isChecked() )
500 mMatchedTodos.remove(tod); 498 mMatchedTodos.remove(tod);
501 else if (!mMatchedTodos.contains( tod )) 499 else if (!mMatchedTodos.contains( tod ))
502 mMatchedTodos.append(tod); 500 mMatchedTodos.append(tod);
503 continue; 501 continue;
504 } 502 }
505 } 503 }
506 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 504 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
507 QPtrList<Attendee> tmpAList = tod->attendees(); 505 QPtrList<Attendee> tmpAList = tod->attendees();
508 Attendee *a; 506 Attendee *a;
509 for (a = tmpAList.first(); a; a = tmpAList.next()) { 507 for (a = tmpAList.first(); a; a = tmpAList.next()) {
510 if (mSearchAName->isChecked()) { 508 if (mSearchAName->isChecked()) {
511#if QT_VERSION >= 0x030000 509#if QT_VERSION >= 0x030000
512 if (re.search(a->name()) != -1) 510 if (re.search(a->name()) != -1)
513#else 511#else
514 if (re.match(a->name()) != -1) 512 if (re.match(a->name()) != -1)
515#endif 513#endif
516 { 514 {
517 if ( mSubItems->isChecked() ) 515 if ( mSubItems->isChecked() )
518 mMatchedTodos.remove(tod); 516 mMatchedTodos.remove(tod);