-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 4 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 155 | ||||
-rw-r--r-- | korganizer/searchdialog.h | 7 |
3 files changed, 136 insertions, 30 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 03d1882..5a9f2a2 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -1421,2 +1421,6 @@ { " Cancel "," Abbrechen " }, +{ "Matching items will be added to list","Passende werden zur Liste hinzugefügt" }, +{ "Matching items will be removed from list","Passende werden von der Liste entfernt" }, +{ "Search on displayed list only","Suche auf der dargestellten Liste" }, +{ "List will be cleared before search","Liste wird vor der Suche gelöscht" }, { "","" }, diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 7b3b543..bba49f0 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp @@ -32,3 +32,3 @@ #include <qpushbutton.h> - +#include <qhbuttongroup.h> #include <klocale.h> @@ -69,4 +69,17 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) - mAddItems = new QCheckBox(i18n("Add items"),topFrame); - subLayout->addWidget(mAddItems); + mAddItems = new QRadioButton( "+ ", topFrame ); + mSubItems = new QRadioButton( "- ", topFrame ); + mRefineItems = new QRadioButton( "< ", topFrame ); + subLayout->addWidget( mAddItems ); + subLayout->addWidget( mSubItems ); + subLayout->addWidget( mRefineItems ); + QFont fo ( mAddItems->font() ); + fo.setBold( true ); + fo.setPointSize( fo.pointSize() + 2 ); + mAddItems->setFont( fo ); + mSubItems->setFont( fo ); + mRefineItems->setFont( fo ); + connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool ))); + connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool ))); + connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); @@ -77,2 +90,3 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) togButton->setMinimumWidth( togButton->sizeHint().height() ); + searchEdit->setText("*"); // Find all events by default @@ -143,2 +157,29 @@ SearchDialog::~SearchDialog() } +void SearchDialog::slot_add( bool b ) +{ + if ( b ) { + if ( mSubItems->isOn() ) mSubItems->toggle(); + if ( mRefineItems->isOn() ) mRefineItems->toggle(); + setCaption( i18n("Matching items will be added to list")); + } else + setCaption( i18n("List will be cleared before search")); +} +void SearchDialog::slot_sub( bool b) +{ + if ( b ) { + if ( mRefineItems->isOn() ) mRefineItems->toggle(); + if ( mAddItems->isOn() ) mAddItems->toggle(); + setCaption( i18n("Matching items will be removed from list")); + } else + setCaption( i18n("List will be cleared before search")); +} +void SearchDialog::slot_refine( bool b) +{ + if ( b ) { + if ( mSubItems->isOn() ) mSubItems->toggle(); + if ( mAddItems->isOn() ) mAddItems->toggle(); + setCaption( i18n("Search on displayed list only")); + } else + setCaption( i18n("List will be cleared before search")); +} void SearchDialog::toggleCheckboxes() @@ -296,4 +337,6 @@ void SearchDialog::search(const QRegExp &re) false /*mInclusiveCheck->isChecked()*/ ); - if ( !mAddItems->isChecked() ) + if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { + if ( mRefineItems->isChecked() ) events = mMatchedEvents; mMatchedEvents.clear(); + } if ( mSearchEvent->isChecked() ) { @@ -307,4 +350,9 @@ void SearchDialog::search(const QRegExp &re) #endif - { - mMatchedEvents.append(ev); + { + if ( mSubItems->isChecked() ) + mMatchedEvents.remove(ev); + else { + if ( !mMatchedEvents.contains( ev ) ) + mMatchedEvents.append(ev); + } continue; @@ -316,4 +364,9 @@ void SearchDialog::search(const QRegExp &re) #endif - { - mMatchedEvents.append(ev); + { + if ( mSubItems->isChecked() ) + mMatchedEvents.remove(ev); + else{ + if ( !mMatchedEvents.contains( ev ) ) + mMatchedEvents.append(ev); + } continue; @@ -327,4 +380,9 @@ void SearchDialog::search(const QRegExp &re) #endif - { - mMatchedEvents.append(ev); + { + if ( mSubItems->isChecked() ) + mMatchedEvents.remove(ev); + else{ + if ( !mMatchedEvents.contains( ev ) ) + mMatchedEvents.append(ev); + } continue; @@ -339,3 +397,9 @@ void SearchDialog::search(const QRegExp &re) { - mMatchedEvents.append(ev); + + if ( mSubItems->isChecked() ) + mMatchedEvents.remove(ev); + else{ + if ( !mMatchedEvents.contains( ev ) ) + mMatchedEvents.append(ev); + } continue; @@ -353,4 +417,9 @@ void SearchDialog::search(const QRegExp &re) #endif - { - mMatchedEvents.append(ev); + { + if ( mSubItems->isChecked() ) + mMatchedEvents.remove(ev); + else{ + if ( !mMatchedEvents.contains( ev ) ) + mMatchedEvents.append(ev); + } break; @@ -364,4 +433,9 @@ void SearchDialog::search(const QRegExp &re) #endif - { - mMatchedEvents.append(ev); + { + if ( mSubItems->isChecked() ) + mMatchedEvents.remove(ev); + else{ + if ( !mMatchedEvents.contains( ev ) ) + mMatchedEvents.append(ev); + } break; @@ -374,4 +448,8 @@ void SearchDialog::search(const QRegExp &re) QPtrList<Todo> todos = mCalendar->todos( ); - if ( !mAddItems->isChecked() ) + + if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { + if ( mRefineItems->isChecked() ) todos = mMatchedTodos ; mMatchedTodos.clear(); + } + if ( mSearchTodo->isChecked() ) { @@ -385,4 +463,7 @@ void SearchDialog::search(const QRegExp &re) #endif - { - mMatchedTodos.append(tod); + { + if ( mSubItems->isChecked() ) + mMatchedTodos.remove(tod); + else if (!mMatchedTodos.contains( tod )) + mMatchedTodos.append(tod); continue; @@ -396,4 +477,7 @@ void SearchDialog::search(const QRegExp &re) #endif - { - mMatchedTodos.append(tod); + { + if ( mSubItems->isChecked() ) + mMatchedTodos.remove(tod); + else if (!mMatchedTodos.contains( tod )) + mMatchedTodos.append(tod); continue; @@ -407,4 +491,7 @@ void SearchDialog::search(const QRegExp &re) #endif - { - mMatchedTodos.append(tod); + { + if ( mSubItems->isChecked() ) + mMatchedTodos.remove(tod); + else if (!mMatchedTodos.contains( tod )) + mMatchedTodos.append(tod); continue; @@ -422,4 +509,7 @@ void SearchDialog::search(const QRegExp &re) #endif - { - mMatchedTodos.append(tod); + { + if ( mSubItems->isChecked() ) + mMatchedTodos.remove(tod); + else if (!mMatchedTodos.contains( tod )) + mMatchedTodos.append(tod); break; @@ -434,3 +524,6 @@ void SearchDialog::search(const QRegExp &re) { - mMatchedTodos.append(tod); + if ( mSubItems->isChecked() ) + mMatchedTodos.remove(tod); + else if (!mMatchedTodos.contains( tod )) + mMatchedTodos.append(tod); break; @@ -442,6 +535,9 @@ void SearchDialog::search(const QRegExp &re) } - if ( !mAddItems->isChecked() ) + + QPtrList<Journal> journals = mCalendar->journals( ); + if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { + if ( mRefineItems->isChecked() ) journals = mMatchedJournals ; mMatchedJournals.clear(); + } if (mSearchJournal->isChecked() ) { - QPtrList<Journal> journals = mCalendar->journals( ); Journal* journ; @@ -457,3 +553,6 @@ void SearchDialog::search(const QRegExp &re) { - mMatchedJournals.append(journ); + if ( mSubItems->isChecked() ) + mMatchedJournals.remove(journ); + else if (!mMatchedJournals.contains( journ )) + mMatchedJournals.append(journ); continue; diff --git a/korganizer/searchdialog.h b/korganizer/searchdialog.h index b345b98..945ff65 100644 --- a/korganizer/searchdialog.h +++ b/korganizer/searchdialog.h @@ -27,3 +27,3 @@ #include <qregexp.h> - +#include <qradiobutton.h> #include <kdialogbase.h> @@ -63,2 +63,5 @@ class SearchDialog : public QVBox void toggleCheckboxes(); + void slot_add( bool ); + void slot_sub( bool ); + void slot_refine( bool ); @@ -94,3 +97,3 @@ class SearchDialog : public QVBox QCheckBox *mSearchAEmail; - QCheckBox *mAddItems; + QRadioButton *mAddItems, *mSubItems, *mRefineItems; void keyPressEvent ( QKeyEvent *e) ; |