summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-08 12:35:38 (UTC)
committer zautrix <zautrix>2005-06-08 12:35:38 (UTC)
commitd9e240cf1a88f4213c9169e9168d01b669613312 (patch) (unidiff)
treeed22cb872cc0f38625afe0f01036a48eb9b3edfa
parent2448916479b456ca7c880427a80e8e32e95b2fba (diff)
downloadkdepimpi-d9e240cf1a88f4213c9169e9168d01b669613312.zip
kdepimpi-d9e240cf1a88f4213c9169e9168d01b669613312.tar.gz
kdepimpi-d9e240cf1a88f4213c9169e9168d01b669613312.tar.bz2
better export
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
@@ -1313,69 +1313,69 @@
1313{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, 1313{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" },
1314{ "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" }, 1314{ "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" },
1315{ "KO/Pi Printout","KO/Pi Ausdruck" }, 1315{ "KO/Pi Printout","KO/Pi Ausdruck" },
1316{ "Print unscaled","Drucke unskaliert" }, 1316{ "Print unscaled","Drucke unskaliert" },
1317{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, 1317{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." },
1318{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, 1318{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." },
1319{ "Printout Mode","Druck Modus" }, 1319{ "Printout Mode","Druck Modus" },
1320{ "Filter menu icon","Filtermenu Icon" }, 1320{ "Filter menu icon","Filtermenu Icon" },
1321{ "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" }, 1321{ "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" },
1322{ "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" }, 1322{ "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" },
1323{ "%1d","%1t" }, 1323{ "%1d","%1t" },
1324{ "%1h","%1std" }, 1324{ "%1h","%1std" },
1325{ "%1min","%1min" }, 1325{ "%1min","%1min" },
1326{ "( %1 before )","( %1 vorher )" }, 1326{ "( %1 before )","( %1 vorher )" },
1327{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, 1327{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" },
1328{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, 1328{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" },
1329{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, 1329{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." },
1330{ "Show Sync Events","Zeige Sync-Ereignisse" }, 1330{ "Show Sync Events","Zeige Sync-Ereignisse" },
1331{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, 1331{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" },
1332{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, 1332{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" },
1333{ " on "," am " }, 1333{ " on "," am " },
1334{ "On: ","Am: " }, 1334{ "On: ","Am: " },
1335{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, 1335{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" },
1336{ "Start/Stop todo...","Starte/Stoppe Todo..." }, 1336{ "Start/Stop todo...","Starte/Stoppe Todo..." },
1337{ "Color for running todos:","Farbe für laufende Todos:" }, 1337{ "Color for running todos:","Farbe für laufende Todos:" },
1338{ "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" }, 1338{ "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" },
1339{ "Todo is started","Todo ist gestartet" }, 1339{ "Todo is started","Todo ist gestartet" },
1340{ "Stop todo","Stoppe Todo" }, 1340{ "Stop todo","Stoppe Todo" },
1341{ "Todo is stopped","Todo ist gestoppt" }, 1341{ "Todo is stopped","Todo ist gestoppt" },
1342{ "Start todo","Starte Todo" }, 1342{ "Start todo","Starte Todo" },
1343{ "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, 1343{ "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" },
1344{ "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, 1344{ "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" },
1345{ "Todo has subtodos","Todo hat Untertodos" }, 1345{ "Todo has subtodos","Todo hat Untertodos" },
1346{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, 1346{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" },
1347{ "Colors","Farben" }, 1347{ "Colors","Farben" },
1348{ "Click on new parent item","Klicke auf neues Übertodo" }, 1348{ "Click on new parent item","Klicke auf neues Übertodo" },
1349{ "Reparenting aborted!","Übertodo setzen abgebrochen" }, 1349{ "Reparenting aborted!","Übertodo setzen abgebrochen" },
1350{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, 1350{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" },
1351{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, 1351{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" },
1352{ "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, 1352{ "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" },
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
@@ -222,133 +222,133 @@ bool ListItemVisitor::visit(Journal * j)
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
237KOListView::KOListView(Calendar *calendar, QWidget *parent, 237KOListView::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
352KOListView::~KOListView() 352KOListView::~KOListView()
353{ 353{
354 delete mPopupMenu; 354 delete mPopupMenu;
@@ -605,137 +605,164 @@ void KOListView::saveDescriptionToFile()
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}
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 == "" )
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}
739void KOListView::hideAll() 766void KOListView::hideAll()
740{ 767{
741 QPtrList<QListViewItem> delSel ; 768 QPtrList<QListViewItem> delSel ;
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 59bf1a2..ef2fc1c 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -1,131 +1,136 @@
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
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
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
130SearchDialog::~SearchDialog() 135SearchDialog::~SearchDialog()
131{ 136{
@@ -211,254 +216,256 @@ void SearchDialog::doSearch()
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}
243void SearchDialog::updateConfig() 248void SearchDialog::updateConfig()
244{ 249{
245 listView->updateConfig(); 250 listView->updateConfig();
246} 251}
247void SearchDialog::updateView() 252void 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
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()) {
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
443void SearchDialog::keyPressEvent ( QKeyEvent *e) 450void 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
@@ -28,68 +28,69 @@
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
36class KDateEdit; 36class KDateEdit;
37class QCheckBox; 37class QCheckBox;
38class QLineEdit; 38class QLineEdit;
39class KLineEdit; 39class KLineEdit;
40class QLabel; 40class QLabel;
41class CalendarView; 41class CalendarView;
42 42
43using namespace KCal; 43using namespace KCal;
44class SearchDialog : public QVBox 44class 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
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index f446197..4382416 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -389,128 +389,139 @@ void Incidence::setCategories(const QString &catStr)
389 389
390 mCategories = QStringList::split(",",catStr); 390 mCategories = QStringList::split(",",catStr);
391 391
392 QStringList::Iterator it; 392 QStringList::Iterator it;
393 for(it = mCategories.begin();it != mCategories.end(); ++it) { 393 for(it = mCategories.begin();it != mCategories.end(); ++it) {
394 *it = (*it).stripWhiteSpace(); 394 *it = (*it).stripWhiteSpace();
395 } 395 }
396 checkCategories(); 396 checkCategories();
397 updated(); 397 updated();
398} 398}
399 399
400QStringList Incidence::categories() const 400QStringList Incidence::categories() const
401{ 401{
402 return mCategories; 402 return mCategories;
403} 403}
404 404
405QString Incidence::categoriesStr() 405QString Incidence::categoriesStr()
406{ 406{
407 return mCategories.join(","); 407 return mCategories.join(",");
408} 408}
409QString Incidence::categoriesStrWithSpace() 409QString Incidence::categoriesStrWithSpace()
410{ 410{
411 return mCategories.join(", "); 411 return mCategories.join(", ");
412} 412}
413 413
414void Incidence::setRelatedToUid(const QString &relatedToUid) 414void Incidence::setRelatedToUid(const QString &relatedToUid)
415{ 415{
416 if (mReadOnly) return; 416 if (mReadOnly) return;
417 mRelatedToUid = relatedToUid; 417 mRelatedToUid = relatedToUid;
418} 418}
419 419
420QString Incidence::relatedToUid() const 420QString Incidence::relatedToUid() const
421{ 421{
422 return mRelatedToUid; 422 return mRelatedToUid;
423} 423}
424 424
425void Incidence::setRelatedTo(Incidence *relatedTo) 425void Incidence::setRelatedTo(Incidence *relatedTo)
426{ 426{
427 //qDebug("Incidence::setRelatedTo %d ", relatedTo); 427 //qDebug("Incidence::setRelatedTo %d ", relatedTo);
428 //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); 428 //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() );
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{
477 if (mReadOnly) return; 488 if (mReadOnly) return;
478 mExDates = exDates; 489 mExDates = exDates;
479 490
480 recurrence()->setRecurExDatesCount(mExDates.count()); 491 recurrence()->setRecurExDatesCount(mExDates.count());
481 492
482 updated(); 493 updated();
483} 494}
484 495
485void Incidence::addExDate(const QDate &date) 496void Incidence::addExDate(const QDate &date)
486{ 497{
487 if (mReadOnly) return; 498 if (mReadOnly) return;
488 mExDates.append(date); 499 mExDates.append(date);
489 500
490 recurrence()->setRecurExDatesCount(mExDates.count()); 501 recurrence()->setRecurExDatesCount(mExDates.count());
491 502
492 updated(); 503 updated();
493} 504}
494 505
495DateList Incidence::exDates() const 506DateList Incidence::exDates() const
496{ 507{
497 return mExDates; 508 return mExDates;
498} 509}
499 510
500bool Incidence::isException(const QDate &date) const 511bool Incidence::isException(const QDate &date) const
501{ 512{
502 DateList::ConstIterator it; 513 DateList::ConstIterator it;
503 for( it = mExDates.begin(); it != mExDates.end(); ++it ) { 514 for( it = mExDates.begin(); it != mExDates.end(); ++it ) {
504 if ( (*it) == date ) { 515 if ( (*it) == date ) {
505 return true; 516 return true;
506 } 517 }
507 } 518 }
508 519
509 return false; 520 return false;
510} 521}
511 522
512void Incidence::addAttachment(Attachment *attachment) 523void Incidence::addAttachment(Attachment *attachment)
513{ 524{
514 if (mReadOnly || !attachment) return; 525 if (mReadOnly || !attachment) return;
515 mAttachments.append(attachment); 526 mAttachments.append(attachment);
516 updated(); 527 updated();
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index aa51e84..fc97ce9 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -52,129 +52,129 @@ class Incidence : public IncidenceBase
52 types of calendar components, without changing the calendar component classes. 52 types of calendar components, without changing the calendar component classes.
53 */ 53 */
54 class Visitor 54 class Visitor
55 { 55 {
56 public: 56 public:
57 /** Destruct Incidence::Visitor */ 57 /** Destruct Incidence::Visitor */
58 virtual ~Visitor() {} 58 virtual ~Visitor() {}
59 59
60 /** 60 /**
61 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions 61 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions
62 on an Event object. 62 on an Event object.
63 */ 63 */
64 virtual bool visit(Event *) { return false; } 64 virtual bool visit(Event *) { return false; }
65 /** 65 /**
66 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions 66 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions
67 on an Todo object. 67 on an Todo object.
68 */ 68 */
69 virtual bool visit(Todo *) { return false; } 69 virtual bool visit(Todo *) { return false; }
70 /** 70 /**
71 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions 71 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions
72 on an Journal object. 72 on an Journal object.
73 */ 73 */
74 virtual bool visit(Journal *) { return false; } 74 virtual bool visit(Journal *) { return false; }
75 75
76 protected: 76 protected:
77 /** Constructor is protected to prevent direct creation of visitor base class. */ 77 /** Constructor is protected to prevent direct creation of visitor base class. */
78 Visitor() {} 78 Visitor() {}
79 }; 79 };
80 80
81 /** 81 /**
82 This class implements a visitor for adding an Incidence to a resource 82 This class implements a visitor for adding an Incidence to a resource
83 supporting addEvent(), addTodo() and addJournal() calls. 83 supporting addEvent(), addTodo() and addJournal() calls.
84 */ 84 */
85 template<class T> 85 template<class T>
86 class AddVisitor : public Visitor 86 class AddVisitor : public Visitor
87 { 87 {
88 public: 88 public:
89 AddVisitor( T *r ) : mResource( r ) {} 89 AddVisitor( T *r ) : mResource( r ) {}
90 bool visit( Event *e ) { return mResource->addEvent( e ); } 90 bool visit( Event *e ) { return mResource->addEvent( e ); }
91 bool visit( Todo *t ) { return mResource->addTodo( t ); } 91 bool visit( Todo *t ) { return mResource->addTodo( t ); }
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. */
141 virtual QDateTime dtEnd() const { return QDateTime(); } 141 virtual QDateTime dtEnd() const { return QDateTime(); }
142 142
143 /** sets the event's lengthy description. */ 143 /** sets the event's lengthy description. */
144 void setDescription(const QString &description); 144 void setDescription(const QString &description);
145 /** returns a reference to the event's description. */ 145 /** returns a reference to the event's description. */
146 QString description() const; 146 QString description() const;
147 147
148 /** sets the event's short summary. */ 148 /** sets the event's short summary. */
149 void setSummary(const QString &summary); 149 void setSummary(const QString &summary);
150 /** returns a reference to the event's summary. */ 150 /** returns a reference to the event's summary. */
151 QString summary() const; 151 QString summary() const;
152 152
153 /** set event's applicable categories */ 153 /** set event's applicable categories */
154 void setCategories(const QStringList &categories, bool setForRelations = false); 154 void setCategories(const QStringList &categories, bool setForRelations = false);
155 void addCategories(const QStringList &categories, bool addToRelations = false); 155 void addCategories(const QStringList &categories, bool addToRelations = false);
156 /** set event's categories based on a comma delimited string */ 156 /** set event's categories based on a comma delimited string */
157 void setCategories(const QString &catStr); 157 void setCategories(const QString &catStr);
158 /** return categories in a list */ 158 /** return categories in a list */
159 QStringList categories() const; 159 QStringList categories() const;
160 /** return categories as a comma separated string */ 160 /** return categories as a comma separated string */
161 QString categoriesStr(); 161 QString categoriesStr();
162 QString categoriesStrWithSpace(); 162 QString categoriesStrWithSpace();
163 163
164 /** point at some other event to which the event relates. This function should 164 /** point at some other event to which the event relates. This function should
165 * only be used when constructing a calendar before the related Event 165 * only be used when constructing a calendar before the related Event
166 * exists. */ 166 * exists. */
167 void setRelatedToUid(const QString &); 167 void setRelatedToUid(const QString &);
168 /** what event does this one relate to? This function should 168 /** what event does this one relate to? This function should
169 * only be used when constructing a calendar before the related Event 169 * only be used when constructing a calendar before the related Event
170 * exists. */ 170 * exists. */
171 QString relatedToUid() const; 171 QString relatedToUid() const;
172 /** point at some other event to which the event relates */ 172 /** point at some other event to which the event relates */
173 void setRelatedTo(Incidence *relatedTo); 173 void setRelatedTo(Incidence *relatedTo);
174 /** what event does this one relate to? */ 174 /** what event does this one relate to? */
175 Incidence *relatedTo() const; 175 Incidence *relatedTo() const;
176 /** All events that are related to this event */ 176 /** All events that are related to this event */
177 QPtrList<Incidence> relations() const; 177 QPtrList<Incidence> relations() const;
178 /** Add an event which is related to this event */ 178 /** Add an event which is related to this event */
179 void addRelation(Incidence *); 179 void addRelation(Incidence *);
180 /** Remove event that is related to this event */ 180 /** Remove event that is related to this event */