-rw-r--r-- | korganizer/kolistview.cpp | 35 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 25 | ||||
-rw-r--r-- | korganizer/searchdialog.h | 1 |
3 files changed, 48 insertions, 13 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index be51694..5797d1b 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -190,197 +190,197 @@ bool ListItemVisitor::visit(Todo *t) | |||
190 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 190 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
191 | mItem->setText(10,t->categoriesStr()); | 191 | mItem->setText(10,t->categoriesStr()); |
192 | 192 | ||
193 | QString key; | 193 | QString key; |
194 | QDate d; | 194 | QDate d; |
195 | if (t->hasDueDate()) { | 195 | if (t->hasDueDate()) { |
196 | d = t->dtDue().date(); | 196 | d = t->dtDue().date(); |
197 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 197 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
198 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 198 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
199 | mItem->setSortKey(7,key); | 199 | mItem->setSortKey(7,key); |
200 | } | 200 | } |
201 | if ( t->hasStartDate() ) { | 201 | if ( t->hasStartDate() ) { |
202 | d = t->dtStart().date(); | 202 | d = t->dtStart().date(); |
203 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 203 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
204 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 204 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
205 | mItem->setSortKey(1,key); | 205 | mItem->setSortKey(1,key); |
206 | } | 206 | } |
207 | return true; | 207 | return true; |
208 | } | 208 | } |
209 | 209 | ||
210 | bool ListItemVisitor::visit(Journal * j) | 210 | bool ListItemVisitor::visit(Journal * j) |
211 | { | 211 | { |
212 | QString des = j->description().left(30); | 212 | QString des = j->description().left(30); |
213 | des = des.simplifyWhiteSpace (); | 213 | des = des.simplifyWhiteSpace (); |
214 | des.replace (QRegExp ("\\n"),"" ); | 214 | des.replace (QRegExp ("\\n"),"" ); |
215 | des.replace (QRegExp ("\\r"),"" ); | 215 | des.replace (QRegExp ("\\r"),"" ); |
216 | mItem->setText(0,i18n("Journal: ")+des.left(25)); | 216 | mItem->setText(0,i18n("Journal: ")+des.left(25)); |
217 | mItem->setText(1,j->dtStartDateStr()); | 217 | mItem->setText(1,j->dtStartDateStr()); |
218 | mItem->setText(2,"---"); | 218 | mItem->setText(2,"---"); |
219 | mItem->setText(3,"---"); | 219 | mItem->setText(3,"---"); |
220 | mItem->setText(4,"---"); | 220 | mItem->setText(4,"---"); |
221 | mItem->setText(5,"---"); | 221 | mItem->setText(5,"---"); |
222 | mItem->setText(6,"---"); | 222 | mItem->setText(6,"---"); |
223 | mItem->setText(7,j->dtStartDateStr()); | 223 | mItem->setText(7,j->dtStartDateStr()); |
224 | mItem->setText(8,"---"); | 224 | mItem->setText(8,"---"); |
225 | mItem->setText(9,"---"); | 225 | mItem->setText(9,"---"); |
226 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); | 226 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); |
227 | 227 | ||
228 | QString key; | 228 | QString key; |
229 | QDate d = j->dtStart().date(); | 229 | QDate d = j->dtStart().date(); |
230 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 230 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
231 | mItem->setSortKey(1,key); | 231 | mItem->setSortKey(1,key); |
232 | mItem->setSortKey(7,key); | 232 | mItem->setSortKey(7,key); |
233 | 233 | ||
234 | return true; | 234 | return true; |
235 | } | 235 | } |
236 | 236 | ||
237 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 237 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
238 | const char *name) | 238 | const char *name) |
239 | : KOEventView(calendar, parent, name) | 239 | : KOEventView(calendar, parent, name) |
240 | { | 240 | { |
241 | mActiveItem = 0; | 241 | mActiveItem = 0; |
242 | mListView = new KOListViewListView(this); | 242 | mListView = new KOListViewListView(this); |
243 | mListView->addColumn(i18n("Summary")); | 243 | mListView->addColumn(i18n("Summary")); |
244 | mListView->addColumn(i18n("Start Date")); | 244 | mListView->addColumn(i18n("Start Date")); |
245 | mListView->addColumn(i18n("Start Time")); | 245 | mListView->addColumn(i18n("Start Time")); |
246 | mListView->addColumn(i18n("End Date")); | 246 | mListView->addColumn(i18n("End Date")); |
247 | mListView->addColumn(i18n("End Time")); | 247 | mListView->addColumn(i18n("End Time")); |
248 | mListView->addColumn(i18n("Alarm")); // alarm set? | 248 | mListView->addColumn(i18n("Alarm")); // alarm set? |
249 | mListView->addColumn(i18n("Recurs")); // recurs? | 249 | mListView->addColumn(i18n("Recurs")); // recurs? |
250 | mListView->addColumn(i18n("Due Date")); | 250 | mListView->addColumn(i18n("Due Date")); |
251 | mListView->addColumn(i18n("Due Time")); | 251 | mListView->addColumn(i18n("Due Time")); |
252 | mListView->addColumn(i18n("Cancelled")); | 252 | mListView->addColumn(i18n("Cancelled")); |
253 | mListView->addColumn(i18n("Categories")); | 253 | mListView->addColumn(i18n("Categories")); |
254 | 254 | ||
255 | mListView->setColumnAlignment(0,AlignLeft); | 255 | mListView->setColumnAlignment(0,AlignLeft); |
256 | mListView->setColumnAlignment(1,AlignLeft); | 256 | mListView->setColumnAlignment(1,AlignLeft); |
257 | mListView->setColumnAlignment(2,AlignHCenter); | 257 | mListView->setColumnAlignment(2,AlignHCenter); |
258 | mListView->setColumnAlignment(3,AlignLeft); | 258 | mListView->setColumnAlignment(3,AlignLeft); |
259 | mListView->setColumnAlignment(4,AlignHCenter); | 259 | mListView->setColumnAlignment(4,AlignHCenter); |
260 | mListView->setColumnAlignment(5,AlignLeft); | 260 | mListView->setColumnAlignment(5,AlignLeft); |
261 | mListView->setColumnAlignment(6,AlignLeft); | 261 | mListView->setColumnAlignment(6,AlignLeft); |
262 | mListView->setColumnAlignment(7,AlignLeft); | 262 | mListView->setColumnAlignment(7,AlignLeft); |
263 | mListView->setColumnAlignment(8,AlignLeft); | 263 | mListView->setColumnAlignment(8,AlignLeft); |
264 | mListView->setColumnAlignment(9,AlignLeft); | 264 | mListView->setColumnAlignment(9,AlignLeft); |
265 | mListView->setColumnAlignment(10,AlignLeft); | 265 | mListView->setColumnAlignment(10,AlignLeft); |
266 | mListView->setColumnWidthMode(10, QListView::Manual); | 266 | mListView->setColumnWidthMode(10, QListView::Manual); |
267 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); | 267 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); |
268 | 268 | ||
269 | int iii = 0; | 269 | int iii = 0; |
270 | for ( iii = 0; iii< 10 ; ++iii ) | 270 | for ( iii = 0; iii< 10 ; ++iii ) |
271 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 271 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
272 | 272 | ||
273 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 273 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
274 | layoutTop->addWidget(mListView); | 274 | layoutTop->addWidget(mListView); |
275 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 275 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
276 | mPopupMenu = eventPopup(); | 276 | mPopupMenu = eventPopup(); |
277 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 277 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
278 | i18n("Select all"),this, | 278 | i18n("Select all"),this, |
279 | SLOT(allSelection()),true); | 279 | SLOT(allSelection()),true); |
280 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 280 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
281 | i18n("Deselect all"),this, | 281 | i18n("Deselect all"),this, |
282 | SLOT(clearSelection()),true); | 282 | SLOT(clearSelection()),true); |
283 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 283 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
284 | i18n("Delete all selected"),this, | 284 | i18n("Delete all selected"),this, |
285 | SLOT(deleteAll()),true); | 285 | SLOT(deleteAll()),true); |
286 | #ifdef DESKTOP_VERSION | 286 | |
287 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 287 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
288 | i18n("Hide all selected"),this, | 288 | i18n("Hide all selected"),this, |
289 | SLOT(hideAll()),true); | 289 | SLOT(hideAll()),true); |
290 | #endif | 290 | |
291 | mPopupMenu->insertSeparator(); | 291 | mPopupMenu->insertSeparator(); |
292 | #ifdef DESKTOP_VERSION | 292 | #ifdef DESKTOP_VERSION |
293 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 293 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
294 | i18n("Print complete list"),this, | 294 | i18n("Print complete list"),this, |
295 | SLOT(printList()),true); | 295 | SLOT(printList()),true); |
296 | mPopupMenu->insertSeparator(); | 296 | mPopupMenu->insertSeparator(); |
297 | #endif | 297 | #endif |
298 | QPopupMenu * exportPO = new QPopupMenu ( this ); | 298 | QPopupMenu * exportPO = new QPopupMenu ( this ); |
299 | mPopupMenu->insertItem( i18n("Export selected"), exportPO ); | 299 | mPopupMenu->insertItem( i18n("Export selected"), exportPO ); |
300 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, | 300 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, |
301 | SLOT(saveToFile())); | 301 | SLOT(saveToFile())); |
302 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, | 302 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, |
303 | SLOT(saveToFileVCS())); | 303 | SLOT(saveToFileVCS())); |
304 | exportPO->insertItem( i18n("Journal/Details..."),this, | 304 | exportPO->insertItem( i18n("Journal/Details..."),this, |
305 | SLOT(saveDescriptionToFile())); | 305 | SLOT(saveDescriptionToFile())); |
306 | // mPopupMenu->insertSeparator(); | 306 | // mPopupMenu->insertSeparator(); |
307 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 307 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
308 | i18n("Add Categ. to selected..."),this, | 308 | i18n("Add Categ. to selected..."),this, |
309 | SLOT(addCat()),true); | 309 | SLOT(addCat()),true); |
310 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 310 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
311 | i18n("Set Categ. for selected..."),this, | 311 | i18n("Set Categ. for selected..."),this, |
312 | SLOT(setCat()),true); | 312 | SLOT(setCat()),true); |
313 | //mPopupMenu->insertSeparator(); | 313 | //mPopupMenu->insertSeparator(); |
314 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 314 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
315 | i18n("Set alarm for selected..."),this, | 315 | i18n("Set alarm for selected..."),this, |
316 | SLOT(setAlarm()),true); | 316 | SLOT(setAlarm()),true); |
317 | 317 | ||
318 | 318 | ||
319 | #ifndef DESKTOP_VERSION | 319 | #ifndef DESKTOP_VERSION |
320 | mPopupMenu->insertSeparator(); | 320 | mPopupMenu->insertSeparator(); |
321 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 321 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
322 | i18n("Beam selected via IR"),this, | 322 | i18n("Beam selected via IR"),this, |
323 | SLOT(beamSelected()),true); | 323 | SLOT(beamSelected()),true); |
324 | #endif | 324 | #endif |
325 | /* | 325 | /* |
326 | mPopupMenu = new QPopupMenu; | 326 | mPopupMenu = new QPopupMenu; |
327 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 327 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
328 | SLOT (editEvent())); | 328 | SLOT (editEvent())); |
329 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, | 329 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, |
330 | SLOT (deleteEvent())); | 330 | SLOT (deleteEvent())); |
331 | mPopupMenu->insertSeparator(); | 331 | mPopupMenu->insertSeparator(); |
332 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 332 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
333 | SLOT(showDates())); | 333 | SLOT(showDates())); |
334 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 334 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
335 | SLOT(hideDates())); | 335 | SLOT(hideDates())); |
336 | */ | 336 | */ |
337 | QObject::connect(mListView,SIGNAL( newEvent()), | 337 | QObject::connect(mListView,SIGNAL( newEvent()), |
338 | this,SIGNAL(signalNewEvent())); | 338 | this,SIGNAL(signalNewEvent())); |
339 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 339 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), |
340 | this,SLOT(defaultItemAction(QListViewItem *))); | 340 | this,SLOT(defaultItemAction(QListViewItem *))); |
341 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, | 341 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, |
342 | const QPoint &, int )), | 342 | const QPoint &, int )), |
343 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); | 343 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); |
344 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), | 344 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), |
345 | SLOT(processSelectionChange(QListViewItem *))); | 345 | SLOT(processSelectionChange(QListViewItem *))); |
346 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), | 346 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), |
347 | SIGNAL(showIncidenceSignal(Incidence *)) ); | 347 | SIGNAL(showIncidenceSignal(Incidence *)) ); |
348 | 348 | ||
349 | readSettings(KOGlobals::config(),"KOListView Layout"); | 349 | readSettings(KOGlobals::config(),"KOListView Layout"); |
350 | } | 350 | } |
351 | 351 | ||
352 | KOListView::~KOListView() | 352 | KOListView::~KOListView() |
353 | { | 353 | { |
354 | delete mPopupMenu; | 354 | delete mPopupMenu; |
355 | #if QT_VERSION >= 0x030000 | 355 | #if QT_VERSION >= 0x030000 |
356 | 356 | ||
357 | #else | 357 | #else |
358 | delete mKOListViewWhatsThis; | 358 | delete mKOListViewWhatsThis; |
359 | #endif | 359 | #endif |
360 | } | 360 | } |
361 | 361 | ||
362 | QString KOListView::getWhatsThisText(QPoint p) | 362 | QString KOListView::getWhatsThisText(QPoint p) |
363 | { | 363 | { |
364 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); | 364 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); |
365 | if ( item ) | 365 | if ( item ) |
366 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), | 366 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), |
367 | KOPrefs::instance()->mWTshowDetails, | 367 | KOPrefs::instance()->mWTshowDetails, |
368 | KOPrefs::instance()->mWTshowCreated, | 368 | KOPrefs::instance()->mWTshowCreated, |
369 | KOPrefs::instance()->mWTshowChanged); | 369 | KOPrefs::instance()->mWTshowChanged); |
370 | return i18n("That is the list view" ); | 370 | return i18n("That is the list view" ); |
371 | 371 | ||
372 | } | 372 | } |
373 | 373 | ||
374 | void KOListView::updateList() | 374 | void KOListView::updateList() |
375 | { | 375 | { |
376 | // qDebug(" KOListView::updateList() "); | 376 | // qDebug(" KOListView::updateList() "); |
377 | 377 | ||
378 | } | 378 | } |
379 | 379 | ||
380 | void KOListView::clearList() | 380 | void KOListView::clearList() |
381 | { | 381 | { |
382 | clear (); | 382 | clear (); |
383 | } | 383 | } |
384 | void KOListView::addCat( ) | 384 | void KOListView::addCat( ) |
385 | { | 385 | { |
386 | setCategories( false ); | 386 | setCategories( false ); |
@@ -573,201 +573,228 @@ void KOListView::saveDescriptionToFile() | |||
573 | i18n("Continue"), i18n("Cancel"), 0, | 573 | i18n("Continue"), i18n("Cancel"), 0, |
574 | 0, 1 ); | 574 | 0, 1 ); |
575 | if ( result != 0 ) { | 575 | if ( result != 0 ) { |
576 | return; | 576 | return; |
577 | } | 577 | } |
578 | int icount = 0; | 578 | int icount = 0; |
579 | QPtrList<Incidence> delSel ; | 579 | QPtrList<Incidence> delSel ; |
580 | QListViewItem *item = mListView->firstChild (); | 580 | QListViewItem *item = mListView->firstChild (); |
581 | while ( item ) { | 581 | while ( item ) { |
582 | if ( item->isSelected() ) { | 582 | if ( item->isSelected() ) { |
583 | delSel.append(((KOListViewItem *)item)->data()); | 583 | delSel.append(((KOListViewItem *)item)->data()); |
584 | ++icount; | 584 | ++icount; |
585 | } | 585 | } |
586 | 586 | ||
587 | item = item->nextSibling(); | 587 | item = item->nextSibling(); |
588 | } | 588 | } |
589 | if ( icount ) { | 589 | if ( icount ) { |
590 | QString fn = KOPrefs::instance()->mLastSaveFile; | 590 | QString fn = KOPrefs::instance()->mLastSaveFile; |
591 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 591 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
592 | 592 | ||
593 | if ( fn == "" ) | 593 | if ( fn == "" ) |
594 | return; | 594 | return; |
595 | QFileInfo info; | 595 | QFileInfo info; |
596 | info.setFile( fn ); | 596 | info.setFile( fn ); |
597 | QString mes; | 597 | QString mes; |
598 | bool createbup = true; | 598 | bool createbup = true; |
599 | if ( info. exists() ) { | 599 | if ( info. exists() ) { |
600 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 600 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
601 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 601 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
602 | i18n("Overwrite!"), i18n("Cancel"), 0, | 602 | i18n("Overwrite!"), i18n("Cancel"), 0, |
603 | 0, 1 ); | 603 | 0, 1 ); |
604 | if ( result != 0 ) { | 604 | if ( result != 0 ) { |
605 | createbup = false; | 605 | createbup = false; |
606 | } | 606 | } |
607 | } | 607 | } |
608 | if ( createbup ) { | 608 | if ( createbup ) { |
609 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + | 609 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + |
610 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); | 610 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); |
611 | Incidence *incidence = delSel.first(); | 611 | Incidence *incidence = delSel.first(); |
612 | icount = 0; | 612 | icount = 0; |
613 | while ( incidence ) { | 613 | while ( incidence ) { |
614 | if ( incidence->typeID() == journalID ) { | 614 | if ( incidence->typeID() == journalID ) { |
615 | text += "\n************************************\n"; | 615 | text += "\n************************************\n"; |
616 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); | 616 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); |
617 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 617 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
618 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); | 618 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); |
619 | ++icount; | 619 | ++icount; |
620 | 620 | ||
621 | } else { | 621 | } else { |
622 | if ( !incidence->description().isEmpty() ) { | 622 | if ( !incidence->description().isEmpty() ) { |
623 | text += "\n************************************\n"; | 623 | text += "\n************************************\n"; |
624 | if ( incidence->typeID() == todoID ) | 624 | if ( incidence->typeID() == todoID ) |
625 | text += i18n("To-Do: "); | 625 | text += i18n("To-Do: "); |
626 | text += incidence->summary(); | 626 | text += incidence->summary(); |
627 | if ( incidence->hasStartDate() ) | 627 | if ( incidence->hasStartDate() ) |
628 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); | 628 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); |
629 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 629 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
630 | if ( !incidence->location().isEmpty() ) | 630 | if ( !incidence->location().isEmpty() ) |
631 | text += "\n" +i18n("Location: ") + incidence->location(); | 631 | text += "\n" +i18n("Location: ") + incidence->location(); |
632 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); | 632 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); |
633 | ++icount; | 633 | ++icount; |
634 | 634 | ||
635 | } | 635 | } |
636 | } | 636 | } |
637 | incidence = delSel.next(); | 637 | incidence = delSel.next(); |
638 | } | 638 | } |
639 | QFile file( fn ); | 639 | QFile file( fn ); |
640 | if (!file.open( IO_WriteOnly ) ) { | 640 | if (!file.open( IO_WriteOnly ) ) { |
641 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); | 641 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); |
642 | return; | 642 | return; |
643 | } | 643 | } |
644 | QTextStream ts( &file ); | 644 | QTextStream ts( &file ); |
645 | ts << text; | 645 | ts << text; |
646 | file.close(); | 646 | file.close(); |
647 | //qDebug("%s ", text.latin1()); | 647 | //qDebug("%s ", text.latin1()); |
648 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); | 648 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); |
649 | KOPrefs::instance()->mLastSaveFile = fn; | 649 | KOPrefs::instance()->mLastSaveFile = fn; |
650 | topLevelWidget()->setCaption(mes); | 650 | topLevelWidget()->setCaption(mes); |
651 | } | 651 | } |
652 | } | 652 | } |
653 | } | 653 | } |
654 | void KOListView::saveToFileVCS() | 654 | void KOListView::saveToFileVCS() |
655 | { | 655 | { |
656 | writeToFile( false ); | 656 | writeToFile( false ); |
657 | } | 657 | } |
658 | void KOListView::saveToFile() | 658 | void KOListView::saveToFile() |
659 | { | 659 | { |
660 | writeToFile( true ); | 660 | writeToFile( true ); |
661 | } | 661 | } |
662 | void KOListView::writeToFile( bool iCal ) | 662 | void KOListView::writeToFile( bool iCal ) |
663 | { | 663 | { |
664 | 664 | ||
665 | int icount = 0; | 665 | int icount = 0; |
666 | QPtrList<Incidence> delSel ; | 666 | QPtrList<Incidence> delSel ; |
667 | QListViewItem *item = mListView->firstChild (); | 667 | QListViewItem *item = mListView->firstChild (); |
668 | bool journal = iCal; // warn only for vCal | 668 | bool journal = iCal; // warn only for vCal |
669 | bool addSubTodos = false; | ||
670 | bool askSubTodos = true; | ||
669 | while ( item ) { | 671 | while ( item ) { |
670 | if ( item->isSelected() ) { | 672 | if ( item->isSelected() ) { |
671 | if ( !journal ) | 673 | if ( !journal ) |
672 | if ( ((KOListViewItem *)item)->data()->typeID() == journalID ) | 674 | if ( ((KOListViewItem *)item)->data()->typeID() == journalID ) |
673 | journal = true; | 675 | journal = true; |
674 | delSel.append(((KOListViewItem *)item)->data()); | 676 | Incidence* inc = ((KOListViewItem *)item)->data(); |
677 | if ( addSubTodos ) { | ||
678 | if ( delSel.findRef( inc ) == -1 ) | ||
679 | delSel.append( inc ); | ||
680 | } else | ||
681 | delSel.append(inc); | ||
682 | if ( inc->typeID() == todoID ) { | ||
683 | Todo * todo = (Todo*) inc; | ||
684 | if ( todo->relations().count() ) { | ||
685 | if ( askSubTodos ) { | ||
686 | int result = KMessageBox::warningYesNoCancel(this, | ||
687 | i18n("A selected todo has subtodos!\nDo you want to export\nall subtodos of all\nselected todos as well?"), | ||
688 | i18n("Todo has subtodos"), | ||
689 | i18n("Yes"), | ||
690 | i18n("No")); | ||
691 | if ( result == KMessageBox::Cancel ) { | ||
692 | return; | ||
693 | } | ||
694 | if (result == KMessageBox::Yes) | ||
695 | addSubTodos = true; | ||
696 | askSubTodos = false; | ||
697 | } | ||
698 | if ( addSubTodos ) { | ||
699 | inc->addRelationsToList( &delSel ); | ||
700 | } | ||
701 | } | ||
702 | } | ||
675 | ++icount; | 703 | ++icount; |
676 | } | 704 | } |
677 | |||
678 | item = item->nextSibling(); | 705 | item = item->nextSibling(); |
679 | } | 706 | } |
680 | if ( !iCal && journal ) { | 707 | if ( !iCal && journal ) { |
681 | int result = KMessageBox::warningContinueCancel(this, | 708 | int result = KMessageBox::warningContinueCancel(this, |
682 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 709 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
683 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 710 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
684 | true); | 711 | true); |
685 | if (result != KMessageBox::Continue) return; | 712 | if (result != KMessageBox::Continue) return; |
686 | } | 713 | } |
687 | if ( icount ) { | 714 | if ( icount ) { |
688 | QString fn = KOPrefs::instance()->mLastSaveFile; | 715 | QString fn = KOPrefs::instance()->mLastSaveFile; |
689 | QString extension; | 716 | QString extension; |
690 | if ( iCal ) { | 717 | if ( iCal ) { |
691 | if ( fn.right( 4 ).lower() == ".vcs" ) { | 718 | if ( fn.right( 4 ).lower() == ".vcs" ) { |
692 | fn = fn.left( fn.length() -3) + "ics"; | 719 | fn = fn.left( fn.length() -3) + "ics"; |
693 | } | 720 | } |
694 | } else { | 721 | } else { |
695 | if ( fn.right( 4 ).lower() == ".ics" ) { | 722 | if ( fn.right( 4 ).lower() == ".ics" ) { |
696 | fn = fn.left( fn.length() -3) + "vcs"; | 723 | fn = fn.left( fn.length() -3) + "vcs"; |
697 | } | 724 | } |
698 | } | 725 | } |
699 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 726 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
700 | 727 | ||
701 | if ( fn == "" ) | 728 | if ( fn == "" ) |
702 | return; | 729 | return; |
703 | QFileInfo info; | 730 | QFileInfo info; |
704 | info.setFile( fn ); | 731 | info.setFile( fn ); |
705 | QString mes; | 732 | QString mes; |
706 | bool createbup = true; | 733 | bool createbup = true; |
707 | if ( info. exists() ) { | 734 | if ( info. exists() ) { |
708 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 735 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
709 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 736 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
710 | i18n("Overwrite!"), i18n("Cancel"), 0, | 737 | i18n("Overwrite!"), i18n("Cancel"), 0, |
711 | 0, 1 ); | 738 | 0, 1 ); |
712 | if ( result != 0 ) { | 739 | if ( result != 0 ) { |
713 | createbup = false; | 740 | createbup = false; |
714 | } | 741 | } |
715 | } | 742 | } |
716 | if ( createbup ) { | 743 | if ( createbup ) { |
717 | CalendarLocal cal; | 744 | CalendarLocal cal; |
718 | cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 745 | cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
719 | Incidence *incidence = delSel.first(); | 746 | Incidence *incidence = delSel.first(); |
720 | while ( incidence ) { | 747 | while ( incidence ) { |
721 | cal.addIncidence( incidence->clone() ); | 748 | cal.addIncidence( incidence->clone() ); |
722 | incidence = delSel.next(); | 749 | incidence = delSel.next(); |
723 | } | 750 | } |
724 | if ( iCal ) { | 751 | if ( iCal ) { |
725 | ICalFormat format; | 752 | ICalFormat format; |
726 | format.save( &cal, fn ); | 753 | format.save( &cal, fn ); |
727 | } else { | 754 | } else { |
728 | 755 | ||
729 | VCalFormat format; | 756 | VCalFormat format; |
730 | format.save( &cal, fn ); | 757 | format.save( &cal, fn ); |
731 | } | 758 | } |
732 | mes = i18n("KO/Pi:Saved %1").arg(fn ); | 759 | mes = i18n("KO/Pi:Saved %1").arg(fn ); |
733 | KOPrefs::instance()->mLastSaveFile = fn; | 760 | KOPrefs::instance()->mLastSaveFile = fn; |
734 | topLevelWidget()->setCaption(mes); | 761 | topLevelWidget()->setCaption(mes); |
735 | } | 762 | } |
736 | } | 763 | } |
737 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 764 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
738 | } | 765 | } |
739 | void KOListView::hideAll() | 766 | void KOListView::hideAll() |
740 | { | 767 | { |
741 | QPtrList<QListViewItem> delSel ; | 768 | QPtrList<QListViewItem> delSel ; |
742 | QListViewItem *item = mListView->firstChild (); | 769 | QListViewItem *item = mListView->firstChild (); |
743 | while ( item ) { | 770 | while ( item ) { |
744 | if ( item->isSelected() ) { | 771 | if ( item->isSelected() ) { |
745 | delSel.append(item); | 772 | delSel.append(item); |
746 | } | 773 | } |
747 | item = item->nextSibling(); | 774 | item = item->nextSibling(); |
748 | } | 775 | } |
749 | item = delSel.first() ; | 776 | item = delSel.first() ; |
750 | while ( item ) { | 777 | while ( item ) { |
751 | QListViewItem * del = item; | 778 | QListViewItem * del = item; |
752 | item = delSel.next(); | 779 | item = delSel.next(); |
753 | delete del; | 780 | delete del; |
754 | } | 781 | } |
755 | } | 782 | } |
756 | void KOListView::printList() | 783 | void KOListView::printList() |
757 | { | 784 | { |
758 | mListView->printList(); | 785 | mListView->printList(); |
759 | } | 786 | } |
760 | void KOListView::deleteAll() | 787 | void KOListView::deleteAll() |
761 | { | 788 | { |
762 | int icount = 0; | 789 | int icount = 0; |
763 | QPtrList<Incidence> delSel ; | 790 | QPtrList<Incidence> delSel ; |
764 | QListViewItem *item = mListView->firstChild (); | 791 | QListViewItem *item = mListView->firstChild (); |
765 | while ( item ) { | 792 | while ( item ) { |
766 | if ( item->isSelected() ) { | 793 | if ( item->isSelected() ) { |
767 | delSel.append(((KOListViewItem *)item)->data()); | 794 | delSel.append(((KOListViewItem *)item)->data()); |
768 | ++icount; | 795 | ++icount; |
769 | } | 796 | } |
770 | 797 | ||
771 | item = item->nextSibling(); | 798 | item = item->nextSibling(); |
772 | } | 799 | } |
773 | if ( icount ) { | 800 | if ( icount ) { |
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 59bf1a2..ef2fc1c 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -1,163 +1,168 @@ | |||
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 | 33 | ||
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 | searchLabel = new QLabel(topFrame); | 59 | searchLabel = new QLabel(topFrame); |
59 | searchLabel->setText(i18n("Search for:")); | 60 | searchLabel->setText(i18n("Search for:")); |
60 | subLayout->addWidget(searchLabel); | 61 | subLayout->addWidget(searchLabel); |
61 | 62 | */ | |
62 | searchEdit = new KLineEdit(topFrame); | 63 | QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame ); |
63 | subLayout->addWidget(searchEdit); | ||
64 | QPushButton *OkButton = new QPushButton( i18n("&Find"), topFrame ); | ||
65 | //OkButton->setDefault( true ); | 64 | //OkButton->setDefault( true ); |
66 | connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); | 65 | connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); |
67 | subLayout->addWidget(OkButton); | 66 | subLayout->addWidget(OkButton); |
67 | searchEdit = new KLineEdit(topFrame); | ||
68 | subLayout->addWidget(searchEdit); | ||
69 | |||
70 | mAddItems = new QCheckBox(i18n("Add items"),topFrame); | ||
71 | subLayout->addWidget(mAddItems); | ||
72 | |||
68 | searchEdit->setText("*"); // Find all events by default | 73 | searchEdit->setText("*"); // Find all events by default |
69 | searchEdit->setFocus(); | 74 | searchEdit->setFocus(); |
70 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); | 75 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); |
71 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); | 76 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); |
72 | // Subjects to search | 77 | // Subjects to search |
73 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), | 78 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), |
74 | // topFrame); | 79 | // topFrame); |
75 | 80 | ||
76 | QHBox *incidenceGroup = new QHBox( topFrame ); | 81 | QHBox *incidenceGroup = new QHBox( topFrame ); |
77 | layout->addWidget(incidenceGroup); | 82 | layout->addWidget(incidenceGroup); |
78 | 83 | ||
79 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); | 84 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); |
80 | //mSearchEvent->setChecked(true); | 85 | //mSearchEvent->setChecked(true); |
81 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); | 86 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); |
82 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); | 87 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); |
83 | 88 | ||
84 | QHBox *subjectGroup = new QHBox( topFrame ); | 89 | QHBox *subjectGroup = new QHBox( topFrame ); |
85 | layout->addWidget(subjectGroup); | 90 | layout->addWidget(subjectGroup); |
86 | 91 | ||
87 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); | 92 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); |
88 | mSummaryCheck->setChecked(true); | 93 | mSummaryCheck->setChecked(true); |
89 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); | 94 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); |
90 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); | 95 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); |
91 | 96 | ||
92 | QHBox *attendeeGroup = new QHBox( topFrame ); | 97 | QHBox *attendeeGroup = new QHBox( topFrame ); |
93 | layout->addWidget(attendeeGroup ); | 98 | layout->addWidget(attendeeGroup ); |
94 | new QLabel( i18n("Attendee:"),attendeeGroup ); | 99 | new QLabel( i18n("Attendee:"),attendeeGroup ); |
95 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); | 100 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); |
96 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); | 101 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); |
97 | // Date range | 102 | // Date range |
98 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), | 103 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), |
99 | // topFrame); | 104 | // topFrame); |
100 | // layout->addWidget(rangeGroup); | 105 | // layout->addWidget(rangeGroup); |
101 | 106 | ||
102 | QWidget *rangeWidget = new QWidget(topFrame); | 107 | QWidget *rangeWidget = new QWidget(topFrame); |
103 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); | 108 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); |
104 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); | 109 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); |
105 | mStartDate = new KDateEdit(rangeWidget); | 110 | mStartDate = new KDateEdit(rangeWidget); |
106 | rangeLayout->addWidget(mStartDate); | 111 | rangeLayout->addWidget(mStartDate); |
107 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); | 112 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); |
108 | mEndDate = new KDateEdit(rangeWidget); | 113 | mEndDate = new KDateEdit(rangeWidget); |
109 | mEndDate->setDate(QDate::currentDate().addDays(365)); | 114 | mEndDate->setDate(QDate::currentDate().addDays(365)); |
110 | rangeLayout->addWidget(mEndDate); | 115 | rangeLayout->addWidget(mEndDate); |
111 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); | 116 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); |
112 | rangeLayout->addWidget( (QWidget*)wt ); | 117 | rangeLayout->addWidget( (QWidget*)wt ); |
113 | layout->addWidget(rangeWidget); | 118 | layout->addWidget(rangeWidget); |
114 | // Results list view | 119 | // Results list view |
115 | listView = new KOListView(mCalendar,topFrame); | 120 | listView = new KOListView(mCalendar,topFrame); |
116 | layout->addWidget(listView); | 121 | layout->addWidget(listView); |
117 | //layout->setStretchFactor( listView, 333 ); | 122 | //layout->setStretchFactor( listView, 333 ); |
118 | //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); | 123 | //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); |
119 | //listView->setMaximumHeight( 50 ); | 124 | //listView->setMaximumHeight( 50 ); |
120 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); | 125 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); |
121 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); | 126 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); |
122 | 127 | ||
123 | setCaption( i18n("KO/Pi Find: ")); | 128 | setCaption( i18n("KO/Pi Find: ")); |
124 | #ifdef DESKTOP_VERSION | 129 | #ifdef DESKTOP_VERSION |
125 | OkButton = new QPushButton( i18n("Close"), this ); | 130 | OkButton = new QPushButton( i18n("Close"), this ); |
126 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); | 131 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); |
127 | #endif | 132 | #endif |
128 | } | 133 | } |
129 | 134 | ||
130 | SearchDialog::~SearchDialog() | 135 | SearchDialog::~SearchDialog() |
131 | { | 136 | { |
132 | 137 | ||
133 | } | 138 | } |
134 | void SearchDialog::raiseAndSelect() | 139 | void SearchDialog::raiseAndSelect() |
135 | { | 140 | { |
136 | 141 | ||
137 | static int currentState = 0; | 142 | static int currentState = 0; |
138 | 143 | ||
139 | if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) | 144 | if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) |
140 | currentState = 0; | 145 | currentState = 0; |
141 | int newState = 0; | 146 | int newState = 0; |
142 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | 147 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { |
143 | newState = VIEW_J_VIEW; | 148 | newState = VIEW_J_VIEW; |
144 | } | 149 | } |
145 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | 150 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { |
146 | newState = VIEW_T_VIEW; | 151 | newState = VIEW_T_VIEW; |
147 | } | 152 | } |
148 | else { | 153 | else { |
149 | newState = VIEW_A_VIEW; | 154 | newState = VIEW_A_VIEW; |
150 | } | 155 | } |
151 | if ( newState != currentState ) { | 156 | if ( newState != currentState ) { |
152 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | 157 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { |
153 | if ( ! mSearchJournal->isChecked() ) { | 158 | if ( ! mSearchJournal->isChecked() ) { |
154 | mSearchJournal->setChecked( true ); | 159 | mSearchJournal->setChecked( true ); |
155 | mSearchTodo->setChecked( false ); | 160 | mSearchTodo->setChecked( false ); |
156 | mSearchEvent->setChecked( false ); | 161 | mSearchEvent->setChecked( false ); |
157 | } | 162 | } |
158 | } | 163 | } |
159 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | 164 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { |
160 | if ( ! mSearchTodo->isChecked() ) { | 165 | if ( ! mSearchTodo->isChecked() ) { |
161 | mSearchTodo->setChecked( true ); | 166 | mSearchTodo->setChecked( true ); |
162 | mSearchJournal->setChecked( false ); | 167 | mSearchJournal->setChecked( false ); |
163 | mSearchEvent->setChecked( false ); | 168 | mSearchEvent->setChecked( false ); |
@@ -179,286 +184,288 @@ void SearchDialog::setFocusToList() | |||
179 | listView->resetFocus(); | 184 | listView->resetFocus(); |
180 | } | 185 | } |
181 | void SearchDialog::accept() | 186 | void SearchDialog::accept() |
182 | { | 187 | { |
183 | doSearch(); | 188 | doSearch(); |
184 | } | 189 | } |
185 | void SearchDialog::updateList() | 190 | void SearchDialog::updateList() |
186 | { | 191 | { |
187 | //listView->updateList(); | 192 | //listView->updateList(); |
188 | if ( isVisible() ) { | 193 | if ( isVisible() ) { |
189 | updateView(); | 194 | updateView(); |
190 | //qDebug("SearchDialog::updated "); | 195 | //qDebug("SearchDialog::updated "); |
191 | } | 196 | } |
192 | else { | 197 | else { |
193 | listView->clear(); | 198 | listView->clear(); |
194 | //qDebug("SearchDialog::cleared "); | 199 | //qDebug("SearchDialog::cleared "); |
195 | 200 | ||
196 | } | 201 | } |
197 | } | 202 | } |
198 | void SearchDialog::searchTextChanged( const QString &_text ) | 203 | void SearchDialog::searchTextChanged( const QString &_text ) |
199 | { | 204 | { |
200 | #if 0 | 205 | #if 0 |
201 | enableButton( KDialogBase::User1, !_text.isEmpty() ); | 206 | enableButton( KDialogBase::User1, !_text.isEmpty() ); |
202 | #endif | 207 | #endif |
203 | } | 208 | } |
204 | 209 | ||
205 | void SearchDialog::doSearch() | 210 | void SearchDialog::doSearch() |
206 | { | 211 | { |
207 | QRegExp re; | 212 | QRegExp re; |
208 | 213 | ||
209 | re.setWildcard(true); // most people understand these better. | 214 | re.setWildcard(true); // most people understand these better. |
210 | re.setCaseSensitive(false); | 215 | re.setCaseSensitive(false); |
211 | QString st = searchEdit->text(); | 216 | QString st = searchEdit->text(); |
212 | if ( st.right(1) != "*") | 217 | if ( st.right(1) != "*") |
213 | st += "*"; | 218 | st += "*"; |
214 | re.setPattern(st); | 219 | re.setPattern(st); |
215 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { | 220 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { |
216 | KMessageBox::sorry(this, | 221 | KMessageBox::sorry(this, |
217 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); | 222 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); |
218 | return; | 223 | return; |
219 | } | 224 | } |
220 | if (!re.isValid() ) { | 225 | if (!re.isValid() ) { |
221 | KMessageBox::sorry(this, | 226 | KMessageBox::sorry(this, |
222 | i18n("Invalid search expression,\ncannot perform " | 227 | i18n("Invalid search expression,\ncannot perform " |
223 | "the search.\nPlease enter a search expression\n" | 228 | "the search.\nPlease enter a search expression\n" |
224 | "using the wildcard characters\n '*' and '?'" | 229 | "using the wildcard characters\n '*' and '?'" |
225 | "where needed.")); | 230 | "where needed.")); |
226 | return; | 231 | return; |
227 | } | 232 | } |
228 | search(re); | 233 | search(re); |
229 | listView->setStartDate( mStartDate->date() ); | 234 | listView->setStartDate( mStartDate->date() ); |
230 | listView->showEvents(mMatchedEvents); | 235 | listView->showEvents(mMatchedEvents); |
231 | listView->addTodos(mMatchedTodos); | 236 | listView->addTodos(mMatchedTodos); |
232 | listView->addJournals(mMatchedJournals); | 237 | listView->addJournals(mMatchedJournals); |
233 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { | 238 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { |
234 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); | 239 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); |
235 | } else { | 240 | } else { |
236 | QString mess; | 241 | QString mess; |
237 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); | 242 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); |
238 | setCaption( i18n("KO/Pi Find: ") + mess); | 243 | setCaption( i18n("KO/Pi Find: ") + mess); |
239 | 244 | ||
240 | } | 245 | } |
241 | searchEdit->setFocus(); | 246 | searchEdit->setFocus(); |
242 | } | 247 | } |
243 | void SearchDialog::updateConfig() | 248 | void SearchDialog::updateConfig() |
244 | { | 249 | { |
245 | listView->updateConfig(); | 250 | listView->updateConfig(); |
246 | } | 251 | } |
247 | void SearchDialog::updateView() | 252 | void SearchDialog::updateView() |
248 | { | 253 | { |
249 | //qDebug("SearchDialog::updateView() %d ", isVisible()); | 254 | //qDebug("SearchDialog::updateView() %d ", isVisible()); |
250 | QRegExp re; | 255 | QRegExp re; |
251 | re.setWildcard(true); // most people understand these better. | 256 | re.setWildcard(true); // most people understand these better. |
252 | re.setCaseSensitive(false); | 257 | re.setCaseSensitive(false); |
253 | QString st = searchEdit->text(); | 258 | QString st = searchEdit->text(); |
254 | if ( st.right(1) != "*") | 259 | if ( st.right(1) != "*") |
255 | st += "*"; | 260 | st += "*"; |
256 | re.setPattern(st); | 261 | re.setPattern(st); |
257 | if (re.isValid()) { | 262 | if (re.isValid()) { |
258 | search(re); | 263 | search(re); |
259 | } else { | 264 | } else { |
260 | mMatchedEvents.clear(); | 265 | mMatchedEvents.clear(); |
261 | mMatchedTodos.clear(); | 266 | mMatchedTodos.clear(); |
262 | mMatchedJournals.clear(); | 267 | mMatchedJournals.clear(); |
263 | } | 268 | } |
264 | listView->setStartDate( mStartDate->date() ); | 269 | listView->setStartDate( mStartDate->date() ); |
265 | listView->showEvents(mMatchedEvents); | 270 | listView->showEvents(mMatchedEvents); |
266 | listView->addTodos(mMatchedTodos); | 271 | listView->addTodos(mMatchedTodos); |
267 | listView->addJournals(mMatchedJournals); | 272 | listView->addJournals(mMatchedJournals); |
268 | } | 273 | } |
269 | 274 | ||
270 | void SearchDialog::search(const QRegExp &re) | 275 | void SearchDialog::search(const QRegExp &re) |
271 | { | 276 | { |
272 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), | 277 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), |
273 | mEndDate->date(), | 278 | mEndDate->date(), |
274 | false /*mInclusiveCheck->isChecked()*/ ); | 279 | false /*mInclusiveCheck->isChecked()*/ ); |
275 | 280 | if ( !mAddItems->isChecked() ) | |
276 | mMatchedEvents.clear(); | 281 | mMatchedEvents.clear(); |
277 | if ( mSearchEvent->isChecked() ) { | 282 | if ( mSearchEvent->isChecked() ) { |
278 | Event *ev; | 283 | Event *ev; |
279 | for(ev=events.first();ev;ev=events.next()) { | 284 | for(ev=events.first();ev;ev=events.next()) { |
280 | if (mSummaryCheck->isChecked()) { | 285 | if (mSummaryCheck->isChecked()) { |
281 | #if QT_VERSION >= 0x030000 | 286 | #if QT_VERSION >= 0x030000 |
282 | if (re.search(ev->summary()) != -1) | 287 | if (re.search(ev->summary()) != -1) |
283 | #else | 288 | #else |
284 | if (re.match(ev->summary()) != -1) | 289 | if (re.match(ev->summary()) != -1) |
285 | #endif | 290 | #endif |
286 | { | 291 | { |
287 | mMatchedEvents.append(ev); | 292 | mMatchedEvents.append(ev); |
288 | continue; | 293 | continue; |
289 | } | 294 | } |
290 | #if QT_VERSION >= 0x030000 | 295 | #if QT_VERSION >= 0x030000 |
291 | if (re.search(ev->location()) != -1) | 296 | if (re.search(ev->location()) != -1) |
292 | #else | 297 | #else |
293 | if (re.match(ev->location()) != -1) | 298 | if (re.match(ev->location()) != -1) |
294 | #endif | 299 | #endif |
295 | { | 300 | { |
296 | mMatchedEvents.append(ev); | 301 | mMatchedEvents.append(ev); |
297 | continue; | 302 | continue; |
298 | } | 303 | } |
299 | } | 304 | } |
300 | if (mDescriptionCheck->isChecked()) { | 305 | if (mDescriptionCheck->isChecked()) { |
301 | #if QT_VERSION >= 0x030000 | 306 | #if QT_VERSION >= 0x030000 |
302 | if (re.search(ev->description()) != -1) | 307 | if (re.search(ev->description()) != -1) |
303 | #else | 308 | #else |
304 | if (re.match(ev->description()) != -1) | 309 | if (re.match(ev->description()) != -1) |
305 | #endif | 310 | #endif |
306 | { | 311 | { |
307 | mMatchedEvents.append(ev); | 312 | mMatchedEvents.append(ev); |
308 | continue; | 313 | continue; |
309 | } | 314 | } |
310 | } | 315 | } |
311 | if (mCategoryCheck->isChecked()) { | 316 | if (mCategoryCheck->isChecked()) { |
312 | #if QT_VERSION >= 0x030000 | 317 | #if QT_VERSION >= 0x030000 |
313 | if (re.search(ev->categoriesStr()) != -1) | 318 | if (re.search(ev->categoriesStr()) != -1) |
314 | #else | 319 | #else |
315 | if (re.match(ev->categoriesStr()) != -1) | 320 | if (re.match(ev->categoriesStr()) != -1) |
316 | #endif | 321 | #endif |
317 | { | 322 | { |
318 | mMatchedEvents.append(ev); | 323 | mMatchedEvents.append(ev); |
319 | continue; | 324 | continue; |
320 | } | 325 | } |
321 | } | 326 | } |
322 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 327 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
323 | QPtrList<Attendee> tmpAList = ev->attendees(); | 328 | QPtrList<Attendee> tmpAList = ev->attendees(); |
324 | Attendee *a; | 329 | Attendee *a; |
325 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 330 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
326 | if (mSearchAName->isChecked()) { | 331 | if (mSearchAName->isChecked()) { |
327 | #if QT_VERSION >= 0x030000 | 332 | #if QT_VERSION >= 0x030000 |
328 | if (re.search(a->name()) != -1) | 333 | if (re.search(a->name()) != -1) |
329 | #else | 334 | #else |
330 | if (re.match(a->name()) != -1) | 335 | if (re.match(a->name()) != -1) |
331 | #endif | 336 | #endif |
332 | { | 337 | { |
333 | mMatchedEvents.append(ev); | 338 | mMatchedEvents.append(ev); |
334 | break; | 339 | break; |
335 | } | 340 | } |
336 | } | 341 | } |
337 | if (mSearchAEmail->isChecked()) { | 342 | if (mSearchAEmail->isChecked()) { |
338 | #if QT_VERSION >= 0x030000 | 343 | #if QT_VERSION >= 0x030000 |
339 | if (re.search(a->email()) != -1) | 344 | if (re.search(a->email()) != -1) |
340 | #else | 345 | #else |
341 | if (re.match(a->email()) != -1) | 346 | if (re.match(a->email()) != -1) |
342 | #endif | 347 | #endif |
343 | { | 348 | { |
344 | mMatchedEvents.append(ev); | 349 | mMatchedEvents.append(ev); |
345 | break; | 350 | break; |
346 | } | 351 | } |
347 | } | 352 | } |
348 | } | 353 | } |
349 | } | 354 | } |
350 | } | 355 | } |
351 | } | 356 | } |
352 | QPtrList<Todo> todos = mCalendar->todos( ); | 357 | QPtrList<Todo> todos = mCalendar->todos( ); |
353 | mMatchedTodos.clear(); | 358 | if ( !mAddItems->isChecked() ) |
359 | mMatchedTodos.clear(); | ||
354 | if ( mSearchTodo->isChecked() ) { | 360 | if ( mSearchTodo->isChecked() ) { |
355 | Todo *tod; | 361 | Todo *tod; |
356 | for(tod=todos.first();tod;tod=todos.next()) { | 362 | for(tod=todos.first();tod;tod=todos.next()) { |
357 | if (mSummaryCheck->isChecked()) { | 363 | if (mSummaryCheck->isChecked()) { |
358 | #if QT_VERSION >= 0x030000 | 364 | #if QT_VERSION >= 0x030000 |
359 | if (re.search(tod->summary()) != -1) | 365 | if (re.search(tod->summary()) != -1) |
360 | #else | 366 | #else |
361 | if (re.match(tod->summary()) != -1) | 367 | if (re.match(tod->summary()) != -1) |
362 | #endif | 368 | #endif |
363 | { | 369 | { |
364 | mMatchedTodos.append(tod); | 370 | mMatchedTodos.append(tod); |
365 | continue; | 371 | continue; |
366 | } | 372 | } |
367 | } | 373 | } |
368 | if (mDescriptionCheck->isChecked()) { | 374 | if (mDescriptionCheck->isChecked()) { |
369 | #if QT_VERSION >= 0x030000 | 375 | #if QT_VERSION >= 0x030000 |
370 | if (re.search(tod->description()) != -1) | 376 | if (re.search(tod->description()) != -1) |
371 | #else | 377 | #else |
372 | if (re.match(tod->description()) != -1) | 378 | if (re.match(tod->description()) != -1) |
373 | #endif | 379 | #endif |
374 | { | 380 | { |
375 | mMatchedTodos.append(tod); | 381 | mMatchedTodos.append(tod); |
376 | continue; | 382 | continue; |
377 | } | 383 | } |
378 | } | 384 | } |
379 | if (mCategoryCheck->isChecked()) { | 385 | if (mCategoryCheck->isChecked()) { |
380 | #if QT_VERSION >= 0x030000 | 386 | #if QT_VERSION >= 0x030000 |
381 | if (re.search(tod->categoriesStr()) != -1) | 387 | if (re.search(tod->categoriesStr()) != -1) |
382 | #else | 388 | #else |
383 | if (re.match(tod->categoriesStr()) != -1) | 389 | if (re.match(tod->categoriesStr()) != -1) |
384 | #endif | 390 | #endif |
385 | { | 391 | { |
386 | mMatchedTodos.append(tod); | 392 | mMatchedTodos.append(tod); |
387 | continue; | 393 | continue; |
388 | } | 394 | } |
389 | } | 395 | } |
390 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 396 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
391 | QPtrList<Attendee> tmpAList = tod->attendees(); | 397 | QPtrList<Attendee> tmpAList = tod->attendees(); |
392 | Attendee *a; | 398 | Attendee *a; |
393 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 399 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
394 | if (mSearchAName->isChecked()) { | 400 | if (mSearchAName->isChecked()) { |
395 | #if QT_VERSION >= 0x030000 | 401 | #if QT_VERSION >= 0x030000 |
396 | if (re.search(a->name()) != -1) | 402 | if (re.search(a->name()) != -1) |
397 | #else | 403 | #else |
398 | if (re.match(a->name()) != -1) | 404 | if (re.match(a->name()) != -1) |
399 | #endif | 405 | #endif |
400 | { | 406 | { |
401 | mMatchedTodos.append(tod); | 407 | mMatchedTodos.append(tod); |
402 | break; | 408 | break; |
403 | } | 409 | } |
404 | } | 410 | } |
405 | if (mSearchAEmail->isChecked()) { | 411 | if (mSearchAEmail->isChecked()) { |
406 | #if QT_VERSION >= 0x030000 | 412 | #if QT_VERSION >= 0x030000 |
407 | if (re.search(a->email()) != -1) | 413 | if (re.search(a->email()) != -1) |
408 | #else | 414 | #else |
409 | if (re.match(a->email()) != -1) | 415 | if (re.match(a->email()) != -1) |
410 | #endif | 416 | #endif |
411 | { | 417 | { |
412 | mMatchedTodos.append(tod); | 418 | mMatchedTodos.append(tod); |
413 | break; | 419 | break; |
414 | } | 420 | } |
415 | } | 421 | } |
416 | } | 422 | } |
417 | } | 423 | } |
418 | } | 424 | } |
419 | } | 425 | } |
420 | mMatchedJournals.clear(); | 426 | if ( !mAddItems->isChecked() ) |
427 | mMatchedJournals.clear(); | ||
421 | if (mSearchJournal->isChecked() ) { | 428 | if (mSearchJournal->isChecked() ) { |
422 | QPtrList<Journal> journals = mCalendar->journals( ); | 429 | QPtrList<Journal> journals = mCalendar->journals( ); |
423 | Journal* journ; | 430 | Journal* journ; |
424 | 431 | ||
425 | for(journ=journals.first();journ;journ=journals.next()) { | 432 | for(journ=journals.first();journ;journ=journals.next()) { |
426 | if ( journ->dtStart().date() <= mEndDate->date() | 433 | if ( journ->dtStart().date() <= mEndDate->date() |
427 | &&journ->dtStart().date() >= mStartDate->date()) { | 434 | &&journ->dtStart().date() >= mStartDate->date()) { |
428 | #if QT_VERSION >= 0x030000 | 435 | #if QT_VERSION >= 0x030000 |
429 | if (re.search(journ->description()) != -1) | 436 | if (re.search(journ->description()) != -1) |
430 | #else | 437 | #else |
431 | if (re.match(journ->description()) != -1) | 438 | if (re.match(journ->description()) != -1) |
432 | #endif | 439 | #endif |
433 | { | 440 | { |
434 | mMatchedJournals.append(journ); | 441 | mMatchedJournals.append(journ); |
435 | continue; | 442 | continue; |
436 | } | 443 | } |
437 | } | 444 | } |
438 | } | 445 | } |
439 | } | 446 | } |
440 | 447 | ||
441 | } | 448 | } |
442 | 449 | ||
443 | void SearchDialog::keyPressEvent ( QKeyEvent *e) | 450 | void SearchDialog::keyPressEvent ( QKeyEvent *e) |
444 | { | 451 | { |
445 | switch ( e->key() ) { | 452 | switch ( e->key() ) { |
446 | case Qt::Key_Escape: | 453 | case Qt::Key_Escape: |
447 | close(); | 454 | close(); |
448 | break; | 455 | break; |
449 | case Qt::Key_F: | 456 | case Qt::Key_F: |
450 | if ( e->state() == Qt::ControlButton ) { | 457 | if ( e->state() == Qt::ControlButton ) { |
451 | 458 | ||
452 | } | 459 | } |
453 | break; | 460 | break; |
454 | case Qt::Key_Return: | 461 | case Qt::Key_Return: |
455 | case Qt::Key_Enter: | 462 | case Qt::Key_Enter: |
456 | doSearch(); | 463 | doSearch(); |
457 | break; | 464 | break; |
458 | 465 | ||
459 | default: | 466 | default: |
460 | e->ignore(); | 467 | e->ignore(); |
461 | } | 468 | } |
462 | } | 469 | } |
463 | 470 | ||
464 | //mMatchedJournals; | 471 | //mMatchedJournals; |
diff --git a/korganizer/searchdialog.h b/korganizer/searchdialog.h index 4559d20..11ad2f0 100644 --- a/korganizer/searchdialog.h +++ b/korganizer/searchdialog.h | |||
@@ -1,95 +1,96 @@ | |||
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 | #ifndef SEARCHDIALOG_H | 24 | #ifndef SEARCHDIALOG_H |
25 | #define SEARCHDIALOG_H | 25 | #define SEARCHDIALOG_H |
26 | 26 | ||
27 | #include <qregexp.h> | 27 | #include <qregexp.h> |
28 | 28 | ||
29 | #include <kdialogbase.h> | 29 | #include <kdialogbase.h> |
30 | #include <qvbox.h> | 30 | #include <qvbox.h> |
31 | 31 | ||
32 | #include <libkcal/calendar.h> | 32 | #include <libkcal/calendar.h> |
33 | 33 | ||
34 | #include "kolistview.h" | 34 | #include "kolistview.h" |
35 | 35 | ||
36 | class KDateEdit; | 36 | class KDateEdit; |
37 | class QCheckBox; | 37 | class QCheckBox; |
38 | class QLineEdit; | 38 | class QLineEdit; |
39 | class KLineEdit; | 39 | class KLineEdit; |
40 | class QLabel; | 40 | class QLabel; |
41 | class CalendarView; | 41 | class CalendarView; |
42 | 42 | ||
43 | using namespace KCal; | 43 | using namespace KCal; |
44 | class SearchDialog : public QVBox | 44 | class SearchDialog : public QVBox |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | public: | 47 | public: |
48 | SearchDialog(Calendar *calendar,CalendarView *parent=0); | 48 | SearchDialog(Calendar *calendar,CalendarView *parent=0); |
49 | virtual ~SearchDialog(); | 49 | virtual ~SearchDialog(); |
50 | KOListView *listview(){ return listView;} | 50 | KOListView *listview(){ return listView;} |
51 | void updateView(); | 51 | void updateView(); |
52 | void raiseAndSelect(); | 52 | void raiseAndSelect(); |
53 | 53 | ||
54 | public slots: | 54 | public slots: |
55 | void changeEventDisplay(Event *, int) { updateView(); } | 55 | void changeEventDisplay(Event *, int) { updateView(); } |
56 | void updateConfig(); | 56 | void updateConfig(); |
57 | void updateList(); | 57 | void updateList(); |
58 | protected slots: | 58 | protected slots: |
59 | void setFocusToList(); | 59 | void setFocusToList(); |
60 | void accept(); | 60 | void accept(); |
61 | void doSearch(); | 61 | void doSearch(); |
62 | void searchTextChanged( const QString &_text ); | 62 | void searchTextChanged( const QString &_text ); |
63 | 63 | ||
64 | signals: | 64 | signals: |
65 | void showEventSignal(Event *); | 65 | void showEventSignal(Event *); |
66 | void editEventSignal(Event *); | 66 | void editEventSignal(Event *); |
67 | void deleteEventSignal(Event *); | 67 | void deleteEventSignal(Event *); |
68 | 68 | ||
69 | private: | 69 | private: |
70 | void search(const QRegExp &); | 70 | void search(const QRegExp &); |
71 | 71 | ||
72 | Calendar *mCalendar; | 72 | Calendar *mCalendar; |
73 | 73 | ||
74 | QPtrList<Event> mMatchedEvents; | 74 | QPtrList<Event> mMatchedEvents; |
75 | QPtrList<Todo> mMatchedTodos; | 75 | QPtrList<Todo> mMatchedTodos; |
76 | QPtrList<Journal> mMatchedJournals; | 76 | QPtrList<Journal> mMatchedJournals; |
77 | 77 | ||
78 | QLabel *searchLabel; | 78 | QLabel *searchLabel; |
79 | KLineEdit *searchEdit; | 79 | KLineEdit *searchEdit; |
80 | KOListView *listView; | 80 | KOListView *listView; |
81 | 81 | ||
82 | KDateEdit *mStartDate; | 82 | KDateEdit *mStartDate; |
83 | KDateEdit *mEndDate; | 83 | KDateEdit *mEndDate; |
84 | QCheckBox *mSummaryCheck; | 84 | QCheckBox *mSummaryCheck; |
85 | QCheckBox *mDescriptionCheck; | 85 | QCheckBox *mDescriptionCheck; |
86 | QCheckBox *mCategoryCheck; | 86 | QCheckBox *mCategoryCheck; |
87 | QCheckBox *mSearchEvent; | 87 | QCheckBox *mSearchEvent; |
88 | QCheckBox *mSearchTodo; | 88 | QCheckBox *mSearchTodo; |
89 | QCheckBox *mSearchJournal; | 89 | QCheckBox *mSearchJournal; |
90 | QCheckBox *mSearchAName; | 90 | QCheckBox *mSearchAName; |
91 | QCheckBox *mSearchAEmail; | 91 | QCheckBox *mSearchAEmail; |
92 | QCheckBox *mAddItems; | ||
92 | void keyPressEvent ( QKeyEvent *e) ; | 93 | void keyPressEvent ( QKeyEvent *e) ; |
93 | }; | 94 | }; |
94 | 95 | ||
95 | #endif | 96 | #endif |