summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-16 19:28:39 (UTC)
committer zautrix <zautrix>2005-06-16 19:28:39 (UTC)
commitb297e71bd6276ee9370917cb6765d73db7b61de9 (patch) (side-by-side diff)
tree74240a9792ad8807b8838b43f89d0303db585538
parentbe2913be979c0d7c41e8a8721b552d14cb7ecd39 (diff)
downloadkdepimpi-b297e71bd6276ee9370917cb6765d73db7b61de9.zip
kdepimpi-b297e71bd6276ee9370917cb6765d73db7b61de9.tar.gz
kdepimpi-b297e71bd6276ee9370917cb6765d73db7b61de9.tar.bz2
search fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--korganizer/searchdialog.cpp111
-rw-r--r--korganizer/searchdialog.h7
3 files changed, 114 insertions, 8 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);
+ 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() ) {
@@ -308,3 +351,8 @@ void SearchDialog::search(const QRegExp &re)
{
+ if ( mSubItems->isChecked() )
+ mMatchedEvents.remove(ev);
+ else {
+ if ( !mMatchedEvents.contains( ev ) )
mMatchedEvents.append(ev);
+ }
continue;
@@ -317,3 +365,8 @@ void SearchDialog::search(const QRegExp &re)
{
+ if ( mSubItems->isChecked() )
+ mMatchedEvents.remove(ev);
+ else{
+ if ( !mMatchedEvents.contains( ev ) )
mMatchedEvents.append(ev);
+ }
continue;
@@ -328,3 +381,8 @@ void SearchDialog::search(const QRegExp &re)
{
+ 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)
{
+
+ if ( mSubItems->isChecked() )
+ mMatchedEvents.remove(ev);
+ else{
+ if ( !mMatchedEvents.contains( ev ) )
mMatchedEvents.append(ev);
+ }
continue;
@@ -354,3 +418,8 @@ void SearchDialog::search(const QRegExp &re)
{
+ if ( mSubItems->isChecked() )
+ mMatchedEvents.remove(ev);
+ else{
+ if ( !mMatchedEvents.contains( ev ) )
mMatchedEvents.append(ev);
+ }
break;
@@ -365,3 +434,8 @@ void SearchDialog::search(const QRegExp &re)
{
+ 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() ) {
@@ -386,2 +464,5 @@ void SearchDialog::search(const QRegExp &re)
{
+ if ( mSubItems->isChecked() )
+ mMatchedTodos.remove(tod);
+ else if (!mMatchedTodos.contains( tod ))
mMatchedTodos.append(tod);
@@ -397,2 +478,5 @@ void SearchDialog::search(const QRegExp &re)
{
+ if ( mSubItems->isChecked() )
+ mMatchedTodos.remove(tod);
+ else if (!mMatchedTodos.contains( tod ))
mMatchedTodos.append(tod);
@@ -408,2 +492,5 @@ void SearchDialog::search(const QRegExp &re)
{
+ if ( mSubItems->isChecked() )
+ mMatchedTodos.remove(tod);
+ else if (!mMatchedTodos.contains( tod ))
mMatchedTodos.append(tod);
@@ -423,2 +510,5 @@ void SearchDialog::search(const QRegExp &re)
{
+ if ( mSubItems->isChecked() )
+ mMatchedTodos.remove(tod);
+ else if (!mMatchedTodos.contains( tod ))
mMatchedTodos.append(tod);
@@ -434,2 +524,5 @@ void SearchDialog::search(const QRegExp &re)
{
+ if ( mSubItems->isChecked() )
+ mMatchedTodos.remove(tod);
+ else if (!mMatchedTodos.contains( tod ))
mMatchedTodos.append(tod);
@@ -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,2 +553,5 @@ void SearchDialog::search(const QRegExp &re)
{
+ if ( mSubItems->isChecked() )
+ mMatchedJournals.remove(journ);
+ else if (!mMatchedJournals.contains( journ ))
mMatchedJournals.append(journ);
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) ;