summaryrefslogtreecommitdiffabout
path: root/korganizer/searchdialog.cpp
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 /korganizer/searchdialog.cpp
parentbe2913be979c0d7c41e8a8721b552d14cb7ecd39 (diff)
downloadkdepimpi-b297e71bd6276ee9370917cb6765d73db7b61de9.zip
kdepimpi-b297e71bd6276ee9370917cb6765d73db7b61de9.tar.gz
kdepimpi-b297e71bd6276ee9370917cb6765d73db7b61de9.tar.bz2
search fixes
Diffstat (limited to 'korganizer/searchdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/searchdialog.cpp155
1 files changed, 127 insertions, 28 deletions
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;