-rw-r--r-- | korganizer/searchdialog.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index db60383..7a945e3 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp @@ -193,33 +193,36 @@ void SearchDialog::updateList() } } void SearchDialog::searchTextChanged( const QString &_text ) { #if 0 enableButton( KDialogBase::User1, !_text.isEmpty() ); #endif } void SearchDialog::doSearch() { QRegExp re; re.setWildcard(true); // most people understand these better. re.setCaseSensitive(false); - re.setPattern(searchEdit->text()); + QString st = searchEdit->text(); + if ( st.right(1) != "*") + st += "*"; + re.setPattern(st); if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { KMessageBox::sorry(this, i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); return; } if (!re.isValid() ) { KMessageBox::sorry(this, i18n("Invalid search expression,\ncannot perform " "the search.\nPlease enter a search expression\n" "using the wildcard characters\n '*' and '?'" "where needed.")); return; } search(re); @@ -234,34 +237,37 @@ void SearchDialog::doSearch() QString mess; mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); setCaption( i18n("KO/Pi Find: ") + mess); } searchEdit->setFocus(); } void SearchDialog::updateConfig() { listView->updateConfig(); } void SearchDialog::updateView() { //qDebug("SearchDialog::updateView() %d ", isVisible()); QRegExp re; re.setWildcard(true); // most people understand these better. - re.setCaseSensitive(false); - re.setPattern(searchEdit->text()); + re.setCaseSensitive(false); + QString st = searchEdit->text(); + if ( st.right(1) != "*") + st += "*"; + re.setPattern(st); if (re.isValid()) { search(re); } else { mMatchedEvents.clear(); mMatchedTodos.clear(); mMatchedJournals.clear(); } listView->setStartDate( mStartDate->date() ); listView->showEvents(mMatchedEvents); listView->addTodos(mMatchedTodos); listView->addJournals(mMatchedJournals); } void SearchDialog::search(const QRegExp &re) { QPtrList<Event> events = mCalendar->events( mStartDate->date(), |