summaryrefslogtreecommitdiffabout
path: root/korganizer/searchdialog.cpp
Unidiff
Diffstat (limited to 'korganizer/searchdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/searchdialog.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 9cfdc35..105b844 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -1,186 +1,193 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qcheckbox.h> 26#include <qcheckbox.h>
27#include <qgroupbox.h> 27#include <q3groupbox.h>
28#include <qapplication.h> 28#include <qapplication.h>
29#include <QDesktopWidget>
29#include <qlabel.h> 30#include <qlabel.h>
30#include <qlistview.h> 31#include <q3listview.h>
31#include <qwhatsthis.h> 32#include <q3whatsthis.h>
32#include <qlineedit.h> 33#include <qlineedit.h>
33#include <qpushbutton.h> 34#include <qpushbutton.h>
34#include <qhbuttongroup.h> 35//#include <qhbuttongroup.h>
36//Added by qt3to4:
37#include <Q3HBoxLayout>
38#include <Q3Frame>
39#include <Q3PtrList>
40#include <QKeyEvent>
41#include <Q3VBoxLayout>
35#include <klocale.h> 42#include <klocale.h>
36#include <kmessagebox.h> 43#include <kmessagebox.h>
37 44
38#include <libkdepim/kdateedit.h> 45#include <libkdepim/kdateedit.h>
39 46
40#include "koglobals.h" 47#include "koglobals.h"
41#include "koprefs.h" 48#include "koprefs.h"
42#include "klineedit.h" 49#include "klineedit.h"
43 50
44#include "calendarview.h" 51#include "calendarview.h"
45#include "koviewmanager.h" 52#include "koviewmanager.h"
46#include "searchdialog.h" 53#include "searchdialog.h"
47 54
48SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) 55SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
49 : QVBox( 0 ) 56 : Q3VBox( 0 )
50 57
51{ 58{
52 mCalendar = calendar; 59 mCalendar = calendar;
53 QFrame *topFrame = new QFrame( this ) ;//plainPage(); 60 Q3Frame *topFrame = new Q3Frame( this ) ;//plainPage();
54 QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); 61 Q3VBoxLayout *layout = new Q3VBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint());
55 62
56 // Search expression 63 // Search expression
57 QHBoxLayout *subLayout = new QHBoxLayout(); 64 Q3HBoxLayout *subLayout = new Q3HBoxLayout();
58 layout->addLayout(subLayout); 65 layout->addLayout(subLayout);
59 /* 66 /*
60 searchLabel = new QLabel(topFrame); 67 searchLabel = new QLabel(topFrame);
61 searchLabel->setText(i18n("Search for:")); 68 searchLabel->setText(i18n("Search for:"));
62 subLayout->addWidget(searchLabel); 69 subLayout->addWidget(searchLabel);
63 */ 70 */
64 QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame ); 71 QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame );
65 //OkButton->setDefault( true ); 72 //OkButton->setDefault( true );
66 connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); 73 connect(OkButton,SIGNAL(clicked()),SLOT(doSearch()));
67 subLayout->addWidget(OkButton); 74 subLayout->addWidget(OkButton);
68 searchEdit = new KLineEdit(topFrame); 75 searchEdit = new KLineEdit(topFrame);
69 subLayout->addWidget(searchEdit); 76 subLayout->addWidget(searchEdit);
70 77
71 mAddItems = new QRadioButton( "+ ", topFrame ); 78 mAddItems = new QRadioButton( "+ ", topFrame );
72 mSubItems = new QRadioButton( "- ", topFrame ); 79 mSubItems = new QRadioButton( "- ", topFrame );
73 mRefineItems = new QRadioButton( "< ", topFrame ); 80 mRefineItems = new QRadioButton( "< ", topFrame );
74 subLayout->addWidget( mAddItems ); 81 subLayout->addWidget( mAddItems );
75 subLayout->addWidget( mSubItems ); 82 subLayout->addWidget( mSubItems );
76 subLayout->addWidget( mRefineItems ); 83 subLayout->addWidget( mRefineItems );
77 QFont fo ( mAddItems->font() ); 84 QFont fo ( mAddItems->font() );
78 fo.setBold( true ); 85 fo.setBold( true );
79 fo.setPointSize( fo.pointSize() + 2 ); 86 fo.setPointSize( fo.pointSize() + 2 );
80 mAddItems->setFont( fo ); 87 mAddItems->setFont( fo );
81 mSubItems->setFont( fo ); 88 mSubItems->setFont( fo );
82 mRefineItems->setFont( fo ); 89 mRefineItems->setFont( fo );
83 connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool ))); 90 connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool )));
84 connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool ))); 91 connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool )));
85 connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); 92 connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool )));
86 93
87 QPushButton *togButton = new QPushButton( "", topFrame ); 94 QPushButton *togButton = new QPushButton( "", topFrame );
88 subLayout->addWidget(togButton); 95 subLayout->addWidget(togButton);
89 connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); 96 connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes()));
90 togButton->setPixmap(SmallIcon("1updownarrow")); 97 togButton->setPixmap(SmallIcon("1updownarrow"));
91 togButton->setMinimumWidth( togButton->sizeHint().height() ); 98 togButton->setMinimumWidth( togButton->sizeHint().height() );
92 99
93 searchEdit->setText("*"); // Find all events by default 100 searchEdit->setText("*"); // Find all events by default
94 searchEdit->setFocus(); 101 searchEdit->setFocus();
95 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); 102 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & )));
96 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); 103 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch()));
97 // Subjects to search 104 // Subjects to search
98 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), 105 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"),
99 // topFrame); 106 // topFrame);
100 107
101 incidenceGroup = new QHBox( topFrame ); 108 incidenceGroup = new Q3HBox( topFrame );
102 layout->addWidget(incidenceGroup); 109 layout->addWidget(incidenceGroup);
103 110
104 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); 111 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup);
105 //mSearchEvent->setChecked(true); 112 //mSearchEvent->setChecked(true);
106 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); 113 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup);
107 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); 114 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup);
108 115
109 subjectGroup = new QHBox( topFrame ); 116 subjectGroup = new Q3HBox( topFrame );
110 layout->addWidget(subjectGroup); 117 layout->addWidget(subjectGroup);
111 118
112 mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); 119 mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup);
113 mSummaryCheck->setChecked(true); 120 mSummaryCheck->setChecked(true);
114 mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); 121 mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup);
115 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); 122 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup);
116 123
117 attendeeGroup = new QHBox( topFrame ); 124 attendeeGroup = new Q3HBox( topFrame );
118 layout->addWidget(attendeeGroup ); 125 layout->addWidget(attendeeGroup );
119 new QLabel( i18n("Attendee:"),attendeeGroup ); 126 new QLabel( i18n("Attendee:"),attendeeGroup );
120 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); 127 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup );
121 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); 128 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup );
122 // Date range 129 // Date range
123 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), 130 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"),
124 // topFrame); 131 // topFrame);
125 // layout->addWidget(rangeGroup); 132 // layout->addWidget(rangeGroup);
126 133
127 QWidget *rangeWidget = new QWidget(topFrame); 134 QWidget *rangeWidget = new QWidget(topFrame);
128 int space = KDialog::spacingHint(); 135 int space = KDialog::spacingHint();
129 if ( QApplication::desktop()->width() <= 240 ) space = 1; 136 if ( QApplication::desktop()->width() <= 240 ) space = 1;
130 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,space); 137 Q3HBoxLayout *rangeLayout = new Q3HBoxLayout(rangeWidget,0,space);
131 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); 138 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget));
132 mStartDate = new KDateEdit(rangeWidget); 139 mStartDate = new KDateEdit(rangeWidget);
133 rangeLayout->addWidget(mStartDate); 140 rangeLayout->addWidget(mStartDate);
134 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); 141 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget));
135 mEndDate = new KDateEdit(rangeWidget); 142 mEndDate = new KDateEdit(rangeWidget);
136 mEndDate->setDate(QDate::currentDate().addDays(365)); 143 mEndDate->setDate(QDate::currentDate().addDays(365));
137 rangeLayout->addWidget(mEndDate); 144 rangeLayout->addWidget(mEndDate);
138 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); 145 QToolButton *wt = Q3WhatsThis::whatsThisButton ( rangeWidget );
139 rangeLayout->addWidget( (QWidget*)wt ); 146 rangeLayout->addWidget( (QWidget*)wt );
140 layout->addWidget(rangeWidget); 147 layout->addWidget(rangeWidget);
141 // Results list view 148 // Results list view
142 listView = new KOListView(mCalendar,topFrame); 149 listView = new KOListView(mCalendar,topFrame);
143 layout->addWidget(listView); 150 layout->addWidget(listView);
144 listView->showCompletedTodos(); 151 listView->showCompletedTodos();
145 //layout->setStretchFactor( listView, 333 ); 152 //layout->setStretchFactor( listView, 333 );
146 //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); 153 //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) );
147 //listView->setMaximumHeight( 50 ); 154 //listView->setMaximumHeight( 50 );
148 listView->readSettings(KOGlobals::config(),"SearchListView Layout"); 155 listView->readSettings(KOGlobals::config(),"SearchListView Layout");
149 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); 156 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList()));
150 157
151 setCaption( i18n("KO/Pi Find: ")); 158 setCaption( i18n("KO/Pi Find: "));
152#ifdef DESKTOP_VERSION 159#ifdef DESKTOP_VERSION
153 OkButton = new QPushButton( i18n("Close"), this ); 160 OkButton = new QPushButton( i18n("Close"), this );
154 connect(OkButton,SIGNAL(clicked()),SLOT(hide())); 161 connect(OkButton,SIGNAL(clicked()),SLOT(hide()));
155#endif 162#endif
156} 163}
157 164
158SearchDialog::~SearchDialog() 165SearchDialog::~SearchDialog()
159{ 166{
160 167
161} 168}
162void SearchDialog::slot_add( bool b ) 169void SearchDialog::slot_add( bool b )
163{ 170{
164 if ( b ) { 171 if ( b ) {
165 if ( mSubItems->isOn() ) mSubItems->toggle(); 172 if ( mSubItems->isOn() ) mSubItems->toggle();
166 if ( mRefineItems->isOn() ) mRefineItems->toggle(); 173 if ( mRefineItems->isOn() ) mRefineItems->toggle();
167 setCaption( i18n("Matching items will be added to list")); 174 setCaption( i18n("Matching items will be added to list"));
168 } else 175 } else
169 setCaption( i18n("List will be cleared before search")); 176 setCaption( i18n("List will be cleared before search"));
170} 177}
171void SearchDialog::slot_sub( bool b) 178void SearchDialog::slot_sub( bool b)
172{ 179{
173 if ( b ) { 180 if ( b ) {
174 if ( mRefineItems->isOn() ) mRefineItems->toggle(); 181 if ( mRefineItems->isOn() ) mRefineItems->toggle();
175 if ( mAddItems->isOn() ) mAddItems->toggle(); 182 if ( mAddItems->isOn() ) mAddItems->toggle();
176 setCaption( i18n("Matching items will be removed from list")); 183 setCaption( i18n("Matching items will be removed from list"));
177 } else 184 } else
178 setCaption( i18n("List will be cleared before search")); 185 setCaption( i18n("List will be cleared before search"));
179} 186}
180void SearchDialog::slot_refine( bool b) 187void SearchDialog::slot_refine( bool b)
181{ 188{
182 if ( b ) { 189 if ( b ) {
183 if ( mSubItems->isOn() ) mSubItems->toggle(); 190 if ( mSubItems->isOn() ) mSubItems->toggle();
184 if ( mAddItems->isOn() ) mAddItems->toggle(); 191 if ( mAddItems->isOn() ) mAddItems->toggle();
185 setCaption( i18n("Search on displayed list only")); 192 setCaption( i18n("Search on displayed list only"));
186 } else 193 } else
@@ -296,304 +303,304 @@ void SearchDialog::doSearch()
296 "the search.\nPlease enter a search expression\n" 303 "the search.\nPlease enter a search expression\n"
297 "using the wildcard characters\n '*' and '?'" 304 "using the wildcard characters\n '*' and '?'"
298 "where needed.")); 305 "where needed."));
299 return; 306 return;
300 } 307 }
301 search(re); 308 search(re);
302 listView->setStartDate( mStartDate->date() ); 309 listView->setStartDate( mStartDate->date() );
303 listView->showEvents(mMatchedEvents); 310 listView->showEvents(mMatchedEvents);
304 listView->addTodos(mMatchedTodos); 311 listView->addTodos(mMatchedTodos);
305 listView->addJournals(mMatchedJournals); 312 listView->addJournals(mMatchedJournals);
306 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { 313 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) {
307 setCaption(i18n("No items found. Use '*' and '?' where needed.")); 314 setCaption(i18n("No items found. Use '*' and '?' where needed."));
308 } else { 315 } else {
309 QString mess; 316 QString mess;
310 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); 317 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() );
311 setCaption( i18n("KO/Pi Find: ") + mess); 318 setCaption( i18n("KO/Pi Find: ") + mess);
312 319
313 } 320 }
314 searchEdit->setFocus(); 321 searchEdit->setFocus();
315} 322}
316void SearchDialog::updateConfig() 323void SearchDialog::updateConfig()
317{ 324{
318 listView->updateConfig(); 325 listView->updateConfig();
319} 326}
320void SearchDialog::updateView() 327void SearchDialog::updateView()
321{ 328{
322 //qDebug("SearchDialog::updateView() %d ", isVisible()); 329 //qDebug("SearchDialog::updateView() %d ", isVisible());
323 QRegExp re; 330 QRegExp re;
324 re.setWildcard(true); // most people understand these better. 331 re.setWildcard(true); // most people understand these better.
325 re.setCaseSensitive(false); 332 re.setCaseSensitive(false);
326 QString st = searchEdit->text(); 333 QString st = searchEdit->text();
327 if ( st.right(1) != "*") 334 if ( st.right(1) != "*")
328 st += "*"; 335 st += "*";
329 re.setPattern(st); 336 re.setPattern(st);
330 mMatchedEvents.clear(); 337 mMatchedEvents.clear();
331 mMatchedTodos.clear(); 338 mMatchedTodos.clear();
332 mMatchedJournals.clear(); 339 mMatchedJournals.clear();
333 if (re.isValid()) { 340 if (re.isValid()) {
334 search(re); 341 search(re);
335 } 342 }
336 listView->setStartDate( mStartDate->date() ); 343 listView->setStartDate( mStartDate->date() );
337 listView->showEvents(mMatchedEvents); 344 listView->showEvents(mMatchedEvents);
338 listView->addTodos(mMatchedTodos); 345 listView->addTodos(mMatchedTodos);
339 listView->addJournals(mMatchedJournals); 346 listView->addJournals(mMatchedJournals);
340} 347}
341 348
342void SearchDialog::search(const QRegExp &re) 349void SearchDialog::search(const QRegExp &re)
343{ 350{
344 QPtrList<Event> events; 351 Q3PtrList<Event> events;
345 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { 352 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
346 if ( mRefineItems->isChecked() ) events = mMatchedEvents; 353 if ( mRefineItems->isChecked() ) events = mMatchedEvents;
347 mMatchedEvents.clear(); 354 mMatchedEvents.clear();
348 } 355 }
349 if ( mSearchEvent->isChecked() ) { 356 if ( mSearchEvent->isChecked() ) {
350 if ( !mRefineItems->isChecked() ) 357 if ( !mRefineItems->isChecked() )
351 events = mCalendar->events( mStartDate->date(), 358 events = mCalendar->events( mStartDate->date(),
352 mEndDate->date(), 359 mEndDate->date(),
353 false /*mInclusiveCheck->isChecked()*/ ); 360 false /*mInclusiveCheck->isChecked()*/ );
354 361
355 362
356 Event *ev; 363 Event *ev;
357 for(ev=events.first();ev;ev=events.next()) { 364 for(ev=events.first();ev;ev=events.next()) {
358 if (mSummaryCheck->isChecked()) { 365 if (mSummaryCheck->isChecked()) {
359#if QT_VERSION >= 0x030000 366#if QT_VERSION >= 0x030000
360 if (re.search(ev->summary()) != -1) 367 if (re.search(ev->summary()) != -1)
361#else 368#else
362 if (re.match(ev->summary()) != -1) 369 if (re.match(ev->summary()) != -1)
363#endif 370#endif
364 { 371 {
365 if ( mSubItems->isChecked() ) 372 if ( mSubItems->isChecked() )
366 mMatchedEvents.remove(ev); 373 mMatchedEvents.remove(ev);
367 else { 374 else {
368 if ( !mMatchedEvents.contains( ev ) ) 375 if ( !mMatchedEvents.contains( ev ) )
369 mMatchedEvents.append(ev); 376 mMatchedEvents.append(ev);
370 } 377 }
371 continue; 378 continue;
372 } 379 }
373#if QT_VERSION >= 0x030000 380#if QT_VERSION >= 0x030000
374 if (re.search(ev->location()) != -1) 381 if (re.search(ev->location()) != -1)
375#else 382#else
376 if (re.match(ev->location()) != -1) 383 if (re.match(ev->location()) != -1)
377#endif 384#endif
378 { 385 {
379 if ( mSubItems->isChecked() ) 386 if ( mSubItems->isChecked() )
380 mMatchedEvents.remove(ev); 387 mMatchedEvents.remove(ev);
381 else{ 388 else{
382 if ( !mMatchedEvents.contains( ev ) ) 389 if ( !mMatchedEvents.contains( ev ) )
383 mMatchedEvents.append(ev); 390 mMatchedEvents.append(ev);
384 } 391 }
385 continue; 392 continue;
386 } 393 }
387 } 394 }
388 if (mDescriptionCheck->isChecked()) { 395 if (mDescriptionCheck->isChecked()) {
389#if QT_VERSION >= 0x030000 396#if QT_VERSION >= 0x030000
390 if (re.search(ev->description()) != -1) 397 if (re.search(ev->description()) != -1)
391#else 398#else
392 if (re.match(ev->description()) != -1) 399 if (re.match(ev->description()) != -1)
393#endif 400#endif
394 { 401 {
395 if ( mSubItems->isChecked() ) 402 if ( mSubItems->isChecked() )
396 mMatchedEvents.remove(ev); 403 mMatchedEvents.remove(ev);
397 else{ 404 else{
398 if ( !mMatchedEvents.contains( ev ) ) 405 if ( !mMatchedEvents.contains( ev ) )
399 mMatchedEvents.append(ev); 406 mMatchedEvents.append(ev);
400 } 407 }
401 continue; 408 continue;
402 } 409 }
403 } 410 }
404 if (mCategoryCheck->isChecked()) { 411 if (mCategoryCheck->isChecked()) {
405#if QT_VERSION >= 0x030000 412#if QT_VERSION >= 0x030000
406 if (re.search(ev->categoriesStr()) != -1) 413 if (re.search(ev->categoriesStr()) != -1)
407#else 414#else
408 if (re.match(ev->categoriesStr()) != -1) 415 if (re.match(ev->categoriesStr()) != -1)
409#endif 416#endif
410 { 417 {
411 418
412 if ( mSubItems->isChecked() ) 419 if ( mSubItems->isChecked() )
413 mMatchedEvents.remove(ev); 420 mMatchedEvents.remove(ev);
414 else{ 421 else{
415 if ( !mMatchedEvents.contains( ev ) ) 422 if ( !mMatchedEvents.contains( ev ) )
416 mMatchedEvents.append(ev); 423 mMatchedEvents.append(ev);
417 } 424 }
418 continue; 425 continue;
419 } 426 }
420 } 427 }
421 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 428 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
422 QPtrList<Attendee> tmpAList = ev->attendees(); 429 Q3PtrList<Attendee> tmpAList = ev->attendees();
423 Attendee *a; 430 Attendee *a;
424 for (a = tmpAList.first(); a; a = tmpAList.next()) { 431 for (a = tmpAList.first(); a; a = tmpAList.next()) {
425 if (mSearchAName->isChecked()) { 432 if (mSearchAName->isChecked()) {
426#if QT_VERSION >= 0x030000 433#if QT_VERSION >= 0x030000
427 if (re.search(a->name()) != -1) 434 if (re.search(a->name()) != -1)
428#else 435#else
429 if (re.match(a->name()) != -1) 436 if (re.match(a->name()) != -1)
430#endif 437#endif
431 { 438 {
432 if ( mSubItems->isChecked() ) 439 if ( mSubItems->isChecked() )
433 mMatchedEvents.remove(ev); 440 mMatchedEvents.remove(ev);
434 else{ 441 else{
435 if ( !mMatchedEvents.contains( ev ) ) 442 if ( !mMatchedEvents.contains( ev ) )
436 mMatchedEvents.append(ev); 443 mMatchedEvents.append(ev);
437 } 444 }
438 break; 445 break;
439 } 446 }
440 } 447 }
441 if (mSearchAEmail->isChecked()) { 448 if (mSearchAEmail->isChecked()) {
442#if QT_VERSION >= 0x030000 449#if QT_VERSION >= 0x030000
443 if (re.search(a->email()) != -1) 450 if (re.search(a->email()) != -1)
444#else 451#else
445 if (re.match(a->email()) != -1) 452 if (re.match(a->email()) != -1)
446#endif 453#endif
447 { 454 {
448 if ( mSubItems->isChecked() ) 455 if ( mSubItems->isChecked() )
449 mMatchedEvents.remove(ev); 456 mMatchedEvents.remove(ev);
450 else{ 457 else{
451 if ( !mMatchedEvents.contains( ev ) ) 458 if ( !mMatchedEvents.contains( ev ) )
452 mMatchedEvents.append(ev); 459 mMatchedEvents.append(ev);
453 } 460 }
454 break; 461 break;
455 } 462 }
456 } 463 }
457 } 464 }
458 } 465 }
459 } 466 }
460 } 467 }
461 QPtrList<Todo> todos; 468 Q3PtrList<Todo> todos;
462 469
463 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { 470 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
464 if ( mRefineItems->isChecked() ) todos = mMatchedTodos ; 471 if ( mRefineItems->isChecked() ) todos = mMatchedTodos ;
465 mMatchedTodos.clear(); 472 mMatchedTodos.clear();
466 } 473 }
467 474
468 if ( mSearchTodo->isChecked() ) { 475 if ( mSearchTodo->isChecked() ) {
469 if ( !mRefineItems->isChecked() ) todos = mCalendar->todos( ); 476 if ( !mRefineItems->isChecked() ) todos = mCalendar->todos( );
470 Todo *tod; 477 Todo *tod;
471 for(tod=todos.first();tod;tod=todos.next()) { 478 for(tod=todos.first();tod;tod=todos.next()) {
472 if (mSummaryCheck->isChecked()) { 479 if (mSummaryCheck->isChecked()) {
473#if QT_VERSION >= 0x030000 480#if QT_VERSION >= 0x030000
474 if (re.search(tod->summary()) != -1) 481 if (re.search(tod->summary()) != -1)
475#else 482#else
476 if (re.match(tod->summary()) != -1) 483 if (re.match(tod->summary()) != -1)
477#endif 484#endif
478 { 485 {
479 if ( mSubItems->isChecked() ) 486 if ( mSubItems->isChecked() )
480 mMatchedTodos.remove(tod); 487 mMatchedTodos.remove(tod);
481 else if (!mMatchedTodos.contains( tod )) 488 else if (!mMatchedTodos.contains( tod ))
482 mMatchedTodos.append(tod); 489 mMatchedTodos.append(tod);
483 continue; 490 continue;
484 } 491 }
485 } 492 }
486 if (mDescriptionCheck->isChecked()) { 493 if (mDescriptionCheck->isChecked()) {
487#if QT_VERSION >= 0x030000 494#if QT_VERSION >= 0x030000
488 if (re.search(tod->description()) != -1) 495 if (re.search(tod->description()) != -1)
489#else 496#else
490 if (re.match(tod->description()) != -1) 497 if (re.match(tod->description()) != -1)
491#endif 498#endif
492 { 499 {
493 if ( mSubItems->isChecked() ) 500 if ( mSubItems->isChecked() )
494 mMatchedTodos.remove(tod); 501 mMatchedTodos.remove(tod);
495 else if (!mMatchedTodos.contains( tod )) 502 else if (!mMatchedTodos.contains( tod ))
496 mMatchedTodos.append(tod); 503 mMatchedTodos.append(tod);
497 continue; 504 continue;
498 } 505 }
499 } 506 }
500 if (mCategoryCheck->isChecked()) { 507 if (mCategoryCheck->isChecked()) {
501#if QT_VERSION >= 0x030000 508#if QT_VERSION >= 0x030000
502 if (re.search(tod->categoriesStr()) != -1) 509 if (re.search(tod->categoriesStr()) != -1)
503#else 510#else
504 if (re.match(tod->categoriesStr()) != -1) 511 if (re.match(tod->categoriesStr()) != -1)
505#endif 512#endif
506 { 513 {
507 if ( mSubItems->isChecked() ) 514 if ( mSubItems->isChecked() )
508 mMatchedTodos.remove(tod); 515 mMatchedTodos.remove(tod);
509 else if (!mMatchedTodos.contains( tod )) 516 else if (!mMatchedTodos.contains( tod ))
510 mMatchedTodos.append(tod); 517 mMatchedTodos.append(tod);
511 continue; 518 continue;
512 } 519 }
513 } 520 }
514 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 521 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
515 QPtrList<Attendee> tmpAList = tod->attendees(); 522 Q3PtrList<Attendee> tmpAList = tod->attendees();
516 Attendee *a; 523 Attendee *a;
517 for (a = tmpAList.first(); a; a = tmpAList.next()) { 524 for (a = tmpAList.first(); a; a = tmpAList.next()) {
518 if (mSearchAName->isChecked()) { 525 if (mSearchAName->isChecked()) {
519#if QT_VERSION >= 0x030000 526#if QT_VERSION >= 0x030000
520 if (re.search(a->name()) != -1) 527 if (re.search(a->name()) != -1)
521#else 528#else
522 if (re.match(a->name()) != -1) 529 if (re.match(a->name()) != -1)
523#endif 530#endif
524 { 531 {
525 if ( mSubItems->isChecked() ) 532 if ( mSubItems->isChecked() )
526 mMatchedTodos.remove(tod); 533 mMatchedTodos.remove(tod);
527 else if (!mMatchedTodos.contains( tod )) 534 else if (!mMatchedTodos.contains( tod ))
528 mMatchedTodos.append(tod); 535 mMatchedTodos.append(tod);
529 break; 536 break;
530 } 537 }
531 } 538 }
532 if (mSearchAEmail->isChecked()) { 539 if (mSearchAEmail->isChecked()) {
533#if QT_VERSION >= 0x030000 540#if QT_VERSION >= 0x030000
534 if (re.search(a->email()) != -1) 541 if (re.search(a->email()) != -1)
535#else 542#else
536 if (re.match(a->email()) != -1) 543 if (re.match(a->email()) != -1)
537#endif 544#endif
538 { 545 {
539 if ( mSubItems->isChecked() ) 546 if ( mSubItems->isChecked() )
540 mMatchedTodos.remove(tod); 547 mMatchedTodos.remove(tod);
541 else if (!mMatchedTodos.contains( tod )) 548 else if (!mMatchedTodos.contains( tod ))
542 mMatchedTodos.append(tod); 549 mMatchedTodos.append(tod);
543 break; 550 break;
544 } 551 }
545 } 552 }
546 } 553 }
547 } 554 }
548 } 555 }
549 } 556 }
550 557
551 QPtrList<Journal> journals; 558 Q3PtrList<Journal> journals;
552 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { 559 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
553 if ( mRefineItems->isChecked() ) journals = mMatchedJournals ; 560 if ( mRefineItems->isChecked() ) journals = mMatchedJournals ;
554 mMatchedJournals.clear(); 561 mMatchedJournals.clear();
555 } 562 }
556 if (mSearchJournal->isChecked() ) { 563 if (mSearchJournal->isChecked() ) {
557 if ( ! mRefineItems->isChecked() ) journals = mCalendar->journals(); 564 if ( ! mRefineItems->isChecked() ) journals = mCalendar->journals();
558 Journal* journ; 565 Journal* journ;
559 566
560 for(journ=journals.first();journ;journ=journals.next()) { 567 for(journ=journals.first();journ;journ=journals.next()) {
561 if ( journ->dtStart().date() <= mEndDate->date() 568 if ( journ->dtStart().date() <= mEndDate->date()
562 &&journ->dtStart().date() >= mStartDate->date()) { 569 &&journ->dtStart().date() >= mStartDate->date()) {
563 if (mDescriptionCheck->isChecked()) { 570 if (mDescriptionCheck->isChecked()) {
564#if QT_VERSION >= 0x030000 571#if QT_VERSION >= 0x030000
565 if (re.search(journ->description()) != -1) 572 if (re.search(journ->description()) != -1)
566#else 573#else
567 if (re.match(journ->description()) != -1) 574 if (re.match(journ->description()) != -1)
568#endif 575#endif
569 { 576 {
570 if ( mSubItems->isChecked() ) 577 if ( mSubItems->isChecked() )
571 mMatchedJournals.remove(journ); 578 mMatchedJournals.remove(journ);
572 else if (!mMatchedJournals.contains( journ )) 579 else if (!mMatchedJournals.contains( journ ))
573 mMatchedJournals.append(journ); 580 mMatchedJournals.append(journ);
574 continue; 581 continue;
575 } 582 }
576 } 583 }
577 if (mSummaryCheck->isChecked()) { 584 if (mSummaryCheck->isChecked()) {
578#if QT_VERSION >= 0x030000 585#if QT_VERSION >= 0x030000
579 if (re.search(journ->summary()) != -1) 586 if (re.search(journ->summary()) != -1)
580#else 587#else
581 if (re.match(journ->summary()) != -1) 588 if (re.match(journ->summary()) != -1)
582#endif 589#endif
583 { 590 {
584 if ( mSubItems->isChecked() ) 591 if ( mSubItems->isChecked() )
585 mMatchedJournals.remove(journ); 592 mMatchedJournals.remove(journ);
586 else if (!mMatchedJournals.contains( journ )) 593 else if (!mMatchedJournals.contains( journ ))
587 mMatchedJournals.append(journ); 594 mMatchedJournals.append(journ);
588 continue; 595 continue;
589 } 596 }
590 } 597 }
591 } 598 }
592 } 599 }
593 } 600 }
594 if ( mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() < 1 ) { 601 if ( mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() < 1 ) {
595 qDebug("count %d ", mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() ); 602 qDebug("count %d ", mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() );
596 if ( mRefineItems->isChecked() ) 603 if ( mRefineItems->isChecked() )
597 mRefineItems->setChecked( false ); 604 mRefineItems->setChecked( false );
598 else if ( mSubItems->isChecked() ) 605 else if ( mSubItems->isChecked() )
599 mSubItems->setChecked( false ); 606 mSubItems->setChecked( false );