summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt2
-rw-r--r--korganizer/kolistview.cpp35
-rw-r--r--korganizer/searchdialog.cpp25
-rw-r--r--korganizer/searchdialog.h1
-rw-r--r--libkcal/incidence.cpp11
-rw-r--r--libkcal/incidence.h2
6 files changed, 61 insertions, 15 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 8f28234..7fa63f4 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1353,29 +1353,29 @@
1353{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, 1353{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" },
1354{ "times","Zeiten" }, 1354{ "times","Zeiten" },
1355{ "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" }, 1355{ "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" },
1356{ "Backup enabled","Backup angeschaltet" }, 1356{ "Backup enabled","Backup angeschaltet" },
1357{ "Use standard backup dir","Standard Backupverzeichnis" }, 1357{ "Use standard backup dir","Standard Backupverzeichnis" },
1358{ "Number of Backups:","Anzahl der Backups" }, 1358{ "Number of Backups:","Anzahl der Backups" },
1359{ "Make backup every ","Mache ein Backup alle " }, 1359{ "Make backup every ","Mache ein Backup alle " },
1360{ " days"," Tage" }, 1360{ " days"," Tage" },
1361{ "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." }, 1361{ "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." },
1362{ "Backup Failed!","Backup Problem!" }, 1362{ "Backup Failed!","Backup Problem!" },
1363{ "Try again now","Versuche jetzt nochmal" }, 1363{ "Try again now","Versuche jetzt nochmal" },
1364{ "Try again later","Versuche später nochmal" }, 1364{ "Try again later","Versuche später nochmal" },
1365{ "Try again tomorrow","Versuche morgen nochmal" }, 1365{ "Try again tomorrow","Versuche morgen nochmal" },
1366{ "Disable backup","Schalte Backup ab" }, 1366{ "Disable backup","Schalte Backup ab" },
1367{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, 1367{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" },
1368{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, 1368{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" },
1369{ "Choose action","Wähle Aktion" }, 1369{ "Choose action","Wähle Aktion" },
1370{ "Comment for todo:","Kommentar zum Todo:" }, 1370{ "Comment for todo:","Kommentar zum Todo:" },
1371{ "Stop+note","Stop+Notiz" }, 1371{ "Stop+note","Stop+Notiz" },
1372{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, 1372{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" },
1373{ "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" }, 1373{ "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" },
1374{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" }, 1374{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" },
1375{ "Print complete list","Drucke komplette Liste" }, 1375{ "Print complete list","Drucke komplette Liste" },
1376{ "Hide all selected","Verstecke Selektierte" }, 1376{ "Hide all selected","Verstecke Selektierte" },
1377{ "","" }, 1377{ "Add items","hinzufügen" },
1378{ "","" }, 1378{ "","" },
1379{ "","" }, 1379{ "","" },
1380{ "","" }, 1380{ "","" },
1381{ "","" }, \ No newline at end of file 1381{ "","" }, \ No newline at end of file
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index be51694..5797d1b 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -262,53 +262,53 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
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()),
@@ -645,57 +645,84 @@ void KOListView::saveDescriptionToFile()
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}
654void KOListView::saveToFileVCS() 654void KOListView::saveToFileVCS()
655{ 655{
656 writeToFile( false ); 656 writeToFile( false );
657} 657}
658void KOListView::saveToFile() 658void KOListView::saveToFile()
659{ 659{
660 writeToFile( true ); 660 writeToFile( true );
661} 661}
662void KOListView::writeToFile( bool iCal ) 662void 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 == "" )
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 59bf1a2..ef2fc1c 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -34,58 +34,63 @@
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
47SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) 47SearchDialog::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
@@ -251,50 +256,50 @@ void SearchDialog::updateView()
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
270void SearchDialog::search(const QRegExp &re) 275void 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()) {
@@ -328,50 +333,51 @@ void SearchDialog::search(const QRegExp &re)
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 }
@@ -396,49 +402,50 @@ void SearchDialog::search(const QRegExp &re)
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
443void SearchDialog::keyPressEvent ( QKeyEvent *e) 450void SearchDialog::keyPressEvent ( QKeyEvent *e)
444{ 451{
diff --git a/korganizer/searchdialog.h b/korganizer/searchdialog.h
index 4559d20..11ad2f0 100644
--- a/korganizer/searchdialog.h
+++ b/korganizer/searchdialog.h
@@ -68,28 +68,29 @@ class SearchDialog : public QVBox
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
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index f446197..4382416 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -429,48 +429,59 @@ void Incidence::setRelatedTo(Incidence *relatedTo)
429 if (mReadOnly || mRelatedTo == relatedTo) return; 429 if (mReadOnly || mRelatedTo == relatedTo) return;
430 if(mRelatedTo) { 430 if(mRelatedTo) {
431 // updated(); 431 // updated();
432 mRelatedTo->removeRelation(this); 432 mRelatedTo->removeRelation(this);
433 } 433 }
434 mRelatedTo = relatedTo; 434 mRelatedTo = relatedTo;
435 if (mRelatedTo) { 435 if (mRelatedTo) {
436 mRelatedTo->addRelation(this); 436 mRelatedTo->addRelation(this);
437 mRelatedToUid = mRelatedTo->uid(); 437 mRelatedToUid = mRelatedTo->uid();
438 } else { 438 } else {
439 mRelatedToUid = ""; 439 mRelatedToUid = "";
440 } 440 }
441} 441}
442 442
443Incidence *Incidence::relatedTo() const 443Incidence *Incidence::relatedTo() const
444{ 444{
445 return mRelatedTo; 445 return mRelatedTo;
446} 446}
447 447
448QPtrList<Incidence> Incidence::relations() const 448QPtrList<Incidence> Incidence::relations() const
449{ 449{
450 return mRelations; 450 return mRelations;
451} 451}
452 452
453void Incidence::addRelationsToList(QPtrList<Incidence> *rel)
454{
455 Incidence* inc;
456 QPtrList<Incidence> Relations = relations();
457 for (inc=Relations.first();inc;inc=Relations.next()) {
458 inc->addRelationsToList( rel );
459 }
460 if ( rel->findRef( this ) == -1 )
461 rel->append( this );
462}
463
453void Incidence::addRelation(Incidence *event) 464void Incidence::addRelation(Incidence *event)
454{ 465{
455 if( mRelations.findRef( event ) == -1 ) { 466 if( mRelations.findRef( event ) == -1 ) {
456 mRelations.append(event); 467 mRelations.append(event);
457 //updated(); 468 //updated();
458 } 469 }
459} 470}
460 471
461void Incidence::removeRelation(Incidence *event) 472void Incidence::removeRelation(Incidence *event)
462{ 473{
463 474
464 mRelations.removeRef(event); 475 mRelations.removeRef(event);
465 476
466// if (event->getRelatedTo() == this) event->setRelatedTo(0); 477// if (event->getRelatedTo() == this) event->setRelatedTo(0);
467} 478}
468 479
469bool Incidence::recursOn(const QDate &qd) const 480bool Incidence::recursOn(const QDate &qd) const
470{ 481{
471 if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; 482 if (recurrence()->recursOnPure(qd) && !isException(qd)) return true;
472 else return false; 483 else return false;
473} 484}
474 485
475void Incidence::setExDates(const DateList &exDates) 486void Incidence::setExDates(const DateList &exDates)
476{ 487{
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index aa51e84..fc97ce9 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -92,49 +92,49 @@ class Incidence : public IncidenceBase
92 bool visit( Journal *j ) { return mResource->addJournal( j ); } 92 bool visit( Journal *j ) { return mResource->addJournal( j ); }
93 93
94 private: 94 private:
95 T *mResource; 95 T *mResource;
96 }; 96 };
97 97
98 /** enumeration for describing an event's secrecy. */ 98 /** enumeration for describing an event's secrecy. */
99 enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 }; 99 enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 };
100 typedef ListBase<Incidence> List; 100 typedef ListBase<Incidence> List;
101 Incidence(); 101 Incidence();
102 Incidence(const Incidence &); 102 Incidence(const Incidence &);
103 ~Incidence(); 103 ~Incidence();
104 104
105 /** 105 /**
106 Accept IncidenceVisitor. A class taking part in the visitor mechanism has to 106 Accept IncidenceVisitor. A class taking part in the visitor mechanism has to
107 provide this implementation: 107 provide this implementation:
108 <pre> 108 <pre>
109 bool accept(Visitor &v) { return v.visit(this); } 109 bool accept(Visitor &v) { return v.visit(this); }
110 </pre> 110 </pre>
111 */ 111 */
112 virtual bool accept(Visitor &) { return false; } 112 virtual bool accept(Visitor &) { return false; }
113 113
114 virtual Incidence *clone() = 0; 114 virtual Incidence *clone() = 0;
115 virtual void cloneRelations( Incidence * ); 115 virtual void cloneRelations( Incidence * );
116 116 void addRelationsToList(QPtrList<Incidence> *rel);
117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0; 117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0;
118 void setReadOnly( bool ); 118 void setReadOnly( bool );
119 119
120 /** 120 /**
121 Recreate event. The event is made a new unique event, but already stored 121 Recreate event. The event is made a new unique event, but already stored
122 event information is preserved. Sets uniquie id, creation date, last 122 event information is preserved. Sets uniquie id, creation date, last
123 modification date and revision number. 123 modification date and revision number.
124 */ 124 */
125 void recreate(); 125 void recreate();
126 Incidence* recreateCloneException(QDate); 126 Incidence* recreateCloneException(QDate);
127 127
128 /** set creation date */ 128 /** set creation date */
129 void setCreated(QDateTime); 129 void setCreated(QDateTime);
130 /** return time and date of creation. */ 130 /** return time and date of creation. */
131 QDateTime created() const; 131 QDateTime created() const;
132 132
133 /** set the number of revisions this event has seen */ 133 /** set the number of revisions this event has seen */
134 void setRevision(int rev); 134 void setRevision(int rev);
135 /** return the number of revisions this event has seen */ 135 /** return the number of revisions this event has seen */
136 int revision() const; 136 int revision() const;
137 137
138 /** Set starting date/time. */ 138 /** Set starting date/time. */
139 virtual void setDtStart(const QDateTime &dtStart); 139 virtual void setDtStart(const QDateTime &dtStart);
140 /** Return the incidence's ending date/time as a QDateTime. */ 140 /** Return the incidence's ending date/time as a QDateTime. */