summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/searchdialog.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 0713980..2390520 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -324,32 +324,36 @@ void SearchDialog::updateView()
324 mMatchedEvents.clear(); 324 mMatchedEvents.clear();
325 mMatchedTodos.clear(); 325 mMatchedTodos.clear();
326 mMatchedJournals.clear(); 326 mMatchedJournals.clear();
327 } 327 }
328 listView->setStartDate( mStartDate->date() ); 328 listView->setStartDate( mStartDate->date() );
329 listView->showEvents(mMatchedEvents); 329 listView->showEvents(mMatchedEvents);
330 listView->addTodos(mMatchedTodos); 330 listView->addTodos(mMatchedTodos);
331 listView->addJournals(mMatchedJournals); 331 listView->addJournals(mMatchedJournals);
332} 332}
333 333
334void SearchDialog::search(const QRegExp &re) 334void SearchDialog::search(const QRegExp &re)
335{ 335{
336 QPtrList<Event> events = mCalendar->events( mStartDate->date(), 336 QPtrList<Event> events;
337 mEndDate->date(),
338 false /*mInclusiveCheck->isChecked()*/ );
339 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { 337 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
340 if ( mRefineItems->isChecked() ) events = mMatchedEvents; 338 if ( mRefineItems->isChecked() ) events = mMatchedEvents;
341 mMatchedEvents.clear(); 339 mMatchedEvents.clear();
342 } 340 }
343 if ( mSearchEvent->isChecked() ) { 341 if ( mSearchEvent->isChecked() ) {
342 if ( !mRefineItems->isChecked() )
343 events = mCalendar->events( mStartDate->date(),
344 mEndDate->date(),
345 false /*mInclusiveCheck->isChecked()*/ );
346
347
344 Event *ev; 348 Event *ev;
345 for(ev=events.first();ev;ev=events.next()) { 349 for(ev=events.first();ev;ev=events.next()) {
346 if (mSummaryCheck->isChecked()) { 350 if (mSummaryCheck->isChecked()) {
347#if QT_VERSION >= 0x030000 351#if QT_VERSION >= 0x030000
348 if (re.search(ev->summary()) != -1) 352 if (re.search(ev->summary()) != -1)
349#else 353#else
350 if (re.match(ev->summary()) != -1) 354 if (re.match(ev->summary()) != -1)
351#endif 355#endif
352 { 356 {
353 if ( mSubItems->isChecked() ) 357 if ( mSubItems->isChecked() )
354 mMatchedEvents.remove(ev); 358 mMatchedEvents.remove(ev);
355 else { 359 else {
@@ -437,32 +441,33 @@ void SearchDialog::search(const QRegExp &re)
437 mMatchedEvents.remove(ev); 441 mMatchedEvents.remove(ev);
438 else{ 442 else{
439 if ( !mMatchedEvents.contains( ev ) ) 443 if ( !mMatchedEvents.contains( ev ) )
440 mMatchedEvents.append(ev); 444 mMatchedEvents.append(ev);
441 } 445 }
442 break; 446 break;
443 } 447 }
444 } 448 }
445 } 449 }
446 } 450 }
447 } 451 }
448 } 452 }
449 QPtrList<Todo> todos = mCalendar->todos( ); 453 QPtrList<Todo> todos;
450 454
451 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { 455 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
452 if ( mRefineItems->isChecked() ) todos = mMatchedTodos ; 456 if ( mRefineItems->isChecked() ) todos = mMatchedTodos ;
453 mMatchedTodos.clear(); 457 mMatchedTodos.clear();
454 } 458 }
455 459
456 if ( mSearchTodo->isChecked() ) { 460 if ( mSearchTodo->isChecked() ) {
461 if ( !mRefineItems->isChecked() ) todos = mCalendar->todos( );
457 Todo *tod; 462 Todo *tod;
458 for(tod=todos.first();tod;tod=todos.next()) { 463 for(tod=todos.first();tod;tod=todos.next()) {
459 if (mSummaryCheck->isChecked()) { 464 if (mSummaryCheck->isChecked()) {
460#if QT_VERSION >= 0x030000 465#if QT_VERSION >= 0x030000
461 if (re.search(tod->summary()) != -1) 466 if (re.search(tod->summary()) != -1)
462#else 467#else
463 if (re.match(tod->summary()) != -1) 468 if (re.match(tod->summary()) != -1)
464#endif 469#endif
465 { 470 {
466 if ( mSubItems->isChecked() ) 471 if ( mSubItems->isChecked() )
467 mMatchedTodos.remove(tod); 472 mMatchedTodos.remove(tod);
468 else if (!mMatchedTodos.contains( tod )) 473 else if (!mMatchedTodos.contains( tod ))
@@ -526,30 +531,31 @@ void SearchDialog::search(const QRegExp &re)
526 if ( mSubItems->isChecked() ) 531 if ( mSubItems->isChecked() )
527 mMatchedTodos.remove(tod); 532 mMatchedTodos.remove(tod);
528 else if (!mMatchedTodos.contains( tod )) 533 else if (!mMatchedTodos.contains( tod ))
529 mMatchedTodos.append(tod); 534 mMatchedTodos.append(tod);
530 break; 535 break;
531 } 536 }
532 } 537 }
533 } 538 }
534 } 539 }
535 } 540 }
536 } 541 }
537 542
538 QPtrList<Journal> journals = mCalendar->journals( ); 543 QPtrList<Journal> journals;
539 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { 544 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
540 if ( mRefineItems->isChecked() ) journals = mMatchedJournals ; 545 if ( mRefineItems->isChecked() ) journals = mMatchedJournals ;
541 mMatchedJournals.clear(); 546 mMatchedJournals.clear();
542 } 547 }
543 if (mSearchJournal->isChecked() ) { 548 if (mSearchJournal->isChecked() ) {
549 if ( ! mRefineItems->isChecked() ) journals = mCalendar->journals();
544 Journal* journ; 550 Journal* journ;
545 551
546 for(journ=journals.first();journ;journ=journals.next()) { 552 for(journ=journals.first();journ;journ=journals.next()) {
547 if ( journ->dtStart().date() <= mEndDate->date() 553 if ( journ->dtStart().date() <= mEndDate->date()
548 &&journ->dtStart().date() >= mStartDate->date()) { 554 &&journ->dtStart().date() >= mStartDate->date()) {
549#if QT_VERSION >= 0x030000 555#if QT_VERSION >= 0x030000
550 if (re.search(journ->description()) != -1) 556 if (re.search(journ->description()) != -1)
551#else 557#else
552 if (re.match(journ->description()) != -1) 558 if (re.match(journ->description()) != -1)
553#endif 559#endif
554 { 560 {
555 if ( mSubItems->isChecked() ) 561 if ( mSubItems->isChecked() )