-rw-r--r-- | korganizer/searchdialog.cpp | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 0e9f64c..72359df 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp @@ -197,48 +197,51 @@ void SearchDialog::toggleCheckboxes() } void SearchDialog::raiseAndSelect() { static int currentState = 0; if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) currentState = 0; int newState = 0; if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { newState = VIEW_J_VIEW; } else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { newState = VIEW_T_VIEW; } else { newState = VIEW_A_VIEW; } if ( newState != currentState ) { if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { if ( ! mSearchJournal->isChecked() ) { mSearchJournal->setChecked( true ); mSearchTodo->setChecked( false ); mSearchEvent->setChecked( false ); + mSummaryCheck->setChecked( true ); + mDescriptionCheck->setChecked( true ); + } } else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { if ( ! mSearchTodo->isChecked() ) { mSearchTodo->setChecked( true ); mSearchJournal->setChecked( false ); mSearchEvent->setChecked( false ); } } else { if ( ! mSearchEvent->isChecked() ) { mSearchEvent->setChecked( true ); mSearchJournal->setChecked( false ); mSearchTodo->setChecked( false ); } } } currentState = newState; raise(); } void SearchDialog::setFocusToList() { listView->resetFocus(); } @@ -529,60 +532,76 @@ void SearchDialog::search(const QRegExp &re) if ( mSubItems->isChecked() ) mMatchedTodos.remove(tod); else if (!mMatchedTodos.contains( tod )) mMatchedTodos.append(tod); break; } } } } } } QPtrList<Journal> journals; if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { if ( mRefineItems->isChecked() ) journals = mMatchedJournals ; mMatchedJournals.clear(); } if (mSearchJournal->isChecked() ) { if ( ! mRefineItems->isChecked() ) journals = mCalendar->journals(); Journal* journ; for(journ=journals.first();journ;journ=journals.next()) { if ( journ->dtStart().date() <= mEndDate->date() &&journ->dtStart().date() >= mStartDate->date()) { + if (mDescriptionCheck->isChecked()) { #if QT_VERSION >= 0x030000 - if (re.search(journ->description()) != -1) + if (re.search(journ->description()) != -1) #else - if (re.match(journ->description()) != -1) + if (re.match(journ->description()) != -1) #endif - { - if ( mSubItems->isChecked() ) - mMatchedJournals.remove(journ); - else if (!mMatchedJournals.contains( journ )) - mMatchedJournals.append(journ); - continue; - } + { + if ( mSubItems->isChecked() ) + mMatchedJournals.remove(journ); + else if (!mMatchedJournals.contains( journ )) + mMatchedJournals.append(journ); + continue; + } + } + if (mSummaryCheck->isChecked()) { +#if QT_VERSION >= 0x030000 + if (re.search(journ->summary()) != -1) +#else + if (re.match(journ->summary()) != -1) +#endif + { + if ( mSubItems->isChecked() ) + mMatchedJournals.remove(journ); + else if (!mMatchedJournals.contains( journ )) + mMatchedJournals.append(journ); + continue; + } + } } } } if ( mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() < 1 ) { qDebug("count %d ", mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() ); if ( mRefineItems->isChecked() ) mRefineItems->setChecked( false ); else if ( mSubItems->isChecked() ) mSubItems->setChecked( false ); } } void SearchDialog::keyPressEvent ( QKeyEvent *e) { switch ( e->key() ) { case Qt::Key_Escape: close(); break; case Qt::Key_F: if ( e->state() == Qt::ControlButton ) { } break; case Qt::Key_Return: |