summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-09 23:58:28 (UTC)
committer zautrix <zautrix>2005-07-09 23:58:28 (UTC)
commit2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b (patch) (unidiff)
treee57782981707d6932940d0489fc942bfeab40dd6
parent47370b5d0dea0f29bb929ba13cf45186095c762d (diff)
downloadkdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.zip
kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.tar.gz
kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.tar.bz2
fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt8
-rw-r--r--korganizer/calendarview.cpp6
-rw-r--r--korganizer/kotodoview.cpp24
-rw-r--r--korganizer/kotodoviewitem.cpp66
-rw-r--r--libkcal/incidence.cpp28
-rw-r--r--libkcal/incidence.h3
-rw-r--r--libkcal/incidencebase.cpp4
-rw-r--r--libkcal/incidencebase.h1
-rw-r--r--libkdepim/kdatepicker.cpp1
9 files changed, 117 insertions, 24 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index ea7071d..6723dc5 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1145,391 +1145,399 @@
1145{ "&From:","Von:" }, 1145{ "&From:","Von:" },
1146{ "&To:","Bis:" }, 1146{ "&To:","Bis:" },
1147{ "Print &all todo items","Drucke alle Todo Items" }, 1147{ "Print &all todo items","Drucke alle Todo Items" },
1148{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" }, 1148{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" },
1149{ "Only items due in the &range:","Nur Items in dem Zeitraum:" }, 1149{ "Only items due in the &range:","Nur Items in dem Zeitraum:" },
1150{ "Todo List","Todo Liste" }, 1150{ "Todo List","Todo Liste" },
1151{ "&Title:","&Titel:" }, 1151{ "&Title:","&Titel:" },
1152{ "Co&nnect subtodos with its parent","Verbinde Untertodos mit ihren Ober-Todos" }, 1152{ "Co&nnect subtodos with its parent","Verbinde Untertodos mit ihren Ober-Todos" },
1153{ "Todo list","Todo Liste" }, 1153{ "Todo list","Todo Liste" },
1154{ "&Print...","Drucke..." }, 1154{ "&Print...","Drucke..." },
1155{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" }, 1155{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" },
1156{ "[Unconfigured]","[Unkonfiguriert]" }, 1156{ "[Unconfigured]","[Unkonfiguriert]" },
1157{ "OK","OK" }, 1157{ "OK","OK" },
1158{ "FilterEditor","FilterEditor" }, 1158{ "FilterEditor","FilterEditor" },
1159{ "Include","Inclusive" }, 1159{ "Include","Inclusive" },
1160{ "Exclude","Exclusive" }, 1160{ "Exclude","Exclusive" },
1161{ "Edit Selection...","Editiere Auswahl" }, 1161{ "Edit Selection...","Editiere Auswahl" },
1162{ "recurring events","wiederholende Termine" }, 1162{ "recurring events","wiederholende Termine" },
1163{ "recurr. events","wiederh.Termine" }, 1163{ "recurr. events","wiederh.Termine" },
1164{ "completed to-dos","erledigte Todos" }, 1164{ "completed to-dos","erledigte Todos" },
1165{ "events","Termine" }, 1165{ "events","Termine" },
1166{ "todos","Todos" }, 1166{ "todos","Todos" },
1167{ "journals","Journale" }, 1167{ "journals","Journale" },
1168{ "public","öffentl." }, 1168{ "public","öffentl." },
1169{ "private","privat" }, 1169{ "private","privat" },
1170{ "confidential","vertraul." }, 1170{ "confidential","vertraul." },
1171{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Untertodos.\nAlle erledigten Untertodos\nwerden auch gelöscht!" }, 1171{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Untertodos.\nAlle erledigten Untertodos\nwerden auch gelöscht!" },
1172{ "Yesterday","Gestern" }, 1172{ "Yesterday","Gestern" },
1173{ "Day after tomorrow","Übermorgen" }, 1173{ "Day after tomorrow","Übermorgen" },
1174{ "Tomorrow","Morgen" }, 1174{ "Tomorrow","Morgen" },
1175{ "Day before yesterday","Vorgestern" }, 1175{ "Day before yesterday","Vorgestern" },
1176{ "Size %1","Größe %1" }, 1176{ "Size %1","Größe %1" },
1177{ "New Agendasize: %1","Neue Agendagröße: %1" }, 1177{ "New Agendasize: %1","Neue Agendagröße: %1" },
1178{ " (%1 y.)"," (%1 J.)" }, 1178{ " (%1 y.)"," (%1 J.)" },
1179{ "Allday:","Ganztägig:" }, 1179{ "Allday:","Ganztägig:" },
1180{ "compl.todos","erled.Todos" }, 1180{ "compl.todos","erled.Todos" },
1181{ "Day view","Tagesansicht" }, 1181{ "Day view","Tagesansicht" },
1182{ "Next days","Nächste Tage" }, 1182{ "Next days","Nächste Tage" },
1183{ "Next week","Nächste Woche" }, 1183{ "Next week","Nächste Woche" },
1184{ "Next two weeks","Nächste zwei Wochen" }, 1184{ "Next two weeks","Nächste zwei Wochen" },
1185{ "This month","Dieser Monat" }, 1185{ "This month","Dieser Monat" },
1186{ "Journal view","Journal" }, 1186{ "Journal view","Journal" },
1187{ "Display all opened","Zeige alle geöffnet" }, 1187{ "Display all opened","Zeige alle geöffnet" },
1188{ "Display all closed","Zeige alle geschlossen" }, 1188{ "Display all closed","Zeige alle geschlossen" },
1189{ "Display all flat","Zeige alle flach" }, 1189{ "Display all flat","Zeige alle flach" },
1190{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, 1190{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" },
1191{ "Default todo done color:","Standard Todo erledigt Farbe" }, 1191{ "Default todo done color:","Standard Todo erledigt Farbe" },
1192{ "Select week %1-%2","Wähle Woche %1-%2" }, 1192{ "Select week %1-%2","Wähle Woche %1-%2" },
1193{ "Select Week","Wähle Woche" }, 1193{ "Select Week","Wähle Woche" },
1194{ "Set alarm...","Setze Alarm..." }, 1194{ "Set alarm...","Setze Alarm..." },
1195{ "Set Alarm!","Setze Alarm!" }, 1195{ "Set Alarm!","Setze Alarm!" },
1196{ "Changed alarm for %1 items","Alarm für %1 Items geändert" }, 1196{ "Changed alarm for %1 items","Alarm für %1 Items geändert" },
1197{ " and "," und " }, 1197{ " and "," und " },
1198{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, 1198{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" },
1199{ "Mail to selected","Mail an Ausgewählte" }, 1199{ "Mail to selected","Mail an Ausgewählte" },
1200{ "Mail to all","Mail an Alle" }, 1200{ "Mail to all","Mail an Alle" },
1201{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, 1201{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" },
1202{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, 1202{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" },
1203{ " on"," am" }, 1203{ " on"," am" },
1204{ " completed on "," erledigt am " }, 1204{ " completed on "," erledigt am " },
1205{ "Save as Event template","Speichere als Vorlage" }, 1205{ "Save as Event template","Speichere als Vorlage" },
1206{ "Load Event template","Lade Termin Vorlage" }, 1206{ "Load Event template","Lade Termin Vorlage" },
1207{ "Save as Journal template","Speichere als Journal Vorlage" }, 1207{ "Save as Journal template","Speichere als Journal Vorlage" },
1208{ "Insert Journal template","Füge Journal Vorlage ein" }, 1208{ "Insert Journal template","Füge Journal Vorlage ein" },
1209{ "Sub todos:<br>","Unter-Todos:<br>" }, 1209{ "Sub todos:<br>","Unter-Todos:<br>" },
1210{ "Parent todo:<br>","Über-Todo:<br>" }, 1210{ "Parent todo:<br>","Über-Todo:<br>" },
1211{ "Set current as color category","Setze Gewählte als Farbkategorie" }, 1211{ "Set current as color category","Setze Gewählte als Farbkategorie" },
1212{ " completed"," erledigt" }, 1212{ " completed"," erledigt" },
1213{ "(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!","(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi basiert auf KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) und das KDE Team.\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.pi-sync.info --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" }, 1213{ "(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!","(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi basiert auf KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) und das KDE Team.\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.pi-sync.info --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" },
1214{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." }, 1214{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." },
1215{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." }, 1215{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." },
1216{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." }, 1216{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." },
1217{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" }, 1217{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" },
1218{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." }, 1218{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." },
1219{ "Error","Fehler" }, 1219{ "Error","Fehler" },
1220{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." }, 1220{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." },
1221{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." }, 1221{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." },
1222{ "Warning","Warnung" }, 1222{ "Warning","Warnung" },
1223{ "Select week number","Wähle Wochen Nummer" }, 1223{ "Select week number","Wähle Wochen Nummer" },
1224{ "Februar","Februar" }, 1224{ "Februar","Februar" },
1225{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" }, 1225{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" },
1226{ "W","W" }, 1226{ "W","W" },
1227{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" }, 1227{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" },
1228{ "T: %1","T: %1" }, 1228{ "T: %1","T: %1" },
1229{ "Start: ","Start: " }, 1229{ "Start: ","Start: " },
1230{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " }, 1230{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " },
1231{ "Password for remote access:","Passwort für fernen Zugriff:" }, 1231{ "Password for remote access:","Passwort für fernen Zugriff:" },
1232{ "Remote IP address:","Ferne IP Adresse:" }, 1232{ "Remote IP address:","Ferne IP Adresse:" },
1233{ "Remote port number:","Ferne Port Nummer:" }, 1233{ "Remote port number:","Ferne Port Nummer:" },
1234{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." }, 1234{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." },
1235{ "Remote from: ","Fern von: " }, 1235{ "Remote from: ","Fern von: " },
1236{ "Local from: ","Lokal von: " }, 1236{ "Local from: ","Lokal von: " },
1237{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" }, 1237{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" },
1238{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, 1238{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" },
1239{ "Write back","Schreibe zurück" }, 1239{ "Write back","Schreibe zurück" },
1240{ "KO/Pi Synchronization","KO/Pi Synchronisation" }, 1240{ "KO/Pi Synchronization","KO/Pi Synchronisation" },
1241{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, 1241{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" },
1242{ "Received sync request","Sync Anfrage erhalten" }, 1242{ "Received sync request","Sync Anfrage erhalten" },
1243{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." }, 1243{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." },
1244{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, 1244{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." },
1245{ "Data saved to temp file!","Daten in temp Datei gespeichert!" }, 1245{ "Data saved to temp file!","Daten in temp Datei gespeichert!" },
1246{ "Sending file...","Sende Datei..." }, 1246{ "Sending file...","Sende Datei..." },
1247{ "Waiting for synced file...","Warte auf gesyncte Daten..." }, 1247{ "Waiting for synced file...","Warte auf gesyncte Daten..." },
1248{ "Receiving synced file...","Gesyncte Daten erhalten..." }, 1248{ "Receiving synced file...","Gesyncte Daten erhalten..." },
1249{ "Received %1 bytes","%1 Bytes erhalten" }, 1249{ "Received %1 bytes","%1 Bytes erhalten" },
1250{ "Writing file to disk...","Speichere Datei..." }, 1250{ "Writing file to disk...","Speichere Datei..." },
1251{ "Pi-Sync successful!","Pi-Sync erfolgreich!" }, 1251{ "Pi-Sync successful!","Pi-Sync erfolgreich!" },
1252{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, 1252{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" },
1253{ "Synchronize!","Synchronisiere!" }, 1253{ "Synchronize!","Synchronisiere!" },
1254{ "High clock skew!","Großer Uhrzeitunterschied!" }, 1254{ "High clock skew!","Großer Uhrzeitunterschied!" },
1255{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, 1255{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" },
1256{ "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!" }, 1256{ "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!" },
1257{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, 1257{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." },
1258{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, 1258{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" },
1259{ "List week view","Listenwochenansicht" }, 1259{ "List week view","Listenwochenansicht" },
1260{ "List week","Listenwochenansicht" }, 1260{ "List week","Listenwochenansicht" },
1261{ "Next Week","Nächste Woche" }, 1261{ "Next Week","Nächste Woche" },
1262{ "Previous Week","Vorherige Woche" }, 1262{ "Previous Week","Vorherige Woche" },
1263{ "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." }, 1263{ "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." },
1264{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, 1264{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" },
1265{ "Details","Details" }, 1265{ "Details","Details" },
1266{ "Created time","Erstellt Zeit" }, 1266{ "Created time","Erstellt Zeit" },
1267{ "Last modified time","Geändert Zeit" }, 1267{ "Last modified time","Geändert Zeit" },
1268{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, 1268{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" },
1269{ "View Options","Anzeige Optionen" }, 1269{ "View Options","Anzeige Optionen" },
1270{ "<b>Created: ","<b>Erstellt am: " }, 1270{ "<b>Created: ","<b>Erstellt am: " },
1271{ "<b>Last modified: ","<b>Zuletzt geändert am: " }, 1271{ "<b>Last modified: ","<b>Zuletzt geändert am: " },
1272{ "Journal: ","Journal: " }, 1272{ "Journal: ","Journal: " },
1273{ "yearly","jährlich" }, 1273{ "yearly","jährlich" },
1274{ "(%1) ","%1-" }, 1274{ "(%1) ","%1-" },
1275{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, 1275{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" },
1276{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, 1276{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" },
1277{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, 1277{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" },
1278{ "Summary/Loc.","Titel/Ort" }, 1278{ "Summary/Loc.","Titel/Ort" },
1279{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, 1279{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." },
1280{ "Week Number","Wochennummer" }, 1280{ "Week Number","Wochennummer" },
1281{ "Import","Importiere" }, 1281{ "Import","Importiere" },
1282{ "Export","Exportiere" }, 1282{ "Export","Exportiere" },
1283{ "Beam","Beame" }, 1283{ "Beam","Beame" },
1284{ "Export","Exportiere" }, 1284{ "Export","Exportiere" },
1285{ "As iCal (ics) file...","Als iCal (ics) Datei..." }, 1285{ "As iCal (ics) file...","Als iCal (ics) Datei..." },
1286{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, 1286{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." },
1287{ "Journal/Details...","Journale/Details..." }, 1287{ "Journal/Details...","Journale/Details..." },
1288{ "Agenda View","Agenda Ansicht" }, 1288{ "Agenda View","Agenda Ansicht" },
1289{ "Show current time","Zeige aktuelle Zeit" }, 1289{ "Show current time","Zeige aktuelle Zeit" },
1290{ "Edit new item","Bearbeite neuen Eintrag" }, 1290{ "Edit new item","Bearbeite neuen Eintrag" },
1291{ "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" }, 1291{ "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" },
1292{ "There is no next alarm.","Es gibt keinen nächsten Alarm." }, 1292{ "There is no next alarm.","Es gibt keinen nächsten Alarm." },
1293{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, 1293{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" },
1294{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, 1294{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" },
1295{ "%1 days\n","%1 Tagen\n" }, 1295{ "%1 days\n","%1 Tagen\n" },
1296{ "1 day\n","1 Tag\n" }, 1296{ "1 day\n","1 Tag\n" },
1297{ "%1 hours\n","%1 Stunden\n" }, 1297{ "%1 hours\n","%1 Stunden\n" },
1298{ "1 hour\n","1 Stunde\n" }, 1298{ "1 hour\n","1 Stunde\n" },
1299{ "%1 minutes\n","%1 Minuten\n" }, 1299{ "%1 minutes\n","%1 Minuten\n" },
1300{ "1 minute\n","1 Minute\n" }, 1300{ "1 minute\n","1 Minute\n" },
1301{ "Only one toolbar","Nur eine Toolbar" }, 1301{ "Only one toolbar","Nur eine Toolbar" },
1302{ "Print","Drucke" }, 1302{ "Print","Drucke" },
1303{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, 1303{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." },
1304{ "There is nothing selected!","Es ist nichts ausgewählt!" }, 1304{ "There is nothing selected!","Es ist nichts ausgewählt!" },
1305{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, 1305{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " },
1306{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, 1306{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" },
1307{ "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" }, 1307{ "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" },
1308{ "KO/Pi Printout","KO/Pi Ausdruck" }, 1308{ "KO/Pi Printout","KO/Pi Ausdruck" },
1309{ "Print unscaled","Drucke unskaliert" }, 1309{ "Print unscaled","Drucke unskaliert" },
1310{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, 1310{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." },
1311{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, 1311{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." },
1312{ "Printout Mode","Druck Modus" }, 1312{ "Printout Mode","Druck Modus" },
1313{ "Filter menu icon","Filtermenu Icon" }, 1313{ "Filter menu icon","Filtermenu Icon" },
1314{ "<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" }, 1314{ "<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" },
1315{ "<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" }, 1315{ "<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" },
1316{ "%1d","%1t" }, 1316{ "%1d","%1t" },
1317{ "%1h","%1std" }, 1317{ "%1h","%1std" },
1318{ "%1min","%1min" }, 1318{ "%1min","%1min" },
1319{ "( %1 before )","( %1 vorher )" }, 1319{ "( %1 before )","( %1 vorher )" },
1320{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, 1320{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" },
1321{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, 1321{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" },
1322{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, 1322{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." },
1323{ "Show Sync Events","Zeige Sync-Ereignisse" }, 1323{ "Show Sync Events","Zeige Sync-Ereignisse" },
1324{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, 1324{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" },
1325{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, 1325{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" },
1326{ " on "," am " }, 1326{ " on "," am " },
1327{ "On: ","Am: " }, 1327{ "On: ","Am: " },
1328{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, 1328{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" },
1329{ "Start/Stop todo...","Starte/Stoppe Todo..." }, 1329{ "Start/Stop todo...","Starte/Stoppe Todo..." },
1330{ "Color for running todos:","Farbe für laufende Todos:" }, 1330{ "Color for running todos:","Farbe für laufende Todos:" },
1331{ "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?" }, 1331{ "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?" },
1332{ "Todo is started","Todo ist gestartet" }, 1332{ "Todo is started","Todo ist gestartet" },
1333{ "Stop todo","Stoppe Todo" }, 1333{ "Stop todo","Stoppe Todo" },
1334{ "Todo is stopped","Todo ist gestoppt" }, 1334{ "Todo is stopped","Todo ist gestoppt" },
1335{ "Start todo","Starte Todo" }, 1335{ "Start todo","Starte Todo" },
1336{ "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?" }, 1336{ "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?" },
1337{ "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?" }, 1337{ "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?" },
1338{ "Todo has subtodos","Todo hat Untertodos" }, 1338{ "Todo has subtodos","Todo hat Untertodos" },
1339{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, 1339{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" },
1340{ "Colors","Farben" }, 1340{ "Colors","Farben" },
1341{ "Click on new parent item","Klicke auf neues Übertodo" }, 1341{ "Click on new parent item","Klicke auf neues Übertodo" },
1342{ "Reparenting aborted!","Übertodo setzen abgebrochen" }, 1342{ "Reparenting aborted!","Übertodo setzen abgebrochen" },
1343{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, 1343{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" },
1344{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, 1344{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" },
1345{ "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, 1345{ "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" },
1346{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, 1346{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" },
1347{ "times","Zeiten" }, 1347{ "times","Zeiten" },
1348{ "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?" }, 1348{ "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?" },
1349{ "Backup enabled","Backup angeschaltet" }, 1349{ "Backup enabled","Backup angeschaltet" },
1350{ "Use standard backup dir","Standard Backupverzeichnis" }, 1350{ "Use standard backup dir","Standard Backupverzeichnis" },
1351{ "Number of Backups:","Anzahl der Backups" }, 1351{ "Number of Backups:","Anzahl der Backups" },
1352{ "Make backup every ","Mache ein Backup alle " }, 1352{ "Make backup every ","Mache ein Backup alle " },
1353{ " days"," Tage" }, 1353{ " days"," Tage" },
1354{ "Creating backup ... please wait ...","Erstelle Backup ... bitte warten ..." }, 1354{ "Creating backup ... please wait ...","Erstelle Backup ... bitte warten ..." },
1355{ "Backup Failed!","Backup Problem!" }, 1355{ "Backup Failed!","Backup Problem!" },
1356{ "Try again now","Versuche jetzt nochmal" }, 1356{ "Try again now","Versuche jetzt nochmal" },
1357{ "Try again later","Versuche später nochmal" }, 1357{ "Try again later","Versuche später nochmal" },
1358{ "Try again tomorrow","Versuche morgen nochmal" }, 1358{ "Try again tomorrow","Versuche morgen nochmal" },
1359{ "Disable backup","Schalte Backup ab" }, 1359{ "Disable backup","Schalte Backup ab" },
1360{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, 1360{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" },
1361{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, 1361{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" },
1362{ "Choose action","Wähle Aktion" }, 1362{ "Choose action","Wähle Aktion" },
1363{ "Comment for todo:","Kommentar zum Todo:" }, 1363{ "Comment for todo:","Kommentar zum Todo:" },
1364{ "Stop+note","Stop+Notiz" }, 1364{ "Stop+note","Stop+Notiz" },
1365{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, 1365{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" },
1366{ "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" }, 1366{ "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" },
1367{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" }, 1367{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" },
1368{ "Print complete list...","Drucke komplette Liste..." }, 1368{ "Print complete list...","Drucke komplette Liste..." },
1369{ "Hide all selected","Verstecke Ausgewählte" }, 1369{ "Hide all selected","Verstecke Ausgewählte" },
1370{ "Add items","hinzufügen" }, 1370{ "Add items","hinzufügen" },
1371{ "One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?","Ein (oder mehrere) ausgewähltes\nTodo hat Untertodos!\nMöchten Sie der Auswahlliste\nalle Untertodos von allen\nausgewählten Todos hinzufügen?" }, 1371{ "One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?","Ein (oder mehrere) ausgewähltes\nTodo hat Untertodos!\nMöchten Sie der Auswahlliste\nalle Untertodos von allen\nausgewählten Todos hinzufügen?" },
1372{ "Print List View...","Drucke Listenansicht..." }, 1372{ "Print List View...","Drucke Listenansicht..." },
1373{ "You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.","Sie können die <b>Listenansicht</b> und die Listenansicht im <b>Suchdialog</b> ausdrucken! Um das zu machen gehen Sie bitte zur <b>Listenansicht</b> oder zum <b>Suchdialog</b>. Rechtsklicken Sie auf die Liste. Wählen Sie im Popupmenu den Eintrag <b>Drucke komplette Liste</b>. Das druckt die Liste so, wie man sie sieht. Sie können Listeneinträge entfernen ohne die korrespondierenden Ereignisse/Todos zu löschen! Selektieren sie einfach alle Einträge, die sie nicht ausdrucken möchten. Dann Rechtsklicken Sie auf einen Eintrag und wählen <b>Verstecke Selektierte</b>. Danach können Sie die Liste ohne diese Einträge ausdrucken." }, 1373{ "You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.","Sie können die <b>Listenansicht</b> und die Listenansicht im <b>Suchdialog</b> ausdrucken! Um das zu machen gehen Sie bitte zur <b>Listenansicht</b> oder zum <b>Suchdialog</b>. Rechtsklicken Sie auf die Liste. Wählen Sie im Popupmenu den Eintrag <b>Drucke komplette Liste</b>. Das druckt die Liste so, wie man sie sieht. Sie können Listeneinträge entfernen ohne die korrespondierenden Ereignisse/Todos zu löschen! Selektieren sie einfach alle Einträge, die sie nicht ausdrucken möchten. Dann Rechtsklicken Sie auf einen Eintrag und wählen <b>Verstecke Selektierte</b>. Danach können Sie die Liste ohne diese Einträge ausdrucken." },
1374{ "Configure KO/Pi...","Konfiguriere KO/Pi..." }, 1374{ "Configure KO/Pi...","Konfiguriere KO/Pi..." },
1375{ "Global Settings...","Globale Einstellungen..." }, 1375{ "Global Settings...","Globale Einstellungen..." },
1376{ "<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n","<p><b>R</b>: Zeige Resource Ansicht | <b>F</b>: Editiere Filter </p>\n" }, 1376{ "<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n","<p><b>R</b>: Zeige Resource Ansicht | <b>F</b>: Editiere Filter </p>\n" },
1377{ "(disabled)","(abgeschaltet)" }, 1377{ "(disabled)","(abgeschaltet)" },
1378{ "New Calendar","Neuer Kalender" }, 1378{ "New Calendar","Neuer Kalender" },
1379{ "Calendar","Kalender" }, 1379{ "Calendar","Kalender" },
1380{ "Filter selector","Filterauswahl" }, 1380{ "Filter selector","Filterauswahl" },
1381{ "Filtermenu","Filtermenu" }, 1381{ "Filtermenu","Filtermenu" },
1382{ "Toggle Fullscreen","Vollbild umschalten" }, 1382{ "Toggle Fullscreen","Vollbild umschalten" },
1383{ "Toggle Resource View","Resourcenansicht umschalten" }, 1383{ "Toggle Resource View","Resourcenansicht umschalten" },
1384{ "Storage HowTo...","Speicherort HowTo..." }, 1384{ "Storage HowTo...","Speicherort HowTo..." },
1385{ "Timetracking HowTo...","Timetracking HowTo..." }, 1385{ "Timetracking HowTo...","Timetracking HowTo..." },
1386{ "Juni","Juni" }, 1386{ "Juni","Juni" },
1387{ "Juli","Juli" }, 1387{ "Juli","Juli" },
1388{ "ToDo:","ToDo:" }, 1388{ "ToDo:","ToDo:" },
1389{ "Set Calendar","Setze Kalender" }, 1389{ "Set Calendar","Setze Kalender" },
1390{ "Todo: %1","Todo: %1" }, 1390{ "Todo: %1","Todo: %1" },
1391{ ": (Prio ",": (Prio " }, 1391{ ": (Prio ",": (Prio " },
1392{ "Todos","Todos" }, 1392{ "Todos","Todos" },
1393{ "Todo Viewer","Todo Anzeige" }, 1393{ "Todo Viewer","Todo Anzeige" },
1394{ "Todo ","Todo " }, 1394{ "Todo ","Todo " },
1395{ " Calendar \n Resource "," Kalender \n Resource " }, 1395{ " Calendar \n Resource "," Kalender \n Resource " },
1396{ " Color "," Farbe " }, 1396{ " Color "," Farbe " },
1397{ "The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>. Möchten Sie diesen Kalender aus KO/Pi entfernen? (Die Datei wird dabei nicht gelöscht!)" }, 1397{ "The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>. Möchten Sie diesen Kalender aus KO/Pi entfernen? (Die Datei wird dabei nicht gelöscht!)" },
1398{ "The calendar <b>%1</b> is displaying file <b>%2</b>","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>" }, 1398{ "The calendar <b>%1</b> is displaying file <b>%2</b>","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>" },
1399{ "Add new Calendar","Füge Kalender hinzu" }, 1399{ "Add new Calendar","Füge Kalender hinzu" },
1400{ "<b>Name of new calendar:</b>","<b>Name des Kalenders:</b>" }, 1400{ "<b>Name of new calendar:</b>","<b>Name des Kalenders:</b>" },
1401{ "<b>Local ical (*.ics) file:</b>","<b>Lokale ical (*.ics) Datei:</b>" }, 1401{ "<b>Local ical (*.ics) file:</b>","<b>Lokale ical (*.ics) Datei:</b>" },
1402{ "Sorry, the calendar name is empty!","Sorry, der Kalendername ist leer!" }, 1402{ "Sorry, the calendar name is empty!","Sorry, der Kalendername ist leer!" },
1403{ "Sorry, the file name is empty!","Sorry, der Dateiname ist leer!" }, 1403{ "Sorry, the file name is empty!","Sorry, der Dateiname ist leer!" },
1404{ "Error loading calendar file\n%1.","Fehler beim Laden der Kalenderdatei\n%1." }, 1404{ "Error loading calendar file\n%1.","Fehler beim Laden der Kalenderdatei\n%1." },
1405{ "The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>","Der Kalender <b>%1</b> ist nicht geladen! Das Laden der Datei <b>%2</b> schlug fehl! <b>Soll erneut versucht werden den Kalender zu laden?</b>" }, 1405{ "The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>","Der Kalender <b>%1</b> ist nicht geladen! Das Laden der Datei <b>%2</b> schlug fehl! <b>Soll erneut versucht werden den Kalender zu laden?</b>" },
1406{ "Global application font for all apps:","Globale Schriftart:" }, 1406{ "Global application font for all apps:","Globale Schriftart:" },
1407{ "Application Font","Applikationsschriftart" }, 1407{ "Application Font","Applikationsschriftart" },
1408{ "Kx/Pi","Kx/Pi" }, 1408{ "Kx/Pi","Kx/Pi" },
1409{ "Backup","Backup" }, 1409{ "Backup","Backup" },
1410{ "KDE-Pim Global Settings","KDE-Pim Globale Einstellungen" }, 1410{ "KDE-Pim Global Settings","KDE-Pim Globale Einstellungen" },
1411{ "Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!","Sorry, der Kalendername \n%1\nist schon in Benutzung!\nBitte wählen Sie einen anderen!" }, 1411{ "Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!","Sorry, der Kalendername \n%1\nist schon in Benutzung!\nBitte wählen Sie einen anderen!" },
1412{ "Sorry, the file \n%1\nis already loaded!\nPlease choose another file!","Sorry, die Datei \n%1\nist schon geladen!\nBitte wählen Sie eine andere!" }, 1412{ "Sorry, the file \n%1\nis already loaded!\nPlease choose another file!","Sorry, die Datei \n%1\nist schon geladen!\nBitte wählen Sie eine andere!" },
1413{ "Choose Color","Wähle Farbe" }, 1413{ "Choose Color","Wähle Farbe" },
1414{ " OK "," OK " }, 1414{ " OK "," OK " },
1415{ " Cancel "," Abbrechen " }, 1415{ " Cancel "," Abbrechen " },
1416{ "Matching items will be added to list","Passende werden zur Liste hinzugefügt" }, 1416{ "Matching items will be added to list","Passende werden zur Liste hinzugefügt" },
1417{ "Matching items will be removed from list","Passende werden von der Liste entfernt" }, 1417{ "Matching items will be removed from list","Passende werden von der Liste entfernt" },
1418{ "Search on displayed list only","Suche auf der dargestellten Liste" }, 1418{ "Search on displayed list only","Suche auf der dargestellten Liste" },
1419{ "List will be cleared before search","Liste wird vor der Suche gelöscht" }, 1419{ "List will be cleared before search","Liste wird vor der Suche gelöscht" },
1420{ "<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>","<center>%1</center> <center>ist nicht am Laufen. Möchten Sie den Zustand auf "laufend" setzen?</center>" }, 1420{ "<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>","<center>%1</center> <center>ist nicht am Laufen. Möchten Sie den Zustand auf "laufend" setzen?</center>" },
1421{ "%1\nis running!","%1\nist am Laufen!" }, 1421{ "%1\nis running!","%1\nist am Laufen!" },
1422{ "Additional Comment:","Zusätzlicher Kommentar:" }, 1422{ "Additional Comment:","Zusätzlicher Kommentar:" },
1423{ "Stop and save","Stopp und Speichern" }, 1423{ "Stop and save","Stopp und Speichern" },
1424{ "Continue running","Weiter laufen lassen" }, 1424{ "Continue running","Weiter laufen lassen" },
1425{ "Stop - do not save","Stopp - nicht Speichern" }, 1425{ "Stop - do not save","Stopp - nicht Speichern" },
1426{ "Do you really want to set\nthe state to stopped\nwithout saving the data?","Möchten sie den Zustand\nwirklich auf gestoppt setzen\nohne die Daten abzuspeichern?" }, 1426{ "Do you really want to set\nthe state to stopped\nwithout saving the data?","Möchten sie den Zustand\nwirklich auf gestoppt setzen\nohne die Daten abzuspeichern?" },
1427{ "Time mismatch!","Zeiten stimmen nicht!" }, 1427{ "Time mismatch!","Zeiten stimmen nicht!" },
1428{ "The start time is\nafter the end time!","Die Startzeit ist\nhinter der Endzeit!" }, 1428{ "The start time is\nafter the end time!","Die Startzeit ist\nhinter der Endzeit!" },
1429{ "Yes, stop todo","Ja, stoppe Todo" }, 1429{ "Yes, stop todo","Ja, stoppe Todo" },
1430{ "Todo stopped - no data saved because runtime was < 15 sec!","Todo gestoppt - nichts gespeichert da Laufzeit < 15 sec!" }, 1430{ "Todo stopped - no data saved because runtime was < 15 sec!","Todo gestoppt - nichts gespeichert da Laufzeit < 15 sec!" },
1431{ "Todo started! Double click again to stop!","Todo gestartet! Doppelklicke um es zu stoppen!" }, 1431{ "Todo started! Double click again to stop!","Todo gestartet! Doppelklicke um es zu stoppen!" },
1432{ "Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.","Bitte wählen Sie den <b>Default-Kalender</b> in dieser Spalte. Neu angelegte oder importierte Einträge werden dem Default-Kalender hinzugefügt." }, 1432{ "Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.","Bitte wählen Sie den <b>Default-Kalender</b> in dieser Spalte. Neu angelegte oder importierte Einträge werden dem Default-Kalender hinzugefügt." },
1433{ "Spouse","Ehegatte" }, 1433{ "Spouse","Ehegatte" },
1434{ "Notes","Notizen" }, 1434{ "Notes","Notizen" },
1435{ "Messanger","Messanger" }, 1435{ "Messanger","Messanger" },
1436{ "Assistant","Assistent" }, 1436{ "Assistant","Assistent" },
1437{ "Manager","Manager" }, 1437{ "Manager","Manager" },
1438{ "Secrecy","Sichtbar" }, 1438{ "Secrecy","Sichtbar" },
1439{ "male","männlich" }, 1439{ "male","männlich" },
1440{ "female","weiblich" }, 1440{ "female","weiblich" },
1441{ "Hide!","Verbergen!" }, 1441{ "Hide!","Verbergen!" },
1442{ "Show!","Anzeigen!" }, 1442{ "Show!","Anzeigen!" },
1443{ "Details","Details" }, 1443{ "Details","Details" },
1444{ "Profession","Beruf" }, 1444{ "Profession","Beruf" },
1445{ "Children","Kinder" }, 1445{ "Children","Kinder" },
1446{ "Department","Abteilung" }, 1446{ "Department","Abteilung" },
1447{ "Backup cancelled","Backup abgebrochen" }, 1447{ "Backup cancelled","Backup abgebrochen" },
1448{ "Backup globally disabled","Backup global abgeschaltet" }, 1448{ "Backup globally disabled","Backup global abgeschaltet" },
1449{ "Backup succesfully finished","Backup erfolgreich beendet" }, 1449{ "Backup succesfully finished","Backup erfolgreich beendet" },
1450{ "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" }, 1450{ "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" },
1451{ "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" }, 1451{ "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" },
1452{ "Birthdays","Geburtstage" }, 1452{ "Birthdays","Geburtstage" },
1453{ "KO/Pi import information!","KO/Pi Import Information!" }, 1453{ "KO/Pi import information!","KO/Pi Import Information!" },
1454{ "Start this todo\nand stop all running","Starte dieses Todo\nund stoppe alle Laufenden" }, 1454{ "Start this todo\nand stop all running","Starte dieses Todo\nund stoppe alle Laufenden" },
1455{ "Cancel - do not start"," Abbrechen - Todo nicht starten" }, 1455{ "Cancel - do not start"," Abbrechen - Todo nicht starten" },
1456{ "The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n"How do I change the timezone?"\nas well!","Die Zeitzone wurde geändert!\nSollen die Kalender neu geladen\nwerden num die Zeiten\nder Termine zu ändern?\nBitte lesen Sie auch\nMenu: Help->FAQ:\n"How do I change the timezone?"" }, 1456{ "The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n"How do I change the timezone?"\nas well!","Die Zeitzone wurde geändert!\nSollen die Kalender neu geladen\nwerden num die Zeiten\nder Termine zu ändern?\nBitte lesen Sie auch\nMenu: Help->FAQ:\n"How do I change the timezone?"" },
1457{ "Reload","Neu laden" }, 1457{ "Reload","Neu laden" },
1458{ "Timezone settings","Zeitzoneneinstellung" }, 1458{ "Timezone settings","Zeitzoneneinstellung" },
1459{ "Title: ","Titel: " }, 1459{ "Title: ","Titel: " },
1460{ "Journal from: ","Journal vom: " }, 1460{ "Journal from: ","Journal vom: " },
1461{ "Journal: %1 from ","Journal: %1 vom " }, 1461{ "Journal: %1 from ","Journal: %1 vom " },
1462{ "<b>Click here to edit categories: </b>","<b>Klicke hier um Kategorien zu ändern: </b>" }, 1462{ "<b>Click here to edit categories: </b>","<b>Klicke hier um Kategorien zu ändern: </b>" },
1463{ "Selected Item","Ausgewähltes Item" }, 1463{ "Selected Item","Ausgewähltes Item" },
1464{ "Select Date...","Wähle Datum..." }, 1464{ "Select Date...","Wähle Datum..." },
1465{ "After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:","Nach dem Importieren/Laden/Syncen kann es neue Kategorien in den Terminen oder Todos geben, die nicht automatisch der Kategorieliste hinzugefügt werden. Bitte wählen Sie, was <b>jetzt</b> passieren soll:" }, 1465{ "After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:","Nach dem Importieren/Laden/Syncen kann es neue Kategorien in den Terminen oder Todos geben, die nicht automatisch der Kategorieliste hinzugefügt werden. Bitte wählen Sie, was <b>jetzt</b> passieren soll:" },
1466{ "Change category list now!","Ändere Kategorieliste jetzt!" }, 1466{ "Change category list now!","Ändere Kategorieliste jetzt!" },
1467{ "Edit category list...","Ändere Kategorieliste..." }, 1467{ "Edit category list...","Ändere Kategorieliste..." },
1468{ "Toolbar changes needs a restart!","Neustart benötigt für Toolbaränderungen!" }, 1468{ "Toolbar changes needs a restart!","Neustart benötigt für Toolbaränderungen!" },
1469{ "Filepath: ","Dateipfad: " }, 1469{ "Filepath: ","Dateipfad: " },
1470{ "You can try to reload the calendar in the Resource View!","In der Resourcenansicht können Sie erneut versuchen den Kalender zu laden!" }, 1470{ "You can try to reload the calendar in the Resource View!","In der Resourcenansicht können Sie erneut versuchen den Kalender zu laden!" },
1471{ "<b>WARNING:</b> There is a pending suspended alarm!","<b>WARNUNG:</b> Es gibt einen laufenden Suspendalarm!" }, 1471{ "<b>WARNING:</b> There is a pending suspended alarm!","<b>WARNUNG:</b> Es gibt einen laufenden Suspendalarm!" },
1472{ "Pending Suspend Alarm","Laufender Suspend Alarm" }, 1472{ "Pending Suspend Alarm","Laufender Suspend Alarm" },
1473{ "Error loading calendar %1","Fehler beim Laden von Kalender %1" }, 1473{ "Error loading calendar %1","Fehler beim Laden von Kalender %1" },
1474{ "Calendar(s) not loaded:","Nicht geladene(r) Kalender:" }, 1474{ "Calendar(s) not loaded:","Nicht geladene(r) Kalender:" },
1475{ "Loding of calendar(s) failed","Laden von Kalendern fehlgeschlagen" }, 1475{ "Loding of calendar(s) failed","Laden von Kalendern fehlgeschlagen" },
1476{ "Alarm Options","Alarm Einstellungen" }, 1476{ "Alarm Options","Alarm Einstellungen" },
1477{ "Delete selected...","Lösche Ausgewählte..." }, 1477{ "Delete selected...","Lösche Ausgewählte..." },
1478{ "None","Nichts" }, 1478{ "None","Nichts" },
1479{ "Selection","Auswahl" }, 1479{ "Selection","Auswahl" },
1480{ "Set categories","Setze Kategorien" }, 1480{ "Set categories","Setze Kategorien" },
1481{ "This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!","Das fügt die ausgewählten\nEinträge dem Kalender\n%1\nhinzu und entfernt sie von\nihrem aktuellen Kalender!" }, 1481{ "This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!","Das fügt die ausgewählten\nEinträge dem Kalender\n%1\nhinzu und entfernt sie von\nihrem aktuellen Kalender!" },
1482{ "Reset","Neu setzen" }, 1482{ "Reset","Neu setzen" },
1483{ "Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?","Möchten Sie Kategorien zu den ausgewählten Einträgen <b>hinzufügen</b> oder die Liste <b>neu setzen</b> (d.h. vorhandene Kategorien löschen)?" }, 1483{ "Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?","Möchten Sie Kategorien zu den ausgewählten Einträgen <b>hinzufügen</b> oder die Liste <b>neu setzen</b> (d.h. vorhandene Kategorien löschen)?" },
1484{ "The file\n%1\ndoes not exist!\nShall I create it for you?","Die Datei\n%1\nexistiert nicht!\nSoll sie neu angelegt werden?" }, 1484{ "The file\n%1\ndoes not exist!\nShall I create it for you?","Die Datei\n%1\nexistiert nicht!\nSoll sie neu angelegt werden?" },
1485{ "Sorry, cannot create the file\n%1!\nNo calendar added!","Kann leider die Datei\n%1\nnicht anlegen!\nKein Kalender hinzugefügt!" }, 1485{ "Sorry, cannot create the file\n%1!\nNo calendar added!","Kann leider die Datei\n%1\nnicht anlegen!\nKein Kalender hinzugefügt!" },
1486{ "\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n","\nKEIN\n SCHREIBBARER\n KALENDER\n GEFUNDEN!\n\nBitte korrigieren Sie\nihre Kalendereinstellungen!\n" }, 1486{ "\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n","\nKEIN\n SCHREIBBARER\n KALENDER\n GEFUNDEN!\n\nBitte korrigieren Sie\nihre Kalendereinstellungen!\n" },
1487{ "\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n","\nDie Datei\n%1\nwurde verändert!\nDatei Grösse: %2 Bytes.\nZuletzt geändert: %3\nMöchten Sie:\n\n - Speichern und die Datei überschreiben?\n - Mit Datei Synchronisieren, dann speichern?\n - Abbrechen ohne zu speichern? \n" }, 1487{ "\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n","\nDie Datei\n%1\nwurde verändert!\nDatei Grösse: %2 Bytes.\nZuletzt geändert: %3\nMöchten Sie:\n\n - Speichern und die Datei überschreiben?\n - Mit Datei Synchronisieren, dann speichern?\n - Abbrechen ohne zu speichern? \n" },
1488{ "Edit","Edit" }, 1488{ "Edit","Edit" },
1489{ "Last Modified","Zuletzt geändert" }, 1489{ "Last Modified","Zuletzt geändert" },
1490{ "Journal viewer","Journal Anzeige" }, 1490{ "Journal viewer","Journal Anzeige" },
1491{ "Configure Calendar Files...","Konfiguriere Kalenderdateien..." }, 1491{ "Configure Calendar Files...","Konfiguriere Kalenderdateien..." },
1492{ "You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>.","Sie können <b>mehr als eine</b> Kalenderdatei in KO/Pi darstellen und benutzen. Eine Kalenderdatei wird <b>Resource</b> genannt. Um einen Kalender hinzuzufügen oder die Kalendereinstellungen zu ändern benutzen Sie bitte das Menu: <b>Ansicht -> Resourcenansicht umschalten</b>." }, 1492{ "You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>.","Sie können <b>mehr als eine</b> Kalenderdatei in KO/Pi darstellen und benutzen. Eine Kalenderdatei wird <b>Resource</b> genannt. Um einen Kalender hinzuzufügen oder die Kalendereinstellungen zu ändern benutzen Sie bitte das Menu: <b>Ansicht -> Resourcenansicht umschalten</b>." },
1493{ "Hide Completed","Verstecke erledigte Todos" }, 1493{ "Hide Completed","Verstecke erledigte Todos" },
1494{ "Show not Running","Zeige nicht Laufende" }, 1494{ "Show not Running","Zeige nicht Laufende" },
1495{ "Click to add new Todo","Klick für neues Todo!" }, 1495{ "Click to add new Todo","Klick für neues Todo!" },
1496{ "Show next conflict for","Zeige nächsten Konflikt für" }, 1496{ "Show next conflict for","Zeige nächsten Konflikt für" },
1497{ "All events","Alle Termine" }, 1497{ "All events","Alle Termine" },
1498{ "Allday events","Ganztagestermine" }, 1498{ "Allday events","Ganztagestermine" },
1499{ "Events with time","Termine mit Zeit" }, 1499{ "Events with time","Termine mit Zeit" },
1500{ "No conflict found","Kein Konflikt gefunden" }, 1500{ "No conflict found","Kein Konflikt gefunden" },
1501{ "Conflict %1 <-> %2","Konflikt %1 <-> %2" }, 1501{ "Conflict %1 <-> %2","Konflikt %1 <-> %2" },
1502{ "<p><b>Q</b>: Show next date with conflicting events\n ","<p><b>Q</b>: Zeige nächstes Datum mit Terminen im Konflikt\n " }, 1502{ "<p><b>Q</b>: Show next date with conflicting events\n ","<p><b>Q</b>: Zeige nächstes Datum mit Terminen im Konflikt\n " },
1503{ "Week view mode uses row layout","Wochenansicht Modus nutzt Reihenlayout" }, 1503{ "Week view mode uses row layout","Wochenansicht Modus nutzt Reihenlayout" },
1504{ "The event\n%1\nconflicts with event\n%2\nat date\n%3.\n","Der Termin\n%1\nist im Konflikt mit Termin\n%2\nam Datum\n%3.\n" }, 1504{ "The event\n%1\nconflicts with event\n%2\nat date\n%3.\n","Der Termin\n%1\nist im Konflikt mit Termin\n%2\nam Datum\n%3.\n" },
1505{ "KO/Pi Conflict delected","KO/Pi Konflikt erkannt" }, 1505{ "KO/Pi Conflict delected","KO/Pi Konflikt erkannt" },
1506{ "Show date","Zeige Datum" }, 1506{ "Show date","Zeige Datum" },
1507{ "No problem!","Null Problemo!" }, 1507{ "No problem!","Null Problemo!" },
1508{ "Automatically sync with KDE-Desktop\nwhen receiving sync request","Synce automatisch mit KDE-Desktop\nwenn eine Sync-Anforderung kommt" }, 1508{ "Automatically sync with KDE-Desktop\nwhen receiving sync request","Synce automatisch mit KDE-Desktop\nwenn eine Sync-Anforderung kommt" },
1509{ "Pi-Sync Port Error","Pi-Sync Port Fehler" }, 1509{ "Pi-Sync Port Error","Pi-Sync Port Fehler" },
1510{ "<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?","<b>Anschalten von Pi-Sync fehlgeschlagen!</b> Fehler beim Ansprechen des Ports %1! Ist bereits eine andere Anwendung dabei diesen Port zu nutzen?" }, 1510{ "<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?","<b>Anschalten von Pi-Sync fehlgeschlagen!</b> Fehler beim Ansprechen des Ports %1! Ist bereits eine andere Anwendung dabei diesen Port zu nutzen?" },
1511{ "No valid port number:\n%1","Keine gültige Port Nummer:\n%1" }, 1511{ "No valid port number:\n%1","Keine gültige Port Nummer:\n%1" },
1512{ "Port number (Default: %1)\nValid range from 1 to 65535","Port Nummer (Standard: %1)\nGültiger Bereich von 1 bis 65535" }, 1512{ "Port number (Default: %1)\nValid range from 1 to 65535","Port Nummer (Standard: %1)\nGültiger Bereich von 1 bis 65535" },
1513{ "Pi-Sync Error","Pi-Sync Fehler" }, 1513{ "Pi-Sync Error","Pi-Sync Fehler" },
1514{ "Got send file request\nwith invalid password","Erhielt "sende Datei" Anfrage\nmit ungültigem Passwort" }, 1514{ "Got send file request\nwith invalid password","Erhielt "sende Datei" Anfrage\nmit ungültigem Passwort" },
1515{ "Got receive file request\nwith invalid password","Erhielt "empfange Datei" Anfrage\nmit ungültigem Passwort" }, 1515{ "Got receive file request\nwith invalid password","Erhielt "empfange Datei" Anfrage\nmit ungültigem Passwort" },
1516{ "Wrong password: Receiving remote file failed.","Falsches Passwort: Empfangen von entfernter Datei fehlgeschlagen." }, 1516{ "Wrong password: Receiving remote file failed.","Falsches Passwort: Empfangen von entfernter Datei fehlgeschlagen." },
1517{ "Please close error dialog on remote.","Bitte schließe Fehler-Dialog am entfernten Rechner" }, 1517{ "Please close error dialog on remote.","Bitte schließe Fehler-Dialog am entfernten Rechner" },
1518{ "Unknown error on remote.","Unbekannter Fehler am entfernten Rechner" }, 1518{ "Unknown error on remote.","Unbekannter Fehler am entfernten Rechner" },
1519{ "Pi-Sync: Connected!","Pi-Sync: Verbunden!" }, 1519{ "Pi-Sync: Connected!","Pi-Sync: Verbunden!" },
1520{ "Receiving file from remote...","Empfange entfernte Datei..." }, 1520{ "Receiving file from remote...","Empfange entfernte Datei..." },
1521{ "Sending back synced file...","Sende synchronisierte Datei zurück..." }, 1521{ "Sending back synced file...","Sende synchronisierte Datei zurück..." },
1522{ "Do you want to\nclear all sync info\nof all profiles?","Möchten Sie wirklich\ndie Sync-Info\nfür alle Profile\nlöschen?" }, 1522{ "Do you want to\nclear all sync info\nof all profiles?","Möchten Sie wirklich\ndie Sync-Info\nfür alle Profile\nlöschen?" },
1523{ "Do you want to\nclear the sync\ninfo of profile\n%1?\n","Möchten Sie wirklich\ndie Sync-Info für Profil\n%1?\nlöschen" }, 1523{ "Do you want to\nclear the sync\ninfo of profile\n%1?\n","Möchten Sie wirklich\ndie Sync-Info für Profil\n%1?\nlöschen" },
1524{ "Sorry, no valid port.Syncing cancelled.","Sorry, kein gültiger Port. Syncing abgebrochen." }, 1524{ "Sorry, no valid port.Syncing cancelled.","Sorry, kein gültiger Port. Syncing abgebrochen." },
1525{ "Remote port number:\n(May be: 1 - 65535)","Ferne Port Nummer:\n(Darf sein: 1 - 65535)" }, 1525{ "Remote port number:\n(May be: 1 - 65535)","Ferne Port Nummer:\n(Darf sein: 1 - 65535)" },
1526{ "Writing back file ...","Schreibe Datei zurück..." }, 1526{ "Writing back file ...","Schreibe Datei zurück..." },
1527{ "Sending back file ...","Sende Datei zurück..." }, 1527{ "Sending back file ...","Sende Datei zurück..." },
1528{ "Eeek, there I am ticklish!","Hihi, da bin ich kitzlig!" }, 1528{ "Eeek, there I am ticklish!","Hihi, da bin ich kitzlig!" },
1529{ "Created","Angelegt" },
1530{ "Last Modified Sub","Zuletzt geändertes Sub" },
1531{ "","" },
1532{ "","" },
1533{ "","" },
1534{ "","" },
1535{ "","" },
1536{ "","" },
1529{ "","" }, 1537{ "","" },
1530{ "","" }, 1538{ "","" },
1531{ "","" }, 1539{ "","" },
1532{ "","" }, 1540{ "","" },
1533{ "","" }, 1541{ "","" },
1534{ "","" }, 1542{ "","" },
1535{ "","" }, 1543{ "","" },
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 7044e90..f9685e9 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1,754 +1,754 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Requires the Qt and KDE widget libraries, available at no cost at 4 Requires the Qt and KDE widget libraries, available at no cost at
5 http://www.troll.no and http://www.kde.org respectively 5 http://www.troll.no and http://www.kde.org respectively
6 6
7 Copyright (c) 1997, 1998, 1999 7 Copyright (c) 1997, 1998, 1999
8 Preston Brown (preton.brown@yale.edu) 8 Preston Brown (preton.brown@yale.edu)
9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) 9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl)
10 Ian Dawes (iadawes@globalserve.net) 10 Ian Dawes (iadawes@globalserve.net)
11 Laszlo Boloni (boloni@cs.purdue.edu) 11 Laszlo Boloni (boloni@cs.purdue.edu)
12 12
13 Copyright (c) 2000, 2001, 2002 13 Copyright (c) 2000, 2001, 2002
14 Cornelius Schumacher <schumacher@kde.org> 14 Cornelius Schumacher <schumacher@kde.org>
15 15
16 This program is free software; you can redistribute it and/or modify 16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by 17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or 18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version. 19 (at your option) any later version.
20 20
21 This program is distributed in the hope that it will be useful, 21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
24 GNU General Public License for more details. 24 GNU General Public License for more details.
25 25
26 You should have received a copy of the GNU General Public License 26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software 27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qradiobutton.h> 34#include <qradiobutton.h>
35#include <qbuttongroup.h> 35#include <qbuttongroup.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qclipboard.h> 37#include <qclipboard.h>
38#include <qcursor.h> 38#include <qcursor.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qprogressbar.h> 40#include <qprogressbar.h>
41#include <qmultilineedit.h> 41#include <qmultilineedit.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qwidgetstack.h> 43#include <qwidgetstack.h>
44#include <qptrlist.h> 44#include <qptrlist.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qgroupbox.h> 46#include <qgroupbox.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qdir.h> 48#include <qdir.h>
49#ifndef KORG_NOSPLITTER 49#ifndef KORG_NOSPLITTER
50#include <qsplitter.h> 50#include <qsplitter.h>
51#endif 51#endif
52 52
53#include <kglobal.h> 53#include <kglobal.h>
54#include <kdebug.h> 54#include <kdebug.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57#include <kmessagebox.h> 57#include <kmessagebox.h>
58#include <knotifyclient.h> 58#include <knotifyclient.h>
59#include <kconfig.h> 59#include <kconfig.h>
60 60
61#include <libkdepim/ksyncprefsdialog.h> 61#include <libkdepim/ksyncprefsdialog.h>
62#include <krun.h> 62#include <krun.h>
63#include <kdirwatch.h> 63#include <kdirwatch.h>
64#include <libkdepim/kdatepicker.h> 64#include <libkdepim/kdatepicker.h>
65#include <libkdepim/ksyncprofile.h> 65#include <libkdepim/ksyncprofile.h>
66#include <libkdepim/kpimglobalprefs.h> 66#include <libkdepim/kpimglobalprefs.h>
67 67
68#include <libkcal/vcaldrag.h> 68#include <libkcal/vcaldrag.h>
69#include <libkcal/icaldrag.h> 69#include <libkcal/icaldrag.h>
70#include <libkcal/icalformat.h> 70#include <libkcal/icalformat.h>
71#include <libkcal/vcalformat.h> 71#include <libkcal/vcalformat.h>
72#include <libkcal/scheduler.h> 72#include <libkcal/scheduler.h>
73#include <libkcal/calendarlocal.h> 73#include <libkcal/calendarlocal.h>
74#include <libkcal/journal.h> 74#include <libkcal/journal.h>
75#include <libkcal/calfilter.h> 75#include <libkcal/calfilter.h>
76#include <libkcal/attendee.h> 76#include <libkcal/attendee.h>
77#include <libkcal/dndfactory.h> 77#include <libkcal/dndfactory.h>
78#include <libkcal/freebusy.h> 78#include <libkcal/freebusy.h>
79#include <libkcal/filestorage.h> 79#include <libkcal/filestorage.h>
80#include <libkcal/calendarresources.h> 80#include <libkcal/calendarresources.h>
81#include <libkcal/qtopiaformat.h> 81#include <libkcal/qtopiaformat.h>
82#include "../kalarmd/alarmdialog.h" 82#include "../kalarmd/alarmdialog.h"
83 83
84#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
85#include <libkcal/sharpformat.h> 85#include <libkcal/sharpformat.h>
86#include <externalapphandler.h> 86#include <externalapphandler.h>
87#endif 87#endif
88#include <libkcal/phoneformat.h> 88#include <libkcal/phoneformat.h>
89#ifndef KORG_NOMAIL 89#ifndef KORG_NOMAIL
90#include "komailclient.h" 90#include "komailclient.h"
91#endif 91#endif
92#ifndef KORG_NOPRINTER 92#ifndef KORG_NOPRINTER
93#include "calprinter.h" 93#include "calprinter.h"
94#endif 94#endif
95#ifndef KORG_NOPLUGINS 95#ifndef KORG_NOPLUGINS
96#include "kocore.h" 96#include "kocore.h"
97#endif 97#endif
98#include "koeventeditor.h" 98#include "koeventeditor.h"
99#include "kotodoeditor.h" 99#include "kotodoeditor.h"
100#include "koprefs.h" 100#include "koprefs.h"
101#include "koeventviewerdialog.h" 101#include "koeventviewerdialog.h"
102#include "publishdialog.h" 102#include "publishdialog.h"
103#include "kofilterview.h" 103#include "kofilterview.h"
104#include "koglobals.h" 104#include "koglobals.h"
105#include "koviewmanager.h" 105#include "koviewmanager.h"
106#include "koagendaview.h" 106#include "koagendaview.h"
107#include "koagenda.h" 107#include "koagenda.h"
108#include "kodialogmanager.h" 108#include "kodialogmanager.h"
109#include "outgoingdialog.h" 109#include "outgoingdialog.h"
110#include "incomingdialog.h" 110#include "incomingdialog.h"
111#include "datenavigatorcontainer.h" 111#include "datenavigatorcontainer.h"
112#include "statusdialog.h" 112#include "statusdialog.h"
113#include "kdatenavigator.h" 113#include "kdatenavigator.h"
114#include "kotodoview.h" 114#include "kotodoview.h"
115#include "datenavigator.h" 115#include "datenavigator.h"
116#include "resourceview.h" 116#include "resourceview.h"
117#include "navigatorbar.h" 117#include "navigatorbar.h"
118#include "searchdialog.h" 118#include "searchdialog.h"
119#include "mainwindow.h" 119#include "mainwindow.h"
120#include "categoryeditdialog.h" 120#include "categoryeditdialog.h"
121 121
122#include "calendarview.h" 122#include "calendarview.h"
123#ifndef DESKTOP_VERSION 123#ifndef DESKTOP_VERSION
124#include <qtopia/alarmserver.h> 124#include <qtopia/alarmserver.h>
125#endif 125#endif
126#ifndef _WIN32_ 126#ifndef _WIN32_
127#include <stdlib.h> 127#include <stdlib.h>
128#include <stdio.h> 128#include <stdio.h>
129#include <unistd.h> 129#include <unistd.h>
130#else 130#else
131#include <qprocess.h> 131#include <qprocess.h>
132#endif 132#endif
133 133
134#ifdef DESKTOP_VERSION 134#ifdef DESKTOP_VERSION
135#include <kabc/stdaddressbook.h> 135#include <kabc/stdaddressbook.h>
136#endif 136#endif
137using namespace KOrg; 137using namespace KOrg;
138using namespace KCal; 138using namespace KCal;
139extern int globalFlagBlockAgenda; 139extern int globalFlagBlockAgenda;
140extern int globalFlagBlockStartup; 140extern int globalFlagBlockStartup;
141 141
142 142
143MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) 143MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent)
144 144
145{ 145{
146 mAlarms = alarms; 146 mAlarms = alarms;
147 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); 147 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) );
148 QString mText = "<table width=\"100%\">\n"; 148 QString mText = "<table width=\"100%\">\n";
149 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 149 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
150#ifdef DESKTOP_VERSION 150#ifdef DESKTOP_VERSION
151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
152#else 152#else
153 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; 153 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>";
154#endif 154#endif
155 // mText += "<img src=\""; 155 // mText += "<img src=\"";
156 // mText += ipath; 156 // mText += ipath;
157 // mText += "\">"; 157 // mText += "\">";
158 //mEventDate = QDate::currentDate(); 158 //mEventDate = QDate::currentDate();
159#ifdef DESKTOP_VERSION 159#ifdef DESKTOP_VERSION
160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; 160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>";
161#else 161#else
162 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; 162 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>";
163#endif 163#endif
164 //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 164 //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
165 165
166 Incidence * inc = getNextInc( start ); 166 Incidence * inc = getNextInc( start );
167 int time = 0; 167 int time = 0;
168 //mText += "<table>"; 168 //mText += "<table>";
169 while ( inc ) { 169 while ( inc ) {
170 QDateTime dt ; 170 QDateTime dt ;
171 QString tempText = "<a "; 171 QString tempText = "<a ";
172 bool ok; 172 bool ok;
173 dt = inc->getNextOccurence( start, &ok ); 173 dt = inc->getNextOccurence( start, &ok );
174 if ( !ok ) continue; 174 if ( !ok ) continue;
175 if ( inc->typeID() == eventID ) { 175 if ( inc->typeID() == eventID ) {
176 tempText += "href=\"event:"; 176 tempText += "href=\"event:";
177 } else if ( inc->typeID() == todoID ) { 177 } else if ( inc->typeID() == todoID ) {
178 tempText += "href=\"todo:"; 178 tempText += "href=\"todo:";
179 } 179 }
180 tempText += inc->uid() + "\">"; 180 tempText += inc->uid() + "\">";
181 if ( inc->typeID() == todoID ) 181 if ( inc->typeID() == todoID )
182 tempText += i18n("Todo: "); 182 tempText += i18n("Todo: ");
183 if ( inc->summary().length() > 0 ) 183 if ( inc->summary().length() > 0 )
184 tempText += inc->summary(); 184 tempText += inc->summary();
185 else 185 else
186 tempText += i18n("-no summary-"); 186 tempText += i18n("-no summary-");
187 QString timestr; 187 QString timestr;
188 if (!inc->doesFloat()) 188 if (!inc->doesFloat())
189 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; 189 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": ";
190 else 190 else
191 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 191 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
192 if ( dt.date() < QDate::currentDate() && time == 0 ) { 192 if ( dt.date() < QDate::currentDate() && time == 0 ) {
193 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 193 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
194 mText += "<table>"; 194 mText += "<table>";
195 time = 1; 195 time = 1;
196 } 196 }
197 if ( dt.date() == QDate::currentDate() && time <= 1 ) { 197 if ( dt.date() == QDate::currentDate() && time <= 1 ) {
198 if ( time > 0 ) 198 if ( time > 0 )
199 mText +="</table>"; 199 mText +="</table>";
200 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; 200 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>";
201 mText += "<table>"; 201 mText += "<table>";
202 time = 2; 202 time = 2;
203 203
204 } 204 }
205 if ( dt.date() > QDate::currentDate() && time <= 2 ) { 205 if ( dt.date() > QDate::currentDate() && time <= 2 ) {
206 if ( time > 0 ) 206 if ( time > 0 )
207 mText +="</table>"; 207 mText +="</table>";
208 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; 208 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>";
209 mText += "<table>"; 209 mText += "<table>";
210 time = 3; 210 time = 3;
211 } 211 }
212 mText +="<tr><td><b>"; 212 mText +="<tr><td><b>";
213 mText += timestr; 213 mText += timestr;
214 mText += "</b></td><td>"; 214 mText += "</b></td><td>";
215 mText += tempText; 215 mText += tempText;
216 mText += "</td></tr>\n"; 216 mText += "</td></tr>\n";
217 inc = getNextInc( start ); 217 inc = getNextInc( start );
218 } 218 }
219 mText +="</table>"; 219 mText +="</table>";
220 setText( mText ); 220 setText( mText );
221} 221}
222 222
223MissedAlarmTextBrowser::~MissedAlarmTextBrowser() 223MissedAlarmTextBrowser::~MissedAlarmTextBrowser()
224{ 224{
225 //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); 225 //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() ");
226} 226}
227Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) 227Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start )
228{ 228{
229 QDateTime dt ; 229 QDateTime dt ;
230 Incidence * retInc; 230 Incidence * retInc;
231 Incidence * inc = mAlarms.first(); 231 Incidence * inc = mAlarms.first();
232 if ( inc == 0 ) 232 if ( inc == 0 )
233 return 0; 233 return 0;
234 bool ok; 234 bool ok;
235 dt = inc->getNextOccurence( start, &ok ); 235 dt = inc->getNextOccurence( start, &ok );
236 if ( ! ok ) return 0; 236 if ( ! ok ) return 0;
237 QDateTime dtn ; 237 QDateTime dtn ;
238 retInc = inc; 238 retInc = inc;
239 inc = mAlarms.next(); 239 inc = mAlarms.next();
240 while ( inc ) { 240 while ( inc ) {
241 dtn = inc->getNextOccurence( start, &ok ); 241 dtn = inc->getNextOccurence( start, &ok );
242 if ( ! ok ) return 0; 242 if ( ! ok ) return 0;
243 if ( dtn < dt ) { 243 if ( dtn < dt ) {
244 dt = dtn; 244 dt = dtn;
245 retInc = inc; 245 retInc = inc;
246 } 246 }
247 inc = mAlarms.next(); 247 inc = mAlarms.next();
248 } 248 }
249 mAlarms.remove( retInc ); 249 mAlarms.remove( retInc );
250 return retInc; 250 return retInc;
251 251
252} 252}
253void MissedAlarmTextBrowser::setSource(const QString & n) 253void MissedAlarmTextBrowser::setSource(const QString & n)
254{ 254{
255 if (n.startsWith("event:")) { 255 if (n.startsWith("event:")) {
256#ifdef DESKTOP_VERSION 256#ifdef DESKTOP_VERSION
257 emit showIncidence(n.mid(8)); 257 emit showIncidence(n.mid(8));
258#else 258#else
259 emit showIncidence(n.mid(6)); 259 emit showIncidence(n.mid(6));
260#endif 260#endif
261 return; 261 return;
262 } else if (n.startsWith("todo:")) { 262 } else if (n.startsWith("todo:")) {
263#ifdef DESKTOP_VERSION 263#ifdef DESKTOP_VERSION
264 emit showIncidence(n.mid(7)); 264 emit showIncidence(n.mid(7));
265#else 265#else
266 emit showIncidence(n.mid(5)); 266 emit showIncidence(n.mid(5));
267#endif 267#endif
268 return; 268 return;
269 } 269 }
270} 270}
271 271
272 272
273class KOBeamPrefs : public QDialog 273class KOBeamPrefs : public QDialog
274{ 274{
275 public: 275 public:
276 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 276 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
277 QDialog( parent, name, true ) 277 QDialog( parent, name, true )
278 { 278 {
279 setCaption( i18n("Beam Options") ); 279 setCaption( i18n("Beam Options") );
280 QVBoxLayout* lay = new QVBoxLayout( this ); 280 QVBoxLayout* lay = new QVBoxLayout( this );
281 lay->setSpacing( 3 ); 281 lay->setSpacing( 3 );
282 lay->setMargin( 3 ); 282 lay->setMargin( 3 );
283 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 283 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
284 lay->addWidget( format ); 284 lay->addWidget( format );
285 format->setExclusive ( true ) ; 285 format->setExclusive ( true ) ;
286 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 286 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
287 lay->addWidget( time ); time->setExclusive ( true ) ; 287 lay->addWidget( time ); time->setExclusive ( true ) ;
288 vcal = new QRadioButton(" vCalendar ", format ); 288 vcal = new QRadioButton(" vCalendar ", format );
289 ical = new QRadioButton(" iCalendar ", format ); 289 ical = new QRadioButton(" iCalendar ", format );
290 vcal->setChecked( true ); 290 vcal->setChecked( true );
291 tz = new QRadioButton(i18n(" With timezone "), time ); 291 tz = new QRadioButton(i18n(" With timezone "), time );
292 local = new QRadioButton(i18n(" Local time "), time ); 292 local = new QRadioButton(i18n(" Local time "), time );
293 tz->setChecked( true ); 293 tz->setChecked( true );
294 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 294 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
295 lay->addWidget( ok ); 295 lay->addWidget( ok );
296 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 296 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
297 lay->addWidget( cancel ); 297 lay->addWidget( cancel );
298 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 298 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
299 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 299 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
300 resize( 200, 200 ); 300 resize( 200, 200 );
301 } 301 }
302 302
303 bool beamVcal() { return vcal->isChecked(); } 303 bool beamVcal() { return vcal->isChecked(); }
304 bool beamLocal() { return local->isChecked(); } 304 bool beamLocal() { return local->isChecked(); }
305private: 305private:
306 QRadioButton* vcal, *ical, *local, *tz; 306 QRadioButton* vcal, *ical, *local, *tz;
307}; 307};
308class KOCatPrefs : public QDialog 308class KOCatPrefs : public QDialog
309{ 309{
310 public: 310 public:
311 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 311 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
312 QDialog( parent, name, true ) 312 QDialog( parent, name, true )
313 { 313 {
314 setCaption( i18n("Manage new Categories") ); 314 setCaption( i18n("Manage new Categories") );
315 QVBoxLayout* lay = new QVBoxLayout( this ); 315 QVBoxLayout* lay = new QVBoxLayout( this );
316 lay->setSpacing( 3 ); 316 lay->setSpacing( 3 );
317 lay->setMargin( 3 ); 317 lay->setMargin( 3 );
318 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); 318 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this );
319 lay->addWidget( lab ); 319 lay->addWidget( lab );
320 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 320 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
321 lay->addWidget( format ); 321 lay->addWidget( format );
322 format->setExclusive ( true ) ; 322 format->setExclusive ( true ) ;
323 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 323 addCatBut = new QRadioButton(i18n("Add to category list"), format );
324 new QRadioButton(i18n("Remove from Events/Todos"), format ); 324 new QRadioButton(i18n("Remove from Events/Todos"), format );
325 addCatBut->setChecked( true ); 325 addCatBut->setChecked( true );
326 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); 326 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this );
327 lay->addWidget( ok ); 327 lay->addWidget( ok );
328 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 328 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
329 lay->addWidget( cancel ); 329 lay->addWidget( cancel );
330 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 330 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
331 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 331 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
332 resize( 200, 200 ); 332 resize( 200, 200 );
333 } 333 }
334 334
335 bool addCat() { return addCatBut->isChecked(); } 335 bool addCat() { return addCatBut->isChecked(); }
336private: 336private:
337 QRadioButton* addCatBut; 337 QRadioButton* addCatBut;
338}; 338};
339 339
340 340
341 341
342CalendarView::CalendarView( CalendarResources *calendar, 342CalendarView::CalendarView( CalendarResources *calendar,
343 QWidget *parent, const char *name ) 343 QWidget *parent, const char *name )
344 : CalendarViewBase( parent, name ), 344 : CalendarViewBase( parent, name ),
345 mCalendar( calendar ), 345 mCalendar( calendar ),
346 mResourceManager( calendar->resourceManager() ) 346 mResourceManager( calendar->resourceManager() )
347{ 347{
348 348
349 mEventEditor = 0; 349 mEventEditor = 0;
350 mTodoEditor = 0; 350 mTodoEditor = 0;
351 351
352 init(); 352 init();
353} 353}
354 354
355CalendarView::CalendarView( Calendar *calendar, 355CalendarView::CalendarView( Calendar *calendar,
356 QWidget *parent, const char *name ) 356 QWidget *parent, const char *name )
357 : CalendarViewBase( parent, name ), 357 : CalendarViewBase( parent, name ),
358 mCalendar( calendar ), 358 mCalendar( calendar ),
359 mResourceManager( 0 ) 359 mResourceManager( 0 )
360{ 360{
361 361
362 mEventEditor = 0; 362 mEventEditor = 0;
363 mTodoEditor = 0; 363 mTodoEditor = 0;
364 init(); 364 init();
365} 365}
366 366
367void CalendarView::init() 367void CalendarView::init()
368{ 368{
369 mNextAlarmDateTime = QDateTime::currentDateTime(); 369 mNextAlarmDateTime = QDateTime::currentDateTime();
370 setFocusPolicy ( NoFocus ); 370 //setFocusPolicy ( NoFocus );
371 mViewerCallerIsSearchDialog = false; 371 mViewerCallerIsSearchDialog = false;
372 mBlockShowDates = false; 372 mBlockShowDates = false;
373 373
374 mDatePickerMode = 0; 374 mDatePickerMode = 0;
375 mCurrentSyncDevice = ""; 375 mCurrentSyncDevice = "";
376 mViewManager = new KOViewManager( this ); 376 mViewManager = new KOViewManager( this );
377 mDialogManager = new KODialogManager( this ); 377 mDialogManager = new KODialogManager( this );
378 mEventViewerDialog = 0; 378 mEventViewerDialog = 0;
379 mModified = false; 379 mModified = false;
380 mReadOnly = false; 380 mReadOnly = false;
381 mSelectedIncidence = 0; 381 mSelectedIncidence = 0;
382 mCalPrinter = 0; 382 mCalPrinter = 0;
383 mFilters.setAutoDelete(true); 383 mFilters.setAutoDelete(true);
384 384
385 mCalendar->registerObserver( this ); 385 mCalendar->registerObserver( this );
386 // TODO: Make sure that view is updated, when calendar is changed. 386 // TODO: Make sure that view is updated, when calendar is changed.
387 387
388 mStorage = new FileStorage( mCalendar ); 388 mStorage = new FileStorage( mCalendar );
389 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 389 mNavigator = new DateNavigator( this, "datevav", mViewManager );
390 390
391 QBoxLayout *topLayout = (QBoxLayout*)layout(); 391 QBoxLayout *topLayout = (QBoxLayout*)layout();
392#ifndef KORG_NOSPLITTER 392#ifndef KORG_NOSPLITTER
393 // create the main layout frames. 393 // create the main layout frames.
394 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 394 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
395 topLayout->addWidget(mPanner); 395 topLayout->addWidget(mPanner);
396 396
397 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 397 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
398 "CalendarView::LeftFrame"); 398 "CalendarView::LeftFrame");
399 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 399 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
400 400
401 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 401 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
402 "CalendarView::DateNavigator" ); 402 "CalendarView::DateNavigator" );
403 403
404 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 404 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
405 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 405 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
406 mTodoList->setNavigator( mNavigator ); 406 mTodoList->setNavigator( mNavigator );
407 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 407 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
408 408
409#ifdef KORG_NORESOURCEVIEW 409#ifdef KORG_NORESOURCEVIEW
410 mResourceView = 0; 410 mResourceView = 0;
411#else 411#else
412 if ( mResourceManager ) { 412 if ( mResourceManager ) {
413 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 413 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
414 mResourceView->updateView(); 414 mResourceView->updateView();
415 connect( mResourceView, SIGNAL( resourcesChanged() ), 415 connect( mResourceView, SIGNAL( resourcesChanged() ),
416 SLOT( updateView() ) ); 416 SLOT( updateView() ) );
417 } else { 417 } else {
418 mResourceView = 0; 418 mResourceView = 0;
419 } 419 }
420#endif 420#endif
421 QWidget *rightBox = new QWidget( mPanner ); 421 QWidget *rightBox = new QWidget( mPanner );
422 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 422 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
423 423
424 mRightFrame = new QWidgetStack( rightBox ); 424 mRightFrame = new QWidgetStack( rightBox );
425 rightLayout->addWidget( mRightFrame, 1 ); 425 rightLayout->addWidget( mRightFrame, 1 );
426 426
427 mLeftFrame = mLeftSplitter; 427 mLeftFrame = mLeftSplitter;
428#else 428#else
429 //QWidget *mainBox = new QWidget( this ); 429 //QWidget *mainBox = new QWidget( this );
430 //QWidget *leftFrame = new QWidget( mainBox ); 430 //QWidget *leftFrame = new QWidget( mainBox );
431 //QBoxLayout * mainBoxLayout; 431 //QBoxLayout * mainBoxLayout;
432 if ( KOPrefs::instance()->mVerticalScreen ) { 432 if ( KOPrefs::instance()->mVerticalScreen ) {
433 //mainBoxLayout = new QVBoxLayout(mainBox); 433 //mainBoxLayout = new QVBoxLayout(mainBox);
434 //leftFrameLayout = new QHBoxLayout(leftFrame ); 434 //leftFrameLayout = new QHBoxLayout(leftFrame );
435 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 435 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
436 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 436 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
437 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 437 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
438 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 438 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
439 } else { 439 } else {
440 //mainBoxLayout = new QHBoxLayout(mainBox); 440 //mainBoxLayout = new QHBoxLayout(mainBox);
441 //leftFrameLayout = new QVBoxLayout(leftFrame ); 441 //leftFrameLayout = new QVBoxLayout(leftFrame );
442 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 442 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
443 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 443 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
444 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 444 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
445 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 445 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
446 } 446 }
447 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 447 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
448 //QBoxLayout * leftFrameLayout; 448 //QBoxLayout * leftFrameLayout;
449 topLayout->addWidget( mMainFrame ); 449 topLayout->addWidget( mMainFrame );
450#ifdef DESKTOP_VERSION 450#ifdef DESKTOP_VERSION
451 mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this ); 451 mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this );
452 topLayout->addWidget( mDateScrollBar ); 452 topLayout->addWidget( mDateScrollBar );
453 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); 453 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
454 if ( QApplication::desktop()->width() < 800 ) 454 if ( QApplication::desktop()->width() < 800 )
455 mDateScrollBar->hide(); 455 mDateScrollBar->hide();
456#endif 456#endif
457 //mainBoxLayout->addWidget (mLeftFrame); 457 //mainBoxLayout->addWidget (mLeftFrame);
458 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 458 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
459 "CalendarView::DateNavigator" ); 459 "CalendarView::DateNavigator" );
460#if 0 460#if 0
461 // FIXME 461 // FIXME
462 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 462 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
463 "CalendarView::DateNavigator", QDate::currentDate()); 463 "CalendarView::DateNavigator", QDate::currentDate());
464#endif 464#endif
465 // mDateNavigator->blockSignals( true ); 465 // mDateNavigator->blockSignals( true );
466 //leftFrameLayout->addWidget( mDateNavigator ); 466 //leftFrameLayout->addWidget( mDateNavigator );
467 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 467 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
468 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 468 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
469 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 469 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
470 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); 470 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
471 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); 471 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
472 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) ); 472 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) );
473 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); 473 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
474 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); 474 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) );
475 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); 475 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
476 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); 476 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
477 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); 477 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
478 connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() )); 478 connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() ));
479 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); 479 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
480 480
481 mTodoList->setNavigator( mNavigator ); 481 mTodoList->setNavigator( mNavigator );
482#if 0 482#if 0
483 if ( QApplication::desktop()->width() < 480 ) { 483 if ( QApplication::desktop()->width() < 480 ) {
484 leftFrameLayout->addWidget(mFilterView); 484 leftFrameLayout->addWidget(mFilterView);
485 leftFrameLayout->addWidget(mTodoList, 2 ); 485 leftFrameLayout->addWidget(mTodoList, 2 );
486 486
487 } else { 487 } else {
488 leftFrameLayout->addWidget(mTodoList,2 ); 488 leftFrameLayout->addWidget(mTodoList,2 );
489 leftFrameLayout->addWidget(mFilterView ); 489 leftFrameLayout->addWidget(mFilterView );
490 } 490 }
491#endif 491#endif
492 mFilterView->hide(); 492 mFilterView->hide();
493 mCalEditView->hide(); 493 mCalEditView->hide();
494 QWidget *rightBox = new QWidget( mMainFrame ); 494 QWidget *rightBox = new QWidget( mMainFrame );
495 //mainBoxLayout->addWidget ( rightBox, 10 ); 495 //mainBoxLayout->addWidget ( rightBox, 10 );
496 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 496 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
497 mRightFrame = new QWidgetStack( rightBox ); 497 mRightFrame = new QWidgetStack( rightBox );
498 rightLayout->addWidget( mRightFrame, 10 ); 498 rightLayout->addWidget( mRightFrame, 10 );
499 499
500 //mLeftFrame = (QWidget *)leftFrame; 500 //mLeftFrame = (QWidget *)leftFrame;
501 if ( KOPrefs::instance()->mVerticalScreen ) { 501 if ( KOPrefs::instance()->mVerticalScreen ) {
502 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 502 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
503 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 503 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
504 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 504 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
505 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 505 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
506 } else { 506 } else {
507 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 507 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
508 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 508 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
509 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 509 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
510 } 510 }
511 if ( !KOPrefs::instance()->mShowDateNavigator) 511 if ( !KOPrefs::instance()->mShowDateNavigator)
512 mDateNavigator->hide(); 512 mDateNavigator->hide();
513 //qDebug("Calendarview Size %d %d ", width(), height()); 513 //qDebug("Calendarview Size %d %d ", width(), height());
514#endif 514#endif
515 515
516 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 516 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
517 SLOT( showDates( const KCal::DateList & ) ) ); 517 SLOT( showDates( const KCal::DateList & ) ) );
518 518
519 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 519 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
520 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 520 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
521 521
522 522
523 523
524 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 524 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
525 mViewManager, SLOT( showMonth( const QDate & ) ) ); 525 mViewManager, SLOT( showMonth( const QDate & ) ) );
526 526
527 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 527 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
528 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 528 mNavigator, SLOT( selectWeek( const QDate & ) ) );
529 529
530 connect( mDateNavigator, SIGNAL( goPrevYear() ), 530 connect( mDateNavigator, SIGNAL( goPrevYear() ),
531 mNavigator, SLOT( selectPreviousYear() ) ); 531 mNavigator, SLOT( selectPreviousYear() ) );
532 connect( mDateNavigator, SIGNAL( goNextYear() ), 532 connect( mDateNavigator, SIGNAL( goNextYear() ),
533 mNavigator, SLOT( selectNextYear() ) ); 533 mNavigator, SLOT( selectNextYear() ) );
534 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 534 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
535 mNavigator, SLOT( selectPreviousMonth() ) ); 535 mNavigator, SLOT( selectPreviousMonth() ) );
536 connect( mDateNavigator, SIGNAL( goNextMonth() ), 536 connect( mDateNavigator, SIGNAL( goNextMonth() ),
537 mNavigator, SLOT( selectNextMonth() ) ); 537 mNavigator, SLOT( selectNextMonth() ) );
538 538
539 connect( mDateNavigator, SIGNAL( goPrevious() ), 539 connect( mDateNavigator, SIGNAL( goPrevious() ),
540 mNavigator, SLOT( selectPrevious() ) ); 540 mNavigator, SLOT( selectPrevious() ) );
541 connect( mDateNavigator, SIGNAL( goNext() ), 541 connect( mDateNavigator, SIGNAL( goNext() ),
542 mNavigator, SLOT( selectNext() ) ); 542 mNavigator, SLOT( selectNext() ) );
543 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 543 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
544 mNavigator, SLOT( slotMonthSelect( int ) ) ); 544 mNavigator, SLOT( slotMonthSelect( int ) ) );
545 545
546 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 546 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
547 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 547 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
548#if 0 548#if 0
549 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 549 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
550 SLOT( incidenceAdded( Incidence *) ) ); 550 SLOT( incidenceAdded( Incidence *) ) );
551#endif 551#endif
552 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 552 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
553 553
554 connect( this, SIGNAL( configChanged() ), 554 connect( this, SIGNAL( configChanged() ),
555 mDateNavigator, SLOT( updateConfig() ) ); 555 mDateNavigator, SLOT( updateConfig() ) );
556 556
557 connect( mTodoList, SIGNAL( newTodoSignal() ), 557 connect( mTodoList, SIGNAL( newTodoSignal() ),
558 SLOT( newTodo() ) ); 558 SLOT( newTodo() ) );
559 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 559 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
560 SLOT( newSubTodo( Todo * ) ) ); 560 SLOT( newSubTodo( Todo * ) ) );
561 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 561 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
562 SLOT( editTodo( Todo * ) ) ); 562 SLOT( editTodo( Todo * ) ) );
563 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 563 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
564 SLOT( showTodo( Todo *) ) ); 564 SLOT( showTodo( Todo *) ) );
565 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 565 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
566 SLOT( deleteTodo( Todo *) ) ); 566 SLOT( deleteTodo( Todo *) ) );
567 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 567 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
568 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 568 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
569 SLOT( purgeCompleted() ) ); 569 SLOT( purgeCompleted() ) );
570 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 570 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
571 SIGNAL( todoModified( Todo *, int ) ) ); 571 SIGNAL( todoModified( Todo *, int ) ) );
572 572
573 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 573 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
574 this, SLOT ( cloneIncidence( Incidence * ) ) ); 574 this, SLOT ( cloneIncidence( Incidence * ) ) );
575 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 575 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
576 this, SLOT (cancelIncidence( Incidence * ) ) ); 576 this, SLOT (cancelIncidence( Incidence * ) ) );
577 577
578 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 578 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
579 this, SLOT ( moveIncidence( Incidence * ) ) ); 579 this, SLOT ( moveIncidence( Incidence * ) ) );
580 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 580 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
581 this, SLOT ( beamIncidence( Incidence * ) ) ); 581 this, SLOT ( beamIncidence( Incidence * ) ) );
582 582
583 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 583 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
584 this, SLOT ( todo_unsub( Todo * ) ) ); 584 this, SLOT ( todo_unsub( Todo * ) ) );
585 585
586 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 586 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
587 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 587 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
588 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 588 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
589 SLOT( updateTodo( Todo *, int ) ) ); 589 SLOT( updateTodo( Todo *, int ) ) );
590 connect( this, SIGNAL( todoModified( Todo *, int )), this, 590 connect( this, SIGNAL( todoModified( Todo *, int )), this,
591 SLOT( changeTodoDisplay( Todo *, int ) ) ); 591 SLOT( changeTodoDisplay( Todo *, int ) ) );
592 592
593 593
594 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 594 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
595 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 595 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
596 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 596 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
597 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 597 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
598 598
599 599
600 600
601 601
602 602
603 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 603 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
604 SLOT(checkClipboard())); 604 SLOT(checkClipboard()));
605 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 605 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
606 SLOT( processTodoListSelection( Incidence * ) ) ); 606 SLOT( processTodoListSelection( Incidence * ) ) );
607 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 607 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
608 608
609 // kdDebug() << "CalendarView::CalendarView() done" << endl; 609 // kdDebug() << "CalendarView::CalendarView() done" << endl;
610 610
611 mDateFrame = new QVBox(0,0,WType_Popup); 611 mDateFrame = new QVBox(0,0,WType_Popup);
612 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 612 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
613 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 613 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
614 mDateFrame->setLineWidth(3); 614 mDateFrame->setLineWidth(3);
615 mDateFrame->hide(); 615 mDateFrame->hide();
616 mDateFrame->setCaption( i18n( "Pick a date to display")); 616 mDateFrame->setCaption( i18n( "Pick a date to display"));
617 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 617 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
618 618
619 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 619 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
620 620
621 mEventEditor = mDialogManager->getEventEditor(); 621 mEventEditor = mDialogManager->getEventEditor();
622 mTodoEditor = mDialogManager->getTodoEditor(); 622 mTodoEditor = mDialogManager->getTodoEditor();
623 623
624 mFlagEditDescription = false; 624 mFlagEditDescription = false;
625 625
626 mSuspendTimer = new QTimer( this ); 626 mSuspendTimer = new QTimer( this );
627 mAlarmTimer = new QTimer( this ); 627 mAlarmTimer = new QTimer( this );
628 mRecheckAlarmTimer = new QTimer( this ); 628 mRecheckAlarmTimer = new QTimer( this );
629 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 629 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
630 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 630 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
631 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 631 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
632 mAlarmDialog = new AlarmDialog( this ); 632 mAlarmDialog = new AlarmDialog( this );
633 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 633 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
634 mAlarmDialog->setServerNotification( false ); 634 mAlarmDialog->setServerNotification( false );
635 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 635 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
636 636
637 637
638#ifndef DESKTOP_VERSION 638#ifndef DESKTOP_VERSION
639//US listen for arriving address resultsets 639//US listen for arriving address resultsets
640 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 640 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
641 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 641 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
642#endif 642#endif
643 mDateNavigator->setCalendar( mCalendar ); 643 mDateNavigator->setCalendar( mCalendar );
644} 644}
645 645
646 646
647CalendarView::~CalendarView() 647CalendarView::~CalendarView()
648{ 648{
649 // kdDebug() << "~CalendarView()" << endl; 649 // kdDebug() << "~CalendarView()" << endl;
650 //qDebug("CalendarView::~CalendarView() "); 650 //qDebug("CalendarView::~CalendarView() ");
651 delete mDialogManager; 651 delete mDialogManager;
652 delete mViewManager; 652 delete mViewManager;
653 delete mStorage; 653 delete mStorage;
654 delete mDateFrame ; 654 delete mDateFrame ;
655 delete mEventViewerDialog; 655 delete mEventViewerDialog;
656 //kdDebug() << "~CalendarView() done" << endl; 656 //kdDebug() << "~CalendarView() done" << endl;
657} 657}
658void CalendarView::nextConflict( bool all, bool allday ) 658void CalendarView::nextConflict( bool all, bool allday )
659{ 659{
660 660
661 QPtrList<Event> testlist = mCalendar->events(); 661 QPtrList<Event> testlist = mCalendar->events();
662 Event * test = testlist.first(); 662 Event * test = testlist.first();
663 while ( test ) { 663 while ( test ) {
664 test->setTagged( false ); 664 test->setTagged( false );
665 test = testlist.next(); 665 test = testlist.next();
666 } 666 }
667 QTime st ( 0,0,0); 667 QTime st ( 0,0,0);
668 if ( mViewManager->currentView() == mViewManager->agendaView() ) 668 if ( mViewManager->currentView() == mViewManager->agendaView() )
669 st = mViewManager->agendaView()->agenda()->getEndTime(); 669 st = mViewManager->agendaView()->agenda()->getEndTime();
670 //qDebug("time %s ", st.toString().latin1()); 670 //qDebug("time %s ", st.toString().latin1());
671 QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); 671 QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st);
672 QDateTime conflict; 672 QDateTime conflict;
673 QDateTime retVal; 673 QDateTime retVal;
674 bool found = false; 674 bool found = false;
675 Event * cE = 0; 675 Event * cE = 0;
676 Event * cE2 = 0; 676 Event * cE2 = 0;
677 QPtrList<Event> testlist2 = testlist; 677 QPtrList<Event> testlist2 = testlist;
678 test = testlist.first(); 678 test = testlist.first();
679 bool skip = false; 679 bool skip = false;
680 while ( test ) { 680 while ( test ) {
681 skip = false; 681 skip = false;
682 if ( !all ) skip = ( allday != test->doesFloat() ); 682 if ( !all ) skip = ( allday != test->doesFloat() );
683 if ( !skip ) { 683 if ( !skip ) {
684 Event * test2 = testlist2.first(); 684 Event * test2 = testlist2.first();
685 while ( test2 ) { 685 while ( test2 ) {
686 skip = false; 686 skip = false;
687 if ( !all ) skip = ( allday != test2->doesFloat() ); 687 if ( !all ) skip = ( allday != test2->doesFloat() );
688 if ( !skip ) { 688 if ( !skip ) {
689 if ( !test2->isTagged() ) { 689 if ( !test2->isTagged() ) {
690 if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { 690 if ( test->isOverlapping ( test2, &retVal, &startDT ) ) {
691 //qDebug("overlap "); 691 //qDebug("overlap ");
692 if ( ! found ) { 692 if ( ! found ) {
693 if ( retVal >= startDT ) { 693 if ( retVal >= startDT ) {
694 conflict = retVal; 694 conflict = retVal;
695 cE = test; 695 cE = test;
696 cE2 = test2; 696 cE2 = test2;
697 found = true; 697 found = true;
698 } 698 }
699 } else { 699 } else {
700 if ( retVal >= startDT && retVal < conflict ) { 700 if ( retVal >= startDT && retVal < conflict ) {
701 conflict = retVal; 701 conflict = retVal;
702 cE = test; 702 cE = test;
703 cE2 = test2; 703 cE2 = test2;
704 } 704 }
705 } 705 }
706 } 706 }
707 } 707 }
708 } 708 }
709 test2 = testlist2.next(); 709 test2 = testlist2.next();
710 } 710 }
711 } 711 }
712 test->setTagged( true ); 712 test->setTagged( true );
713 test = testlist.next(); 713 test = testlist.next();
714 } 714 }
715 if ( found ) { 715 if ( found ) {
716 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) 716 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
717 mViewManager->showDayView(); 717 mViewManager->showDayView();
718 mNavigator->slotDaySelect( conflict.date() ); 718 mNavigator->slotDaySelect( conflict.date() );
719 int hour = conflict.time().hour(); 719 int hour = conflict.time().hour();
720 mViewManager->agendaView()->setStartHour( hour ); 720 mViewManager->agendaView()->setStartHour( hour );
721 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); 721 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) );
722 return; 722 return;
723 } 723 }
724 724
725 topLevelWidget()->setCaption( i18n("No conflict found") ); 725 topLevelWidget()->setCaption( i18n("No conflict found") );
726 qDebug("No conflict found "); 726 qDebug("No conflict found ");
727 return; 727 return;
728} 728}
729 729
730void CalendarView::conflictAll() 730void CalendarView::conflictAll()
731{ 731{
732 nextConflict ( true, true ); 732 nextConflict ( true, true );
733} 733}
734void CalendarView::conflictAllday() 734void CalendarView::conflictAllday()
735{ 735{
736 nextConflict ( false, true ); 736 nextConflict ( false, true );
737} 737}
738void CalendarView::conflictNotAll() 738void CalendarView::conflictNotAll()
739{ 739{
740 nextConflict ( false, false ); 740 nextConflict ( false, false );
741} 741}
742 742
743void CalendarView::setCalReadOnly( int id, bool readO ) 743void CalendarView::setCalReadOnly( int id, bool readO )
744{ 744{
745 if ( readO ) { 745 if ( readO ) {
746 emit save(); 746 emit save();
747 } 747 }
748 mCalendar->setReadOnly( id, readO ); 748 mCalendar->setReadOnly( id, readO );
749} 749}
750void CalendarView::setScrollBarStep(int val ) 750void CalendarView::setScrollBarStep(int val )
751{ 751{
752#ifdef DESKTOP_VERSION 752#ifdef DESKTOP_VERSION
753 mDateScrollBar->setLineStep ( val ); 753 mDateScrollBar->setLineStep ( val );
754#endif 754#endif
@@ -4306,515 +4306,515 @@ QPtrList<CalFilter> CalendarView::filters()
4306 return mFilters; 4306 return mFilters;
4307 4307
4308} 4308}
4309void CalendarView::editFilters() 4309void CalendarView::editFilters()
4310{ 4310{
4311 // kdDebug() << "CalendarView::editFilters()" << endl; 4311 // kdDebug() << "CalendarView::editFilters()" << endl;
4312 4312
4313 CalFilter *filter = mFilters.first(); 4313 CalFilter *filter = mFilters.first();
4314 while(filter) { 4314 while(filter) {
4315 filter = mFilters.next(); 4315 filter = mFilters.next();
4316 } 4316 }
4317 4317
4318 mDialogManager->showFilterEditDialog(&mFilters); 4318 mDialogManager->showFilterEditDialog(&mFilters);
4319 updateFilter(); 4319 updateFilter();
4320} 4320}
4321void CalendarView::toggleFilter() 4321void CalendarView::toggleFilter()
4322{ 4322{
4323 if ( mLeftFrame->isHidden() ) { 4323 if ( mLeftFrame->isHidden() ) {
4324 toggleExpand(); 4324 toggleExpand();
4325 showFilter( true ); 4325 showFilter( true );
4326 } else 4326 } else
4327 showFilter(! mCalEditView->isVisible()); 4327 showFilter(! mCalEditView->isVisible());
4328} 4328}
4329 4329
4330KOFilterView *CalendarView::filterView() 4330KOFilterView *CalendarView::filterView()
4331{ 4331{
4332 return mFilterView; 4332 return mFilterView;
4333} 4333}
4334void CalendarView::selectFilter( int fil ) 4334void CalendarView::selectFilter( int fil )
4335{ 4335{
4336 mFilterView->setSelectedFilter( fil ); 4336 mFilterView->setSelectedFilter( fil );
4337 updateUnmanagedViews(); 4337 updateUnmanagedViews();
4338} 4338}
4339void CalendarView::showFilter(bool visible) 4339void CalendarView::showFilter(bool visible)
4340{ 4340{
4341#if 1 4341#if 1
4342 if (visible) { 4342 if (visible) {
4343 mCalEditView->readConfig(); 4343 mCalEditView->readConfig();
4344 mCalEditView->show(); 4344 mCalEditView->show();
4345 QValueList<int> sizes; 4345 QValueList<int> sizes;
4346 sizes = mLeftFrame->sizes(); 4346 sizes = mLeftFrame->sizes();
4347 if ( sizes.count() == 4 && sizes[3] < 20 ) { 4347 if ( sizes.count() == 4 && sizes[3] < 20 ) {
4348 sizes.clear(); 4348 sizes.clear();
4349 sizes << 100; 4349 sizes << 100;
4350 sizes << 0; 4350 sizes << 0;
4351 sizes << 0; 4351 sizes << 0;
4352 sizes << 100; 4352 sizes << 100;
4353 mLeftFrame->setSizes(sizes); 4353 mLeftFrame->setSizes(sizes);
4354 } 4354 }
4355#if 0 4355#if 0
4356 sizes = mLeftFrame->sizes(); 4356 sizes = mLeftFrame->sizes();
4357 int ccc = 0; 4357 int ccc = 0;
4358 while ( ccc < sizes.count()) { 4358 while ( ccc < sizes.count()) {
4359 qDebug("size %d %d ", ccc, sizes[ccc]); 4359 qDebug("size %d %d ", ccc, sizes[ccc]);
4360 ++ccc; 4360 ++ccc;
4361 } 4361 }
4362#endif 4362#endif
4363 4363
4364 } 4364 }
4365 else { 4365 else {
4366 mCalEditView->hide(); 4366 mCalEditView->hide();
4367 } 4367 }
4368#else 4368#else
4369 if (visible) mFilterView->show(); 4369 if (visible) mFilterView->show();
4370 else mFilterView->hide(); 4370 else mFilterView->hide();
4371#endif 4371#endif
4372} 4372}
4373void CalendarView::toggleFilerEnabled( ) 4373void CalendarView::toggleFilerEnabled( )
4374{ 4374{
4375 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 4375 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
4376 if ( !mFilterView->filtersEnabled() ) 4376 if ( !mFilterView->filtersEnabled() )
4377 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 4377 topLevelWidget()->setCaption( i18n("Filter disabled ") );
4378 updateUnmanagedViews(); 4378 updateUnmanagedViews();
4379 4379
4380} 4380}
4381void CalendarView::updateFilter() 4381void CalendarView::updateFilter()
4382{ 4382{
4383 CalFilter *filter = mFilterView->selectedFilter(); 4383 CalFilter *filter = mFilterView->selectedFilter();
4384 if (filter) { 4384 if (filter) {
4385 QString mess; 4385 QString mess;
4386 if (mFilterView->filtersEnabled()) { 4386 if (mFilterView->filtersEnabled()) {
4387 mess = i18n("Filter selected: ")+filter->name(); 4387 mess = i18n("Filter selected: ")+filter->name();
4388 filter->setEnabled(true); 4388 filter->setEnabled(true);
4389 } 4389 }
4390 else filter->setEnabled(false); 4390 else filter->setEnabled(false);
4391 mCalendar->setFilter(filter); 4391 mCalendar->setFilter(filter);
4392 updateView(); 4392 updateView();
4393 if ( !mess.isEmpty() ) 4393 if ( !mess.isEmpty() )
4394 topLevelWidget()->setCaption( mess ); 4394 topLevelWidget()->setCaption( mess );
4395 4395
4396 } 4396 }
4397 emit filtersUpdated(); 4397 emit filtersUpdated();
4398} 4398}
4399 4399
4400void CalendarView::filterEdited() 4400void CalendarView::filterEdited()
4401{ 4401{
4402 mFilterView->updateFilters(); 4402 mFilterView->updateFilters();
4403 updateFilter(); 4403 updateFilter();
4404 writeSettings(); 4404 writeSettings();
4405} 4405}
4406 4406
4407 4407
4408void CalendarView::takeOverEvent() 4408void CalendarView::takeOverEvent()
4409{ 4409{
4410 Incidence *incidence = currentSelection(); 4410 Incidence *incidence = currentSelection();
4411 4411
4412 if (!incidence) return; 4412 if (!incidence) return;
4413 4413
4414 incidence->setOrganizer(KOPrefs::instance()->email()); 4414 incidence->setOrganizer(KOPrefs::instance()->email());
4415 incidence->recreate(); 4415 incidence->recreate();
4416 incidence->setReadOnly(false); 4416 incidence->setReadOnly(false);
4417 4417
4418 updateView(); 4418 updateView();
4419} 4419}
4420 4420
4421void CalendarView::takeOverCalendar() 4421void CalendarView::takeOverCalendar()
4422{ 4422{
4423 // TODO: Create Calendar::allIncidences() function and use it here 4423 // TODO: Create Calendar::allIncidences() function and use it here
4424 4424
4425 clearAllViews(); 4425 clearAllViews();
4426 QPtrList<Event> events = mCalendar->events(); 4426 QPtrList<Event> events = mCalendar->events();
4427 for(uint i=0; i<events.count(); ++i) { 4427 for(uint i=0; i<events.count(); ++i) {
4428 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 4428 events.at(i)->setOrganizer(KOPrefs::instance()->email());
4429 events.at(i)->recreate(); 4429 events.at(i)->recreate();
4430 events.at(i)->setReadOnly(false); 4430 events.at(i)->setReadOnly(false);
4431 } 4431 }
4432 4432
4433 QPtrList<Todo> todos = mCalendar->todos(); 4433 QPtrList<Todo> todos = mCalendar->todos();
4434 for(uint i=0; i<todos.count(); ++i) { 4434 for(uint i=0; i<todos.count(); ++i) {
4435 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 4435 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
4436 todos.at(i)->recreate(); 4436 todos.at(i)->recreate();
4437 todos.at(i)->setReadOnly(false); 4437 todos.at(i)->setReadOnly(false);
4438 } 4438 }
4439 4439
4440 QPtrList<Journal> journals = mCalendar->journals(); 4440 QPtrList<Journal> journals = mCalendar->journals();
4441 for(uint i=0; i<journals.count(); ++i) { 4441 for(uint i=0; i<journals.count(); ++i) {
4442 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 4442 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
4443 journals.at(i)->recreate(); 4443 journals.at(i)->recreate();
4444 journals.at(i)->setReadOnly(false); 4444 journals.at(i)->setReadOnly(false);
4445 } 4445 }
4446 4446
4447 updateView(); 4447 updateView();
4448} 4448}
4449 4449
4450void CalendarView::showIntro() 4450void CalendarView::showIntro()
4451{ 4451{
4452 kdDebug() << "To be implemented." << endl; 4452 kdDebug() << "To be implemented." << endl;
4453} 4453}
4454 4454
4455QWidgetStack *CalendarView::viewStack() 4455QWidgetStack *CalendarView::viewStack()
4456{ 4456{
4457 return mRightFrame; 4457 return mRightFrame;
4458} 4458}
4459 4459
4460QWidget *CalendarView::leftFrame() 4460QWidget *CalendarView::leftFrame()
4461{ 4461{
4462 return ( QWidget *)mLeftFrame; 4462 return ( QWidget *)mLeftFrame;
4463} 4463}
4464 4464
4465DateNavigator *CalendarView::dateNavigator() 4465DateNavigator *CalendarView::dateNavigator()
4466{ 4466{
4467 return mNavigator; 4467 return mNavigator;
4468} 4468}
4469 4469
4470KDateNavigator* CalendarView::dateNavigatorWidget() 4470KDateNavigator* CalendarView::dateNavigatorWidget()
4471{ 4471{
4472 return mDateNavigator->navigatorView(); 4472 return mDateNavigator->navigatorView();
4473} 4473}
4474void CalendarView::toggleDateNavigatorWidget() 4474void CalendarView::toggleDateNavigatorWidget()
4475{ 4475{
4476 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 4476 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
4477 4477
4478 if (!KOPrefs::instance()->mShowDateNavigator ) 4478 if (!KOPrefs::instance()->mShowDateNavigator )
4479 mDateNavigator->hide(); 4479 mDateNavigator->hide();
4480 else 4480 else
4481 mDateNavigator->show(); 4481 mDateNavigator->show();
4482} 4482}
4483void CalendarView::addView(KOrg::BaseView *view) 4483void CalendarView::addView(KOrg::BaseView *view)
4484{ 4484{
4485 mViewManager->addView(view); 4485 mViewManager->addView(view);
4486} 4486}
4487 4487
4488void CalendarView::showView(KOrg::BaseView *view) 4488void CalendarView::showView(KOrg::BaseView *view)
4489{ 4489{
4490 mViewManager->showView(view, mLeftFrame->isVisible()); 4490 mViewManager->showView(view, mLeftFrame->isVisible());
4491} 4491}
4492 4492
4493Incidence *CalendarView::currentSelection() 4493Incidence *CalendarView::currentSelection()
4494{ 4494{
4495 return mViewManager->currentSelection(); 4495 return mViewManager->currentSelection();
4496} 4496}
4497void CalendarView::toggleAllDaySize() 4497void CalendarView::toggleAllDaySize()
4498{ 4498{
4499 /* 4499 /*
4500 if ( KOPrefs::instance()->mAllDaySize > 47 ) 4500 if ( KOPrefs::instance()->mAllDaySize > 47 )
4501 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 4501 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
4502 else 4502 else
4503 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 4503 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
4504 */ 4504 */
4505 viewManager()->agendaView()->toggleAllDay(); 4505 viewManager()->agendaView()->toggleAllDay();
4506} 4506}
4507void CalendarView::toggleExpand() 4507void CalendarView::toggleExpand()
4508{ 4508{
4509 // if ( mLeftFrame->isHidden() ) { 4509 // if ( mLeftFrame->isHidden() ) {
4510 // mLeftFrame->show(); 4510 // mLeftFrame->show();
4511 // emit calendarViewExpanded( false ); 4511 // emit calendarViewExpanded( false );
4512 // } else { 4512 // } else {
4513 // mLeftFrame->hide(); 4513 // mLeftFrame->hide();
4514 // emit calendarViewExpanded( true ); 4514 // emit calendarViewExpanded( true );
4515 // } 4515 // }
4516 //qDebug(" CalendarView::toggleExpand()"); 4516 //qDebug(" CalendarView::toggleExpand()");
4517 globalFlagBlockAgenda = 1; 4517 globalFlagBlockAgenda = 1;
4518 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 4518 emit calendarViewExpanded( !mLeftFrame->isHidden() );
4519 globalFlagBlockAgenda = 5; 4519 globalFlagBlockAgenda = 5;
4520 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 4520 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
4521 //mViewManager->showView( 0, true ); 4521 //mViewManager->showView( 0, true );
4522} 4522}
4523 4523
4524void CalendarView::calendarModified( bool modified, Calendar * ) 4524void CalendarView::calendarModified( bool modified, Calendar * )
4525{ 4525{
4526 setModified( modified ); 4526 setModified( modified );
4527} 4527}
4528 4528
4529Todo *CalendarView::selectedTodo() 4529Todo *CalendarView::selectedTodo()
4530{ 4530{
4531 Incidence *incidence = currentSelection(); 4531 Incidence *incidence = currentSelection();
4532 if ( incidence && incidence->typeID() == todoID ) { 4532 if ( incidence && incidence->typeID() == todoID ) {
4533 return static_cast<Todo *>( incidence ); 4533 return static_cast<Todo *>( incidence );
4534 } 4534 }
4535 4535
4536 incidence = mTodoList->selectedIncidences().first(); 4536 incidence = mTodoList->selectedIncidences().first();
4537 if ( incidence && incidence->typeID() == todoID ) { 4537 if ( incidence && incidence->typeID() == todoID ) {
4538 return static_cast<Todo *>( incidence ); 4538 return static_cast<Todo *>( incidence );
4539 } 4539 }
4540 4540
4541 return 0; 4541 return 0;
4542} 4542}
4543 4543
4544void CalendarView::showIncidence() 4544void CalendarView::showIncidence()
4545{ 4545{
4546 mViewerCallerIsSearchDialog = false; 4546 mViewerCallerIsSearchDialog = false;
4547 Incidence *incidence = currentSelection(); 4547 Incidence *incidence = currentSelection();
4548 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4548 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4549 if ( incidence ) { 4549 if ( incidence ) {
4550 ShowIncidenceVisitor v; 4550 ShowIncidenceVisitor v;
4551 v.act( incidence, this ); 4551 v.act( incidence, this );
4552 } 4552 }
4553} 4553}
4554void CalendarView::editIncidenceDescription() 4554void CalendarView::editIncidenceDescription()
4555{ 4555{
4556 mFlagEditDescription = true; 4556 mFlagEditDescription = true;
4557 editIncidence(); 4557 editIncidence();
4558 mFlagEditDescription = false; 4558 mFlagEditDescription = false;
4559} 4559}
4560void CalendarView::editIncidence() 4560void CalendarView::editIncidence()
4561{ 4561{
4562 // qDebug("editIncidence() "); 4562 // qDebug("editIncidence() ");
4563 Incidence *incidence = currentSelection(); 4563 Incidence *incidence = currentSelection();
4564 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4564 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4565 if ( incidence ) { 4565 if ( incidence ) {
4566 EditIncidenceVisitor v; 4566 EditIncidenceVisitor v;
4567 v.act( incidence, this ); 4567 v.act( incidence, this );
4568 } 4568 }
4569} 4569}
4570 4570
4571void CalendarView::deleteIncidence() 4571void CalendarView::deleteIncidence()
4572{ 4572{
4573 Incidence *incidence = currentSelection(); 4573 Incidence *incidence = currentSelection();
4574 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4574 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4575 if ( incidence ) { 4575 if ( incidence ) {
4576 deleteIncidence(incidence); 4576 deleteIncidence(incidence);
4577 } 4577 }
4578} 4578}
4579void CalendarView::showIncidence(QString uid) 4579void CalendarView::showIncidence(QString uid)
4580{ 4580{
4581 Incidence *inc = mCalendar->incidence( uid ); 4581 Incidence *inc = mCalendar->incidence( uid );
4582 if ( inc ) 4582 if ( inc )
4583 showIncidence( inc ); 4583 showIncidence( inc );
4584} 4584}
4585void CalendarView::showIncidence(Incidence *incidence) 4585void CalendarView::showIncidence(Incidence *incidence)
4586{ 4586{
4587 mViewerCallerIsSearchDialog = false; 4587 mViewerCallerIsSearchDialog = false;
4588 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); 4588 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() );
4589 if ( sender() && mDialogManager->getSearchDialog() ) { 4589 if ( sender() && mDialogManager->getSearchDialog() ) {
4590 if ( sender () == mDialogManager->getSearchDialog()->listview() ) { 4590 if ( sender () == mDialogManager->getSearchDialog()->listview() ) {
4591 mViewerCallerIsSearchDialog = true; 4591 mViewerCallerIsSearchDialog = true;
4592 } 4592 }
4593 } 4593 }
4594 if ( incidence ) { 4594 if ( incidence ) {
4595 ShowIncidenceVisitor v; 4595 ShowIncidenceVisitor v;
4596 v.act( incidence, this ); 4596 v.act( incidence, this );
4597 } 4597 }
4598} 4598}
4599 4599
4600void CalendarView::editIncidence(Incidence *incidence) 4600void CalendarView::editIncidence(Incidence *incidence)
4601{ 4601{
4602 if ( incidence ) { 4602 if ( incidence ) {
4603 4603
4604 EditIncidenceVisitor v; 4604 EditIncidenceVisitor v;
4605 v.act( incidence, this ); 4605 v.act( incidence, this );
4606 4606
4607 } 4607 }
4608} 4608}
4609 4609
4610void CalendarView::deleteIncidence(Incidence *incidence) 4610void CalendarView::deleteIncidence(Incidence *incidence)
4611{ 4611{
4612 //qDebug(" CalendarView::deleteIncidence "); 4612 //qDebug(" CalendarView::deleteIncidence ");
4613 if ( incidence == 0 ) { 4613 if ( incidence == 0 ) {
4614 updateView(); 4614 updateView();
4615 emit updateSearchDialog(); 4615 emit updateSearchDialog();
4616 return; 4616 return;
4617 } 4617 }
4618 if ( incidence ) { 4618 if ( incidence ) {
4619 DeleteIncidenceVisitor v; 4619 DeleteIncidenceVisitor v;
4620 v.act( incidence, this ); 4620 v.act( incidence, this );
4621 } 4621 }
4622} 4622}
4623 4623
4624 4624
4625void CalendarView::lookForOutgoingMessages() 4625void CalendarView::lookForOutgoingMessages()
4626{ 4626{
4627 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 4627 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
4628 ogd->loadMessages(); 4628 ogd->loadMessages();
4629} 4629}
4630 4630
4631void CalendarView::lookForIncomingMessages() 4631void CalendarView::lookForIncomingMessages()
4632{ 4632{
4633 IncomingDialog *icd = mDialogManager->incomingDialog(); 4633 IncomingDialog *icd = mDialogManager->incomingDialog();
4634 icd->retrieve(); 4634 icd->retrieve();
4635} 4635}
4636 4636
4637bool CalendarView::removeCompletedSubTodos( Todo* t ) 4637bool CalendarView::removeCompletedSubTodos( Todo* t )
4638{ 4638{
4639 bool deleteTodo = true; 4639 bool deleteTodo = true;
4640 QPtrList<Incidence> subTodos; 4640 QPtrList<Incidence> subTodos;
4641 Incidence *aTodo; 4641 Incidence *aTodo;
4642 subTodos = t->relations(); 4642 subTodos = t->relations();
4643 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 4643 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
4644 if (! removeCompletedSubTodos( (Todo*) aTodo )) 4644 if (! removeCompletedSubTodos( (Todo*) aTodo ))
4645 deleteTodo = false; 4645 deleteTodo = false;
4646 } 4646 }
4647 if ( deleteTodo ) { 4647 if ( deleteTodo ) {
4648 if ( t->isCompleted() && !t->doesRecur()) { 4648 if ( t->isCompleted() && !t->doesRecur()) {
4649 checkExternalId( t ); 4649 checkExternalId( t );
4650 mCalendar->deleteTodo( t ); 4650 mCalendar->deleteTodo( t );
4651 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 4651 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
4652 } 4652 }
4653 else 4653 else
4654 deleteTodo = false; 4654 deleteTodo = false;
4655 } 4655 }
4656 return deleteTodo; 4656 return deleteTodo;
4657 4657
4658} 4658}
4659void CalendarView::purgeCompleted() 4659void CalendarView::purgeCompleted()
4660{ 4660{
4661 int result = KMessageBox::warningContinueCancel(this, 4661 int result = KMessageBox::warningContinueCancel(this,
4662 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); 4662 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge"));
4663 4663
4664 if (result == KMessageBox::Continue) { 4664 if (result == KMessageBox::Continue) {
4665 4665
4666 QPtrList<Todo> todoCal; 4666 QPtrList<Todo> todoCal;
4667 QPtrList<Todo> rootTodos; 4667 QPtrList<Todo> rootTodos;
4668 //QPtrList<Incidence> rel; 4668 //QPtrList<Incidence> rel;
4669 Todo *aTodo; 4669 Todo *aTodo;
4670 todoCal = calendar()->todos(); 4670 todoCal = calendar()->todos();
4671 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 4671 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
4672 if ( !aTodo->relatedTo() ) 4672 if ( !aTodo->relatedTo() )
4673 rootTodos.append( aTodo ); 4673 rootTodos.append( aTodo );
4674 } 4674 }
4675 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 4675 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
4676 removeCompletedSubTodos( aTodo ); 4676 removeCompletedSubTodos( aTodo );
4677 } 4677 }
4678 4678
4679 updateView(); 4679 updateView();
4680 } 4680 }
4681} 4681}
4682 4682
4683void CalendarView::slotCalendarChanged() 4683void CalendarView::slotCalendarChanged()
4684{ 4684{
4685 ; 4685 ;
4686} 4686}
4687 4687
4688void CalendarView::keyPressEvent ( QKeyEvent *e) 4688void CalendarView::keyPressEvent ( QKeyEvent *e)
4689{ 4689{
4690 //qDebug(" alendarView::keyPressEvent "); 4690 //qDebug("CalendarView::keyPressEvent ");
4691 e->ignore(); 4691 e->ignore();
4692} 4692}
4693 4693
4694 4694
4695bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 4695bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
4696{ 4696{
4697 4697
4698 if ( manager != mSyncManager) 4698 if ( manager != mSyncManager)
4699 qDebug("KO: Internal error-1. SyncManager mismatch "); 4699 qDebug("KO: Internal error-1. SyncManager mismatch ");
4700 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 4700 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
4701 qDebug("KO: SyncKDE request detected!"); 4701 qDebug("KO: SyncKDE request detected!");
4702 } 4702 }
4703 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4703 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4704 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4704 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4705 return syncCalendar( filename, mode ); 4705 return syncCalendar( filename, mode );
4706} 4706}
4707bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 4707bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
4708{ 4708{
4709 //mSyncManager = manager; 4709 //mSyncManager = manager;
4710 if ( manager != mSyncManager) 4710 if ( manager != mSyncManager)
4711 qDebug("KO: Internal error-2. SyncManager mismatch "); 4711 qDebug("KO: Internal error-2. SyncManager mismatch ");
4712 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4712 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4713 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4713 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4714 if ( resource == "sharp" ) 4714 if ( resource == "sharp" )
4715 syncExternal( 0 ); 4715 syncExternal( 0 );
4716 if ( resource == "phone" ) 4716 if ( resource == "phone" )
4717 syncExternal( 1 ); 4717 syncExternal( 1 );
4718 // pending setmodified 4718 // pending setmodified
4719 return true; 4719 return true;
4720} 4720}
4721void CalendarView::setSyncManager(KSyncManager* manager) 4721void CalendarView::setSyncManager(KSyncManager* manager)
4722{ 4722{
4723 mSyncManager = manager; 4723 mSyncManager = manager;
4724} 4724}
4725 4725
4726void CalendarView::removeSyncInfo( QString syncProfile) 4726void CalendarView::removeSyncInfo( QString syncProfile)
4727{ 4727{
4728 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 4728 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
4729 mCalendar->removeSyncInfo( syncProfile ); 4729 mCalendar->removeSyncInfo( syncProfile );
4730 4730
4731} 4731}
4732 4732
4733void CalendarView::undo_delete() 4733void CalendarView::undo_delete()
4734{ 4734{
4735 //qDebug("undo_delete() "); 4735 //qDebug("undo_delete() ");
4736 Incidence* undo = mCalendar->undoIncidence(); 4736 Incidence* undo = mCalendar->undoIncidence();
4737 if ( !undo ) { 4737 if ( !undo ) {
4738 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 4738 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
4739 i18n("KO/Pi")); 4739 i18n("KO/Pi"));
4740 return; 4740 return;
4741 } 4741 }
4742 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( undo->summary(),0 ) + 4742 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( undo->summary(),0 ) +
4743 i18n("\nAre you sure you want\nto restore this?"), 4743 i18n("\nAre you sure you want\nto restore this?"),
4744 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 4744 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
4745 mCalendar->undoDeleteIncidence(); 4745 mCalendar->undoDeleteIncidence();
4746 updateView(); 4746 updateView();
4747 } 4747 }
4748} 4748}
4749 4749
4750void CalendarView::slotViewerClosed() 4750void CalendarView::slotViewerClosed()
4751{ 4751{
4752 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 4752 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
4753} 4753}
4754 4754
4755void CalendarView::resetFocus() 4755void CalendarView::resetFocus()
4756{ 4756{
4757 if ( mViewerCallerIsSearchDialog ) { 4757 if ( mViewerCallerIsSearchDialog ) {
4758 if ( mDialogManager->getSearchDialog()->isVisible() ){ 4758 if ( mDialogManager->getSearchDialog()->isVisible() ){
4759 mDialogManager->getSearchDialog()->raise(); 4759 mDialogManager->getSearchDialog()->raise();
4760 mDialogManager->getSearchDialog()->setActiveWindow(); 4760 mDialogManager->getSearchDialog()->setActiveWindow();
4761 mDialogManager->getSearchDialog()->listview()->resetFocus(); 4761 mDialogManager->getSearchDialog()->listview()->resetFocus();
4762 } else 4762 } else
4763 mViewerCallerIsSearchDialog = false; 4763 mViewerCallerIsSearchDialog = false;
4764 } 4764 }
4765 if ( !mViewerCallerIsSearchDialog ) { 4765 if ( !mViewerCallerIsSearchDialog ) {
4766 //mViewManager->currentView()->setFocus(); 4766 //mViewManager->currentView()->setFocus();
4767 //qDebug("sssssssssssssssset focus "); 4767 //qDebug("sssssssssssssssset focus ");
4768 topLevelWidget()->raise(); 4768 topLevelWidget()->raise();
4769 setActiveWindow(); 4769 setActiveWindow();
4770 //setFocus(); 4770 //setFocus();
4771 } 4771 }
4772 mViewerCallerIsSearchDialog = false; 4772 mViewerCallerIsSearchDialog = false;
4773} 4773}
4774 4774
4775void CalendarView::showNextAlarms() 4775void CalendarView::showNextAlarms()
4776{ 4776{
4777 QString message; 4777 QString message;
4778 QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); 4778 QDateTime nextAl = mCalendar->nextAlarmEventDateTime();
4779 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { 4779 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) {
4780 QString sum = mCalendar->nextSummary(); 4780 QString sum = mCalendar->nextSummary();
4781 QDateTime nextA = mNextAlarmDateTime; 4781 QDateTime nextA = mNextAlarmDateTime;
4782 QDateTime cur = QDateTime::currentDateTime(); 4782 QDateTime cur = QDateTime::currentDateTime();
4783 int secs = cur.secsTo( nextA ); 4783 int secs = cur.secsTo( nextA );
4784 int min = secs /60; 4784 int min = secs /60;
4785 int hours = min /60; 4785 int hours = min /60;
4786 min = min % 60; 4786 min = min % 60;
4787 int days = hours /24; 4787 int days = hours /24;
4788 hours = hours % 24; 4788 hours = hours % 24;
4789 4789
4790 //message = i18n("The next alarm is in:\n"); 4790 //message = i18n("The next alarm is in:\n");
4791 if ( days > 1 ) 4791 if ( days > 1 )
4792 message += i18n("%1 days\n").arg( days ); 4792 message += i18n("%1 days\n").arg( days );
4793 else if ( days == 1 ) 4793 else if ( days == 1 )
4794 message += i18n("1 day\n"); 4794 message += i18n("1 day\n");
4795 if ( hours > 1 ) 4795 if ( hours > 1 )
4796 message += i18n("%1 hours\n").arg( hours ); 4796 message += i18n("%1 hours\n").arg( hours );
4797 else if ( hours == 1 ) 4797 else if ( hours == 1 )
4798 message += i18n("1 hour\n"); 4798 message += i18n("1 hour\n");
4799 if ( min > 1 ) 4799 if ( min > 1 )
4800 message += i18n("%1 minutes\n").arg( min ); 4800 message += i18n("%1 minutes\n").arg( min );
4801 else if ( min == 1 ) 4801 else if ( min == 1 )
4802 message += i18n("1 minute\n"); 4802 message += i18n("1 minute\n");
4803 if ( message.isEmpty() ) 4803 if ( message.isEmpty() )
4804 message = i18n("The next alarm is in\nless than one minute!"); 4804 message = i18n("The next alarm is in\nless than one minute!");
4805 else 4805 else
4806 message = i18n("The next alarm is in:\n") + message; 4806 message = i18n("The next alarm is in:\n") + message;
4807 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; 4807 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ;
4808 } else { 4808 } else {
4809 message = i18n("There is no next alarm."); 4809 message = i18n("There is no next alarm.");
4810 4810
4811 } 4811 }
4812#ifdef DESKTOP_VERSION 4812#ifdef DESKTOP_VERSION
4813 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 4813 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
4814 message += i18n("\nThe internal alarm notification is disabled!\n"); 4814 message += i18n("\nThe internal alarm notification is disabled!\n");
4815 message += i18n("Enable it in the settings menu, TAB alarm."); 4815 message += i18n("Enable it in the settings menu, TAB alarm.");
4816 } 4816 }
4817 4817
4818#endif 4818#endif
4819 KMessageBox::information( this, message); 4819 KMessageBox::information( this, message);
4820} 4820}
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index add1819..94f35e6 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -51,925 +51,931 @@
51#include <libkcal/kincidenceformatter.h> 51#include <libkcal/kincidenceformatter.h>
52#ifndef DESKTOP_VERSION 52#ifndef DESKTOP_VERSION
53#include <qpe/qpeapplication.h> 53#include <qpe/qpeapplication.h>
54#else 54#else
55#include <qapplication.h> 55#include <qapplication.h>
56#endif 56#endif
57#ifndef KORG_NOPRINTER 57#ifndef KORG_NOPRINTER
58#include "calprinter.h" 58#include "calprinter.h"
59#endif 59#endif
60#include "docprefs.h" 60#include "docprefs.h"
61 61
62#include "kotodoview.h" 62#include "kotodoview.h"
63using namespace KOrg; 63using namespace KOrg;
64 64
65 65
66KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) : 66KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) :
67 QDialog( parent, name, true ) 67 QDialog( parent, name, true )
68{ 68{
69 mStopAll = true; 69 mStopAll = true;
70 setCaption( i18n("Start todo") ); 70 setCaption( i18n("Start todo") );
71 QVBoxLayout* lay = new QVBoxLayout( this ); 71 QVBoxLayout* lay = new QVBoxLayout( this );
72 lay->setSpacing( 3 ); 72 lay->setSpacing( 3 );
73 lay->setMargin( 3 ); 73 lay->setMargin( 3 );
74 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this ); 74 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this );
75 lay->addWidget( lab ); 75 lay->addWidget( lab );
76 lab->setAlignment( AlignCenter ); 76 lab->setAlignment( AlignCenter );
77 77
78 QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this ); 78 QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this );
79 lay->addWidget( ok ); 79 lay->addWidget( ok );
80 ok->setDefault( true ); 80 ok->setDefault( true );
81 QPushButton * start = new QPushButton( i18n("Start todo"), this ); 81 QPushButton * start = new QPushButton( i18n("Start todo"), this );
82 lay->addWidget( start ); 82 lay->addWidget( start );
83 QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this ); 83 QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this );
84 lay->addWidget( cancel ); 84 lay->addWidget( cancel );
85 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 85 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
86 connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) ); 86 connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) );
87 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 87 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
88 resize( sizeHint() ); 88 resize( sizeHint() );
89 89
90} 90}
91void KOStartTodoPrefs::doStop() 91void KOStartTodoPrefs::doStop()
92{ 92{
93 mStopAll = false; 93 mStopAll = false;
94 accept(); 94 accept();
95} 95}
96KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : 96KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) :
97 QDialog( parent, name, true ) 97 QDialog( parent, name, true )
98{ 98{
99 mTodo = todo; 99 mTodo = todo;
100 setCaption( i18n("Stop todo") ); 100 setCaption( i18n("Stop todo") );
101 QVBoxLayout* lay = new QVBoxLayout( this ); 101 QVBoxLayout* lay = new QVBoxLayout( this );
102 lay->setSpacing( 3 ); 102 lay->setSpacing( 3 );
103 lay->setMargin( 3 ); 103 lay->setMargin( 3 );
104 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this ); 104 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this );
105 lay->addWidget( lab ); 105 lay->addWidget( lab );
106 lab->setAlignment( AlignHCenter ); 106 lab->setAlignment( AlignHCenter );
107 lab = new QLabel( i18n("Additional Comment:"), this ); 107 lab = new QLabel( i18n("Additional Comment:"), this );
108 lay->addWidget( lab ); 108 lay->addWidget( lab );
109 mComment = new QLineEdit( this ); 109 mComment = new QLineEdit( this );
110 lay->addWidget( mComment ); 110 lay->addWidget( mComment );
111 QHBox * start = new QHBox ( this ); 111 QHBox * start = new QHBox ( this );
112 lay->addWidget( start ); 112 lay->addWidget( start );
113 lab = new QLabel( i18n("Start:"), start ); 113 lab = new QLabel( i18n("Start:"), start );
114 QHBox * end = new QHBox ( this ); 114 QHBox * end = new QHBox ( this );
115 lay->addWidget( end ); 115 lay->addWidget( end );
116 lab = new QLabel( i18n("End:"), end ); 116 lab = new QLabel( i18n("End:"), end );
117 sde = new KDateEdit( start ); 117 sde = new KDateEdit( start );
118 ste = new KOTimeEdit( start ); 118 ste = new KOTimeEdit( start );
119 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); 119 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) );
120 ede = new KDateEdit( end ); 120 ede = new KDateEdit( end );
121 ete = new KOTimeEdit(end ); 121 ete = new KOTimeEdit(end );
122 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); 122 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) );
123 sde->setDate( mTodo->runStart().date() ); 123 sde->setDate( mTodo->runStart().date() );
124 ste->setTime( mTodo->runStart().time() ); 124 ste->setTime( mTodo->runStart().time() );
125 ede->setDate( QDate::currentDate()); 125 ede->setDate( QDate::currentDate());
126 ete->setTime( QTime::currentTime() ); 126 ete->setTime( QTime::currentTime() );
127 QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); 127 QPushButton * ok = new QPushButton( i18n("Stop and save"), this );
128 lay->addWidget( ok ); 128 lay->addWidget( ok );
129 ok->setDefault( true ); 129 ok->setDefault( true );
130 QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); 130 QPushButton * cancel = new QPushButton( i18n("Continue running"), this );
131 lay->addWidget( cancel ); 131 lay->addWidget( cancel );
132 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 132 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
133 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 133 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
134 ok = new QPushButton( i18n("Stop - do not save"), this ); 134 ok = new QPushButton( i18n("Stop - do not save"), this );
135 connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); 135 connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) );
136 lay->addWidget( ok ); 136 lay->addWidget( ok );
137 if (QApplication::desktop()->width() < 320 ) 137 if (QApplication::desktop()->width() < 320 )
138 resize( 240, sizeHint().height() ); 138 resize( 240, sizeHint().height() );
139 else 139 else
140 resize( 320, sizeHint().height() ); 140 resize( 320, sizeHint().height() );
141 141
142} 142}
143 143
144void KOStopTodoPrefs::accept() 144void KOStopTodoPrefs::accept()
145{ 145{
146 QDateTime start = QDateTime( sde->date(), ste->getTime() ); 146 QDateTime start = QDateTime( sde->date(), ste->getTime() );
147 QDateTime stop = QDateTime( ede->date(), ete->getTime() ); 147 QDateTime stop = QDateTime( ede->date(), ete->getTime() );
148 if ( start > stop ) { 148 if ( start > stop ) {
149 KMessageBox::sorry(this, 149 KMessageBox::sorry(this,
150 i18n("The start time is\nafter the end time!"), 150 i18n("The start time is\nafter the end time!"),
151 i18n("Time mismatch!")); 151 i18n("Time mismatch!"));
152 return; 152 return;
153 } 153 }
154 mTodo->saveRunningInfo( mComment->text(), start, stop ); 154 mTodo->saveRunningInfo( mComment->text(), start, stop );
155 QDialog::accept(); 155 QDialog::accept();
156} 156}
157void KOStopTodoPrefs::doNotSave() 157void KOStopTodoPrefs::doNotSave()
158{ 158{
159 int result = KMessageBox::warningContinueCancel(this, 159 int result = KMessageBox::warningContinueCancel(this,
160 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") ); 160 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") );
161 if (result != KMessageBox::Continue) return; 161 if (result != KMessageBox::Continue) return;
162 mTodo->stopRunning(); 162 mTodo->stopRunning();
163 QDialog::accept(); 163 QDialog::accept();
164} 164}
165 165
166 166
167class KOTodoViewWhatsThis :public QWhatsThis 167class KOTodoViewWhatsThis :public QWhatsThis
168{ 168{
169public: 169public:
170 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 170 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
171 171
172protected: 172protected:
173 virtual QString text( const QPoint& p) 173 virtual QString text( const QPoint& p)
174 { 174 {
175 return _view->getWhatsThisText(p) ; 175 return _view->getWhatsThisText(p) ;
176 } 176 }
177private: 177private:
178 QWidget* _wid; 178 QWidget* _wid;
179 KOTodoView * _view; 179 KOTodoView * _view;
180}; 180};
181 181
182KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 182KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
183 const char *name) : 183 const char *name) :
184 KListView(parent,name) 184 KListView(parent,name)
185{ 185{
186 mName = QString ( name ); 186 mName = QString ( name );
187 mCalendar = calendar; 187 mCalendar = calendar;
188#ifndef DESKTOP_VERSION 188#ifndef DESKTOP_VERSION
189 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 189 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
190#endif 190#endif
191 mOldCurrent = 0; 191 mOldCurrent = 0;
192 mMousePressed = false; 192 mMousePressed = false;
193 193
194 setAcceptDrops(true); 194 setAcceptDrops(true);
195 viewport()->setAcceptDrops(true); 195 viewport()->setAcceptDrops(true);
196 int size = 16; 196 int size = 16;
197 if (qApp->desktop()->width() < 300 ) 197 if (qApp->desktop()->width() < 300 )
198 size = 12; 198 size = 12;
199 setTreeStepSize( size + 6 ); 199 setTreeStepSize( size + 6 );
200 200
201} 201}
202 202
203void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) 203void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e)
204{ 204{
205#ifndef KORG_NODND 205#ifndef KORG_NODND
206// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; 206// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl;
207 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 207 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
208 !QTextDrag::canDecode( e ) ) { 208 !QTextDrag::canDecode( e ) ) {
209 e->ignore(); 209 e->ignore();
210 return; 210 return;
211 } 211 }
212 212
213 mOldCurrent = currentItem(); 213 mOldCurrent = currentItem();
214#endif 214#endif
215} 215}
216 216
217 217
218void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) 218void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e)
219{ 219{
220#ifndef KORG_NODND 220#ifndef KORG_NODND
221// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; 221// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl;
222 222
223 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 223 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
224 !QTextDrag::canDecode( e ) ) { 224 !QTextDrag::canDecode( e ) ) {
225 e->ignore(); 225 e->ignore();
226 return; 226 return;
227 } 227 }
228 228
229 e->accept(); 229 e->accept();
230#endif 230#endif
231} 231}
232 232
233void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) 233void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *)
234{ 234{
235#ifndef KORG_NODND 235#ifndef KORG_NODND
236// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; 236// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl;
237 237
238 setCurrentItem(mOldCurrent); 238 setCurrentItem(mOldCurrent);
239 setSelected(mOldCurrent,true); 239 setSelected(mOldCurrent,true);
240#endif 240#endif
241} 241}
242 242
243void KOTodoListView::contentsDropEvent(QDropEvent *e) 243void KOTodoListView::contentsDropEvent(QDropEvent *e)
244{ 244{
245#ifndef KORG_NODND 245#ifndef KORG_NODND
246// kdDebug() << "KOTodoListView::contentsDropEvent" << endl; 246// kdDebug() << "KOTodoListView::contentsDropEvent" << endl;
247 247
248 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 248 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
249 !QTextDrag::canDecode( e ) ) { 249 !QTextDrag::canDecode( e ) ) {
250 e->ignore(); 250 e->ignore();
251 return; 251 return;
252 } 252 }
253 253
254 DndFactory factory( mCalendar ); 254 DndFactory factory( mCalendar );
255 Todo *todo = factory.createDropTodo(e); 255 Todo *todo = factory.createDropTodo(e);
256 256
257 if (todo) { 257 if (todo) {
258 e->acceptAction(); 258 e->acceptAction();
259 259
260 KOTodoViewItem *destination = 260 KOTodoViewItem *destination =
261 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); 261 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos()));
262 Todo *destinationEvent = 0; 262 Todo *destinationEvent = 0;
263 if (destination) destinationEvent = destination->todo(); 263 if (destination) destinationEvent = destination->todo();
264 264
265 Todo *existingTodo = mCalendar->todo(todo->uid()); 265 Todo *existingTodo = mCalendar->todo(todo->uid());
266 266
267 if(existingTodo) { 267 if(existingTodo) {
268 Incidence *to = destinationEvent; 268 Incidence *to = destinationEvent;
269 while(to) { 269 while(to) {
270 if (to->uid() == todo->uid()) { 270 if (to->uid() == todo->uid()) {
271 KMessageBox::sorry(this, 271 KMessageBox::sorry(this,
272 i18n("Cannot move Todo to itself\nor a child of itself"), 272 i18n("Cannot move Todo to itself\nor a child of itself"),
273 i18n("Drop Todo")); 273 i18n("Drop Todo"));
274 delete todo; 274 delete todo;
275 return; 275 return;
276 } 276 }
277 to = to->relatedTo(); 277 to = to->relatedTo();
278 } 278 }
279 internalDrop = true; 279 internalDrop = true;
280 if ( destinationEvent ) 280 if ( destinationEvent )
281 reparentTodoSignal( destinationEvent, existingTodo ); 281 reparentTodoSignal( destinationEvent, existingTodo );
282 else 282 else
283 unparentTodoSignal(existingTodo); 283 unparentTodoSignal(existingTodo);
284 delete todo; 284 delete todo;
285 } else { 285 } else {
286 mCalendar->addTodo(todo); 286 mCalendar->addTodo(todo);
287 emit todoDropped(todo, KOGlobals::EVENTADDED); 287 emit todoDropped(todo, KOGlobals::EVENTADDED);
288 if ( destinationEvent ) 288 if ( destinationEvent )
289 reparentTodoSignal( destinationEvent, todo ); 289 reparentTodoSignal( destinationEvent, todo );
290 } 290 }
291 } 291 }
292 else { 292 else {
293 QString text; 293 QString text;
294 if (QTextDrag::decode(e,text)) { 294 if (QTextDrag::decode(e,text)) {
295 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); 295 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) );
296 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); 296 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) ));
297 qDebug("Dropped : " + text); 297 qDebug("Dropped : " + text);
298 QStringList emails = QStringList::split(",",text); 298 QStringList emails = QStringList::split(",",text);
299 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { 299 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
300 int pos = (*it).find("<"); 300 int pos = (*it).find("<");
301 QString name = (*it).left(pos); 301 QString name = (*it).left(pos);
302 QString email = (*it).mid(pos); 302 QString email = (*it).mid(pos);
303 if (!email.isEmpty() && todoi) { 303 if (!email.isEmpty() && todoi) {
304 todoi->todo()->addAttendee(new Attendee(name,email)); 304 todoi->todo()->addAttendee(new Attendee(name,email));
305 } 305 }
306 } 306 }
307 } 307 }
308 else { 308 else {
309 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); 309 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable ");
310 e->ignore(); 310 e->ignore();
311 } 311 }
312 } 312 }
313#endif 313#endif
314} 314}
315void KOTodoListView::wheelEvent (QWheelEvent *e) 315void KOTodoListView::wheelEvent (QWheelEvent *e)
316{ 316{
317 QListView::wheelEvent (e); 317 QListView::wheelEvent (e);
318} 318}
319 319
320void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 320void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
321{ 321{
322 322
323 QPoint p(contentsToViewport(e->pos())); 323 QPoint p(contentsToViewport(e->pos()));
324 QListViewItem *i = itemAt(p); 324 QListViewItem *i = itemAt(p);
325 bool rootClicked = true; 325 bool rootClicked = true;
326 if (i) { 326 if (i) {
327 // if the user clicked into the root decoration of the item, don't 327 // if the user clicked into the root decoration of the item, don't
328 // try to start a drag! 328 // try to start a drag!
329 int X = p.x(); 329 int X = p.x();
330 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); 330 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() );
331 if (X > header()->sectionPos(0) + 331 if (X > header()->sectionPos(0) +
332 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + 332 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
333 itemMargin() +i->height()|| 333 itemMargin() +i->height()||
334 X < header()->sectionPos(0)) { 334 X < header()->sectionPos(0)) {
335 rootClicked = false; 335 rootClicked = false;
336 } 336 }
337 } else { 337 } else {
338 rootClicked = false; 338 rootClicked = false;
339 } 339 }
340#ifndef KORG_NODND 340#ifndef KORG_NODND
341 mMousePressed = false; 341 mMousePressed = false;
342 if (! rootClicked && !( e->button() == RightButton) ) { 342 if (! rootClicked && !( e->button() == RightButton) ) {
343 mPressPos = e->pos(); 343 mPressPos = e->pos();
344 mMousePressed = true; 344 mMousePressed = true;
345 } else { 345 } else {
346 mMousePressed = false; 346 mMousePressed = false;
347 } 347 }
348#endif 348#endif
349 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); 349 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked);
350#ifndef DESKTOP_VERSION 350#ifndef DESKTOP_VERSION
351 if (!( e->button() == RightButton && rootClicked) ) 351 if (!( e->button() == RightButton && rootClicked) )
352 QListView::contentsMousePressEvent(e); 352 QListView::contentsMousePressEvent(e);
353#else 353#else
354 QListView::contentsMousePressEvent(e); 354 QListView::contentsMousePressEvent(e);
355#endif 355#endif
356} 356}
357void KOTodoListView::paintEvent(QPaintEvent* e) 357void KOTodoListView::paintEvent(QPaintEvent* e)
358{ 358{
359 emit paintNeeded(); 359 emit paintNeeded();
360 QListView::paintEvent( e); 360 QListView::paintEvent( e);
361} 361}
362void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 362void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
363{ 363{
364 364
365#ifndef KORG_NODND 365#ifndef KORG_NODND
366 //QListView::contentsMouseMoveEvent(e); 366 //QListView::contentsMouseMoveEvent(e);
367 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > 367 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
368 QApplication::startDragDistance()*3) { 368 QApplication::startDragDistance()*3) {
369 mMousePressed = false; 369 mMousePressed = false;
370 QListViewItem *item = itemAt(contentsToViewport(mPressPos)); 370 QListViewItem *item = itemAt(contentsToViewport(mPressPos));
371 if (item) { 371 if (item) {
372 DndFactory factory( mCalendar ); 372 DndFactory factory( mCalendar );
373 ICalDrag *vd = factory.createDrag( 373 ICalDrag *vd = factory.createDrag(
374 ((KOTodoViewItem *)item)->todo(),viewport()); 374 ((KOTodoViewItem *)item)->todo(),viewport());
375 internalDrop = false; 375 internalDrop = false;
376 // we cannot do any senseful here, because the DnD is still broken in Qt 376 // we cannot do any senseful here, because the DnD is still broken in Qt
377 if (vd->drag()) { 377 if (vd->drag()) {
378 if ( !internalDrop ) { 378 if ( !internalDrop ) {
379 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); 379 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() );
380 qDebug("Dnd: External move: Delete drag source "); 380 qDebug("Dnd: External move: Delete drag source ");
381 } else 381 } else
382 qDebug("Dnd: Internal move "); 382 qDebug("Dnd: Internal move ");
383 383
384 } else { 384 } else {
385 if ( !internalDrop ) { 385 if ( !internalDrop ) {
386 qDebug("Dnd: External Copy"); 386 qDebug("Dnd: External Copy");
387 } else 387 } else
388 qDebug("DnD: Internal copy: Copy pending"); 388 qDebug("DnD: Internal copy: Copy pending");
389 } 389 }
390 } 390 }
391 } 391 }
392#endif 392#endif
393} 393}
394void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) 394void KOTodoListView::keyReleaseEvent ( QKeyEvent *e )
395{ 395{
396 if ( !e->isAutoRepeat() ) { 396 if ( !e->isAutoRepeat() ) {
397 mFlagKeyPressed = false; 397 mFlagKeyPressed = false;
398 } 398 }
399} 399}
400 400
401 401
402void KOTodoListView::keyPressEvent ( QKeyEvent * e ) 402void KOTodoListView::keyPressEvent ( QKeyEvent * e )
403{ 403{
404 qApp->processEvents(); 404 qApp->processEvents();
405 if ( !isVisible() ) { 405 if ( !isVisible() ) {
406 e->ignore(); 406 e->ignore();
407 return; 407 return;
408 } 408 }
409 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 409 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
410 e->ignore(); 410 e->ignore();
411 // qDebug(" ignore %d",e->isAutoRepeat() ); 411 // qDebug(" ignore %d",e->isAutoRepeat() );
412 return; 412 return;
413 } 413 }
414 if (! e->isAutoRepeat() ) 414 if (! e->isAutoRepeat() )
415 mFlagKeyPressed = true; 415 mFlagKeyPressed = true;
416 QListViewItem* cn; 416 QListViewItem* cn;
417 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { 417 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) {
418 cn = currentItem(); 418 cn = currentItem();
419 if ( cn ) { 419 if ( cn ) {
420 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 420 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
421 if ( ci ){ 421 if ( ci ){
422 if ( e->state() == ShiftButton ) 422 if ( e->state() == ShiftButton )
423 ci->setOn( false ); 423 ci->setOn( false );
424 else 424 else
425 ci->setOn( true ); 425 ci->setOn( true );
426 cn = cn->itemBelow(); 426 cn = cn->itemBelow();
427 if ( cn ) { 427 if ( cn ) {
428 setCurrentItem ( cn ); 428 setCurrentItem ( cn );
429 ensureItemVisible ( cn ); 429 ensureItemVisible ( cn );
430 } 430 }
431 431
432 } 432 }
433 } 433 }
434 434
435 e->accept();
435 return; 436 return;
436 } 437 }
437 438
438 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 439 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
439 switch ( e->key() ) { 440 switch ( e->key() ) {
440 case Qt::Key_Down: 441 case Qt::Key_Down:
441 case Qt::Key_Up: 442 case Qt::Key_Up:
442 QListView::keyPressEvent ( e ); 443 QListView::keyPressEvent ( e );
444 e->accept();
443 break; 445 break;
444 case Qt::Key_Left: 446 case Qt::Key_Left:
445 case Qt::Key_Right: 447 case Qt::Key_Right:
446 QListView::keyPressEvent ( e ); 448 QListView::keyPressEvent ( e );
447 e->accept(); 449 e->accept();
448 return; 450 return;
449 break; 451 break;
450 default: 452 default:
451 e->ignore(); 453 e->ignore();
452 break; 454 break;
453 } 455 }
454 return; 456 return;
455 } 457 }
456 e->ignore(); 458 e->ignore();
457} 459}
458void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 460void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
459{ 461{
460 QListView::contentsMouseReleaseEvent(e); 462 QListView::contentsMouseReleaseEvent(e);
461 mMousePressed = false; 463 mMousePressed = false;
462} 464}
463 465
464void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 466void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
465{ 467{
466 if (!e) return; 468 if (!e) return;
467 469
468 QPoint vp = contentsToViewport(e->pos()); 470 QPoint vp = contentsToViewport(e->pos());
469 471
470 QListViewItem *item = itemAt(vp); 472 QListViewItem *item = itemAt(vp);
471 473
472 emit double_Clicked(item); 474 emit double_Clicked(item);
473 if (!item) return; 475 if (!item) return;
474 476
475 emit doubleClicked(item,vp,0); 477 emit doubleClicked(item,vp,0);
476} 478}
477 479
478///////////////////////////////////////////////////////////////////////////// 480/////////////////////////////////////////////////////////////////////////////
479 481
480KOQuickTodo::KOQuickTodo(QWidget *parent) : 482KOQuickTodo::KOQuickTodo(QWidget *parent) :
481 QLineEdit(parent) 483 QLineEdit(parent)
482{ 484{
483 setText(i18n("Click to add new Todo")); 485 setText(i18n("Click to add new Todo"));
484} 486}
485 487
486void KOQuickTodo::focusInEvent(QFocusEvent *ev) 488void KOQuickTodo::focusInEvent(QFocusEvent *ev)
487{ 489{
488 if ( text()==i18n("Click to add new Todo") ) 490 if ( text()==i18n("Click to add new Todo") )
489 setText(""); 491 setText("");
490 QLineEdit::focusInEvent(ev); 492 QLineEdit::focusInEvent(ev);
491} 493}
492 494
493void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 495void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
494{ 496{
495 setText(i18n("Click to add new Todo")); 497 setText(i18n("Click to add new Todo"));
496 QLineEdit::focusOutEvent(ev); 498 QLineEdit::focusOutEvent(ev);
497} 499}
498 500
499///////////////////////////////////////////////////////////////////////////// 501/////////////////////////////////////////////////////////////////////////////
500 502
501KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 503KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
502 KOrg::BaseView(calendar,parent,name) 504 KOrg::BaseView(calendar,parent,name)
503{ 505{
504 mCategoryPopupMenu = 0; 506 mCategoryPopupMenu = 0;
505 mPendingUpdateBeforeRepaint = false; 507 mPendingUpdateBeforeRepaint = false;
506 isFlatDisplay = false; 508 isFlatDisplay = false;
507 mNavigator = 0; 509 mNavigator = 0;
508 QBoxLayout *topLayout = new QVBoxLayout(this); 510 QBoxLayout *topLayout = new QVBoxLayout(this);
509 mName = QString ( name ); 511 mName = QString ( name );
510 mBlockUpdate = false; 512 mBlockUpdate = false;
511 mQuickBar = new QWidget( this ); 513 mQuickBar = new QWidget( this );
512 topLayout->addWidget(mQuickBar); 514 topLayout->addWidget(mQuickBar);
513 515
514 mQuickAdd = new KOQuickTodo(mQuickBar); 516 mQuickAdd = new KOQuickTodo(mQuickBar);
515 QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); 517 QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar);
516 quickLayout->addWidget( mQuickAdd ); 518 quickLayout->addWidget( mQuickAdd );
519 mNewSubBut = new QPushButton( "sub",mQuickBar );
520 QPushButton * s_done = new QPushButton( "D",mQuickBar );
521 QPushButton * s_run = new QPushButton( "R",mQuickBar );
522 QPushButton * allopen = new QPushButton( "O",mQuickBar );
523 QPushButton * allclose = new QPushButton( "C",mQuickBar );
517 QPushButton * flat = new QPushButton( "F",mQuickBar ); 524 QPushButton * flat = new QPushButton( "F",mQuickBar );
525
518 int fixwid = flat->sizeHint().height(); 526 int fixwid = flat->sizeHint().height();
519 if ( QApplication::desktop()->width() >= 800 ) 527 if ( QApplication::desktop()->width() >= 800 )
520 fixwid *= 2; 528 fixwid *= 2;
521 flat->setFixedWidth( fixwid ); 529 flat->setFixedWidth( fixwid );
522 connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); 530 connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat()));
523 QPushButton * allopen = new QPushButton( "O",mQuickBar );
524 allopen->setFixedWidth( fixwid ); 531 allopen->setFixedWidth( fixwid );
525 connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); 532 connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen()));
526 QPushButton * allclose = new QPushButton( "C",mQuickBar );
527 allclose->setFixedWidth( fixwid ); 533 allclose->setFixedWidth( fixwid );
528 connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); 534 connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose()));
529 QPushButton * s_done = new QPushButton( "D",mQuickBar );
530 s_done->setPixmap( SmallIcon("greenhook16")); 535 s_done->setPixmap( SmallIcon("greenhook16"));
531 s_done->setFixedWidth( fixwid ); 536 s_done->setFixedWidth( fixwid );
532 s_done->setFixedHeight( flat->sizeHint().height() ); 537 s_done->setFixedHeight( flat->sizeHint().height() );
533 connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); 538 connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted()));
534 QPushButton * s_run = new QPushButton( "R",mQuickBar );
535 s_run->setPixmap( SmallIcon("ko16old")); 539 s_run->setPixmap( SmallIcon("ko16old"));
536 s_run->setFixedWidth( fixwid ); 540 s_run->setFixedWidth( fixwid );
537 s_run->setFixedHeight( flat->sizeHint().height() ); 541 s_run->setFixedHeight( flat->sizeHint().height() );
538 connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); 542 connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning()));
539 543
540 mNewSubBut = new QPushButton( "sub",mQuickBar );
541 mNewSubBut->setFixedWidth( fixwid*3/2 ); 544 mNewSubBut->setFixedWidth( fixwid*3/2 );
542 connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); 545 connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo()));
543 mNewSubBut->setEnabled( false ); 546 mNewSubBut->setEnabled( false );
544 quickLayout->addWidget( mNewSubBut ); 547 quickLayout->addWidget( mNewSubBut );
545 quickLayout->addWidget( s_done ); 548 quickLayout->addWidget( s_done );
546 quickLayout->addWidget( s_run ); 549 quickLayout->addWidget( s_run );
547 550
548 quickLayout->addWidget( allopen ); 551 quickLayout->addWidget( allopen );
549 quickLayout->addWidget( allclose ); 552 quickLayout->addWidget( allclose );
550 quickLayout->addWidget( flat ); 553 quickLayout->addWidget( flat );
551 554
552 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); 555 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide();
553 556
554 mTodoListView = new KOTodoListView(calendar,this, name ); 557 mTodoListView = new KOTodoListView(calendar,this, name );
555 topLayout->addWidget(mTodoListView); 558 topLayout->addWidget(mTodoListView);
556 //mTodoListView->header()->setMaximumHeight(30); 559 //mTodoListView->header()->setMaximumHeight(30);
557 mTodoListView->setRootIsDecorated(true); 560 mTodoListView->setRootIsDecorated(true);
558 mTodoListView->setAllColumnsShowFocus(true); 561 mTodoListView->setAllColumnsShowFocus(true);
559 562
560 mTodoListView->setShowSortIndicator(true); 563 mTodoListView->setShowSortIndicator(true);
561 564
562 mTodoListView->addColumn(i18n("Todo")); 565 mTodoListView->addColumn(i18n("Todo"));
563 mTodoListView->addColumn(i18n("Prio")); 566 mTodoListView->addColumn(i18n("Prio"));
564 mTodoListView->setColumnAlignment(1,AlignHCenter); 567 mTodoListView->setColumnAlignment(1,AlignHCenter);
565 mTodoListView->addColumn(i18n("Complete")); 568 mTodoListView->addColumn(i18n("Complete"));
566 mTodoListView->setColumnAlignment(2,AlignCenter); 569 mTodoListView->setColumnAlignment(2,AlignCenter);
567 570
568 mTodoListView->addColumn(i18n("Due Date")); 571 mTodoListView->addColumn(i18n("Due Date"));
569 mTodoListView->setColumnAlignment(3,AlignLeft); 572 mTodoListView->setColumnAlignment(3,AlignLeft);
570 mTodoListView->addColumn(i18n("Due Time")); 573 mTodoListView->addColumn(i18n("Due Time"));
571 mTodoListView->setColumnAlignment(4,AlignHCenter); 574 mTodoListView->setColumnAlignment(4,AlignHCenter);
572 575
573 mTodoListView->addColumn(i18n("Start Date")); 576 mTodoListView->addColumn(i18n("Start Date"));
574 mTodoListView->setColumnAlignment(5,AlignLeft); 577 mTodoListView->setColumnAlignment(5,AlignLeft);
575 mTodoListView->addColumn(i18n("Start Time")); 578 mTodoListView->addColumn(i18n("Start Time"));
576 mTodoListView->setColumnAlignment(6,AlignHCenter); 579 mTodoListView->setColumnAlignment(6,AlignHCenter);
577 580
578 mTodoListView->addColumn(i18n("Cancelled")); 581 //mTodoListView->addColumn(i18n("Cancelled"));
579 mTodoListView->addColumn(i18n("Categories")); 582 mTodoListView->addColumn(i18n("Categories"));
580 mTodoListView->addColumn(i18n("Calendar")); 583 mTodoListView->addColumn(i18n("Calendar"));
584 mTodoListView->addColumn(i18n("Last Modified"));
585 mTodoListView->addColumn(i18n("Created"));
586 mTodoListView->addColumn(i18n("Last Modified Sub"));
581#if 0 587#if 0
582 mTodoListView->addColumn(i18n("Sort Id")); 588 mTodoListView->addColumn(i18n("Sort Id"));
583 mTodoListView->setColumnAlignment(4,AlignHCenter); 589 mTodoListView->setColumnAlignment(4,AlignHCenter);
584#endif 590#endif
585 591
586 mTodoListView->setMinimumHeight( 60 ); 592 mTodoListView->setMinimumHeight( 60 );
587 mTodoListView->setItemsRenameable( true ); 593 mTodoListView->setItemsRenameable( true );
588 mTodoListView->setRenameable( 0 ); 594 mTodoListView->setRenameable( 0 );
589 mTodoListView->setColumnWidth( 0, 120 ); 595 mTodoListView->setColumnWidth( 0, 120 );
590 int iii = 0; 596 int iii = 0;
591 for ( iii = 0; iii< 10 ; ++iii ) 597 for ( iii = 0; iii< 12 ; ++iii )
592 mTodoListView->setColumnWidthMode( iii, QListView::Manual ); 598 mTodoListView->setColumnWidthMode( iii, QListView::Manual );
593 599
594 600
595 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); 601 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this);
596 602
597 mPriorityPopupMenu = new QPopupMenu(this); 603 mPriorityPopupMenu = new QPopupMenu(this);
598 for (int i = 1; i <= 5; i++) { 604 for (int i = 1; i <= 5; i++) {
599 QString label = QString ("%1").arg (i); 605 QString label = QString ("%1").arg (i);
600 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 606 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
601 } 607 }
602 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 608 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
603 609
604 mPercentageCompletedPopupMenu = new QPopupMenu(this); 610 mPercentageCompletedPopupMenu = new QPopupMenu(this);
605 for (int i = 0; i <= 100; i+=20) { 611 for (int i = 0; i <= 100; i+=20) {
606 QString label = QString ("%1 %").arg (i); 612 QString label = QString ("%1 %").arg (i);
607 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 613 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
608 } 614 }
609 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 615 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
610 616
611 617
612 mCategoryPopupMenu = new QPopupMenu (this); 618 mCategoryPopupMenu = new QPopupMenu (this);
613 mCategoryPopupMenu->setCheckable (true); 619 mCategoryPopupMenu->setCheckable (true);
614 connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 620 connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
615 connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); 621 connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ()));
616 622
617 mCalPopupMenu = new QPopupMenu (this); 623 mCalPopupMenu = new QPopupMenu (this);
618 mCalPopupMenu->setCheckable (true); 624 mCalPopupMenu->setCheckable (true);
619 connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); 625 connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int)));
620 connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); 626 connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ()));
621 627
622 628
623 629
624 630
625 mItemPopupMenu = new QPopupMenu(this); 631 mItemPopupMenu = new QPopupMenu(this);
626 mItemPopupMenu->insertItem(i18n("Show"), this, 632 mItemPopupMenu->insertItem(i18n("Show"), this,
627 SLOT (showTodo())); 633 SLOT (showTodo()));
628 mItemPopupMenu->insertItem(i18n("Edit..."), this, 634 mItemPopupMenu->insertItem(i18n("Edit..."), this,
629 SLOT (editTodo())); 635 SLOT (editTodo()));
630 mItemPopupMenu->insertItem( i18n("Delete..."), this, 636 mItemPopupMenu->insertItem( i18n("Delete..."), this,
631 SLOT (deleteTodo())); 637 SLOT (deleteTodo()));
632 mItemPopupMenu->insertItem( i18n("Clone..."), this, 638 mItemPopupMenu->insertItem( i18n("Clone..."), this,
633 SLOT (cloneTodo())); 639 SLOT (cloneTodo()));
634 mItemPopupMenu->insertItem( i18n("Move..."), this, 640 mItemPopupMenu->insertItem( i18n("Move..."), this,
635 SLOT (moveTodo())); 641 SLOT (moveTodo()));
636#ifndef DESKTOP_VERSION 642#ifndef DESKTOP_VERSION
637 mItemPopupMenu->insertItem( i18n("Beam..."), this, 643 mItemPopupMenu->insertItem( i18n("Beam..."), this,
638 SLOT (beamTodo())); 644 SLOT (beamTodo()));
639#endif 645#endif
640 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 646 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
641 SLOT (cancelTodo())); 647 SLOT (cancelTodo()));
642 mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu); 648 mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu);
643 mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu); 649 mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu);
644 mItemPopupMenu->insertSeparator(); 650 mItemPopupMenu->insertSeparator();
645 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, 651 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
646 SLOT (toggleRunningItem())); 652 SLOT (toggleRunningItem()));
647 mItemPopupMenu->insertSeparator(); 653 mItemPopupMenu->insertSeparator();
648 /* 654 /*
649 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 655 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
650 SLOT (newTodo())); 656 SLOT (newTodo()));
651 */ 657 */
652 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 658 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
653 SLOT (newSubTodo())); 659 SLOT (newSubTodo()));
654 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 660 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
655 SLOT (unparentTodo()),0,21); 661 SLOT (unparentTodo()),0,21);
656 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, 662 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
657 SLOT (reparentTodo()),0,22); 663 SLOT (reparentTodo()),0,22);
658 mItemPopupMenu->insertSeparator(); 664 mItemPopupMenu->insertSeparator();
659#if 0 665#if 0
660 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed..."), 666 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed..."),
661 this, SLOT( purgeCompleted() ) ); 667 this, SLOT( purgeCompleted() ) );
662 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 668 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
663 this, SLOT( toggleCompleted() ),0, 33 ); 669 this, SLOT( toggleCompleted() ),0, 33 );
664 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 670 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
665 this, SLOT( toggleQuickTodo() ),0, 34 ); 671 this, SLOT( toggleQuickTodo() ),0, 34 );
666 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 672 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
667 this, SLOT( toggleRunning() ),0, 35 ); 673 this, SLOT( toggleRunning() ),0, 35 );
668 674
669#endif 675#endif
670 mPopupMenu = new QPopupMenu(this); 676 mPopupMenu = new QPopupMenu(this);
671 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, 677 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
672 SLOT (newTodo()),0,1); 678 SLOT (newTodo()),0,1);
673 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."), 679 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."),
674 this, SLOT(purgeCompleted()),0,2); 680 this, SLOT(purgeCompleted()),0,2);
675 mPopupMenu->insertItem(i18n("Show Completed"), 681 mPopupMenu->insertItem(i18n("Show Completed"),
676 this, SLOT( toggleCompleted() ),0,3 ); 682 this, SLOT( toggleCompleted() ),0,3 );
677 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 683 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
678 this, SLOT( toggleRunning() ),0,5 ); 684 this, SLOT( toggleRunning() ),0,5 );
679 mPopupMenu->insertItem(i18n(" set all open","Display all opened"), 685 mPopupMenu->insertItem(i18n(" set all open","Display all opened"),
680 this, SLOT( setAllOpen() ),0,6 ); 686 this, SLOT( setAllOpen() ),0,6 );
681 mPopupMenu->insertItem(i18n(" set all close","Display all closed"), 687 mPopupMenu->insertItem(i18n(" set all close","Display all closed"),
682 this, SLOT( setAllClose() ),0,7 ); 688 this, SLOT( setAllClose() ),0,7 );
683 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), 689 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"),
684 this, SLOT( setAllFlat() ),0,8 ); 690 this, SLOT( setAllFlat() ),0,8 );
685 mPopupMenu->insertSeparator(); 691 mPopupMenu->insertSeparator();
686 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 692 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
687 this, SLOT( toggleQuickTodo() ),0,4 ); 693 this, SLOT( toggleQuickTodo() ),0,4 );
688 mDocPrefs = new DocPrefs( name ); 694 mDocPrefs = new DocPrefs( name );
689 695
690 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); 696 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu );
691 mPopupMenu->setCheckable( true ); 697 mPopupMenu->setCheckable( true );
692 mItemPopupMenu->setCheckable( true ); 698 mItemPopupMenu->setCheckable( true );
693 699
694 700
695 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 701 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
696 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 702 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
697 703
698 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 704 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
699 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 705 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
700 706
701 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 707 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
702 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 708 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
703 709
704 710
705 // Double clicking conflicts with opening/closing the subtree 711 // Double clicking conflicts with opening/closing the subtree
706 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 712 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
707 SLOT( editItem( QListViewItem *) ) ); 713 SLOT( editItem( QListViewItem *) ) );
708 /* 714 /*
709 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 715 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
710 const QPoint &,int ) ), 716 const QPoint &,int ) ),
711 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 717 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
712 */ 718 */
713 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 719 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
714 const QPoint &,int ) ), 720 const QPoint &,int ) ),
715 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 721 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
716 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 722 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
717 SLOT( itemClicked( QListViewItem * ) ) ); 723 SLOT( itemClicked( QListViewItem * ) ) );
718 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 724 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
719 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 725 SLOT( itemDoubleClicked( QListViewItem * ) ) );
720 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 726 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
721 SLOT( updateView() ) ); 727 SLOT( updateView() ) );
722 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 728 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
723 SLOT( todoModified(Todo *, int) ) ); 729 SLOT( todoModified(Todo *, int) ) );
724 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 730 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
725 SLOT( itemStateChanged( QListViewItem * ) ) ); 731 SLOT( itemStateChanged( QListViewItem * ) ) );
726 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 732 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
727 SLOT( itemStateChanged( QListViewItem * ) ) ); 733 SLOT( itemStateChanged( QListViewItem * ) ) );
728 connect( mTodoListView, SIGNAL( paintNeeded() ), 734 connect( mTodoListView, SIGNAL( paintNeeded() ),
729 SLOT( paintNeeded()) ); 735 SLOT( paintNeeded()) );
730 736
731#if 0 737#if 0
732 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 738 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
733 SLOT(selectionChanged(QListViewItem *))); 739 SLOT(selectionChanged(QListViewItem *)));
734 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 740 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
735 SLOT(selectionChanged(QListViewItem *))); 741 SLOT(selectionChanged(QListViewItem *)));
736 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 742 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
737 SLOT(selectionChanged(QListViewItem *))); 743 SLOT(selectionChanged(QListViewItem *)));
738#endif 744#endif
739 745
740 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); 746 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
741 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); 747 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
742 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); 748 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
743 749
744 connect( mTodoListView, SIGNAL(selectionChanged() ), 750 connect( mTodoListView, SIGNAL(selectionChanged() ),
745 SLOT( processSelectionChange() ) ); 751 SLOT( processSelectionChange() ) );
746 connect( mQuickAdd, SIGNAL( returnPressed () ), 752 connect( mQuickAdd, SIGNAL( returnPressed () ),
747 SLOT( addQuickTodo() ) ); 753 SLOT( addQuickTodo() ) );
748 754
749} 755}
750 756
751KOTodoView::~KOTodoView() 757KOTodoView::~KOTodoView()
752{ 758{
753 759
754#if QT_VERSION >= 0x030000 760#if QT_VERSION >= 0x030000
755 761
756#else 762#else
757 delete mKOTodoViewWhatsThis; 763 delete mKOTodoViewWhatsThis;
758#endif 764#endif
759 765
760 delete mDocPrefs; 766 delete mDocPrefs;
761} 767}
762QString KOTodoView::getWhatsThisText(QPoint p) 768QString KOTodoView::getWhatsThisText(QPoint p)
763{ 769{
764 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); 770 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p );
765 if ( item ) 771 if ( item )
766 return KIncidenceFormatter::instance()->getFormattedText( item->todo(), 772 return KIncidenceFormatter::instance()->getFormattedText( item->todo(),
767 KOPrefs::instance()->mWTshowDetails, 773 KOPrefs::instance()->mWTshowDetails,
768 KOPrefs::instance()->mWTshowCreated, 774 KOPrefs::instance()->mWTshowCreated,
769 KOPrefs::instance()->mWTshowChanged); 775 KOPrefs::instance()->mWTshowChanged);
770 return i18n("That is the todo view" ); 776 return i18n("That is the todo view" );
771 777
772} 778}
773 779
774void KOTodoView::jumpToDate () 780void KOTodoView::jumpToDate ()
775{ 781{
776 // if (mActiveItem) { 782 // if (mActiveItem) {
777// mActiveItem->todo()); 783// mActiveItem->todo());
778// if ( mActiveItem->todo()->hasDueDate() ) 784// if ( mActiveItem->todo()->hasDueDate() )
779// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 785// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
780} 786}
781void KOTodoView::paintNeeded() 787void KOTodoView::paintNeeded()
782{ 788{
783 if ( mPendingUpdateBeforeRepaint ) { 789 if ( mPendingUpdateBeforeRepaint ) {
784 updateView(); 790 updateView();
785 mPendingUpdateBeforeRepaint = false; 791 mPendingUpdateBeforeRepaint = false;
786 } 792 }
787} 793}
788void KOTodoView::paintEvent(QPaintEvent * pevent) 794void KOTodoView::paintEvent(QPaintEvent * pevent)
789{ 795{
790 if ( mPendingUpdateBeforeRepaint ) { 796 if ( mPendingUpdateBeforeRepaint ) {
791 updateView(); 797 updateView();
792 mPendingUpdateBeforeRepaint = false; 798 mPendingUpdateBeforeRepaint = false;
793 } 799 }
794 KOrg::BaseView::paintEvent( pevent); 800 KOrg::BaseView::paintEvent( pevent);
795} 801}
796 802
797void KOTodoView::updateView() 803void KOTodoView::updateView()
798{ 804{
799 pendingSubtodo = 0; 805 pendingSubtodo = 0;
800 if ( mBlockUpdate ) { 806 if ( mBlockUpdate ) {
801 return; 807 return;
802 } 808 }
803 if ( !isVisible() ) { 809 if ( !isVisible() ) {
804 mPendingUpdateBeforeRepaint = true; 810 mPendingUpdateBeforeRepaint = true;
805 return; 811 return;
806 } 812 }
807 //qDebug("KOTodoView::updateView() %x", this); 813 //qDebug("KOTodoView::updateView() %x", this);
808 if ( isFlatDisplay ) { 814 if ( isFlatDisplay ) {
809 displayAllFlat(); 815 displayAllFlat();
810 return; 816 return;
811 } 817 }
812 storeCurrentItem(); 818 storeCurrentItem();
813 //qDebug("update "); 819 //qDebug("update ");
814// kdDebug() << "KOTodoView::updateView()" << endl; 820// kdDebug() << "KOTodoView::updateView()" << endl;
815 QFont fo = KOPrefs::instance()->mTodoViewFont; 821 QFont fo = KOPrefs::instance()->mTodoViewFont;
816 822
817 823
818 mTodoListView->clear(); 824 mTodoListView->clear();
819 if ( mName == "todolistsmall" ) { 825 if ( mName == "todolistsmall" ) {
820 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 826 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
821 int ps = fo.pointSize() -2; 827 int ps = fo.pointSize() -2;
822 if ( ps > 12 ) 828 if ( ps > 12 )
823 ps -= 2; 829 ps -= 2;
824 fo.setPointSize( ps ); 830 fo.setPointSize( ps );
825 } 831 }
826 } 832 }
827 833
828 mTodoListView->setFont( fo ); 834 mTodoListView->setFont( fo );
829 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 835 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
830 //mTodoListView->header()->setMaximumHeight(fm.height()); 836 //mTodoListView->header()->setMaximumHeight(fm.height());
831 QPtrList<Todo> todoList = calendar()->todos(); 837 QPtrList<Todo> todoList = calendar()->todos();
832 838
833/* 839/*
834 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 840 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
835 Event *t; 841 Event *t;
836 for(t = todoList.first(); t; t = todoList.next()) { 842 for(t = todoList.first(); t; t = todoList.next()) {
837 kdDebug() << " " << t->getSummary() << endl; 843 kdDebug() << " " << t->getSummary() << endl;
838 844
839 if (t->getRelatedTo()) { 845 if (t->getRelatedTo()) {
840 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 846 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
841 } 847 }
842 848
843 QPtrList<Event> l = t->getRelations(); 849 QPtrList<Event> l = t->getRelations();
844 Event *c; 850 Event *c;
845 for(c=l.first();c;c=l.next()) { 851 for(c=l.first();c;c=l.next()) {
846 kdDebug() << " - relation: " << c->getSummary() << endl; 852 kdDebug() << " - relation: " << c->getSummary() << endl;
847 } 853 }
848 } 854 }
849*/ 855*/
850 856
851 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 857 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
852 // specific order of events. That means that we have to generate parent items 858 // specific order of events. That means that we have to generate parent items
853 // recursively for proper hierarchical display of Todos. 859 // recursively for proper hierarchical display of Todos.
854 mTodoMap.clear(); 860 mTodoMap.clear();
855 Todo *todo; 861 Todo *todo;
856 todo = todoList.first();// todo; todo = todoList.next()) { 862 todo = todoList.first();// todo; todo = todoList.next()) {
857 while ( todo ) { 863 while ( todo ) {
858 bool next = true; 864 bool next = true;
859 // qDebug("todo %s ", todo->summary().latin1()); 865 // qDebug("todo %s ", todo->summary().latin1());
860 Incidence *incidence = todo->relatedTo(); 866 Incidence *incidence = todo->relatedTo();
861 while ( incidence ) { 867 while ( incidence ) {
862 if ( incidence->typeID() == todoID ) { 868 if ( incidence->typeID() == todoID ) {
863 //qDebug("related %s ",incidence->summary().latin1() ); 869 //qDebug("related %s ",incidence->summary().latin1() );
864 if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) { 870 if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) {
865 //qDebug("related not found "); 871 //qDebug("related not found ");
866 todoList.remove( ); 872 todoList.remove( );
867 todo = todoList.current(); 873 todo = todoList.current();
868 next = false; 874 next = false;
869 incidence = 0; 875 incidence = 0;
870 876
871 } else { 877 } else {
872 //qDebug("related found "); 878 //qDebug("related found ");
873 incidence = incidence->relatedTo(); 879 incidence = incidence->relatedTo();
874 } 880 }
875 } else 881 } else
876 incidence = 0; 882 incidence = 0;
877 } 883 }
878 if ( next ) 884 if ( next )
879 todo = todoList.next(); 885 todo = todoList.next();
880 } 886 }
881 887
882 for(todo = todoList.first(); todo; todo = todoList.next()) { 888 for(todo = todoList.first(); todo; todo = todoList.next()) {
883 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 889 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
884 { 890 {
885 insertTodoItem(todo); 891 insertTodoItem(todo);
886 } 892 }
887 } 893 }
888 // Restore opened/closed state 894 // Restore opened/closed state
889 mTodoListView->blockSignals( true ); 895 mTodoListView->blockSignals( true );
890 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 896 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
891 mTodoListView->blockSignals( false ); 897 mTodoListView->blockSignals( false );
892 resetCurrentItem(); 898 resetCurrentItem();
893} 899}
894 900
895void KOTodoView::storeCurrentItem() 901void KOTodoView::storeCurrentItem()
896{ 902{
897 mCurItem = 0; 903 mCurItem = 0;
898 mCurItemRootParent = 0; 904 mCurItemRootParent = 0;
899 mCurItemParent = 0; 905 mCurItemParent = 0;
900 mCurItemAbove = 0; 906 mCurItemAbove = 0;
901 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 907 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
902 if (mActiveItem) { 908 if (mActiveItem) {
903 mCurItem = mActiveItem->todo(); 909 mCurItem = mActiveItem->todo();
904 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); 910 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
905 if ( activeItemAbove ) 911 if ( activeItemAbove )
906 mCurItemAbove = activeItemAbove->todo(); 912 mCurItemAbove = activeItemAbove->todo();
907 mCurItemRootParent = mCurItem; 913 mCurItemRootParent = mCurItem;
908 mCurItemParent = mCurItemRootParent->relatedTo(); 914 mCurItemParent = mCurItemRootParent->relatedTo();
909 while ( mCurItemRootParent->relatedTo() != 0 ) 915 while ( mCurItemRootParent->relatedTo() != 0 )
910 mCurItemRootParent = mCurItemRootParent->relatedTo(); 916 mCurItemRootParent = mCurItemRootParent->relatedTo();
911 } 917 }
912 mActiveItem = 0; 918 mActiveItem = 0;
913} 919}
914 920
915void KOTodoView::resetCurrentItem() 921void KOTodoView::resetCurrentItem()
916{ 922{
917 //mTodoListView->setFocus(); 923 //mTodoListView->setFocus();
918 KOTodoViewItem* foundItem = 0; 924 KOTodoViewItem* foundItem = 0;
919 KOTodoViewItem* foundItemRoot = 0; 925 KOTodoViewItem* foundItemRoot = 0;
920 KOTodoViewItem* foundItemParent = 0; 926 KOTodoViewItem* foundItemParent = 0;
921 KOTodoViewItem* foundItemAbove = 0; 927 KOTodoViewItem* foundItemAbove = 0;
922 if ( mTodoListView->firstChild () ) { 928 if ( mTodoListView->firstChild () ) {
923 if ( mCurItem ) { 929 if ( mCurItem ) {
924 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); 930 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild ();
925 while ( item ) { 931 while ( item ) {
926 if ( item->todo() == mCurItem ) { 932 if ( item->todo() == mCurItem ) {
927 foundItem = item; 933 foundItem = item;
928 break; 934 break;
929 } else if ( item->todo() == mCurItemAbove ) { 935 } else if ( item->todo() == mCurItemAbove ) {
930 foundItemAbove = item; 936 foundItemAbove = item;
931 937
932 } 938 }
933 if ( item->todo() == mCurItemRootParent ) { 939 if ( item->todo() == mCurItemRootParent ) {
934 foundItemRoot = item; 940 foundItemRoot = item;
935 } 941 }
936 if ( item->todo() == mCurItemParent ) { 942 if ( item->todo() == mCurItemParent ) {
937 foundItemParent = item; 943 foundItemParent = item;
938 } 944 }
939 item = (KOTodoViewItem*)item->itemBelow(); 945 item = (KOTodoViewItem*)item->itemBelow();
940 } 946 }
941 if ( ! foundItem ) { 947 if ( ! foundItem ) {
942 if ( foundItemParent ) { 948 if ( foundItemParent ) {
943 foundItem = foundItemParent; 949 foundItem = foundItemParent;
944 } else { 950 } else {
945 if ( foundItemRoot ) 951 if ( foundItemRoot )
946 foundItem = foundItemRoot; 952 foundItem = foundItemRoot;
947 else 953 else
948 foundItem = foundItemAbove; 954 foundItem = foundItemAbove;
949 } 955 }
950 } 956 }
951 } 957 }
952 if ( foundItem ) { 958 if ( foundItem ) {
953 mTodoListView->setSelected ( foundItem, true ); 959 mTodoListView->setSelected ( foundItem, true );
954 mTodoListView->setCurrentItem( foundItem ); 960 mTodoListView->setCurrentItem( foundItem );
955 mTodoListView->ensureItemVisible( foundItem ); 961 mTodoListView->ensureItemVisible( foundItem );
956 } else { 962 } else {
957 if ( mTodoListView->firstChild () ) { 963 if ( mTodoListView->firstChild () ) {
958 mTodoListView->setSelected ( mTodoListView->firstChild (), true ); 964 mTodoListView->setSelected ( mTodoListView->firstChild (), true );
959 mTodoListView->setCurrentItem( mTodoListView->firstChild () ); 965 mTodoListView->setCurrentItem( mTodoListView->firstChild () );
960 } 966 }
961 } 967 }
962 } 968 }
963 processSelectionChange(); 969 processSelectionChange();
964 QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); 970 QTimer::singleShot( 100, this, SLOT ( resetFocusToList() ));
965} 971}
966void KOTodoView::resetFocusToList() 972void KOTodoView::resetFocusToList()
967{ 973{
968 topLevelWidget()->setActiveWindow(); 974 topLevelWidget()->setActiveWindow();
969 mTodoListView->setFocus(); 975 mTodoListView->setFocus();
970} 976}
971//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; 977//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
972bool KOTodoView::checkTodo( Todo * todo ) 978bool KOTodoView::checkTodo( Todo * todo )
973{ 979{
974 980
975 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) 981 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
@@ -1222,490 +1228,490 @@ void KOTodoView::setNewPercentage(int index)
1222 mActiveItem->todo()->setCompleted(false); 1228 mActiveItem->todo()->setCompleted(false);
1223 } 1229 }
1224 mActiveItem->todo()->setPercentComplete(mPercentage[index]); 1230 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
1225 mActiveItem->construct(); 1231 mActiveItem->construct();
1226 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); 1232 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
1227 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1233 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1228 } 1234 }
1229 processSelectionChange(); 1235 processSelectionChange();
1230} 1236}
1231 1237
1232void KOTodoView::fillCategories () 1238void KOTodoView::fillCategories ()
1233{ 1239{
1234 mCategoryPopupMenu->clear(); 1240 mCategoryPopupMenu->clear();
1235 if ( ! mActiveItem ) return; 1241 if ( ! mActiveItem ) return;
1236 QStringList checkedCategories = mActiveItem->todo()->categories (); 1242 QStringList checkedCategories = mActiveItem->todo()->categories ();
1237 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 1243 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
1238 it != KOPrefs::instance()->mCustomCategories.end (); 1244 it != KOPrefs::instance()->mCustomCategories.end ();
1239 ++it) { 1245 ++it) {
1240 int index = mCategoryPopupMenu->insertItem (*it); 1246 int index = mCategoryPopupMenu->insertItem (*it);
1241 mCategory[index] = *it; 1247 mCategory[index] = *it;
1242 if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); 1248 if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true);
1243 } 1249 }
1244} 1250}
1245void KOTodoView::fillCal () 1251void KOTodoView::fillCal ()
1246{ 1252{
1247 mCalPopupMenu->clear(); 1253 mCalPopupMenu->clear();
1248 if (!mActiveItem) return; 1254 if (!mActiveItem) return;
1249 bool readO = mActiveItem->todo()->isReadOnly(); 1255 bool readO = mActiveItem->todo()->isReadOnly();
1250 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 1256 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
1251 while ( kkf ) { 1257 while ( kkf ) {
1252 int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber); 1258 int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber);
1253 if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) 1259 if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO )
1254 mCalPopupMenu->setItemEnabled( index, false ); 1260 mCalPopupMenu->setItemEnabled( index, false );
1255 mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID()); 1261 mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID());
1256 kkf = KOPrefs::instance()->mCalendars.next(); 1262 kkf = KOPrefs::instance()->mCalendars.next();
1257 } 1263 }
1258} 1264}
1259void KOTodoView::changedCal (int index ) 1265void KOTodoView::changedCal (int index )
1260{ 1266{
1261 if (!mActiveItem) return; 1267 if (!mActiveItem) return;
1262 mActiveItem->todo()->setCalID( index ); 1268 mActiveItem->todo()->setCalID( index );
1263 mActiveItem->construct(); 1269 mActiveItem->construct();
1264} 1270}
1265void KOTodoView::changedCategories(int index) 1271void KOTodoView::changedCategories(int index)
1266{ 1272{
1267 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1273 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1268 QStringList categories = mActiveItem->todo()->categories (); 1274 QStringList categories = mActiveItem->todo()->categories ();
1269 QString colcat = categories.first(); 1275 QString colcat = categories.first();
1270 if (categories.find (mCategory[index]) != categories.end ()) 1276 if (categories.find (mCategory[index]) != categories.end ())
1271 categories.remove (mCategory[index]); 1277 categories.remove (mCategory[index]);
1272 else 1278 else
1273 categories.insert (categories.end(), mCategory[index]); 1279 categories.insert (categories.end(), mCategory[index]);
1274 categories.sort (); 1280 categories.sort ();
1275 if ( !colcat.isEmpty() ) { 1281 if ( !colcat.isEmpty() ) {
1276 if ( categories.find ( colcat ) != categories.end () ) { 1282 if ( categories.find ( colcat ) != categories.end () ) {
1277 categories.remove( colcat ); 1283 categories.remove( colcat );
1278 categories.prepend( colcat ); 1284 categories.prepend( colcat );
1279 } 1285 }
1280 } 1286 }
1281 mActiveItem->todo()->setCategories (categories); 1287 mActiveItem->todo()->setCategories (categories);
1282 mActiveItem->construct(); 1288 mActiveItem->construct();
1283 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1289 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1284 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1290 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1285 } 1291 }
1286} 1292}
1287void KOTodoView::itemDoubleClicked(QListViewItem *item) 1293void KOTodoView::itemDoubleClicked(QListViewItem *item)
1288{ 1294{
1289 if ( pendingSubtodo != 0 ) { 1295 if ( pendingSubtodo != 0 ) {
1290 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1296 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1291 } 1297 }
1292 pendingSubtodo = 0; 1298 pendingSubtodo = 0;
1293 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1299 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1294 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); 1300 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() );
1295 //qDebug("ROW %d ", row); 1301 //qDebug("ROW %d ", row);
1296 if (!item) { 1302 if (!item) {
1297 newTodo(); 1303 newTodo();
1298 return; 1304 return;
1299 } else { 1305 } else {
1300 if ( row == 1 ) { 1306 if ( row == 1 ) {
1301 mActiveItem = (KOTodoViewItem *) item; 1307 mActiveItem = (KOTodoViewItem *) item;
1302 newSubTodo(); 1308 newSubTodo();
1303 return; 1309 return;
1304 } 1310 }
1305 if ( row == 5 || row == 6 || row == 2) { 1311 if ( row == 5 || row == 6 || row == 2) {
1306 mActiveItem = (KOTodoViewItem *) item; 1312 mActiveItem = (KOTodoViewItem *) item;
1307 Todo * t = mActiveItem->todo(); 1313 Todo * t = mActiveItem->todo();
1308 if ( t->isRunning() ) { 1314 if ( t->isRunning() ) {
1309 if ( t->runTime() < 15) { 1315 if ( t->runTime() < 15) {
1310 t->stopRunning(); 1316 t->stopRunning();
1311 mActiveItem->construct(); 1317 mActiveItem->construct();
1312 topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); 1318 topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!"));
1313 return; 1319 return;
1314 } 1320 }
1315 else 1321 else
1316 toggleRunningItem(); 1322 toggleRunningItem();
1317 return; 1323 return;
1318 } else { 1324 } else {
1319 t->setRunning( true ); 1325 t->setRunning( true );
1320 mActiveItem->construct(); 1326 mActiveItem->construct();
1321 topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); 1327 topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!"));
1322 return; 1328 return;
1323 } 1329 }
1324 } 1330 }
1325 } 1331 }
1326 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1332 if ( KOPrefs::instance()->mEditOnDoubleClick )
1327 editItem( item ); 1333 editItem( item );
1328 else 1334 else
1329 showItem( item , QPoint(), 0 ); 1335 showItem( item , QPoint(), 0 );
1330} 1336}
1331void KOTodoView::toggleRunningItem() 1337void KOTodoView::toggleRunningItem()
1332{ 1338{
1333 // qDebug("KOTodoView::toggleRunning() "); 1339 // qDebug("KOTodoView::toggleRunning() ");
1334 if ( ! mActiveItem ) 1340 if ( ! mActiveItem )
1335 return; 1341 return;
1336 Todo * t = mActiveItem->todo(); 1342 Todo * t = mActiveItem->todo();
1337 if ( t->isRunning() ) { 1343 if ( t->isRunning() ) {
1338 KOStopTodoPrefs tp ( t, this ); 1344 KOStopTodoPrefs tp ( t, this );
1339 if (QApplication::desktop()->width() <= 800 ){ 1345 if (QApplication::desktop()->width() <= 800 ){
1340 int wid = tp.width(); 1346 int wid = tp.width();
1341 int hei = tp.height(); 1347 int hei = tp.height();
1342 int xx = (QApplication::desktop()->width()-wid)/2; 1348 int xx = (QApplication::desktop()->width()-wid)/2;
1343 int yy = (QApplication::desktop()->height()-hei)/2; 1349 int yy = (QApplication::desktop()->height()-hei)/2;
1344 tp.setGeometry( xx,yy,wid,hei ); 1350 tp.setGeometry( xx,yy,wid,hei );
1345 } 1351 }
1346 tp.exec(); 1352 tp.exec();
1347 mActiveItem->construct(); 1353 mActiveItem->construct();
1348 } else { 1354 } else {
1349 KOStartTodoPrefs tp ( t->summary(), this ); 1355 KOStartTodoPrefs tp ( t->summary(), this );
1350 if (QApplication::desktop()->width() <= 800 ){ 1356 if (QApplication::desktop()->width() <= 800 ){
1351 int wid = tp.width(); 1357 int wid = tp.width();
1352 int hei = tp.height(); 1358 int hei = tp.height();
1353 int xx = (QApplication::desktop()->width()-wid)/2; 1359 int xx = (QApplication::desktop()->width()-wid)/2;
1354 int yy = (QApplication::desktop()->height()-hei)/2; 1360 int yy = (QApplication::desktop()->height()-hei)/2;
1355 tp.setGeometry( xx,yy,wid,hei ); 1361 tp.setGeometry( xx,yy,wid,hei );
1356 } 1362 }
1357 if ( !tp.exec() ) return; 1363 if ( !tp.exec() ) return;
1358 if ( tp.stopAll() ) { 1364 if ( tp.stopAll() ) {
1359 mCalendar->stopAllTodos(); 1365 mCalendar->stopAllTodos();
1360 t->setRunning( true ); 1366 t->setRunning( true );
1361 updateView(); 1367 updateView();
1362 } else { 1368 } else {
1363 t->setRunning( true ); 1369 t->setRunning( true );
1364 mActiveItem->construct(); 1370 mActiveItem->construct();
1365 } 1371 }
1366 } 1372 }
1367} 1373}
1368 1374
1369void KOTodoView::itemClicked(QListViewItem *item) 1375void KOTodoView::itemClicked(QListViewItem *item)
1370{ 1376{
1371 //qDebug("KOTodoView::itemClicked %d", item); 1377 //qDebug("KOTodoView::itemClicked %d", item);
1372 if (!item) { 1378 if (!item) {
1373 if ( pendingSubtodo != 0 ) { 1379 if ( pendingSubtodo != 0 ) {
1374 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1380 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1375 } 1381 }
1376 pendingSubtodo = 0; 1382 pendingSubtodo = 0;
1377 return; 1383 return;
1378 } 1384 }
1379 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1385 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1380 if ( pendingSubtodo != 0 ) { 1386 if ( pendingSubtodo != 0 ) {
1381 bool allowReparent = true; 1387 bool allowReparent = true;
1382 QListViewItem *par = item; 1388 QListViewItem *par = item;
1383 while ( par ) { 1389 while ( par ) {
1384 if ( par == pendingSubtodo ) { 1390 if ( par == pendingSubtodo ) {
1385 allowReparent = false; 1391 allowReparent = false;
1386 break; 1392 break;
1387 } 1393 }
1388 par = par->parent(); 1394 par = par->parent();
1389 } 1395 }
1390 if ( !allowReparent ) { 1396 if ( !allowReparent ) {
1391 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1397 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1392 pendingSubtodo = 0; 1398 pendingSubtodo = 0;
1393 } else { 1399 } else {
1394 Todo* newParent = todoItem->todo(); 1400 Todo* newParent = todoItem->todo();
1395 Todo* newSub = pendingSubtodo->todo(); 1401 Todo* newSub = pendingSubtodo->todo();
1396 pendingSubtodo = 0; 1402 pendingSubtodo = 0;
1397 emit reparentTodoSignal( newParent,newSub ); 1403 emit reparentTodoSignal( newParent,newSub );
1398 return; 1404 return;
1399 } 1405 }
1400 } 1406 }
1401 1407
1402} 1408}
1403 1409
1404void KOTodoView::setDocumentId( const QString &id ) 1410void KOTodoView::setDocumentId( const QString &id )
1405{ 1411{
1406 1412
1407 mDocPrefs->setDoc( id ); 1413 mDocPrefs->setDoc( id );
1408} 1414}
1409 1415
1410void KOTodoView::itemStateChanged( QListViewItem *item ) 1416void KOTodoView::itemStateChanged( QListViewItem *item )
1411{ 1417{
1412 if (!item) return; 1418 if (!item) return;
1413 1419
1414 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1420 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1415 1421
1416// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1422// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1417 1423
1418 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1424 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1419} 1425}
1420 1426
1421void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1427void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1422{ 1428{
1423 mTodoListView->saveLayout(config,group); 1429 mTodoListView->saveLayout(config,group);
1424} 1430}
1425 1431
1426void KOTodoView::restoreLayout(KConfig *config, const QString &group) 1432void KOTodoView::restoreLayout(KConfig *config, const QString &group)
1427{ 1433{
1428 mTodoListView->restoreLayout(config,group); 1434 mTodoListView->restoreLayout(config,group);
1429} 1435}
1430 1436
1431void KOTodoView::processSelectionChange() 1437void KOTodoView::processSelectionChange()
1432{ 1438{
1433// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 1439// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
1434 1440
1435 KOTodoViewItem *item = 1441 KOTodoViewItem *item =
1436 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 1442 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
1437 1443
1438 if ( !item ) { 1444 if ( !item ) {
1439 emit incidenceSelected( 0 ); 1445 emit incidenceSelected( 0 );
1440 mNewSubBut->setEnabled( false ); 1446 mNewSubBut->setEnabled( false );
1441 } else { 1447 } else {
1442 emit incidenceSelected( item->todo() ); 1448 emit incidenceSelected( item->todo() );
1443 mNewSubBut->setEnabled( true ); 1449 mNewSubBut->setEnabled( true );
1444 } 1450 }
1445} 1451}
1446 1452
1447void KOTodoView::modified(bool b) 1453void KOTodoView::modified(bool b)
1448{ 1454{
1449 emit isModified(b); 1455 emit isModified(b);
1450} 1456}
1451void KOTodoView::setTodoModified( Todo* todo ) 1457void KOTodoView::setTodoModified( Todo* todo )
1452{ 1458{
1453 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 1459 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
1454} 1460}
1455void KOTodoView::clearSelection() 1461void KOTodoView::clearSelection()
1456{ 1462{
1457 mTodoListView->selectAll( false ); 1463 mTodoListView->selectAll( false );
1458} 1464}
1459void KOTodoView::setAllOpen() 1465void KOTodoView::setAllOpen()
1460{ 1466{
1461 if ( isFlatDisplay ) { 1467 if ( isFlatDisplay ) {
1462 isFlatDisplay = false; 1468 isFlatDisplay = false;
1463 mPopupMenu->setItemChecked( 8,false ); 1469 mPopupMenu->setItemChecked( 8,false );
1464 updateView(); 1470 updateView();
1465 } else { 1471 } else {
1466 storeCurrentItem(); 1472 storeCurrentItem();
1467 } 1473 }
1468 setOpen(mTodoListView->firstChild(), true); 1474 setOpen(mTodoListView->firstChild(), true);
1469 resetCurrentItem(); 1475 resetCurrentItem();
1470} 1476}
1471void KOTodoView::setAllClose() 1477void KOTodoView::setAllClose()
1472{ 1478{
1473 if ( isFlatDisplay ) { 1479 if ( isFlatDisplay ) {
1474 isFlatDisplay = false; 1480 isFlatDisplay = false;
1475 mPopupMenu->setItemChecked( 8,false ); 1481 mPopupMenu->setItemChecked( 8,false );
1476 updateView(); 1482 updateView();
1477 } else { 1483 } else {
1478 storeCurrentItem(); 1484 storeCurrentItem();
1479 } 1485 }
1480 setOpen(mTodoListView->firstChild(), false); 1486 setOpen(mTodoListView->firstChild(), false);
1481 resetCurrentItem(); 1487 resetCurrentItem();
1482} 1488}
1483void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) 1489void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
1484{ 1490{
1485 1491
1486 while ( item ) { 1492 while ( item ) {
1487 setOpen( item->firstChild(), setOpenI ); 1493 setOpen( item->firstChild(), setOpenI );
1488 item->setOpen( setOpenI ); 1494 item->setOpen( setOpenI );
1489 item = item->nextSibling(); 1495 item = item->nextSibling();
1490 } 1496 }
1491} 1497}
1492 1498
1493void KOTodoView::displayAllFlat() 1499void KOTodoView::displayAllFlat()
1494{ 1500{
1495 storeCurrentItem(); 1501 storeCurrentItem();
1496 pendingSubtodo = 0; 1502 pendingSubtodo = 0;
1497 if ( mBlockUpdate ) { 1503 if ( mBlockUpdate ) {
1498 return; 1504 return;
1499 } 1505 }
1500 mPopupMenu->setItemChecked( 8,true ); 1506 mPopupMenu->setItemChecked( 8,true );
1501 isFlatDisplay = true; 1507 isFlatDisplay = true;
1502 QPtrList<Todo> todoList = calendar()->todos(); 1508 QPtrList<Todo> todoList = calendar()->todos();
1503 mTodoMap.clear(); 1509 mTodoMap.clear();
1504 mTodoListView->clear(); 1510 mTodoListView->clear();
1505 Todo *todo; 1511 Todo *todo;
1506 for(todo = todoList.first(); todo; todo = todoList.next()) { 1512 for(todo = todoList.first(); todo; todo = todoList.next()) {
1507 if ( checkTodo( todo ) ) { 1513 if ( checkTodo( todo ) ) {
1508 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 1514 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
1509 mTodoMap.insert(todo,todoItem); 1515 mTodoMap.insert(todo,todoItem);
1510 } 1516 }
1511 } 1517 }
1512 resetCurrentItem(); 1518 resetCurrentItem();
1513} 1519}
1514 1520
1515void KOTodoView::setAllFlat() 1521void KOTodoView::setAllFlat()
1516{ 1522{
1517 if ( isFlatDisplay ) { 1523 if ( isFlatDisplay ) {
1518 isFlatDisplay = false; 1524 isFlatDisplay = false;
1519 mPopupMenu->setItemChecked( 8,false ); 1525 mPopupMenu->setItemChecked( 8,false );
1520 updateView(); 1526 updateView();
1521 return; 1527 return;
1522 } 1528 }
1523 displayAllFlat(); 1529 displayAllFlat();
1524} 1530}
1525 1531
1526void KOTodoView::purgeCompleted() 1532void KOTodoView::purgeCompleted()
1527{ 1533{
1528 emit purgeCompletedSignal(); 1534 emit purgeCompletedSignal();
1529 1535
1530} 1536}
1531void KOTodoView::toggleQuickTodo() 1537void KOTodoView::toggleQuickTodo()
1532{ 1538{
1533 if ( mQuickBar->isVisible() ) { 1539 if ( mQuickBar->isVisible() ) {
1534 mQuickBar->hide(); 1540 mQuickBar->hide();
1535 KOPrefs::instance()->mEnableQuickTodo = false; 1541 KOPrefs::instance()->mEnableQuickTodo = false;
1536 } 1542 }
1537 else { 1543 else {
1538 mQuickBar->show(); 1544 mQuickBar->show();
1539 KOPrefs::instance()->mEnableQuickTodo = true; 1545 KOPrefs::instance()->mEnableQuickTodo = true;
1540 } 1546 }
1541 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 1547 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
1542 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 1548 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
1543} 1549}
1544 1550
1545void KOTodoView::toggleRunning() 1551void KOTodoView::toggleRunning()
1546{ 1552{
1547 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; 1553 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos;
1548 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 1554 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
1549 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 1555 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
1550 updateView(); 1556 updateView();
1551 if ( KOPrefs::instance()->mHideNonStartedTodos ) 1557 if ( KOPrefs::instance()->mHideNonStartedTodos )
1552 topLevelWidget()->setCaption(i18n("Hide not Running")); 1558 topLevelWidget()->setCaption(i18n("Hide not Running"));
1553 else 1559 else
1554 topLevelWidget()->setCaption(i18n("Show not Running")); 1560 topLevelWidget()->setCaption(i18n("Show not Running"));
1555} 1561}
1556 1562
1557void KOTodoView::toggleCompleted() 1563void KOTodoView::toggleCompleted()
1558{ 1564{
1559 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; 1565 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo;
1560 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 1566 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
1561 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 1567 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
1562 updateView(); 1568 updateView();
1563 if ( KOPrefs::instance()->mShowCompletedTodo ) 1569 if ( KOPrefs::instance()->mShowCompletedTodo )
1564 topLevelWidget()->setCaption(i18n("Show Completed")); 1570 topLevelWidget()->setCaption(i18n("Show Completed"));
1565 else 1571 else
1566 topLevelWidget()->setCaption(i18n("Hide Completed")); 1572 topLevelWidget()->setCaption(i18n("Hide Completed"));
1567} 1573}
1568 1574
1569void KOTodoView::addQuickTodo() 1575void KOTodoView::addQuickTodo()
1570{ 1576{
1571 addQuickTodoPar( 0 ); 1577 addQuickTodoPar( 0 );
1572} 1578}
1573void KOTodoView::addQuickTodoPar( Todo * parentTodo) 1579void KOTodoView::addQuickTodoPar( Todo * parentTodo)
1574{ 1580{
1575 Todo *todo = new Todo(); 1581 Todo *todo = new Todo();
1576 todo->setSummary(mQuickAdd->text()); 1582 todo->setSummary(mQuickAdd->text());
1577 todo->setOrganizer(KOPrefs::instance()->email()); 1583 todo->setOrganizer(KOPrefs::instance()->email());
1578 if ( parentTodo ) { 1584 if ( parentTodo ) {
1579 todo->setRelatedTo(parentTodo); 1585 todo->setRelatedTo(parentTodo);
1580 1586
1581 todo->setCategories (parentTodo->categoriesStr ()); 1587 todo->setCategories (parentTodo->categoriesStr ());
1582 todo->setSecrecy (parentTodo->secrecy ()); 1588 todo->setSecrecy (parentTodo->secrecy ());
1583 if ( parentTodo->priority() < 3 ) 1589 if ( parentTodo->priority() < 3 )
1584 todo->setPriority( parentTodo->priority() ); 1590 todo->setPriority( parentTodo->priority() );
1585 todo->setCalID( parentTodo->calID() ); 1591 todo->setCalID( parentTodo->calID() );
1586 } else { 1592 } else {
1587 CalFilter * cf = mCalendar->filter(); 1593 CalFilter * cf = mCalendar->filter();
1588 if ( cf ) { 1594 if ( cf ) {
1589 if ( cf->isEnabled()&& cf->showCategories()) { 1595 if ( cf->isEnabled()&& cf->showCategories()) {
1590 todo->setCategories(cf->categoryList()); 1596 todo->setCategories(cf->categoryList());
1591 } 1597 }
1592 if ( cf->isEnabled() ) 1598 if ( cf->isEnabled() )
1593 todo->setSecrecy( cf->getSecrecy()); 1599 todo->setSecrecy( cf->getSecrecy());
1594 } 1600 }
1595 } 1601 }
1596 mCalendar->addTodo(todo); 1602 mCalendar->addTodo(todo);
1597 mQuickAdd->setText(""); 1603 mQuickAdd->setText("");
1598 todoModified (todo, KOGlobals::EVENTADDED ); 1604 todoModified (todo, KOGlobals::EVENTADDED );
1599 updateView(); 1605 updateView();
1600 1606
1601} 1607}
1602void KOTodoView::keyPressEvent ( QKeyEvent * e ) 1608void KOTodoView::keyPressEvent ( QKeyEvent * e )
1603{ 1609{
1604 // e->ignore(); 1610 // e->ignore();
1605 //return; 1611 //return;
1606 //qDebug("KOTodoView::keyPressEvent ");
1607 if ( !isVisible() ) { 1612 if ( !isVisible() ) {
1608 e->ignore(); 1613 e->ignore();
1609 return; 1614 return;
1610 } 1615 }
1611 switch ( e->key() ) { 1616 switch ( e->key() ) {
1612 case Qt::Key_Down: 1617 case Qt::Key_Down:
1613 case Qt::Key_Up: 1618 case Qt::Key_Up:
1614 QWidget::keyPressEvent ( e ); 1619 // KOrg::BaseView::keyPressEvent ( e );
1620 e->ignore();
1615 break; 1621 break;
1616 1622
1617 case Qt::Key_Q: 1623 case Qt::Key_Q:
1618 1624
1619 1625
1620 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) { 1626 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) {
1621 e->ignore(); 1627 e->ignore();
1622 break; 1628 break;
1623 } 1629 }
1624 toggleQuickTodo(); 1630 toggleQuickTodo();
1625 break; 1631 break;
1626 case Qt::Key_U: 1632 case Qt::Key_U:
1627 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1633 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1628 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1634 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1629 unparentTodo(); 1635 unparentTodo();
1630 e->accept(); 1636 e->accept();
1631 } else 1637 } else
1632 e->ignore(); 1638 e->ignore();
1633 break; 1639 break;
1634 case Qt::Key_S: 1640 case Qt::Key_S:
1635 if ( e->state() == Qt::ControlButton ) { 1641 if ( e->state() == Qt::ControlButton ) {
1636 e->ignore(); 1642 e->ignore();
1637 break; 1643 break;
1638 } 1644 }
1639 if ( e->state() == Qt::ShiftButton ) { 1645 if ( e->state() == Qt::ShiftButton ) {
1640 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1646 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1641 reparentTodo(); 1647 reparentTodo();
1642 e->accept(); 1648 e->accept();
1643 } else 1649 } else
1644 e->ignore(); 1650 e->ignore();
1645 break; 1651 break;
1646 case Qt::Key_P: 1652 case Qt::Key_P:
1647 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1653 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1648 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1654 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1649 if ( pendingSubtodo ) 1655 if ( pendingSubtodo )
1650 itemClicked(mActiveItem); 1656 itemClicked(mActiveItem);
1651 e->accept(); 1657 e->accept();
1652 } else 1658 } else
1653 e->ignore(); 1659 e->ignore();
1654 break; 1660 break;
1655 case Qt::Key_Escape: 1661 case Qt::Key_Escape:
1656 if ( pendingSubtodo ) { 1662 if ( pendingSubtodo ) {
1657 itemClicked(0); 1663 itemClicked(0);
1658 e->accept(); 1664 e->accept();
1659 } else 1665 } else
1660 e->ignore(); 1666 e->ignore();
1661 break; 1667 break;
1662 default: 1668 default:
1663 e->ignore(); 1669 e->ignore();
1664 } 1670 }
1665 1671
1666 if ( true ) { 1672 if ( true ) {
1667 if ( e->key() == Qt::Key_I ) { 1673 if ( e->key() == Qt::Key_I ) {
1668 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); 1674 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem();
1669 if ( cn ) { 1675 if ( cn ) {
1670 mActiveItem = cn; 1676 mActiveItem = cn;
1671 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 1677 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
1672 if ( ci ){ 1678 if ( ci ){
1673 showTodo(); 1679 showTodo();
1674 cn = (KOTodoViewItem*)cn->itemBelow(); 1680 cn = (KOTodoViewItem*)cn->itemBelow();
1675 if ( cn ) { 1681 if ( cn ) {
1676 mTodoListView->setCurrentItem ( cn ); 1682 mTodoListView->setCurrentItem ( cn );
1677 mTodoListView->ensureItemVisible ( cn ); 1683 mTodoListView->ensureItemVisible ( cn );
1678 } 1684 }
1679 1685
1680 } 1686 }
1681 } 1687 }
1682 e->accept(); 1688 e->accept();
1683 1689
1684 } 1690 }
1685 1691
1686 } 1692 }
1687 1693
1688} 1694}
1689void KOTodoView::updateTodo( Todo * t, int type ) 1695void KOTodoView::updateTodo( Todo * t, int type )
1690{ 1696{
1691 if ( mBlockUpdate) 1697 if ( mBlockUpdate)
1692 return; 1698 return;
1693 1699
1694 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 1700 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
1695 itemIterator = mTodoMap.find(t); 1701 itemIterator = mTodoMap.find(t);
1696 if (itemIterator != mTodoMap.end()) { 1702 if (itemIterator != mTodoMap.end()) {
1697 (*itemIterator)->construct(); 1703 (*itemIterator)->construct();
1698 } else { 1704 } else {
1699 if ( type == KOGlobals::EVENTADDED ) { 1705 if ( type == KOGlobals::EVENTADDED ) {
1700 insertTodoItem( t ); 1706 insertTodoItem( t );
1701 } 1707 }
1702 } 1708 }
1703 1709
1704} 1710}
1705 1711
1706void KOTodoView::todoModified(Todo * t , int p ) 1712void KOTodoView::todoModified(Todo * t , int p )
1707{ 1713{
1708 mBlockUpdate = true; 1714 mBlockUpdate = true;
1709 emit todoModifiedSignal ( t, p ); 1715 emit todoModifiedSignal ( t, p );
1710 mBlockUpdate = false; 1716 mBlockUpdate = false;
1711} 1717}
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 0cf6e4c..bdef94c 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -1,526 +1,576 @@
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 19
20#include <klocale.h> 20#include <klocale.h>
21#include <kdebug.h> 21#include <kdebug.h>
22#include <qapp.h> 22#include <qapp.h>
23#include <kglobal.h> 23#include <kglobal.h>
24 24
25#include <kiconloader.h> 25#include <kiconloader.h>
26#include "kotodoviewitem.h" 26#include "kotodoviewitem.h"
27#include "kotodoview.h" 27#include "kotodoview.h"
28#include "koprefs.h" 28#include "koprefs.h"
29 29
30KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) 30KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo)
31 : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) 31 : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
32{ 32{
33 construct(); 33 construct();
34} 34}
35 35
36KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) 36KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo )
37 : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) 37 : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
38{ 38{
39 construct(); 39 construct();
40} 40}
41 41
42QString KOTodoViewItem::key(int column,bool) const 42QString KOTodoViewItem::key(int column,bool) const
43{ 43{
44 QMap<int,QString>::ConstIterator it = mKeyMap.find(column); 44 QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
45 if (it == mKeyMap.end()) { 45 if (it == mKeyMap.end()) {
46 return text(column).lower(); 46 return text(column).lower();
47 } else { 47 } else {
48 return *it; 48 return *it;
49 } 49 }
50} 50}
51 51
52void KOTodoViewItem:: setup() 52void KOTodoViewItem:: setup()
53{ 53{
54 54
55 int h = 20; 55 int h = 20;
56 if ( listView () ) { 56 if ( listView () ) {
57 QFontMetrics fm ( listView ()->font () ); 57 QFontMetrics fm ( listView ()->font () );
58 h = fm.height(); 58 h = fm.height();
59 } 59 }
60 setHeight( h ); 60 setHeight( h );
61 61
62} 62}
63void KOTodoViewItem::setSortKey(int column,const QString &key) 63void KOTodoViewItem::setSortKey(int column,const QString &key)
64{ 64{
65 mKeyMap.insert(column,key); 65 mKeyMap.insert(column,key);
66} 66}
67 67
68#if QT_VERSION >= 0x030000 68#if QT_VERSION >= 0x030000
69void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, 69void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w,
70 int y,int h) 70 int y,int h)
71{ 71{
72 QListViewItem::paintBranches(p,cg,w,y,h); 72 QListViewItem::paintBranches(p,cg,w,y,h);
73} 73}
74#else 74#else
75#endif 75#endif
76 76
77void KOTodoViewItem::construct() 77void KOTodoViewItem::construct()
78{ 78{
79 // qDebug("KOTodoViewItem::construct() "); 79 // qDebug("KOTodoViewItem::construct() ");
80 m_init = true; 80 m_init = true;
81 QString keyd = "=="; 81 QString keyd = "==";
82 QString keyt = "=="; 82 QString keyt = "==";
83 QString skeyd = "=="; 83 QString skeyd = "==";
84 QString skeyt = "=="; 84 QString skeyt = "==";
85 85
86 setOn(mTodo->isCompleted()); 86 setOn(mTodo->isCompleted());
87 setText(0,mTodo->summary()); 87 setText(0,mTodo->summary());
88 setText(1,QString::number(mTodo->priority())); 88 setText(1,QString::number(mTodo->priority()));
89 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); 89 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
90 if (mTodo->percentComplete()<100) { 90 if (mTodo->percentComplete()<100) {
91 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 91 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
92 else setSortKey(2,QString::number(mTodo->percentComplete())); 92 else setSortKey(2,QString::number(mTodo->percentComplete()));
93 } 93 }
94 else { 94 else {
95 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 95 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
96 else setSortKey(2,QString::number(99)); 96 else setSortKey(2,QString::number(99));
97 } 97 }
98 if (mTodo->hasDueDate()) { 98 if (mTodo->hasDueDate()) {
99 setText(3, mTodo->dtDueDateStr()); 99 setText(3, mTodo->dtDueDateStr());
100 QDate d = mTodo->dtDue().date(); 100 QDate d = mTodo->dtDue().date();
101 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 101 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
102 // setSortKey(3,keyd); 102 // setSortKey(3,keyd);
103 if (mTodo->doesFloat()) { 103 if (mTodo->doesFloat()) {
104 setText(4,""); 104 setText(4,"");
105 } 105 }
106 else { 106 else {
107 setText(4,mTodo->dtDueTimeStr()); 107 setText(4,mTodo->dtDueTimeStr());
108 QTime t = mTodo->dtDue().time(); 108 QTime t = mTodo->dtDue().time();
109 keyt.sprintf("%02d%02d",t.hour(),t.minute()); 109 keyt.sprintf("%02d%02d",t.hour(),t.minute());
110 //setSortKey(4,keyt); 110 //setSortKey(4,keyt);
111 } 111 }
112 } else { 112 } else {
113 setText(3,""); 113 setText(3,"");
114 setText(4,""); 114 setText(4,"");
115 } 115 }
116 setSortKey(3,keyd); 116 setSortKey(3,keyd);
117 setSortKey(4,keyt); 117 setSortKey(4,keyt);
118 118
119 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); 119 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt);
120 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 120 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
121 121
122 122
123 123
124 keyd = ""; 124 keyd = "";
125 keyt = ""; 125 keyt = "";
126 126
127 if (mTodo->isRunning() ) { 127 if (mTodo->isRunning() ) {
128 QDate d = mTodo->runStart().date(); 128 QDate d = mTodo->runStart().date();
129 QTime t = mTodo->runStart().time(); 129 QTime t = mTodo->runStart().time();
130 skeyt.sprintf("%02d%02d",t.hour(),t.minute()); 130 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
131 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 131 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
132 keyd = KGlobal::locale()->formatDate( d , true); 132 keyd = KGlobal::locale()->formatDate( d , true);
133 keyt = KGlobal::locale()->formatTime( t ); 133 keyt = KGlobal::locale()->formatTime( t );
134 134
135 } else { 135 } else {
136 136
137 if (mTodo->hasStartDate()) { 137 if (mTodo->hasStartDate()) {
138 keyd = mTodo->dtStartDateStr(); 138 keyd = mTodo->dtStartDateStr();
139 QDate d = mTodo->dtStart().date(); 139 QDate d = mTodo->dtStart().date();
140 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 140 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
141 141
142 if ( !mTodo->doesFloat()) { 142 if ( !mTodo->doesFloat()) {
143 keyt = mTodo->dtStartTimeStr(); 143 keyt = mTodo->dtStartTimeStr();
144 QTime t = mTodo->dtStart().time(); 144 QTime t = mTodo->dtStart().time();
145 skeyt.sprintf("%02d%02d",t.hour(),t.minute()); 145 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
146 146
147 } 147 }
148 148
149 } 149 }
150 } 150 }
151 setText(5,keyd); 151 setText(5,keyd);
152 setText(6,keyt); 152 setText(6,keyt);
153 setSortKey(5,skeyd); 153 setSortKey(5,skeyd);
154 setSortKey(6,skeyt); 154 setSortKey(6,skeyt);
155 155
156 setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); 156 //setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No"));
157 setText(8,mTodo->categoriesStr()); 157 setText(7,mTodo->categoriesStr());
158 setText(9,KOPrefs::instance()->calName( mTodo->calID())); 158 setText(8,KOPrefs::instance()->calName( mTodo->calID()));
159 159 setText(9, KGlobal::locale()->formatDateTime( mTodo->lastModified(), true, true ));
160 setText(10, KGlobal::locale()->formatDateTime( mTodo->created(), true, true ));
161 setText(11, KGlobal::locale()->formatDateTime( mTodo->lastModifiedSub(), true, true ));
162 QString key;
163 QDate d = mTodo->lastModified().date();
164 QTime t = mTodo->lastModified().time();
165 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() );
166 setSortKey(9,key);
167 d = mTodo->created().date();
168 t = mTodo->created().time();
169 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() );
170 setSortKey(10,key);
171 d = mTodo->lastModifiedSub().date();
172 t = mTodo->lastModifiedSub().time();
173 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() );
174 setSortKey(11,key);
175
160#if 0 176#if 0
161 // Find sort id in description. It's the text behind the last '#' character 177 // Find sort id in description. It's the text behind the last '#' character
162 // found in the description. White spaces are removed from beginning and end 178 // found in the description. White spaces are removed from beginning and end
163 // of sort id. 179 // of sort id.
164 int pos = mTodo->description().findRev('#'); 180 int pos = mTodo->description().findRev('#');
165 if (pos < 0) { 181 if (pos < 0) {
166 setText(6,""); 182 setText(6,"");
167 } else { 183 } else {
168 QString str = mTodo->description().mid(pos+1); 184 QString str = mTodo->description().mid(pos+1);
169 str.stripWhiteSpace(); 185 str.stripWhiteSpace();
170 setText(6,str); 186 setText(6,str);
171 } 187 }
172#endif 188#endif
173 189
174 m_known = false; 190 m_known = false;
175 m_init = false; 191 m_init = false;
176 192
177 setMyPixmap(); 193 setMyPixmap();
178 194
179} 195}
180void KOTodoViewItem::setMyPixmap() 196void KOTodoViewItem::setMyPixmap()
181{ 197{
182 int size = 5; 198 int size = 5;
183 QPixmap pixi = QPixmap( 1, 1 ); 199 QPixmap pixi = QPixmap( 1, 1 );
184 // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { 200 // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) {
185// pixi = SmallIcon("redcross16"); 201// pixi = SmallIcon("redcross16");
186// } else { 202// } else {
187 QPainter p; 203 QPainter p;
188 204
189 int pixSize = 0; 205 int pixSize = 0;
190 QPixmap pPix = QPixmap( size, size ); 206 QPixmap pPix = QPixmap( size, size );
191 if ( mTodo->description().length() > 0 ) { 207 if ( mTodo->description().length() > 0 ) {
192 pixi.resize(size, pixSize+size); 208 pixi.resize(size, pixSize+size);
193 pPix.fill( Qt::darkGreen ); 209 pPix.fill( Qt::darkGreen );
194 p.begin( &pixi ); 210 p.begin( &pixi );
195 p. drawPixmap ( 0, pixSize, pPix); 211 p. drawPixmap ( 0, pixSize, pPix);
196 p.end(); 212 p.end();
197 pixSize += size; 213 pixSize += size;
198 } 214 }
199 if ( mTodo->isAlarmEnabled() && mTodo->alarmEnabled()) { 215 if ( mTodo->isAlarmEnabled() && mTodo->alarmEnabled()) {
200 pixi.resize(size, pixSize+size); 216 pixi.resize(size, pixSize+size);
201 pPix.fill( Qt::red ); 217 pPix.fill( Qt::red );
202 p.begin( &pixi ); 218 p.begin( &pixi );
203 p. drawPixmap ( 0, pixSize, pPix); 219 p. drawPixmap ( 0, pixSize, pPix);
204 p.end(); 220 p.end();
205 pixSize += size; 221 pixSize += size;
206 } 222 }
207 if ( mTodo->doesRecur() ) { 223 if ( mTodo->doesRecur() ) {
208 pixi.resize(size, pixSize+size); 224 pixi.resize(size, pixSize+size);
209 pPix.fill( Qt::blue ); 225 pPix.fill( Qt::blue );
210 p.begin( &pixi ); 226 p.begin( &pixi );
211 p. drawPixmap ( 0, pixSize, pPix); 227 p. drawPixmap ( 0, pixSize, pPix);
212 p.end(); 228 p.end();
213 pixSize += size; 229 pixSize += size;
214 } 230 }
215 // } 231 // }
216 if ( pixi.width() > 1 ) { 232 if ( pixi.width() > 1 ) {
217 setPixmap ( 0,pixi ) ; 233 setPixmap ( 0,pixi ) ;
218 } else { 234 } else {
219 setPixmap ( 0,QPixmap() ) ; 235 setPixmap ( 0,QPixmap() ) ;
220 } 236 }
221} 237}
222void KOTodoViewItem::stateChange(bool state) 238void KOTodoViewItem::stateChange(bool state)
223{ 239{
224 // qDebug("KOTodoViewItem::stateChange %d ", state); 240 // qDebug("KOTodoViewItem::stateChange %d ", state);
225 // do not change setting on startup 241 // do not change setting on startup
226 if ( m_init ) return; 242 if ( m_init ) return;
227 if (isOn()!=state) { 243 if (isOn()!=state) {
228 setOn(state); 244 setOn(state);
229 //qDebug("SETON "); 245 //qDebug("SETON ");
230 return; 246 return;
231 } 247 }
232 if ( mTodo->isCompleted() == state ) { 248 if ( mTodo->isCompleted() == state ) {
233 //qDebug("STATECHANGE:nothing to do "); 249 //qDebug("STATECHANGE:nothing to do ");
234 return; 250 return;
235 } 251 }
236 QString keyd = "=="; 252 QString keyd = "==";
237 QString keyt = "=="; 253 QString keyt = "==";
238 //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); 254 //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1());
239 if ( mTodo->doesRecur() ){ 255 if ( mTodo->doesRecur() ){
240 QDateTime start = mTodo->dtStart(); 256 QDateTime start = mTodo->dtStart();
241 mTodo->setCompleted(state); 257 mTodo->setCompleted(state);
242 if ( start != mTodo->dtStart() ) { 258 if ( start != mTodo->dtStart() ) {
243 if ( state && !mTodo->isCompleted() ) { 259 if ( state && !mTodo->isCompleted() ) {
244 setOn( false ); 260 setOn( false );
245 state = false; 261 state = false;
246 } 262 }
247 } 263 }
248 } else 264 } else
249 mTodo->setCompleted(state); 265 mTodo->setCompleted(state);
250 266
251 if (state) mTodo->setCompleted(QDateTime::currentDateTime()); 267 if (state) mTodo->setCompleted(QDateTime::currentDateTime());
252 268
253 if (mTodo->hasDueDate()) { 269 if (mTodo->hasDueDate()) {
254 setText(3, mTodo->dtDueDateStr()); 270 setText(3, mTodo->dtDueDateStr());
255 QDate d = mTodo->dtDue().date(); 271 QDate d = mTodo->dtDue().date();
256 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 272 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
257 setSortKey(3,keyd); 273 setSortKey(3,keyd);
258 if (mTodo->doesFloat()) { 274 if (mTodo->doesFloat()) {
259 setText(4,""); 275 setText(4,"");
260 } 276 }
261 else { 277 else {
262 setText(4,mTodo->dtDueTimeStr()); 278 setText(4,mTodo->dtDueTimeStr());
263 QTime t = mTodo->dtDue().time(); 279 QTime t = mTodo->dtDue().time();
264 keyt.sprintf("%02d%02d",t.hour(),t.minute()); 280 keyt.sprintf("%02d%02d",t.hour(),t.minute());
265 setSortKey(4,keyt); 281 setSortKey(4,keyt);
266 } 282 }
267 } 283 }
268 if (mTodo->hasStartDate()) { 284 if (mTodo->hasStartDate()) {
269 QString skeyt = "=="; 285 QString skeyt = "==";
270 QString skeyd = "=="; 286 QString skeyd = "==";
271 setText(5, mTodo->dtStartDateStr()); 287 setText(5, mTodo->dtStartDateStr());
272 QDate d = mTodo->dtStart().date(); 288 QDate d = mTodo->dtStart().date();
273 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 289 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
274 290
275 if (mTodo->doesFloat()) { 291 if (mTodo->doesFloat()) {
276 setText(6,""); 292 setText(6,"");
277 } 293 }
278 else { 294 else {
279 setText(6,mTodo->dtStartTimeStr()); 295 setText(6,mTodo->dtStartTimeStr());
280 QTime t = mTodo->dtStart().time(); 296 QTime t = mTodo->dtStart().time();
281 skeyt.sprintf("%02d%02d",t.hour(),t.minute()); 297 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
282 298
283 } 299 }
284 setSortKey(5,skeyd); 300 setSortKey(5,skeyd);
285 setSortKey(6,skeyt); 301 setSortKey(6,skeyt);
286 } 302 }
287 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); 303 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt);
288 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 304 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
289 305
290 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); 306 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
291 if (mTodo->percentComplete()<100) { 307 if (mTodo->percentComplete()<100) {
292 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 308 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
293 else setSortKey(2,QString::number(mTodo->percentComplete())); 309 else setSortKey(2,QString::number(mTodo->percentComplete()));
294 } 310 }
295 else { 311 else {
296 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 312 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
297 else setSortKey(2,QString::number(99)); 313 else setSortKey(2,QString::number(99));
298 } 314 }
299 if ( state ) { 315 if ( state ) {
300 QListViewItem * myChild = firstChild(); 316 QListViewItem * myChild = firstChild();
301 KOTodoViewItem *item; 317 KOTodoViewItem *item;
302 while( myChild ) { 318 while( myChild ) {
303 //qDebug("stateCH "); 319 //qDebug("stateCH ");
304 item = static_cast<KOTodoViewItem*>(myChild); 320 item = static_cast<KOTodoViewItem*>(myChild);
305 item->stateChange(state); 321 item->stateChange(state);
306 myChild = myChild->nextSibling(); 322 myChild = myChild->nextSibling();
307 } 323 }
308 } else { 324 } else {
309 QListViewItem * myChild = parent(); 325 QListViewItem * myChild = parent();
310 if ( myChild ) 326 if ( myChild )
311 (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); 327 (static_cast<KOTodoViewItem*>(myChild))->stateChange(state);
312 } 328 }
313 mTodoView->modified(true); 329 mTodoView->modified(true);
314 setMyPixmap(); 330 setMyPixmap();
315 mTodoView->setTodoModified( mTodo ); 331 mTodoView->setTodoModified( mTodo );
316} 332}
317 333
318bool KOTodoViewItem::isAlternate() 334bool KOTodoViewItem::isAlternate()
319{ 335{
320 336#if 0
337 //if ( m_known ) return m_odd;
338 //qDebug("test ");
339 KOTodoViewItem *item = static_cast<KOTodoViewItem *>(itemAbove());
340 if ( item ) {
341 m_known = item->m_known;
342 if ( m_known ) {
343 m_odd = !item->m_odd ;
344 return m_odd;
345 }
346 } else {
347 item = static_cast<KOTodoViewItem *>(itemBelow());
348 if ( item ) {
349 m_known = item->m_known;
350 if ( m_known ) {
351 m_odd = !item->m_odd ;
352 return m_odd;
353 }
354 }
355 }
321 KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); 356 KOTodoListView *lv = static_cast<KOTodoListView *>(listView());
322 if (lv && lv->alternateBackground().isValid()) 357 item = static_cast<KOTodoViewItem *>(lv->firstChild());
358 bool previous = true;
359 qDebug("WHILE ");
360 while ( item ) {
361 item->m_odd = !previous;
362 item->m_known = true;
363 previous = !previous;
364 item = static_cast<KOTodoViewItem *>(item->itemBelow());
365 }
366 return m_odd;
367
368#else
369
370 //KOTodoListView *lv = static_cast<KOTodoListView *>(listView());
371 //if (lv && lv->alternateBackground().isValid())
323 { 372 {
324 KOTodoViewItem *above = 0; 373 KOTodoViewItem *above = static_cast<KOTodoViewItem *>(itemAbove());
325 above = static_cast<KOTodoViewItem *>(itemAbove());
326 m_known = above ? above->m_known : true; 374 m_known = above ? above->m_known : true;
327 if (m_known) 375 if (m_known)
328 { 376 {
329 m_odd = above ? !above->m_odd : false; 377 m_odd = above ? !above->m_odd : false;
330 } 378 }
331 else 379 else
332 { 380 {
333 KOTodoViewItem *item; 381 KOTodoViewItem *item;
334 bool previous = true; 382 bool previous = true;
335 if (QListViewItem::parent()) 383 if (QListViewItem::parent())
336 { 384 {
337 item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); 385 item = static_cast<KOTodoViewItem *>(QListViewItem::parent());
338 if (item) 386 if (item)
339 previous = item->m_odd; 387 previous = item->m_odd;
340 item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); 388 item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild());
341 } 389 }
342 else 390 else
343 { 391 {
392 KOTodoListView *lv = static_cast<KOTodoListView *>(listView());
344 item = static_cast<KOTodoViewItem *>(lv->firstChild()); 393 item = static_cast<KOTodoViewItem *>(lv->firstChild());
345 } 394 }
346 395
347 while(item) 396 while(item)
348 { 397 {
349 item->m_odd = previous = !previous; 398 item->m_odd = previous = !previous;
350 item->m_known = true; 399 item->m_known = true;
351 item = static_cast<KOTodoViewItem *>(item->nextSibling()); 400 item = static_cast<KOTodoViewItem *>(item->nextSibling());
352 } 401 }
353 } 402 }
354 return m_odd; 403 return m_odd;
355 } 404 }
356 return false; 405 return false;
406#endif
357} 407}
358 408
359void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) 409void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
360{ 410{
361 QColorGroup _cg = cg; 411 QColorGroup _cg = cg;
362 QColorGroup::ColorRole role; 412 QColorGroup::ColorRole role;
363 if ( KOPrefs::instance()->mTodoViewUsesForegroundColor && !mTodo->isRunning()) 413 if ( KOPrefs::instance()->mTodoViewUsesForegroundColor && !mTodo->isRunning())
364 role = QColorGroup::Text; 414 role = QColorGroup::Text;
365 else 415 else
366 role = QColorGroup::Base; 416 role = QColorGroup::Base;
367 //#ifndef KORG_NOLVALTERNATION 417 //#ifndef KORG_NOLVALTERNATION
368 if (isAlternate()) 418 if (isAlternate())
369 _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); 419 _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground());
370 bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; 420 bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors;
371 QColor colorToSet; 421 QColor colorToSet;
372 if ( column == 0 && mTodo->calID() > 1 ) { 422 if ( column == 0 && mTodo->calID() > 1 ) {
373 setColor = true; 423 setColor = true;
374 colorToSet = KOPrefs::instance()->defaultColor( mTodo->calID() ); 424 colorToSet = KOPrefs::instance()->defaultColor( mTodo->calID() );
375 } else if ( setColor ) { 425 } else if ( setColor ) {
376 QStringList categories = mTodo->categories(); 426 QStringList categories = mTodo->categories();
377 QString cat = categories.first(); 427 QString cat = categories.first();
378 if ( !cat.isEmpty()) { 428 if ( !cat.isEmpty()) {
379 colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); 429 colorToSet = *(KOPrefs::instance()->categoryColor(cat) );
380 } else 430 } else
381 setColor = false; 431 setColor = false;
382 } 432 }
383 bool openMode = !isOpen(); 433 bool openMode = !isOpen();
384 // maybe we are in flat-display-mode 434 // maybe we are in flat-display-mode
385 if ( !firstChild() ) 435 if ( !firstChild() )
386 openMode = false; 436 openMode = false;
387 bool colorRunning = mTodo->isRunning(); 437 bool colorRunning = mTodo->isRunning();
388 if ( ! colorRunning && openMode ) 438 if ( ! colorRunning && openMode )
389 colorRunning = mTodo->hasRunningSub(); 439 colorRunning = mTodo->hasRunningSub();
390 if ( colorRunning ) { 440 if ( colorRunning ) {
391 setColor = true; 441 setColor = true;
392 colorToSet = KOPrefs::instance()->mTodoRunColor; 442 colorToSet = KOPrefs::instance()->mTodoRunColor;
393 } else { 443 } else {
394 int odue = mTodo->hasDueSubTodo( openMode ); 444 int odue = mTodo->hasDueSubTodo( openMode );
395 if (odue == 2) { 445 if (odue == 2) {
396 colorToSet = KOPrefs::instance()->mTodoOverdueColor; 446 colorToSet = KOPrefs::instance()->mTodoOverdueColor;
397 setColor = true; 447 setColor = true;
398 } else if ( odue == 1 ) { 448 } else if ( odue == 1 ) {
399 colorToSet = KOPrefs::instance()->mTodoDueTodayColor; 449 colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
400 setColor = true; 450 setColor = true;
401 } 451 }
402 } 452 }
403 453
404 454
405 if ( setColor ) { 455 if ( setColor ) {
406 _cg.setColor(role,colorToSet ); 456 _cg.setColor(role,colorToSet );
407 if ( role == QColorGroup::Base) { 457 if ( role == QColorGroup::Base) {
408 int rgb = colorToSet.red(); 458 int rgb = colorToSet.red();
409 rgb += colorToSet.blue()/2; 459 rgb += colorToSet.blue()/2;
410 rgb += colorToSet.green(); 460 rgb += colorToSet.green();
411 if ( rgb < 200 ) 461 if ( rgb < 200 )
412 _cg.setColor(QColorGroup::Text,Qt::white ); 462 _cg.setColor(QColorGroup::Text,Qt::white );
413 } 463 }
414 } 464 }
415 //#endif 465 //#endif
416 if ( column > 0 ){ 466 if ( column > 0 ){
417 if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { 467 if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) {
418 p->save(); 468 p->save();
419 int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); 469 int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5);
420 470
421 p->fillRect( 0, 0, width, height(), _cg.base() ); // background 471 p->fillRect( 0, 0, width, height(), _cg.base() ); // background
422 // p->setPen(Qt::black ); //border 472 // p->setPen(Qt::black ); //border
423 // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling 473 // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling
424 QColor fc = KOPrefs::instance()->mHighlightColor; 474 QColor fc = KOPrefs::instance()->mHighlightColor;
425 if ( mTodo->percentComplete() == 100 ) 475 if ( mTodo->percentComplete() == 100 )
426 fc = darkGreen; 476 fc = darkGreen;
427 p->drawRect( 2, 2, width-4, height()-4); 477 p->drawRect( 2, 2, width-4, height()-4);
428 p->fillRect( 3, 3, progress, height()-6, 478 p->fillRect( 3, 3, progress, height()-6,
429 fc ); 479 fc );
430 p->restore(); 480 p->restore();
431 } else { 481 } else {
432 QCheckListItem::paintCell(p, _cg, column, width, alignment); 482 QCheckListItem::paintCell(p, _cg, column, width, alignment);
433 } 483 }
434 return; 484 return;
435 } 485 }
436 486
437 int align = alignment; 487 int align = alignment;
438 488
439 if ( !p ) 489 if ( !p )
440 return; 490 return;
441 491
442 p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); 492 p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) );
443 493
444 QListView *lv = listView(); 494 QListView *lv = listView();
445 if ( !lv ) 495 if ( !lv )
446 return; 496 return;
447 int marg = 2;//lv->itemMargin(); 497 int marg = 2;//lv->itemMargin();
448 int r = 0; 498 int r = 0;
449 QCheckListItem::Type myType = QCheckListItem::CheckBox; 499 QCheckListItem::Type myType = QCheckListItem::CheckBox;
450 int BoxSize = 20; 500 int BoxSize = 20;
451 int boxOffset = 2; 501 int boxOffset = 2;
452 int xOffset = 2; 502 int xOffset = 2;
453 if (qApp->desktop()->width() < 300 ) { 503 if (qApp->desktop()->width() < 300 ) {
454 BoxSize = 14; 504 BoxSize = 14;
455 boxOffset = -1; 505 boxOffset = -1;
456 xOffset = 1; 506 xOffset = 1;
457 // marg = 0; 507 // marg = 0;
458 } 508 }
459 if ( height() < BoxSize ) { 509 if ( height() < BoxSize ) {
460 boxOffset = boxOffset - ((BoxSize - height())/2) ; 510 boxOffset = boxOffset - ((BoxSize - height())/2) ;
461 // qDebug("boxOffset %d height %d", boxOffset, height() ); 511 // qDebug("boxOffset %d height %d", boxOffset, height() );
462 BoxSize = height(); 512 BoxSize = height();
463 513
464 } 514 }
465 //bool winStyle = lv->style() == WindowsStyle; 515 //bool winStyle = lv->style() == WindowsStyle;
466 516
467 int lineStart = 5; 517 int lineStart = 5;
468 if ( myType == Controller ) { 518 if ( myType == Controller ) {
469 if ( !pixmap( 0 ) ) 519 if ( !pixmap( 0 ) )
470 r += BoxSize + 4; 520 r += BoxSize + 4;
471 } else { 521 } else {
472 ASSERT( lv ); //### 522 ASSERT( lv ); //###
473 //QFontMetrics fm( lv->font() ); 523 //QFontMetrics fm( lv->font() );
474 //int d = fm.height(); 524 //int d = fm.height();
475 int x = 0; 525 int x = 0;
476 int y = (height() - BoxSize) / 2; 526 int y = (height() - BoxSize) / 2;
477 //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); 527 //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) );
478 if ( myType == CheckBox ) { 528 if ( myType == CheckBox ) {
479 if ( isEnabled() ) 529 if ( isEnabled() )
480 p->setPen( QPen( _cg.text(), 1 ) ); 530 p->setPen( QPen( _cg.text(), 1 ) );
481 else 531 else
482 p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); 532 p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) );
483 p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); 533 p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 );
484 lineStart = x+marg; 534 lineStart = x+marg;
485 ///////////////////// 535 /////////////////////
486 x++; 536 x++;
487 y++; 537 y++;
488 if ( isOn() ) { 538 if ( isOn() ) {
489 QPointArray a( 7*2 ); 539 QPointArray a( 7*2 );
490 int i, xx, yy; 540 int i, xx, yy;
491 xx = x+xOffset+marg+(boxOffset/2); 541 xx = x+xOffset+marg+(boxOffset/2);
492 yy = y+5+boxOffset; 542 yy = y+5+boxOffset;
493 for ( i=0; i<3; i++ ) { 543 for ( i=0; i<3; i++ ) {
494 a.setPoint( 2*i, xx, yy ); 544 a.setPoint( 2*i, xx, yy );
495 a.setPoint( 2*i+1, xx, yy+2 ); 545 a.setPoint( 2*i+1, xx, yy+2 );
496 // qDebug(" "); 546 // qDebug(" ");
497 xx++; yy++; 547 xx++; yy++;
498 } 548 }
499 yy -= 2; 549 yy -= 2;
500 for ( i=3; i<7; i++ ) { 550 for ( i=3; i<7; i++ ) {
501 a.setPoint( 2*i, xx, yy ); 551 a.setPoint( 2*i, xx, yy );
502 a.setPoint( 2*i+1, xx, yy+2 ); 552 a.setPoint( 2*i+1, xx, yy+2 );
503 xx++; yy--; 553 xx++; yy--;
504 } 554 }
505 p->setPen( darkGreen ); 555 p->setPen( darkGreen );
506 p->drawLineSegments( a ); 556 p->drawLineSegments( a );
507 } 557 }
508 //////////////////////// 558 ////////////////////////
509 } 559 }
510 r += BoxSize + 4; 560 r += BoxSize + 4;
511 } 561 }
512 562
513 p->translate( r, 0 ); 563 p->translate( r, 0 );
514 p->setPen( QPen( _cg.text() ) ); 564 p->setPen( QPen( _cg.text() ) );
515 QListViewItem::paintCell( p, _cg, column, width - r, align ); 565 QListViewItem::paintCell( p, _cg, column, width - r, align );
516 if ( mTodo->cancelled () ) { 566 if ( mTodo->cancelled () ) {
517 p->setPen( black ); 567 p->setPen( black );
518 QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); 568 QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() );
519 int wid = br.width() +lineStart; 569 int wid = br.width() +lineStart;
520 if ( wid > width-3 ) 570 if ( wid > width-3 )
521 wid = width-3; 571 wid = width-3;
522 p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); 572 p->drawLine( lineStart, height()/2+1, wid, height()/2+1 );
523 573
524 } 574 }
525 575
526} 576}
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 11f7ecc..e4bcc5e 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -1,760 +1,780 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library 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 GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include <kglobal.h> 21#include <kglobal.h>
22#include <klocale.h> 22#include <klocale.h>
23#include <kdebug.h> 23#include <kdebug.h>
24 24
25#include "calformat.h" 25#include "calformat.h"
26 26
27#include "incidence.h" 27#include "incidence.h"
28#include "todo.h" 28#include "todo.h"
29 29
30using namespace KCal; 30using namespace KCal;
31 31
32Incidence::Incidence() : 32Incidence::Incidence() :
33 IncidenceBase(), 33 IncidenceBase(),
34 mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) 34 mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3)
35{ 35{
36 mRecurrence = new Recurrence(this); 36 mRecurrence = new Recurrence(this);
37 mCancelled = false; 37 mCancelled = false;
38 recreate(); 38 recreate();
39 mHasStartDate = true; 39 mHasStartDate = true;
40 mAlarms.setAutoDelete(true); 40 mAlarms.setAutoDelete(true);
41 mAttachments.setAutoDelete(true); 41 mAttachments.setAutoDelete(true);
42 mHasRecurrenceID = false; 42 mHasRecurrenceID = false;
43 mHoliday = false; 43 mHoliday = false;
44 mBirthday = false; 44 mBirthday = false;
45 mAnniversary = false; 45 mAnniversary = false;
46 46
47} 47}
48 48
49Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) 49Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
50{ 50{
51// TODO: reenable attributes currently commented out. 51// TODO: reenable attributes currently commented out.
52 mRevision = i.mRevision; 52 mRevision = i.mRevision;
53 mCreated = i.mCreated; 53 mCreated = i.mCreated;
54 mDescription = i.mDescription; 54 mDescription = i.mDescription;
55 mSummary = i.mSummary; 55 mSummary = i.mSummary;
56 mCategories = i.mCategories; 56 mCategories = i.mCategories;
57// Incidence *mRelatedTo; Incidence *mRelatedTo; 57// Incidence *mRelatedTo; Incidence *mRelatedTo;
58 mRelatedTo = 0; 58 mRelatedTo = 0;
59 mRelatedToUid = i.mRelatedToUid; 59 mRelatedToUid = i.mRelatedToUid;
60// QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; 60// QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations;
61 mExDates = i.mExDates; 61 mExDates = i.mExDates;
62 mAttachments = i.mAttachments; 62 mAttachments = i.mAttachments;
63 mResources = i.mResources; 63 mResources = i.mResources;
64 mSecrecy = i.mSecrecy; 64 mSecrecy = i.mSecrecy;
65 mPriority = i.mPriority; 65 mPriority = i.mPriority;
66 mLocation = i.mLocation; 66 mLocation = i.mLocation;
67 mCancelled = i.mCancelled; 67 mCancelled = i.mCancelled;
68 mHasStartDate = i.mHasStartDate; 68 mHasStartDate = i.mHasStartDate;
69 QPtrListIterator<Alarm> it( i.mAlarms ); 69 QPtrListIterator<Alarm> it( i.mAlarms );
70 const Alarm *a; 70 const Alarm *a;
71 while( (a = it.current()) ) { 71 while( (a = it.current()) ) {
72 Alarm *b = new Alarm( *a ); 72 Alarm *b = new Alarm( *a );
73 b->setParent( this ); 73 b->setParent( this );
74 mAlarms.append( b ); 74 mAlarms.append( b );
75 75
76 ++it; 76 ++it;
77 } 77 }
78 mAlarms.setAutoDelete(true); 78 mAlarms.setAutoDelete(true);
79 mHasRecurrenceID = i.mHasRecurrenceID; 79 mHasRecurrenceID = i.mHasRecurrenceID;
80 mRecurrenceID = i.mRecurrenceID; 80 mRecurrenceID = i.mRecurrenceID;
81 mRecurrence = new Recurrence( *(i.mRecurrence), this ); 81 mRecurrence = new Recurrence( *(i.mRecurrence), this );
82 mHoliday = i.mHoliday ; 82 mHoliday = i.mHoliday ;
83 mBirthday = i.mBirthday; 83 mBirthday = i.mBirthday;
84 mAnniversary = i.mAnniversary; 84 mAnniversary = i.mAnniversary;
85} 85}
86 86
87Incidence::~Incidence() 87Incidence::~Incidence()
88{ 88{
89 89
90 Incidence *ev; 90 Incidence *ev;
91 QPtrList<Incidence> Relations = relations(); 91 QPtrList<Incidence> Relations = relations();
92 for (ev=Relations.first();ev;ev=Relations.next()) { 92 for (ev=Relations.first();ev;ev=Relations.next()) {
93 if (ev->relatedTo() == this) ev->setRelatedTo(0); 93 if (ev->relatedTo() == this) ev->setRelatedTo(0);
94 } 94 }
95 if (relatedTo()) relatedTo()->removeRelation(this); 95 if (relatedTo()) relatedTo()->removeRelation(this);
96 delete mRecurrence; 96 delete mRecurrence;
97 97
98} 98}
99 99
100bool Incidence::isHoliday() const 100bool Incidence::isHoliday() const
101{ 101{
102 return mHoliday; 102 return mHoliday;
103} 103}
104bool Incidence::isBirthday() const 104bool Incidence::isBirthday() const
105{ 105{
106 106
107 return mBirthday ; 107 return mBirthday ;
108} 108}
109bool Incidence::isAnniversary() const 109bool Incidence::isAnniversary() const
110{ 110{
111 return mAnniversary ; 111 return mAnniversary ;
112 112
113} 113}
114 114
115bool Incidence::hasRecurrenceID() const 115bool Incidence::hasRecurrenceID() const
116{ 116{
117 return mHasRecurrenceID; 117 return mHasRecurrenceID;
118} 118}
119 119
120void Incidence::setHasRecurrenceID( bool b ) 120void Incidence::setHasRecurrenceID( bool b )
121{ 121{
122 mHasRecurrenceID = b; 122 mHasRecurrenceID = b;
123} 123}
124 124
125void Incidence::setRecurrenceID(QDateTime d) 125void Incidence::setRecurrenceID(QDateTime d)
126{ 126{
127 mRecurrenceID = d; 127 mRecurrenceID = d;
128 mHasRecurrenceID = true; 128 mHasRecurrenceID = true;
129 updated(); 129 updated();
130} 130}
131QDateTime Incidence::recurrenceID () const 131QDateTime Incidence::recurrenceID () const
132{ 132{
133 return mRecurrenceID; 133 return mRecurrenceID;
134} 134}
135 135
136bool Incidence::cancelled() const 136bool Incidence::cancelled() const
137{ 137{
138 return mCancelled; 138 return mCancelled;
139} 139}
140void Incidence::setCancelled( bool b ) 140void Incidence::setCancelled( bool b )
141{ 141{
142 mCancelled = b; 142 mCancelled = b;
143 updated(); 143 updated();
144} 144}
145bool Incidence::hasStartDate() const 145bool Incidence::hasStartDate() const
146{ 146{
147 return mHasStartDate; 147 return mHasStartDate;
148} 148}
149 149
150void Incidence::setHasStartDate(bool f) 150void Incidence::setHasStartDate(bool f)
151{ 151{
152 if (mReadOnly) return; 152 if (mReadOnly) return;
153 mHasStartDate = f; 153 mHasStartDate = f;
154 updated(); 154 updated();
155} 155}
156 156
157// A string comparison that considers that null and empty are the same 157// A string comparison that considers that null and empty are the same
158static bool stringCompare( const QString& s1, const QString& s2 ) 158static bool stringCompare( const QString& s1, const QString& s2 )
159{ 159{
160 if ( s1.isEmpty() && s2.isEmpty() ) 160 if ( s1.isEmpty() && s2.isEmpty() )
161 return true; 161 return true;
162 return s1 == s2; 162 return s1 == s2;
163} 163}
164 164
165bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) 165bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
166{ 166{
167 167
168 if( i1.alarms().count() != i2.alarms().count() ) { 168 if( i1.alarms().count() != i2.alarms().count() ) {
169 return false; // no need to check further 169 return false; // no need to check further
170 } 170 }
171 if ( i1.alarms().count() > 0 ) { 171 if ( i1.alarms().count() > 0 ) {
172 if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) ) 172 if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) )
173 { 173 {
174 qDebug("alarm not equal "); 174 qDebug("alarm not equal ");
175 return false; 175 return false;
176 } 176 }
177 } 177 }
178#if 0 178#if 0
179 QPtrListIterator<Alarm> a1( i1.alarms() ); 179 QPtrListIterator<Alarm> a1( i1.alarms() );
180 QPtrListIterator<Alarm> a2( i2.alarms() ); 180 QPtrListIterator<Alarm> a2( i2.alarms() );
181 for( ; a1.current() && a2.current(); ++a1, ++a2 ) { 181 for( ; a1.current() && a2.current(); ++a1, ++a2 ) {
182 if( *a1.current() == *a2.current() ) { 182 if( *a1.current() == *a2.current() ) {
183 continue; 183 continue;
184 } 184 }
185 else { 185 else {
186 return false; 186 return false;
187 } 187 }
188 } 188 }
189#endif 189#endif
190 190
191 if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) { 191 if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) {
192 if ( i1.hasRecurrenceID() ) { 192 if ( i1.hasRecurrenceID() ) {
193 if ( i1.recurrenceID() != i2.recurrenceID() ) 193 if ( i1.recurrenceID() != i2.recurrenceID() )
194 return false; 194 return false;
195 } 195 }
196 196
197 } else { 197 } else {
198 return false; 198 return false;
199 } 199 }
200 200
201 if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) 201 if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) )
202 return false; 202 return false;
203 if ( i1.hasStartDate() == i2.hasStartDate() ) { 203 if ( i1.hasStartDate() == i2.hasStartDate() ) {
204 if ( i1.hasStartDate() ) { 204 if ( i1.hasStartDate() ) {
205 if ( i1.dtStart() != i2.dtStart() ) 205 if ( i1.dtStart() != i2.dtStart() )
206 return false; 206 return false;
207 } 207 }
208 } else { 208 } else {
209 return false; 209 return false;
210 } 210 }
211 if (!( *i1.recurrence() == *i2.recurrence()) ) { 211 if (!( *i1.recurrence() == *i2.recurrence()) ) {
212 qDebug("recurrence is NOT equal "); 212 qDebug("recurrence is NOT equal ");
213 return false; 213 return false;
214 } 214 }
215 return 215 return
216 // i1.created() == i2.created() && 216 // i1.created() == i2.created() &&
217 stringCompare( i1.description(), i2.description() ) && 217 stringCompare( i1.description(), i2.description() ) &&
218 stringCompare( i1.summary(), i2.summary() ) && 218 stringCompare( i1.summary(), i2.summary() ) &&
219 i1.categories() == i2.categories() && 219 i1.categories() == i2.categories() &&
220 // no need to compare mRelatedTo 220 // no need to compare mRelatedTo
221 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && 221 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) &&
222 // i1.relations() == i2.relations() && 222 // i1.relations() == i2.relations() &&
223 i1.exDates() == i2.exDates() && 223 i1.exDates() == i2.exDates() &&
224 i1.attachments() == i2.attachments() && 224 i1.attachments() == i2.attachments() &&
225 i1.resources() == i2.resources() && 225 i1.resources() == i2.resources() &&
226 i1.secrecy() == i2.secrecy() && 226 i1.secrecy() == i2.secrecy() &&
227 i1.priority() == i2.priority() && 227 i1.priority() == i2.priority() &&
228 i1.cancelled() == i2.cancelled() && 228 i1.cancelled() == i2.cancelled() &&
229 stringCompare( i1.location(), i2.location() ); 229 stringCompare( i1.location(), i2.location() );
230} 230}
231 231
232Incidence* Incidence::recreateCloneException( QDate d ) 232Incidence* Incidence::recreateCloneException( QDate d )
233{ 233{
234 Incidence* newInc = clone(); 234 Incidence* newInc = clone();
235 newInc->recreate(); 235 newInc->recreate();
236 if ( doesRecur() ) { 236 if ( doesRecur() ) {
237 addExDate( d ); 237 addExDate( d );
238 newInc->recurrence()->unsetRecurs(); 238 newInc->recurrence()->unsetRecurs();
239 if ( typeID() == eventID ) { 239 if ( typeID() == eventID ) {
240 int len = dtStart().secsTo( ((Event*)this)->dtEnd()); 240 int len = dtStart().secsTo( ((Event*)this)->dtEnd());
241 QTime tim = dtStart().time(); 241 QTime tim = dtStart().time();
242 newInc->setDtStart( QDateTime(d, tim) ); 242 newInc->setDtStart( QDateTime(d, tim) );
243 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 243 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
244 } else { 244 } else {
245 int len = dtStart().secsTo( ((Todo*)this)->dtDue()); 245 int len = dtStart().secsTo( ((Todo*)this)->dtDue());
246 QTime tim = ((Todo*)this)->dtDue().time(); 246 QTime tim = ((Todo*)this)->dtDue().time();
247 ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); 247 ((Todo*)newInc)->setDtDue( QDateTime(d, tim) );
248 ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); 248 ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) );
249 ((Todo*)this)->setRecurDates(); 249 ((Todo*)this)->setRecurDates();
250 } 250 }
251 newInc->setExDates( DateList () ); 251 newInc->setExDates( DateList () );
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 284void Incidence::setLastModifiedSubInvalid()
285{
286 mLastModifiedSub = QDateTime();
287 if ( mRelatedTo )
288 mRelatedTo->setLastModifiedSubInvalid();
289}
290QDateTime Incidence::lastModifiedSub()
291{
292 if ( !mRelations.count() )
293 return lastModified();
294 if ( mLastModifiedSub.isValid() )
295 return mLastModifiedSub;
296 mLastModifiedSub = lastModified();
297 Incidence * inc;
298 QPtrList<Incidence> Relations = relations();
299 for (inc=Relations.first();inc;inc=Relations.next()) {
300 if ( inc->lastModifiedSub() > mLastModifiedSub )
301 mLastModifiedSub = inc->lastModifiedSub();
302 }
303 return mLastModifiedSub;
304}
285void Incidence::setCreated(QDateTime created) 305void Incidence::setCreated(QDateTime created)
286{ 306{
287 if (mReadOnly) return; 307 if (mReadOnly) return;
288 mCreated = getEvenTime(created); 308 mCreated = getEvenTime(created);
289} 309}
290 310
291QDateTime Incidence::created() const 311QDateTime Incidence::created() const
292{ 312{
293 return mCreated; 313 return mCreated;
294} 314}
295 315
296void Incidence::setRevision(int rev) 316void Incidence::setRevision(int rev)
297{ 317{
298 if (mReadOnly) return; 318 if (mReadOnly) return;
299 mRevision = rev; 319 mRevision = rev;
300 320
301 updated(); 321 updated();
302} 322}
303 323
304int Incidence::revision() const 324int Incidence::revision() const
305{ 325{
306 return mRevision; 326 return mRevision;
307} 327}
308 328
309void Incidence::setDtStart(const QDateTime &dtStart) 329void Incidence::setDtStart(const QDateTime &dtStart)
310{ 330{
311 331
312 QDateTime dt = getEvenTime(dtStart); 332 QDateTime dt = getEvenTime(dtStart);
313 recurrence()->setRecurStart( dt); 333 recurrence()->setRecurStart( dt);
314 IncidenceBase::setDtStart( dt ); 334 IncidenceBase::setDtStart( dt );
315} 335}
316 336
317void Incidence::setDescription(const QString &description) 337void Incidence::setDescription(const QString &description)
318{ 338{
319 if (mReadOnly) return; 339 if (mReadOnly) return;
320 mDescription = description; 340 mDescription = description;
321 updated(); 341 updated();
322} 342}
323 343
324QString Incidence::description() const 344QString Incidence::description() const
325{ 345{
326 return mDescription; 346 return mDescription;
327} 347}
328 348
329 349
330void Incidence::setSummary(const QString &summary) 350void Incidence::setSummary(const QString &summary)
331{ 351{
332 if (mReadOnly) return; 352 if (mReadOnly) return;
333 mSummary = summary; 353 mSummary = summary;
334 updated(); 354 updated();
335} 355}
336 356
337QString Incidence::summary() const 357QString Incidence::summary() const
338{ 358{
339 return mSummary; 359 return mSummary;
340} 360}
341void Incidence::checkCategories() 361void Incidence::checkCategories()
342{ 362{
343 mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); 363 mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday"));
344 mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); 364 mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday"));
345 mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); 365 mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary"));
346} 366}
347 367
348void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false 368void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false
349{ 369{
350 if (mReadOnly) return; 370 if (mReadOnly) return;
351 int i; 371 int i;
352 for( i = 0; i < categories.count(); ++i ) { 372 for( i = 0; i < categories.count(); ++i ) {
353 if ( !mCategories.contains (categories[i])) 373 if ( !mCategories.contains (categories[i]))
354 mCategories.append( categories[i] ); 374 mCategories.append( categories[i] );
355 } 375 }
356 checkCategories(); 376 checkCategories();
357 updated(); 377 updated();
358 if ( addToRelations ) { 378 if ( addToRelations ) {
359 Incidence * inc; 379 Incidence * inc;
360 QPtrList<Incidence> Relations = relations(); 380 QPtrList<Incidence> Relations = relations();
361 for (inc=Relations.first();inc;inc=Relations.next()) { 381 for (inc=Relations.first();inc;inc=Relations.next()) {
362 inc->addCategories( categories, true ); 382 inc->addCategories( categories, true );
363 } 383 }
364 } 384 }
365} 385}
366 386
367void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false 387void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false
368{ 388{
369 if (mReadOnly) return; 389 if (mReadOnly) return;
370 mCategories = categories; 390 mCategories = categories;
371 checkCategories(); 391 checkCategories();
372 updated(); 392 updated();
373 if ( setForRelations ) { 393 if ( setForRelations ) {
374 Incidence * inc; 394 Incidence * inc;
375 QPtrList<Incidence> Relations = relations(); 395 QPtrList<Incidence> Relations = relations();
376 for (inc=Relations.first();inc;inc=Relations.next()) { 396 for (inc=Relations.first();inc;inc=Relations.next()) {
377 inc->setCategories( categories, true ); 397 inc->setCategories( categories, true );
378 } 398 }
379 } 399 }
380} 400}
381 401
382// TODO: remove setCategories(QString) function 402// TODO: remove setCategories(QString) function
383void Incidence::setCategories(const QString &catStr) 403void Incidence::setCategories(const QString &catStr)
384{ 404{
385 if (mReadOnly) return; 405 if (mReadOnly) return;
386 mCategories.clear(); 406 mCategories.clear();
387 407
388 if (catStr.isEmpty()) return; 408 if (catStr.isEmpty()) return;
389 409
390 mCategories = QStringList::split(",",catStr); 410 mCategories = QStringList::split(",",catStr);
391 411
392 QStringList::Iterator it; 412 QStringList::Iterator it;
393 for(it = mCategories.begin();it != mCategories.end(); ++it) { 413 for(it = mCategories.begin();it != mCategories.end(); ++it) {
394 *it = (*it).stripWhiteSpace(); 414 *it = (*it).stripWhiteSpace();
395 } 415 }
396 checkCategories(); 416 checkCategories();
397 updated(); 417 updated();
398} 418}
399// using this makes filtering 3 times faster 419// using this makes filtering 3 times faster
400QStringList* Incidence::categoriesP() 420QStringList* Incidence::categoriesP()
401{ 421{
402 return &mCategories; 422 return &mCategories;
403} 423}
404 424
405QStringList Incidence::categories() const 425QStringList Incidence::categories() const
406{ 426{
407 return mCategories; 427 return mCategories;
408} 428}
409 429
410QString Incidence::categoriesStr() 430QString Incidence::categoriesStr()
411{ 431{
412 return mCategories.join(","); 432 return mCategories.join(",");
413} 433}
414QString Incidence::categoriesStrWithSpace() 434QString Incidence::categoriesStrWithSpace()
415{ 435{
416 return mCategories.join(", "); 436 return mCategories.join(", ");
417} 437}
418 438
419void Incidence::setRelatedToUid(const QString &relatedToUid) 439void Incidence::setRelatedToUid(const QString &relatedToUid)
420{ 440{
421 if (mReadOnly) return; 441 if (mReadOnly) return;
422 mRelatedToUid = relatedToUid; 442 mRelatedToUid = relatedToUid;
423} 443}
424 444
425QString Incidence::relatedToUid() const 445QString Incidence::relatedToUid() const
426{ 446{
427 return mRelatedToUid; 447 return mRelatedToUid;
428} 448}
429 449
430void Incidence::setRelatedTo(Incidence *relatedTo) 450void Incidence::setRelatedTo(Incidence *relatedTo)
431{ 451{
432 //qDebug("Incidence::setRelatedTo %d ", relatedTo); 452 //qDebug("Incidence::setRelatedTo %d ", relatedTo);
433 //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); 453 //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() );
434 if (mReadOnly || mRelatedTo == relatedTo) return; 454 if (mReadOnly || mRelatedTo == relatedTo) return;
435 if(mRelatedTo) { 455 if(mRelatedTo) {
436 // updated(); 456 // updated();
437 mRelatedTo->removeRelation(this); 457 mRelatedTo->removeRelation(this);
438 } 458 }
439 mRelatedTo = relatedTo; 459 mRelatedTo = relatedTo;
440 if (mRelatedTo) { 460 if (mRelatedTo) {
441 mRelatedTo->addRelation(this); 461 mRelatedTo->addRelation(this);
442 mRelatedToUid = mRelatedTo->uid(); 462 mRelatedToUid = mRelatedTo->uid();
443 } else { 463 } else {
444 mRelatedToUid = ""; 464 mRelatedToUid = "";
445 } 465 }
446} 466}
447 467
448Incidence *Incidence::relatedTo() const 468Incidence *Incidence::relatedTo() const
449{ 469{
450 return mRelatedTo; 470 return mRelatedTo;
451} 471}
452 472
453QPtrList<Incidence> Incidence::relations() const 473QPtrList<Incidence> Incidence::relations() const
454{ 474{
455 return mRelations; 475 return mRelations;
456} 476}
457 477
458void Incidence::addRelationsToList(QPtrList<Incidence> *rel) 478void Incidence::addRelationsToList(QPtrList<Incidence> *rel)
459{ 479{
460 Incidence* inc; 480 Incidence* inc;
461 QPtrList<Incidence> Relations = relations(); 481 QPtrList<Incidence> Relations = relations();
462 for (inc=Relations.first();inc;inc=Relations.next()) { 482 for (inc=Relations.first();inc;inc=Relations.next()) {
463 inc->addRelationsToList( rel ); 483 inc->addRelationsToList( rel );
464 } 484 }
465 if ( rel->findRef( this ) == -1 ) 485 if ( rel->findRef( this ) == -1 )
466 rel->append( this ); 486 rel->append( this );
467} 487}
468 488
469void Incidence::addRelation(Incidence *event) 489void Incidence::addRelation(Incidence *event)
470{ 490{
491 setLastModifiedSubInvalid();
471 if( mRelations.findRef( event ) == -1 ) { 492 if( mRelations.findRef( event ) == -1 ) {
472 mRelations.append(event); 493 mRelations.append(event);
473 //updated(); 494 //updated();
474 } 495 }
475} 496}
476 497
477void Incidence::removeRelation(Incidence *event) 498void Incidence::removeRelation(Incidence *event)
478{ 499{
479 500 setLastModifiedSubInvalid();
480 mRelations.removeRef(event); 501 mRelations.removeRef(event);
481
482// if (event->getRelatedTo() == this) event->setRelatedTo(0); 502// if (event->getRelatedTo() == this) event->setRelatedTo(0);
483} 503}
484 504
485bool Incidence::recursOn(const QDate &qd) const 505bool Incidence::recursOn(const QDate &qd) const
486{ 506{
487 if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; 507 if (recurrence()->recursOnPure(qd) && !isException(qd)) return true;
488 else return false; 508 else return false;
489} 509}
490 510
491void Incidence::setExDates(const DateList &exDates) 511void Incidence::setExDates(const DateList &exDates)
492{ 512{
493 if (mReadOnly) return; 513 if (mReadOnly) return;
494 mExDates = exDates; 514 mExDates = exDates;
495 515
496 recurrence()->setRecurExDatesCount(mExDates.count()); 516 recurrence()->setRecurExDatesCount(mExDates.count());
497 517
498 updated(); 518 updated();
499} 519}
500 520
501void Incidence::addExDate(const QDate &date) 521void Incidence::addExDate(const QDate &date)
502{ 522{
503 if (mReadOnly) return; 523 if (mReadOnly) return;
504 mExDates.append(date); 524 mExDates.append(date);
505 525
506 recurrence()->setRecurExDatesCount(mExDates.count()); 526 recurrence()->setRecurExDatesCount(mExDates.count());
507 527
508 updated(); 528 updated();
509} 529}
510 530
511DateList Incidence::exDates() const 531DateList Incidence::exDates() const
512{ 532{
513 return mExDates; 533 return mExDates;
514} 534}
515 535
516bool Incidence::isException(const QDate &date) const 536bool Incidence::isException(const QDate &date) const
517{ 537{
518 DateList::ConstIterator it; 538 DateList::ConstIterator it;
519 for( it = mExDates.begin(); it != mExDates.end(); ++it ) { 539 for( it = mExDates.begin(); it != mExDates.end(); ++it ) {
520 if ( (*it) == date ) { 540 if ( (*it) == date ) {
521 return true; 541 return true;
522 } 542 }
523 } 543 }
524 544
525 return false; 545 return false;
526} 546}
527 547
528void Incidence::addAttachment(Attachment *attachment) 548void Incidence::addAttachment(Attachment *attachment)
529{ 549{
530 if (mReadOnly || !attachment) return; 550 if (mReadOnly || !attachment) return;
531 mAttachments.append(attachment); 551 mAttachments.append(attachment);
532 updated(); 552 updated();
533} 553}
534 554
535void Incidence::deleteAttachment(Attachment *attachment) 555void Incidence::deleteAttachment(Attachment *attachment)
536{ 556{
537 mAttachments.removeRef(attachment); 557 mAttachments.removeRef(attachment);
538} 558}
539 559
540void Incidence::deleteAttachments(const QString& mime) 560void Incidence::deleteAttachments(const QString& mime)
541{ 561{
542 Attachment *at = mAttachments.first(); 562 Attachment *at = mAttachments.first();
543 while (at) { 563 while (at) {
544 if (at->mimeType() == mime) 564 if (at->mimeType() == mime)
545 mAttachments.remove(); 565 mAttachments.remove();
546 else 566 else
547 at = mAttachments.next(); 567 at = mAttachments.next();
548 } 568 }
549} 569}
550 570
551QPtrList<Attachment> Incidence::attachments() const 571QPtrList<Attachment> Incidence::attachments() const
552{ 572{
553 return mAttachments; 573 return mAttachments;
554} 574}
555 575
556QPtrList<Attachment> Incidence::attachments(const QString& mime) const 576QPtrList<Attachment> Incidence::attachments(const QString& mime) const
557{ 577{
558 QPtrList<Attachment> attachments; 578 QPtrList<Attachment> attachments;
559 QPtrListIterator<Attachment> it( mAttachments ); 579 QPtrListIterator<Attachment> it( mAttachments );
560 Attachment *at; 580 Attachment *at;
561 while ( (at = it.current()) ) { 581 while ( (at = it.current()) ) {
562 if (at->mimeType() == mime) 582 if (at->mimeType() == mime)
563 attachments.append(at); 583 attachments.append(at);
564 ++it; 584 ++it;
565 } 585 }
566 586
567 return attachments; 587 return attachments;
568} 588}
569 589
570void Incidence::setResources(const QStringList &resources) 590void Incidence::setResources(const QStringList &resources)
571{ 591{
572 if (mReadOnly) return; 592 if (mReadOnly) return;
573 mResources = resources; 593 mResources = resources;
574 updated(); 594 updated();
575} 595}
576 596
577QStringList Incidence::resources() const 597QStringList Incidence::resources() const
578{ 598{
579 return mResources; 599 return mResources;
580} 600}
581 601
582 602
583void Incidence::setPriority(int priority) 603void Incidence::setPriority(int priority)
584{ 604{
585 if (mReadOnly) return; 605 if (mReadOnly) return;
586 mPriority = priority; 606 mPriority = priority;
587 updated(); 607 updated();
588} 608}
589 609
590int Incidence::priority() const 610int Incidence::priority() const
591{ 611{
592 return mPriority; 612 return mPriority;
593} 613}
594 614
595void Incidence::setSecrecy(int sec) 615void Incidence::setSecrecy(int sec)
596{ 616{
597 if (mReadOnly) return; 617 if (mReadOnly) return;
598 mSecrecy = sec; 618 mSecrecy = sec;
599 updated(); 619 updated();
600} 620}
601 621
602int Incidence::secrecy() const 622int Incidence::secrecy() const
603{ 623{
604 return mSecrecy; 624 return mSecrecy;
605} 625}
606 626
607QString Incidence::secrecyStr() const 627QString Incidence::secrecyStr() const
608{ 628{
609 return secrecyName(mSecrecy); 629 return secrecyName(mSecrecy);
610} 630}
611 631
612QString Incidence::secrecyName(int secrecy) 632QString Incidence::secrecyName(int secrecy)
613{ 633{
614 switch (secrecy) { 634 switch (secrecy) {
615 case SecrecyPublic: 635 case SecrecyPublic:
616 return i18n("Public"); 636 return i18n("Public");
617 break; 637 break;
618 case SecrecyPrivate: 638 case SecrecyPrivate:
619 return i18n("Private"); 639 return i18n("Private");
620 break; 640 break;
621 case SecrecyConfidential: 641 case SecrecyConfidential:
622 return i18n("Confidential"); 642 return i18n("Confidential");
623 break; 643 break;
624 default: 644 default:
625 return i18n("Undefined"); 645 return i18n("Undefined");
626 break; 646 break;
627 } 647 }
628} 648}
629 649
630QStringList Incidence::secrecyList() 650QStringList Incidence::secrecyList()
631{ 651{
632 QStringList list; 652 QStringList list;
633 list << secrecyName(SecrecyPublic); 653 list << secrecyName(SecrecyPublic);
634 list << secrecyName(SecrecyPrivate); 654 list << secrecyName(SecrecyPrivate);
635 list << secrecyName(SecrecyConfidential); 655 list << secrecyName(SecrecyConfidential);
636 656
637 return list; 657 return list;
638} 658}
639 659
640 660
641QPtrList<Alarm> Incidence::alarms() const 661QPtrList<Alarm> Incidence::alarms() const
642{ 662{
643 return mAlarms; 663 return mAlarms;
644} 664}
645 665
646Alarm* Incidence::newAlarm() 666Alarm* Incidence::newAlarm()
647{ 667{
648 Alarm* alarm = new Alarm(this); 668 Alarm* alarm = new Alarm(this);
649 mAlarms.append(alarm); 669 mAlarms.append(alarm);
650// updated(); 670// updated();
651 return alarm; 671 return alarm;
652} 672}
653 673
654void Incidence::addAlarm(Alarm *alarm) 674void Incidence::addAlarm(Alarm *alarm)
655{ 675{
656 mAlarms.append(alarm); 676 mAlarms.append(alarm);
657 updated(); 677 updated();
658} 678}
659 679
660void Incidence::removeAlarm(Alarm *alarm) 680void Incidence::removeAlarm(Alarm *alarm)
661{ 681{
662 mAlarms.removeRef(alarm); 682 mAlarms.removeRef(alarm);
663 updated(); 683 updated();
664} 684}
665 685
666void Incidence::clearAlarms() 686void Incidence::clearAlarms()
667{ 687{
668 mAlarms.clear(); 688 mAlarms.clear();
669 updated(); 689 updated();
670} 690}
671 691
672bool Incidence::isAlarmEnabled() const 692bool Incidence::isAlarmEnabled() const
673{ 693{
674 Alarm* alarm; 694 Alarm* alarm;
675 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { 695 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
676 if (alarm->enabled()) 696 if (alarm->enabled())
677 return true; 697 return true;
678 } 698 }
679 return false; 699 return false;
680} 700}
681 701
682Recurrence *Incidence::recurrence() const 702Recurrence *Incidence::recurrence() const
683{ 703{
684 return mRecurrence; 704 return mRecurrence;
685} 705}
686void Incidence::setRecurrence( Recurrence * r) 706void Incidence::setRecurrence( Recurrence * r)
687{ 707{
688 delete mRecurrence; 708 delete mRecurrence;
689 mRecurrence = r; 709 mRecurrence = r;
690} 710}
691 711
692void Incidence::setLocation(const QString &location) 712void Incidence::setLocation(const QString &location)
693{ 713{
694 if (mReadOnly) return; 714 if (mReadOnly) return;
695 mLocation = location; 715 mLocation = location;
696 updated(); 716 updated();
697} 717}
698 718
699QString Incidence::location() const 719QString Incidence::location() const
700{ 720{
701 return mLocation; 721 return mLocation;
702} 722}
703 723
704ushort Incidence::doesRecur() const 724ushort Incidence::doesRecur() const
705{ 725{
706 if ( mRecurrence ) return mRecurrence->doesRecur(); 726 if ( mRecurrence ) return mRecurrence->doesRecur();
707 else return Recurrence::rNone; 727 else return Recurrence::rNone;
708} 728}
709 729
710QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const 730QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
711{ 731{
712 QDateTime incidenceStart = dt; 732 QDateTime incidenceStart = dt;
713 *ok = false; 733 *ok = false;
714 if ( doesRecur() ) { 734 if ( doesRecur() ) {
715 bool last; 735 bool last;
716 recurrence()->getPreviousDateTime( incidenceStart , &last ); 736 recurrence()->getPreviousDateTime( incidenceStart , &last );
717 int count = 0; 737 int count = 0;
718 if ( !last ) { 738 if ( !last ) {
719 while ( !last ) { 739 while ( !last ) {
720 ++count; 740 ++count;
721 incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); 741 incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last );
722 if ( recursOn( incidenceStart.date() ) ) { 742 if ( recursOn( incidenceStart.date() ) ) {
723 last = true; // exit while llop 743 last = true; // exit while llop
724 } else { 744 } else {
725 if ( last ) { // no alarm on last recurrence 745 if ( last ) { // no alarm on last recurrence
726 return QDateTime (); 746 return QDateTime ();
727 } 747 }
728 int year = incidenceStart.date().year(); 748 int year = incidenceStart.date().year();
729 // workaround for bug in recurrence 749 // workaround for bug in recurrence
730 if ( count == 100 || year < 1000 || year > 5000 ) { 750 if ( count == 100 || year < 1000 || year > 5000 ) {
731 return QDateTime (); 751 return QDateTime ();
732 } 752 }
733 incidenceStart = incidenceStart.addSecs( 1 ); 753 incidenceStart = incidenceStart.addSecs( 1 );
734 } 754 }
735 } 755 }
736 } else { 756 } else {
737 return QDateTime (); 757 return QDateTime ();
738 } 758 }
739 } else { 759 } else {
740 if ( hasStartDate () ) { 760 if ( hasStartDate () ) {
741 incidenceStart = dtStart(); 761 incidenceStart = dtStart();
742 } 762 }
743 if ( typeID() == todoID ) { 763 if ( typeID() == todoID ) {
744 if ( ((Todo*)this)->hasDueDate() ) 764 if ( ((Todo*)this)->hasDueDate() )
745 incidenceStart = ((Todo*)this)->dtDue(); 765 incidenceStart = ((Todo*)this)->dtDue();
746 } 766 }
747 } 767 }
748 if ( incidenceStart > dt ) 768 if ( incidenceStart > dt )
749 *ok = true; 769 *ok = true;
750 return incidenceStart; 770 return incidenceStart;
751} 771}
752QDateTime Incidence::dtStart() const 772QDateTime Incidence::dtStart() const
753{ 773{
754 if ( doesRecur() ) { 774 if ( doesRecur() ) {
755 if ( typeID() == todoID ) { 775 if ( typeID() == todoID ) {
756 ((Todo*)this)->checkSetCompletedFalse(); 776 ((Todo*)this)->checkSetCompletedFalse();
757 } 777 }
758 } 778 }
759 return mDtStart; 779 return mDtStart;
760} 780}
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index c88ba2f..d4af9f0 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -1,318 +1,321 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library 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 GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef INCIDENCE_H 20#ifndef INCIDENCE_H
21#define INCIDENCE_H 21#define INCIDENCE_H
22// 22//
23// Incidence - base class of calendaring components 23// Incidence - base class of calendaring components
24// 24//
25 25
26#include <qdatetime.h> 26#include <qdatetime.h>
27#include <qstringlist.h> 27#include <qstringlist.h>
28#include <qvaluelist.h> 28#include <qvaluelist.h>
29 29
30#include "recurrence.h" 30#include "recurrence.h"
31#include "alarm.h" 31#include "alarm.h"
32#include "attachment.h" 32#include "attachment.h"
33#include "listbase.h" 33#include "listbase.h"
34#include "incidencebase.h" 34#include "incidencebase.h"
35 35
36namespace KCal { 36namespace KCal {
37 37
38class Event; 38class Event;
39class Todo; 39class Todo;
40class Journal; 40class Journal;
41 41
42/** 42/**
43 This class provides the base class common to all calendar components. 43 This class provides the base class common to all calendar components.
44*/ 44*/
45class Incidence : public IncidenceBase 45class Incidence : public IncidenceBase
46{ 46{
47 public: 47 public:
48 /** 48 /**
49 This class provides the interface for a visitor of calendar components. It 49 This class provides the interface for a visitor of calendar components. It
50 serves as base class for concrete visitors, which implement certain actions on 50 serves as base class for concrete visitors, which implement certain actions on
51 calendar components. It allows to add functions, which operate on the concrete 51 calendar components. It allows to add functions, which operate on the concrete
52 types of calendar components, without changing the calendar component classes. 52 types of calendar components, without changing the calendar component classes.
53 */ 53 */
54 class Visitor 54 class Visitor
55 { 55 {
56 public: 56 public:
57 /** Destruct Incidence::Visitor */ 57 /** Destruct Incidence::Visitor */
58 virtual ~Visitor() {} 58 virtual ~Visitor() {}
59 59
60 /** 60 /**
61 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions 61 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions
62 on an Event object. 62 on an Event object.
63 */ 63 */
64 virtual bool visit(Event *) { return false; } 64 virtual bool visit(Event *) { return false; }
65 /** 65 /**
66 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions 66 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions
67 on an Todo object. 67 on an Todo object.
68 */ 68 */
69 virtual bool visit(Todo *) { return false; } 69 virtual bool visit(Todo *) { return false; }
70 /** 70 /**
71 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions 71 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions
72 on an Journal object. 72 on an Journal object.
73 */ 73 */
74 virtual bool visit(Journal *) { return false; } 74 virtual bool visit(Journal *) { return false; }
75 75
76 protected: 76 protected:
77 /** Constructor is protected to prevent direct creation of visitor base class. */ 77 /** Constructor is protected to prevent direct creation of visitor base class. */
78 Visitor() {} 78 Visitor() {}
79 }; 79 };
80 80
81 /** 81 /**
82 This class implements a visitor for adding an Incidence to a resource 82 This class implements a visitor for adding an Incidence to a resource
83 supporting addEvent(), addTodo() and addJournal() calls. 83 supporting addEvent(), addTodo() and addJournal() calls.
84 */ 84 */
85 template<class T> 85 template<class T>
86 class AddVisitor : public Visitor 86 class AddVisitor : public Visitor
87 { 87 {
88 public: 88 public:
89 AddVisitor( T *r ) : mResource( r ) {} 89 AddVisitor( T *r ) : mResource( r ) {}
90 bool visit( Event *e ) { return mResource->addEvent( e ); } 90 bool visit( Event *e ) { return mResource->addEvent( e ); }
91 bool visit( Todo *t ) { return mResource->addTodo( t ); } 91 bool visit( Todo *t ) { return mResource->addTodo( t ); }
92 bool visit( Journal *j ) { return mResource->addJournal( j ); } 92 bool visit( Journal *j ) { return mResource->addJournal( j ); }
93 93
94 private: 94 private:
95 T *mResource; 95 T *mResource;
96 }; 96 };
97 97
98 /** enumeration for describing an event's secrecy. */ 98 /** enumeration for describing an event's secrecy. */
99 enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 }; 99 enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 };
100 typedef ListBase<Incidence> List; 100 typedef ListBase<Incidence> List;
101 Incidence(); 101 Incidence();
102 Incidence(const Incidence &); 102 Incidence(const Incidence &);
103 ~Incidence(); 103 ~Incidence();
104 104
105 /** 105 /**
106 Accept IncidenceVisitor. A class taking part in the visitor mechanism has to 106 Accept IncidenceVisitor. A class taking part in the visitor mechanism has to
107 provide this implementation: 107 provide this implementation:
108 <pre> 108 <pre>
109 bool accept(Visitor &v) { return v.visit(this); } 109 bool accept(Visitor &v) { return v.visit(this); }
110 </pre> 110 </pre>
111 */ 111 */
112 virtual bool accept(Visitor &) { return false; } 112 virtual bool accept(Visitor &) { return false; }
113 113
114 virtual Incidence *clone() = 0; 114 virtual Incidence *clone() = 0;
115 virtual void cloneRelations( Incidence * ); 115 virtual void cloneRelations( Incidence * );
116 void addRelationsToList(QPtrList<Incidence> *rel); 116 void addRelationsToList(QPtrList<Incidence> *rel);
117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0; 117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0;
118 void setReadOnly( bool ); 118 void setReadOnly( bool );
119 119
120 /** 120 /**
121 Recreate event. The event is made a new unique event, but already stored 121 Recreate event. The event is made a new unique event, but already stored
122 event information is preserved. Sets uniquie id, creation date, last 122 event information is preserved. Sets uniquie id, creation date, last
123 modification date and revision number. 123 modification date and revision number.
124 */ 124 */
125 void recreate(); 125 void recreate();
126 Incidence* recreateCloneException(QDate); 126 Incidence* recreateCloneException(QDate);
127 127
128 /** set creation date */ 128 /** set creation date */
129 void setCreated(QDateTime); 129 void setCreated(QDateTime);
130 /** return time and date of creation. */ 130 /** return time and date of creation. */
131 QDateTime created() const; 131 QDateTime created() const;
132 132
133 /** set the number of revisions this event has seen */ 133 /** set the number of revisions this event has seen */
134 void setRevision(int rev); 134 void setRevision(int rev);
135 /** return the number of revisions this event has seen */ 135 /** return the number of revisions this event has seen */
136 int revision() const; 136 int revision() const;
137 137
138 /** Set starting date/time. */ 138 /** Set starting date/time. */
139 virtual void setDtStart(const QDateTime &dtStart); 139 virtual void setDtStart(const QDateTime &dtStart);
140 /** Return the incidence's ending date/time as a QDateTime. */ 140 /** Return the incidence's ending date/time as a QDateTime. */
141 virtual QDateTime dtEnd() const { return QDateTime(); } 141 virtual QDateTime dtEnd() const { return QDateTime(); }
142 142
143 /** sets the event's lengthy description. */ 143 /** sets the event's lengthy description. */
144 void setDescription(const QString &description); 144 void setDescription(const QString &description);
145 /** returns a reference to the event's description. */ 145 /** returns a reference to the event's description. */
146 QString description() const; 146 QString description() const;
147 147
148 /** sets the event's short summary. */ 148 /** sets the event's short summary. */
149 void setSummary(const QString &summary); 149 void setSummary(const QString &summary);
150 /** returns a reference to the event's summary. */ 150 /** returns a reference to the event's summary. */
151 QString summary() const; 151 QString summary() const;
152 152
153 /** set event's applicable categories */ 153 /** set event's applicable categories */
154 void setCategories(const QStringList &categories, bool setForRelations = false); 154 void setCategories(const QStringList &categories, bool setForRelations = false);
155 void addCategories(const QStringList &categories, bool addToRelations = false); 155 void addCategories(const QStringList &categories, bool addToRelations = false);
156 /** set event's categories based on a comma delimited string */ 156 /** set event's categories based on a comma delimited string */
157 void setCategories(const QString &catStr); 157 void setCategories(const QString &catStr);
158 /** return categories in a list */ 158 /** return categories in a list */
159 QStringList categories() const; 159 QStringList categories() const;
160 QStringList* categoriesP(); 160 QStringList* categoriesP();
161 /** return categories as a comma separated string */ 161 /** return categories as a comma separated string */
162 QString categoriesStr(); 162 QString categoriesStr();
163 QString categoriesStrWithSpace(); 163 QString categoriesStrWithSpace();
164 164
165 /** point at some other event to which the event relates. This function should 165 /** point at some other event to which the event relates. This function should
166 * only be used when constructing a calendar before the related Event 166 * only be used when constructing a calendar before the related Event
167 * exists. */ 167 * exists. */
168 void setRelatedToUid(const QString &); 168 void setRelatedToUid(const QString &);
169 /** what event does this one relate to? This function should 169 /** what event does this one relate to? This function should
170 * only be used when constructing a calendar before the related Event 170 * only be used when constructing a calendar before the related Event
171 * exists. */ 171 * exists. */
172 QString relatedToUid() const; 172 QString relatedToUid() const;
173 /** point at some other event to which the event relates */ 173 /** point at some other event to which the event relates */
174 void setRelatedTo(Incidence *relatedTo); 174 void setRelatedTo(Incidence *relatedTo);
175 /** what event does this one relate to? */ 175 /** what event does this one relate to? */
176 Incidence *relatedTo() const; 176 Incidence *relatedTo() const;
177 /** All events that are related to this event */ 177 /** All events that are related to this event */
178 QPtrList<Incidence> relations() const; 178 QPtrList<Incidence> relations() const;
179 /** Add an event which is related to this event */ 179 /** Add an event which is related to this event */
180 void addRelation(Incidence *); 180 void addRelation(Incidence *);
181 /** Remove event that is related to this event */ 181 /** Remove event that is related to this event */
182 void removeRelation(Incidence *); 182 void removeRelation(Incidence *);
183 183
184 /** returns the list of dates which are exceptions to the recurrence rule */ 184 /** returns the list of dates which are exceptions to the recurrence rule */
185 DateList exDates() const; 185 DateList exDates() const;
186 /** sets the list of dates which are exceptions to the recurrence rule */ 186 /** sets the list of dates which are exceptions to the recurrence rule */
187 void setExDates(const DateList &_exDates); 187 void setExDates(const DateList &_exDates);
188 void setExDates(const char *dates); 188 void setExDates(const char *dates);
189 /** Add a date to the list of exceptions of the recurrence rule. */ 189 /** Add a date to the list of exceptions of the recurrence rule. */
190 void addExDate(const QDate &date); 190 void addExDate(const QDate &date);
191 191
192 /** returns true if there is an exception for this date in the recurrence 192 /** returns true if there is an exception for this date in the recurrence
193 rule set, or false otherwise. */ 193 rule set, or false otherwise. */
194 bool isException(const QDate &qd) const; 194 bool isException(const QDate &qd) const;
195 195
196 /** add attachment to this event */ 196 /** add attachment to this event */
197 void addAttachment(Attachment *attachment); 197 void addAttachment(Attachment *attachment);
198 /** remove and delete a specific attachment */ 198 /** remove and delete a specific attachment */
199 void deleteAttachment(Attachment *attachment); 199 void deleteAttachment(Attachment *attachment);
200 /** remove and delete all attachments with this mime type */ 200 /** remove and delete all attachments with this mime type */
201 void deleteAttachments(const QString& mime); 201 void deleteAttachments(const QString& mime);
202 /** return list of all associated attachments */ 202 /** return list of all associated attachments */
203 QPtrList<Attachment> attachments() const; 203 QPtrList<Attachment> attachments() const;
204 /** find a list of attachments with this mime type */ 204 /** find a list of attachments with this mime type */
205 QPtrList<Attachment> attachments(const QString& mime) const; 205 QPtrList<Attachment> attachments(const QString& mime) const;
206 206
207 /** sets the event's status the value specified. See the enumeration 207 /** sets the event's status the value specified. See the enumeration
208 * above for possible values. */ 208 * above for possible values. */
209 void setSecrecy(int); 209 void setSecrecy(int);
210 /** return the event's secrecy. */ 210 /** return the event's secrecy. */
211 int secrecy() const; 211 int secrecy() const;
212 /** return the event's secrecy in string format. */ 212 /** return the event's secrecy in string format. */
213 QString secrecyStr() const; 213 QString secrecyStr() const;
214 /** return list of all availbale secrecy classes */ 214 /** return list of all availbale secrecy classes */
215 static QStringList secrecyList(); 215 static QStringList secrecyList();
216 /** return human-readable name of secrecy class */ 216 /** return human-readable name of secrecy class */
217 static QString secrecyName(int); 217 static QString secrecyName(int);
218 218
219 /** returns TRUE if the date specified is one on which the event will 219 /** returns TRUE if the date specified is one on which the event will
220 * recur. */ 220 * recur. */
221 bool recursOn(const QDate &qd) const; 221 bool recursOn(const QDate &qd) const;
222 222
223 // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): 223 // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?):
224 224
225 /** set resources used, such as Office, Car, etc. */ 225 /** set resources used, such as Office, Car, etc. */
226 void setResources(const QStringList &resources); 226 void setResources(const QStringList &resources);
227 /** return list of current resources */ 227 /** return list of current resources */
228 QStringList resources() const; 228 QStringList resources() const;
229 229
230 /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ 230 /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */
231 void setPriority(int priority); 231 void setPriority(int priority);
232 /** get the event's priority */ 232 /** get the event's priority */
233 int priority() const; 233 int priority() const;
234 234
235 /** All alarms that are associated with this incidence */ 235 /** All alarms that are associated with this incidence */
236 QPtrList<Alarm> alarms() const; 236 QPtrList<Alarm> alarms() const;
237 /** Create a new alarm which is associated with this incidence */ 237 /** Create a new alarm which is associated with this incidence */
238 Alarm* newAlarm(); 238 Alarm* newAlarm();
239 /** Add an alarm which is associated with this incidence */ 239 /** Add an alarm which is associated with this incidence */
240 void addAlarm(Alarm*); 240 void addAlarm(Alarm*);
241 /** Remove an alarm that is associated with this incidence */ 241 /** Remove an alarm that is associated with this incidence */
242 void removeAlarm(Alarm*); 242 void removeAlarm(Alarm*);
243 /** Remove all alarms that are associated with this incidence */ 243 /** Remove all alarms that are associated with this incidence */
244 void clearAlarms(); 244 void clearAlarms();
245 /** return whether any alarm associated with this incidence is enabled */ 245 /** return whether any alarm associated with this incidence is enabled */
246 bool isAlarmEnabled() const; 246 bool isAlarmEnabled() const;
247 247
248 /** 248 /**
249 Return the recurrence rule associated with this incidence. If there is 249 Return the recurrence rule associated with this incidence. If there is
250 none, returns an appropriate (non-0) object. 250 none, returns an appropriate (non-0) object.
251 */ 251 */
252 Recurrence *recurrence() const; 252 Recurrence *recurrence() const;
253 void setRecurrence(Recurrence * r); 253 void setRecurrence(Recurrence * r);
254 /** 254 /**
255 Forward to Recurrence::doesRecur(). 255 Forward to Recurrence::doesRecur().
256 */ 256 */
257 ushort doesRecur() const; 257 ushort doesRecur() const;
258 258
259 /** set the event's/todo's location. Do _not_ use it with journal */ 259 /** set the event's/todo's location. Do _not_ use it with journal */
260 void setLocation(const QString &location); 260 void setLocation(const QString &location);
261 /** return the event's/todo's location. Do _not_ use it with journal */ 261 /** return the event's/todo's location. Do _not_ use it with journal */
262 QString location() const; 262 QString location() const;
263 /** returns TRUE or FALSE depending on whether the todo has a start date */ 263 /** returns TRUE or FALSE depending on whether the todo has a start date */
264 bool hasStartDate() const; 264 bool hasStartDate() const;
265 /** sets the event's hasStartDate value. */ 265 /** sets the event's hasStartDate value. */
266 void setHasStartDate(bool f); 266 void setHasStartDate(bool f);
267 QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; 267 QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const;
268 bool cancelled() const; 268 bool cancelled() const;
269 void setCancelled( bool b ); 269 void setCancelled( bool b );
270 270
271 bool hasRecurrenceID() const; 271 bool hasRecurrenceID() const;
272 void setHasRecurrenceID( bool b ); 272 void setHasRecurrenceID( bool b );
273 273
274 void setRecurrenceID(QDateTime); 274 void setRecurrenceID(QDateTime);
275 QDateTime recurrenceID () const; 275 QDateTime recurrenceID () const;
276 QDateTime dtStart() const; 276 QDateTime dtStart() const;
277 bool isHoliday() const; 277 bool isHoliday() const;
278 bool isBirthday() const; 278 bool isBirthday() const;
279 bool isAnniversary() const; 279 bool isAnniversary() const;
280 QDateTime lastModifiedSub();
281 void setLastModifiedSubInvalid();
280 282
281 283
282protected: 284protected:
283 QPtrList<Alarm> mAlarms; 285 QPtrList<Alarm> mAlarms;
284 QPtrList<Incidence> mRelations; 286 QPtrList<Incidence> mRelations;
285 QDateTime mRecurrenceID; 287 QDateTime mRecurrenceID;
286 bool mHasRecurrenceID; 288 bool mHasRecurrenceID;
287 private: 289 private:
288 void checkCategories(); 290 void checkCategories();
289 bool mHoliday, mBirthday, mAnniversary; 291 bool mHoliday, mBirthday, mAnniversary;
290 int mRevision; 292 int mRevision;
291 bool mCancelled; 293 bool mCancelled;
292 294
293 // base components of jounal, event and todo 295 // base components of jounal, event and todo
294 QDateTime mCreated; 296 QDateTime mCreated;
297 QDateTime mLastModifiedSub;
295 QString mDescription; 298 QString mDescription;
296 QString mSummary; 299 QString mSummary;
297 QStringList mCategories; 300 QStringList mCategories;
298 Incidence *mRelatedTo; 301 Incidence *mRelatedTo;
299 QString mRelatedToUid; 302 QString mRelatedToUid;
300 DateList mExDates; 303 DateList mExDates;
301 QPtrList<Attachment> mAttachments; 304 QPtrList<Attachment> mAttachments;
302 QStringList mResources; 305 QStringList mResources;
303 bool mHasStartDate; // if todo has associated start date 306 bool mHasStartDate; // if todo has associated start date
304 307
305 int mSecrecy; 308 int mSecrecy;
306 int mPriority; // 1 = highest, 2 = less, etc. 309 int mPriority; // 1 = highest, 2 = less, etc.
307 310
308 //QPtrList<Alarm> mAlarms; 311 //QPtrList<Alarm> mAlarms;
309 Recurrence *mRecurrence; 312 Recurrence *mRecurrence;
310 313
311 QString mLocation; 314 QString mLocation;
312}; 315};
313 316
314bool operator==( const Incidence&, const Incidence& ); 317bool operator==( const Incidence&, const Incidence& );
315 318
316} 319}
317 320
318#endif 321#endif
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 1a19f3e..022dead 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -1,478 +1,482 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library 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 GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include <kglobal.h> 21#include <kglobal.h>
22#include <klocale.h> 22#include <klocale.h>
23#include <kdebug.h> 23#include <kdebug.h>
24#include <kidmanager.h> 24#include <kidmanager.h>
25 25
26#include "calformat.h" 26#include "calformat.h"
27#include "syncdefines.h" 27#include "syncdefines.h"
28 28
29#include "incidencebase.h" 29#include "incidencebase.h"
30 30
31using namespace KCal; 31using namespace KCal;
32 32
33IncidenceBase::IncidenceBase() : 33IncidenceBase::IncidenceBase() :
34 mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false), 34 mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false),
35 mPilotId(0), mSyncStatus(SYNCMOD) 35 mPilotId(0), mSyncStatus(SYNCMOD)
36{ 36{
37 blockLastModified = false; 37 blockLastModified = false;
38 setUid(CalFormat::createUniqueId()); 38 setUid(CalFormat::createUniqueId());
39 mOrganizer = ""; 39 mOrganizer = "";
40 mFloats = false; 40 mFloats = false;
41 mDuration = 0; 41 mDuration = 0;
42 mHasDuration = false; 42 mHasDuration = false;
43 mPilotId = 0; 43 mPilotId = 0;
44 mExternalId = ":"; 44 mExternalId = ":";
45 mTempSyncStat = SYNC_TEMPSTATE_INITIAL; 45 mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
46 mSyncStatus = 0; 46 mSyncStatus = 0;
47 mAttendees.setAutoDelete( true ); 47 mAttendees.setAutoDelete( true );
48 mCalEnabled = true; 48 mCalEnabled = true;
49 mAlarmEnabled = true; 49 mAlarmEnabled = true;
50 mCalID = 0; 50 mCalID = 0;
51} 51}
52 52
53IncidenceBase::IncidenceBase(const IncidenceBase &i) : 53IncidenceBase::IncidenceBase(const IncidenceBase &i) :
54 CustomProperties( i ) 54 CustomProperties( i )
55{ 55{
56 56
57 blockLastModified = false; 57 blockLastModified = false;
58 mReadOnly = i.mReadOnly; 58 mReadOnly = i.mReadOnly;
59 mDtStart = i.mDtStart; 59 mDtStart = i.mDtStart;
60 mDuration = i.mDuration; 60 mDuration = i.mDuration;
61 mHasDuration = i.mHasDuration; 61 mHasDuration = i.mHasDuration;
62 mOrganizer = i.mOrganizer; 62 mOrganizer = i.mOrganizer;
63 mUid = i.mUid; 63 mUid = i.mUid;
64 mCalEnabled = i.mCalEnabled; 64 mCalEnabled = i.mCalEnabled;
65 mAlarmEnabled = i.mAlarmEnabled; 65 mAlarmEnabled = i.mAlarmEnabled;
66 mCalID = i.mCalID; 66 mCalID = i.mCalID;
67 QPtrList<Attendee> attendees = i.attendees(); 67 QPtrList<Attendee> attendees = i.attendees();
68 for( Attendee *a = attendees.first(); a; a = attendees.next() ) { 68 for( Attendee *a = attendees.first(); a; a = attendees.next() ) {
69 mAttendees.append( new Attendee( *a ) ); 69 mAttendees.append( new Attendee( *a ) );
70 } 70 }
71 mFloats = i.mFloats; 71 mFloats = i.mFloats;
72 mLastModified = i.mLastModified; 72 mLastModified = i.mLastModified;
73 mPilotId = i.mPilotId; 73 mPilotId = i.mPilotId;
74 mTempSyncStat = i.mTempSyncStat; 74 mTempSyncStat = i.mTempSyncStat;
75 mSyncStatus = i.mSyncStatus; 75 mSyncStatus = i.mSyncStatus;
76 mExternalId = i.mExternalId; 76 mExternalId = i.mExternalId;
77 // The copied object is a new one, so it isn't observed by the observer 77 // The copied object is a new one, so it isn't observed by the observer
78 // of the original object. 78 // of the original object.
79 mObservers.clear(); 79 mObservers.clear();
80 80
81 mAttendees.setAutoDelete( true ); 81 mAttendees.setAutoDelete( true );
82} 82}
83 83
84IncidenceBase::~IncidenceBase() 84IncidenceBase::~IncidenceBase()
85{ 85{
86} 86}
87 87
88 88
89bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) 89bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 )
90{ 90{
91 // do not compare mSyncStatus and mExternalId 91 // do not compare mSyncStatus and mExternalId
92 if( i1.attendees().count() != i2.attendees().count() ) { 92 if( i1.attendees().count() != i2.attendees().count() ) {
93 return false; // no need to check further 93 return false; // no need to check further
94 } 94 }
95 if ( i1.attendees().count() > 0 ) { 95 if ( i1.attendees().count() > 0 ) {
96 Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ; 96 Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ;
97 while ( a1 ) { 97 while ( a1 ) {
98 if ( !( (*a1) == (*a2)) ) 98 if ( !( (*a1) == (*a2)) )
99 { 99 {
100 //qDebug("Attendee not equal "); 100 //qDebug("Attendee not equal ");
101 return false; 101 return false;
102 } 102 }
103 a1 = i1.attendees().next(); 103 a1 = i1.attendees().next();
104 a2 = i2.attendees().next(); 104 a2 = i2.attendees().next();
105 } 105 }
106 } 106 }
107 //if ( i1.dtStart() != i2.dtStart() ) 107 //if ( i1.dtStart() != i2.dtStart() )
108 // return false; 108 // return false;
109#if 0 109#if 0
110 qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); 110 qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() );
111 qDebug("1 %d ",i1.duration() == i2.duration() ); 111 qDebug("1 %d ",i1.duration() == i2.duration() );
112 qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); 112 qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() );
113 qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); 113 qDebug("1 %d ",i1.pilotId() == i2.pilotId() );
114 qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); 114 qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() );
115 qDebug("6 %d ",i1.organizer() == i2.organizer() ); 115 qDebug("6 %d ",i1.organizer() == i2.organizer() );
116 116
117#endif 117#endif
118 if ( i1.hasDuration() == i2.hasDuration() ) { 118 if ( i1.hasDuration() == i2.hasDuration() ) {
119 if ( i1.hasDuration() ) { 119 if ( i1.hasDuration() ) {
120 if ( i1.duration() != i2.duration() ) 120 if ( i1.duration() != i2.duration() )
121 return false; 121 return false;
122 } 122 }
123 } else { 123 } else {
124 return false; 124 return false;
125 } 125 }
126 126
127 return ( i1.organizer() == i2.organizer() && 127 return ( i1.organizer() == i2.organizer() &&
128 // i1.uid() == i2.uid() && 128 // i1.uid() == i2.uid() &&
129 // Don't compare lastModified, otherwise the operator is not 129 // Don't compare lastModified, otherwise the operator is not
130 // of much use. We are not comparing for identity, after all. 130 // of much use. We are not comparing for identity, after all.
131 i1.doesFloat() == i2.doesFloat() && 131 i1.doesFloat() == i2.doesFloat() &&
132 i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); 132 i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() );
133 // no need to compare mObserver 133 // no need to compare mObserver
134} 134}
135 135
136 136
137QDateTime IncidenceBase::getEvenTime( QDateTime dt ) 137QDateTime IncidenceBase::getEvenTime( QDateTime dt )
138{ 138{
139 QTime t = dt.time(); 139 QTime t = dt.time();
140 dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 140 dt.setTime( QTime (t.hour (), t.minute (), t.second () ) );
141 return dt; 141 return dt;
142} 142}
143 143
144bool IncidenceBase::isTagged() const 144bool IncidenceBase::isTagged() const
145{ 145{
146 return mIsTagged; 146 return mIsTagged;
147} 147}
148void IncidenceBase::setTagged( bool b) 148void IncidenceBase::setTagged( bool b)
149{ 149{
150 mIsTagged = b; 150 mIsTagged = b;
151} 151}
152void IncidenceBase::setCalID( int id ) 152void IncidenceBase::setCalID( int id )
153{ 153{
154 if ( mCalID > 0 ) { 154 if ( mCalID > 0 ) {
155 blockLastModified = true; 155 blockLastModified = true;
156 updated(); 156 updated();
157 blockLastModified = false; 157 blockLastModified = false;
158 } 158 }
159 mCalID = id; 159 mCalID = id;
160} 160}
161int IncidenceBase::calID() const 161int IncidenceBase::calID() const
162{ 162{
163 return mCalID; 163 return mCalID;
164} 164}
165void IncidenceBase::setCalEnabled( bool b ) 165void IncidenceBase::setCalEnabled( bool b )
166{ 166{
167 mCalEnabled = b; 167 mCalEnabled = b;
168} 168}
169bool IncidenceBase::calEnabled() const 169bool IncidenceBase::calEnabled() const
170{ 170{
171 return mCalEnabled; 171 return mCalEnabled;
172} 172}
173 173
174void IncidenceBase::setAlarmEnabled( bool b ) 174void IncidenceBase::setAlarmEnabled( bool b )
175{ 175{
176 mAlarmEnabled = b; 176 mAlarmEnabled = b;
177} 177}
178bool IncidenceBase::alarmEnabled() const 178bool IncidenceBase::alarmEnabled() const
179{ 179{
180 return mAlarmEnabled; 180 return mAlarmEnabled;
181} 181}
182 182
183 183
184void IncidenceBase::setUid(const QString &uid) 184void IncidenceBase::setUid(const QString &uid)
185{ 185{
186 mUid = uid; 186 mUid = uid;
187 updated(); 187 updated();
188} 188}
189 189
190QString IncidenceBase::uid() const 190QString IncidenceBase::uid() const
191{ 191{
192 return mUid; 192 return mUid;
193} 193}
194void IncidenceBase::setLastModifiedSubInvalid()
195{
194 196
197}
195void IncidenceBase::setLastModified(const QDateTime &lm) 198void IncidenceBase::setLastModified(const QDateTime &lm)
196{ 199{
197 if ( blockLastModified ) return; 200 if ( blockLastModified ) return;
198 // DON'T! updated() because we call this from 201 // DON'T! updated() because we call this from
199 // Calendar::updateEvent(). 202 // Calendar::updateEvent().
200 mLastModified = getEvenTime(lm); 203 mLastModified = getEvenTime(lm);
204 setLastModifiedSubInvalid();
201 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); 205 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1());
202} 206}
203 207
204QDateTime IncidenceBase::lastModified() const 208QDateTime IncidenceBase::lastModified() const
205{ 209{
206 return mLastModified; 210 return mLastModified;
207} 211}
208 212
209void IncidenceBase::setOrganizer(const QString &o) 213void IncidenceBase::setOrganizer(const QString &o)
210{ 214{
211 // we don't check for readonly here, because it is 215 // we don't check for readonly here, because it is
212 // possible that by setting the organizer we are changing 216 // possible that by setting the organizer we are changing
213 // the event's readonly status... 217 // the event's readonly status...
214 mOrganizer = o; 218 mOrganizer = o;
215 if (mOrganizer.left(7).upper() == "MAILTO:") 219 if (mOrganizer.left(7).upper() == "MAILTO:")
216 mOrganizer = mOrganizer.remove(0,7); 220 mOrganizer = mOrganizer.remove(0,7);
217 221
218 updated(); 222 updated();
219} 223}
220 224
221QString IncidenceBase::organizer() const 225QString IncidenceBase::organizer() const
222{ 226{
223 return mOrganizer; 227 return mOrganizer;
224} 228}
225 229
226void IncidenceBase::setReadOnly( bool readOnly ) 230void IncidenceBase::setReadOnly( bool readOnly )
227{ 231{
228 mReadOnly = readOnly; 232 mReadOnly = readOnly;
229} 233}
230 234
231void IncidenceBase::setDtStart(const QDateTime &dtStart) 235void IncidenceBase::setDtStart(const QDateTime &dtStart)
232{ 236{
233// if (mReadOnly) return; 237// if (mReadOnly) return;
234 mDtStart = getEvenTime(dtStart); 238 mDtStart = getEvenTime(dtStart);
235 updated(); 239 updated();
236} 240}
237 241
238 242
239QDateTime IncidenceBase::dtStart() const 243QDateTime IncidenceBase::dtStart() const
240{ 244{
241 return mDtStart; 245 return mDtStart;
242} 246}
243 247
244QString IncidenceBase::dtStartTimeStr() const 248QString IncidenceBase::dtStartTimeStr() const
245{ 249{
246 return KGlobal::locale()->formatTime(dtStart().time()); 250 return KGlobal::locale()->formatTime(dtStart().time());
247} 251}
248 252
249QString IncidenceBase::dtStartDateStr(bool shortfmt) const 253QString IncidenceBase::dtStartDateStr(bool shortfmt) const
250{ 254{
251 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); 255 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt);
252} 256}
253 257
254QString IncidenceBase::dtStartStr(bool shortfmt) const 258QString IncidenceBase::dtStartStr(bool shortfmt) const
255{ 259{
256 if ( doesFloat() ) 260 if ( doesFloat() )
257 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); 261 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt);
258 return KGlobal::locale()->formatDateTime(dtStart(), shortfmt); 262 return KGlobal::locale()->formatDateTime(dtStart(), shortfmt);
259} 263}
260 264
261 265
262bool IncidenceBase::doesFloat() const 266bool IncidenceBase::doesFloat() const
263{ 267{
264 return mFloats; 268 return mFloats;
265} 269}
266 270
267void IncidenceBase::setFloats(bool f) 271void IncidenceBase::setFloats(bool f)
268{ 272{
269 if (mReadOnly) return; 273 if (mReadOnly) return;
270 mFloats = f; 274 mFloats = f;
271 updated(); 275 updated();
272} 276}
273 277
274 278
275bool IncidenceBase::addAttendee(Attendee *a, bool doupdate) 279bool IncidenceBase::addAttendee(Attendee *a, bool doupdate)
276{ 280{
277 if (mReadOnly) return false; 281 if (mReadOnly) return false;
278 if (a->name().left(7).upper() == "MAILTO:") 282 if (a->name().left(7).upper() == "MAILTO:")
279 a->setName(a->name().remove(0,7)); 283 a->setName(a->name().remove(0,7));
280 284
281 QPtrListIterator<Attendee> qli(mAttendees); 285 QPtrListIterator<Attendee> qli(mAttendees);
282 286
283 qli.toFirst(); 287 qli.toFirst();
284 while (qli) { 288 while (qli) {
285 if (*qli.current() == *a) 289 if (*qli.current() == *a)
286 return false; 290 return false;
287 ++qli; 291 ++qli;
288 } 292 }
289 mAttendees.append(a); 293 mAttendees.append(a);
290 if (doupdate) updated(); 294 if (doupdate) updated();
291 return true; 295 return true;
292} 296}
293 297
294#if 0 298#if 0
295void IncidenceBase::removeAttendee(Attendee *a) 299void IncidenceBase::removeAttendee(Attendee *a)
296{ 300{
297 if (mReadOnly) return; 301 if (mReadOnly) return;
298 mAttendees.removeRef(a); 302 mAttendees.removeRef(a);
299 updated(); 303 updated();
300} 304}
301 305
302void IncidenceBase::removeAttendee(const char *n) 306void IncidenceBase::removeAttendee(const char *n)
303{ 307{
304 Attendee *a; 308 Attendee *a;
305 309
306 if (mReadOnly) return; 310 if (mReadOnly) return;
307 for (a = mAttendees.first(); a; a = mAttendees.next()) 311 for (a = mAttendees.first(); a; a = mAttendees.next())
308 if (a->getName() == n) { 312 if (a->getName() == n) {
309 mAttendees.remove(); 313 mAttendees.remove();
310 break; 314 break;
311 } 315 }
312} 316}
313#endif 317#endif
314 318
315void IncidenceBase::clearAttendees() 319void IncidenceBase::clearAttendees()
316{ 320{
317 if (mReadOnly) return; 321 if (mReadOnly) return;
318 mAttendees.clear(); 322 mAttendees.clear();
319} 323}
320 324
321#if 0 325#if 0
322Attendee *IncidenceBase::getAttendee(const char *n) const 326Attendee *IncidenceBase::getAttendee(const char *n) const
323{ 327{
324 QPtrListIterator<Attendee> qli(mAttendees); 328 QPtrListIterator<Attendee> qli(mAttendees);
325 329
326 qli.toFirst(); 330 qli.toFirst();
327 while (qli) { 331 while (qli) {
328 if (qli.current()->getName() == n) 332 if (qli.current()->getName() == n)
329 return qli.current(); 333 return qli.current();
330 ++qli; 334 ++qli;
331 } 335 }
332 return 0L; 336 return 0L;
333} 337}
334#endif 338#endif
335 339
336Attendee *IncidenceBase::attendeeByMail(const QString &email) 340Attendee *IncidenceBase::attendeeByMail(const QString &email)
337{ 341{
338 QPtrListIterator<Attendee> qli(mAttendees); 342 QPtrListIterator<Attendee> qli(mAttendees);
339 343
340 qli.toFirst(); 344 qli.toFirst();
341 while (qli) { 345 while (qli) {
342 if (qli.current()->email().lower() == email.lower()) 346 if (qli.current()->email().lower() == email.lower())
343 return qli.current(); 347 return qli.current();
344 ++qli; 348 ++qli;
345 } 349 }
346 return 0L; 350 return 0L;
347} 351}
348 352
349Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email) 353Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email)
350{ 354{
351 QPtrListIterator<Attendee> qli(mAttendees); 355 QPtrListIterator<Attendee> qli(mAttendees);
352 356
353 QStringList mails = emails; 357 QStringList mails = emails;
354 if (!email.isEmpty()) { 358 if (!email.isEmpty()) {
355 mails.append(email); 359 mails.append(email);
356 } 360 }
357 qli.toFirst(); 361 qli.toFirst();
358 while (qli) { 362 while (qli) {
359 for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) { 363 for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) {
360 if (qli.current()->email().lower() == (*it).lower()) 364 if (qli.current()->email().lower() == (*it).lower())
361 return qli.current(); 365 return qli.current();
362 } 366 }
363 367
364 ++qli; 368 ++qli;
365 } 369 }
366 return 0L; 370 return 0L;
367} 371}
368 372
369void IncidenceBase::setDuration(int seconds) 373void IncidenceBase::setDuration(int seconds)
370{ 374{
371 mDuration = seconds; 375 mDuration = seconds;
372 setHasDuration(true); 376 setHasDuration(true);
373} 377}
374 378
375int IncidenceBase::duration() const 379int IncidenceBase::duration() const
376{ 380{
377 return mDuration; 381 return mDuration;
378} 382}
379 383
380void IncidenceBase::setHasDuration(bool b) 384void IncidenceBase::setHasDuration(bool b)
381{ 385{
382 mHasDuration = b; 386 mHasDuration = b;
383} 387}
384 388
385bool IncidenceBase::hasDuration() const 389bool IncidenceBase::hasDuration() const
386{ 390{
387 return mHasDuration; 391 return mHasDuration;
388} 392}
389 393
390void IncidenceBase::setSyncStatus(int stat) 394void IncidenceBase::setSyncStatus(int stat)
391{ 395{
392 if (mReadOnly) return; 396 if (mReadOnly) return;
393 mSyncStatus = stat; 397 mSyncStatus = stat;
394} 398}
395 399
396int IncidenceBase::syncStatus() const 400int IncidenceBase::syncStatus() const
397{ 401{
398 return mSyncStatus; 402 return mSyncStatus;
399} 403}
400 404
401void IncidenceBase::setPilotId( int id ) 405void IncidenceBase::setPilotId( int id )
402{ 406{
403 if (mReadOnly) return; 407 if (mReadOnly) return;
404 mPilotId = id; 408 mPilotId = id;
405} 409}
406 410
407int IncidenceBase::pilotId() const 411int IncidenceBase::pilotId() const
408{ 412{
409 return mPilotId; 413 return mPilotId;
410} 414}
411 415
412int IncidenceBase::tempSyncStat() const 416int IncidenceBase::tempSyncStat() const
413{ 417{
414 return mTempSyncStat; 418 return mTempSyncStat;
415} 419}
416void IncidenceBase::setTempSyncStat( int id ) 420void IncidenceBase::setTempSyncStat( int id )
417{ 421{
418 if (mReadOnly) return; 422 if (mReadOnly) return;
419 mTempSyncStat = id; 423 mTempSyncStat = id;
420} 424}
421 425
422void IncidenceBase::removeID(const QString &prof) 426void IncidenceBase::removeID(const QString &prof)
423{ 427{
424 if ( prof.isEmpty() ) 428 if ( prof.isEmpty() )
425 mExternalId = ":"; 429 mExternalId = ":";
426 else 430 else
427 mExternalId = KIdManager::removeId ( mExternalId, prof); 431 mExternalId = KIdManager::removeId ( mExternalId, prof);
428 432
429} 433}
430void IncidenceBase::setID( const QString & prof , const QString & id ) 434void IncidenceBase::setID( const QString & prof , const QString & id )
431{ 435{
432 mExternalId = KIdManager::setId ( mExternalId, prof, id ); 436 mExternalId = KIdManager::setId ( mExternalId, prof, id );
433} 437}
434QString IncidenceBase::getID( const QString & prof) 438QString IncidenceBase::getID( const QString & prof)
435{ 439{
436 return KIdManager::getId ( mExternalId, prof ); 440 return KIdManager::getId ( mExternalId, prof );
437} 441}
438 442
439// example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: 443// example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0:
440// format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 444// format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0
441void IncidenceBase::setCsum( const QString & prof , const QString & id ) 445void IncidenceBase::setCsum( const QString & prof , const QString & id )
442{ 446{
443 mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); 447 mExternalId = KIdManager::setCsum ( mExternalId, prof, id );
444} 448}
445QString IncidenceBase::getCsum( const QString & prof) 449QString IncidenceBase::getCsum( const QString & prof)
446{ 450{
447 return KIdManager::getCsum ( mExternalId, prof ); 451 return KIdManager::getCsum ( mExternalId, prof );
448} 452}
449 453
450void IncidenceBase::setIDStr( const QString & s ) 454void IncidenceBase::setIDStr( const QString & s )
451{ 455{
452 if (mReadOnly) return; 456 if (mReadOnly) return;
453 mExternalId = s; 457 mExternalId = s;
454} 458}
455 459
456QString IncidenceBase::IDStr() const 460QString IncidenceBase::IDStr() const
457{ 461{
458 return mExternalId ; 462 return mExternalId ;
459} 463}
460void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) 464void IncidenceBase::registerObserver( IncidenceBase::Observer *observer )
461{ 465{
462 if( !mObservers.contains(observer) ) mObservers.append( observer ); 466 if( !mObservers.contains(observer) ) mObservers.append( observer );
463} 467}
464 468
465void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) 469void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer )
466{ 470{
467 mObservers.remove( observer ); 471 mObservers.remove( observer );
468} 472}
469 473
470void IncidenceBase::updated() 474void IncidenceBase::updated()
471{ 475{
472 QPtrListIterator<Observer> it(mObservers); 476 QPtrListIterator<Observer> it(mObservers);
473 while( it.current() ) { 477 while( it.current() ) {
474 Observer *o = it.current(); 478 Observer *o = it.current();
475 ++it; 479 ++it;
476 o->incidenceUpdated( this ); 480 o->incidenceUpdated( this );
477 } 481 }
478} 482}
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index bed73db..665c1f6 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -1,186 +1,187 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library 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 GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef KCAL_INCIDENCEBASE_H 20#ifndef KCAL_INCIDENCEBASE_H
21#define KCAL_INCIDENCEBASE_H 21#define KCAL_INCIDENCEBASE_H
22// 22//
23// Incidence - base class of calendaring components 23// Incidence - base class of calendaring components
24// 24//
25 25
26#include <qdatetime.h> 26#include <qdatetime.h>
27#include <qstringlist.h> 27#include <qstringlist.h>
28#include <qvaluelist.h> 28#include <qvaluelist.h>
29#include <qptrlist.h> 29#include <qptrlist.h>
30 30
31#include "customproperties.h" 31#include "customproperties.h"
32#include "attendee.h" 32#include "attendee.h"
33 33
34namespace KCal { 34namespace KCal {
35 35
36typedef QValueList<QDate> DateList; 36typedef QValueList<QDate> DateList;
37 enum IncTypeID { eventID,todoID,journalID,freebusyID }; 37 enum IncTypeID { eventID,todoID,journalID,freebusyID };
38 38
39/** 39/**
40 This class provides the base class common to all calendar components. 40 This class provides the base class common to all calendar components.
41*/ 41*/
42class IncidenceBase : public CustomProperties 42class IncidenceBase : public CustomProperties
43{ 43{
44 public: 44 public:
45 class Observer { 45 class Observer {
46 public: 46 public:
47 virtual void incidenceUpdated( IncidenceBase * ) = 0; 47 virtual void incidenceUpdated( IncidenceBase * ) = 0;
48 }; 48 };
49 49
50 IncidenceBase(); 50 IncidenceBase();
51 IncidenceBase(const IncidenceBase &); 51 IncidenceBase(const IncidenceBase &);
52 virtual ~IncidenceBase(); 52 virtual ~IncidenceBase();
53 53
54 virtual QCString type() const = 0; 54 virtual QCString type() const = 0;
55 virtual IncTypeID typeID() const = 0; 55 virtual IncTypeID typeID() const = 0;
56 56
57 /** Set the unique id for the event */ 57 /** Set the unique id for the event */
58 void setUid(const QString &); 58 void setUid(const QString &);
59 /** Return the unique id for the event */ 59 /** Return the unique id for the event */
60 QString uid() const; 60 QString uid() const;
61 61
62 /** Sets the time the incidence was last modified. */ 62 /** Sets the time the incidence was last modified. */
63 void setLastModified(const QDateTime &lm); 63 void setLastModified(const QDateTime &lm);
64 /** Return the time the incidence was last modified. */ 64 /** Return the time the incidence was last modified. */
65 QDateTime lastModified() const; 65 QDateTime lastModified() const;
66 66
67 /** sets the organizer for the event */ 67 /** sets the organizer for the event */
68 void setOrganizer(const QString &o); 68 void setOrganizer(const QString &o);
69 QString organizer() const; 69 QString organizer() const;
70 70
71 /** Set readonly status. */ 71 /** Set readonly status. */
72 virtual void setReadOnly( bool ); 72 virtual void setReadOnly( bool );
73 /** Return if the object is read-only. */ 73 /** Return if the object is read-only. */
74 bool isReadOnly() const { return mReadOnly; } 74 bool isReadOnly() const { return mReadOnly; }
75 75
76 /** for setting the event's starting date/time with a QDateTime. */ 76 /** for setting the event's starting date/time with a QDateTime. */
77 virtual void setDtStart(const QDateTime &dtStart); 77 virtual void setDtStart(const QDateTime &dtStart);
78 /** returns an event's starting date/time as a QDateTime. */ 78 /** returns an event's starting date/time as a QDateTime. */
79 virtual QDateTime dtStart() const; 79 virtual QDateTime dtStart() const;
80 /** returns an event's starting time as a string formatted according to the 80 /** returns an event's starting time as a string formatted according to the
81 users locale settings */ 81 users locale settings */
82 QString dtStartTimeStr() const; 82 QString dtStartTimeStr() const;
83 /** returns an event's starting date as a string formatted according to the 83 /** returns an event's starting date as a string formatted according to the
84 users locale settings */ 84 users locale settings */
85 QString dtStartDateStr(bool shortfmt=true) const; 85 QString dtStartDateStr(bool shortfmt=true) const;
86 /** returns an event's starting date and time as a string formatted according 86 /** returns an event's starting date and time as a string formatted according
87 to the users locale settings */ 87 to the users locale settings */
88 QString dtStartStr(bool shortfmt=true) const; 88 QString dtStartStr(bool shortfmt=true) const;
89 89
90 virtual void setDuration(int seconds); 90 virtual void setDuration(int seconds);
91 int duration() const; 91 int duration() const;
92 void setHasDuration(bool); 92 void setHasDuration(bool);
93 bool hasDuration() const; 93 bool hasDuration() const;
94 94
95 /** Return true or false depending on whether the incidence "floats," 95 /** Return true or false depending on whether the incidence "floats,"
96 * i.e. has a date but no time attached to it. */ 96 * i.e. has a date but no time attached to it. */
97 bool doesFloat() const; 97 bool doesFloat() const;
98 /** Set whether the incidence floats, i.e. has a date but no time attached to it. */ 98 /** Set whether the incidence floats, i.e. has a date but no time attached to it. */
99 void setFloats(bool f); 99 void setFloats(bool f);
100 100
101 /** 101 /**
102 Add Attendee to this incidence. IncidenceBase takes ownership of the 102 Add Attendee to this incidence. IncidenceBase takes ownership of the
103 Attendee object. 103 Attendee object.
104 */ 104 */
105 bool addAttendee(Attendee *a, bool doupdate=true ); 105 bool addAttendee(Attendee *a, bool doupdate=true );
106// void removeAttendee(Attendee *a); 106// void removeAttendee(Attendee *a);
107// void removeAttendee(const char *n); 107// void removeAttendee(const char *n);
108 /** Remove all Attendees. */ 108 /** Remove all Attendees. */
109 void clearAttendees(); 109 void clearAttendees();
110 /** Return list of attendees. */ 110 /** Return list of attendees. */
111 QPtrList<Attendee> attendees() const { return mAttendees; }; 111 QPtrList<Attendee> attendees() const { return mAttendees; };
112 /** Return number of attendees. */ 112 /** Return number of attendees. */
113 int attendeeCount() const { return mAttendees.count(); }; 113 int attendeeCount() const { return mAttendees.count(); };
114 /** Return the Attendee with this email */ 114 /** Return the Attendee with this email */
115 Attendee* attendeeByMail(const QString &); 115 Attendee* attendeeByMail(const QString &);
116 /** Return first Attendee with one of this emails */ 116 /** Return first Attendee with one of this emails */
117 Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); 117 Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null);
118 118
119 /** pilot syncronization states */ 119 /** pilot syncronization states */
120 enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; 120 enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 };
121 /** Set synchronisation satus. */ 121 /** Set synchronisation satus. */
122 void setSyncStatus(int stat); 122 void setSyncStatus(int stat);
123 /** Return synchronisation status. */ 123 /** Return synchronisation status. */
124 int syncStatus() const; 124 int syncStatus() const;
125 125
126 /** Set Pilot Id. */ 126 /** Set Pilot Id. */
127 void setPilotId(int id); 127 void setPilotId(int id);
128 /** Return Pilot Id. */ 128 /** Return Pilot Id. */
129 int pilotId() const; 129 int pilotId() const;
130 130
131 void setTempSyncStat(int id); 131 void setTempSyncStat(int id);
132 int tempSyncStat() const; 132 int tempSyncStat() const;
133 void setIDStr( const QString & ); 133 void setIDStr( const QString & );
134 QString IDStr() const; 134 QString IDStr() const;
135 void setID( const QString &, const QString & ); 135 void setID( const QString &, const QString & );
136 QString getID( const QString & ); 136 QString getID( const QString & );
137 void setCsum( const QString &, const QString & ); 137 void setCsum( const QString &, const QString & );
138 QString getCsum( const QString & ); 138 QString getCsum( const QString & );
139 void removeID(const QString &); 139 void removeID(const QString &);
140 140
141 void registerObserver( Observer * ); 141 void registerObserver( Observer * );
142 void unRegisterObserver( Observer * ); 142 void unRegisterObserver( Observer * );
143 void updated(); 143 void updated();
144 void setCalID( int id ); 144 void setCalID( int id );
145 int calID() const; 145 int calID() const;
146 void setCalEnabled( bool ); 146 void setCalEnabled( bool );
147 bool calEnabled() const; 147 bool calEnabled() const;
148 void setAlarmEnabled( bool ); 148 void setAlarmEnabled( bool );
149 bool alarmEnabled() const; 149 bool alarmEnabled() const;
150 bool isTagged() const; 150 bool isTagged() const;
151 void setTagged( bool ); 151 void setTagged( bool );
152 virtual void setLastModifiedSubInvalid();
152 protected: 153 protected:
153 bool blockLastModified; 154 bool blockLastModified;
154 bool mIsTagged; 155 bool mIsTagged;
155 QDateTime mDtStart; 156 QDateTime mDtStart;
156 bool mReadOnly; 157 bool mReadOnly;
157 QDateTime getEvenTime( QDateTime ); 158 QDateTime getEvenTime( QDateTime );
158 159
159 private: 160 private:
160 // base components 161 // base components
161 QString mOrganizer; 162 QString mOrganizer;
162 QString mUid; 163 QString mUid;
163 int mCalID; 164 int mCalID;
164 bool mCalEnabled; 165 bool mCalEnabled;
165 bool mAlarmEnabled; 166 bool mAlarmEnabled;
166 QDateTime mLastModified; 167 QDateTime mLastModified;
167 QPtrList<Attendee> mAttendees; 168 QPtrList<Attendee> mAttendees;
168 169
169 bool mFloats; 170 bool mFloats;
170 171
171 int mDuration; 172 int mDuration;
172 bool mHasDuration; 173 bool mHasDuration;
173 QString mExternalId; 174 QString mExternalId;
174 int mTempSyncStat; 175 int mTempSyncStat;
175 176
176 // PILOT SYNCHRONIZATION STUFF 177 // PILOT SYNCHRONIZATION STUFF
177 int mPilotId; // unique id for pilot sync 178 int mPilotId; // unique id for pilot sync
178 int mSyncStatus; // status (for sync) 179 int mSyncStatus; // status (for sync)
179 180
180 QPtrList<Observer> mObservers; 181 QPtrList<Observer> mObservers;
181}; 182};
182 183
183bool operator==( const IncidenceBase&, const IncidenceBase& ); 184bool operator==( const IncidenceBase&, const IncidenceBase& );
184} 185}
185 186
186#endif 187#endif
diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp
index 5d83511..7f352d6 100644
--- a/libkdepim/kdatepicker.cpp
+++ b/libkdepim/kdatepicker.cpp
@@ -95,394 +95,395 @@ KDatePicker::resizeEvent(QResizeEvent*)
95 QWidget *buttons[] = { 95 QWidget *buttons[] = {
96 yearBackward, 96 yearBackward,
97 monthBackward, 97 monthBackward,
98 selectMonth, 98 selectMonth,
99 selectYear, 99 selectYear,
100 monthForward, 100 monthForward,
101 yearForward }; 101 yearForward };
102 const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); 102 const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]);
103 QSize sizes[NoOfButtons]; 103 QSize sizes[NoOfButtons];
104 int buttonHeight=0; 104 int buttonHeight=0;
105 int count; 105 int count;
106 int w; 106 int w;
107 int x=0; 107 int x=0;
108 // ----- calculate button row height: 108 // ----- calculate button row height:
109 for(count=0; count<NoOfButtons; ++count) { 109 for(count=0; count<NoOfButtons; ++count) {
110 int xS = buttons[count]->sizeHint().width(); 110 int xS = buttons[count]->sizeHint().width();
111 int yS = buttons[count]->sizeHint().height(); 111 int yS = buttons[count]->sizeHint().height();
112 if ( QApplication::desktop()->width() < 320 ) 112 if ( QApplication::desktop()->width() < 320 )
113 sizes[count]=QSize ( xS+4, yS ); 113 sizes[count]=QSize ( xS+4, yS );
114 else 114 else
115 sizes[count]=QSize ( xS+10, yS ); 115 sizes[count]=QSize ( xS+10, yS );
116 116
117 buttonHeight=QMAX(buttonHeight, sizes[count].height()); 117 buttonHeight=QMAX(buttonHeight, sizes[count].height());
118 } 118 }
119 buttonHeight += 10; 119 buttonHeight += 10;
120 // ----- calculate size of the month button: 120 // ----- calculate size of the month button:
121 w=0; 121 w=0;
122 for(count=0; count<NoOfButtons; ++count) { 122 for(count=0; count<NoOfButtons; ++count) {
123 if(buttons[count]!=selectMonth) 123 if(buttons[count]!=selectMonth)
124 { 124 {
125 w+=sizes[count].width(); 125 w+=sizes[count].width();
126 } else { 126 } else {
127 x=count; 127 x=count;
128 } 128 }
129 } 129 }
130 sizes[x].setWidth(width()-w); // stretch the month button 130 sizes[x].setWidth(width()-w); // stretch the month button
131 // ----- place the buttons: 131 // ----- place the buttons:
132 x=0; 132 x=0;
133 for(count=0; count<NoOfButtons; ++count) 133 for(count=0; count<NoOfButtons; ++count)
134 { 134 {
135 w=sizes[count].width(); 135 w=sizes[count].width();
136 buttons[count]->setGeometry(x, 0, w, buttonHeight); 136 buttons[count]->setGeometry(x, 0, w, buttonHeight);
137 x+=w; 137 x+=w;
138 } 138 }
139 // ----- place the line edit for direct input: 139 // ----- place the line edit for direct input:
140 sizes[0]=lineDate->sizeHint(); 140 sizes[0]=lineDate->sizeHint();
141 //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); 141 //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height());
142 int todaywid = todayBut->sizeHint().width(); 142 int todaywid = todayBut->sizeHint().width();
143todayBut->setGeometry(0, height()-sizes[0].height(),todaywid, sizes[0].height()); 143todayBut->setGeometry(0, height()-sizes[0].height(),todaywid, sizes[0].height());
144 lineDate->setGeometry(0+todaywid, height()-sizes[0].height(), width()-todaywid, sizes[0].height()); 144 lineDate->setGeometry(0+todaywid, height()-sizes[0].height(), width()-todaywid, sizes[0].height());
145 // ----- adjust the table: 145 // ----- adjust the table:
146 table->setGeometry(0, buttonHeight, width(), 146 table->setGeometry(0, buttonHeight, width(),
147 height()-buttonHeight-sizes[0].height()); 147 height()-buttonHeight-sizes[0].height());
148} 148}
149 149
150void 150void
151KDatePicker::dateChangedSlot(QDate date) 151KDatePicker::dateChangedSlot(QDate date)
152{ 152{
153 lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true)); 153 lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true));
154 //line->setText(KGlobal::locale()->formatDate(date, true)); 154 //line->setText(KGlobal::locale()->formatDate(date, true));
155 emit(dateChanged(date)); 155 emit(dateChanged(date));
156} 156}
157 157
158void 158void
159KDatePicker::tableClickedSlot() 159KDatePicker::tableClickedSlot()
160{ 160{
161 161
162 emit(dateSelected(table->getDate())); 162 emit(dateSelected(table->getDate()));
163 emit(tableClicked()); 163 emit(tableClicked());
164} 164}
165 165
166const QDate& 166const QDate&
167KDatePicker::getDate() const 167KDatePicker::getDate() const
168{ 168{
169 return table->getDate(); 169 return table->getDate();
170} 170}
171 171
172const QDate & 172const QDate &
173KDatePicker::date() const 173KDatePicker::date() const
174{ 174{
175 return table->getDate(); 175 return table->getDate();
176} 176}
177 177
178void KDatePicker::goToday() 178void KDatePicker::goToday()
179{ 179{
180 slotSetDate( QDate::currentDate() ); 180 slotSetDate( QDate::currentDate() );
181 181
182} 182}
183void KDatePicker::slotSetDate( QDate date ) 183void KDatePicker::slotSetDate( QDate date )
184{ 184{
185 185
186 if(date.isValid()) { 186 if(date.isValid()) {
187 QString temp; 187 QString temp;
188 // ----- 188 // -----
189 table->setDate(date); 189 table->setDate(date);
190 selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); 190 selectMonth->setText(KGlobal::locale()->monthName(date.month(), false));
191 temp.setNum(date.year()); 191 temp.setNum(date.year());
192 selectYear->setText(temp); 192 selectYear->setText(temp);
193 //line->setText(KGlobal::locale()->formatDate(date, true)); 193 //line->setText(KGlobal::locale()->formatDate(date, true));
194 lineDate->setDate( date ); 194 lineDate->setDate( date );
195 } 195 }
196 196
197} 197}
198bool 198bool
199KDatePicker::setDate(const QDate& date) 199KDatePicker::setDate(const QDate& date)
200{ 200{
201 table->setFocus(); 201 table->setFocus();
202 if(date.isValid()) { 202 if(date.isValid()) {
203 QString temp; 203 QString temp;
204 // ----- 204 // -----
205 table->setDate(date); 205 table->setDate(date);
206 selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); 206 selectMonth->setText(KGlobal::locale()->monthName(date.month(), false));
207 temp.setNum(date.year()); 207 temp.setNum(date.year());
208 selectYear->setText(temp); 208 selectYear->setText(temp);
209 //line->setText(KGlobal::locale()->formatDate(date, true)); 209 //line->setText(KGlobal::locale()->formatDate(date, true));
210 lineDate->setDate( date ); 210 lineDate->setDate( date );
211 return true; 211 return true;
212 } else { 212 } else {
213 213
214 return false; 214 return false;
215 } 215 }
216 216
217 217
218} 218}
219 219
220void 220void
221KDatePicker::monthForwardClicked() 221KDatePicker::monthForwardClicked()
222{ 222{
223 QDate temp=table->getDate(); 223 QDate temp=table->getDate();
224 int day=temp.day(); 224 int day=temp.day();
225 // ----- 225 // -----
226 if(temp.month()==12) { 226 if(temp.month()==12) {
227 temp.setYMD(temp.year()+1, 1, 1); 227 temp.setYMD(temp.year()+1, 1, 1);
228 } else { 228 } else {
229 temp.setYMD(temp.year(), temp.month()+1, 1); 229 temp.setYMD(temp.year(), temp.month()+1, 1);
230 } 230 }
231 if(temp.daysInMonth()<day) { 231 if(temp.daysInMonth()<day) {
232 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); 232 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth());
233 } else { 233 } else {
234 temp.setYMD(temp.year(), temp.month(), day); 234 temp.setYMD(temp.year(), temp.month(), day);
235 } 235 }
236 // assert(temp.isValid()); 236 // assert(temp.isValid());
237 setDate(temp); 237 setDate(temp);
238} 238}
239 239
240void 240void
241KDatePicker::monthBackwardClicked() 241KDatePicker::monthBackwardClicked()
242{ 242{
243 QDate temp=table->getDate(); 243 QDate temp=table->getDate();
244 int day=temp.day(); 244 int day=temp.day();
245 // ----- 245 // -----
246 if(temp.month()==1) 246 if(temp.month()==1)
247 { 247 {
248 temp.setYMD(temp.year()-1, 12, 1); 248 temp.setYMD(temp.year()-1, 12, 1);
249 } else { 249 } else {
250 temp.setYMD(temp.year(), temp.month()-1, 1); 250 temp.setYMD(temp.year(), temp.month()-1, 1);
251 } 251 }
252 if(temp.daysInMonth()<day) 252 if(temp.daysInMonth()<day)
253 { 253 {
254 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); 254 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth());
255 } else { 255 } else {
256 temp.setYMD(temp.year(), temp.month(), day); 256 temp.setYMD(temp.year(), temp.month(), day);
257 } 257 }
258 // assert(temp.isValid()); 258 // assert(temp.isValid());
259 setDate(temp); 259 setDate(temp);
260} 260}
261 261
262void 262void
263KDatePicker::yearForwardClicked() 263KDatePicker::yearForwardClicked()
264{ 264{
265 QDate temp=table->getDate(); 265 QDate temp=table->getDate();
266 int day=temp.day(); 266 int day=temp.day();
267 // ----- 267 // -----
268 temp.setYMD(temp.year()+1, temp.month(), 1); 268 temp.setYMD(temp.year()+1, temp.month(), 1);
269 if(temp.daysInMonth()<day) 269 if(temp.daysInMonth()<day)
270 { 270 {
271 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); 271 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth());
272 } else { 272 } else {
273 temp.setYMD(temp.year(), temp.month(), day); 273 temp.setYMD(temp.year(), temp.month(), day);
274 } 274 }
275 // assert(temp.isValid()); 275 // assert(temp.isValid());
276 setDate(temp); 276 setDate(temp);
277} 277}
278 278
279void 279void
280KDatePicker::yearBackwardClicked() 280KDatePicker::yearBackwardClicked()
281{ 281{
282 QDate temp=table->getDate(); 282 QDate temp=table->getDate();
283 int day=temp.day(); 283 int day=temp.day();
284 // ----- 284 // -----
285 temp.setYMD(temp.year()-1, temp.month(), 1); 285 temp.setYMD(temp.year()-1, temp.month(), 1);
286 if(temp.daysInMonth()<day) 286 if(temp.daysInMonth()<day)
287 { 287 {
288 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); 288 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth());
289 } else { 289 } else {
290 temp.setYMD(temp.year(), temp.month(), day); 290 temp.setYMD(temp.year(), temp.month(), day);
291 } 291 }
292 // assert(temp.isValid()); 292 // assert(temp.isValid());
293 setDate(temp); 293 setDate(temp);
294} 294}
295 295
296void 296void
297KDatePicker::selectMonthClicked() 297KDatePicker::selectMonthClicked()
298{ 298{
299 int month; 299 int month;
300 KPopupFrame* popup = new KPopupFrame(this); 300 KPopupFrame* popup = new KPopupFrame(this);
301 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); 301 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup);
302 // ----- 302 // -----
303 picker->resize(picker->sizeHint()); 303 picker->resize(picker->sizeHint());
304 popup->setMainWidget(picker); 304 popup->setMainWidget(picker);
305 picker->setFocus(); 305 picker->setFocus();
306 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 306 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
307 if(popup->exec(selectMonth->mapToGlobal(QPoint(0, selectMonth->height())))) 307 if(popup->exec(selectMonth->mapToGlobal(QPoint(0, selectMonth->height()))))
308 { 308 {
309 QDate date; 309 QDate date;
310 int day; 310 int day;
311 // ----- 311 // -----
312 month=picker->getResult(); 312 month=picker->getResult();
313 date=table->getDate(); 313 date=table->getDate();
314 day=date.day(); 314 day=date.day();
315 // ----- construct a valid date in this month: 315 // ----- construct a valid date in this month:
316 date.setYMD(date.year(), month, 1); 316 date.setYMD(date.year(), month, 1);
317 date.setYMD(date.year(), month, QMIN(day, date.daysInMonth())); 317 date.setYMD(date.year(), month, QMIN(day, date.daysInMonth()));
318 // ----- set this month 318 // ----- set this month
319 setDate(date); 319 setDate(date);
320 } else { 320 } else {
321 KNotifyClient::beep(); 321 KNotifyClient::beep();
322 } 322 }
323 delete popup; 323 delete popup;
324} 324}
325 325
326void 326void
327KDatePicker::selectYearClicked() 327KDatePicker::selectYearClicked()
328{ 328{
329 int year; 329 int year;
330 KPopupFrame* popup = new KPopupFrame(this); 330 KPopupFrame* popup = new KPopupFrame(this);
331 KDateInternalYearSelector* picker = new KDateInternalYearSelector(fontsize, popup); 331 KDateInternalYearSelector* picker = new KDateInternalYearSelector(fontsize, popup);
332 // ----- 332 // -----
333 picker->resize(picker->sizeHint()); 333 picker->resize(picker->sizeHint());
334 popup->setMainWidget(picker); 334 popup->setMainWidget(picker);
335 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 335 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
336 picker->setFocus(); 336 picker->setFocus();
337 if(popup->exec(selectYear->mapToGlobal(QPoint(0, selectMonth->height())))) 337 if(popup->exec(selectYear->mapToGlobal(QPoint(0, selectMonth->height()))))
338 { 338 {
339 QDate date; 339 QDate date;
340 int day; 340 int day;
341 // ----- 341 // -----
342 year=picker->getYear(); 342 year=picker->getYear();
343 date=table->getDate(); 343 date=table->getDate();
344 day=date.day(); 344 day=date.day();
345 // ----- construct a valid date in this month: 345 // ----- construct a valid date in this month:
346 date.setYMD(year, date.month(), 1); 346 date.setYMD(year, date.month(), 1);
347 date.setYMD(year, date.month(), QMIN(day, date.daysInMonth())); 347 date.setYMD(year, date.month(), QMIN(day, date.daysInMonth()));
348 // ----- set this month 348 // ----- set this month
349 setDate(date); 349 setDate(date);
350 } else { 350 } else {
351 KNotifyClient::beep(); 351 KNotifyClient::beep();
352 } 352 }
353 delete popup; 353 delete popup;
354} 354}
355 355
356void 356void
357KDatePicker::setEnabled(bool enable) 357KDatePicker::setEnabled(bool enable)
358{ 358{
359 QWidget *widgets[]= { 359 QWidget *widgets[]= {
360 yearForward, yearBackward, monthForward, monthBackward, 360 yearForward, yearBackward, monthForward, monthBackward,
361 selectMonth, selectYear, 361 selectMonth, selectYear,
362 lineDate, table }; 362 lineDate, table };
363 const int Size=sizeof(widgets)/sizeof(widgets[0]); 363 const int Size=sizeof(widgets)/sizeof(widgets[0]);
364 int count; 364 int count;
365 // ----- 365 // -----
366 for(count=0; count<Size; ++count) 366 for(count=0; count<Size; ++count)
367 { 367 {
368 widgets[count]->setEnabled(enable); 368 widgets[count]->setEnabled(enable);
369 } 369 }
370} 370}
371 371
372void 372void
373KDatePicker::lineEnterPressed() 373KDatePicker::lineEnterPressed()
374{ 374{
375 QDate temp; 375 QDate temp;
376 // ----- 376 // -----
377 temp = lineDate->date(); 377 temp = lineDate->date();
378 //if(val->date(line->text(), temp)==QValidator::Acceptable) 378 //if(val->date(line->text(), temp)==QValidator::Acceptable)
379 //{ 379 //{
380 emit(dateEntered(temp)); 380 emit(dateEntered(temp));
381 setDate(temp); 381 setDate(temp);
382 // } else { 382 // } else {
383// KNotifyClient::beep(); 383// KNotifyClient::beep();
384// } 384// }
385} 385}
386 386
387QSize 387QSize
388KDatePicker::sizeHint() const 388KDatePicker::sizeHint() const
389{ 389{
390 QSize tableSize=table->sizeHint(); 390 QSize tableSize=table->sizeHint();
391 QWidget *buttons[]={ 391 QWidget *buttons[]={
392 yearBackward, 392 yearBackward,
393 monthBackward, 393 monthBackward,
394 selectMonth, 394 selectMonth,
395 selectYear, 395 selectYear,
396 monthForward, 396 monthForward,
397 yearForward }; 397 yearForward };
398 const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); 398 const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]);
399 QSize sizes[NoOfButtons]; 399 QSize sizes[NoOfButtons];
400 int cx=0, cy=0, count; 400 int cx=0, cy=0, count;
401 // ----- store the size hints: 401 // ----- store the size hints:
402 for(count=0; count<NoOfButtons; ++count) 402 for(count=0; count<NoOfButtons; ++count)
403 { 403 {
404 sizes[count]=buttons[count]->sizeHint(); 404 sizes[count]=buttons[count]->sizeHint();
405 if(buttons[count]==selectMonth) 405 if(buttons[count]==selectMonth)
406 { 406 {
407 cx+=maxMonthRect.width()+15; 407 cx+=maxMonthRect.width()+15;
408 } else { 408 } else {
409 cx+=sizes[count].width()+15; 409 cx+=sizes[count].width()+15;
410 } 410 }
411 cy=QMAX(sizes[count].height(), cy); 411 cy=QMAX(sizes[count].height(), cy);
412 } 412 }
413 // ----- calculate width hint: 413 // ----- calculate width hint:
414 cx=QMAX(cx, tableSize.width()); // line edit ignored 414 cx=QMAX(cx, tableSize.width()); // line edit ignored
415 if ( cx > QApplication::desktop()->width() -5 ) 415 if ( cx > QApplication::desktop()->width() -5 )
416 cx = QApplication::desktop()->width() -5; 416 cx = QApplication::desktop()->width() -5;
417 // ----- calculate height hint: 417 // ----- calculate height hint:
418 cy+=tableSize.height()+lineDate->sizeHint().height(); 418 cy+=tableSize.height()+lineDate->sizeHint().height();
419 419
420 return QSize(cx, cy); 420 return QSize(cx, cy);
421} 421}
422 422
423void 423void
424KDatePicker::setFontSize(int s) 424KDatePicker::setFontSize(int s)
425{ 425{
426 QWidget *buttons[]= { 426 QWidget *buttons[]= {
427 // yearBackward, 427 // yearBackward,
428 // monthBackward, 428 // monthBackward,
429 selectMonth, 429 selectMonth,
430 selectYear, 430 selectYear,
431 // monthForward, 431 // monthForward,
432 // yearForward 432 // yearForward
433 }; 433 };
434 const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); 434 const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]);
435 int count; 435 int count;
436 QFont font; 436 QFont font;
437 QRect r; 437 QRect r;
438 // ----- 438 // -----
439 fontsize=s; 439 fontsize=s;
440 for(count=0; count<NoOfButtons; ++count) 440 for(count=0; count<NoOfButtons; ++count)
441 { 441 {
442 font=buttons[count]->font(); 442 font=buttons[count]->font();
443 font.setPointSize(s); 443 font.setPointSize(s);
444 buttons[count]->setFont(font); 444 buttons[count]->setFont(font);
445 } 445 }
446 QFontMetrics metrics(selectMonth->fontMetrics()); 446 QFontMetrics metrics(selectMonth->fontMetrics());
447 for(int i=1; i <= 12; ++i) 447 for(int i=1; i <= 12; ++i)
448 { // maxMonthRect is used by sizeHint() 448 { // maxMonthRect is used by sizeHint()
449 r=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); 449 r=metrics.boundingRect(KGlobal::locale()->monthName(i, false));
450 maxMonthRect.setWidth(QMAX(r.width(), maxMonthRect.width())); 450 maxMonthRect.setWidth(QMAX(r.width(), maxMonthRect.width()));
451 maxMonthRect.setHeight(QMAX(r.height(), maxMonthRect.height())); 451 maxMonthRect.setHeight(QMAX(r.height(), maxMonthRect.height()));
452 } 452 }
453 table->setFontSize(s); 453 table->setFontSize(s);
454} 454}
455 455
456void KDatePicker::virtual_hook( int id, void* data ) 456void KDatePicker::virtual_hook( int id, void* data )
457{ /*BASE::virtual_hook( id, data );*/ } 457{ /*BASE::virtual_hook( id, data );*/ }
458 458
459void KDatePicker::keyPressEvent ( QKeyEvent * e ) 459void KDatePicker::keyPressEvent ( QKeyEvent * e )
460{ 460{
461 switch ( e->key() ) { 461 switch ( e->key() ) {
462 case Qt::Key_Right: 462 case Qt::Key_Right:
463 monthForwardClicked(); 463 monthForwardClicked();
464 break; 464 break;
465 case Qt::Key_Left: 465 case Qt::Key_Left:
466 monthBackwardClicked(); 466 monthBackwardClicked();
467 break; 467 break;
468 468
469 case Qt::Key_Down: 469 case Qt::Key_Down:
470 yearForwardClicked(); 470 yearForwardClicked();
471 471
472 break; 472 break;
473 473
474 case Qt::Key_Up: 474 case Qt::Key_Up:
475 yearBackwardClicked(); 475 yearBackwardClicked();
476 break; 476 break;
477 477
478 case Qt::Key_Return: 478 case Qt::Key_Return:
479 case Qt::Key_Enter:
479 tableClickedSlot(); 480 tableClickedSlot();
480 break; 481 break;
481 case Qt::Key_Escape: 482 case Qt::Key_Escape:
482 e->ignore(); 483 e->ignore();
483 break; 484 break;
484 default: 485 default:
485 break; 486 break;
486 } 487 }
487 488
488} 489}