author | zautrix <zautrix> | 2005-06-25 01:34:43 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-25 01:34:43 (UTC) |
commit | ab93fa0a7cd97beada9475f6099bf6083547f0d6 (patch) (unidiff) | |
tree | c983cb818528cac200a98585b3451c0371389e52 | |
parent | ce9c31a057f12a8d6a126a7312e4ecaf3270da50 (diff) | |
download | kdepimpi-ab93fa0a7cd97beada9475f6099bf6083547f0d6.zip kdepimpi-ab93fa0a7cd97beada9475f6099bf6083547f0d6.tar.gz kdepimpi-ab93fa0a7cd97beada9475f6099bf6083547f0d6.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/searchdialog.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 0713980..2390520 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -1,594 +1,600 @@ | |||
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 <qgroupbox.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlistview.h> | 29 | #include <qlistview.h> |
30 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | #include <qhbuttongroup.h> | 33 | #include <qhbuttongroup.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
36 | 36 | ||
37 | #include <libkdepim/kdateedit.h> | 37 | #include <libkdepim/kdateedit.h> |
38 | 38 | ||
39 | #include "koglobals.h" | 39 | #include "koglobals.h" |
40 | #include "koprefs.h" | 40 | #include "koprefs.h" |
41 | #include "klineedit.h" | 41 | #include "klineedit.h" |
42 | 42 | ||
43 | #include "calendarview.h" | 43 | #include "calendarview.h" |
44 | #include "koviewmanager.h" | 44 | #include "koviewmanager.h" |
45 | #include "searchdialog.h" | 45 | #include "searchdialog.h" |
46 | 46 | ||
47 | SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) | 47 | SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) |
48 | : QVBox( 0 ) | 48 | : QVBox( 0 ) |
49 | 49 | ||
50 | { | 50 | { |
51 | mCalendar = calendar; | 51 | mCalendar = calendar; |
52 | QFrame *topFrame = new QFrame( this ) ;//plainPage(); | 52 | QFrame *topFrame = new QFrame( this ) ;//plainPage(); |
53 | QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); | 53 | QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); |
54 | 54 | ||
55 | // Search expression | 55 | // Search expression |
56 | QHBoxLayout *subLayout = new QHBoxLayout(); | 56 | QHBoxLayout *subLayout = new QHBoxLayout(); |
57 | layout->addLayout(subLayout); | 57 | layout->addLayout(subLayout); |
58 | /* | 58 | /* |
59 | searchLabel = new QLabel(topFrame); | 59 | searchLabel = new QLabel(topFrame); |
60 | searchLabel->setText(i18n("Search for:")); | 60 | searchLabel->setText(i18n("Search for:")); |
61 | subLayout->addWidget(searchLabel); | 61 | subLayout->addWidget(searchLabel); |
62 | */ | 62 | */ |
63 | QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame ); | 63 | QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame ); |
64 | //OkButton->setDefault( true ); | 64 | //OkButton->setDefault( true ); |
65 | connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); | 65 | connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); |
66 | subLayout->addWidget(OkButton); | 66 | subLayout->addWidget(OkButton); |
67 | searchEdit = new KLineEdit(topFrame); | 67 | searchEdit = new KLineEdit(topFrame); |
68 | subLayout->addWidget(searchEdit); | 68 | subLayout->addWidget(searchEdit); |
69 | 69 | ||
70 | mAddItems = new QRadioButton( "+ ", topFrame ); | 70 | mAddItems = new QRadioButton( "+ ", topFrame ); |
71 | mSubItems = new QRadioButton( "- ", topFrame ); | 71 | mSubItems = new QRadioButton( "- ", topFrame ); |
72 | mRefineItems = new QRadioButton( "< ", topFrame ); | 72 | mRefineItems = new QRadioButton( "< ", topFrame ); |
73 | subLayout->addWidget( mAddItems ); | 73 | subLayout->addWidget( mAddItems ); |
74 | subLayout->addWidget( mSubItems ); | 74 | subLayout->addWidget( mSubItems ); |
75 | subLayout->addWidget( mRefineItems ); | 75 | subLayout->addWidget( mRefineItems ); |
76 | QFont fo ( mAddItems->font() ); | 76 | QFont fo ( mAddItems->font() ); |
77 | fo.setBold( true ); | 77 | fo.setBold( true ); |
78 | fo.setPointSize( fo.pointSize() + 2 ); | 78 | fo.setPointSize( fo.pointSize() + 2 ); |
79 | mAddItems->setFont( fo ); | 79 | mAddItems->setFont( fo ); |
80 | mSubItems->setFont( fo ); | 80 | mSubItems->setFont( fo ); |
81 | mRefineItems->setFont( fo ); | 81 | mRefineItems->setFont( fo ); |
82 | connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool ))); | 82 | connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool ))); |
83 | connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool ))); | 83 | connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool ))); |
84 | connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); | 84 | connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); |
85 | 85 | ||
86 | QPushButton *togButton = new QPushButton( "", topFrame ); | 86 | QPushButton *togButton = new QPushButton( "", topFrame ); |
87 | subLayout->addWidget(togButton); | 87 | subLayout->addWidget(togButton); |
88 | connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); | 88 | connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); |
89 | togButton->setPixmap(SmallIcon("1updownarrow")); | 89 | togButton->setPixmap(SmallIcon("1updownarrow")); |
90 | togButton->setMinimumWidth( togButton->sizeHint().height() ); | 90 | togButton->setMinimumWidth( togButton->sizeHint().height() ); |
91 | 91 | ||
92 | searchEdit->setText("*"); // Find all events by default | 92 | searchEdit->setText("*"); // Find all events by default |
93 | searchEdit->setFocus(); | 93 | searchEdit->setFocus(); |
94 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); | 94 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); |
95 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); | 95 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); |
96 | // Subjects to search | 96 | // Subjects to search |
97 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), | 97 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), |
98 | // topFrame); | 98 | // topFrame); |
99 | 99 | ||
100 | incidenceGroup = new QHBox( topFrame ); | 100 | incidenceGroup = new QHBox( topFrame ); |
101 | layout->addWidget(incidenceGroup); | 101 | layout->addWidget(incidenceGroup); |
102 | 102 | ||
103 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); | 103 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); |
104 | //mSearchEvent->setChecked(true); | 104 | //mSearchEvent->setChecked(true); |
105 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); | 105 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); |
106 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); | 106 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); |
107 | 107 | ||
108 | subjectGroup = new QHBox( topFrame ); | 108 | subjectGroup = new QHBox( topFrame ); |
109 | layout->addWidget(subjectGroup); | 109 | layout->addWidget(subjectGroup); |
110 | 110 | ||
111 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); | 111 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); |
112 | mSummaryCheck->setChecked(true); | 112 | mSummaryCheck->setChecked(true); |
113 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); | 113 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); |
114 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); | 114 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); |
115 | 115 | ||
116 | attendeeGroup = new QHBox( topFrame ); | 116 | attendeeGroup = new QHBox( topFrame ); |
117 | layout->addWidget(attendeeGroup ); | 117 | layout->addWidget(attendeeGroup ); |
118 | new QLabel( i18n("Attendee:"),attendeeGroup ); | 118 | new QLabel( i18n("Attendee:"),attendeeGroup ); |
119 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); | 119 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); |
120 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); | 120 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); |
121 | // Date range | 121 | // Date range |
122 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), | 122 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), |
123 | // topFrame); | 123 | // topFrame); |
124 | // layout->addWidget(rangeGroup); | 124 | // layout->addWidget(rangeGroup); |
125 | 125 | ||
126 | QWidget *rangeWidget = new QWidget(topFrame); | 126 | QWidget *rangeWidget = new QWidget(topFrame); |
127 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); | 127 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); |
128 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); | 128 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); |
129 | mStartDate = new KDateEdit(rangeWidget); | 129 | mStartDate = new KDateEdit(rangeWidget); |
130 | rangeLayout->addWidget(mStartDate); | 130 | rangeLayout->addWidget(mStartDate); |
131 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); | 131 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); |
132 | mEndDate = new KDateEdit(rangeWidget); | 132 | mEndDate = new KDateEdit(rangeWidget); |
133 | mEndDate->setDate(QDate::currentDate().addDays(365)); | 133 | mEndDate->setDate(QDate::currentDate().addDays(365)); |
134 | rangeLayout->addWidget(mEndDate); | 134 | rangeLayout->addWidget(mEndDate); |
135 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); | 135 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); |
136 | rangeLayout->addWidget( (QWidget*)wt ); | 136 | rangeLayout->addWidget( (QWidget*)wt ); |
137 | layout->addWidget(rangeWidget); | 137 | layout->addWidget(rangeWidget); |
138 | // Results list view | 138 | // Results list view |
139 | listView = new KOListView(mCalendar,topFrame); | 139 | listView = new KOListView(mCalendar,topFrame); |
140 | layout->addWidget(listView); | 140 | layout->addWidget(listView); |
141 | listView->showCompletedTodos(); | 141 | listView->showCompletedTodos(); |
142 | //layout->setStretchFactor( listView, 333 ); | 142 | //layout->setStretchFactor( listView, 333 ); |
143 | //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); | 143 | //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); |
144 | //listView->setMaximumHeight( 50 ); | 144 | //listView->setMaximumHeight( 50 ); |
145 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); | 145 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); |
146 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); | 146 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); |
147 | 147 | ||
148 | setCaption( i18n("KO/Pi Find: ")); | 148 | setCaption( i18n("KO/Pi Find: ")); |
149 | #ifdef DESKTOP_VERSION | 149 | #ifdef DESKTOP_VERSION |
150 | OkButton = new QPushButton( i18n("Close"), this ); | 150 | OkButton = new QPushButton( i18n("Close"), this ); |
151 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); | 151 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); |
152 | #endif | 152 | #endif |
153 | } | 153 | } |
154 | 154 | ||
155 | SearchDialog::~SearchDialog() | 155 | SearchDialog::~SearchDialog() |
156 | { | 156 | { |
157 | 157 | ||
158 | } | 158 | } |
159 | void SearchDialog::slot_add( bool b ) | 159 | void SearchDialog::slot_add( bool b ) |
160 | { | 160 | { |
161 | if ( b ) { | 161 | if ( b ) { |
162 | if ( mSubItems->isOn() ) mSubItems->toggle(); | 162 | if ( mSubItems->isOn() ) mSubItems->toggle(); |
163 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); | 163 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); |
164 | setCaption( i18n("Matching items will be added to list")); | 164 | setCaption( i18n("Matching items will be added to list")); |
165 | } else | 165 | } else |
166 | setCaption( i18n("List will be cleared before search")); | 166 | setCaption( i18n("List will be cleared before search")); |
167 | } | 167 | } |
168 | void SearchDialog::slot_sub( bool b) | 168 | void SearchDialog::slot_sub( bool b) |
169 | { | 169 | { |
170 | if ( b ) { | 170 | if ( b ) { |
171 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); | 171 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); |
172 | if ( mAddItems->isOn() ) mAddItems->toggle(); | 172 | if ( mAddItems->isOn() ) mAddItems->toggle(); |
173 | setCaption( i18n("Matching items will be removed from list")); | 173 | setCaption( i18n("Matching items will be removed from list")); |
174 | } else | 174 | } else |
175 | setCaption( i18n("List will be cleared before search")); | 175 | setCaption( i18n("List will be cleared before search")); |
176 | } | 176 | } |
177 | void SearchDialog::slot_refine( bool b) | 177 | void SearchDialog::slot_refine( bool b) |
178 | { | 178 | { |
179 | if ( b ) { | 179 | if ( b ) { |
180 | if ( mSubItems->isOn() ) mSubItems->toggle(); | 180 | if ( mSubItems->isOn() ) mSubItems->toggle(); |
181 | if ( mAddItems->isOn() ) mAddItems->toggle(); | 181 | if ( mAddItems->isOn() ) mAddItems->toggle(); |
182 | setCaption( i18n("Search on displayed list only")); | 182 | setCaption( i18n("Search on displayed list only")); |
183 | } else | 183 | } else |
184 | setCaption( i18n("List will be cleared before search")); | 184 | setCaption( i18n("List will be cleared before search")); |
185 | } | 185 | } |
186 | void SearchDialog::toggleCheckboxes() | 186 | void SearchDialog::toggleCheckboxes() |
187 | { | 187 | { |
188 | if ( incidenceGroup->isVisible() ) { | 188 | if ( incidenceGroup->isVisible() ) { |
189 | incidenceGroup->hide() ; | 189 | incidenceGroup->hide() ; |
190 | subjectGroup->hide() ; | 190 | subjectGroup->hide() ; |
191 | attendeeGroup->hide() ; | 191 | attendeeGroup->hide() ; |
192 | } else { | 192 | } else { |
193 | incidenceGroup->show() ; | 193 | incidenceGroup->show() ; |
194 | subjectGroup->show() ; | 194 | subjectGroup->show() ; |
195 | attendeeGroup->show() ; | 195 | attendeeGroup->show() ; |
196 | } | 196 | } |
197 | } | 197 | } |
198 | void SearchDialog::raiseAndSelect() | 198 | void SearchDialog::raiseAndSelect() |
199 | { | 199 | { |
200 | 200 | ||
201 | static int currentState = 0; | 201 | static int currentState = 0; |
202 | 202 | ||
203 | if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) | 203 | if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) |
204 | currentState = 0; | 204 | currentState = 0; |
205 | int newState = 0; | 205 | int newState = 0; |
206 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | 206 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { |
207 | newState = VIEW_J_VIEW; | 207 | newState = VIEW_J_VIEW; |
208 | } | 208 | } |
209 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | 209 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { |
210 | newState = VIEW_T_VIEW; | 210 | newState = VIEW_T_VIEW; |
211 | } | 211 | } |
212 | else { | 212 | else { |
213 | newState = VIEW_A_VIEW; | 213 | newState = VIEW_A_VIEW; |
214 | } | 214 | } |
215 | if ( newState != currentState ) { | 215 | if ( newState != currentState ) { |
216 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | 216 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { |
217 | if ( ! mSearchJournal->isChecked() ) { | 217 | if ( ! mSearchJournal->isChecked() ) { |
218 | mSearchJournal->setChecked( true ); | 218 | mSearchJournal->setChecked( true ); |
219 | mSearchTodo->setChecked( false ); | 219 | mSearchTodo->setChecked( false ); |
220 | mSearchEvent->setChecked( false ); | 220 | mSearchEvent->setChecked( false ); |
221 | } | 221 | } |
222 | } | 222 | } |
223 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | 223 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { |
224 | if ( ! mSearchTodo->isChecked() ) { | 224 | if ( ! mSearchTodo->isChecked() ) { |
225 | mSearchTodo->setChecked( true ); | 225 | mSearchTodo->setChecked( true ); |
226 | mSearchJournal->setChecked( false ); | 226 | mSearchJournal->setChecked( false ); |
227 | mSearchEvent->setChecked( false ); | 227 | mSearchEvent->setChecked( false ); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | else { | 230 | else { |
231 | if ( ! mSearchEvent->isChecked() ) { | 231 | if ( ! mSearchEvent->isChecked() ) { |
232 | mSearchEvent->setChecked( true ); | 232 | mSearchEvent->setChecked( true ); |
233 | mSearchJournal->setChecked( false ); | 233 | mSearchJournal->setChecked( false ); |
234 | mSearchTodo->setChecked( false ); | 234 | mSearchTodo->setChecked( false ); |
235 | } | 235 | } |
236 | } | 236 | } |
237 | } | 237 | } |
238 | currentState = newState; | 238 | currentState = newState; |
239 | raise(); | 239 | raise(); |
240 | } | 240 | } |
241 | void SearchDialog::setFocusToList() | 241 | void SearchDialog::setFocusToList() |
242 | { | 242 | { |
243 | listView->resetFocus(); | 243 | listView->resetFocus(); |
244 | } | 244 | } |
245 | void SearchDialog::accept() | 245 | void SearchDialog::accept() |
246 | { | 246 | { |
247 | doSearch(); | 247 | doSearch(); |
248 | } | 248 | } |
249 | void SearchDialog::updateList() | 249 | void SearchDialog::updateList() |
250 | { | 250 | { |
251 | //listView->updateList(); | 251 | //listView->updateList(); |
252 | if ( isVisible() ) { | 252 | if ( isVisible() ) { |
253 | updateView(); | 253 | updateView(); |
254 | //qDebug("SearchDialog::updated "); | 254 | //qDebug("SearchDialog::updated "); |
255 | } | 255 | } |
256 | else { | 256 | else { |
257 | listView->clear(); | 257 | listView->clear(); |
258 | //qDebug("SearchDialog::cleared "); | 258 | //qDebug("SearchDialog::cleared "); |
259 | 259 | ||
260 | } | 260 | } |
261 | } | 261 | } |
262 | void SearchDialog::searchTextChanged( const QString &_text ) | 262 | void SearchDialog::searchTextChanged( const QString &_text ) |
263 | { | 263 | { |
264 | #if 0 | 264 | #if 0 |
265 | enableButton( KDialogBase::User1, !_text.isEmpty() ); | 265 | enableButton( KDialogBase::User1, !_text.isEmpty() ); |
266 | #endif | 266 | #endif |
267 | } | 267 | } |
268 | 268 | ||
269 | void SearchDialog::doSearch() | 269 | void SearchDialog::doSearch() |
270 | { | 270 | { |
271 | QRegExp re; | 271 | QRegExp re; |
272 | 272 | ||
273 | re.setWildcard(true); // most people understand these better. | 273 | re.setWildcard(true); // most people understand these better. |
274 | re.setCaseSensitive(false); | 274 | re.setCaseSensitive(false); |
275 | QString st = searchEdit->text(); | 275 | QString st = searchEdit->text(); |
276 | if ( st.right(1) != "*") | 276 | if ( st.right(1) != "*") |
277 | st += "*"; | 277 | st += "*"; |
278 | re.setPattern(st); | 278 | re.setPattern(st); |
279 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { | 279 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { |
280 | KMessageBox::sorry(this, | 280 | KMessageBox::sorry(this, |
281 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); | 281 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); |
282 | return; | 282 | return; |
283 | } | 283 | } |
284 | if (!re.isValid() ) { | 284 | if (!re.isValid() ) { |
285 | KMessageBox::sorry(this, | 285 | KMessageBox::sorry(this, |
286 | i18n("Invalid search expression,\ncannot perform " | 286 | i18n("Invalid search expression,\ncannot perform " |
287 | "the search.\nPlease enter a search expression\n" | 287 | "the search.\nPlease enter a search expression\n" |
288 | "using the wildcard characters\n '*' and '?'" | 288 | "using the wildcard characters\n '*' and '?'" |
289 | "where needed.")); | 289 | "where needed.")); |
290 | return; | 290 | return; |
291 | } | 291 | } |
292 | search(re); | 292 | search(re); |
293 | listView->setStartDate( mStartDate->date() ); | 293 | listView->setStartDate( mStartDate->date() ); |
294 | listView->showEvents(mMatchedEvents); | 294 | listView->showEvents(mMatchedEvents); |
295 | listView->addTodos(mMatchedTodos); | 295 | listView->addTodos(mMatchedTodos); |
296 | listView->addJournals(mMatchedJournals); | 296 | listView->addJournals(mMatchedJournals); |
297 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { | 297 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { |
298 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); | 298 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); |
299 | } else { | 299 | } else { |
300 | QString mess; | 300 | QString mess; |
301 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); | 301 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); |
302 | setCaption( i18n("KO/Pi Find: ") + mess); | 302 | setCaption( i18n("KO/Pi Find: ") + mess); |
303 | 303 | ||
304 | } | 304 | } |
305 | searchEdit->setFocus(); | 305 | searchEdit->setFocus(); |
306 | } | 306 | } |
307 | void SearchDialog::updateConfig() | 307 | void SearchDialog::updateConfig() |
308 | { | 308 | { |
309 | listView->updateConfig(); | 309 | listView->updateConfig(); |
310 | } | 310 | } |
311 | void SearchDialog::updateView() | 311 | void SearchDialog::updateView() |
312 | { | 312 | { |
313 | //qDebug("SearchDialog::updateView() %d ", isVisible()); | 313 | //qDebug("SearchDialog::updateView() %d ", isVisible()); |
314 | QRegExp re; | 314 | QRegExp re; |
315 | re.setWildcard(true); // most people understand these better. | 315 | re.setWildcard(true); // most people understand these better. |
316 | re.setCaseSensitive(false); | 316 | re.setCaseSensitive(false); |
317 | QString st = searchEdit->text(); | 317 | QString st = searchEdit->text(); |
318 | if ( st.right(1) != "*") | 318 | if ( st.right(1) != "*") |
319 | st += "*"; | 319 | st += "*"; |
320 | re.setPattern(st); | 320 | re.setPattern(st); |
321 | if (re.isValid()) { | 321 | if (re.isValid()) { |
322 | search(re); | 322 | search(re); |
323 | } else { | 323 | } else { |
324 | mMatchedEvents.clear(); | 324 | mMatchedEvents.clear(); |
325 | mMatchedTodos.clear(); | 325 | mMatchedTodos.clear(); |
326 | mMatchedJournals.clear(); | 326 | mMatchedJournals.clear(); |
327 | } | 327 | } |
328 | listView->setStartDate( mStartDate->date() ); | 328 | listView->setStartDate( mStartDate->date() ); |
329 | listView->showEvents(mMatchedEvents); | 329 | listView->showEvents(mMatchedEvents); |
330 | listView->addTodos(mMatchedTodos); | 330 | listView->addTodos(mMatchedTodos); |
331 | listView->addJournals(mMatchedJournals); | 331 | listView->addJournals(mMatchedJournals); |
332 | } | 332 | } |
333 | 333 | ||
334 | void SearchDialog::search(const QRegExp &re) | 334 | void SearchDialog::search(const QRegExp &re) |
335 | { | 335 | { |
336 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), | 336 | QPtrList<Event> events; |
337 | mEndDate->date(), | ||
338 | false /*mInclusiveCheck->isChecked()*/ ); | ||
339 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { | 337 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { |
340 | if ( mRefineItems->isChecked() ) events = mMatchedEvents; | 338 | if ( mRefineItems->isChecked() ) events = mMatchedEvents; |
341 | mMatchedEvents.clear(); | 339 | mMatchedEvents.clear(); |
342 | } | 340 | } |
343 | if ( mSearchEvent->isChecked() ) { | 341 | if ( mSearchEvent->isChecked() ) { |
342 | if ( !mRefineItems->isChecked() ) | ||
343 | events = mCalendar->events( mStartDate->date(), | ||
344 | mEndDate->date(), | ||
345 | false /*mInclusiveCheck->isChecked()*/ ); | ||
346 | |||
347 | |||
344 | Event *ev; | 348 | Event *ev; |
345 | for(ev=events.first();ev;ev=events.next()) { | 349 | for(ev=events.first();ev;ev=events.next()) { |
346 | if (mSummaryCheck->isChecked()) { | 350 | if (mSummaryCheck->isChecked()) { |
347 | #if QT_VERSION >= 0x030000 | 351 | #if QT_VERSION >= 0x030000 |
348 | if (re.search(ev->summary()) != -1) | 352 | if (re.search(ev->summary()) != -1) |
349 | #else | 353 | #else |
350 | if (re.match(ev->summary()) != -1) | 354 | if (re.match(ev->summary()) != -1) |
351 | #endif | 355 | #endif |
352 | { | 356 | { |
353 | if ( mSubItems->isChecked() ) | 357 | if ( mSubItems->isChecked() ) |
354 | mMatchedEvents.remove(ev); | 358 | mMatchedEvents.remove(ev); |
355 | else { | 359 | else { |
356 | if ( !mMatchedEvents.contains( ev ) ) | 360 | if ( !mMatchedEvents.contains( ev ) ) |
357 | mMatchedEvents.append(ev); | 361 | mMatchedEvents.append(ev); |
358 | } | 362 | } |
359 | continue; | 363 | continue; |
360 | } | 364 | } |
361 | #if QT_VERSION >= 0x030000 | 365 | #if QT_VERSION >= 0x030000 |
362 | if (re.search(ev->location()) != -1) | 366 | if (re.search(ev->location()) != -1) |
363 | #else | 367 | #else |
364 | if (re.match(ev->location()) != -1) | 368 | if (re.match(ev->location()) != -1) |
365 | #endif | 369 | #endif |
366 | { | 370 | { |
367 | if ( mSubItems->isChecked() ) | 371 | if ( mSubItems->isChecked() ) |
368 | mMatchedEvents.remove(ev); | 372 | mMatchedEvents.remove(ev); |
369 | else{ | 373 | else{ |
370 | if ( !mMatchedEvents.contains( ev ) ) | 374 | if ( !mMatchedEvents.contains( ev ) ) |
371 | mMatchedEvents.append(ev); | 375 | mMatchedEvents.append(ev); |
372 | } | 376 | } |
373 | continue; | 377 | continue; |
374 | } | 378 | } |
375 | } | 379 | } |
376 | if (mDescriptionCheck->isChecked()) { | 380 | if (mDescriptionCheck->isChecked()) { |
377 | #if QT_VERSION >= 0x030000 | 381 | #if QT_VERSION >= 0x030000 |
378 | if (re.search(ev->description()) != -1) | 382 | if (re.search(ev->description()) != -1) |
379 | #else | 383 | #else |
380 | if (re.match(ev->description()) != -1) | 384 | if (re.match(ev->description()) != -1) |
381 | #endif | 385 | #endif |
382 | { | 386 | { |
383 | if ( mSubItems->isChecked() ) | 387 | if ( mSubItems->isChecked() ) |
384 | mMatchedEvents.remove(ev); | 388 | mMatchedEvents.remove(ev); |
385 | else{ | 389 | else{ |
386 | if ( !mMatchedEvents.contains( ev ) ) | 390 | if ( !mMatchedEvents.contains( ev ) ) |
387 | mMatchedEvents.append(ev); | 391 | mMatchedEvents.append(ev); |
388 | } | 392 | } |
389 | continue; | 393 | continue; |
390 | } | 394 | } |
391 | } | 395 | } |
392 | if (mCategoryCheck->isChecked()) { | 396 | if (mCategoryCheck->isChecked()) { |
393 | #if QT_VERSION >= 0x030000 | 397 | #if QT_VERSION >= 0x030000 |
394 | if (re.search(ev->categoriesStr()) != -1) | 398 | if (re.search(ev->categoriesStr()) != -1) |
395 | #else | 399 | #else |
396 | if (re.match(ev->categoriesStr()) != -1) | 400 | if (re.match(ev->categoriesStr()) != -1) |
397 | #endif | 401 | #endif |
398 | { | 402 | { |
399 | 403 | ||
400 | if ( mSubItems->isChecked() ) | 404 | if ( mSubItems->isChecked() ) |
401 | mMatchedEvents.remove(ev); | 405 | mMatchedEvents.remove(ev); |
402 | else{ | 406 | else{ |
403 | if ( !mMatchedEvents.contains( ev ) ) | 407 | if ( !mMatchedEvents.contains( ev ) ) |
404 | mMatchedEvents.append(ev); | 408 | mMatchedEvents.append(ev); |
405 | } | 409 | } |
406 | continue; | 410 | continue; |
407 | } | 411 | } |
408 | } | 412 | } |
409 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 413 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
410 | QPtrList<Attendee> tmpAList = ev->attendees(); | 414 | QPtrList<Attendee> tmpAList = ev->attendees(); |
411 | Attendee *a; | 415 | Attendee *a; |
412 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 416 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
413 | if (mSearchAName->isChecked()) { | 417 | if (mSearchAName->isChecked()) { |
414 | #if QT_VERSION >= 0x030000 | 418 | #if QT_VERSION >= 0x030000 |
415 | if (re.search(a->name()) != -1) | 419 | if (re.search(a->name()) != -1) |
416 | #else | 420 | #else |
417 | if (re.match(a->name()) != -1) | 421 | if (re.match(a->name()) != -1) |
418 | #endif | 422 | #endif |
419 | { | 423 | { |
420 | if ( mSubItems->isChecked() ) | 424 | if ( mSubItems->isChecked() ) |
421 | mMatchedEvents.remove(ev); | 425 | mMatchedEvents.remove(ev); |
422 | else{ | 426 | else{ |
423 | if ( !mMatchedEvents.contains( ev ) ) | 427 | if ( !mMatchedEvents.contains( ev ) ) |
424 | mMatchedEvents.append(ev); | 428 | mMatchedEvents.append(ev); |
425 | } | 429 | } |
426 | break; | 430 | break; |
427 | } | 431 | } |
428 | } | 432 | } |
429 | if (mSearchAEmail->isChecked()) { | 433 | if (mSearchAEmail->isChecked()) { |
430 | #if QT_VERSION >= 0x030000 | 434 | #if QT_VERSION >= 0x030000 |
431 | if (re.search(a->email()) != -1) | 435 | if (re.search(a->email()) != -1) |
432 | #else | 436 | #else |
433 | if (re.match(a->email()) != -1) | 437 | if (re.match(a->email()) != -1) |
434 | #endif | 438 | #endif |
435 | { | 439 | { |
436 | if ( mSubItems->isChecked() ) | 440 | if ( mSubItems->isChecked() ) |
437 | mMatchedEvents.remove(ev); | 441 | mMatchedEvents.remove(ev); |
438 | else{ | 442 | else{ |
439 | if ( !mMatchedEvents.contains( ev ) ) | 443 | if ( !mMatchedEvents.contains( ev ) ) |
440 | mMatchedEvents.append(ev); | 444 | mMatchedEvents.append(ev); |
441 | } | 445 | } |
442 | break; | 446 | break; |
443 | } | 447 | } |
444 | } | 448 | } |
445 | } | 449 | } |
446 | } | 450 | } |
447 | } | 451 | } |
448 | } | 452 | } |
449 | QPtrList<Todo> todos = mCalendar->todos( ); | 453 | QPtrList<Todo> todos; |
450 | 454 | ||
451 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { | 455 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { |
452 | if ( mRefineItems->isChecked() ) todos = mMatchedTodos ; | 456 | if ( mRefineItems->isChecked() ) todos = mMatchedTodos ; |
453 | mMatchedTodos.clear(); | 457 | mMatchedTodos.clear(); |
454 | } | 458 | } |
455 | 459 | ||
456 | if ( mSearchTodo->isChecked() ) { | 460 | if ( mSearchTodo->isChecked() ) { |
461 | if ( !mRefineItems->isChecked() ) todos = mCalendar->todos( ); | ||
457 | Todo *tod; | 462 | Todo *tod; |
458 | for(tod=todos.first();tod;tod=todos.next()) { | 463 | for(tod=todos.first();tod;tod=todos.next()) { |
459 | if (mSummaryCheck->isChecked()) { | 464 | if (mSummaryCheck->isChecked()) { |
460 | #if QT_VERSION >= 0x030000 | 465 | #if QT_VERSION >= 0x030000 |
461 | if (re.search(tod->summary()) != -1) | 466 | if (re.search(tod->summary()) != -1) |
462 | #else | 467 | #else |
463 | if (re.match(tod->summary()) != -1) | 468 | if (re.match(tod->summary()) != -1) |
464 | #endif | 469 | #endif |
465 | { | 470 | { |
466 | if ( mSubItems->isChecked() ) | 471 | if ( mSubItems->isChecked() ) |
467 | mMatchedTodos.remove(tod); | 472 | mMatchedTodos.remove(tod); |
468 | else if (!mMatchedTodos.contains( tod )) | 473 | else if (!mMatchedTodos.contains( tod )) |
469 | mMatchedTodos.append(tod); | 474 | mMatchedTodos.append(tod); |
470 | continue; | 475 | continue; |
471 | } | 476 | } |
472 | } | 477 | } |
473 | if (mDescriptionCheck->isChecked()) { | 478 | if (mDescriptionCheck->isChecked()) { |
474 | #if QT_VERSION >= 0x030000 | 479 | #if QT_VERSION >= 0x030000 |
475 | if (re.search(tod->description()) != -1) | 480 | if (re.search(tod->description()) != -1) |
476 | #else | 481 | #else |
477 | if (re.match(tod->description()) != -1) | 482 | if (re.match(tod->description()) != -1) |
478 | #endif | 483 | #endif |
479 | { | 484 | { |
480 | if ( mSubItems->isChecked() ) | 485 | if ( mSubItems->isChecked() ) |
481 | mMatchedTodos.remove(tod); | 486 | mMatchedTodos.remove(tod); |
482 | else if (!mMatchedTodos.contains( tod )) | 487 | else if (!mMatchedTodos.contains( tod )) |
483 | mMatchedTodos.append(tod); | 488 | mMatchedTodos.append(tod); |
484 | continue; | 489 | continue; |
485 | } | 490 | } |
486 | } | 491 | } |
487 | if (mCategoryCheck->isChecked()) { | 492 | if (mCategoryCheck->isChecked()) { |
488 | #if QT_VERSION >= 0x030000 | 493 | #if QT_VERSION >= 0x030000 |
489 | if (re.search(tod->categoriesStr()) != -1) | 494 | if (re.search(tod->categoriesStr()) != -1) |
490 | #else | 495 | #else |
491 | if (re.match(tod->categoriesStr()) != -1) | 496 | if (re.match(tod->categoriesStr()) != -1) |
492 | #endif | 497 | #endif |
493 | { | 498 | { |
494 | if ( mSubItems->isChecked() ) | 499 | if ( mSubItems->isChecked() ) |
495 | mMatchedTodos.remove(tod); | 500 | mMatchedTodos.remove(tod); |
496 | else if (!mMatchedTodos.contains( tod )) | 501 | else if (!mMatchedTodos.contains( tod )) |
497 | mMatchedTodos.append(tod); | 502 | mMatchedTodos.append(tod); |
498 | continue; | 503 | continue; |
499 | } | 504 | } |
500 | } | 505 | } |
501 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 506 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
502 | QPtrList<Attendee> tmpAList = tod->attendees(); | 507 | QPtrList<Attendee> tmpAList = tod->attendees(); |
503 | Attendee *a; | 508 | Attendee *a; |
504 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 509 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
505 | if (mSearchAName->isChecked()) { | 510 | if (mSearchAName->isChecked()) { |
506 | #if QT_VERSION >= 0x030000 | 511 | #if QT_VERSION >= 0x030000 |
507 | if (re.search(a->name()) != -1) | 512 | if (re.search(a->name()) != -1) |
508 | #else | 513 | #else |
509 | if (re.match(a->name()) != -1) | 514 | if (re.match(a->name()) != -1) |
510 | #endif | 515 | #endif |
511 | { | 516 | { |
512 | if ( mSubItems->isChecked() ) | 517 | if ( mSubItems->isChecked() ) |
513 | mMatchedTodos.remove(tod); | 518 | mMatchedTodos.remove(tod); |
514 | else if (!mMatchedTodos.contains( tod )) | 519 | else if (!mMatchedTodos.contains( tod )) |
515 | mMatchedTodos.append(tod); | 520 | mMatchedTodos.append(tod); |
516 | break; | 521 | break; |
517 | } | 522 | } |
518 | } | 523 | } |
519 | if (mSearchAEmail->isChecked()) { | 524 | if (mSearchAEmail->isChecked()) { |
520 | #if QT_VERSION >= 0x030000 | 525 | #if QT_VERSION >= 0x030000 |
521 | if (re.search(a->email()) != -1) | 526 | if (re.search(a->email()) != -1) |
522 | #else | 527 | #else |
523 | if (re.match(a->email()) != -1) | 528 | if (re.match(a->email()) != -1) |
524 | #endif | 529 | #endif |
525 | { | 530 | { |
526 | if ( mSubItems->isChecked() ) | 531 | if ( mSubItems->isChecked() ) |
527 | mMatchedTodos.remove(tod); | 532 | mMatchedTodos.remove(tod); |
528 | else if (!mMatchedTodos.contains( tod )) | 533 | else if (!mMatchedTodos.contains( tod )) |
529 | mMatchedTodos.append(tod); | 534 | mMatchedTodos.append(tod); |
530 | break; | 535 | break; |
531 | } | 536 | } |
532 | } | 537 | } |
533 | } | 538 | } |
534 | } | 539 | } |
535 | } | 540 | } |
536 | } | 541 | } |
537 | 542 | ||
538 | QPtrList<Journal> journals = mCalendar->journals( ); | 543 | QPtrList<Journal> journals; |
539 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { | 544 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { |
540 | if ( mRefineItems->isChecked() ) journals = mMatchedJournals ; | 545 | if ( mRefineItems->isChecked() ) journals = mMatchedJournals ; |
541 | mMatchedJournals.clear(); | 546 | mMatchedJournals.clear(); |
542 | } | 547 | } |
543 | if (mSearchJournal->isChecked() ) { | 548 | if (mSearchJournal->isChecked() ) { |
549 | if ( ! mRefineItems->isChecked() ) journals = mCalendar->journals(); | ||
544 | Journal* journ; | 550 | Journal* journ; |
545 | 551 | ||
546 | for(journ=journals.first();journ;journ=journals.next()) { | 552 | for(journ=journals.first();journ;journ=journals.next()) { |
547 | if ( journ->dtStart().date() <= mEndDate->date() | 553 | if ( journ->dtStart().date() <= mEndDate->date() |
548 | &&journ->dtStart().date() >= mStartDate->date()) { | 554 | &&journ->dtStart().date() >= mStartDate->date()) { |
549 | #if QT_VERSION >= 0x030000 | 555 | #if QT_VERSION >= 0x030000 |
550 | if (re.search(journ->description()) != -1) | 556 | if (re.search(journ->description()) != -1) |
551 | #else | 557 | #else |
552 | if (re.match(journ->description()) != -1) | 558 | if (re.match(journ->description()) != -1) |
553 | #endif | 559 | #endif |
554 | { | 560 | { |
555 | if ( mSubItems->isChecked() ) | 561 | if ( mSubItems->isChecked() ) |
556 | mMatchedJournals.remove(journ); | 562 | mMatchedJournals.remove(journ); |
557 | else if (!mMatchedJournals.contains( journ )) | 563 | else if (!mMatchedJournals.contains( journ )) |
558 | mMatchedJournals.append(journ); | 564 | mMatchedJournals.append(journ); |
559 | continue; | 565 | continue; |
560 | } | 566 | } |
561 | } | 567 | } |
562 | } | 568 | } |
563 | } | 569 | } |
564 | if ( mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() < 1 ) { | 570 | if ( mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() < 1 ) { |
565 | qDebug("count %d ", mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() ); | 571 | qDebug("count %d ", mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() ); |
566 | if ( mRefineItems->isChecked() ) | 572 | if ( mRefineItems->isChecked() ) |
567 | mRefineItems->setChecked( false ); | 573 | mRefineItems->setChecked( false ); |
568 | else if ( mSubItems->isChecked() ) | 574 | else if ( mSubItems->isChecked() ) |
569 | mSubItems->setChecked( false ); | 575 | mSubItems->setChecked( false ); |
570 | } | 576 | } |
571 | } | 577 | } |
572 | 578 | ||
573 | void SearchDialog::keyPressEvent ( QKeyEvent *e) | 579 | void SearchDialog::keyPressEvent ( QKeyEvent *e) |
574 | { | 580 | { |
575 | switch ( e->key() ) { | 581 | switch ( e->key() ) { |
576 | case Qt::Key_Escape: | 582 | case Qt::Key_Escape: |
577 | close(); | 583 | close(); |
578 | break; | 584 | break; |
579 | case Qt::Key_F: | 585 | case Qt::Key_F: |
580 | if ( e->state() == Qt::ControlButton ) { | 586 | if ( e->state() == Qt::ControlButton ) { |
581 | 587 | ||
582 | } | 588 | } |
583 | break; | 589 | break; |
584 | case Qt::Key_Return: | 590 | case Qt::Key_Return: |
585 | case Qt::Key_Enter: | 591 | case Qt::Key_Enter: |
586 | doSearch(); | 592 | doSearch(); |
587 | break; | 593 | break; |
588 | 594 | ||
589 | default: | 595 | default: |
590 | e->ignore(); | 596 | e->ignore(); |
591 | } | 597 | } |
592 | } | 598 | } |
593 | 599 | ||
594 | //mMatchedJournals; | 600 | //mMatchedJournals; |