summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-18 10:41:31 (UTC)
committer zautrix <zautrix>2005-04-18 10:41:31 (UTC)
commit409e329447a7d00a93a56855fcddadbb0f793163 (patch) (unidiff)
tree1c92498d2dfb4c89358c64a6944aca1300a27d11
parent0ff0dca7ccb94ebb1381351e4e4081fe0bac500a (diff)
downloadkdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.zip
kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.tar.gz
kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.tar.bz2
morefixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt2
-rw-r--r--korganizer/koeditorgeneraltodo.cpp20
-rw-r--r--korganizer/kolistview.cpp53
-rw-r--r--korganizer/kotodoeditor.cpp53
-rw-r--r--korganizer/kotodoview.cpp11
-rw-r--r--libkcal/incidence.cpp28
-rw-r--r--libkcal/incidence.h3
7 files changed, 103 insertions, 67 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 2981762..7fa92bf 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1259,102 +1259,102 @@
1259{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, 1259{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" },
1260{ "Synchronize!","Synchronisiere!" }, 1260{ "Synchronize!","Synchronisiere!" },
1261{ "High clock skew!","Großer Uhrzeitunterschied!" }, 1261{ "High clock skew!","Großer Uhrzeitunterschied!" },
1262{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, 1262{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" },
1263{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" }, 1263{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" },
1264{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, 1264{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." },
1265{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, 1265{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" },
1266{ "List week view","Listenwochenansicht" }, 1266{ "List week view","Listenwochenansicht" },
1267{ "List week","Listenwochenansicht" }, 1267{ "List week","Listenwochenansicht" },
1268{ "Next Week","Nächste Woche" }, 1268{ "Next Week","Nächste Woche" },
1269{ "Previous Week","Vorherige Woche" }, 1269{ "Previous Week","Vorherige Woche" },
1270{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." }, 1270{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." },
1271{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, 1271{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" },
1272{ "Details","Details" }, 1272{ "Details","Details" },
1273{ "Created time","Erstellt Zeit" }, 1273{ "Created time","Erstellt Zeit" },
1274{ "Last modified time","Geändert Zeit" }, 1274{ "Last modified time","Geändert Zeit" },
1275{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, 1275{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" },
1276{ "View Options","Anzeige Optionen" }, 1276{ "View Options","Anzeige Optionen" },
1277{ "<b>Created: ","<b>Erstellt am: " }, 1277{ "<b>Created: ","<b>Erstellt am: " },
1278{ "<b>Last modified: ","<b>Zuletzt geändert am: " }, 1278{ "<b>Last modified: ","<b>Zuletzt geändert am: " },
1279{ "Journal: ","Journal: " }, 1279{ "Journal: ","Journal: " },
1280{ "yearly","jährlich" }, 1280{ "yearly","jährlich" },
1281{ "(%1) ","%1-" }, 1281{ "(%1) ","%1-" },
1282{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, 1282{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" },
1283{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, 1283{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" },
1284{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, 1284{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" },
1285{ "Summary/Loc.","Titel/Ort" }, 1285{ "Summary/Loc.","Titel/Ort" },
1286{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, 1286{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." },
1287{ "Week Number","Wochennummer" }, 1287{ "Week Number","Wochennummer" },
1288{ "Import","Importiere" }, 1288{ "Import","Importiere" },
1289{ "Export","Exportiere" }, 1289{ "Export","Exportiere" },
1290{ "Beam","Beame" }, 1290{ "Beam","Beame" },
1291{ "Export selected","Exportiere Selektierte" }, 1291{ "Export selected","Exportiere Selektierte" },
1292{ "As iCal (ics) file...","Als iCal (ics) Datei..." }, 1292{ "As iCal (ics) file...","Als iCal (ics) Datei..." },
1293{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, 1293{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." },
1294{ "Journal/Details...","Journale/Details..." }, 1294{ "Journal/Details...","Journale/Details..." },
1295{ "Agenda View","Agenda Ansicht" }, 1295{ "Agenda View","Agenda Ansicht" },
1296{ "Show current time","Zeige aktuelle Zeit" }, 1296{ "Show current time","Zeige aktuelle Zeit" },
1297{ "Edit new item","Bearbeite neuen Eintrag" }, 1297{ "Edit new item","Bearbeite neuen Eintrag" },
1298{ "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" }, 1298{ "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" },
1299{ "There is no next alarm.","Es gibt keinen nächsten Alarm." }, 1299{ "There is no next alarm.","Es gibt keinen nächsten Alarm." },
1300{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, 1300{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" },
1301{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, 1301{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" },
1302{ "%1 days\n","%1 Tagen\n" }, 1302{ "%1 days\n","%1 Tagen\n" },
1303{ "1 day\n","1 Tag\n" }, 1303{ "1 day\n","1 Tag\n" },
1304{ "%1 hours\n","%1 Stunden\n" }, 1304{ "%1 hours\n","%1 Stunden\n" },
1305{ "1 hour\n","1 Stunde\n" }, 1305{ "1 hour\n","1 Stunde\n" },
1306{ "%1 minutes\n","%1 Minuten\n" }, 1306{ "%1 minutes\n","%1 Minuten\n" },
1307{ "1 minute\n","1 Minute\n" }, 1307{ "1 minute\n","1 Minute\n" },
1308{ "Only one toolbar","Nur eine Toolbar" }, 1308{ "Only one toolbar","Nur eine Toolbar" },
1309{ "Print","Drucke" }, 1309{ "Print","Drucke" },
1310{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, 1310{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." },
1311{ "There is nothing selected!","Es ist nichts ausgewählt!" }, 1311{ "There is nothing selected!","Es ist nichts ausgewählt!" },
1312{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, 1312{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " },
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 in WN+Agenda","Zeige Sync-Ereignisse in WN+Agenda" }, 1330{ "Show Sync Events in WN+Agenda","Zeige Sync-Ereignisse in WN+Agenda" },
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 is gestarted" }, 1339{ "Todo is started","Todo is gestarted" },
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{ "","" }, 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{ "","" }, 1356{ "","" },
1357{ "","" }, 1357{ "","" },
1358{ "","" }, 1358{ "","" },
1359{ "","" }, 1359{ "","" },
1360{ "","" }, 1360{ "","" },
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index 4a1576a..e86b4d0 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -1,216 +1,217 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qfiledialog.h> 25#include <qfiledialog.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qapplication.h> 32#include <qapplication.h>
33 33
34#include <kglobal.h> 34#include <kglobal.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kiconloader.h> 36#include <kiconloader.h>
37#include <kmessagebox.h> 37#include <kmessagebox.h>
38#include <kdebug.h> 38#include <kdebug.h>
39#include <krestrictedline.h> 39#include <krestrictedline.h>
40#include <kstandarddirs.h> 40#include <kstandarddirs.h>
41#include <kfiledialog.h> 41#include <kfiledialog.h>
42#include <kdialog.h>
42 43
43#include <libkcal/todo.h> 44#include <libkcal/todo.h>
44 45
45#include <libkdepim/kdateedit.h> 46#include <libkdepim/kdateedit.h>
46 47
47#include "koprefs.h" 48#include "koprefs.h"
48#include "ktimeedit.h" 49#include "ktimeedit.h"
49 50
50#include "koeditorgeneraltodo.h" 51#include "koeditorgeneraltodo.h"
51#include "kolocationbox.h" 52#include "kolocationbox.h"
52 53
53KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, 54KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent,
54 const char* name) 55 const char* name)
55 : KOEditorGeneral( parent, name) 56 : KOEditorGeneral( parent, name)
56{ 57{
57} 58}
58 59
59KOEditorGeneralTodo::~KOEditorGeneralTodo() 60KOEditorGeneralTodo::~KOEditorGeneralTodo()
60{ 61{
61} 62}
62 63
63void KOEditorGeneralTodo::finishSetup() 64void KOEditorGeneralTodo::finishSetup()
64{ 65{
65 66
66// QWidget::setTabOrder(mSummaryEdit, mLocationEdit); 67// QWidget::setTabOrder(mSummaryEdit, mLocationEdit);
67// QWidget::setTabOrder(mLocationEdit, mDueCheck); 68// QWidget::setTabOrder(mLocationEdit, mDueCheck);
68// QWidget::setTabOrder(mDueCheck, mDueDateEdit); 69// QWidget::setTabOrder(mDueCheck, mDueDateEdit);
69// QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); 70// QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit);
70// QWidget::setTabOrder(mDueTimeEdit, mStartCheck); 71// QWidget::setTabOrder(mDueTimeEdit, mStartCheck);
71// QWidget::setTabOrder(mStartCheck, mStartDateEdit); 72// QWidget::setTabOrder(mStartCheck, mStartDateEdit);
72// QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); 73// QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit);
73// QWidget::setTabOrder(mStartTimeEdit, mTimeButton); 74// QWidget::setTabOrder(mStartTimeEdit, mTimeButton);
74// QWidget::setTabOrder(mTimeButton, mCompletedCombo); 75// QWidget::setTabOrder(mTimeButton, mCompletedCombo);
75// QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); 76// QWidget::setTabOrder(mCompletedCombo, mPriorityCombo);
76// QWidget::setTabOrder(mPriorityCombo, mAlarmButton); 77// QWidget::setTabOrder(mPriorityCombo, mAlarmButton);
77// QWidget::setTabOrder(mAlarmButton, mCategoriesButton); 78// QWidget::setTabOrder(mAlarmButton, mCategoriesButton);
78// QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); 79// QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo);
79// QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); 80// QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit);
80 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 81 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
81 mSummaryEdit->setFocus(); 82 mSummaryEdit->setFocus();
82} 83}
83 84
84void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) 85void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
85{ 86{
86 QBoxLayout *timeLayout = new QVBoxLayout(topLayout); 87 QBoxLayout *timeLayout = new QVBoxLayout(topLayout);
87 88
88 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, 89 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal,
89 i18n("Date && Time"),parent); 90 i18n("Date && Time"),parent);
90 timeLayout->addWidget(timeGroupBox); 91 timeLayout->addWidget(timeGroupBox);
91 timeGroupBox->layout()->setSpacing( 0 ); 92 timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() );
92 timeGroupBox->layout()->setMargin( 5 ); 93 timeGroupBox->layout()->setMargin( KDialog::marginHint() );
93 QFrame *timeBoxFrame = new QFrame(timeGroupBox); 94 QFrame *timeBoxFrame = new QFrame(timeGroupBox);
94 95
95 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); 96 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3);
96 layoutTimeBox->setSpacing(topLayout->spacing()); 97 layoutTimeBox->setSpacing(KDialog::spacingHintSmall());
97 layoutTimeBox->setColStretch( 1, 1 ); 98 layoutTimeBox->setColStretch( 1, 1 );
98 99
99 mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); 100 mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame);
100 layoutTimeBox->addWidget(mDueCheck,0,0); 101 layoutTimeBox->addWidget(mDueCheck,1,0);
101 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); 102 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool)));
102 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); 103 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm()));
103 104
104 105
105 mDueDateEdit = new KDateEdit(timeBoxFrame); 106 mDueDateEdit = new KDateEdit(timeBoxFrame);
106 layoutTimeBox->addWidget(mDueDateEdit,0,1); 107 layoutTimeBox->addWidget(mDueDateEdit,1,1);
107 108
108 mDueTimeEdit = new KOTimeEdit(timeBoxFrame); 109 mDueTimeEdit = new KOTimeEdit(timeBoxFrame);
109 layoutTimeBox->addWidget(mDueTimeEdit,0,2); 110 layoutTimeBox->addWidget(mDueTimeEdit,1,2);
110 111
111 112
112 mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); 113 mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame);
113 layoutTimeBox->addWidget(mStartCheck,1,0); 114 layoutTimeBox->addWidget(mStartCheck,0,0);
114 connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); 115 connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool)));
115 116
116 mStartDateEdit = new KDateEdit(timeBoxFrame); 117 mStartDateEdit = new KDateEdit(timeBoxFrame);
117 layoutTimeBox->addWidget(mStartDateEdit,1,1); 118 layoutTimeBox->addWidget(mStartDateEdit,0,1);
118 119
119 mStartTimeEdit = new KOTimeEdit(timeBoxFrame); 120 mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
120 layoutTimeBox->addWidget(mStartTimeEdit,1,2); 121 layoutTimeBox->addWidget(mStartTimeEdit,0,2);
121 122
122 123
123 mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); 124 mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame);
124 layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); 125 layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1);
125 126
126 connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); 127 connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool)));
127 connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime))); 128 connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime)));
128 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); 129 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime)));
129 130
130 // some more layouting 131 // some more layouting
131 //layoutTimeBox->setColStretch(3,1); 132 //layoutTimeBox->setColStretch(3,1);
132} 133}
133 134
134 135
135void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) 136void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout)
136{ 137{
137 mCompletedCombo = new QComboBox(parent); 138 mCompletedCombo = new QComboBox(parent);
138 // xgettext:no-c-format 139 // xgettext:no-c-format
139 mCompletedCombo->insertItem(i18n(" 0 %")); 140 mCompletedCombo->insertItem(i18n(" 0 %"));
140 // xgettext:no-c-format 141 // xgettext:no-c-format
141 mCompletedCombo->insertItem(i18n(" 20 %")); 142 mCompletedCombo->insertItem(i18n(" 20 %"));
142 // xgettext:no-c-format 143 // xgettext:no-c-format
143 mCompletedCombo->insertItem(i18n(" 40 %")); 144 mCompletedCombo->insertItem(i18n(" 40 %"));
144 // xgettext:no-c-format 145 // xgettext:no-c-format
145 mCompletedCombo->insertItem(i18n(" 60 %")); 146 mCompletedCombo->insertItem(i18n(" 60 %"));
146 // xgettext:no-c-format 147 // xgettext:no-c-format
147 mCompletedCombo->insertItem(i18n(" 80 %")); 148 mCompletedCombo->insertItem(i18n(" 80 %"));
148 // xgettext:no-c-format 149 // xgettext:no-c-format
149 mCompletedCombo->insertItem(i18n("100 %")); 150 mCompletedCombo->insertItem(i18n("100 %"));
150 connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); 151 connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int)));
151 topLayout->addWidget(mCompletedCombo); 152 topLayout->addWidget(mCompletedCombo);
152 153
153 mCompletedLabel = new QLabel(i18n("completed"),parent); 154 mCompletedLabel = new QLabel(i18n("completed"),parent);
154 topLayout->addWidget(mCompletedLabel); 155 topLayout->addWidget(mCompletedLabel);
155 156
156 mCompleteDateEdit = new KDateEdit(parent); 157 mCompleteDateEdit = new KDateEdit(parent);
157 topLayout->addWidget(mCompleteDateEdit ); 158 topLayout->addWidget(mCompleteDateEdit );
158 159
159 mCompleteTimeEdit = new KOTimeEdit(parent); 160 mCompleteTimeEdit = new KOTimeEdit(parent);
160 topLayout->addWidget( mCompleteTimeEdit); 161 topLayout->addWidget( mCompleteTimeEdit);
161 162
162 mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); 163 mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) );
163 mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); 164 mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) );
164 connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime))); 165 connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime)));
165 166
166 if ( QApplication::desktop()->width() <= 480 ) { 167 if ( QApplication::desktop()->width() <= 480 ) {
167 if ( QApplication::desktop()->width() < 320 ) 168 if ( QApplication::desktop()->width() < 320 )
168 mCompleteDateEdit->setMaximumWidth( 85 ); 169 mCompleteDateEdit->setMaximumWidth( 85 );
169 else 170 else
170 mCompleteDateEdit->setMaximumWidth( 140 ); 171 mCompleteDateEdit->setMaximumWidth( 140 );
171 topLayout->setSpacing( 0 ); 172 topLayout->setSpacing( 0 );
172 } 173 }
173} 174}
174 175
175void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) 176void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout)
176{ 177{
177 178
178 QHBox* h = new QHBox ( parent ); 179 QHBox* h = new QHBox ( parent );
179 topLayout->addWidget( h ); 180 topLayout->addWidget( h );
180 QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); 181 QLabel *priorityLabel = new QLabel(i18n("Priority:"), h);
181 // topLayout->addWidget(priorityLabel); 182 // topLayout->addWidget(priorityLabel);
182 mPriorityCombo = new QComboBox( h ); 183 mPriorityCombo = new QComboBox( h );
183 mPriorityCombo->insertItem(i18n("1 (high)")); 184 mPriorityCombo->insertItem(i18n("1 (high)"));
184 mPriorityCombo->insertItem(i18n("2")); 185 mPriorityCombo->insertItem(i18n("2"));
185 mPriorityCombo->insertItem(i18n("3")); 186 mPriorityCombo->insertItem(i18n("3"));
186 mPriorityCombo->insertItem(i18n("4")); 187 mPriorityCombo->insertItem(i18n("4"));
187 mPriorityCombo->insertItem(i18n("5 (low)")); 188 mPriorityCombo->insertItem(i18n("5 (low)"));
188 //topLayout->addWidget(mPriorityCombo); 189 //topLayout->addWidget(mPriorityCombo);
189} 190}
190 191
191void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) 192void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout)
192{ 193{
193 QBoxLayout *statusLayout = new QHBoxLayout(topLayout); 194 QBoxLayout *statusLayout = new QHBoxLayout(topLayout);
194 195
195 initCompletion( parent, statusLayout ); 196 initCompletion( parent, statusLayout );
196 197
197 statusLayout->addStretch( 1 ); 198 statusLayout->addStretch( 1 );
198 199
199 initPriority( parent, statusLayout ); 200 initPriority( parent, statusLayout );
200} 201}
201 202
202void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) 203void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay)
203{ 204{
204 205
205 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 206 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
206 mLocationEdit->load(KOLocationBox::LOCATION); 207 mLocationEdit->load(KOLocationBox::LOCATION);
207 KOEditorGeneral::setDefaults(allDay); 208 KOEditorGeneral::setDefaults(allDay);
208 209
209 mTimeButton->setChecked( !allDay ); 210 mTimeButton->setChecked( !allDay );
210 if(mTimeButton->isChecked()) { 211 if(mTimeButton->isChecked()) {
211 mTimeButton->setEnabled(true); 212 mTimeButton->setEnabled(true);
212 } 213 }
213 else { 214 else {
214 mTimeButton->setEnabled(false); 215 mTimeButton->setEnabled(false);
215 } 216 }
216 217
@@ -248,193 +249,192 @@ void KOEditorGeneralTodo::readTodo(Todo *todo)
248 249
249 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 250 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
250 mLocationEdit->load(KOLocationBox::LOCATION); 251 mLocationEdit->load(KOLocationBox::LOCATION);
251 KOEditorGeneral::readIncidence(todo); 252 KOEditorGeneral::readIncidence(todo);
252 253
253 QDateTime dueDT; 254 QDateTime dueDT;
254 255
255 if (todo->hasDueDate()) { 256 if (todo->hasDueDate()) {
256 enableAlarmEdit(true); 257 enableAlarmEdit(true);
257 dueDT = todo->dtDue(); 258 dueDT = todo->dtDue();
258 mDueDateEdit->setDate(todo->dtDue().date()); 259 mDueDateEdit->setDate(todo->dtDue().date());
259 mDueTimeEdit->setTime(todo->dtDue().time()); 260 mDueTimeEdit->setTime(todo->dtDue().time());
260 mDueCheck->setChecked(true); 261 mDueCheck->setChecked(true);
261 } else { 262 } else {
262 alarmDisable(true); 263 alarmDisable(true);
263 mDueDateEdit->setEnabled(false); 264 mDueDateEdit->setEnabled(false);
264 mDueTimeEdit->setEnabled(false); 265 mDueTimeEdit->setEnabled(false);
265 mDueDateEdit->setDate(QDate::currentDate()); 266 mDueDateEdit->setDate(QDate::currentDate());
266 mDueTimeEdit->setTime(QTime::currentTime()); 267 mDueTimeEdit->setTime(QTime::currentTime());
267 mDueCheck->setChecked(false); 268 mDueCheck->setChecked(false);
268 } 269 }
269 270
270 if (todo->hasStartDate()) { 271 if (todo->hasStartDate()) {
271 mStartDateEdit->setDate(todo->dtStart().date()); 272 mStartDateEdit->setDate(todo->dtStart().date());
272 mStartTimeEdit->setTime(todo->dtStart().time()); 273 mStartTimeEdit->setTime(todo->dtStart().time());
273 mStartCheck->setChecked(true); 274 mStartCheck->setChecked(true);
274 } else { 275 } else {
275 mStartDateEdit->setEnabled(false); 276 mStartDateEdit->setEnabled(false);
276 mStartTimeEdit->setEnabled(false); 277 mStartTimeEdit->setEnabled(false);
277 mStartDateEdit->setDate(QDate::currentDate()); 278 mStartDateEdit->setDate(QDate::currentDate());
278 mStartTimeEdit->setTime(QTime::currentTime()); 279 mStartTimeEdit->setTime(QTime::currentTime());
279 mStartCheck->setChecked(false); 280 mStartCheck->setChecked(false);
280 } 281 }
281 282
282 mTimeButton->setChecked( !todo->doesFloat() ); 283 mTimeButton->setChecked( !todo->doesFloat() );
283 284
284 mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); 285 mCompletedCombo->setCurrentItem(todo->percentComplete() / 20);
285 if (todo->isCompleted() && todo->hasCompletedDate()) { 286 if (todo->isCompleted() && todo->hasCompletedDate()) {
286 mCompleted = todo->completed(); 287 mCompleted = todo->completed();
287 } 288 }
288 setCompletedDate(); 289 setCompletedDate();
289 290
290 mPriorityCombo->setCurrentItem(todo->priority()-1); 291 mPriorityCombo->setCurrentItem(todo->priority()-1);
291} 292}
292 293
293void KOEditorGeneralTodo::writeTodo(Todo *todo) 294void KOEditorGeneralTodo::writeTodo(Todo *todo)
294{ 295{
295 KOEditorGeneral::writeIncidence(todo); 296 KOEditorGeneral::writeIncidence(todo);
296 297
297 // temp. until something better happens. 298 // temp. until something better happens.
298 QString tmpStr; 299 QString tmpStr;
299 300
300 todo->setHasDueDate(mDueCheck->isChecked()); 301 todo->setHasDueDate(mDueCheck->isChecked());
301 todo->setHasStartDate(mStartCheck->isChecked()); 302 todo->setHasStartDate(mStartCheck->isChecked());
302 303
303 QDate tmpDate; 304 QDate tmpDate;
304 QTime tmpTime; 305 QTime tmpTime;
305 QDateTime tmpDT; 306 QDateTime tmpDT;
306 if ( mTimeButton->isChecked() ) { 307 if ( mTimeButton->isChecked() ) {
307 todo->setFloats(false); 308 todo->setFloats(false);
308 309
309 // set due date/time 310 // set due date/time
310 tmpDate = mDueDateEdit->date(); 311 tmpDate = mDueDateEdit->date();
311 tmpTime = mDueTimeEdit->getTime(); 312 tmpTime = mDueTimeEdit->getTime();
312 tmpDT.setDate(tmpDate); 313 tmpDT.setDate(tmpDate);
313 tmpDT.setTime(tmpTime); 314 tmpDT.setTime(tmpTime);
314 todo->setDtDue(tmpDT); 315 todo->setDtDue(tmpDT);
315 316
316 // set start date/time 317 // set start date/time
317 tmpDate = mStartDateEdit->date(); 318 tmpDate = mStartDateEdit->date();
318 tmpTime = mStartTimeEdit->getTime(); 319 tmpTime = mStartTimeEdit->getTime();
319 tmpDT.setDate(tmpDate); 320 tmpDT.setDate(tmpDate);
320 tmpDT.setTime(tmpTime); 321 tmpDT.setTime(tmpTime);
321 todo->setDtStart(tmpDT); 322 todo->setDtStart(tmpDT);
322 } else { 323 } else {
323 todo->setFloats(true); 324 todo->setFloats(true);
324 325
325 // need to change this. 326 // need to change this.
326 tmpDate = mDueDateEdit->date(); 327 tmpDate = mDueDateEdit->date();
327 tmpTime.setHMS(0,0,0); 328 tmpTime.setHMS(0,0,0);
328 tmpDT.setDate(tmpDate); 329 tmpDT.setDate(tmpDate);
329 tmpDT.setTime(tmpTime); 330 tmpDT.setTime(tmpTime);
330 todo->setDtDue(tmpDT); 331 todo->setDtDue(tmpDT);
331 332
332 tmpDate = mStartDateEdit->date(); 333 tmpDate = mStartDateEdit->date();
333 tmpTime.setHMS(0,0,0); 334 tmpTime.setHMS(0,0,0);
334 tmpDT.setDate(tmpDate); 335 tmpDT.setDate(tmpDate);
335 tmpDT.setTime(tmpTime); 336 tmpDT.setTime(tmpTime);
336 todo->setDtStart(tmpDT); 337 todo->setDtStart(tmpDT);
337 } 338 }
338 todo->setPriority(mPriorityCombo->currentItem()+1); 339 todo->setPriority(mPriorityCombo->currentItem()+1);
339 340
340 // set completion state 341 // set completion state
341 if ( mCompletedCombo->currentItem() == 5 ) { 342 if ( mCompletedCombo->currentItem() == 5 ) {
342 QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() ); 343 QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() );
343 if ( comp.isValid () ) { 344 if ( comp.isValid () ) {
344 todo->setPercentComplete(0);
345 todo->setPercentComplete(100); 345 todo->setPercentComplete(100);
346 todo->setCompleted(comp); 346 todo->setCompleted(comp);
347 } else { 347 } else {
348 todo->setPercentComplete( 100 ); 348 todo->setPercentComplete( 100 );
349 if ( mCompleted.isValid() ) 349 if ( mCompleted.isValid() )
350 todo->setCompleted(mCompleted); 350 todo->setCompleted(mCompleted);
351 } 351 }
352 } else { 352 } else {
353 todo->setPercentComplete(mCompletedCombo->currentItem() * 20); 353 todo->setPercentComplete(mCompletedCombo->currentItem() * 20);
354 } 354 }
355 355
356 mSummaryEdit->save(KOLocationBox::SUMMARYTODO); 356 mSummaryEdit->save(KOLocationBox::SUMMARYTODO);
357} 357}
358 358
359void KOEditorGeneralTodo::enableDueEdit(bool enable) 359void KOEditorGeneralTodo::enableDueEdit(bool enable)
360{ 360{
361 mDueDateEdit->setEnabled( enable ); 361 mDueDateEdit->setEnabled( enable );
362 362
363 if(mDueCheck->isChecked() || mStartCheck->isChecked()) { 363 if(mDueCheck->isChecked() || mStartCheck->isChecked()) {
364 mTimeButton->setEnabled(true); 364 mTimeButton->setEnabled(true);
365 } 365 }
366 else { 366 else {
367 mTimeButton->setEnabled(false); 367 mTimeButton->setEnabled(false);
368 mTimeButton->setChecked(false); 368 mTimeButton->setChecked(false);
369 } 369 }
370 370
371 if (enable) { 371 if (enable) {
372 mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); 372 mDueTimeEdit->setEnabled( mTimeButton->isChecked() );
373 } else { 373 } else {
374 mDueTimeEdit->setEnabled( false ); 374 mDueTimeEdit->setEnabled( false );
375 } 375 }
376 emit datesChecked(); 376 emit datesChecked();
377} 377}
378 378
379void KOEditorGeneralTodo::enableStartEdit( bool enable ) 379void KOEditorGeneralTodo::enableStartEdit( bool enable )
380{ 380{
381 mStartDateEdit->setEnabled( enable ); 381 mStartDateEdit->setEnabled( enable );
382 382
383 if(mDueCheck->isChecked() || mStartCheck->isChecked()) { 383 if(mDueCheck->isChecked() || mStartCheck->isChecked()) {
384 mTimeButton->setEnabled(true); 384 mTimeButton->setEnabled(true);
385 } 385 }
386 else { 386 else {
387 mTimeButton->setEnabled(false); 387 mTimeButton->setEnabled(false);
388 mTimeButton->setChecked(false); 388 mTimeButton->setChecked(false);
389 } 389 }
390 390
391 if (enable) { 391 if (enable) {
392 mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); 392 mStartTimeEdit->setEnabled( mTimeButton->isChecked() );
393 } else { 393 } else {
394 mStartTimeEdit->setEnabled( false ); 394 mStartTimeEdit->setEnabled( false );
395 } 395 }
396 emit datesChecked(); 396 emit datesChecked();
397} 397}
398 398
399void KOEditorGeneralTodo::enableTimeEdits(bool enable) 399void KOEditorGeneralTodo::enableTimeEdits(bool enable)
400{ 400{
401 if(mStartCheck->isChecked()) { 401 if(mStartCheck->isChecked()) {
402 mStartTimeEdit->setEnabled( enable ); 402 mStartTimeEdit->setEnabled( enable );
403 } 403 }
404 if(mDueCheck->isChecked()) { 404 if(mDueCheck->isChecked()) {
405 mDueTimeEdit->setEnabled( enable ); 405 mDueTimeEdit->setEnabled( enable );
406 } 406 }
407} 407}
408 408
409void KOEditorGeneralTodo::showAlarm() 409void KOEditorGeneralTodo::showAlarm()
410{ 410{
411 if ( mDueCheck->isChecked() ) { 411 if ( mDueCheck->isChecked() ) {
412 alarmDisable(false); 412 alarmDisable(false);
413 } 413 }
414 else { 414 else {
415 alarmDisable(true); 415 alarmDisable(true);
416 } 416 }
417} 417}
418 418
419bool KOEditorGeneralTodo::validateInput() 419bool KOEditorGeneralTodo::validateInput()
420{ 420{
421 if (mDueCheck->isChecked()) { 421 if (mDueCheck->isChecked()) {
422 if (!mDueDateEdit->inputIsValid()) { 422 if (!mDueDateEdit->inputIsValid()) {
423 KMessageBox::sorry(0,i18n("Please specify a valid due date.")); 423 KMessageBox::sorry(0,i18n("Please specify a valid due date."));
424 return false; 424 return false;
425 } 425 }
426 } 426 }
427 427
428 if (mStartCheck->isChecked()) { 428 if (mStartCheck->isChecked()) {
429 if (!mStartDateEdit->inputIsValid()) { 429 if (!mStartDateEdit->inputIsValid()) {
430 KMessageBox::sorry(0,i18n("Please specify a valid start date.")); 430 KMessageBox::sorry(0,i18n("Please specify a valid start date."));
431 return false; 431 return false;
432 } 432 }
433 } 433 }
434 434
435 if (mStartCheck->isChecked() && mDueCheck->isChecked()) { 435 if (mStartCheck->isChecked() && mDueCheck->isChecked()) {
436 QDateTime startDate; 436 QDateTime startDate;
437 QDateTime dueDate; 437 QDateTime dueDate;
438 startDate.setDate(mStartDateEdit->date()); 438 startDate.setDate(mStartDateEdit->date());
439 dueDate.setDate(mDueDateEdit->date()); 439 dueDate.setDate(mDueDateEdit->date());
440 if (mTimeButton->isChecked()) { 440 if (mTimeButton->isChecked()) {
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index bbf83d9..fd86095 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -278,305 +278,306 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
278 i18n("Deselect all"),this, 278 i18n("Deselect all"),this,
279 SLOT(clearSelection()),true); 279 SLOT(clearSelection()),true);
280 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 280 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
281 i18n("Delete all selected"),this, 281 i18n("Delete all selected"),this,
282 SLOT(deleteAll()),true); 282 SLOT(deleteAll()),true);
283 mPopupMenu->insertSeparator(); 283 mPopupMenu->insertSeparator();
284 QPopupMenu * exportPO = new QPopupMenu ( this ); 284 QPopupMenu * exportPO = new QPopupMenu ( this );
285 mPopupMenu->insertItem( i18n("Export selected"), exportPO ); 285 mPopupMenu->insertItem( i18n("Export selected"), exportPO );
286 exportPO->insertItem( i18n("As iCal (ics) file..."),this, 286 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
287 SLOT(saveToFile())); 287 SLOT(saveToFile()));
288 exportPO->insertItem( i18n("As vCal (vcs) file..."),this, 288 exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
289 SLOT(saveToFileVCS())); 289 SLOT(saveToFileVCS()));
290 exportPO->insertItem( i18n("Journal/Details..."),this, 290 exportPO->insertItem( i18n("Journal/Details..."),this,
291 SLOT(saveDescriptionToFile())); 291 SLOT(saveDescriptionToFile()));
292 // mPopupMenu->insertSeparator(); 292 // mPopupMenu->insertSeparator();
293 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 293 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
294 i18n("Add Categ. to selected..."),this, 294 i18n("Add Categ. to selected..."),this,
295 SLOT(addCat()),true); 295 SLOT(addCat()),true);
296 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 296 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
297 i18n("Set Categ. for selected..."),this, 297 i18n("Set Categ. for selected..."),this,
298 SLOT(setCat()),true); 298 SLOT(setCat()),true);
299 //mPopupMenu->insertSeparator(); 299 //mPopupMenu->insertSeparator();
300 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 300 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
301 i18n("Set alarm for selected..."),this, 301 i18n("Set alarm for selected..."),this,
302 SLOT(setAlarm()),true); 302 SLOT(setAlarm()),true);
303 303
304 304
305#ifndef DESKTOP_VERSION 305#ifndef DESKTOP_VERSION
306 mPopupMenu->insertSeparator(); 306 mPopupMenu->insertSeparator();
307 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 307 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
308 i18n("Beam selected via IR"),this, 308 i18n("Beam selected via IR"),this,
309 SLOT(beamSelected()),true); 309 SLOT(beamSelected()),true);
310#endif 310#endif
311 /* 311 /*
312 mPopupMenu = new QPopupMenu; 312 mPopupMenu = new QPopupMenu;
313 mPopupMenu->insertItem(i18n("Edit Event"), this, 313 mPopupMenu->insertItem(i18n("Edit Event"), this,
314 SLOT (editEvent())); 314 SLOT (editEvent()));
315 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 315 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
316 SLOT (deleteEvent())); 316 SLOT (deleteEvent()));
317 mPopupMenu->insertSeparator(); 317 mPopupMenu->insertSeparator();
318 mPopupMenu->insertItem(i18n("Show Dates"), this, 318 mPopupMenu->insertItem(i18n("Show Dates"), this,
319 SLOT(showDates())); 319 SLOT(showDates()));
320 mPopupMenu->insertItem(i18n("Hide Dates"), this, 320 mPopupMenu->insertItem(i18n("Hide Dates"), this,
321 SLOT(hideDates())); 321 SLOT(hideDates()));
322 */ 322 */
323 QObject::connect(mListView,SIGNAL( newEvent()), 323 QObject::connect(mListView,SIGNAL( newEvent()),
324 this,SIGNAL(signalNewEvent())); 324 this,SIGNAL(signalNewEvent()));
325 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 325 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
326 this,SLOT(defaultItemAction(QListViewItem *))); 326 this,SLOT(defaultItemAction(QListViewItem *)));
327 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, 327 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
328 const QPoint &, int )), 328 const QPoint &, int )),
329 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 329 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
330 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 330 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
331 SLOT(processSelectionChange(QListViewItem *))); 331 SLOT(processSelectionChange(QListViewItem *)));
332 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 332 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
333 SIGNAL(showIncidenceSignal(Incidence *)) ); 333 SIGNAL(showIncidenceSignal(Incidence *)) );
334 334
335 readSettings(KOGlobals::config(),"KOListView Layout"); 335 readSettings(KOGlobals::config(),"KOListView Layout");
336} 336}
337 337
338KOListView::~KOListView() 338KOListView::~KOListView()
339{ 339{
340 delete mPopupMenu; 340 delete mPopupMenu;
341} 341}
342 342
343QString KOListView::getWhatsThisText(QPoint p) 343QString KOListView::getWhatsThisText(QPoint p)
344{ 344{
345 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 345 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
346 if ( item ) 346 if ( item )
347 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 347 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
348 KOPrefs::instance()->mWTshowDetails, 348 KOPrefs::instance()->mWTshowDetails,
349 KOPrefs::instance()->mWTshowCreated, 349 KOPrefs::instance()->mWTshowCreated,
350 KOPrefs::instance()->mWTshowChanged); 350 KOPrefs::instance()->mWTshowChanged);
351 return i18n("That is the list view" ); 351 return i18n("That is the list view" );
352 352
353} 353}
354 354
355void KOListView::updateList() 355void KOListView::updateList()
356{ 356{
357 // qDebug(" KOListView::updateList() "); 357 // qDebug(" KOListView::updateList() ");
358 358
359} 359}
360 360
361void KOListView::addCat( ) 361void KOListView::addCat( )
362{ 362{
363 setCategories( false ); 363 setCategories( false );
364} 364}
365void KOListView::setCat() 365void KOListView::setCat()
366{ 366{
367 setCategories( true ); 367 setCategories( true );
368} 368}
369void KOListView::setAlarm() 369void KOListView::setAlarm()
370{ 370{
371 KOAlarmPrefs kap( this); 371 KOAlarmPrefs kap( this);
372 if ( !kap.exec() ) 372 if ( !kap.exec() )
373 return; 373 return;
374
375
376 QStringList itemList; 374 QStringList itemList;
377 QPtrList<KOListViewItem> sel ; 375 QPtrList<KOListViewItem> sel ;
378 QListViewItem *qitem = mListView->firstChild (); 376 QListViewItem *qitem = mListView->firstChild ();
379 while ( qitem ) { 377 while ( qitem ) {
380 if ( qitem->isSelected() ) { 378 if ( qitem->isSelected() ) {
381 Incidence* inc = ((KOListViewItem *) qitem)->data(); 379 Incidence* inc = ((KOListViewItem *) qitem)->data();
382 if ( inc->type() != "Journal" ) { 380 if ( inc->type() != "Journal" ) {
383 if ( inc->type() == "Todo" ) { 381 if ( inc->type() == "Todo" ) {
384 if ( ((Todo*)inc)->hasDueDate() ) 382 if ( ((Todo*)inc)->hasDueDate() )
385 sel.append(((KOListViewItem *)qitem)); 383 sel.append(((KOListViewItem *)qitem));
386 } else 384 } else
387 sel.append(((KOListViewItem *)qitem)); 385 sel.append(((KOListViewItem *)qitem));
388 } 386 }
389 } 387 }
390 qitem = qitem->nextSibling(); 388 qitem = qitem->nextSibling();
391 } 389 }
392 int count = 0; 390 int count = 0;
393 KOListViewItem * item, *temp; 391 KOListViewItem * item, *temp;
394 item = sel.first(); 392 item = sel.first();
395 Incidence* inc; 393 Incidence* inc;
396 while ( item ) { 394 while ( item ) {
397 inc = item->data(); 395 inc = item->data();
398 ++count; 396 ++count;
399 if (kap.mAlarmButton->isChecked()) { 397 if (kap.mAlarmButton->isChecked()) {
400 if (inc->alarms().count() == 0) 398 if (inc->alarms().count() == 0)
401 inc->newAlarm(); 399 inc->newAlarm();
402 QPtrList<Alarm> alarms = inc->alarms(); 400 QPtrList<Alarm> alarms = inc->alarms();
403 Alarm *alarm; 401 Alarm *alarm;
404 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 402 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
405 alarm->setEnabled(true); 403 alarm->setEnabled(true);
406 int j = kap.mAlarmTimeEdit->value()* -60; 404 int j = kap.mAlarmTimeEdit->value()* -60;
407 if (kap.mAlarmIncrCombo->currentItem() == 1) 405 if (kap.mAlarmIncrCombo->currentItem() == 1)
408 j = j * 60; 406 j = j * 60;
409 else if (kap.mAlarmIncrCombo->currentItem() == 2) 407 else if (kap.mAlarmIncrCombo->currentItem() == 2)
410 j = j * (60 * 24); 408 j = j * (60 * 24);
411 alarm->setStartOffset( j ); 409 alarm->setStartOffset( j );
412 410
413 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { 411 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
414 alarm->setProcedureAlarm(kap.mAlarmProgram); 412 alarm->setProcedureAlarm(kap.mAlarmProgram);
415 } 413 }
416 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 414 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
417 alarm->setAudioAlarm(kap.mAlarmSound); 415 alarm->setAudioAlarm(kap.mAlarmSound);
418 else 416 else
419 alarm->setType(Alarm::Invalid); 417 alarm->setType(Alarm::Invalid);
420 //alarm->setAudioAlarm("default"); 418 //alarm->setAudioAlarm("default");
421 // TODO: Deal with multiple alarms 419 // TODO: Deal with multiple alarms
422 break; // For now, stop after the first alarm 420 break; // For now, stop after the first alarm
423 } 421 }
424 } else { 422 } else {
425 Alarm* alarm = inc->alarms().first(); 423 Alarm* alarm = inc->alarms().first();
426 if ( alarm ) { 424 if ( alarm ) {
427 alarm->setEnabled(false); 425 alarm->setEnabled(false);
428 alarm->setType(Alarm::Invalid); 426 alarm->setType(Alarm::Invalid);
429 } 427 }
430 } 428 }
431 temp = item; 429 ListItemVisitor v(item, mStartDate );
432 item = sel.next(); 430 inc->accept(v);
433 mUidDict.remove( inc->uid() ); 431 item = sel.next();
434 delete temp;;
435 addIncidence( inc );
436 } 432 }
437 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); 433 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) );
438 qDebug("KO: Set alarm for %d items", count); 434 qDebug("KO: Set alarm for %d items", count);
439 calendar()->reInitAlarmSettings(); 435 calendar()->reInitAlarmSettings();
440 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 436 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
441} 437}
442void KOListView::setCategories( bool removeOld ) 438void KOListView::setCategories( bool removeOld )
443{ 439{
444 440
445 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 441 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
442 csd->setColorEnabled();
446 if (! csd->exec()) { 443 if (! csd->exec()) {
447 delete csd; 444 delete csd;
448 return; 445 return;
449 } 446 }
450 QStringList catList = csd->selectedCategories(); 447 QStringList catList = csd->selectedCategories();
451 delete csd; 448 delete csd;
452 // if ( catList.count() == 0 ) 449 // if ( catList.count() == 0 )
453 // return; 450 // return;
454 catList.sort(); 451 //catList.sort();
455 QString categoriesStr = catList.join(","); 452 QString categoriesStr = catList.join(",");
456 int i; 453 int i;
457 QStringList itemList; 454 QStringList itemList;
458 QPtrList<KOListViewItem> sel ; 455 QPtrList<KOListViewItem> sel ;
459 QListViewItem *qitem = mListView->firstChild (); 456 QListViewItem *qitem = mListView->firstChild ();
460 while ( qitem ) { 457 while ( qitem ) {
461 if ( qitem->isSelected() ) { 458 if ( qitem->isSelected() ) {
462 sel.append(((KOListViewItem *)qitem)); 459 sel.append(((KOListViewItem *)qitem));
463 } 460 }
464 qitem = qitem->nextSibling(); 461 qitem = qitem->nextSibling();
465 } 462 }
466 KOListViewItem * item, *temp; 463 KOListViewItem * item, *temp;
467 item = sel.first(); 464 item = sel.first();
468 Incidence* inc; 465 if( item ) {
469 while ( item ) { 466 Incidence* inc = item->data() ;
470 inc = item->data(); 467 bool setSub = false;
471 if ( removeOld ) { 468 if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) {
472 inc->setCategories( categoriesStr ); 469 int result = KMessageBox::warningYesNoCancel(this,
473 } else { 470 i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ),
474 itemList = QStringList::split (",", inc->categoriesStr() ); 471 i18n("Todo has subtodos"),
475 for( i = 0; i< catList.count(); ++i ) { 472 i18n("Yes"),
476 if ( !itemList.contains (catList[i])) 473 i18n("No"));
477 itemList.append( catList[i] ); 474 if (result == KMessageBox::Cancel) item = 0;
478 } 475 if (result == KMessageBox::Yes) setSub = true;
479 itemList.sort(); 476 }
480 inc->setCategories( itemList.join(",") ); 477 while ( item ) {
478 inc = item->data();
479 if ( removeOld ) {
480 inc->setCategories( catList, setSub );
481 } else {
482 inc->addCategories( catList, setSub );
483 }
484 ListItemVisitor v(item, mStartDate );
485 inc->accept(v);
486 item = sel.next();
481 } 487 }
482 temp = item;
483 item = sel.next();
484 mUidDict.remove( inc->uid() );
485 delete temp;;
486 addIncidence( inc );
487 } 488 }
488 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 489 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
489} 490}
490 491
491void KOListView::beamSelected() 492void KOListView::beamSelected()
492{ 493{
493 int icount = 0; 494 int icount = 0;
494 QPtrList<Incidence> delSel ; 495 QPtrList<Incidence> delSel ;
495 QListViewItem *item = mListView->firstChild (); 496 QListViewItem *item = mListView->firstChild ();
496 while ( item ) { 497 while ( item ) {
497 if ( item->isSelected() ) { 498 if ( item->isSelected() ) {
498 delSel.append(((KOListViewItem *)item)->data()); 499 delSel.append(((KOListViewItem *)item)->data());
499 ++icount; 500 ++icount;
500 } 501 }
501 502
502 item = item->nextSibling(); 503 item = item->nextSibling();
503 } 504 }
504 if ( icount ) { 505 if ( icount ) {
505 emit beamIncidenceList( delSel ); 506 emit beamIncidenceList( delSel );
506 return; 507 return;
507 QString fn ; 508 QString fn ;
508 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 509 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
509 QString mes; 510 QString mes;
510 bool createbup = true; 511 bool createbup = true;
511 if ( createbup ) { 512 if ( createbup ) {
512 QString description = "\n"; 513 QString description = "\n";
513 CalendarLocal* cal = new CalendarLocal(); 514 CalendarLocal* cal = new CalendarLocal();
514 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 515 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
515 Incidence *incidence = delSel.first(); 516 Incidence *incidence = delSel.first();
516 while ( incidence ) { 517 while ( incidence ) {
517 Incidence *in = incidence->clone(); 518 Incidence *in = incidence->clone();
518 description += in->summary() + "\n"; 519 description += in->summary() + "\n";
519 cal->addIncidence( in ); 520 cal->addIncidence( in );
520 incidence = delSel.next(); 521 incidence = delSel.next();
521 } 522 }
522 FileStorage storage( cal, fn, new VCalFormat ); 523 FileStorage storage( cal, fn, new VCalFormat );
523 storage.save(); 524 storage.save();
524 delete cal; 525 delete cal;
525 mes = i18n("KO/Pi: Ready for beaming"); 526 mes = i18n("KO/Pi: Ready for beaming");
526 topLevelWidget()->setCaption(mes); 527 topLevelWidget()->setCaption(mes);
527 528
528#ifndef DESKTOP_VERSION 529#ifndef DESKTOP_VERSION
529 Ir *ir = new Ir( this ); 530 Ir *ir = new Ir( this );
530 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 531 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
531 ir->send( fn, description, "text/x-vCalendar" ); 532 ir->send( fn, description, "text/x-vCalendar" );
532#endif 533#endif
533 } 534 }
534 } 535 }
535} 536}
536void KOListView::beamDone( Ir *ir ) 537void KOListView::beamDone( Ir *ir )
537{ 538{
538#ifndef DESKTOP_VERSION 539#ifndef DESKTOP_VERSION
539 delete ir; 540 delete ir;
540#endif 541#endif
541 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); 542 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done"));
542} 543}
543 544
544void KOListView::saveDescriptionToFile() 545void KOListView::saveDescriptionToFile()
545{ 546{
546 547
547 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), 548 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
548 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 549 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
549 i18n("Continue"), i18n("Cancel"), 0, 550 i18n("Continue"), i18n("Cancel"), 0,
550 0, 1 ); 551 0, 1 );
551 if ( result != 0 ) { 552 if ( result != 0 ) {
552 return; 553 return;
553 } 554 }
554 int icount = 0; 555 int icount = 0;
555 QPtrList<Incidence> delSel ; 556 QPtrList<Incidence> delSel ;
556 QListViewItem *item = mListView->firstChild (); 557 QListViewItem *item = mListView->firstChild ();
557 while ( item ) { 558 while ( item ) {
558 if ( item->isSelected() ) { 559 if ( item->isSelected() ) {
559 delSel.append(((KOListViewItem *)item)->data()); 560 delSel.append(((KOListViewItem *)item)->data());
560 ++icount; 561 ++icount;
561 } 562 }
562 563
563 item = item->nextSibling(); 564 item = item->nextSibling();
564 } 565 }
565 if ( icount ) { 566 if ( icount ) {
566 QString fn = KOPrefs::instance()->mLastSaveFile; 567 QString fn = KOPrefs::instance()->mLastSaveFile;
567 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 568 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
568 569
569 if ( fn == "" ) 570 if ( fn == "" )
570 return; 571 return;
571 QFileInfo info; 572 QFileInfo info;
572 info.setFile( fn ); 573 info.setFile( fn );
573 QString mes; 574 QString mes;
574 bool createbup = true; 575 bool createbup = true;
575 if ( info. exists() ) { 576 if ( info. exists() ) {
576 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 577 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
577 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 578 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
578 i18n("Overwrite!"), i18n("Cancel"), 0, 579 i18n("Overwrite!"), i18n("Cancel"), 0,
579 0, 1 ); 580 0, 1 );
580 if ( result != 0 ) { 581 if ( result != 0 ) {
581 createbup = false; 582 createbup = false;
582 } 583 }
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 6a05cc8..5513e8b 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -17,197 +17,197 @@
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 <qtooltip.h> 25#include <qtooltip.h>
26#include <qframe.h> 26#include <qframe.h>
27#include <qpixmap.h> 27#include <qpixmap.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qhbox.h> 29#include <qhbox.h>
30#include <qdir.h> 30#include <qdir.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qapplication.h> 32#include <qapplication.h>
33#include <qtabwidget.h> 33#include <qtabwidget.h>
34 34
35#include <kiconloader.h> 35#include <kiconloader.h>
36#include <klocale.h> 36#include <klocale.h>
37#include <kfiledialog.h> 37#include <kfiledialog.h>
38#include <kstandarddirs.h> 38#include <kstandarddirs.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40 40
41#include <libkdepim/categoryselectdialog.h> 41#include <libkdepim/categoryselectdialog.h>
42#include <libkcal/calendarlocal.h> 42#include <libkcal/calendarlocal.h>
43#include <libkcal/calendarresources.h> 43#include <libkcal/calendarresources.h>
44#include <libkcal/resourcecalendar.h> 44#include <libkcal/resourcecalendar.h>
45#include <libkcal/icalformat.h> 45#include <libkcal/icalformat.h>
46#include <kresources/resourceselectdialog.h> 46#include <kresources/resourceselectdialog.h>
47#include <libkdepim/kdateedit.h> 47#include <libkdepim/kdateedit.h>
48 48
49#include "koprefs.h" 49#include "koprefs.h"
50#include "kolocationbox.h" 50#include "kolocationbox.h"
51 51
52#include "kotodoeditor.h" 52#include "kotodoeditor.h"
53extern int globalFlagBlockAgenda; 53extern int globalFlagBlockAgenda;
54 54
55KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : 55KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) :
56 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) 56 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent )
57{ 57{
58 mTodo = 0; 58 mTodo = 0;
59 mRelatedTodo = 0; 59 mRelatedTodo = 0;
60 findButton(User1)->hide(); 60 findButton(User1)->hide();
61 init(); 61 init();
62} 62}
63 63
64KOTodoEditor::~KOTodoEditor() 64KOTodoEditor::~KOTodoEditor()
65{ 65{
66 emit dialogClose( mTodo ); 66 emit dialogClose( mTodo );
67} 67}
68 68
69void KOTodoEditor::init() 69void KOTodoEditor::init()
70{ 70{
71 setupGeneral(); 71 setupGeneral();
72 setupAttendeesTab(); 72 setupAttendeesTab();
73 setupRecurrence(); 73 setupRecurrence();
74 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence())); 74 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence()));
75 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") ); 75 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") );
76} 76}
77void KOTodoEditor::setupRecurrence() 77void KOTodoEditor::setupRecurrence()
78{ 78{
79 QFrame *topFrame = addPage( i18n("Recurrence") ); 79 QFrame *topFrame = addPage( i18n("Recurrence") );
80 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 80 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
81 81
82 mRecurrence = new KOEditorRecurrence( topFrame ); 82 mRecurrence = new KOEditorRecurrence( topFrame );
83 topLayout->addWidget( mRecurrence ); 83 topLayout->addWidget( mRecurrence );
84} 84}
85 85
86void KOTodoEditor::setCategories( QString s ) 86void KOTodoEditor::setCategories( QString s )
87{ 87{
88 mGeneral->setCategories(s); 88 mGeneral->setCategories(s);
89} 89}
90void KOTodoEditor::setSecrecy( int sec ) 90void KOTodoEditor::setSecrecy( int sec )
91{ 91{
92 mGeneral->setSecrecy( sec ); 92 mGeneral->setSecrecy( sec );
93} 93}
94void KOTodoEditor::reload() 94void KOTodoEditor::reload()
95{ 95{
96 if ( mTodo ) readTodo( mTodo ); 96 if ( mTodo ) readTodo( mTodo );
97} 97}
98 98
99void KOTodoEditor::setupGeneral() 99void KOTodoEditor::setupGeneral()
100{ 100{
101 mGeneral = new KOEditorGeneralTodo(this); 101 mGeneral = new KOEditorGeneralTodo(this);
102 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); 102 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
103 103
104 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); 104 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
105 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), 105 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)),
106 // mGeneral,SLOT(setCategories(const QString &))); 106 // mGeneral,SLOT(setCategories(const QString &)));
107 107
108 if (KOPrefs::instance()->mCompactDialogs) { 108 if (KOPrefs::instance()->mCompactDialogs) {
109 QFrame *topFrame = addPage(i18n("General")); 109 QFrame *topFrame = addPage(i18n("General"));
110 110
111 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 111 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
112 if ( QApplication::desktop()->width() < 480 ) { 112 if ( QApplication::desktop()->width() < 480 ) {
113 topLayout->setMargin(1); 113 topLayout->setMargin(marginHintSmall());
114 topLayout->setSpacing(1); 114 topLayout->setSpacing(spacingHintSmall());
115 } else { 115 } else {
116 topLayout->setMargin(marginHint()-1); 116 topLayout->setMargin(marginHint());
117 topLayout->setSpacing(spacingHint()-1); 117 topLayout->setSpacing(spacingHint());
118 } 118 }
119 mGeneral->initHeader(topFrame,topLayout); 119 mGeneral->initHeader(topFrame,topLayout);
120 mGeneral->initTime(topFrame,topLayout); 120 mGeneral->initTime(topFrame,topLayout);
121 mGeneral->initAlarm(topFrame,topLayout); 121 mGeneral->initAlarm(topFrame,topLayout);
122 mGeneral->enableAlarm( false ); 122 mGeneral->enableAlarm( false );
123 123
124 124
125 QBoxLayout *priorityLayout; 125 QBoxLayout *priorityLayout;
126 if ( QApplication::desktop()->width() < 500 ) 126 if ( QApplication::desktop()->width() < 500 )
127 priorityLayout = new QVBoxLayout( topLayout ); 127 priorityLayout = new QVBoxLayout( topLayout );
128 else 128 else
129 priorityLayout = new QHBoxLayout( topLayout ); 129 priorityLayout = new QHBoxLayout( topLayout );
130 QWidget* prioWidget = new QWidget (topFrame); 130 QWidget* prioWidget = new QWidget (topFrame);
131 priorityLayout->addWidget( prioWidget ); 131 priorityLayout->addWidget( prioWidget );
132 QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget); 132 QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget);
133 133
134 134
135 QIconSet icon; 135 QIconSet icon;
136 if ( QApplication::desktop()->width() < 321 ) 136 if ( QApplication::desktop()->width() < 321 )
137 icon = SmallIcon("fileimport16"); 137 icon = SmallIcon("fileimport16");
138 else 138 else
139 icon = SmallIcon("fileimport"); 139 icon = SmallIcon("fileimport");
140 QPushButton * loadTemplate = new QPushButton( prioWidget); 140 QPushButton * loadTemplate = new QPushButton( prioWidget);
141 loadTemplate->setIconSet (icon ) ; 141 loadTemplate->setIconSet (icon ) ;
142 int size = loadTemplate->sizeHint().height(); 142 int size = loadTemplate->sizeHint().height();
143 loadTemplate->setFixedSize( size, size ); 143 loadTemplate->setFixedSize( size, size );
144 if ( QApplication::desktop()->width() < 321 ) 144 if ( QApplication::desktop()->width() < 321 )
145 icon = SmallIcon("fileexport16"); 145 icon = SmallIcon("fileexport16");
146 else 146 else
147 icon = SmallIcon("fileexport"); 147 icon = SmallIcon("fileexport");
148 QPushButton * saveTemplate = new QPushButton( prioWidget); 148 QPushButton * saveTemplate = new QPushButton( prioWidget);
149 saveTemplate->setIconSet (icon ) ; 149 saveTemplate->setIconSet (icon ) ;
150 saveTemplate->setFixedSize( size, size ); 150 saveTemplate->setFixedSize( size, size );
151 151
152 priorityLayout2->addWidget(loadTemplate); 152 priorityLayout2->addWidget(loadTemplate);
153 priorityLayout2->addWidget(saveTemplate); 153 priorityLayout2->addWidget(saveTemplate);
154 mGeneral->initPriority(prioWidget,priorityLayout2); 154 mGeneral->initPriority(prioWidget,priorityLayout2);
155 mGeneral->initCategories( topFrame, priorityLayout ); 155 mGeneral->initCategories( topFrame, priorityLayout );
156 topLayout->addStretch(1); 156 topLayout->addStretch(1);
157 157
158 QFrame *topFrame2 = addPage(i18n("Details")); 158 QFrame *topFrame2 = addPage(i18n("Details"));
159 159
160 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); 160 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2);
161 topLayout2->setMargin(marginHint()); 161 topLayout2->setMargin(marginHint());
162 topLayout2->setSpacing(spacingHint()); 162 topLayout2->setSpacing(spacingHint());
163 163
164 QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 ); 164 QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 );
165 mGeneral->initCompletion(topFrame2,completionLayout); 165 mGeneral->initCompletion(topFrame2,completionLayout);
166 166
167 167
168 mGeneral->initSecrecy( topFrame2, topLayout2 ); 168 mGeneral->initSecrecy( topFrame2, topLayout2 );
169 mGeneral->initDescription(topFrame2,topLayout2); 169 mGeneral->initDescription(topFrame2,topLayout2);
170 170
171 // QHBox * hb = new QHBox ( topFrame2 ); 171 // QHBox * hb = new QHBox ( topFrame2 );
172 // topLayout2->addWidget(hb); 172 // topLayout2->addWidget(hb);
173 // hb->setSpacing( 3 ); 173 // hb->setSpacing( 3 );
174 174
175 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 175 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
176 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 176 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
177 177
178 } else { 178 } else {
179 QFrame *topFrame = addPage(i18n("General")); 179 QFrame *topFrame = addPage(i18n("General"));
180 180
181 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 181 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
182 topLayout->setSpacing(spacingHint()); 182 topLayout->setSpacing(spacingHint());
183 183
184 mGeneral->initHeader(topFrame,topLayout); 184 mGeneral->initHeader(topFrame,topLayout);
185 mGeneral->initTime(topFrame,topLayout); 185 mGeneral->initTime(topFrame,topLayout);
186 mGeneral->initStatus(topFrame,topLayout); 186 mGeneral->initStatus(topFrame,topLayout);
187 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 187 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
188 mGeneral->initAlarm(topFrame,alarmLineLayout); 188 mGeneral->initAlarm(topFrame,alarmLineLayout);
189 mGeneral->initDescription(topFrame,topLayout); 189 mGeneral->initDescription(topFrame,topLayout);
190 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); 190 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout);
191 mGeneral->initCategories( topFrame, detailsLayout ); 191 mGeneral->initCategories( topFrame, detailsLayout );
192 mGeneral->initSecrecy( topFrame, detailsLayout ); 192 mGeneral->initSecrecy( topFrame, detailsLayout );
193 } 193 }
194 mGeneral->finishSetup(); 194 mGeneral->finishSetup();
195 195
196} 196}
197 197
198void KOTodoEditor::editTodo(Todo *todo, bool editDescription) 198void KOTodoEditor::editTodo(Todo *todo, bool editDescription)
199{ 199{
200 //init(); 200 //init();
201 201
202 mTodo = todo; 202 mTodo = todo;
203 readTodo(mTodo); 203 readTodo(mTodo);
204 if ( editDescription ) { 204 if ( editDescription ) {
205 showPage( 1 ); 205 showPage( 1 );
206 mGeneral->setFocusOn( 1 ); 206 mGeneral->setFocusOn( 1 );
207 } else { 207 } else {
208 showPage( 0 ); 208 showPage( 0 );
209 mGeneral->setFocusOn( 2 ); 209 mGeneral->setFocusOn( 2 );
210 } 210 }
211 checkRecurrence(); 211 checkRecurrence();
212} 212}
213 213
@@ -251,187 +251,194 @@ bool KOTodoEditor::processInput( bool emitTime )
251 mCalendar->addTodo(todo); 251 mCalendar->addTodo(todo);
252 mTodo = todo; 252 mTodo = todo;
253 emit todoAdded(todo); 253 emit todoAdded(todo);
254 } 254 }
255 255
256 return true; 256 return true;
257} 257}
258 258
259void KOTodoEditor::deleteTodo() 259void KOTodoEditor::deleteTodo()
260{ 260{
261 if (mTodo) { 261 if (mTodo) {
262 if (KOPrefs::instance()->mConfirm) { 262 if (KOPrefs::instance()->mConfirm) {
263 switch (msgItemDelete()) { 263 switch (msgItemDelete()) {
264 case KMessageBox::Continue: // OK 264 case KMessageBox::Continue: // OK
265 emit todoToBeDeleted(mTodo); 265 emit todoToBeDeleted(mTodo);
266 emit dialogClose(mTodo); 266 emit dialogClose(mTodo);
267 mCalendar->deleteTodo(mTodo); 267 mCalendar->deleteTodo(mTodo);
268 emit todoDeleted(); 268 emit todoDeleted();
269 reject(); 269 reject();
270 break; 270 break;
271 } 271 }
272 } 272 }
273 else { 273 else {
274 emit todoToBeDeleted(mTodo); 274 emit todoToBeDeleted(mTodo);
275 emit dialogClose(mTodo); 275 emit dialogClose(mTodo);
276 mCalendar->deleteTodo(mTodo); 276 mCalendar->deleteTodo(mTodo);
277 emit todoDeleted(); 277 emit todoDeleted();
278 reject(); 278 reject();
279 } 279 }
280 } else { 280 } else {
281 reject(); 281 reject();
282 } 282 }
283} 283}
284 284
285void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) 285void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay)
286{ 286{
287 mRelatedTodo = relatedEvent; 287 mRelatedTodo = relatedEvent;
288 288
289 mGeneral->setDefaults(due,allDay); 289 mGeneral->setDefaults(due,allDay);
290 mDetails->setDefaults(); 290 mDetails->setDefaults();
291 showPage( 0 ); 291 showPage( 0 );
292 if ( mRelatedTodo ) { 292 if ( mRelatedTodo ) {
293 mGeneral->setCategories (mRelatedTodo->categoriesStr ()); 293 mGeneral->setCategories (mRelatedTodo->categoriesStr ());
294 mGeneral->setSecrecy (mRelatedTodo->secrecy ()); 294 mGeneral->setSecrecy (mRelatedTodo->secrecy ());
295 if ( mRelatedTodo->priority() < 3 ) 295 if ( mRelatedTodo->priority() < 3 )
296 mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1); 296 mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1);
297 mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": "); 297 mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": ");
298 int len = mRelatedTodo->summary().length(); 298 int len = mRelatedTodo->summary().length();
299 mGeneral->mSummaryEdit->lineEdit()->setFocus(); 299 mGeneral->mSummaryEdit->lineEdit()->setFocus();
300 mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 ); 300 mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 );
301 mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 ); 301 mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 );
302 302
303 } else 303 } else
304 mGeneral->setFocusOn( 2 ); 304 mGeneral->setFocusOn( 2 );
305 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); 305 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
306 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); 306 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true);
307} 307}
308void KOTodoEditor::checkRecurrence() 308void KOTodoEditor::checkRecurrence()
309{ 309{
310 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { 310 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
311 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true ); 311 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true );
312 312
313 if ( mTodo ) 313 if ( mTodo )
314 mRecurrence->readEvent( mTodo ); 314 mRecurrence->readEvent( mTodo );
315 else { 315 else {
316 bool time = mGeneral->mTimeButton->isChecked(); 316 bool time = mGeneral->mTimeButton->isChecked();
317 QDateTime from,to; 317 QDateTime from,to;
318 if ( time ) { 318 if ( time ) {
319 to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ; 319 to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ;
320 from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ; 320 from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ;
321 } else { 321 } else {
322 to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ; 322 to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ;
323 from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ; 323 from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ;
324 } 324 }
325 if ( to < from ) 325 if ( to < from )
326 to = from; 326 to = from;
327 mRecurrence->setDefaults(from,to,!time); 327 mRecurrence->setDefaults(from,to,!time);
328 } 328 }
329 } else { 329 } else {
330 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); 330 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
331 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); 331 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true);
332 } 332 }
333} 333}
334void KOTodoEditor::readTodo(Todo *todo) 334void KOTodoEditor::readTodo(Todo *todo)
335{ 335{
336 mGeneral->readTodo(todo); 336 mGeneral->readTodo(todo);
337 mDetails->readEvent(todo); 337 mDetails->readEvent(todo);
338 mRelatedTodo = 0;//todo->relatedTo(); 338 mRelatedTodo = 0;//todo->relatedTo();
339 // categories 339 // categories
340 // mCategoryDialog->setSelected(todo->categories()); 340 // mCategoryDialog->setSelected(todo->categories());
341 341
342 // We should handle read-only events here. 342 // We should handle read-only events here.
343} 343}
344 344
345void KOTodoEditor::writeTodo(Todo *event) 345void KOTodoEditor::writeTodo(Todo *event)
346{ 346{
347 mGeneral->writeTodo(event); 347 bool maybeComputeRecurrenceTime = false;
348 mDetails->writeEvent(event); 348 if( event->hasRecurrenceID() && event->percentComplete() < 100)
349 349 maybeComputeRecurrenceTime = true;
350 // set related event, i.e. parent to-do in this case. 350 event->setHasRecurrenceID( false );
351 if (mRelatedTodo) { 351 mGeneral->writeTodo(event);
352 event->setRelatedTo(mRelatedTodo); 352 mDetails->writeEvent(event);
353 } 353
354 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { 354 // set related event, i.e. parent to-do in this case.
355 mRecurrence->writeEvent(event); 355 if (mRelatedTodo) {
356 if ( event->doesRecur() ) { 356 event->setRelatedTo(mRelatedTodo);
357 event->setRecurrenceID( event->dtStart().addSecs(-1) ); 357 }
358 event->setRecurDates(); 358 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
359 } else { 359 mRecurrence->writeEvent(event);
360 event->setHasRecurrenceID( false ); 360 if ( event->doesRecur() ) {
361 } 361 int addSec = -1 ;
362 } else { 362 if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 )
363 event->setHasRecurrenceID( false ); 363 addSec = 1;
364 event->recurrence()->unsetRecurs(); 364 event->setRecurrenceID( event->dtStart().addSecs( addSec ) );
365 } 365 event->setRecurDates();
366 } else {
367 event->setHasRecurrenceID( false );
368 }
369 } else {
370 event->setHasRecurrenceID( false );
371 event->recurrence()->unsetRecurs();
372 }
366} 373}
367 374
368bool KOTodoEditor::validateInput() 375bool KOTodoEditor::validateInput()
369{ 376{
370 if (!mGeneral->validateInput()) return false; 377 if (!mGeneral->validateInput()) return false;
371 if (!mDetails->validateInput()) return false; 378 if (!mDetails->validateInput()) return false;
372 return true; 379 return true;
373} 380}
374 381
375int KOTodoEditor::msgItemDelete() 382int KOTodoEditor::msgItemDelete()
376{ 383{
377 return KMessageBox::warningContinueCancel(this, 384 return KMessageBox::warningContinueCancel(this,
378 i18n("This item will be permanently deleted."), 385 i18n("This item will be permanently deleted."),
379 i18n("KOrganizer Confirmation"),i18n("Delete")); 386 i18n("KOrganizer Confirmation"),i18n("Delete"));
380} 387}
381 388
382void KOTodoEditor::modified (int modification) 389void KOTodoEditor::modified (int modification)
383{ 390{
384 if (modification == KOGlobals::CATEGORY_MODIFIED || 391 if (modification == KOGlobals::CATEGORY_MODIFIED ||
385 KOGlobals::UNKNOWN_MODIFIED == modification ) 392 KOGlobals::UNKNOWN_MODIFIED == modification )
386 // mCategoryDialog->setSelected (mTodo->categories ()); 393 // mCategoryDialog->setSelected (mTodo->categories ());
387 mGeneral->modified (mTodo, modification); 394 mGeneral->modified (mTodo, modification);
388 395
389} 396}
390 397
391void KOTodoEditor::slotLoadTemplate() 398void KOTodoEditor::slotLoadTemplate()
392{ 399{
393 400
394 QString fileName =locateLocal( "templates", "todos" ); 401 QString fileName =locateLocal( "templates", "todos" );
395 QDir t_dir; 402 QDir t_dir;
396 if ( !t_dir.exists(fileName) ) 403 if ( !t_dir.exists(fileName) )
397 t_dir.mkdir ( fileName ); 404 t_dir.mkdir ( fileName );
398 fileName += "/todo"; 405 fileName += "/todo";
399 fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this ); 406 fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this );
400 if ( fileName.length() == 0 ) 407 if ( fileName.length() == 0 )
401 return; 408 return;
402 CalendarLocal cal; 409 CalendarLocal cal;
403 ICalFormat format; 410 ICalFormat format;
404 if ( !format.load( &cal, fileName ) ) { 411 if ( !format.load( &cal, fileName ) ) {
405 KMessageBox::error( this, i18n("Error loading template file\n '%1'.") 412 KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
406 .arg( fileName ) ); 413 .arg( fileName ) );
407 return ; 414 return ;
408 } 415 }
409 QPtrList<Todo> todos = cal.todos(); 416 QPtrList<Todo> todos = cal.todos();
410 Todo * todo = todos.first(); 417 Todo * todo = todos.first();
411 if ( !todo ) { 418 if ( !todo ) {
412 KMessageBox::error( this, 419 KMessageBox::error( this,
413 i18n("Template does not\ncontain a valid Todo.")); 420 i18n("Template does not\ncontain a valid Todo."));
414 } else { 421 } else {
415 readTodo( todo ); 422 readTodo( todo );
416 } 423 }
417 424
418} 425}
419 426
420void KOTodoEditor::slotSaveTemplate() 427void KOTodoEditor::slotSaveTemplate()
421{ 428{
422 QString fileName =locateLocal( "templates", "todos" ); 429 QString fileName =locateLocal( "templates", "todos" );
423 QDir t_dir; 430 QDir t_dir;
424 if ( !t_dir.exists(fileName) ) 431 if ( !t_dir.exists(fileName) )
425 t_dir.mkdir ( fileName ); 432 t_dir.mkdir ( fileName );
426 fileName += "/todo"; 433 fileName += "/todo";
427 fileName = KFileDialog::getSaveFileName( fileName , "Save as Todo template", this ); 434 fileName = KFileDialog::getSaveFileName( fileName , "Save as Todo template", this );
428 if ( fileName.length() > 0 ) 435 if ( fileName.length() > 0 )
429 saveTemplate( fileName ); 436 saveTemplate( fileName );
430} 437}
431 438
432void KOTodoEditor::saveTemplate( const QString &templateName ) 439void KOTodoEditor::saveTemplate( const QString &templateName )
433{ 440{
434 Todo *todo = new Todo; 441 Todo *todo = new Todo;
435 writeTodo( todo ); 442 writeTodo( todo );
436 saveAsTemplate( todo, templateName ); 443 saveAsTemplate( todo, templateName );
437} 444}
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 25be63a..f26d16d 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -372,249 +372,250 @@ KOQuickTodo::KOQuickTodo(QWidget *parent) :
372} 372}
373 373
374void KOQuickTodo::focusInEvent(QFocusEvent *ev) 374void KOQuickTodo::focusInEvent(QFocusEvent *ev)
375{ 375{
376 if ( text()==i18n("Click to add a new Todo") ) 376 if ( text()==i18n("Click to add a new Todo") )
377 setText(""); 377 setText("");
378 QLineEdit::focusInEvent(ev); 378 QLineEdit::focusInEvent(ev);
379} 379}
380 380
381void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 381void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
382{ 382{
383 setText(i18n("Click to add a new Todo")); 383 setText(i18n("Click to add a new Todo"));
384 QLineEdit::focusOutEvent(ev); 384 QLineEdit::focusOutEvent(ev);
385} 385}
386 386
387///////////////////////////////////////////////////////////////////////////// 387/////////////////////////////////////////////////////////////////////////////
388 388
389KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 389KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
390 KOrg::BaseView(calendar,parent,name) 390 KOrg::BaseView(calendar,parent,name)
391{ 391{
392 mPendingUpdateBeforeRepaint = false; 392 mPendingUpdateBeforeRepaint = false;
393 isFlatDisplay = false; 393 isFlatDisplay = false;
394 mNavigator = 0; 394 mNavigator = 0;
395 QBoxLayout *topLayout = new QVBoxLayout(this); 395 QBoxLayout *topLayout = new QVBoxLayout(this);
396 mName = QString ( name ); 396 mName = QString ( name );
397 mBlockUpdate = false; 397 mBlockUpdate = false;
398 mQuickAdd = new KOQuickTodo(this); 398 mQuickAdd = new KOQuickTodo(this);
399 topLayout->addWidget(mQuickAdd); 399 topLayout->addWidget(mQuickAdd);
400 400
401 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 401 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
402 402
403 mTodoListView = new KOTodoListView(calendar,this, name ); 403 mTodoListView = new KOTodoListView(calendar,this, name );
404 topLayout->addWidget(mTodoListView); 404 topLayout->addWidget(mTodoListView);
405 //mTodoListView->header()->setMaximumHeight(30); 405 //mTodoListView->header()->setMaximumHeight(30);
406 mTodoListView->setRootIsDecorated(true); 406 mTodoListView->setRootIsDecorated(true);
407 mTodoListView->setAllColumnsShowFocus(true); 407 mTodoListView->setAllColumnsShowFocus(true);
408 408
409 mTodoListView->setShowSortIndicator(true); 409 mTodoListView->setShowSortIndicator(true);
410 410
411 mTodoListView->addColumn(i18n("Todo")); 411 mTodoListView->addColumn(i18n("Todo"));
412 mTodoListView->addColumn(i18n("Prio")); 412 mTodoListView->addColumn(i18n("Prio"));
413 mTodoListView->setColumnAlignment(1,AlignHCenter); 413 mTodoListView->setColumnAlignment(1,AlignHCenter);
414 mTodoListView->addColumn(i18n("Complete")); 414 mTodoListView->addColumn(i18n("Complete"));
415 mTodoListView->setColumnAlignment(2,AlignCenter); 415 mTodoListView->setColumnAlignment(2,AlignCenter);
416 416
417 mTodoListView->addColumn(i18n("Due Date")); 417 mTodoListView->addColumn(i18n("Due Date"));
418 mTodoListView->setColumnAlignment(3,AlignLeft); 418 mTodoListView->setColumnAlignment(3,AlignLeft);
419 mTodoListView->addColumn(i18n("Due Time")); 419 mTodoListView->addColumn(i18n("Due Time"));
420 mTodoListView->setColumnAlignment(4,AlignHCenter); 420 mTodoListView->setColumnAlignment(4,AlignHCenter);
421 421
422 mTodoListView->addColumn(i18n("Start Date")); 422 mTodoListView->addColumn(i18n("Start Date"));
423 mTodoListView->setColumnAlignment(5,AlignLeft); 423 mTodoListView->setColumnAlignment(5,AlignLeft);
424 mTodoListView->addColumn(i18n("Start Time")); 424 mTodoListView->addColumn(i18n("Start Time"));
425 mTodoListView->setColumnAlignment(6,AlignHCenter); 425 mTodoListView->setColumnAlignment(6,AlignHCenter);
426 426
427 mTodoListView->addColumn(i18n("Cancelled")); 427 mTodoListView->addColumn(i18n("Cancelled"));
428 mTodoListView->addColumn(i18n("Categories")); 428 mTodoListView->addColumn(i18n("Categories"));
429#if 0 429#if 0
430 mTodoListView->addColumn(i18n("Sort Id")); 430 mTodoListView->addColumn(i18n("Sort Id"));
431 mTodoListView->setColumnAlignment(4,AlignHCenter); 431 mTodoListView->setColumnAlignment(4,AlignHCenter);
432#endif 432#endif
433 433
434 mTodoListView->setMinimumHeight( 60 ); 434 mTodoListView->setMinimumHeight( 60 );
435 mTodoListView->setItemsRenameable( true ); 435 mTodoListView->setItemsRenameable( true );
436 mTodoListView->setRenameable( 0 ); 436 mTodoListView->setRenameable( 0 );
437 mTodoListView->setColumnWidth( 0, 120 ); 437 mTodoListView->setColumnWidth( 0, 120 );
438 mTodoListView->setColumnWidthMode(0, QListView::Manual); 438 mTodoListView->setColumnWidthMode(0, QListView::Manual);
439 mTodoListView->setColumnWidthMode(1, QListView::Manual); 439 mTodoListView->setColumnWidthMode(1, QListView::Manual);
440 mTodoListView->setColumnWidthMode(2, QListView::Manual); 440 mTodoListView->setColumnWidthMode(2, QListView::Manual);
441 mTodoListView->setColumnWidthMode(3, QListView::Manual); 441 mTodoListView->setColumnWidthMode(3, QListView::Manual);
442 mTodoListView->setColumnWidthMode(4, QListView::Manual); 442 mTodoListView->setColumnWidthMode(4, QListView::Manual);
443 mTodoListView->setColumnWidthMode(5, QListView::Manual); 443 mTodoListView->setColumnWidthMode(5, QListView::Manual);
444 mTodoListView->setColumnWidthMode(6, QListView::Manual); 444 mTodoListView->setColumnWidthMode(6, QListView::Manual);
445 mTodoListView->setColumnWidthMode(7, QListView::Manual); 445 mTodoListView->setColumnWidthMode(7, QListView::Manual);
446 mTodoListView->setColumnWidthMode(8, QListView::Manual); 446 mTodoListView->setColumnWidthMode(8, QListView::Manual);
447 447
448 448
449 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); 449 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this);
450 450
451 mPriorityPopupMenu = new QPopupMenu(this); 451 mPriorityPopupMenu = new QPopupMenu(this);
452 for (int i = 1; i <= 5; i++) { 452 for (int i = 1; i <= 5; i++) {
453 QString label = QString ("%1").arg (i); 453 QString label = QString ("%1").arg (i);
454 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 454 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
455 } 455 }
456 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 456 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
457 457
458 mPercentageCompletedPopupMenu = new QPopupMenu(this); 458 mPercentageCompletedPopupMenu = new QPopupMenu(this);
459 for (int i = 0; i <= 100; i+=20) { 459 for (int i = 0; i <= 100; i+=20) {
460 QString label = QString ("%1 %").arg (i); 460 QString label = QString ("%1 %").arg (i);
461 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 461 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
462 } 462 }
463 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 463 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
464 464
465 465
466 466
467 mItemPopupMenu = new QPopupMenu(this); 467 mItemPopupMenu = new QPopupMenu(this);
468 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
469 SLOT (toggleRunningItem()));
470 mItemPopupMenu->insertSeparator();
471 mItemPopupMenu->insertItem(i18n("Show..."), this, 468 mItemPopupMenu->insertItem(i18n("Show..."), this,
472 SLOT (showTodo())); 469 SLOT (showTodo()));
473 mItemPopupMenu->insertItem(i18n("Edit..."), this, 470 mItemPopupMenu->insertItem(i18n("Edit..."), this,
474 SLOT (editTodo())); 471 SLOT (editTodo()));
475 mItemPopupMenu->insertItem( i18n("Delete"), this, 472 mItemPopupMenu->insertItem( i18n("Delete"), this,
476 SLOT (deleteTodo())); 473 SLOT (deleteTodo()));
477 mItemPopupMenu->insertItem( i18n("Clone..."), this, 474 mItemPopupMenu->insertItem( i18n("Clone..."), this,
478 SLOT (cloneTodo())); 475 SLOT (cloneTodo()));
479 mItemPopupMenu->insertItem( i18n("Move..."), this, 476 mItemPopupMenu->insertItem( i18n("Move..."), this,
480 SLOT (moveTodo())); 477 SLOT (moveTodo()));
481 mItemPopupMenu->insertItem( i18n("Beam..."), this, 478 mItemPopupMenu->insertItem( i18n("Beam..."), this,
482 SLOT (beamTodo())); 479 SLOT (beamTodo()));
483 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 480 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
484 SLOT (cancelTodo())); 481 SLOT (cancelTodo()));
485 mItemPopupMenu->insertSeparator(); 482 mItemPopupMenu->insertSeparator();
483 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
484 SLOT (toggleRunningItem()));
485 mItemPopupMenu->insertSeparator();
486 /* 486 /*
487 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 487 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
488 SLOT (newTodo())); 488 SLOT (newTodo()));
489 */ 489 */
490 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 490 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
491 SLOT (newSubTodo())); 491 SLOT (newSubTodo()));
492 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 492 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
493 SLOT (unparentTodo()),0,21); 493 SLOT (unparentTodo()),0,21);
494 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, 494 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
495 SLOT (reparentTodo()),0,22); 495 SLOT (reparentTodo()),0,22);
496 mItemPopupMenu->insertSeparator(); 496 mItemPopupMenu->insertSeparator();
497#if 0 497#if 0
498 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), 498 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
499 this, SLOT( purgeCompleted() ) ); 499 this, SLOT( purgeCompleted() ) );
500 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 500 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
501 this, SLOT( toggleCompleted() ),0, 33 ); 501 this, SLOT( toggleCompleted() ),0, 33 );
502 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 502 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
503 this, SLOT( toggleQuickTodo() ),0, 34 ); 503 this, SLOT( toggleQuickTodo() ),0, 34 );
504 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 504 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
505 this, SLOT( toggleRunning() ),0, 35 ); 505 this, SLOT( toggleRunning() ),0, 35 );
506 506
507#endif 507#endif
508 mPopupMenu = new QPopupMenu(this); 508 mPopupMenu = new QPopupMenu(this);
509 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, 509 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
510 SLOT (newTodo()),0,1); 510 SLOT (newTodo()),0,1);
511 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), 511 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"),
512 this, SLOT(purgeCompleted()),0,2); 512 this, SLOT(purgeCompleted()),0,2);
513 mPopupMenu->insertItem(i18n("Show Completed"), 513 mPopupMenu->insertItem(i18n("Show Completed"),
514 this, SLOT( toggleCompleted() ),0,3 ); 514 this, SLOT( toggleCompleted() ),0,3 );
515 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
516 this, SLOT( toggleQuickTodo() ),0,4 );
517 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 515 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
518 this, SLOT( toggleRunning() ),0,5 ); 516 this, SLOT( toggleRunning() ),0,5 );
519 mPopupMenu->insertItem(i18n(" set all open","Display all opened"), 517 mPopupMenu->insertItem(i18n(" set all open","Display all opened"),
520 this, SLOT( setAllOpen() ),0,6 ); 518 this, SLOT( setAllOpen() ),0,6 );
521 mPopupMenu->insertItem(i18n(" set all close","Display all closed"), 519 mPopupMenu->insertItem(i18n(" set all close","Display all closed"),
522 this, SLOT( setAllClose() ),0,7 ); 520 this, SLOT( setAllClose() ),0,7 );
523 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), 521 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"),
524 this, SLOT( setAllFlat() ),0,8 ); 522 this, SLOT( setAllFlat() ),0,8 );
523 mPopupMenu->insertSeparator();
524 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
525 this, SLOT( toggleQuickTodo() ),0,4 );
525 mDocPrefs = new DocPrefs( name ); 526 mDocPrefs = new DocPrefs( name );
526 527
527 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); 528 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu );
528 mPopupMenu->setCheckable( true ); 529 mPopupMenu->setCheckable( true );
529 mItemPopupMenu->setCheckable( true ); 530 mItemPopupMenu->setCheckable( true );
530 531
531 532
532 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 533 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
533 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 534 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
534 535
535 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 536 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
536 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 537 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
537 538
538 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 539 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
539 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 540 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
540 541
541 542
542 // Double clicking conflicts with opening/closing the subtree 543 // Double clicking conflicts with opening/closing the subtree
543 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 544 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
544 SLOT( editItem( QListViewItem *) ) ); 545 SLOT( editItem( QListViewItem *) ) );
545 /* 546 /*
546 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 547 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
547 const QPoint &,int ) ), 548 const QPoint &,int ) ),
548 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 549 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
549 */ 550 */
550 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 551 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
551 const QPoint &,int ) ), 552 const QPoint &,int ) ),
552 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 553 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
553 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 554 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
554 SLOT( itemClicked( QListViewItem * ) ) ); 555 SLOT( itemClicked( QListViewItem * ) ) );
555 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 556 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
556 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 557 SLOT( itemDoubleClicked( QListViewItem * ) ) );
557 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 558 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
558 SLOT( updateView() ) ); 559 SLOT( updateView() ) );
559 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 560 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
560 SLOT( todoModified(Todo *, int) ) ); 561 SLOT( todoModified(Todo *, int) ) );
561 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 562 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
562 SLOT( itemStateChanged( QListViewItem * ) ) ); 563 SLOT( itemStateChanged( QListViewItem * ) ) );
563 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 564 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
564 SLOT( itemStateChanged( QListViewItem * ) ) ); 565 SLOT( itemStateChanged( QListViewItem * ) ) );
565 connect( mTodoListView, SIGNAL( paintNeeded() ), 566 connect( mTodoListView, SIGNAL( paintNeeded() ),
566 SLOT( paintNeeded()) ); 567 SLOT( paintNeeded()) );
567 568
568#if 0 569#if 0
569 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 570 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
570 SLOT(selectionChanged(QListViewItem *))); 571 SLOT(selectionChanged(QListViewItem *)));
571 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 572 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
572 SLOT(selectionChanged(QListViewItem *))); 573 SLOT(selectionChanged(QListViewItem *)));
573 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 574 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
574 SLOT(selectionChanged(QListViewItem *))); 575 SLOT(selectionChanged(QListViewItem *)));
575#endif 576#endif
576 577
577 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); 578 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
578 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); 579 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
579 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); 580 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
580 581
581 connect( mTodoListView, SIGNAL(selectionChanged() ), 582 connect( mTodoListView, SIGNAL(selectionChanged() ),
582 SLOT( processSelectionChange() ) ); 583 SLOT( processSelectionChange() ) );
583 connect( mQuickAdd, SIGNAL( returnPressed () ), 584 connect( mQuickAdd, SIGNAL( returnPressed () ),
584 SLOT( addQuickTodo() ) ); 585 SLOT( addQuickTodo() ) );
585 586
586} 587}
587 588
588KOTodoView::~KOTodoView() 589KOTodoView::~KOTodoView()
589{ 590{
590 // delete mKOTodoViewWhatsThis; 591 // delete mKOTodoViewWhatsThis;
591 delete mDocPrefs; 592 delete mDocPrefs;
592} 593}
593QString KOTodoView::getWhatsThisText(QPoint p) 594QString KOTodoView::getWhatsThisText(QPoint p)
594{ 595{
595 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); 596 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p );
596 if ( item ) 597 if ( item )
597 return KIncidenceFormatter::instance()->getFormattedText( item->todo(), 598 return KIncidenceFormatter::instance()->getFormattedText( item->todo(),
598 KOPrefs::instance()->mWTshowDetails, 599 KOPrefs::instance()->mWTshowDetails,
599 KOPrefs::instance()->mWTshowCreated, 600 KOPrefs::instance()->mWTshowCreated,
600 KOPrefs::instance()->mWTshowChanged); 601 KOPrefs::instance()->mWTshowChanged);
601 return i18n("That is the todo view" ); 602 return i18n("That is the todo view" );
602 603
603} 604}
604 605
605void KOTodoView::jumpToDate () 606void KOTodoView::jumpToDate ()
606{ 607{
607 // if (mActiveItem) { 608 // if (mActiveItem) {
608// mActiveItem->todo()); 609// mActiveItem->todo());
609// if ( mActiveItem->todo()->hasDueDate() ) 610// if ( mActiveItem->todo()->hasDueDate() )
610// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 611// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
611} 612}
612void KOTodoView::paintNeeded() 613void KOTodoView::paintNeeded()
613{ 614{
614 if ( mPendingUpdateBeforeRepaint ) { 615 if ( mPendingUpdateBeforeRepaint ) {
615 updateView(); 616 updateView();
616 mPendingUpdateBeforeRepaint = false; 617 mPendingUpdateBeforeRepaint = false;
617 } 618 }
618} 619}
619void KOTodoView::paintEvent(QPaintEvent * pevent) 620void KOTodoView::paintEvent(QPaintEvent * pevent)
620{ 621{
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 9c35b1d..762103f 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -252,198 +252,224 @@ Incidence* Incidence::recreateCloneException( QDate d )
252 } 252 }
253 return newInc; 253 return newInc;
254} 254}
255 255
256void Incidence::recreate() 256void Incidence::recreate()
257{ 257{
258 setCreated(QDateTime::currentDateTime()); 258 setCreated(QDateTime::currentDateTime());
259 259
260 setUid(CalFormat::createUniqueId()); 260 setUid(CalFormat::createUniqueId());
261 261
262 setRevision(0); 262 setRevision(0);
263 setIDStr( ":" ); 263 setIDStr( ":" );
264 setLastModified(QDateTime::currentDateTime()); 264 setLastModified(QDateTime::currentDateTime());
265} 265}
266void Incidence::cloneRelations( Incidence * newInc ) 266void Incidence::cloneRelations( Incidence * newInc )
267{ 267{
268 // newInc is already a clone of this incidence 268 // newInc is already a clone of this incidence
269 Incidence * inc; 269 Incidence * inc;
270 Incidence * cloneInc; 270 Incidence * cloneInc;
271 QPtrList<Incidence> Relations = relations(); 271 QPtrList<Incidence> Relations = relations();
272 for (inc=Relations.first();inc;inc=Relations.next()) { 272 for (inc=Relations.first();inc;inc=Relations.next()) {
273 cloneInc = inc->clone(); 273 cloneInc = inc->clone();
274 cloneInc->recreate(); 274 cloneInc->recreate();
275 cloneInc->setRelatedTo( newInc ); 275 cloneInc->setRelatedTo( newInc );
276 inc->cloneRelations( cloneInc ); 276 inc->cloneRelations( cloneInc );
277 } 277 }
278} 278}
279void Incidence::setReadOnly( bool readOnly ) 279void Incidence::setReadOnly( bool readOnly )
280{ 280{
281 IncidenceBase::setReadOnly( readOnly ); 281 IncidenceBase::setReadOnly( readOnly );
282 recurrence()->setRecurReadOnly( readOnly); 282 recurrence()->setRecurReadOnly( readOnly);
283} 283}
284 284
285void Incidence::setCreated(QDateTime created) 285void Incidence::setCreated(QDateTime created)
286{ 286{
287 if (mReadOnly) return; 287 if (mReadOnly) return;
288 mCreated = getEvenTime(created); 288 mCreated = getEvenTime(created);
289} 289}
290 290
291QDateTime Incidence::created() const 291QDateTime Incidence::created() const
292{ 292{
293 return mCreated; 293 return mCreated;
294} 294}
295 295
296void Incidence::setRevision(int rev) 296void Incidence::setRevision(int rev)
297{ 297{
298 if (mReadOnly) return; 298 if (mReadOnly) return;
299 mRevision = rev; 299 mRevision = rev;
300 300
301 updated(); 301 updated();
302} 302}
303 303
304int Incidence::revision() const 304int Incidence::revision() const
305{ 305{
306 return mRevision; 306 return mRevision;
307} 307}
308 308
309void Incidence::setDtStart(const QDateTime &dtStart) 309void Incidence::setDtStart(const QDateTime &dtStart)
310{ 310{
311 311
312 QDateTime dt = getEvenTime(dtStart); 312 QDateTime dt = getEvenTime(dtStart);
313 recurrence()->setRecurStart( dt); 313 recurrence()->setRecurStart( dt);
314 IncidenceBase::setDtStart( dt ); 314 IncidenceBase::setDtStart( dt );
315} 315}
316 316
317void Incidence::setDescription(const QString &description) 317void Incidence::setDescription(const QString &description)
318{ 318{
319 if (mReadOnly) return; 319 if (mReadOnly) return;
320 mDescription = description; 320 mDescription = description;
321 updated(); 321 updated();
322} 322}
323 323
324QString Incidence::description() const 324QString Incidence::description() const
325{ 325{
326 return mDescription; 326 return mDescription;
327} 327}
328 328
329 329
330void Incidence::setSummary(const QString &summary) 330void Incidence::setSummary(const QString &summary)
331{ 331{
332 if (mReadOnly) return; 332 if (mReadOnly) return;
333 mSummary = summary; 333 mSummary = summary;
334 updated(); 334 updated();
335} 335}
336 336
337QString Incidence::summary() const 337QString Incidence::summary() const
338{ 338{
339 return mSummary; 339 return mSummary;
340} 340}
341void Incidence::checkCategories() 341void Incidence::checkCategories()
342{ 342{
343 mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); 343 mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday"));
344 mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); 344 mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday"));
345 mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); 345 mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary"));
346} 346}
347 347
348void Incidence::setCategories(const QStringList &categories) 348void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false
349{
350 if (mReadOnly) return;
351 int i;
352 for( i = 0; i < categories.count(); ++i ) {
353 if ( !mCategories.contains (categories[i]))
354 mCategories.append( categories[i] );
355 }
356 checkCategories();
357 updated();
358 if ( addToRelations ) {
359 Incidence * inc;
360 QPtrList<Incidence> Relations = relations();
361 for (inc=Relations.first();inc;inc=Relations.next()) {
362 inc->addCategories( categories, true );
363 }
364 }
365}
366
367void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false
349{ 368{
350 if (mReadOnly) return; 369 if (mReadOnly) return;
351 mCategories = categories; 370 mCategories = categories;
352 checkCategories(); 371 checkCategories();
353 updated(); 372 updated();
373 if ( setForRelations ) {
374 Incidence * inc;
375 QPtrList<Incidence> Relations = relations();
376 for (inc=Relations.first();inc;inc=Relations.next()) {
377 inc->setCategories( categories, true );
378 }
379 }
354} 380}
355 381
356// TODO: remove setCategories(QString) function 382// TODO: remove setCategories(QString) function
357void Incidence::setCategories(const QString &catStr) 383void Incidence::setCategories(const QString &catStr)
358{ 384{
359 if (mReadOnly) return; 385 if (mReadOnly) return;
360 mCategories.clear(); 386 mCategories.clear();
361 387
362 if (catStr.isEmpty()) return; 388 if (catStr.isEmpty()) return;
363 389
364 mCategories = QStringList::split(",",catStr); 390 mCategories = QStringList::split(",",catStr);
365 391
366 QStringList::Iterator it; 392 QStringList::Iterator it;
367 for(it = mCategories.begin();it != mCategories.end(); ++it) { 393 for(it = mCategories.begin();it != mCategories.end(); ++it) {
368 *it = (*it).stripWhiteSpace(); 394 *it = (*it).stripWhiteSpace();
369 } 395 }
370 checkCategories(); 396 checkCategories();
371 updated(); 397 updated();
372} 398}
373 399
374QStringList Incidence::categories() const 400QStringList Incidence::categories() const
375{ 401{
376 return mCategories; 402 return mCategories;
377} 403}
378 404
379QString Incidence::categoriesStr() 405QString Incidence::categoriesStr()
380{ 406{
381 return mCategories.join(","); 407 return mCategories.join(",");
382} 408}
383QString Incidence::categoriesStrWithSpace() 409QString Incidence::categoriesStrWithSpace()
384{ 410{
385 return mCategories.join(", "); 411 return mCategories.join(", ");
386} 412}
387 413
388void Incidence::setRelatedToUid(const QString &relatedToUid) 414void Incidence::setRelatedToUid(const QString &relatedToUid)
389{ 415{
390 if (mReadOnly) return; 416 if (mReadOnly) return;
391 mRelatedToUid = relatedToUid; 417 mRelatedToUid = relatedToUid;
392} 418}
393 419
394QString Incidence::relatedToUid() const 420QString Incidence::relatedToUid() const
395{ 421{
396 return mRelatedToUid; 422 return mRelatedToUid;
397} 423}
398 424
399void Incidence::setRelatedTo(Incidence *relatedTo) 425void Incidence::setRelatedTo(Incidence *relatedTo)
400{ 426{
401 //qDebug("Incidence::setRelatedTo %d ", relatedTo); 427 //qDebug("Incidence::setRelatedTo %d ", relatedTo);
402 //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); 428 //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() );
403 if (mReadOnly || mRelatedTo == relatedTo) return; 429 if (mReadOnly || mRelatedTo == relatedTo) return;
404 if(mRelatedTo) { 430 if(mRelatedTo) {
405 // updated(); 431 // updated();
406 mRelatedTo->removeRelation(this); 432 mRelatedTo->removeRelation(this);
407 } 433 }
408 mRelatedTo = relatedTo; 434 mRelatedTo = relatedTo;
409 if (mRelatedTo) { 435 if (mRelatedTo) {
410 mRelatedTo->addRelation(this); 436 mRelatedTo->addRelation(this);
411 mRelatedToUid = mRelatedTo->uid(); 437 mRelatedToUid = mRelatedTo->uid();
412 } else { 438 } else {
413 mRelatedToUid = ""; 439 mRelatedToUid = "";
414 } 440 }
415} 441}
416 442
417Incidence *Incidence::relatedTo() const 443Incidence *Incidence::relatedTo() const
418{ 444{
419 return mRelatedTo; 445 return mRelatedTo;
420} 446}
421 447
422QPtrList<Incidence> Incidence::relations() const 448QPtrList<Incidence> Incidence::relations() const
423{ 449{
424 return mRelations; 450 return mRelations;
425} 451}
426 452
427void Incidence::addRelation(Incidence *event) 453void Incidence::addRelation(Incidence *event)
428{ 454{
429 if( mRelations.findRef( event ) == -1 ) { 455 if( mRelations.findRef( event ) == -1 ) {
430 mRelations.append(event); 456 mRelations.append(event);
431 //updated(); 457 //updated();
432 } 458 }
433} 459}
434 460
435void Incidence::removeRelation(Incidence *event) 461void Incidence::removeRelation(Incidence *event)
436{ 462{
437 463
438 mRelations.removeRef(event); 464 mRelations.removeRef(event);
439 465
440// if (event->getRelatedTo() == this) event->setRelatedTo(0); 466// if (event->getRelatedTo() == this) event->setRelatedTo(0);
441} 467}
442 468
443bool Incidence::recursOn(const QDate &qd) const 469bool Incidence::recursOn(const QDate &qd) const
444{ 470{
445 if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; 471 if (recurrence()->recursOnPure(qd) && !isException(qd)) return true;
446 else return false; 472 else return false;
447} 473}
448 474
449void Incidence::setExDates(const DateList &exDates) 475void Incidence::setExDates(const DateList &exDates)
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index 327e7dd..ebd50d0 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -58,193 +58,194 @@ class Incidence : public IncidenceBase
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
117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0; 117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) 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); 154 void setCategories(const QStringList &categories, bool setForRelations = false);
155 void addCategories(const QStringList &categories, bool addToRelations = false);
155 /** set event's categories based on a comma delimited string */ 156 /** set event's categories based on a comma delimited string */
156 void setCategories(const QString &catStr); 157 void setCategories(const QString &catStr);
157 /** return categories in a list */ 158 /** return categories in a list */
158 QStringList categories() const; 159 QStringList categories() const;
159 /** return categories as a comma separated string */ 160 /** return categories as a comma separated string */
160 QString categoriesStr(); 161 QString categoriesStr();
161 QString categoriesStrWithSpace(); 162 QString categoriesStrWithSpace();
162 163
163 /** 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
164 * only be used when constructing a calendar before the related Event 165 * only be used when constructing a calendar before the related Event
165 * exists. */ 166 * exists. */
166 void setRelatedToUid(const QString &); 167 void setRelatedToUid(const QString &);
167 /** what event does this one relate to? This function should 168 /** what event does this one relate to? This function should
168 * only be used when constructing a calendar before the related Event 169 * only be used when constructing a calendar before the related Event
169 * exists. */ 170 * exists. */
170 QString relatedToUid() const; 171 QString relatedToUid() const;
171 /** point at some other event to which the event relates */ 172 /** point at some other event to which the event relates */
172 void setRelatedTo(Incidence *relatedTo); 173 void setRelatedTo(Incidence *relatedTo);
173 /** what event does this one relate to? */ 174 /** what event does this one relate to? */
174 Incidence *relatedTo() const; 175 Incidence *relatedTo() const;
175 /** All events that are related to this event */ 176 /** All events that are related to this event */
176 QPtrList<Incidence> relations() const; 177 QPtrList<Incidence> relations() const;
177 /** Add an event which is related to this event */ 178 /** Add an event which is related to this event */
178 void addRelation(Incidence *); 179 void addRelation(Incidence *);
179 /** Remove event that is related to this event */ 180 /** Remove event that is related to this event */
180 void removeRelation(Incidence *); 181 void removeRelation(Incidence *);
181 182
182 /** returns the list of dates which are exceptions to the recurrence rule */ 183 /** returns the list of dates which are exceptions to the recurrence rule */
183 DateList exDates() const; 184 DateList exDates() const;
184 /** sets the list of dates which are exceptions to the recurrence rule */ 185 /** sets the list of dates which are exceptions to the recurrence rule */
185 void setExDates(const DateList &_exDates); 186 void setExDates(const DateList &_exDates);
186 void setExDates(const char *dates); 187 void setExDates(const char *dates);
187 /** Add a date to the list of exceptions of the recurrence rule. */ 188 /** Add a date to the list of exceptions of the recurrence rule. */
188 void addExDate(const QDate &date); 189 void addExDate(const QDate &date);
189 190
190 /** returns true if there is an exception for this date in the recurrence 191 /** returns true if there is an exception for this date in the recurrence
191 rule set, or false otherwise. */ 192 rule set, or false otherwise. */
192 bool isException(const QDate &qd) const; 193 bool isException(const QDate &qd) const;
193 194
194 /** add attachment to this event */ 195 /** add attachment to this event */
195 void addAttachment(Attachment *attachment); 196 void addAttachment(Attachment *attachment);
196 /** remove and delete a specific attachment */ 197 /** remove and delete a specific attachment */
197 void deleteAttachment(Attachment *attachment); 198 void deleteAttachment(Attachment *attachment);
198 /** remove and delete all attachments with this mime type */ 199 /** remove and delete all attachments with this mime type */
199 void deleteAttachments(const QString& mime); 200 void deleteAttachments(const QString& mime);
200 /** return list of all associated attachments */ 201 /** return list of all associated attachments */
201 QPtrList<Attachment> attachments() const; 202 QPtrList<Attachment> attachments() const;
202 /** find a list of attachments with this mime type */ 203 /** find a list of attachments with this mime type */
203 QPtrList<Attachment> attachments(const QString& mime) const; 204 QPtrList<Attachment> attachments(const QString& mime) const;
204 205
205 /** sets the event's status the value specified. See the enumeration 206 /** sets the event's status the value specified. See the enumeration
206 * above for possible values. */ 207 * above for possible values. */
207 void setSecrecy(int); 208 void setSecrecy(int);
208 /** return the event's secrecy. */ 209 /** return the event's secrecy. */
209 int secrecy() const; 210 int secrecy() const;
210 /** return the event's secrecy in string format. */ 211 /** return the event's secrecy in string format. */
211 QString secrecyStr() const; 212 QString secrecyStr() const;
212 /** return list of all availbale secrecy classes */ 213 /** return list of all availbale secrecy classes */
213 static QStringList secrecyList(); 214 static QStringList secrecyList();
214 /** return human-readable name of secrecy class */ 215 /** return human-readable name of secrecy class */
215 static QString secrecyName(int); 216 static QString secrecyName(int);
216 217
217 /** returns TRUE if the date specified is one on which the event will 218 /** returns TRUE if the date specified is one on which the event will
218 * recur. */ 219 * recur. */
219 bool recursOn(const QDate &qd) const; 220 bool recursOn(const QDate &qd) const;
220 221
221 // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): 222 // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?):
222 223
223 /** set resources used, such as Office, Car, etc. */ 224 /** set resources used, such as Office, Car, etc. */
224 void setResources(const QStringList &resources); 225 void setResources(const QStringList &resources);
225 /** return list of current resources */ 226 /** return list of current resources */
226 QStringList resources() const; 227 QStringList resources() const;
227 228
228 /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ 229 /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */
229 void setPriority(int priority); 230 void setPriority(int priority);
230 /** get the event's priority */ 231 /** get the event's priority */
231 int priority() const; 232 int priority() const;
232 233
233 /** All alarms that are associated with this incidence */ 234 /** All alarms that are associated with this incidence */
234 QPtrList<Alarm> alarms() const; 235 QPtrList<Alarm> alarms() const;
235 /** Create a new alarm which is associated with this incidence */ 236 /** Create a new alarm which is associated with this incidence */
236 Alarm* newAlarm(); 237 Alarm* newAlarm();
237 /** Add an alarm which is associated with this incidence */ 238 /** Add an alarm which is associated with this incidence */
238 void addAlarm(Alarm*); 239 void addAlarm(Alarm*);
239 /** Remove an alarm that is associated with this incidence */ 240 /** Remove an alarm that is associated with this incidence */
240 void removeAlarm(Alarm*); 241 void removeAlarm(Alarm*);
241 /** Remove all alarms that are associated with this incidence */ 242 /** Remove all alarms that are associated with this incidence */
242 void clearAlarms(); 243 void clearAlarms();
243 /** return whether any alarm associated with this incidence is enabled */ 244 /** return whether any alarm associated with this incidence is enabled */
244 bool isAlarmEnabled() const; 245 bool isAlarmEnabled() const;
245 246
246 /** 247 /**
247 Return the recurrence rule associated with this incidence. If there is 248 Return the recurrence rule associated with this incidence. If there is
248 none, returns an appropriate (non-0) object. 249 none, returns an appropriate (non-0) object.
249 */ 250 */
250 Recurrence *recurrence() const; 251 Recurrence *recurrence() const;