-rw-r--r-- | korganizer/searchdialog.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index a8de297..0713980 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -540,49 +540,55 @@ void SearchDialog::search(const QRegExp &re) | |||
540 | if ( mRefineItems->isChecked() ) journals = mMatchedJournals ; | 540 | if ( mRefineItems->isChecked() ) journals = mMatchedJournals ; |
541 | mMatchedJournals.clear(); | 541 | mMatchedJournals.clear(); |
542 | } | 542 | } |
543 | if (mSearchJournal->isChecked() ) { | 543 | if (mSearchJournal->isChecked() ) { |
544 | Journal* journ; | 544 | Journal* journ; |
545 | 545 | ||
546 | for(journ=journals.first();journ;journ=journals.next()) { | 546 | for(journ=journals.first();journ;journ=journals.next()) { |
547 | if ( journ->dtStart().date() <= mEndDate->date() | 547 | if ( journ->dtStart().date() <= mEndDate->date() |
548 | &&journ->dtStart().date() >= mStartDate->date()) { | 548 | &&journ->dtStart().date() >= mStartDate->date()) { |
549 | #if QT_VERSION >= 0x030000 | 549 | #if QT_VERSION >= 0x030000 |
550 | if (re.search(journ->description()) != -1) | 550 | if (re.search(journ->description()) != -1) |
551 | #else | 551 | #else |
552 | if (re.match(journ->description()) != -1) | 552 | if (re.match(journ->description()) != -1) |
553 | #endif | 553 | #endif |
554 | { | 554 | { |
555 | if ( mSubItems->isChecked() ) | 555 | if ( mSubItems->isChecked() ) |
556 | mMatchedJournals.remove(journ); | 556 | mMatchedJournals.remove(journ); |
557 | else if (!mMatchedJournals.contains( journ )) | 557 | else if (!mMatchedJournals.contains( journ )) |
558 | mMatchedJournals.append(journ); | 558 | mMatchedJournals.append(journ); |
559 | continue; | 559 | continue; |
560 | } | 560 | } |
561 | } | 561 | } |
562 | } | 562 | } |
563 | } | 563 | } |
564 | 564 | if ( mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() < 1 ) { | |
565 | qDebug("count %d ", mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() ); | ||
566 | if ( mRefineItems->isChecked() ) | ||
567 | mRefineItems->setChecked( false ); | ||
568 | else if ( mSubItems->isChecked() ) | ||
569 | mSubItems->setChecked( false ); | ||
570 | } | ||
565 | } | 571 | } |
566 | 572 | ||
567 | void SearchDialog::keyPressEvent ( QKeyEvent *e) | 573 | void SearchDialog::keyPressEvent ( QKeyEvent *e) |
568 | { | 574 | { |
569 | switch ( e->key() ) { | 575 | switch ( e->key() ) { |
570 | case Qt::Key_Escape: | 576 | case Qt::Key_Escape: |
571 | close(); | 577 | close(); |
572 | break; | 578 | break; |
573 | case Qt::Key_F: | 579 | case Qt::Key_F: |
574 | if ( e->state() == Qt::ControlButton ) { | 580 | if ( e->state() == Qt::ControlButton ) { |
575 | 581 | ||
576 | } | 582 | } |
577 | break; | 583 | break; |
578 | case Qt::Key_Return: | 584 | case Qt::Key_Return: |
579 | case Qt::Key_Enter: | 585 | case Qt::Key_Enter: |
580 | doSearch(); | 586 | doSearch(); |
581 | break; | 587 | break; |
582 | 588 | ||
583 | default: | 589 | default: |
584 | e->ignore(); | 590 | e->ignore(); |
585 | } | 591 | } |
586 | } | 592 | } |
587 | 593 | ||
588 | //mMatchedJournals; | 594 | //mMatchedJournals; |