-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 4 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 111 | ||||
-rw-r--r-- | korganizer/searchdialog.h | 7 |
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 @@ -1326,103 +1326,107 @@ { "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, { "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, { "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, { "Show Sync Events","Zeige Sync-Ereignisse" }, { "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, { "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, { " on "," am " }, { "On: ","Am: " }, { "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, { "Start/Stop todo...","Starte/Stoppe Todo..." }, { "Color for running todos:","Farbe für laufende Todos:" }, { "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" }, { "Todo is started","Todo ist gestartet" }, { "Stop todo","Stoppe Todo" }, { "Todo is stopped","Todo ist gestoppt" }, { "Start todo","Starte Todo" }, { "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, { "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, { "Todo has subtodos","Todo hat Untertodos" }, { "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, { "Colors","Farben" }, { "Click on new parent item","Klicke auf neues Übertodo" }, { "Reparenting aborted!","Übertodo setzen abgebrochen" }, { "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, { "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, { "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, { "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, { "times","Zeiten" }, { "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" }, { "Backup enabled","Backup angeschaltet" }, { "Use standard backup dir","Standard Backupverzeichnis" }, { "Number of Backups:","Anzahl der Backups" }, { "Make backup every ","Mache ein Backup alle " }, { " days"," Tage" }, { "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." }, { "Backup Failed!","Backup Problem!" }, { "Try again now","Versuche jetzt nochmal" }, { "Try again later","Versuche später nochmal" }, { "Try again tomorrow","Versuche morgen nochmal" }, { "Disable backup","Schalte Backup ab" }, { "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, { "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, { "Choose action","Wähle Aktion" }, { "Comment for todo:","Kommentar zum Todo:" }, { "Stop+note","Stop+Notiz" }, { "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, { "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" }, { "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" }, { "Print complete list","Drucke komplette Liste" }, { "Hide all selected","Verstecke Selektierte" }, { "Add items","hinzufügen" }, { "One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?","Ein (oder mehrere) ausgewähltes\nTodo hat Untertodos!\nMöchten Sie der Auswahlliste\nalle Untertodos von allen\nausgewählten Todos hinzufügen?" }, { "Print List View...","Drucke Listenansicht..." }, { "You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.","Sie können die <b>Listenansicht</b> und die Listenansicht im <b>Suchdialog</b> ausdrucken! Um das zu machen gehen Sie bitte zur <b>Listenansicht</b> oder zum <b>Suchdialog</b>. Rechtsklicken Sie auf die Liste. Wählen Sie im Popupmenu den Eintrag <b>Drucke komplette Liste</b>. Das druckt die Liste so, wie man sie sieht. Sie können Listeneinträge entfernen ohne die korrespondierenden Ereignisse/Todos zu löschen! Selektieren sie einfach alle Einträge, die sie nicht ausdrucken möchten. Dann Rechtsklicken Sie auf einen Eintrag und wählen <b>Verstecke Selektierte</b>. Danach können Sie die Liste ohne diese Einträge ausdrucken." }, { "Configure KO/Pi...","Konfiguriere KO/Pi..." }, { "Global Settings...","Globale Einstellungen..." }, { "<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n","<p><b>R</b>: Zeige Resource Ansicht | <b>F</b>: Editiere Filter </p>\n" }, { "(disabled)","(abgeschaltet)" }, { "New Calendar","Neuer Kalender" }, { "Calendar","Kalender" }, { "Filter selector","Filterauswahl" }, { "Filtermenu","Filtermenu" }, { "Toggle Fullscreen","Vollbild umschalten" }, { "Toggle Resource View","Resourcenansicht umschalten" }, { "Storage HowTo...","Speicherort HowTo..." }, { "Timetracking HowTo...","Timetracking HowTo..." }, { "Juni","Juni" }, { "Juli","Juli" }, { "ToDo:","ToDo:" }, { "Set Calendar","Setze Kalender" }, { "Todo: %1","Todo: %1" }, { ": (Prio ",": (Prio " }, { "Todos","Todos" }, { "Todo Viewer","Todo Viewer" }, { "Todo ","Todo " }, { " Calendar \n Resource "," Kalender \n Resource " }, { " Color "," Farbe " }, { "The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>. Möchten Sie diesen Kalender aus KO/Pi entfernen? (Die Datei wird dabei nicht gelöscht!)" }, { "The calendar <b>%1</b> is displaying file <b>%2</b>","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>" }, { "Add new Calendar","Füge Kalender hinzu" }, { "<b>Name of new calendar:</b>","<b>Name des Kalenders:</b>" }, { "<b>Local ical (*.ics) file:</b>","<b>Lokale ical (*.ics) Datei:</b>" }, { "Sorry, the calendar name is empty!","Sorry, der Kalendername ist leer!" }, { "Sorry, the file name is empty!","Sorry, der Dateiname ist leer!" }, { "Error loading calendar file\n%1.","Fehler beim Laden der Kalenderdatei\n%1." }, { "The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>","Der Kalender <b>%1</b> ist nicht geladen! Das Laden der Datei <b>%2</b> schlug fehl! <b>Soll erneut versucht werden den Kalender zu laden?</b>" }, { "Global application font for all apps:","Globale Schriftart:" }, { "Application Font","Applikationsschriftart" }, { "Kx/Pi","Kx/Pi" }, { "Backup","Backup" }, { "KDE-Pim Global Settings","KDE-Pim Globale Einstellungen" }, { "Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!","Sorry, der Kalendername \n%1\nist schon in Benutzung!\nBitte wählen Sie einen anderen!" }, { "Sorry, the file \n%1\nis already loaded!\nPlease choose another file!","Sorry, die Datei \n%1\nist schon geladen!\nBitte wählen Sie eine andere!" }, { "Choose Color","Wähle Farbe" }, { " OK "," OK " }, { " 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" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" },
\ No newline at end of file diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 7b3b543..bba49f0 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp @@ -1,488 +1,587 @@ /* This file is part of KOrganizer. Copyright (c) 1998 Preston Brown Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qlayout.h> #include <qcheckbox.h> #include <qgroupbox.h> #include <qlabel.h> #include <qlistview.h> #include <qwhatsthis.h> #include <qlineedit.h> #include <qpushbutton.h> - +#include <qhbuttongroup.h> #include <klocale.h> #include <kmessagebox.h> #include <libkdepim/kdateedit.h> #include "koglobals.h" #include "koprefs.h" #include "klineedit.h" #include "calendarview.h" #include "koviewmanager.h" #include "searchdialog.h" SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) : QVBox( 0 ) { mCalendar = calendar; QFrame *topFrame = new QFrame( this ) ;//plainPage(); QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); // Search expression QHBoxLayout *subLayout = new QHBoxLayout(); layout->addLayout(subLayout); /* searchLabel = new QLabel(topFrame); searchLabel->setText(i18n("Search for:")); subLayout->addWidget(searchLabel); */ QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame ); //OkButton->setDefault( true ); connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); subLayout->addWidget(OkButton); searchEdit = new KLineEdit(topFrame); subLayout->addWidget(searchEdit); - 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 ))); QPushButton *togButton = new QPushButton( "", topFrame ); subLayout->addWidget(togButton); connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); togButton->setPixmap(SmallIcon("1updownarrow")); togButton->setMinimumWidth( togButton->sizeHint().height() ); + searchEdit->setText("*"); // Find all events by default searchEdit->setFocus(); connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); // Subjects to search // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), // topFrame); incidenceGroup = new QHBox( topFrame ); layout->addWidget(incidenceGroup); mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); //mSearchEvent->setChecked(true); mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); subjectGroup = new QHBox( topFrame ); layout->addWidget(subjectGroup); mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); mSummaryCheck->setChecked(true); mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); attendeeGroup = new QHBox( topFrame ); layout->addWidget(attendeeGroup ); new QLabel( i18n("Attendee:"),attendeeGroup ); mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); // Date range // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), // topFrame); // layout->addWidget(rangeGroup); QWidget *rangeWidget = new QWidget(topFrame); QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); mStartDate = new KDateEdit(rangeWidget); rangeLayout->addWidget(mStartDate); rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); mEndDate = new KDateEdit(rangeWidget); mEndDate->setDate(QDate::currentDate().addDays(365)); rangeLayout->addWidget(mEndDate); QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); rangeLayout->addWidget( (QWidget*)wt ); layout->addWidget(rangeWidget); // Results list view listView = new KOListView(mCalendar,topFrame); layout->addWidget(listView); //layout->setStretchFactor( listView, 333 ); //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); //listView->setMaximumHeight( 50 ); listView->readSettings(KOGlobals::config(),"SearchListView Layout"); connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); setCaption( i18n("KO/Pi Find: ")); #ifdef DESKTOP_VERSION OkButton = new QPushButton( i18n("Close"), this ); connect(OkButton,SIGNAL(clicked()),SLOT(hide())); #endif } 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() { if ( incidenceGroup->isVisible() ) { incidenceGroup->hide() ; subjectGroup->hide() ; attendeeGroup->hide() ; } else { incidenceGroup->show() ; subjectGroup->show() ; attendeeGroup->show() ; } } 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() { doSearch(); } void SearchDialog::updateList() { //listView->updateList(); if ( isVisible() ) { updateView(); //qDebug("SearchDialog::updated "); } else { listView->clear(); //qDebug("SearchDialog::cleared "); } } 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); 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); listView->setStartDate( mStartDate->date() ); listView->showEvents(mMatchedEvents); listView->addTodos(mMatchedTodos); listView->addJournals(mMatchedJournals); if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { setCaption(i18n("No items found. Use '*' and '?' where needed.")); } else { 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); 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(), mEndDate->date(), false /*mInclusiveCheck->isChecked()*/ ); - if ( !mAddItems->isChecked() ) + if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { + if ( mRefineItems->isChecked() ) events = mMatchedEvents; mMatchedEvents.clear(); + } if ( mSearchEvent->isChecked() ) { Event *ev; for(ev=events.first();ev;ev=events.next()) { if (mSummaryCheck->isChecked()) { #if QT_VERSION >= 0x030000 if (re.search(ev->summary()) != -1) #else if (re.match(ev->summary()) != -1) #endif { + if ( mSubItems->isChecked() ) + mMatchedEvents.remove(ev); + else { + if ( !mMatchedEvents.contains( ev ) ) mMatchedEvents.append(ev); + } continue; } #if QT_VERSION >= 0x030000 if (re.search(ev->location()) != -1) #else if (re.match(ev->location()) != -1) #endif { + if ( mSubItems->isChecked() ) + mMatchedEvents.remove(ev); + else{ + if ( !mMatchedEvents.contains( ev ) ) mMatchedEvents.append(ev); + } continue; } } if (mDescriptionCheck->isChecked()) { #if QT_VERSION >= 0x030000 if (re.search(ev->description()) != -1) #else if (re.match(ev->description()) != -1) #endif { + if ( mSubItems->isChecked() ) + mMatchedEvents.remove(ev); + else{ + if ( !mMatchedEvents.contains( ev ) ) mMatchedEvents.append(ev); + } continue; } } if (mCategoryCheck->isChecked()) { #if QT_VERSION >= 0x030000 if (re.search(ev->categoriesStr()) != -1) #else if (re.match(ev->categoriesStr()) != -1) #endif { + + if ( mSubItems->isChecked() ) + mMatchedEvents.remove(ev); + else{ + if ( !mMatchedEvents.contains( ev ) ) mMatchedEvents.append(ev); + } continue; } } if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { QPtrList<Attendee> tmpAList = ev->attendees(); Attendee *a; for (a = tmpAList.first(); a; a = tmpAList.next()) { if (mSearchAName->isChecked()) { #if QT_VERSION >= 0x030000 if (re.search(a->name()) != -1) #else if (re.match(a->name()) != -1) #endif { + if ( mSubItems->isChecked() ) + mMatchedEvents.remove(ev); + else{ + if ( !mMatchedEvents.contains( ev ) ) mMatchedEvents.append(ev); + } break; } } if (mSearchAEmail->isChecked()) { #if QT_VERSION >= 0x030000 if (re.search(a->email()) != -1) #else if (re.match(a->email()) != -1) #endif { + if ( mSubItems->isChecked() ) + mMatchedEvents.remove(ev); + else{ + if ( !mMatchedEvents.contains( ev ) ) mMatchedEvents.append(ev); + } break; } } } } } } QPtrList<Todo> todos = mCalendar->todos( ); - if ( !mAddItems->isChecked() ) + + if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { + if ( mRefineItems->isChecked() ) todos = mMatchedTodos ; mMatchedTodos.clear(); + } + if ( mSearchTodo->isChecked() ) { Todo *tod; for(tod=todos.first();tod;tod=todos.next()) { if (mSummaryCheck->isChecked()) { #if QT_VERSION >= 0x030000 if (re.search(tod->summary()) != -1) #else if (re.match(tod->summary()) != -1) #endif { + if ( mSubItems->isChecked() ) + mMatchedTodos.remove(tod); + else if (!mMatchedTodos.contains( tod )) mMatchedTodos.append(tod); continue; } } if (mDescriptionCheck->isChecked()) { #if QT_VERSION >= 0x030000 if (re.search(tod->description()) != -1) #else if (re.match(tod->description()) != -1) #endif { + if ( mSubItems->isChecked() ) + mMatchedTodos.remove(tod); + else if (!mMatchedTodos.contains( tod )) mMatchedTodos.append(tod); continue; } } if (mCategoryCheck->isChecked()) { #if QT_VERSION >= 0x030000 if (re.search(tod->categoriesStr()) != -1) #else if (re.match(tod->categoriesStr()) != -1) #endif { + if ( mSubItems->isChecked() ) + mMatchedTodos.remove(tod); + else if (!mMatchedTodos.contains( tod )) mMatchedTodos.append(tod); continue; } } if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { QPtrList<Attendee> tmpAList = tod->attendees(); Attendee *a; for (a = tmpAList.first(); a; a = tmpAList.next()) { if (mSearchAName->isChecked()) { #if QT_VERSION >= 0x030000 if (re.search(a->name()) != -1) #else if (re.match(a->name()) != -1) #endif { + if ( mSubItems->isChecked() ) + mMatchedTodos.remove(tod); + else if (!mMatchedTodos.contains( tod )) mMatchedTodos.append(tod); break; } } if (mSearchAEmail->isChecked()) { #if QT_VERSION >= 0x030000 if (re.search(a->email()) != -1) #else if (re.match(a->email()) != -1) #endif { + if ( mSubItems->isChecked() ) + mMatchedTodos.remove(tod); + else if (!mMatchedTodos.contains( tod )) mMatchedTodos.append(tod); break; } } } } } } - 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; for(journ=journals.first();journ;journ=journals.next()) { if ( journ->dtStart().date() <= mEndDate->date() &&journ->dtStart().date() >= mStartDate->date()) { #if QT_VERSION >= 0x030000 if (re.search(journ->description()) != -1) #else if (re.match(journ->description()) != -1) #endif { + if ( mSubItems->isChecked() ) + mMatchedJournals.remove(journ); + else if (!mMatchedJournals.contains( journ )) mMatchedJournals.append(journ); continue; } } } } } void SearchDialog::keyPressEvent ( QKeyEvent *e) { switch ( e->key() ) { case Qt::Key_Escape: close(); break; case Qt::Key_F: if ( e->state() == Qt::ControlButton ) { } break; case Qt::Key_Return: case Qt::Key_Enter: doSearch(); break; default: e->ignore(); } } //mMatchedJournals; diff --git a/korganizer/searchdialog.h b/korganizer/searchdialog.h index b345b98..945ff65 100644 --- a/korganizer/searchdialog.h +++ b/korganizer/searchdialog.h @@ -1,99 +1,102 @@ /* This file is part of KOrganizer. Copyright (c) 1998 Preston Brown Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #ifndef SEARCHDIALOG_H #define SEARCHDIALOG_H #include <qregexp.h> - +#include <qradiobutton.h> #include <kdialogbase.h> #include <qvbox.h> #include <libkcal/calendar.h> #include "kolistview.h" class KDateEdit; class QCheckBox; class QLineEdit; class KLineEdit; class QLabel; class CalendarView; using namespace KCal; class SearchDialog : public QVBox { Q_OBJECT public: SearchDialog(Calendar *calendar,CalendarView *parent=0); virtual ~SearchDialog(); KOListView *listview(){ return listView;} void updateView(); void raiseAndSelect(); public slots: void changeEventDisplay(Event *, int) { updateView(); } void updateConfig(); void updateList(); protected slots: void setFocusToList(); void accept(); void doSearch(); void searchTextChanged( const QString &_text ); void toggleCheckboxes(); + void slot_add( bool ); + void slot_sub( bool ); + void slot_refine( bool ); signals: void showEventSignal(Event *); void editEventSignal(Event *); void deleteEventSignal(Event *); private: QHBox *incidenceGroup ,*subjectGroup ,*attendeeGroup; void search(const QRegExp &); Calendar *mCalendar; QPtrList<Event> mMatchedEvents; QPtrList<Todo> mMatchedTodos; QPtrList<Journal> mMatchedJournals; QLabel *searchLabel; KLineEdit *searchEdit; KOListView *listView; KDateEdit *mStartDate; KDateEdit *mEndDate; QCheckBox *mSummaryCheck; QCheckBox *mDescriptionCheck; QCheckBox *mCategoryCheck; QCheckBox *mSearchEvent; QCheckBox *mSearchTodo; QCheckBox *mSearchJournal; QCheckBox *mSearchAName; QCheckBox *mSearchAEmail; - QCheckBox *mAddItems; + QRadioButton *mAddItems, *mSubItems, *mRefineItems; void keyPressEvent ( QKeyEvent *e) ; }; #endif |