-rw-r--r-- | korganizer/searchdialog.cpp | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 341a839..db60383 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp @@ -74,13 +74,13 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) // topFrame); QHBox *incidenceGroup = new QHBox( topFrame ); layout->addWidget(incidenceGroup); mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); - mSearchEvent->setChecked(true); + //mSearchEvent->setChecked(true); mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); QHBox *subjectGroup = new QHBox( topFrame ); layout->addWidget(subjectGroup); @@ -126,12 +126,55 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) } SearchDialog::~SearchDialog() { } +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 ); + } + } + 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(); } void SearchDialog::accept() { @@ -198,13 +241,13 @@ void SearchDialog::doSearch() 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()); if (re.isValid()) { search(re); |