summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-27 13:04:11 (UTC)
committer zautrix <zautrix>2005-03-27 13:04:11 (UTC)
commit9e3e43aaca0986ae224c752d2d3a760661be61b6 (patch) (unidiff)
tree18295c0cc7177be6022a7abec716131f06b2a756
parent1800cf5f3af1f666dddcbfffe3171adcd467ae3d (diff)
downloadkdepimpi-9e3e43aaca0986ae224c752d2d3a760661be61b6.zip
kdepimpi-9e3e43aaca0986ae224c752d2d3a760661be61b6.tar.gz
kdepimpi-9e3e43aaca0986ae224c752d2d3a760661be61b6.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt13
-rw-r--r--kalarmd/alarmdialog.cpp4
-rw-r--r--korganizer/calendarview.cpp28
-rw-r--r--korganizer/koagendaview.cpp27
-rw-r--r--korganizer/mainwindow.cpp8
-rw-r--r--libkcal/calendarlocal.cpp1
6 files changed, 59 insertions, 22 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index ce55780..5ef60be 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1117,200 +1117,209 @@
1117{ "Agenda","Agenda" }, 1117{ "Agenda","Agenda" },
1118{ " ("," (" }, 1118{ " ("," (" },
1119{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" }, 1119{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" },
1120{ "Print","Print" }, 1120{ "Print","Print" },
1121{ "&Setup Printer...","Drucker &Setup..." }, 1121{ "&Setup Printer...","Drucker &Setup..." },
1122{ "View Type","Zeige Typ" }, 1122{ "View Type","Zeige Typ" },
1123{ "Page &orientation:","Seiten Ausrichtung:" }, 1123{ "Page &orientation:","Seiten Ausrichtung:" },
1124{ "Use Default of Selected Style","Default des selektierten Stils" }, 1124{ "Use Default of Selected Style","Default des selektierten Stils" },
1125{ "Use Default Setting of Printer","Default Einstellung des Druckers" }, 1125{ "Use Default Setting of Printer","Default Einstellung des Druckers" },
1126{ "Portrait","Portrait" }, 1126{ "Portrait","Portrait" },
1127{ "Landscape","Landschaft" }, 1127{ "Landscape","Landschaft" },
1128{ "Print day","Drucke Tag" }, 1128{ "Print day","Drucke Tag" },
1129{ "CalPrintDay_Base","CalPrintDay_Base" }, 1129{ "CalPrintDay_Base","CalPrintDay_Base" },
1130{ "Date && Time Range","Datum && Zeitspanne" }, 1130{ "Date && Time Range","Datum && Zeitspanne" },
1131{ "&End date:","&Enddatum:" }, 1131{ "&End date:","&Enddatum:" },
1132{ "&Start date:","&Startdatum:" }, 1132{ "&Start date:","&Startdatum:" },
1133{ "Start &time:","Startzeit:" }, 1133{ "Start &time:","Startzeit:" },
1134{ "End ti&me:","Endzeit:" }, 1134{ "End ti&me:","Endzeit:" },
1135{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" }, 1135{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" },
1136{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" }, 1136{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" },
1137{ "Alt+D","Alt+D" }, 1137{ "Alt+D","Alt+D" },
1138{ "&Use colors","Nutze Farben" }, 1138{ "&Use colors","Nutze Farben" },
1139{ "Alt+U","Alt+U" }, 1139{ "Alt+U","Alt+U" },
1140{ "Print week","Drucke Woche" }, 1140{ "Print week","Drucke Woche" },
1141{ "CalPrintWeek_Base","CalPrintWeek_Base" }, 1141{ "CalPrintWeek_Base","CalPrintWeek_Base" },
1142{ "Use &colors","Nutze Farben" }, 1142{ "Use &colors","Nutze Farben" },
1143{ "Type of View","Typ der Ansicht" }, 1143{ "Type of View","Typ der Ansicht" },
1144{ "Print as &Filofax page","Drucke als &Filofax Seite" }, 1144{ "Print as &Filofax page","Drucke als &Filofax Seite" },
1145{ "Alt+F","Alt+F" }, 1145{ "Alt+F","Alt+F" },
1146{ "Print as &timetable view:","Drucke als Zeittabelle:" }, 1146{ "Print as &timetable view:","Drucke als Zeittabelle:" },
1147{ "Alt+T","Alt+T" }, 1147{ "Alt+T","Alt+T" },
1148{ "Print as split week view","Drucke als gesplittete Wochenansicht" }, 1148{ "Print as split week view","Drucke als gesplittete Wochenansicht" },
1149{ "Print month","Drucke Monat" }, 1149{ "Print month","Drucke Monat" },
1150{ "CalPrintMonth_Base","CalPrintMonth_Base" }, 1150{ "CalPrintMonth_Base","CalPrintMonth_Base" },
1151{ "&Start month:","&Startmonat:" }, 1151{ "&Start month:","&Startmonat:" },
1152{ "&End month:","&Endmonat:" }, 1152{ "&End month:","&Endmonat:" },
1153{ "Print week &numbers","Drucke Wochen Nummer(n)" }, 1153{ "Print week &numbers","Drucke Wochen Nummer(n)" },
1154{ "Print todos","Drucke Todos" }, 1154{ "Print todos","Drucke Todos" },
1155{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" }, 1155{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" },
1156{ "Include &description of the item","Inclusive Itembeschreibung" }, 1156{ "Include &description of the item","Inclusive Itembeschreibung" },
1157{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" }, 1157{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" },
1158{ "Include &priority of the item","Inclusive Priorität des Items" }, 1158{ "Include &priority of the item","Inclusive Priorität des Items" },
1159{ "Items to Print","Zu druckende Items" }, 1159{ "Items to Print","Zu druckende Items" },
1160{ "&From:","Von:" }, 1160{ "&From:","Von:" },
1161{ "&To:","Bis:" }, 1161{ "&To:","Bis:" },
1162{ "Print &all todo items","Drucke alle Todo Items" }, 1162{ "Print &all todo items","Drucke alle Todo Items" },
1163{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" }, 1163{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" },
1164{ "Only items due in the &range:","Nur Items in dem Zeitraum:" }, 1164{ "Only items due in the &range:","Nur Items in dem Zeitraum:" },
1165{ "Todo List","Todo Liste" }, 1165{ "Todo List","Todo Liste" },
1166{ "&Title:","&Titel:" }, 1166{ "&Title:","&Titel:" },
1167{ "Co&nnect subtodos with its parent","Verbinde Unter-Todos mit ihren Ober-Todos" }, 1167{ "Co&nnect subtodos with its parent","Verbinde Unter-Todos mit ihren Ober-Todos" },
1168{ "Todo list","Todo Liste" }, 1168{ "Todo list","Todo Liste" },
1169{ "&Print...","Drucke..." }, 1169{ "&Print...","Drucke..." },
1170{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" }, 1170{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" },
1171{ "[Unconfigured]","[Unkonfiguriert]" }, 1171{ "[Unconfigured]","[Unkonfiguriert]" },
1172{ "OK","OK" }, 1172{ "OK","OK" },
1173{ "FilterEditor","FilterEditor" }, 1173{ "FilterEditor","FilterEditor" },
1174{ "Include","Inclusive" }, 1174{ "Include","Inclusive" },
1175{ "Exclude","Exclusive" }, 1175{ "Exclude","Exclusive" },
1176{ "Edit Selection...","Editiere Auswahl" }, 1176{ "Edit Selection...","Editiere Auswahl" },
1177{ "recurring events","wiederholende Termine" }, 1177{ "recurring events","wiederholende Termine" },
1178{ "recurr. events","wiederh.Termine" }, 1178{ "recurr. events","wiederh.Termine" },
1179{ "completed to-dos","erledigte Todos" }, 1179{ "completed to-dos","erledigte Todos" },
1180{ "events","Termine" }, 1180{ "events","Termine" },
1181{ "todos","Todos" }, 1181{ "todos","Todos" },
1182{ "journals","Journale" }, 1182{ "journals","Journale" },
1183{ "public","öffentl." }, 1183{ "public","öffentl." },
1184{ "private","privat" }, 1184{ "private","privat" },
1185{ "confidential","vertraul." }, 1185{ "confidential","vertraul." },
1186{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" }, 1186{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" },
1187{ "Yesterday","Gestern" }, 1187{ "Yesterday","Gestern" },
1188{ "Day after tomorrow","Übermorgen" }, 1188{ "Day after tomorrow","Übermorgen" },
1189{ "Tomorrow","Morgen" }, 1189{ "Tomorrow","Morgen" },
1190{ "Day before yesterday","Vorgestern" }, 1190{ "Day before yesterday","Vorgestern" },
1191{ "Size %1","Größe %1" }, 1191{ "Size %1","Größe %1" },
1192{ "New Agendasize: %1","Neue Agendagröße: %1" }, 1192{ "New Agendasize: %1","Neue Agendagröße: %1" },
1193{ " (%1 y.)"," (%1 J.)" }, 1193{ " (%1 y.)"," (%1 J.)" },
1194{ "Allday:","Ganztägig:" }, 1194{ "Allday:","Ganztägig:" },
1195{ "compl.todos","erled.Todos" }, 1195{ "compl.todos","erled.Todos" },
1196{ "Day view","Tagesansicht" }, 1196{ "Day view","Tagesansicht" },
1197{ "Next days","Nächste Tage" }, 1197{ "Next days","Nächste Tage" },
1198{ "Next week","Nächste Woche" }, 1198{ "Next week","Nächste Woche" },
1199{ "Next two weeks","Nächste zwei Wochen" }, 1199{ "Next two weeks","Nächste zwei Wochen" },
1200{ "Next month","Nächster Monat" }, 1200{ "Next month","Nächster Monat" },
1201{ "Journal view","Journal" }, 1201{ "Journal view","Journal" },
1202{ "Display all opened","Zeige alle geöffnet" }, 1202{ "Display all opened","Zeige alle geöffnet" },
1203{ "Display all closed","Zeige alle geschlossen" }, 1203{ "Display all closed","Zeige alle geschlossen" },
1204{ "Display all flat","Zeige alle flach" }, 1204{ "Display all flat","Zeige alle flach" },
1205{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, 1205{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" },
1206{ "Default todo done color:","Standard Todo erledigt Farbe" }, 1206{ "Default todo done color:","Standard Todo erledigt Farbe" },
1207{ "Select week %1-%2","Wähle Woche %1-%2" }, 1207{ "Select week %1-%2","Wähle Woche %1-%2" },
1208{ "Select Week","Wähle Woche" }, 1208{ "Select Week","Wähle Woche" },
1209{ "Set alarm for selected...","Setze Alarm für Selekt..." }, 1209{ "Set alarm for selected...","Setze Alarm für Selekt..." },
1210{ "Set Alarm!","Setze Alarm!" }, 1210{ "Set Alarm!","Setze Alarm!" },
1211{ "Canged alarm for %1 items","Alarm für %1 Items geändert" }, 1211{ "Canged alarm for %1 items","Alarm für %1 Items geändert" },
1212{ " and "," und " }, 1212{ " and "," und " },
1213{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, 1213{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" },
1214{ "Mail to selected","Mail an Ausgewählte" }, 1214{ "Mail to selected","Mail an Ausgewählte" },
1215{ "Mail to all","Mail an Alle" }, 1215{ "Mail to all","Mail an Alle" },
1216{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, 1216{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" },
1217{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, 1217{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" },
1218{ " on"," am" }, 1218{ " on"," am" },
1219{ " completed on "," erledigt am " }, 1219{ " completed on "," erledigt am " },
1220{ "Save as Event template","Speichere als Vorlage" }, 1220{ "Save as Event template","Speichere als Vorlage" },
1221{ "Load Event template","Lade Termin Vorlage" }, 1221{ "Load Event template","Lade Termin Vorlage" },
1222{ "Save as Journal template","Speichere als Journal Vorlage" }, 1222{ "Save as Journal template","Speichere als Journal Vorlage" },
1223{ "Insert Journal template","Füge Journal Vorlage ein" }, 1223{ "Insert Journal template","Füge Journal Vorlage ein" },
1224{ "Sub todos:<br>","Unter Todos:<br>" }, 1224{ "Sub todos:<br>","Unter Todos:<br>" },
1225{ "Parent todo:<br>","Über Todo:<br>" }, 1225{ "Parent todo:<br>","Über Todo:<br>" },
1226{ "Set current as color category","Setze Gewählte als Farbkategorie" }, 1226{ "Set current as color category","Setze Gewählte als Farbkategorie" },
1227{ " completed"," erledigt" }, 1227{ " completed"," erledigt" },
1228{ "(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!" }, 1228{ "(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!" },
1229{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." }, 1229{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." },
1230{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." }, 1230{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." },
1231{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." }, 1231{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." },
1232{ "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?" }, 1232{ "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?" },
1233{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." }, 1233{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." },
1234{ "Error","Fehler" }, 1234{ "Error","Fehler" },
1235{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." }, 1235{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." },
1236{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." }, 1236{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." },
1237{ "Warning","Warnung" }, 1237{ "Warning","Warnung" },
1238{ "Select week number","Wähle Wochen Nummer" }, 1238{ "Select week number","Wähle Wochen Nummer" },
1239{ "Februar","Februar" }, 1239{ "Februar","Februar" },
1240{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" }, 1240{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" },
1241{ "W","W" }, 1241{ "W","W" },
1242{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" }, 1242{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" },
1243{ "T: %1","T: %1" }, 1243{ "T: %1","T: %1" },
1244{ "Start: ","Start: " }, 1244{ "Start: ","Start: " },
1245{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " }, 1245{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " },
1246{ "Password for remote access:","Passwort für fernen Zugriff:" }, 1246{ "Password for remote access:","Passwort für fernen Zugriff:" },
1247{ "Remote IP address:","Ferne IP Adresse:" }, 1247{ "Remote IP address:","Ferne IP Adresse:" },
1248{ "Remote port number:","Ferne Port Nummer:" }, 1248{ "Remote port number:","Ferne Port Nummer:" },
1249{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." }, 1249{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." },
1250{ "Remote from: ","Fern von: " }, 1250{ "Remote from: ","Fern von: " },
1251{ "Local from: ","Lokal von: " }, 1251{ "Local from: ","Lokal von: " },
1252{ "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" }, 1252{ "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" },
1253{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, 1253{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" },
1254{ "Write back","Schreibe zurück" }, 1254{ "Write back","Schreibe zurück" },
1255{ "KO/Pi Synchronization","KO/Pi Synchronisation" }, 1255{ "KO/Pi Synchronization","KO/Pi Synchronisation" },
1256{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, 1256{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" },
1257{ "Received sync request","Sync Anfrage erhalten" }, 1257{ "Received sync request","Sync Anfrage erhalten" },
1258{ "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." }, 1258{ "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." },
1259{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, 1259{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." },
1260{ "Data saved to temp file!","Daten in temp Datei gespeichert!" }, 1260{ "Data saved to temp file!","Daten in temp Datei gespeichert!" },
1261{ "Sending file...","Sende Datei..." }, 1261{ "Sending file...","Sende Datei..." },
1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." }, 1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." },
1263{ "Receiving synced file...","Gesyncte Daten erhalten..." }, 1263{ "Receiving synced file...","Gesyncte Daten erhalten..." },
1264{ "Received %1 bytes","%1 Bytes erhalten" }, 1264{ "Received %1 bytes","%1 Bytes erhalten" },
1265{ "Writing file to disk...","Speichere Datei..." }, 1265{ "Writing file to disk...","Speichere Datei..." },
1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" }, 1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" },
1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, 1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" },
1268{ "Synchronize!","Synchronisiere!" }, 1268{ "Synchronize!","Synchronisiere!" },
1269{ "High clock skew!","Großer Uhrzeitunterschied!" }, 1269{ "High clock skew!","Großer Uhrzeitunterschied!" },
1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, 1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" },
1271{ "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!" }, 1271{ "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!" },
1272{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, 1272{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." },
1273{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, 1273{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" },
1274{ "List week view","Listenwochenansicht" }, 1274{ "List week view","Listenwochenansicht" },
1275{ "List week","Listenwochenansicht" }, 1275{ "List week","Listenwochenansicht" },
1276{ "Next Week","Nächste Woche" }, 1276{ "Next Week","Nächste Woche" },
1277{ "Previous Week","Vorherige Woche" }, 1277{ "Previous Week","Vorherige Woche" },
1278{ "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." }, 1278{ "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." },
1279{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, 1279{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" },
1280{ "Details","Details" }, 1280{ "Details","Details" },
1281{ "Created time","Erstellt Zeit" }, 1281{ "Created time","Erstellt Zeit" },
1282{ "Last modified time","Geändert Zeit" }, 1282{ "Last modified time","Geändert Zeit" },
1283{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, 1283{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" },
1284{ "View Options","Anzeige Optionen" }, 1284{ "View Options","Anzeige Optionen" },
1285{ "<b>Created: ","<b>Erstellt am: " }, 1285{ "<b>Created: ","<b>Erstellt am: " },
1286{ "<b>Last modified: ","<b>Zuletzt geändert am: " }, 1286{ "<b>Last modified: ","<b>Zuletzt geändert am: " },
1287{ "Journal: ","Journal: " }, 1287{ "Journal: ","Journal: " },
1288{ "yearly","jährlich" }, 1288{ "yearly","jährlich" },
1289{ "(%1) ","%1-" }, 1289{ "(%1) ","%1-" },
1290{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, 1290{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" },
1291{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, 1291{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" },
1292{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, 1292{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" },
1293{ "Summary/Loc.","Titel/Ort" }, 1293{ "Summary/Loc.","Titel/Ort" },
1294{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, 1294{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." },
1295{ "Week Number","Wochennummer" }, 1295{ "Week Number","Wochennummer" },
1296{ "Import","Importiere" }, 1296{ "Import","Importiere" },
1297{ "Export","Exportiere" }, 1297{ "Export","Exportiere" },
1298{ "Beam","Beame" }, 1298{ "Beam","Beame" },
1299{ "Export selected","Exportiere Selektierte" }, 1299{ "Export selected","Exportiere Selektierte" },
1300{ "As iCal (ics) file...","Als iCal (ics) Datei..." }, 1300{ "As iCal (ics) file...","Als iCal (ics) Datei..." },
1301{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, 1301{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." },
1302{ "Journal/Details...","Journale/Details..." }, 1302{ "Journal/Details...","Journale/Details..." },
1303{ "Agenda View","Agenda Ansicht" }, 1303{ "Agenda View","Agenda Ansicht" },
1304{ "Show current time","Zeige aktuelle Zeit" }, 1304{ "Show current time","Zeige aktuelle Zeit" },
1305{ "Edit new item","Bearbeite neuen Eintrag" }, 1305{ "Edit new item","Bearbeite neuen Eintrag" },
1306{ "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" }, 1306{ "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" },
1307{ "There is no next alarm.","Es gibt keinen nächsten Alarm." }, 1307{ "There is no next alarm.","Es gibt keinen nächsten Alarm." },
1308{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, 1308{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" },
1309{ "The next alarm is on:\n%1\nat: %2\n\n%3\n(%4)","Der nächste Alarm in am:\n%1\num: %2\n\n%3\n(%4)" }, 1309{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" },
1310{ "%1 days\n","%1 Tagen\n" },
1311{ "1 day\n","1 Tag\n" },
1312{ "%1 hours\n","%1 Stunden\n" },
1313{ "1 hour\n","1 Stunde\n" },
1314{ "%1 minutes\n","%1 Minuten\n" },
1315{ "1 minute\n","1 Minute\n" },
1310{ "","" }, 1316{ "","" },
1311{ "","" }, 1317{ "","" },
1312{ "","" }, 1318{ "","" },
1313{ "","" }, 1319{ "","" },
1314{ "","" }, 1320{ "","" },
1315{ "","" }, 1321{ "","" },
1316 \ No newline at end of file 1322{ "","" },
1323{ "","" },
1324{ "","" },
1325{ "","" }, \ No newline at end of file
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp
index 7ead3b9..7b888ab 100644
--- a/kalarmd/alarmdialog.cpp
+++ b/kalarmd/alarmdialog.cpp
@@ -1,229 +1,233 @@
1/* 1/*
2 This file is part of the KDE alarm daemon. 2 This file is part of the KDE alarm daemon.
3 Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24// $Id$ 24// $Id$
25 25
26#include <qhbox.h> 26#include <qhbox.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qapp.h> 28#include <qapp.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qlayout.h> 30#include <qlayout.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qsound.h> 33#include <qsound.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#ifndef DESKTOP_VERSION
35#define protected public 36#define protected public
36#include <qspinbox.h> 37#include <qspinbox.h>
37#undef protected 38#undef protected
39#else
40#include <qspinbox.h>
41#endif
38#include <stdlib.h> 42#include <stdlib.h>
39#ifndef _WIN32_ 43#ifndef _WIN32_
40#include <unistd.h> 44#include <unistd.h>
41#include <sys/ioctl.h> 45#include <sys/ioctl.h>
42#endif 46#endif
43#include <stdio.h> 47#include <stdio.h>
44#include <fcntl.h> 48#include <fcntl.h>
45 49
46#ifndef DESKTOP_VERSION 50#ifndef DESKTOP_VERSION
47#include <qtopia/alarmserver.h> 51#include <qtopia/alarmserver.h>
48#include <qpe/resource.h> 52#include <qpe/resource.h>
49#include <qtopia/sound.h> 53#include <qtopia/sound.h>
50 54
51#endif 55#endif
52 56
53#include "alarmdialog.h" 57#include "alarmdialog.h"
54 58
55 59
56AlarmDialog::AlarmDialog(QWidget *parent,const char *name) 60AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
57 : QDialog (parent, name, true, Qt::WStyle_StaysOnTop ) 61 : QDialog (parent, name, true, Qt::WStyle_StaysOnTop )
58{ 62{
59 setCaption( "KO/Pi Alarm!" ); 63 setCaption( "KO/Pi Alarm!" );
60 QVBoxLayout* layout = new QVBoxLayout( this); 64 QVBoxLayout* layout = new QVBoxLayout( this);
61 QLabel* l = new QLabel("The following event triggered alarm:",this); 65 QLabel* l = new QLabel("The following event triggered alarm:",this);
62 layout->addWidget ( l ); 66 layout->addWidget ( l );
63 l->setAlignment( AlignCenter); 67 l->setAlignment( AlignCenter);
64 mMessage = new QLabel ( " ", this ); 68 mMessage = new QLabel ( " ", this );
65 int fs = 18; 69 int fs = 18;
66 int fs2 = 12; 70 int fs2 = 12;
67 if ( QApplication::desktop()->width() < 480 ) { 71 if ( QApplication::desktop()->width() < 480 ) {
68 setMaximumSize(220, 260); 72 setMaximumSize(220, 260);
69 fs2 = 10; 73 fs2 = 10;
70 } 74 }
71 else { 75 else {
72 setMaximumSize(440, 440); 76 setMaximumSize(440, 440);
73 } 77 }
74 layout->setSpacing( 3 ); 78 layout->setSpacing( 3 );
75 layout->setMargin( 3 ); 79 layout->setMargin( 3 );
76 QFont fo = QApplication::font(); 80 QFont fo = QApplication::font();
77 fo.setBold( true ); 81 fo.setBold( true );
78 fo.setPointSize( fs2 ); 82 fo.setPointSize( fs2 );
79 l->setFont( fo ); 83 l->setFont( fo );
80 fo.setPointSize( fs ); 84 fo.setPointSize( fs );
81 mMessage->setFont(fo ); 85 mMessage->setFont(fo );
82 mMessage->setAlignment( AlignCenter); 86 mMessage->setAlignment( AlignCenter);
83 layout->addWidget ( mMessage ); 87 layout->addWidget ( mMessage );
84 mMissedAlarms= new QLabel ( "(No missed Alarms)", this ); 88 mMissedAlarms= new QLabel ( "(No missed Alarms)", this );
85 mMissedAlarms->setAlignment( AlignCenter); 89 mMissedAlarms->setAlignment( AlignCenter);
86 90
87 playSoundTimer = new QTimer( this ); 91 playSoundTimer = new QTimer( this );
88 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) ); 92 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) );
89 93
90 playSoundTimer->stop(); 94 playSoundTimer->stop();
91 95
92 layout->addWidget ( mMissedAlarms ); 96 layout->addWidget ( mMissedAlarms );
93 mMissedAlarmsCombo = new QComboBox ( this ); 97 mMissedAlarmsCombo = new QComboBox ( this );
94 layout->addWidget ( mMissedAlarmsCombo ); 98 layout->addWidget ( mMissedAlarmsCombo );
95 99
96 QLabel* labb = new QLabel("Suspend duration (minutes):",this); 100 QLabel* labb = new QLabel("Suspend duration (minutes):",this);
97 labb->setAlignment(AlignCenter); 101 labb->setAlignment(AlignCenter);
98 layout->addWidget ( labb ); 102 layout->addWidget ( labb );
99 fo = font(); 103 fo = font();
100 int pointSize = 36; 104 int pointSize = 36;
101 if ( QApplication::desktop()->width() <= 320 ) 105 if ( QApplication::desktop()->width() <= 320 )
102 pointSize = 24; 106 pointSize = 24;
103 fo.setPointSize( pointSize ); 107 fo.setPointSize( pointSize );
104 mSuspendSpin = new QSpinBox(1,1440,1,this); 108 mSuspendSpin = new QSpinBox(1,1440,1,this);
105 mSuspendSpin->setFont( fo ); 109 mSuspendSpin->setFont( fo );
106 mSuspendSpin->setValue(7); // default suspend duration 110 mSuspendSpin->setValue(7); // default suspend duration
107 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 111 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
108 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 112 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
109#if QT_VERSION < 0x030000 113#if QT_VERSION < 0x030000
110 mSuspendSpin->upButton ()->setFixedSize( QSize( 48, 30 )); 114 mSuspendSpin->upButton ()->setFixedSize( QSize( 48, 30 ));
111 mSuspendSpin->downButton ()->setFixedSize( QSize( 48, 30 )); 115 mSuspendSpin->downButton ()->setFixedSize( QSize( 48, 30 ));
112#endif 116#endif
113 mSuspendSpin->setFixedSize( 100,62 ); 117 mSuspendSpin->setFixedSize( 100,62 );
114 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 118 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
115 QHBoxLayout* layoutSpin = new QHBoxLayout( layout ); 119 QHBoxLayout* layoutSpin = new QHBoxLayout( layout );
116 layoutSpin->addStretch (); 120 layoutSpin->addStretch ();
117 layoutSpin->addWidget ( mSuspendSpin ); 121 layoutSpin->addWidget ( mSuspendSpin );
118 layoutSpin->addStretch (); 122 layoutSpin->addStretch ();
119 123
120 QVBox * bbox = new QVBox ( this ); 124 QVBox * bbox = new QVBox ( this );
121 layout->addWidget ( bbox ); 125 layout->addWidget ( bbox );
122 bbox->layout()->setSpacing( 2 ); 126 bbox->layout()->setSpacing( 2 );
123 labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox); 127 labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox);
124 labb->setAlignment(AlignCenter); 128 labb->setAlignment(AlignCenter);
125 mSuspendButton = new QPushButton( "Suspend", bbox); 129 mSuspendButton = new QPushButton( "Suspend", bbox);
126 QPushButton* silen = new QPushButton( " Stop sound ", bbox); 130 QPushButton* silen = new QPushButton( " Stop sound ", bbox);
127 QPushButton* okbut = new QPushButton( "Ok", bbox); 131 QPushButton* okbut = new QPushButton( "Ok", bbox);
128 mSuspendButton->setFont( fo ); 132 mSuspendButton->setFont( fo );
129 silen->setFont( fo ); 133 silen->setFont( fo );
130 okbut->setFont( fo ); 134 okbut->setFont( fo );
131 okbut->setDefault( true ); 135 okbut->setDefault( true );
132 connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); 136 connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) );
133 connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); 137 connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) );
134 connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) ); 138 connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) );
135#ifndef _WIN32_ 139#ifndef _WIN32_
136 if ( QFile::exists ( "/dev/sharp_led" ) ) 140 if ( QFile::exists ( "/dev/sharp_led" ) )
137 fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 141 fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
138 else 142 else
139#endif 143#endif
140 fd_led = 0; 144 fd_led = 0;
141 statusLED.which = SHARP_LED_SALARM; 145 statusLED.which = SHARP_LED_SALARM;
142 mSilent = false; 146 mSilent = false;
143 mSuspendCounter = 0; 147 mSuspendCounter = 0;
144 setServerNotification( true ); 148 setServerNotification( true );
145} 149}
146void AlarmDialog::reject () 150void AlarmDialog::reject ()
147{ 151{
148 QTimer::singleShot ( 3000, this, SLOT (suspend()) ); 152 QTimer::singleShot ( 3000, this, SLOT (suspend()) );
149 slotSuspend(); 153 slotSuspend();
150} 154}
151AlarmDialog::~AlarmDialog() 155AlarmDialog::~AlarmDialog()
152{ 156{
153} 157}
154void AlarmDialog::silent () 158void AlarmDialog::silent ()
155{ 159{
156 mSilent = true; 160 mSilent = true;
157} 161}
158void AlarmDialog::accept() 162void AlarmDialog::accept()
159{ 163{
160 slotOk(); 164 slotOk();
161} 165}
162 166
163void AlarmDialog::suspend() 167void AlarmDialog::suspend()
164{ 168{
165#ifdef DESKTOP_VERSION 169#ifdef DESKTOP_VERSION
166 170
167#else 171#else
168 Sound::soundAlarm (); 172 Sound::soundAlarm ();
169#endif 173#endif
170} 174}
171void AlarmDialog::slotOk() 175void AlarmDialog::slotOk()
172{ 176{
173 mStopAlarm = true; 177 mStopAlarm = true;
174 mMissedAlarms->setText("(No missed Alarms)"); 178 mMissedAlarms->setText("(No missed Alarms)");
175 mMessage->setText(""); 179 mMessage->setText("");
176 mMissedAlarmsCombo->clear(); 180 mMissedAlarmsCombo->clear();
177#ifndef _WIN32_ 181#ifndef _WIN32_
178 if ( fd_led > 0 ) { 182 if ( fd_led > 0 ) {
179 statusLED.status = LED_SALARM_OFF ; 183 statusLED.status = LED_SALARM_OFF ;
180 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); 184 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED);
181 } 185 }
182#endif 186#endif
183 QDialog::accept(); 187 QDialog::accept();
184} 188}
185 189
186void AlarmDialog::slotSuspend() 190void AlarmDialog::slotSuspend()
187{ 191{
188 //qDebug("AlarmDialog::suspend() "); // emit suspendSignal(mSuspendSpin->value()); 192 //qDebug("AlarmDialog::suspend() "); // emit suspendSignal(mSuspendSpin->value());
189 mStopAlarm = true; 193 mStopAlarm = true;
190 QDateTime nextA = QDateTime::currentDateTime().addSecs( mSuspendSpin->value() * 60 ); 194 QDateTime nextA = QDateTime::currentDateTime().addSecs( mSuspendSpin->value() * 60 );
191 QString mess = "suspend_alarm" +mFileName+"+++" ; 195 QString mess = "suspend_alarm" +mFileName+"+++" ;
192 if ( mMessage->text().left( 10 ) !="Suspended:" ) 196 if ( mMessage->text().left( 10 ) !="Suspended:" )
193 mess += "Suspended:\n"; 197 mess += "Suspended:\n";
194 mess +=mMessage->text(); 198 mess +=mMessage->text();
195#ifndef DESKTOP_VERSION 199#ifndef DESKTOP_VERSION
196 if ( mServerNotification ) 200 if ( mServerNotification )
197 AlarmServer::addAlarm ( nextA,"koalarm",mess.latin1()); 201 AlarmServer::addAlarm ( nextA,"koalarm",mess.latin1());
198#endif 202#endif
199 emit addAlarm( nextA , mess ); 203 emit addAlarm( nextA , mess );
200 slotOk(); 204 slotOk();
201} 205}
202 206
203void AlarmDialog::setServerNotification( bool b ) 207void AlarmDialog::setServerNotification( bool b )
204{ 208{
205 mServerNotification = b; 209 mServerNotification = b;
206} 210}
207int AlarmDialog::getSuspendTime( ) 211int AlarmDialog::getSuspendTime( )
208{ 212{
209 return mSuspendSpin->value(); 213 return mSuspendSpin->value();
210 214
211} 215}
212void AlarmDialog::setSuspendTime( int val ) 216void AlarmDialog::setSuspendTime( int val )
213{ 217{
214 mSuspendSpin->setValue( val ); 218 mSuspendSpin->setValue( val );
215} 219}
216bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, bool playwav, int pause , int suspendtimes) 220bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, bool playwav, int pause , int suspendtimes)
217{ 221{
218 if ( mess.left( 9) != "Suspended" ) 222 if ( mess.left( 9) != "Suspended" )
219 mSuspendCounter = suspendtimes; 223 mSuspendCounter = suspendtimes;
220 mPauseCount = pause; 224 mPauseCount = pause;
221 mFileName = fn; 225 mFileName = fn;
222 mPlayWav = playwav; 226 mPlayWav = playwav;
223 if ( !QFile::exists( fn ) ) 227 if ( !QFile::exists( fn ) )
224 mFileName = ""; 228 mFileName = "";
225 alarmCounter = 0 ; 229 alarmCounter = 0 ;
226 maxAlarmReplay = replay ; 230 maxAlarmReplay = replay ;
227 mStopAlarm = false; 231 mStopAlarm = false;
228 mSilent = false; 232 mSilent = false;
229 if ( !mMessage->text().stripWhiteSpace().isEmpty() ) { 233 if ( !mMessage->text().stripWhiteSpace().isEmpty() ) {
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 73aa733..a330414 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3880,203 +3880,225 @@ void CalendarView::deleteIncidence()
3880 if ( incidence ) { 3880 if ( incidence ) {
3881 deleteIncidence(incidence); 3881 deleteIncidence(incidence);
3882 } 3882 }
3883} 3883}
3884 3884
3885void CalendarView::showIncidence(Incidence *incidence) 3885void CalendarView::showIncidence(Incidence *incidence)
3886{ 3886{
3887 mViewerCallerIsSearchDialog = false; 3887 mViewerCallerIsSearchDialog = false;
3888 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); 3888 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() );
3889 if ( sender() && mDialogManager->getSearchDialog() ) { 3889 if ( sender() && mDialogManager->getSearchDialog() ) {
3890 if ( sender () == mDialogManager->getSearchDialog()->listview() ) { 3890 if ( sender () == mDialogManager->getSearchDialog()->listview() ) {
3891 mViewerCallerIsSearchDialog = true; 3891 mViewerCallerIsSearchDialog = true;
3892 } 3892 }
3893 } 3893 }
3894 if ( incidence ) { 3894 if ( incidence ) {
3895 ShowIncidenceVisitor v; 3895 ShowIncidenceVisitor v;
3896 v.act( incidence, this ); 3896 v.act( incidence, this );
3897 } 3897 }
3898} 3898}
3899 3899
3900void CalendarView::editIncidence(Incidence *incidence) 3900void CalendarView::editIncidence(Incidence *incidence)
3901{ 3901{
3902 if ( incidence ) { 3902 if ( incidence ) {
3903 3903
3904 EditIncidenceVisitor v; 3904 EditIncidenceVisitor v;
3905 v.act( incidence, this ); 3905 v.act( incidence, this );
3906 3906
3907 } 3907 }
3908} 3908}
3909 3909
3910void CalendarView::deleteIncidence(Incidence *incidence) 3910void CalendarView::deleteIncidence(Incidence *incidence)
3911{ 3911{
3912 //qDebug(" CalendarView::deleteIncidence "); 3912 //qDebug(" CalendarView::deleteIncidence ");
3913 if ( incidence ) { 3913 if ( incidence ) {
3914 DeleteIncidenceVisitor v; 3914 DeleteIncidenceVisitor v;
3915 v.act( incidence, this ); 3915 v.act( incidence, this );
3916 } 3916 }
3917} 3917}
3918 3918
3919 3919
3920void CalendarView::lookForOutgoingMessages() 3920void CalendarView::lookForOutgoingMessages()
3921{ 3921{
3922 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 3922 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
3923 ogd->loadMessages(); 3923 ogd->loadMessages();
3924} 3924}
3925 3925
3926void CalendarView::lookForIncomingMessages() 3926void CalendarView::lookForIncomingMessages()
3927{ 3927{
3928 IncomingDialog *icd = mDialogManager->incomingDialog(); 3928 IncomingDialog *icd = mDialogManager->incomingDialog();
3929 icd->retrieve(); 3929 icd->retrieve();
3930} 3930}
3931 3931
3932bool CalendarView::removeCompletedSubTodos( Todo* t ) 3932bool CalendarView::removeCompletedSubTodos( Todo* t )
3933{ 3933{
3934 bool deleteTodo = true; 3934 bool deleteTodo = true;
3935 QPtrList<Incidence> subTodos; 3935 QPtrList<Incidence> subTodos;
3936 Incidence *aTodo; 3936 Incidence *aTodo;
3937 subTodos = t->relations(); 3937 subTodos = t->relations();
3938 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 3938 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3939 if (! removeCompletedSubTodos( (Todo*) aTodo )) 3939 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3940 deleteTodo = false; 3940 deleteTodo = false;
3941 } 3941 }
3942 if ( deleteTodo ) { 3942 if ( deleteTodo ) {
3943 if ( t->isCompleted() && !t->doesRecur()) { 3943 if ( t->isCompleted() && !t->doesRecur()) {
3944 checkExternalId( t ); 3944 checkExternalId( t );
3945 mCalendar->deleteTodo( t ); 3945 mCalendar->deleteTodo( t );
3946 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 3946 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3947 } 3947 }
3948 else 3948 else
3949 deleteTodo = false; 3949 deleteTodo = false;
3950 } 3950 }
3951 return deleteTodo; 3951 return deleteTodo;
3952 3952
3953} 3953}
3954void CalendarView::purgeCompleted() 3954void CalendarView::purgeCompleted()
3955{ 3955{
3956 int result = KMessageBox::warningContinueCancel(this, 3956 int result = KMessageBox::warningContinueCancel(this,
3957 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); 3957 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge"));
3958 3958
3959 if (result == KMessageBox::Continue) { 3959 if (result == KMessageBox::Continue) {
3960 3960
3961 QPtrList<Todo> todoCal; 3961 QPtrList<Todo> todoCal;
3962 QPtrList<Todo> rootTodos; 3962 QPtrList<Todo> rootTodos;
3963 //QPtrList<Incidence> rel; 3963 //QPtrList<Incidence> rel;
3964 Todo *aTodo;//, *rTodo; 3964 Todo *aTodo;//, *rTodo;
3965 Incidence *rIncidence; 3965 Incidence *rIncidence;
3966 bool childDelete = false; 3966 bool childDelete = false;
3967 bool deletedOne = true; 3967 bool deletedOne = true;
3968 todoCal = calendar()->todos(); 3968 todoCal = calendar()->todos();
3969 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 3969 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
3970 if ( !aTodo->relatedTo() ) 3970 if ( !aTodo->relatedTo() )
3971 rootTodos.append( aTodo ); 3971 rootTodos.append( aTodo );
3972 } 3972 }
3973 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3973 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3974 removeCompletedSubTodos( aTodo ); 3974 removeCompletedSubTodos( aTodo );
3975 } 3975 }
3976 3976
3977 updateView(); 3977 updateView();
3978 } 3978 }
3979} 3979}
3980 3980
3981void CalendarView::slotCalendarChanged() 3981void CalendarView::slotCalendarChanged()
3982{ 3982{
3983 ; 3983 ;
3984} 3984}
3985 3985
3986void CalendarView::keyPressEvent ( QKeyEvent *e) 3986void CalendarView::keyPressEvent ( QKeyEvent *e)
3987{ 3987{
3988 //qDebug(" alendarView::keyPressEvent "); 3988 //qDebug(" alendarView::keyPressEvent ");
3989 e->ignore(); 3989 e->ignore();
3990} 3990}
3991 3991
3992 3992
3993bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 3993bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
3994{ 3994{
3995 // mSyncManager = manager; 3995 // mSyncManager = manager;
3996 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 3996 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
3997 qDebug("KO: SyncKDE request detected!"); 3997 qDebug("KO: SyncKDE request detected!");
3998 } 3998 }
3999 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3999 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4000 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4000 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4001 return syncCalendar( filename, mode ); 4001 return syncCalendar( filename, mode );
4002} 4002}
4003bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 4003bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
4004{ 4004{
4005 //mSyncManager = manager; 4005 //mSyncManager = manager;
4006 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4006 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4007 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4007 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4008 if ( resource == "sharp" ) 4008 if ( resource == "sharp" )
4009 syncExternal( 0 ); 4009 syncExternal( 0 );
4010 if ( resource == "phone" ) 4010 if ( resource == "phone" )
4011 syncExternal( 1 ); 4011 syncExternal( 1 );
4012 // pending setmodified 4012 // pending setmodified
4013 return true; 4013 return true;
4014} 4014}
4015void CalendarView::setSyncManager(KSyncManager* manager) 4015void CalendarView::setSyncManager(KSyncManager* manager)
4016{ 4016{
4017 mSyncManager = manager; 4017 mSyncManager = manager;
4018} 4018}
4019 4019
4020void CalendarView::removeSyncInfo( QString syncProfile) 4020void CalendarView::removeSyncInfo( QString syncProfile)
4021{ 4021{
4022 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 4022 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
4023 mCalendar->removeSyncInfo( syncProfile ); 4023 mCalendar->removeSyncInfo( syncProfile );
4024 4024
4025} 4025}
4026 4026
4027void CalendarView::undo_delete() 4027void CalendarView::undo_delete()
4028{ 4028{
4029 //qDebug("undo_delete() "); 4029 //qDebug("undo_delete() ");
4030 Incidence* undo = mCalendar->undoIncidence(); 4030 Incidence* undo = mCalendar->undoIncidence();
4031 if ( !undo ) { 4031 if ( !undo ) {
4032 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 4032 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
4033 i18n("KO/Pi")); 4033 i18n("KO/Pi"));
4034 return; 4034 return;
4035 } 4035 }
4036 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 4036 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
4037 i18n("\nAre you sure you want\nto restore this?"), 4037 i18n("\nAre you sure you want\nto restore this?"),
4038 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 4038 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
4039 mCalendar->undoDeleteIncidence(); 4039 mCalendar->undoDeleteIncidence();
4040 updateView(); 4040 updateView();
4041 } 4041 }
4042} 4042}
4043 4043
4044void CalendarView::slotViewerClosed() 4044void CalendarView::slotViewerClosed()
4045{ 4045{
4046 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 4046 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
4047} 4047}
4048 4048
4049void CalendarView::resetFocus() 4049void CalendarView::resetFocus()
4050{ 4050{
4051 if ( mViewerCallerIsSearchDialog ) { 4051 if ( mViewerCallerIsSearchDialog ) {
4052 if ( mDialogManager->getSearchDialog()->isVisible() ){ 4052 if ( mDialogManager->getSearchDialog()->isVisible() ){
4053 mDialogManager->getSearchDialog()->raise(); 4053 mDialogManager->getSearchDialog()->raise();
4054 mDialogManager->getSearchDialog()->setActiveWindow(); 4054 mDialogManager->getSearchDialog()->setActiveWindow();
4055 mDialogManager->getSearchDialog()->listview()->resetFocus(); 4055 mDialogManager->getSearchDialog()->listview()->resetFocus();
4056 } else 4056 } else
4057 mViewerCallerIsSearchDialog = false; 4057 mViewerCallerIsSearchDialog = false;
4058 } 4058 }
4059 if ( !mViewerCallerIsSearchDialog ) { 4059 if ( !mViewerCallerIsSearchDialog ) {
4060 //mViewManager->currentView()->setFocus(); 4060 //mViewManager->currentView()->setFocus();
4061 //qDebug("sssssssssssssssset focus "); 4061 //qDebug("sssssssssssssssset focus ");
4062 topLevelWidget()->raise(); 4062 topLevelWidget()->raise();
4063 setActiveWindow(); 4063 setActiveWindow();
4064 //setFocus(); 4064 //setFocus();
4065 } 4065 }
4066 mViewerCallerIsSearchDialog = false; 4066 mViewerCallerIsSearchDialog = false;
4067} 4067}
4068 4068
4069void CalendarView::showNextAlarms() 4069void CalendarView::showNextAlarms()
4070{ 4070{
4071 QString message; 4071 QString message;
4072 if ( mNextAlarmDateTime > QDateTime::currentDateTime() ) { 4072 QDateTime nextAl = mCalendar->nextAlarmEventDateTime();
4073 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) {
4073 QString sum = mCalendar->nextSummary(); 4074 QString sum = mCalendar->nextSummary();
4074 QDateTime nextA = mNextAlarmDateTime; 4075 QDateTime nextA = mNextAlarmDateTime;
4075 QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); 4076 QDateTime cur = QDateTime::currentDateTime();
4076 message = i18n("The next alarm is on:\n%1\nat: %2\n\n%3\n(%4)").arg( KGlobal::locale()->formatDate(nextA.date() , false)).arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; 4077 int secs = cur.secsTo( nextA );
4078 int min = secs /60;
4079 int hours = min /60;
4080 min = min % 60;
4081 int days = hours /24;
4082 hours = hours % 24;
4083
4084 message = i18n("The next alarm is in:\n");
4085 if ( days > 1 )
4086 message += i18n("%1 days\n").arg( days );
4087 else if ( days == 1 )
4088 message += i18n("1 day\n");
4089 if ( hours > 1 )
4090 message += i18n("%1 hours\n").arg( hours );
4091 else if ( hours == 1 )
4092 message += i18n("1 hour\n");
4093 if ( min > 1 )
4094 message += i18n("%1 minutes\n").arg( min );
4095 else if ( min == 1 )
4096 message += i18n("1 minute\n");
4097
4098 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ;
4077 } else { 4099 } else {
4078 message = i18n("There is no next alarm."); 4100 message = i18n("There is no next alarm.");
4079 4101
4080 } 4102 }
4081 KMessageBox::information( this, message); 4103 KMessageBox::information( this, message);
4082} 4104}
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 18f242c..f6f390b 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1,398 +1,398 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qhbox.h> 24#include <qhbox.h>
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#ifndef KORG_NOSPLITTER 29#ifndef KORG_NOSPLITTER
30#include <qsplitter.h> 30#include <qsplitter.h>
31#endif 31#endif
32#include <qfont.h> 32#include <qfont.h>
33#include <qfontmetrics.h> 33#include <qfontmetrics.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qtooltip.h> 35#include <qtooltip.h>
36#include <qpainter.h> 36#include <qpainter.h>
37#include <qpushbutton.h> 37#include <qpushbutton.h>
38#include <qapplication.h> 38#include <qapplication.h>
39 39
40#include <kapplication.h> 40#include <kapplication.h>
41#include <KDGanttMinimizeSplitter.h> 41#include <KDGanttMinimizeSplitter.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kstandarddirs.h> 43#include <kstandarddirs.h>
44#include <kiconloader.h> 44#include <kiconloader.h>
45#include <klocale.h> 45#include <klocale.h>
46#include <kconfig.h> 46#include <kconfig.h>
47#include <kglobal.h> 47#include <kglobal.h>
48#include "calendarview.h" 48#include "calendarview.h"
49#include "koviewmanager.h" 49#include "koviewmanager.h"
50 50
51#include <libkcal/calendar.h> 51#include <libkcal/calendar.h>
52#include <libkcal/icaldrag.h> 52#include <libkcal/icaldrag.h>
53#include <libkcal/dndfactory.h> 53#include <libkcal/dndfactory.h>
54 54
55#include <kcalendarsystem.h> 55#include <kcalendarsystem.h>
56 56
57#include "koglobals.h" 57#include "koglobals.h"
58#ifndef KORG_NOPLUGINS 58#ifndef KORG_NOPLUGINS
59#include "kocore.h" 59#include "kocore.h"
60#endif 60#endif
61#include "koprefs.h" 61#include "koprefs.h"
62#include "koagenda.h" 62#include "koagenda.h"
63#include "koagendaitem.h" 63#include "koagendaitem.h"
64#ifndef KORG_NOPRINTER 64#ifndef KORG_NOPRINTER
65#include "calprinter.h" 65#include "calprinter.h"
66#endif 66#endif
67 67
68#include "koagendaview.h" 68#include "koagendaview.h"
69//#include "koagendaview.moc" 69//#include "koagendaview.moc"
70 70
71//extern bool globalFlagBlockPainting; 71//extern bool globalFlagBlockPainting;
72extern int globalFlagBlockAgenda; 72extern int globalFlagBlockAgenda;
73extern int globalFlagBlockStartup; 73extern int globalFlagBlockStartup;
74extern int globalFlagBlockAgendaItemPaint; 74extern int globalFlagBlockAgendaItemPaint;
75extern int globalFlagBlockAgendaItemUpdate; 75extern int globalFlagBlockAgendaItemUpdate;
76extern int globalFlagBlockLabel; 76extern int globalFlagBlockLabel;
77using namespace KOrg; 77using namespace KOrg;
78 78
79 79
80 80
81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : 81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
82 QScrollView(parent,name,f) 82 QScrollView(parent,name,f)
83{ 83{
84 mRows = rows; 84 mRows = rows;
85 85
86 setMinimumHeight( 20 ); 86 setMinimumHeight( 20 );
87 mCellHeight = KOPrefs::instance()->mHourSize*4; 87 mCellHeight = KOPrefs::instance()->mHourSize*4;
88 88
89 enableClipper(true); 89 enableClipper(true);
90 90
91 setHScrollBarMode(AlwaysOff); 91 setHScrollBarMode(AlwaysOff);
92 setVScrollBarMode(AlwaysOff); 92 setVScrollBarMode(AlwaysOff);
93 93
94 resizeContents(50,mRows * mCellHeight); 94 resizeContents(50,mRows * mCellHeight);
95 95
96 viewport()->setBackgroundMode( PaletteBackground ); 96 viewport()->setBackgroundMode( PaletteBackground );
97} 97}
98 98
99void TimeLabels::setCellHeight(int height) 99void TimeLabels::setCellHeight(int height)
100{ 100{
101 mCellHeight = height; 101 mCellHeight = height;
102} 102}
103 103
104/* 104/*
105 Optimization so that only the "dirty" portion of the scroll view 105 Optimization so that only the "dirty" portion of the scroll view
106 is redrawn. Unfortunately, this is not called by default paintEvent() method. 106 is redrawn. Unfortunately, this is not called by default paintEvent() method.
107*/ 107*/
108void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) 108void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
109{ 109{
110 110
111 // if ( globalFlagBlockAgenda ) 111 // if ( globalFlagBlockAgenda )
112 // return; 112 // return;
113 // bug: the parameters cx, cy, cw, ch are the areas that need to be 113 // bug: the parameters cx, cy, cw, ch are the areas that need to be
114 // redrawn, not the area of the widget. unfortunately, this 114 // redrawn, not the area of the widget. unfortunately, this
115 // code assumes the latter... 115 // code assumes the latter...
116 116
117 // now, for a workaround... 117 // now, for a workaround...
118 // these two assignments fix the weird redraw bug 118 // these two assignments fix the weird redraw bug
119 cx = contentsX() + 2; 119 cx = contentsX() + 2;
120 cw = contentsWidth() - 2; 120 cw = contentsWidth() - 2;
121 // end of workaround 121 // end of workaround
122 122
123 int cell = ((int)(cy/mCellHeight)); 123 int cell = ((int)(cy/mCellHeight));
124 int y = cell * mCellHeight; 124 int y = cell * mCellHeight;
125 QFontMetrics fm = fontMetrics(); 125 QFontMetrics fm = fontMetrics();
126 QString hour; 126 QString hour;
127 QString suffix; 127 QString suffix;
128 QString fullTime;
129 int tW = fm.width("24:00i"); 128 int tW = fm.width("24:00i");
130 int timeHeight = fm.height(); 129 int timeHeight = fm.height();
131 //timeHeight -= (timeHeight/4-2); 130 //timeHeight -= (timeHeight/4-2);
132 int borderWidth = 0; 131 int borderWidth = 0;
133 QFont nFont = p->font(); 132 QFont nFont = p->font();
134 133
135 if (!KGlobal::locale()->use12Clock()) 134 if (!KGlobal::locale()->use12Clock())
136 suffix = "00"; 135 suffix = "00";
137 else 136 else
138 borderWidth = 0; 137 borderWidth = 0;
139 if ( timeHeight > mCellHeight ) { 138 if ( timeHeight > mCellHeight ) {
140 timeHeight = mCellHeight-1; 139 timeHeight = mCellHeight-1;
141 int pointS = nFont.pointSize(); 140 int pointS = nFont.pointSize();
142 while ( pointS > 4 ) { 141 while ( pointS > 4 ) {
143 nFont.setPointSize( pointS ); 142 nFont.setPointSize( pointS );
144 fm = QFontMetrics( nFont ); 143 fm = QFontMetrics( nFont );
145 if ( fm.height() < mCellHeight ) 144 if ( fm.height() < mCellHeight )
146 break; 145 break;
147 -- pointS; 146 -- pointS;
148 } 147 }
149 fm = QFontMetrics( nFont ); 148 fm = QFontMetrics( nFont );
150 borderWidth = 4; 149 borderWidth = 4;
151 timeHeight = fm.height(); 150 timeHeight = fm.height();
152 } 151 }
153 timeHeight -= (timeHeight/4-2); 152 timeHeight -= (timeHeight/4-2);
154 QFont sFont = nFont; 153 QFont sFont = nFont;
155 sFont.setPointSize( sFont.pointSize()/2+2 ); 154 sFont.setPointSize( sFont.pointSize()/2+2 );
156 QFontMetrics fmS( sFont ); 155 QFontMetrics fmS( sFont );
157 int sHei = fmS.height(); 156 int sHei = fmS.height();
158 157 sHei -= (sHei/4-2);
158 int startW = this->width() - frameWidth();
159 while (y < cy + ch) { 159 while (y < cy + ch) {
160 p->drawLine(cx,y,cx+tW,y); 160 p->drawLine(cx,y,cx+tW,y);
161 hour.setNum(cell); 161 hour.setNum(cell);
162 162
163 // handle 24h and am/pm time formats 163 // handle 24h and am/pm time formats
164 if (KGlobal::locale()->use12Clock()) { 164 if (KGlobal::locale()->use12Clock()) {
165 if (cell > 11) suffix = "pm"; 165 if (cell > 11) suffix = "pm";
166 else 166 else
167 suffix = "am"; 167 suffix = "am";
168 if (cell == 0) hour.setNum(12); 168 if (cell == 0) hour.setNum(12);
169 if (cell > 12) hour.setNum(cell - 12); 169 if (cell > 12) hour.setNum(cell - 12);
170 } 170 }
171 171
172 // create string in format of "XX:XX" or "XXpm/am"
173 fullTime = hour;// + suffix;
174
175 // center and draw the time label 172 // center and draw the time label
176 int timeWidth = fm.width(fullTime+"i"); 173 int timeWidth = fm.width(hour+"i");
177 int tw2 = fm.width(suffix); 174 int tw2 = fm.width(suffix);
178 int offset = this->width() - timeWidth - tw2; 175 int offset = startW - timeWidth - tw2 ;
179 p->setFont( nFont ); 176 p->setFont( nFont );
180 p->drawText(cx - borderWidth + offset, y+ timeHeight, fullTime); 177 p->drawText(cx - borderWidth + offset, y+ timeHeight, hour);
181 p->setFont( sFont ); 178 p->setFont( sFont );
182 offset += timeWidth; 179 offset = startW - tw2-1;
183 p->drawText(cx - borderWidth + offset, y+ sHei, suffix); 180 p->drawText(cx - borderWidth + offset, y+ sHei, suffix);
184 181
185 // increment indices 182 // increment indices
186 y += mCellHeight; 183 y += mCellHeight;
187 cell++; 184 cell++;
188 } 185 }
189} 186}
190 187
191/** 188/**
192 Calculates the minimum width. 189 Calculates the minimum width.
193*/ 190*/
194int TimeLabels::minimumWidth() const 191int TimeLabels::minimumWidth() const
195{ 192{
196 return mMiniWidth; 193 return mMiniWidth;
197} 194}
198 195
199/** updates widget's internal state */ 196/** updates widget's internal state */
200void TimeLabels::updateConfig() 197void TimeLabels::updateConfig()
201{ 198{
202 // set the font 199 // set the font
203 // config->setGroup("Fonts"); 200 // config->setGroup("Fonts");
204 // QFont font = config->readFontEntry("TimeBar Font"); 201 // QFont font = config->readFontEntry("TimeBar Font");
205 setFont(KOPrefs::instance()->mTimeBarFont); 202 setFont(KOPrefs::instance()->mTimeBarFont);
206 mMiniWidth = fontMetrics().width("88:88") + 2 ; 203 QString test = "88:88";
204 if (KGlobal::locale()->use12Clock())
205 test += "i";
206 mMiniWidth = fontMetrics().width(test) + frameWidth()*2 +1 ;
207 // update geometry restrictions based on new settings 207 // update geometry restrictions based on new settings
208 setFixedWidth(minimumWidth()); 208 setFixedWidth(minimumWidth());
209 209
210 // update HourSize 210 // update HourSize
211 mCellHeight = KOPrefs::instance()->mHourSize*4; 211 mCellHeight = KOPrefs::instance()->mHourSize*4;
212 resizeContents(50,mRows * mCellHeight); 212 resizeContents(50,mRows * mCellHeight);
213} 213}
214 214
215/** update time label positions */ 215/** update time label positions */
216void TimeLabels::positionChanged() 216void TimeLabels::positionChanged()
217{ 217{
218 int adjustment = mAgenda->contentsY(); 218 int adjustment = mAgenda->contentsY();
219 setContentsPos(0, adjustment); 219 setContentsPos(0, adjustment);
220} 220}
221 221
222/** */ 222/** */
223void TimeLabels::setAgenda(KOAgenda* agenda) 223void TimeLabels::setAgenda(KOAgenda* agenda)
224{ 224{
225 mAgenda = agenda; 225 mAgenda = agenda;
226} 226}
227 227
228void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) 228void TimeLabels::contentsMousePressEvent ( QMouseEvent * e)
229{ 229{
230 mMouseDownY = e->pos().y(); 230 mMouseDownY = e->pos().y();
231 mOrgCap = topLevelWidget()->caption(); 231 mOrgCap = topLevelWidget()->caption();
232} 232}
233 233
234void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) 234void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e )
235{ 235{
236 int diff = mMouseDownY - e->pos().y(); 236 int diff = mMouseDownY - e->pos().y();
237 if ( diff < 10 && diff > -10 ) 237 if ( diff < 10 && diff > -10 )
238 return; 238 return;
239 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; 239 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ;
240 if ( tSize < 4 ) 240 if ( tSize < 4 )
241 tSize = 4; 241 tSize = 4;
242 if ( tSize > 22 ) 242 if ( tSize > 22 )
243 tSize = 22; 243 tSize = 22;
244 tSize = (tSize-2)/2; 244 tSize = (tSize-2)/2;
245 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); 245 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize));
246 246
247} 247}
248void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) 248void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e )
249{ 249{
250 topLevelWidget()->setCaption( mOrgCap ); 250 topLevelWidget()->setCaption( mOrgCap );
251 int diff = mMouseDownY - e->pos().y(); 251 int diff = mMouseDownY - e->pos().y();
252 if ( diff < 10 && diff > -10 ) 252 if ( diff < 10 && diff > -10 )
253 return; 253 return;
254 int tSize = KOPrefs::instance()->mHourSize + (diff/10); 254 int tSize = KOPrefs::instance()->mHourSize + (diff/10);
255 if ( tSize < 4 ) 255 if ( tSize < 4 )
256 tSize = 4; 256 tSize = 4;
257 if ( tSize > 22 ) 257 if ( tSize > 22 )
258 tSize = 22; 258 tSize = 22;
259 tSize = (tSize/2)*2; 259 tSize = (tSize/2)*2;
260 if ( tSize == KOPrefs::instance()->mHourSize ) 260 if ( tSize == KOPrefs::instance()->mHourSize )
261 return; 261 return;
262 KOPrefs::instance()->mHourSize = tSize; 262 KOPrefs::instance()->mHourSize = tSize;
263 emit scaleChanged(); 263 emit scaleChanged();
264} 264}
265 265
266/** This is called in response to repaint() */ 266/** This is called in response to repaint() */
267void TimeLabels::paintEvent(QPaintEvent*) 267void TimeLabels::paintEvent(QPaintEvent*)
268{ 268{
269 269
270 // kdDebug() << "paintevent..." << endl; 270 // kdDebug() << "paintevent..." << endl;
271 // this is another hack! 271 // this is another hack!
272 // QPainter painter(this); 272 // QPainter painter(this);
273 //QString c 273 //QString c
274 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); 274 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight());
275} 275}
276 276
277//////////////////////////////////////////////////////////////////////////// 277////////////////////////////////////////////////////////////////////////////
278 278
279EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) 279EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name)
280 : QFrame(parent,name) 280 : QFrame(parent,name)
281{ 281{
282 mColumns = 1; 282 mColumns = 1;
283 mTopBox = 0; 283 mTopBox = 0;
284 mLocation = loc; 284 mLocation = loc;
285 mTopLayout = 0; 285 mTopLayout = 0;
286 mPaintWidget = 0; 286 mPaintWidget = 0;
287 mXOffset = 0; 287 mXOffset = 0;
288 if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); 288 if (mLocation == Top) mPixmap = SmallIcon("1uparrow");
289 else mPixmap = SmallIcon("1downarrow"); 289 else mPixmap = SmallIcon("1downarrow");
290 mEnabled.resize(mColumns); 290 mEnabled.resize(mColumns);
291 mEnabled.fill( false ); 291 mEnabled.fill( false );
292 setMinimumHeight(mPixmap.height()); 292 setMinimumHeight(mPixmap.height());
293} 293}
294 294
295EventIndicator::~EventIndicator() 295EventIndicator::~EventIndicator()
296{ 296{
297} 297}
298 298
299void EventIndicator::drawContents(QPainter *p) 299void EventIndicator::drawContents(QPainter *p)
300{ 300{
301 301
302 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; 302 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl;
303 KDGanttSplitterHandle* han = 0; 303 KDGanttSplitterHandle* han = 0;
304 if ( mPaintWidget ) 304 if ( mPaintWidget )
305 han = mPaintWidget->firstHandle(); 305 han = mPaintWidget->firstHandle();
306 if ( ! han ) { 306 if ( ! han ) {
307 int i; 307 int i;
308 for(i=0;i<mColumns;++i) { 308 for(i=0;i<mColumns;++i) {
309 if (mEnabled[i]) { 309 if (mEnabled[i]) {
310 int cellWidth = contentsRect().right()/mColumns; 310 int cellWidth = contentsRect().right()/mColumns;
311 int xOffset = KOGlobals::self()->reverseLayout() ? 311 int xOffset = KOGlobals::self()->reverseLayout() ?
312 (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : 312 (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 :
313 i*cellWidth + (cellWidth -mPixmap.width()) /2; 313 i*cellWidth + (cellWidth -mPixmap.width()) /2;
314 p->drawPixmap(QPoint(1+xOffset,0),mPixmap); 314 p->drawPixmap(QPoint(1+xOffset,0),mPixmap);
315 } 315 }
316 } 316 }
317 } else { 317 } else {
318 han->repaint(); 318 han->repaint();
319 //mPaintWidget->setBackgroundColor( red ); 319 //mPaintWidget->setBackgroundColor( red );
320 320
321 QPainter pa( han ); 321 QPainter pa( han );
322 int i; 322 int i;
323 bool setColor = false; 323 bool setColor = false;
324 for(i=0;i<mColumns;++i) { 324 for(i=0;i<mColumns;++i) {
325 if (mEnabled[i]) { 325 if (mEnabled[i]) {
326 setColor = true; 326 setColor = true;
327 327
328 int cellWidth = contentsRect().right()/mColumns; 328 int cellWidth = contentsRect().right()/mColumns;
329 int xOffset = KOGlobals::self()->reverseLayout() ? 329 int xOffset = KOGlobals::self()->reverseLayout() ?
330 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : 330 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 :
331 i*cellWidth + cellWidth/2 -mPixmap.width()/2; 331 i*cellWidth + cellWidth/2 -mPixmap.width()/2;
332 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); 332 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap);
333 //qDebug("222draw pix %d ",xOffset ); 333 //qDebug("222draw pix %d ",xOffset );
334 334
335 } 335 }
336 336
337 } 337 }
338 pa.end(); 338 pa.end();
339 339
340 } 340 }
341} 341}
342 342
343void EventIndicator::setXOffset( int x ) 343void EventIndicator::setXOffset( int x )
344{ 344{
345 mXOffset = x; 345 mXOffset = x;
346} 346}
347void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) 347void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w )
348{ 348{
349 mPaintWidget = w; 349 mPaintWidget = w;
350 setMaximumHeight(0); 350 setMaximumHeight(0);
351 setMinimumHeight(0); 351 setMinimumHeight(0);
352} 352}
353void EventIndicator::changeColumns(int columns) 353void EventIndicator::changeColumns(int columns)
354{ 354{
355 mColumns = columns; 355 mColumns = columns;
356 mEnabled.resize(mColumns); 356 mEnabled.resize(mColumns);
357 357
358 update(); 358 update();
359} 359}
360 360
361void EventIndicator::enableColumn(int column, bool enable) 361void EventIndicator::enableColumn(int column, bool enable)
362{ 362{
363 mEnabled[column] = enable; 363 mEnabled[column] = enable;
364} 364}
365 365
366 366
367//////////////////////////////////////////////////////////////////////////// 367////////////////////////////////////////////////////////////////////////////
368//////////////////////////////////////////////////////////////////////////// 368////////////////////////////////////////////////////////////////////////////
369//////////////////////////////////////////////////////////////////////////// 369////////////////////////////////////////////////////////////////////////////
370 370
371KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : 371KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
372 KOEventView (cal,parent,name) 372 KOEventView (cal,parent,name)
373{ 373{
374 mBlockUpdating = true; 374 mBlockUpdating = true;
375 mStartHour = 8; 375 mStartHour = 8;
376 mSelectedDates.append(QDate::currentDate()); 376 mSelectedDates.append(QDate::currentDate());
377 377
378 mLayoutDayLabels = 0; 378 mLayoutDayLabels = 0;
379 mDayLabelsFrame = 0; 379 mDayLabelsFrame = 0;
380 mDayLabels = 0; 380 mDayLabels = 0;
381 bool isRTL = KOGlobals::self()->reverseLayout(); 381 bool isRTL = KOGlobals::self()->reverseLayout();
382 QPixmap expandPix; 382 QPixmap expandPix;
383 if ( KOPrefs::instance()->mVerticalScreen ) { 383 if ( KOPrefs::instance()->mVerticalScreen ) {
384 expandPix = SmallIcon( "1updownarrow" ); 384 expandPix = SmallIcon( "1updownarrow" );
385 } else { 385 } else {
386 expandPix = SmallIcon("1leftrightarrow" ); 386 expandPix = SmallIcon("1leftrightarrow" );
387 } 387 }
388 388
389 QBoxLayout *topLayout = new QVBoxLayout(this); 389 QBoxLayout *topLayout = new QVBoxLayout(this);
390 390
391 // Create day name labels for agenda columns 391 // Create day name labels for agenda columns
392 // Create agenda splitter 392 // Create agenda splitter
393 393
394 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); 394 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this);
395 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 395 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
396 topLayout->addWidget( mSplitterAgenda ); 396 topLayout->addWidget( mSplitterAgenda );
397 mAllDayFrame = new QHBox(mSplitterAgenda); 397 mAllDayFrame = new QHBox(mSplitterAgenda);
398 mAllDayFrame->setFocusPolicy(NoFocus); 398 mAllDayFrame->setFocusPolicy(NoFocus);
@@ -647,389 +647,386 @@ void KOAgendaView::createDayLabels()
647 647
648 } 648 }
649 int newHight; 649 int newHight;
650 650
651 // ### Before deleting and recreating we could check if mSelectedDates changed... 651 // ### Before deleting and recreating we could check if mSelectedDates changed...
652 // It would remove some flickering and gain speed (since this is called by 652 // It would remove some flickering and gain speed (since this is called by
653 // each updateView() call) 653 // each updateView() call)
654 654
655 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; 655 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2;
656 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); 656 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth );
657 if ( maxWid < 0 ) 657 if ( maxWid < 0 )
658 maxWid = 20; 658 maxWid = 20;
659 659
660 QFont dlf = KOPrefs::instance()->mTimeLabelsFont; 660 QFont dlf = KOPrefs::instance()->mTimeLabelsFont;
661 QFontMetrics fm ( dlf ); 661 QFontMetrics fm ( dlf );
662 int selCount = mSelectedDates.count(); 662 int selCount = mSelectedDates.count();
663 QString dayTest = "Mon 20"; 663 QString dayTest = "Mon 20";
664 //QString dayTest = "Mon 20"; 664 //QString dayTest = "Mon 20";
665 int wid = fm.width( dayTest ); 665 int wid = fm.width( dayTest );
666 //maxWid -= ( selCount * 3 ); //working for QLabels 666 //maxWid -= ( selCount * 3 ); //working for QLabels
667 maxWid -= ( selCount * 3 ); //working for QPushButton 667 maxWid -= ( selCount * 3 ); //working for QPushButton
668 if ( maxWid < 0 ) 668 if ( maxWid < 0 )
669 maxWid = 20; 669 maxWid = 20;
670 int needWid = wid * selCount; 670 int needWid = wid * selCount;
671 //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); 671 //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid );
672 //if ( needWid > maxWid ) 672 //if ( needWid > maxWid )
673 // qDebug("DAYLABELS TOOOOOOO BIG "); 673 // qDebug("DAYLABELS TOOOOOOO BIG ");
674 while ( needWid > maxWid ) { 674 while ( needWid > maxWid ) {
675 dayTest = dayTest.left( dayTest.length() - 1 ); 675 dayTest = dayTest.left( dayTest.length() - 1 );
676 wid = fm.width( dayTest ); 676 wid = fm.width( dayTest );
677 needWid = wid * selCount; 677 needWid = wid * selCount;
678 } 678 }
679 int maxLen = dayTest.length(); 679 int maxLen = dayTest.length();
680 int fontPoint = dlf.pointSize(); 680 int fontPoint = dlf.pointSize();
681 if ( maxLen < 2 ) { 681 if ( maxLen < 2 ) {
682 int fontPoint = dlf.pointSize(); 682 int fontPoint = dlf.pointSize();
683 while ( fontPoint > 4 ) { 683 while ( fontPoint > 4 ) {
684 --fontPoint; 684 --fontPoint;
685 dlf.setPointSize( fontPoint ); 685 dlf.setPointSize( fontPoint );
686 QFontMetrics f( dlf ); 686 QFontMetrics f( dlf );
687 wid = f.width( "30" ); 687 wid = f.width( "30" );
688 needWid = wid * selCount; 688 needWid = wid * selCount;
689 if ( needWid < maxWid ) 689 if ( needWid < maxWid )
690 break; 690 break;
691 } 691 }
692 maxLen = 2; 692 maxLen = 2;
693 } 693 }
694 //qDebug("Max len %d ", dayTest.length() ); 694 //qDebug("Max len %d ", dayTest.length() );
695 695
696 QFontMetrics tempF( dlf ); 696 QFontMetrics tempF( dlf );
697 newHight = tempF.height(); 697 newHight = tempF.height();
698 mDayLabels->setFont( dlf ); 698 mDayLabels->setFont( dlf );
699 // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; 699 // mLayoutDayLabels = new QHBoxLayout(mDayLabels);;
700 // mLayoutDayLabels->addSpacing(mTimeLabels->width()); 700 // mLayoutDayLabels->addSpacing(mTimeLabels->width());
701 //mLayoutDayLabels->addSpacing( 2 ); 701 //mLayoutDayLabels->addSpacing( 2 );
702 // QFont lFont = dlf; 702 // QFont lFont = dlf;
703 bool appendLabels = false; 703 bool appendLabels = false;
704 KOAgendaButton *dayLabel; 704 KOAgendaButton *dayLabel;
705 dayLabel = mDayLabelsList.first(); 705 dayLabel = mDayLabelsList.first();
706 if ( !dayLabel ) { 706 if ( !dayLabel ) {
707 appendLabels = true; 707 appendLabels = true;
708 dayLabel = getNewDaylabel(); 708 dayLabel = getNewDaylabel();
709 } 709 }
710 dayLabel->setFixedWidth( mTimeLabels->width()+2 ); 710 dayLabel->setFixedWidth( mTimeLabels->width()+2 );
711 dayLabel->setFont( dlf ); 711 dayLabel->setFont( dlf );
712 dayLabel->setNum( -1 ); 712 dayLabel->setNum( -1 );
713 //dayLabel->setAlignment(QLabel::AlignHCenter); 713 //dayLabel->setAlignment(QLabel::AlignHCenter);
714 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); 714 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) );
715 dayLabel->show(); 715 dayLabel->show();
716 DateList::ConstIterator dit; 716 DateList::ConstIterator dit;
717 bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); 717 bool oneday = (mSelectedDates.first() == mSelectedDates.last() );
718 int counter = -1; 718 int counter = -1;
719 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { 719 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
720 ++counter; 720 ++counter;
721 QDate date = *dit; 721 QDate date = *dit;
722 // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); 722 // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels);
723 if ( ! appendLabels ) { 723 if ( ! appendLabels ) {
724 dayLabel = mDayLabelsList.next(); 724 dayLabel = mDayLabelsList.next();
725 if ( !dayLabel ) 725 if ( !dayLabel )
726 appendLabels = true; 726 appendLabels = true;
727 } 727 }
728 if ( appendLabels ) { 728 if ( appendLabels ) {
729 dayLabel = getNewDaylabel(); 729 dayLabel = getNewDaylabel();
730 } 730 }
731 dayLabel->setMinimumWidth( 1 ); 731 dayLabel->setMinimumWidth( 1 );
732 dayLabel->setMaximumWidth( 10240 ); 732 dayLabel->setMaximumWidth( 10240 );
733 dayLabel->setFont( dlf ); 733 dayLabel->setFont( dlf );
734 dayLabel->show(); 734 dayLabel->show();
735 dayLabel->setNum( counter ); 735 dayLabel->setNum( counter );
736 QString str; 736 QString str;
737 int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); 737 int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date);
738 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); 738 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true );
739 switch ( maxLen ) { 739 switch ( maxLen ) {
740 case 2: 740 case 2:
741 str = QString::number( date.day() ); 741 str = QString::number( date.day() );
742 break; 742 break;
743 743
744 case 3: 744 case 3:
745 str = dayName.left( 1 ) +QString::number( date.day()); 745 str = dayName.left( 1 ) +QString::number( date.day());
746 746
747 break; 747 break;
748 case 4: 748 case 4:
749 str = dayName.left( 1 ) + " " +QString::number( date.day()); 749 str = dayName.left( 1 ) + " " +QString::number( date.day());
750 750
751 break; 751 break;
752 case 5: 752 case 5:
753 str = dayName.left( 2 ) + " " +QString::number( date.day()); 753 str = dayName.left( 2 ) + " " +QString::number( date.day());
754 754
755 break; 755 break;
756 case 6: 756 case 6:
757 str = dayName.left( 3 ) + " " +QString::number( date.day()); 757 str = dayName.left( 3 ) + " " +QString::number( date.day());
758 break; 758 break;
759 759
760 default: 760 default:
761 break; 761 break;
762 } 762 }
763 if ( oneday ) { 763 if ( oneday ) {
764 QString addString; 764 QString addString;
765 if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) 765 if ( mSelectedDates.first() == QDateTime::currentDateTime().date() )
766 addString = i18n("Today"); 766 addString = i18n("Today");
767 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) 767 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) )
768 addString = i18n("Tomorrow"); 768 addString = i18n("Tomorrow");
769 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) 769 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) )
770 addString = i18n("Yesterday"); 770 addString = i18n("Yesterday");
771 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) 771 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) )
772 addString = i18n("Day before yesterday"); 772 addString = i18n("Day before yesterday");
773 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) 773 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) )
774 addString = i18n("Day after tomorrow"); 774 addString = i18n("Day after tomorrow");
775 if ( !addString.isEmpty() ) { 775 if ( !addString.isEmpty() ) {
776 str = addString+", " + str; 776 str = addString+", " + str;
777 } else { 777 } else {
778 str = KGlobal::locale()->formatDate( date, KOPrefs::instance()->mShortDateInViewer); 778 str = KGlobal::locale()->formatDate( date, KOPrefs::instance()->mShortDateInViewer);
779 } 779 }
780 } 780 }
781 dayLabel->setText(str); 781 dayLabel->setText(str);
782 //dayLabel->setAlignment(QLabel::AlignHCenter); 782 //dayLabel->setAlignment(QLabel::AlignHCenter);
783 if (date == QDate::currentDate()) { 783 if (date == QDate::currentDate()) {
784 QFont bFont = dlf; 784 QFont bFont = dlf;
785 bFont.setBold( true ); 785 bFont.setBold( true );
786 dayLabel->setFont(bFont); 786 dayLabel->setFont(bFont);
787 } 787 }
788 //dayLayout->addWidget(dayLabel); 788 //dayLayout->addWidget(dayLabel);
789 789
790#ifndef KORG_NOPLUGINS 790#ifndef KORG_NOPLUGINS
791 CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); 791 CalendarDecoration::List cds = KOCore::self()->calendarDecorations();
792 CalendarDecoration *it; 792 CalendarDecoration *it;
793 for(it = cds.first(); it; it = cds.next()) { 793 for(it = cds.first(); it; it = cds.next()) {
794 QString text = it->shortText( date ); 794 QString text = it->shortText( date );
795 if ( !text.isEmpty() ) { 795 if ( !text.isEmpty() ) {
796 QLabel *label = new QLabel(text,mDayLabels); 796 QLabel *label = new QLabel(text,mDayLabels);
797 label->setAlignment(AlignCenter); 797 label->setAlignment(AlignCenter);
798 dayLayout->addWidget(label); 798 dayLayout->addWidget(label);
799 } 799 }
800 } 800 }
801 801
802 for(it = cds.first(); it; it = cds.next()) { 802 for(it = cds.first(); it; it = cds.next()) {
803 QWidget *wid = it->smallWidget(mDayLabels,date); 803 QWidget *wid = it->smallWidget(mDayLabels,date);
804 if ( wid ) { 804 if ( wid ) {
805 // wid->setHeight(20); 805 // wid->setHeight(20);
806 dayLayout->addWidget(wid); 806 dayLayout->addWidget(wid);
807 } 807 }
808 } 808 }
809#endif 809#endif
810 } 810 }
811 if ( ! appendLabels ) { 811 if ( ! appendLabels ) {
812 dayLabel = mDayLabelsList.next(); 812 dayLabel = mDayLabelsList.next();
813 if ( !dayLabel ) 813 if ( !dayLabel )
814 appendLabels = true; 814 appendLabels = true;
815 } 815 }
816 if ( appendLabels ) { 816 if ( appendLabels ) {
817 dayLabel = getNewDaylabel(); 817 dayLabel = getNewDaylabel();
818 } 818 }
819 //dayLabel->hide();//test only 819 //dayLabel->hide();//test only
820 820
821 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; 821 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ;
822 if ( offset < 0 ) offset = 0; 822 if ( offset < 0 ) offset = 0;
823 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); 823 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 );
824 dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); 824 dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) );
825 dayLabel->setFont( dlf ); 825 dayLabel->setFont( dlf );
826 dayLabel->show(); 826 dayLabel->show();
827 dayLabel->setNum( -2 ); 827 dayLabel->setNum( -2 );
828 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); 828 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset );
829 //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); 829 //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2);
830 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); 830 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2);
831 if ( !appendLabels ) { 831 if ( !appendLabels ) {
832 dayLabel = mDayLabelsList.next(); 832 dayLabel = mDayLabelsList.next();
833 while ( dayLabel ) { 833 while ( dayLabel ) {
834 //qDebug("!dayLabel %d",dayLabel ); 834 //qDebug("!dayLabel %d",dayLabel );
835 dayLabel->hide(); 835 dayLabel->hide();
836 dayLabel = mDayLabelsList.next(); 836 dayLabel = mDayLabelsList.next();
837 } 837 }
838 } 838 }
839 //mDayLabelsFrame->show(); 839
840 //mDayLabels->show(); 840 mDayLabelsFrame->setFixedHeight( newHight + 4 );
841 //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight);
842 //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight );
843 mDayLabelsFrame->setFixedHeight( newHight );
844} 841}
845 842
846int KOAgendaView::maxDatesHint() 843int KOAgendaView::maxDatesHint()
847{ 844{
848 // Not sure about the max number of events, so return 0 for now. 845 // Not sure about the max number of events, so return 0 for now.
849 return 0; 846 return 0;
850} 847}
851 848
852int KOAgendaView::currentDateCount() 849int KOAgendaView::currentDateCount()
853{ 850{
854 return mSelectedDates.count(); 851 return mSelectedDates.count();
855} 852}
856 853
857QPtrList<Incidence> KOAgendaView::selectedIncidences() 854QPtrList<Incidence> KOAgendaView::selectedIncidences()
858{ 855{
859 QPtrList<Incidence> selected; 856 QPtrList<Incidence> selected;
860 Incidence *incidence; 857 Incidence *incidence;
861 858
862 incidence = mAgenda->selectedIncidence(); 859 incidence = mAgenda->selectedIncidence();
863 if (incidence) selected.append(incidence); 860 if (incidence) selected.append(incidence);
864 861
865 incidence = mAllDayAgenda->selectedIncidence(); 862 incidence = mAllDayAgenda->selectedIncidence();
866 if (incidence) selected.append(incidence); 863 if (incidence) selected.append(incidence);
867 864
868 return selected; 865 return selected;
869} 866}
870 867
871DateList KOAgendaView::selectedDates() 868DateList KOAgendaView::selectedDates()
872{ 869{
873 DateList selected; 870 DateList selected;
874 QDate qd; 871 QDate qd;
875 872
876 qd = mAgenda->selectedIncidenceDate(); 873 qd = mAgenda->selectedIncidenceDate();
877 if (qd.isValid()) selected.append(qd); 874 if (qd.isValid()) selected.append(qd);
878 875
879 qd = mAllDayAgenda->selectedIncidenceDate(); 876 qd = mAllDayAgenda->selectedIncidenceDate();
880 if (qd.isValid()) selected.append(qd); 877 if (qd.isValid()) selected.append(qd);
881 878
882 return selected; 879 return selected;
883} 880}
884 881
885 882
886void KOAgendaView::updateView() 883void KOAgendaView::updateView()
887{ 884{
888 if ( mBlockUpdating ) 885 if ( mBlockUpdating )
889 return; 886 return;
890 // kdDebug() << "KOAgendaView::updateView()" << endl; 887 // kdDebug() << "KOAgendaView::updateView()" << endl;
891 fillAgenda(); 888 fillAgenda();
892 889
893} 890}
894 891
895 892
896/* 893/*
897 Update configuration settings for the agenda view. This method is not 894 Update configuration settings for the agenda view. This method is not
898 complete. 895 complete.
899*/ 896*/
900void KOAgendaView::updateConfig() 897void KOAgendaView::updateConfig()
901{ 898{
902 if ( mBlockUpdating ) 899 if ( mBlockUpdating )
903 return; 900 return;
904 if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { 901 if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) {
905 int old = KOPrefs::instance()->mHourSize; 902 int old = KOPrefs::instance()->mHourSize;
906 KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; 903 KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1;
907 qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); 904 qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize );
908 } 905 }
909 906
910 907
911 // update config for children 908 // update config for children
912 mTimeLabels->updateConfig(); 909 mTimeLabels->updateConfig();
913 mAgenda->storePosition(); 910 mAgenda->storePosition();
914 mAgenda->updateConfig(); 911 mAgenda->updateConfig();
915 mAllDayAgenda->updateConfig(); 912 mAllDayAgenda->updateConfig();
916 // widget synchronization 913 // widget synchronization
917 //TODO: find a better way, maybe signal/slot 914 //TODO: find a better way, maybe signal/slot
918 mTimeLabels->positionChanged(); 915 mTimeLabels->positionChanged();
919 916
920 // for some reason, this needs to be called explicitly 917 // for some reason, this needs to be called explicitly
921 mTimeLabels->repaint(); 918 mTimeLabels->repaint();
922 919
923 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 920 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
924 921
925 // ToolTips displaying summary of events 922 // ToolTips displaying summary of events
926 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() 923 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
927 ->mEnableToolTips); 924 ->mEnableToolTips);
928 925
929 //setHolidayMasks(); 926 //setHolidayMasks();
930 927
931 //createDayLabels(); called by via updateView(); 928 //createDayLabels(); called by via updateView();
932 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); 929 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth());
933 updateView(); 930 updateView();
934 mAgenda->restorePosition(); 931 mAgenda->restorePosition();
935} 932}
936 933
937 934
938void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) 935void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
939{ 936{
940 // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; 937 // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl;
941 //qDebug("KOAgendaView::updateEventDates "); 938 //qDebug("KOAgendaView::updateEventDates ");
942 QDateTime startDt,endDt; 939 QDateTime startDt,endDt;
943 QDate startDate; 940 QDate startDate;
944 int lenInSecs; 941 int lenInSecs;
945 // if ( type == KOAgenda::RESIZETOP ) 942 // if ( type == KOAgenda::RESIZETOP )
946 // qDebug("RESIZETOP "); 943 // qDebug("RESIZETOP ");
947 // if ( type == KOAgenda::RESIZEBOTTOM ) 944 // if ( type == KOAgenda::RESIZEBOTTOM )
948 // qDebug("RESIZEBOTTOM "); 945 // qDebug("RESIZEBOTTOM ");
949 // if ( type == KOAgenda::MOVE ) 946 // if ( type == KOAgenda::MOVE )
950 // qDebug("MOVE "); 947 // qDebug("MOVE ");
951 if ( item->incidence()->type() == "Event" ) { 948 if ( item->incidence()->type() == "Event" ) {
952 startDt =item->incidence()->dtStart(); 949 startDt =item->incidence()->dtStart();
953 endDt = item->incidence()->dtEnd(); 950 endDt = item->incidence()->dtEnd();
954 lenInSecs = startDt.secsTo( endDt ); 951 lenInSecs = startDt.secsTo( endDt );
955 } 952 }
956 953
957 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); 954 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED );
958 955
959 if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { 956 if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) {
960 startDate = mSelectedDates[item->mLastMoveXPos]; 957 startDate = mSelectedDates[item->mLastMoveXPos];
961 } else { 958 } else {
962 if (item->cellX() < 0) { 959 if (item->cellX() < 0) {
963 startDate = (mSelectedDates.first()).addDays(item->cellX()); 960 startDate = (mSelectedDates.first()).addDays(item->cellX());
964 } else { 961 } else {
965 startDate = mSelectedDates[item->cellX()]; 962 startDate = mSelectedDates[item->cellX()];
966 } 963 }
967 } 964 }
968 startDt.setDate(startDate); 965 startDt.setDate(startDate);
969 966
970 if (item->incidence()->doesFloat()) { 967 if (item->incidence()->doesFloat()) {
971 endDt.setDate(startDate.addDays(item->cellWidth() - 1)); 968 endDt.setDate(startDate.addDays(item->cellWidth() - 1));
972 } else { 969 } else {
973 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) 970 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE )
974 startDt.setTime(mAgenda->gyToTime(item->cellYTop())); 971 startDt.setTime(mAgenda->gyToTime(item->cellYTop()));
975 if ( item->incidence()->type() == "Event" ) { 972 if ( item->incidence()->type() == "Event" ) {
976 if ( type == KOAgenda::MOVE ) { 973 if ( type == KOAgenda::MOVE ) {
977 endDt = startDt.addSecs(lenInSecs); 974 endDt = startDt.addSecs(lenInSecs);
978 975
979 } else if ( type == KOAgenda::RESIZEBOTTOM ) { 976 } else if ( type == KOAgenda::RESIZEBOTTOM ) {
980 if (item->lastMultiItem()) { 977 if (item->lastMultiItem()) {
981 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 978 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
982 endDt.setDate(startDate. 979 endDt.setDate(startDate.
983 addDays(item->lastMultiItem()->cellX() - item->cellX())); 980 addDays(item->lastMultiItem()->cellX() - item->cellX()));
984 } else { 981 } else {
985 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 982 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
986 endDt.setDate(startDate); 983 endDt.setDate(startDate);
987 } 984 }
988 } 985 }
989 } else { 986 } else {
990 // todo 987 // todo
991 if (item->lastMultiItem()) { 988 if (item->lastMultiItem()) {
992 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 989 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
993 endDt.setDate(startDate. 990 endDt.setDate(startDate.
994 addDays(item->lastMultiItem()->cellX() - item->cellX())); 991 addDays(item->lastMultiItem()->cellX() - item->cellX()));
995 } else { 992 } else {
996 //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); 993 //qDebug("tem->cellYBottom() %d",item->cellYBottom() );
997 if ( item->cellYBottom() > 0 ) 994 if ( item->cellYBottom() > 0 )
998 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 995 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
999 else 996 else
1000 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); 997 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time());
1001 endDt.setDate(startDate); 998 endDt.setDate(startDate);
1002 } 999 }
1003 } 1000 }
1004 } 1001 }
1005 if ( item->incidence()->type() == "Event" ) { 1002 if ( item->incidence()->type() == "Event" ) {
1006 item->incidence()->setDtStart(startDt); 1003 item->incidence()->setDtStart(startDt);
1007 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); 1004 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt);
1008 } else if ( item->incidence()->type() == "Todo" ) { 1005 } else if ( item->incidence()->type() == "Todo" ) {
1009 Todo* to = static_cast<Todo*>(item->incidence()); 1006 Todo* to = static_cast<Todo*>(item->incidence());
1010 1007
1011 to->setDtDue(endDt); 1008 to->setDtDue(endDt);
1012 if ( to->hasStartDate() ) { 1009 if ( to->hasStartDate() ) {
1013 if (to->dtStart() >= to->dtDue() ) 1010 if (to->dtStart() >= to->dtDue() )
1014 to->setDtStart(to->dtDue().addDays( -2 )); 1011 to->setDtStart(to->dtDue().addDays( -2 ));
1015 } 1012 }
1016 1013
1017 } 1014 }
1018 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); 1015 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() );
1019 item->incidence()->setRevision(item->incidence()->revision()+1); 1016 item->incidence()->setRevision(item->incidence()->revision()+1);
1020 item->setItemDate(startDt.date()); 1017 item->setItemDate(startDt.date());
1021 //item->updateItem(); 1018 //item->updateItem();
1022 if ( item->incidence()->type() == "Todo" ) { 1019 if ( item->incidence()->type() == "Todo" ) {
1023 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); 1020 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED );
1024 1021
1025 } 1022 }
1026 else 1023 else
1027 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); 1024 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED);
1028 item->updateItem(); 1025 item->updateItem();
1029} 1026}
1030 1027
1031void KOAgendaView::showDates( const QDate &start, const QDate &end ) 1028void KOAgendaView::showDates( const QDate &start, const QDate &end )
1032{ 1029{
1033 // kdDebug() << "KOAgendaView::selectDates" << endl; 1030 // kdDebug() << "KOAgendaView::selectDates" << endl;
1034 1031
1035 mSelectedDates.clear(); 1032 mSelectedDates.clear();
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 7a4275b..ca0d542 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1534,386 +1534,390 @@ void MainWindow::importQtopia()
1534 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1534 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1535#endif 1535#endif
1536 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1536 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1537 i18n("Import!"), i18n("Cancel"), 0, 1537 i18n("Import!"), i18n("Cancel"), 0,
1538 0, 1 ); 1538 0, 1 );
1539 if ( result == 0 ) { 1539 if ( result == 0 ) {
1540#ifndef DESKTOP_VERSION 1540#ifndef DESKTOP_VERSION
1541 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1541 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1542 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1542 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1543 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1543 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1544#else 1544#else
1545 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1545 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1546 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1546 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1547 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1547 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1548#endif 1548#endif
1549 mView->importQtopia( categories, datebook, todolist ); 1549 mView->importQtopia( categories, datebook, todolist );
1550 } 1550 }
1551#if 0 1551#if 0
1552 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1552 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1553 i18n("Not supported \non desktop!\n"), 1553 i18n("Not supported \non desktop!\n"),
1554 i18n("Ok"), i18n("Cancel"), 0, 1554 i18n("Ok"), i18n("Cancel"), 0,
1555 0, 1 ); 1555 0, 1 );
1556 1556
1557#endif 1557#endif
1558} 1558}
1559 1559
1560void MainWindow::saveOnClose() 1560void MainWindow::saveOnClose()
1561{ 1561{
1562 KOPrefs *p = KOPrefs::instance(); 1562 KOPrefs *p = KOPrefs::instance();
1563 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1563 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1564 p->mToolBarUp = iconToolBar->x() > width()/2 || 1564 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1565 iconToolBar->y() > height()/2; 1565 iconToolBar->y() > height()/2;
1566 mView->writeSettings(); 1566 mView->writeSettings();
1567 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1567 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1568 save(); 1568 save();
1569} 1569}
1570void MainWindow::slotModifiedChanged( bool changed ) 1570void MainWindow::slotModifiedChanged( bool changed )
1571{ 1571{
1572 if ( mBlockAtStartup ) 1572 if ( mBlockAtStartup )
1573 return; 1573 return;
1574 1574
1575 int msec; 1575 int msec;
1576 // we store the changes after 1 minute, 1576 // we store the changes after 1 minute,
1577 // and for safety reasons after 10 minutes again 1577 // and for safety reasons after 10 minutes again
1578 if ( !mSyncManager->blockSave() ) 1578 if ( !mSyncManager->blockSave() )
1579 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1579 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1580 else 1580 else
1581 msec = 1000 * 600; 1581 msec = 1000 * 600;
1582 mSaveTimer.start( msec, true ); // 1 minute 1582 mSaveTimer.start( msec, true ); // 1 minute
1583 qDebug("KO: Saving File in %d secs!", msec/1000); 1583 qDebug("KO: Saving File in %d secs!", msec/1000);
1584 mCalendarModifiedFlag = true; 1584 mCalendarModifiedFlag = true;
1585} 1585}
1586void MainWindow::saveStopTimer() 1586void MainWindow::saveStopTimer()
1587{ 1587{
1588 mSaveTimer.stop(); 1588 mSaveTimer.stop();
1589 if (mSaveTimer.isActive() ) 1589 if (mSaveTimer.isActive() )
1590 qDebug("ti active "); 1590 qDebug("ti active ");
1591 else 1591 else
1592 qDebug("KO: Save timer stopped"); 1592 qDebug("KO: Save timer stopped");
1593} 1593}
1594void MainWindow::save() 1594void MainWindow::save()
1595{ 1595{
1596 if ( !mCalendarModifiedFlag ) { 1596 if ( !mCalendarModifiedFlag ) {
1597 qDebug("KO: Calendar not modified. Nothing saved."); 1597 qDebug("KO: Calendar not modified. Nothing saved.");
1598 return; 1598 return;
1599 } 1599 }
1600 if ( mSyncManager->blockSave() ) 1600 if ( mSyncManager->blockSave() )
1601 return; 1601 return;
1602 mSyncManager->setBlockSave(true); 1602 mSyncManager->setBlockSave(true);
1603 if ( mView->checkFileVersion( defaultFileName()) ) { 1603 if ( mView->checkFileVersion( defaultFileName()) ) {
1604 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1604 QTime neededSaveTime = QDateTime::currentDateTime().time();
1605 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1605 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1606 qDebug("KO: Start saving data to file!"); 1606 qDebug("KO: Start saving data to file!");
1607 mView->saveCalendar( defaultFileName() ); 1607 mView->saveCalendar( defaultFileName() );
1608 mCalendarModifiedFlag = false; 1608 mCalendarModifiedFlag = false;
1609 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1609 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1610 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1610 qDebug("KO: Needed %d ms for saving.",msNeeded );
1611 QString savemes; 1611 QString savemes;
1612 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1612 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1613 setCaption(savemes); 1613 setCaption(savemes);
1614 } else 1614 } else
1615 setCaption(i18n("Saving cancelled!")); 1615 setCaption(i18n("Saving cancelled!"));
1616 mSyncManager->setBlockSave( false ); 1616 mSyncManager->setBlockSave( false );
1617} 1617}
1618 1618
1619void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1619void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1620{ 1620{
1621 if ( !e->isAutoRepeat() ) { 1621 if ( !e->isAutoRepeat() ) {
1622 mFlagKeyPressed = false; 1622 mFlagKeyPressed = false;
1623 } 1623 }
1624} 1624}
1625void MainWindow::keyPressEvent ( QKeyEvent * e ) 1625void MainWindow::keyPressEvent ( QKeyEvent * e )
1626{ 1626{
1627 qApp->processEvents(); 1627 qApp->processEvents();
1628 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1628 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1629 e->ignore(); 1629 e->ignore();
1630 // qDebug(" ignore %d",e->isAutoRepeat() ); 1630 // qDebug(" ignore %d",e->isAutoRepeat() );
1631 return; 1631 return;
1632 } 1632 }
1633 if (! e->isAutoRepeat() ) 1633 if (! e->isAutoRepeat() )
1634 mFlagKeyPressed = true; 1634 mFlagKeyPressed = true;
1635 KOPrefs *p = KOPrefs::instance(); 1635 KOPrefs *p = KOPrefs::instance();
1636 bool showSelectedDates = false; 1636 bool showSelectedDates = false;
1637 int size; 1637 int size;
1638 int pro = 0; 1638 int pro = 0;
1639 //qDebug("MainWindow::keyPressEvent "); 1639 //qDebug("MainWindow::keyPressEvent ");
1640 switch ( e->key() ) { 1640 switch ( e->key() ) {
1641 case Qt::Key_Right: 1641 case Qt::Key_Right:
1642 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1642 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1643 mView->goNextMonth(); 1643 mView->goNextMonth();
1644 else 1644 else
1645 mView->goNext(); 1645 mView->goNext();
1646 showSelectedDates = true; 1646 showSelectedDates = true;
1647 break; 1647 break;
1648 case Qt::Key_Left: 1648 case Qt::Key_Left:
1649 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1649 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1650 mView->goPreviousMonth(); 1650 mView->goPreviousMonth();
1651 else 1651 else
1652 mView->goPrevious(); 1652 mView->goPrevious();
1653 showSelectedDates = true; 1653 showSelectedDates = true;
1654 break; 1654 break;
1655 case Qt::Key_Down: 1655 case Qt::Key_Down:
1656 mView->viewManager()->agendaView()->scrollOneHourDown(); 1656 mView->viewManager()->agendaView()->scrollOneHourDown();
1657 break; 1657 break;
1658 case Qt::Key_Up: 1658 case Qt::Key_Up:
1659 mView->viewManager()->agendaView()->scrollOneHourUp(); 1659 mView->viewManager()->agendaView()->scrollOneHourUp();
1660 break; 1660 break;
1661 case Qt::Key_K: 1661 case Qt::Key_K:
1662 mView->viewManager()->showMonthViewWeek(); 1662 mView->viewManager()->showMonthViewWeek();
1663 break; 1663 break;
1664 case Qt::Key_I: 1664 case Qt::Key_I:
1665 mView->showIncidence(); 1665 mView->showIncidence();
1666 break; 1666 break;
1667 case Qt::Key_Delete: 1667 case Qt::Key_Delete:
1668 case Qt::Key_Backspace: 1668 case Qt::Key_Backspace:
1669 mView->deleteIncidence(); 1669 mView->deleteIncidence();
1670 break; 1670 break;
1671 case Qt::Key_D: 1671 case Qt::Key_D:
1672 mView->viewManager()->showDayView(); 1672 mView->viewManager()->showDayView();
1673 showSelectedDates = true; 1673 showSelectedDates = true;
1674 break; 1674 break;
1675 case Qt::Key_O: 1675 case Qt::Key_O:
1676 mView->toggleFilerEnabled( ); 1676 mView->toggleFilerEnabled( );
1677 break; 1677 break;
1678 case Qt::Key_0: 1678 case Qt::Key_0:
1679 case Qt::Key_1: 1679 case Qt::Key_1:
1680 case Qt::Key_2: 1680 case Qt::Key_2:
1681 case Qt::Key_3: 1681 case Qt::Key_3:
1682 case Qt::Key_4: 1682 case Qt::Key_4:
1683 case Qt::Key_5: 1683 case Qt::Key_5:
1684 case Qt::Key_6: 1684 case Qt::Key_6:
1685 case Qt::Key_7: 1685 case Qt::Key_7:
1686 case Qt::Key_8: 1686 case Qt::Key_8:
1687 case Qt::Key_9: 1687 case Qt::Key_9:
1688 pro = e->key()-48; 1688 pro = e->key()-48;
1689 if ( pro == 0 ) 1689 if ( pro == 0 )
1690 pro = 10; 1690 pro = 10;
1691 if ( e->state() == Qt::ControlButton) 1691 if ( e->state() == Qt::ControlButton)
1692 pro += 10; 1692 pro += 10;
1693 break; 1693 break;
1694 case Qt::Key_M: 1694 case Qt::Key_M:
1695 mView->viewManager()->showMonthView(); 1695 mView->viewManager()->showMonthView();
1696 showSelectedDates = true; 1696 showSelectedDates = true;
1697 break; 1697 break;
1698 case Qt::Key_Insert: 1698 case Qt::Key_Insert:
1699 mView->newEvent(); 1699 mView->newEvent();
1700 break; 1700 break;
1701 case Qt::Key_S : 1701 case Qt::Key_S :
1702 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1702 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1703 mView->newSubTodo(); 1703 mView->newSubTodo();
1704 else 1704 else
1705 mView->dialogManager()->showSearchDialog(); 1705 mView->dialogManager()->showSearchDialog();
1706 break; 1706 break;
1707 case Qt::Key_Y : 1707 case Qt::Key_Y :
1708 case Qt::Key_Z : 1708 case Qt::Key_Z :
1709 mView->viewManager()->showWorkWeekView(); 1709 mView->viewManager()->showWorkWeekView();
1710 showSelectedDates = true; 1710 showSelectedDates = true;
1711 break; 1711 break;
1712 case Qt::Key_U : 1712 case Qt::Key_U :
1713 mView->viewManager()->showWeekView(); 1713 mView->viewManager()->showWeekView();
1714 showSelectedDates = true; 1714 showSelectedDates = true;
1715 break; 1715 break;
1716 case Qt::Key_H : 1716 case Qt::Key_H :
1717 keyBindings(); 1717 keyBindings();
1718 break; 1718 break;
1719 case Qt::Key_W: 1719 case Qt::Key_W:
1720 mView->viewManager()->showWhatsNextView(); 1720 mView->viewManager()->showWhatsNextView();
1721 break; 1721 break;
1722 case Qt::Key_L: 1722 case Qt::Key_L:
1723 mView->viewManager()->showListView(); 1723 mView->viewManager()->showListView();
1724 break; 1724 break;
1725 case Qt::Key_N: 1725 case Qt::Key_N:
1726 mView->viewManager()->showNextXView(); 1726 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1727 showSelectedDates = true; 1727 mView->viewManager()->showNextView();
1728 else {
1729 mView->viewManager()->showNextXView();
1730 showSelectedDates = true;
1731 }
1728 break; 1732 break;
1729 case Qt::Key_V: 1733 case Qt::Key_V:
1730 mView->viewManager()->showTodoView(); 1734 mView->viewManager()->showTodoView();
1731 break; 1735 break;
1732 case Qt::Key_C: 1736 case Qt::Key_C:
1733 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1737 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1734 break; 1738 break;
1735 case Qt::Key_P: 1739 case Qt::Key_P:
1736 mView->showDatePicker( ); 1740 mView->showDatePicker( );
1737 break; 1741 break;
1738 case Qt::Key_F: 1742 case Qt::Key_F:
1739 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1743 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1740 mView->editFilters(); 1744 mView->editFilters();
1741 else 1745 else
1742 mView->toggleFilter(); 1746 mView->toggleFilter();
1743 break; 1747 break;
1744 case Qt::Key_X: 1748 case Qt::Key_X:
1745 mView->toggleDateNavigatorWidget(); 1749 mView->toggleDateNavigatorWidget();
1746 break; 1750 break;
1747 case Qt::Key_Space: 1751 case Qt::Key_Space:
1748 mView->toggleExpand(); 1752 mView->toggleExpand();
1749 break; 1753 break;
1750 case Qt::Key_A: 1754 case Qt::Key_A:
1751 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 1755 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
1752 mView->showNextAlarms(); 1756 mView->showNextAlarms();
1753 else 1757 else
1754 mView->toggleAllDaySize(); 1758 mView->toggleAllDaySize();
1755 break; 1759 break;
1756 case Qt::Key_T: 1760 case Qt::Key_T:
1757 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1761 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1758 mView->newTodo(); 1762 mView->newTodo();
1759 else { 1763 else {
1760 mView->goToday(); 1764 mView->goToday();
1761 showSelectedDates = true; 1765 showSelectedDates = true;
1762 } 1766 }
1763 break; 1767 break;
1764 case Qt::Key_J: 1768 case Qt::Key_J:
1765 mView->viewManager()->showJournalView(); 1769 mView->viewManager()->showJournalView();
1766 break; 1770 break;
1767 case Qt::Key_B: 1771 case Qt::Key_B:
1768 mView->editIncidenceDescription();; 1772 mView->editIncidenceDescription();;
1769 break; 1773 break;
1770 // case Qt::Key_Return: 1774 // case Qt::Key_Return:
1771 case Qt::Key_E: 1775 case Qt::Key_E:
1772 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1776 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1773 mView->newEvent(); 1777 mView->newEvent();
1774 else 1778 else
1775 mView->editIncidence(); 1779 mView->editIncidence();
1776 break; 1780 break;
1777 case Qt::Key_Plus: 1781 case Qt::Key_Plus:
1778 size = p->mHourSize +2; 1782 size = p->mHourSize +2;
1779 if ( size <= 22 ) 1783 if ( size <= 22 )
1780 configureAgenda( size ); 1784 configureAgenda( size );
1781 break; 1785 break;
1782 case Qt::Key_Minus: 1786 case Qt::Key_Minus:
1783 size = p->mHourSize - 2; 1787 size = p->mHourSize - 2;
1784 if ( size >= 4 ) 1788 if ( size >= 4 )
1785 configureAgenda( size ); 1789 configureAgenda( size );
1786 break; 1790 break;
1787 1791
1788 1792
1789 default: 1793 default:
1790 e->ignore(); 1794 e->ignore();
1791 } 1795 }
1792 if ( pro > 0 ) { 1796 if ( pro > 0 ) {
1793 mView->selectFilter( pro-1 ); 1797 mView->selectFilter( pro-1 );
1794 } 1798 }
1795 if ( showSelectedDates ) { 1799 if ( showSelectedDates ) {
1796 ;// setCaptionToDates(); 1800 ;// setCaptionToDates();
1797 } 1801 }
1798 1802
1799} 1803}
1800 1804
1801void MainWindow::fillFilterMenu() 1805void MainWindow::fillFilterMenu()
1802{ 1806{
1803 selectFilterMenu->clear(); 1807 selectFilterMenu->clear();
1804 bool disable = false; 1808 bool disable = false;
1805 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1809 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1806 selectFilterMenu->insertSeparator(); 1810 selectFilterMenu->insertSeparator();
1807 if ( mView->filterView()->filtersEnabled() ) { 1811 if ( mView->filterView()->filtersEnabled() ) {
1808 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1812 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1809 } 1813 }
1810 else { 1814 else {
1811 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); 1815 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1812 disable = true; 1816 disable = true;
1813 } 1817 }
1814 selectFilterMenu->insertSeparator(); 1818 selectFilterMenu->insertSeparator();
1815 QPtrList<CalFilter> fili = mView->filters(); 1819 QPtrList<CalFilter> fili = mView->filters();
1816 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1820 CalFilter *curfilter = mView->filterView()->selectedFilter();
1817 CalFilter *filter = fili.first(); 1821 CalFilter *filter = fili.first();
1818 int iii = 2; 1822 int iii = 2;
1819 while(filter) { 1823 while(filter) {
1820 selectFilterMenu->insertItem( filter->name(), iii ); 1824 selectFilterMenu->insertItem( filter->name(), iii );
1821 if ( filter == curfilter) 1825 if ( filter == curfilter)
1822 selectFilterMenu->setItemChecked( iii, true ); 1826 selectFilterMenu->setItemChecked( iii, true );
1823 if ( disable ) 1827 if ( disable )
1824 selectFilterMenu->setItemEnabled( iii, false ); 1828 selectFilterMenu->setItemEnabled( iii, false );
1825 filter = fili.next(); 1829 filter = fili.next();
1826 ++iii; 1830 ++iii;
1827 } 1831 }
1828} 1832}
1829void MainWindow::selectFilter( int fil ) 1833void MainWindow::selectFilter( int fil )
1830{ 1834{
1831 if ( fil == 0 ) { 1835 if ( fil == 0 ) {
1832 mView->editFilters( ); 1836 mView->editFilters( );
1833 } else if ( fil == 1 ){ 1837 } else if ( fil == 1 ){
1834 mView->toggleFilerEnabled( ); 1838 mView->toggleFilerEnabled( );
1835 } else { 1839 } else {
1836 mView->selectFilter( fil-2 ); 1840 mView->selectFilter( fil-2 );
1837 } 1841 }
1838} 1842}
1839void MainWindow::configureToolBar( int item ) 1843void MainWindow::configureToolBar( int item )
1840{ 1844{
1841 1845
1842 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1846 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1843 KOPrefs *p = KOPrefs::instance(); 1847 KOPrefs *p = KOPrefs::instance();
1844 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1848 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1845 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1849 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1846 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1850 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1847 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1851 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1848 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1852 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1849 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1853 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1850 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1854 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1851 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 1855 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
1852 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1856 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1853 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1857 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1854 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1858 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1855 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1859 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1856 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1860 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1857 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1861 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1858 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1862 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1859 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1863 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1860 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1864 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1861 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1865 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1862 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1866 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1863 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1867 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1864 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 1868 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
1865 // initActions(); 1869 // initActions();
1866} 1870}
1867void MainWindow::setCaption ( const QString & c ) 1871void MainWindow::setCaption ( const QString & c )
1868{ 1872{
1869 QString cap = c; 1873 QString cap = c;
1870 cap.replace( QRegExp("\n"), " " ); 1874 cap.replace( QRegExp("\n"), " " );
1871 cap = cap.stripWhiteSpace(); 1875 cap = cap.stripWhiteSpace();
1872 if ( cap.isEmpty() ) 1876 if ( cap.isEmpty() )
1873 cap = "KO/Pi"; 1877 cap = "KO/Pi";
1874 QWidget::setCaption( cap ); 1878 QWidget::setCaption( cap );
1875} 1879}
1876void MainWindow::setCaptionToDates() 1880void MainWindow::setCaptionToDates()
1877{ 1881{
1878 QString selDates; 1882 QString selDates;
1879 QDate date = mView->startDate(); 1883 QDate date = mView->startDate();
1880 if ( ! date.isValid() ) { 1884 if ( ! date.isValid() ) {
1881 setCaption(""); 1885 setCaption("");
1882 return; 1886 return;
1883 } 1887 }
1884 selDates = KGlobal::locale()->formatDate( date, true); 1888 selDates = KGlobal::locale()->formatDate( date, true);
1885 if (mView->startDate() < mView->endDate() ) 1889 if (mView->startDate() < mView->endDate() )
1886 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1890 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1887 else { 1891 else {
1888 QString addString; 1892 QString addString;
1889 if ( date == QDateTime::currentDateTime().date() ) 1893 if ( date == QDateTime::currentDateTime().date() )
1890 addString = i18n("Today"); 1894 addString = i18n("Today");
1891 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 1895 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
1892 addString = i18n("Tomorrow"); 1896 addString = i18n("Tomorrow");
1893 if ( !addString.isEmpty() ) 1897 if ( !addString.isEmpty() )
1894 selDates = addString+", "+selDates ; 1898 selDates = addString+", "+selDates ;
1895 } 1899 }
1896 setCaption( i18n("Dates: ") + selDates ); 1900 setCaption( i18n("Dates: ") + selDates );
1897 1901
1898} 1902}
1899void MainWindow::showConfigureAgenda( ) 1903void MainWindow::showConfigureAgenda( )
1900{ 1904{
1901 int iii; 1905 int iii;
1902 for ( iii = 1;iii<= 10 ;++iii ){ 1906 for ( iii = 1;iii<= 10 ;++iii ){
1903 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 1907 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
1904 } 1908 }
1905 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 1909 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
1906} 1910}
1907void MainWindow::configureAgenda( int item ) 1911void MainWindow::configureAgenda( int item )
1908{ 1912{
1909 if ( KOPrefs::instance()->mHourSize == item ) 1913 if ( KOPrefs::instance()->mHourSize == item )
1910 return; 1914 return;
1911 KOPrefs::instance()->mHourSize=item; 1915 KOPrefs::instance()->mHourSize=item;
1912 mView->viewManager()->agendaView()->updateConfig(); 1916 mView->viewManager()->agendaView()->updateConfig();
1913} 1917}
1914 1918
1915void MainWindow::saveCalendar() 1919void MainWindow::saveCalendar()
1916{ 1920{
1917 QString fn = KOPrefs::instance()->mLastSaveFile; 1921 QString fn = KOPrefs::instance()->mLastSaveFile;
1918 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1922 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1919 1923
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 52c298b..5c889c3 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -109,384 +109,385 @@ bool CalendarLocal::addAnniversaryNoDup( Event *event )
109 cat = i18n( "Birthday" ); 109 cat = i18n( "Birthday" );
110 } else { 110 } else {
111 qDebug("addAnniversaryNoDup called without fitting category! "); 111 qDebug("addAnniversaryNoDup called without fitting category! ");
112 return false; 112 return false;
113 } 113 }
114 Event * eve; 114 Event * eve;
115 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { 115 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
116 if ( !(eve->categories().contains( cat ) )) 116 if ( !(eve->categories().contains( cat ) ))
117 continue; 117 continue;
118 // now we have an event with fitting category 118 // now we have an event with fitting category
119 if ( eve->dtStart().date() != event->dtStart().date() ) 119 if ( eve->dtStart().date() != event->dtStart().date() )
120 continue; 120 continue;
121 // now we have an event with fitting category+date 121 // now we have an event with fitting category+date
122 if ( eve->summary() != event->summary() ) 122 if ( eve->summary() != event->summary() )
123 continue; 123 continue;
124 // now we have an event with fitting category+date+summary 124 // now we have an event with fitting category+date+summary
125 return false; 125 return false;
126 } 126 }
127 return addEvent( event ); 127 return addEvent( event );
128 128
129} 129}
130bool CalendarLocal::addEventNoDup( Event *event ) 130bool CalendarLocal::addEventNoDup( Event *event )
131{ 131{
132 Event * eve; 132 Event * eve;
133 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { 133 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
134 if ( *eve == *event ) { 134 if ( *eve == *event ) {
135 //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); 135 //qDebug("CalendarLocal::Duplicate event found! Not inserted! ");
136 return false; 136 return false;
137 } 137 }
138 } 138 }
139 return addEvent( event ); 139 return addEvent( event );
140} 140}
141 141
142bool CalendarLocal::addEvent( Event *event ) 142bool CalendarLocal::addEvent( Event *event )
143{ 143{
144 insertEvent( event ); 144 insertEvent( event );
145 145
146 event->registerObserver( this ); 146 event->registerObserver( this );
147 147
148 setModified( true ); 148 setModified( true );
149 149
150 return true; 150 return true;
151} 151}
152 152
153void CalendarLocal::deleteEvent( Event *event ) 153void CalendarLocal::deleteEvent( Event *event )
154{ 154{
155 if ( mUndoIncidence ) delete mUndoIncidence; 155 if ( mUndoIncidence ) delete mUndoIncidence;
156 mUndoIncidence = event->clone(); 156 mUndoIncidence = event->clone();
157 if ( mEventList.removeRef( event ) ) { 157 if ( mEventList.removeRef( event ) ) {
158 setModified( true ); 158 setModified( true );
159 } 159 }
160} 160}
161 161
162 162
163Event *CalendarLocal::event( const QString &uid ) 163Event *CalendarLocal::event( const QString &uid )
164{ 164{
165 165
166 Event *event; 166 Event *event;
167 167
168 for ( event = mEventList.first(); event; event = mEventList.next() ) { 168 for ( event = mEventList.first(); event; event = mEventList.next() ) {
169 if ( event->uid() == uid ) { 169 if ( event->uid() == uid ) {
170 return event; 170 return event;
171 } 171 }
172 } 172 }
173 173
174 return 0; 174 return 0;
175} 175}
176bool CalendarLocal::addTodoNoDup( Todo *todo ) 176bool CalendarLocal::addTodoNoDup( Todo *todo )
177{ 177{
178 Todo * eve; 178 Todo * eve;
179 for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { 179 for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) {
180 if ( *eve == *todo ) { 180 if ( *eve == *todo ) {
181 //qDebug("duplicate todo found! not inserted! "); 181 //qDebug("duplicate todo found! not inserted! ");
182 return false; 182 return false;
183 } 183 }
184 } 184 }
185 return addTodo( todo ); 185 return addTodo( todo );
186} 186}
187bool CalendarLocal::addTodo( Todo *todo ) 187bool CalendarLocal::addTodo( Todo *todo )
188{ 188{
189 mTodoList.append( todo ); 189 mTodoList.append( todo );
190 190
191 todo->registerObserver( this ); 191 todo->registerObserver( this );
192 192
193 // Set up subtask relations 193 // Set up subtask relations
194 setupRelations( todo ); 194 setupRelations( todo );
195 195
196 setModified( true ); 196 setModified( true );
197 197
198 return true; 198 return true;
199} 199}
200 200
201void CalendarLocal::deleteTodo( Todo *todo ) 201void CalendarLocal::deleteTodo( Todo *todo )
202{ 202{
203 // Handle orphaned children 203 // Handle orphaned children
204 if ( mUndoIncidence ) delete mUndoIncidence; 204 if ( mUndoIncidence ) delete mUndoIncidence;
205 removeRelations( todo ); 205 removeRelations( todo );
206 mUndoIncidence = todo->clone(); 206 mUndoIncidence = todo->clone();
207 207
208 if ( mTodoList.removeRef( todo ) ) { 208 if ( mTodoList.removeRef( todo ) ) {
209 setModified( true ); 209 setModified( true );
210 } 210 }
211} 211}
212 212
213QPtrList<Todo> CalendarLocal::rawTodos() 213QPtrList<Todo> CalendarLocal::rawTodos()
214{ 214{
215 return mTodoList; 215 return mTodoList;
216} 216}
217Todo *CalendarLocal::todo( QString syncProf, QString id ) 217Todo *CalendarLocal::todo( QString syncProf, QString id )
218{ 218{
219 Todo *todo; 219 Todo *todo;
220 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { 220 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
221 if ( todo->getID( syncProf ) == id ) return todo; 221 if ( todo->getID( syncProf ) == id ) return todo;
222 } 222 }
223 223
224 return 0; 224 return 0;
225} 225}
226void CalendarLocal::removeSyncInfo( QString syncProfile) 226void CalendarLocal::removeSyncInfo( QString syncProfile)
227{ 227{
228 QPtrList<Incidence> all = rawIncidences() ; 228 QPtrList<Incidence> all = rawIncidences() ;
229 Incidence *inc; 229 Incidence *inc;
230 for ( inc = all.first(); inc; inc = all.next() ) { 230 for ( inc = all.first(); inc; inc = all.next() ) {
231 inc->removeID( syncProfile ); 231 inc->removeID( syncProfile );
232 } 232 }
233 if ( syncProfile.isEmpty() ) { 233 if ( syncProfile.isEmpty() ) {
234 QPtrList<Event> el; 234 QPtrList<Event> el;
235 Event *todo; 235 Event *todo;
236 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 236 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
237 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) 237 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
238 el.append( todo ); 238 el.append( todo );
239 } 239 }
240 for ( todo = el.first(); todo; todo = el.next() ) { 240 for ( todo = el.first(); todo; todo = el.next() ) {
241 deleteIncidence ( todo ); 241 deleteIncidence ( todo );
242 } 242 }
243 } else { 243 } else {
244 Event *lse = event( "last-syncEvent-"+ syncProfile); 244 Event *lse = event( "last-syncEvent-"+ syncProfile);
245 if ( lse ) 245 if ( lse )
246 deleteIncidence ( lse ); 246 deleteIncidence ( lse );
247 } 247 }
248} 248}
249QPtrList<Event> CalendarLocal::getExternLastSyncEvents() 249QPtrList<Event> CalendarLocal::getExternLastSyncEvents()
250{ 250{
251 QPtrList<Event> el; 251 QPtrList<Event> el;
252 Event *todo; 252 Event *todo;
253 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 253 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
254 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) 254 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
255 if ( todo->summary().left(3) == "E: " ) 255 if ( todo->summary().left(3) == "E: " )
256 el.append( todo ); 256 el.append( todo );
257 } 257 }
258 258
259 return el; 259 return el;
260 260
261} 261}
262Event *CalendarLocal::event( QString syncProf, QString id ) 262Event *CalendarLocal::event( QString syncProf, QString id )
263{ 263{
264 Event *todo; 264 Event *todo;
265 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 265 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
266 if ( todo->getID( syncProf ) == id ) return todo; 266 if ( todo->getID( syncProf ) == id ) return todo;
267 } 267 }
268 268
269 return 0; 269 return 0;
270} 270}
271Todo *CalendarLocal::todo( const QString &uid ) 271Todo *CalendarLocal::todo( const QString &uid )
272{ 272{
273 Todo *todo; 273 Todo *todo;
274 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { 274 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
275 if ( todo->uid() == uid ) return todo; 275 if ( todo->uid() == uid ) return todo;
276 } 276 }
277 277
278 return 0; 278 return 0;
279} 279}
280QString CalendarLocal::nextSummary() const 280QString CalendarLocal::nextSummary() const
281{ 281{
282 return mNextSummary; 282 return mNextSummary;
283} 283}
284QDateTime CalendarLocal::nextAlarmEventDateTime() const 284QDateTime CalendarLocal::nextAlarmEventDateTime() const
285{ 285{
286 return mNextAlarmEventDateTime; 286 return mNextAlarmEventDateTime;
287} 287}
288void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) 288void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted)
289{ 289{
290 //mNextAlarmIncidence 290 //mNextAlarmIncidence
291 //mNextAlarmDateTime 291 //mNextAlarmDateTime
292 //return mNextSummary; 292 //return mNextSummary;
293 //return mNextAlarmEventDateTime; 293 //return mNextAlarmEventDateTime;
294 bool newNextAlarm = false; 294 bool newNextAlarm = false;
295 bool computeNextAlarm = false; 295 bool computeNextAlarm = false;
296 bool ok; 296 bool ok;
297 int offset; 297 int offset;
298 QDateTime nextA; 298 QDateTime nextA;
299 // QString nextSum; 299 // QString nextSum;
300 //QDateTime nextEvent; 300 //QDateTime nextEvent;
301 mNextAlarmEventDateTime = QDateTime();
301 if ( mNextAlarmIncidence == 0 || incidence == 0 ) { 302 if ( mNextAlarmIncidence == 0 || incidence == 0 ) {
302 computeNextAlarm = true; 303 computeNextAlarm = true;
303 } else { 304 } else {
304 if ( ! deleted ) { 305 if ( ! deleted ) {
305 nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ; 306 nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ;
306 if ( ok ) { 307 if ( ok ) {
307 if ( nextA < mNextAlarmDateTime ) { 308 if ( nextA < mNextAlarmDateTime ) {
308 deRegisterAlarm(); 309 deRegisterAlarm();
309 mNextAlarmDateTime = nextA; 310 mNextAlarmDateTime = nextA;
310 mNextSummary = incidence->summary(); 311 mNextSummary = incidence->summary();
311 mNextAlarmEventDateTime = nextA.addSecs(offset ) ; 312 mNextAlarmEventDateTime = nextA.addSecs(offset ) ;
312 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); 313 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime);
313 newNextAlarm = true; 314 newNextAlarm = true;
314 mNextAlarmIncidence = incidence; 315 mNextAlarmIncidence = incidence;
315 } else { 316 } else {
316 if ( incidence == mNextAlarmIncidence ) { 317 if ( incidence == mNextAlarmIncidence ) {
317 computeNextAlarm = true; 318 computeNextAlarm = true;
318 } 319 }
319 } 320 }
320 } else { 321 } else {
321 if ( mNextAlarmIncidence == incidence ) { 322 if ( mNextAlarmIncidence == incidence ) {
322 computeNextAlarm = true; 323 computeNextAlarm = true;
323 } 324 }
324 } 325 }
325 } else { // deleted 326 } else { // deleted
326 if ( incidence == mNextAlarmIncidence ) { 327 if ( incidence == mNextAlarmIncidence ) {
327 computeNextAlarm = true; 328 computeNextAlarm = true;
328 } 329 }
329 } 330 }
330 } 331 }
331 if ( computeNextAlarm ) { 332 if ( computeNextAlarm ) {
332 deRegisterAlarm(); 333 deRegisterAlarm();
333 nextA = nextAlarm( 1000 ); 334 nextA = nextAlarm( 1000 );
334 if (! mNextAlarmIncidence ) { 335 if (! mNextAlarmIncidence ) {
335 return; 336 return;
336 } 337 }
337 newNextAlarm = true; 338 newNextAlarm = true;
338 } 339 }
339 if ( newNextAlarm ) 340 if ( newNextAlarm )
340 registerAlarm(); 341 registerAlarm();
341} 342}
342QString CalendarLocal:: getAlarmNotification() 343QString CalendarLocal:: getAlarmNotification()
343{ 344{
344 QString ret; 345 QString ret;
345 // this should not happen 346 // this should not happen
346 if (! mNextAlarmIncidence ) 347 if (! mNextAlarmIncidence )
347 return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString; 348 return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString;
348 Alarm* alarm = mNextAlarmIncidence->alarms().first(); 349 Alarm* alarm = mNextAlarmIncidence->alarms().first();
349 if ( alarm->type() == Alarm::Procedure ) { 350 if ( alarm->type() == Alarm::Procedure ) {
350 ret = "proc_alarm" + alarm->programFile()+"+++"; 351 ret = "proc_alarm" + alarm->programFile()+"+++";
351 } else { 352 } else {
352 ret = "audio_alarm" +alarm->audioFile() +"+++"; 353 ret = "audio_alarm" +alarm->audioFile() +"+++";
353 } 354 }
354 ret += "cal_alarm"+ mNextSummary.left( 25 ); 355 ret += "cal_alarm"+ mNextSummary.left( 25 );
355 if ( mNextSummary.length() > 25 ) 356 if ( mNextSummary.length() > 25 )
356 ret += "\n" + mNextSummary.mid(25, 25 ); 357 ret += "\n" + mNextSummary.mid(25, 25 );
357 ret+= "\n"+mNextAlarmEventDateTimeString; 358 ret+= "\n"+mNextAlarmEventDateTimeString;
358 return ret; 359 return ret;
359} 360}
360void CalendarLocal::registerAlarm() 361void CalendarLocal::registerAlarm()
361{ 362{
362 mLastAlarmNotificationString = getAlarmNotification(); 363 mLastAlarmNotificationString = getAlarmNotification();
363 // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() ); 364 // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() );
364 emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); 365 emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
365// #ifndef DESKTOP_VERSION 366// #ifndef DESKTOP_VERSION
366// AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() ); 367// AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() );
367// #endif 368// #endif
368} 369}
369void CalendarLocal::deRegisterAlarm() 370void CalendarLocal::deRegisterAlarm()
370{ 371{
371 if ( mLastAlarmNotificationString.isNull() ) 372 if ( mLastAlarmNotificationString.isNull() )
372 return; 373 return;
373 //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() ); 374 //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() );
374 375
375 emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); 376 emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
376// #ifndef DESKTOP_VERSION 377// #ifndef DESKTOP_VERSION
377// AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() ); 378// AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() );
378// #endif 379// #endif
379} 380}
380 381
381QPtrList<Todo> CalendarLocal::todos( const QDate &date ) 382QPtrList<Todo> CalendarLocal::todos( const QDate &date )
382{ 383{
383 QPtrList<Todo> todos; 384 QPtrList<Todo> todos;
384 385
385 Todo *todo; 386 Todo *todo;
386 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { 387 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
387 if ( todo->hasDueDate() && todo->dtDue().date() == date ) { 388 if ( todo->hasDueDate() && todo->dtDue().date() == date ) {
388 todos.append( todo ); 389 todos.append( todo );
389 } 390 }
390 } 391 }
391 392
392 filter()->apply( &todos ); 393 filter()->apply( &todos );
393 return todos; 394 return todos;
394} 395}
395void CalendarLocal::reInitAlarmSettings() 396void CalendarLocal::reInitAlarmSettings()
396{ 397{
397 if ( !mNextAlarmIncidence ) { 398 if ( !mNextAlarmIncidence ) {
398 nextAlarm( 1000 ); 399 nextAlarm( 1000 );
399 } 400 }
400 deRegisterAlarm(); 401 deRegisterAlarm();
401 mNextAlarmIncidence = 0; 402 mNextAlarmIncidence = 0;
402 checkAlarmForIncidence( 0, false ); 403 checkAlarmForIncidence( 0, false );
403 404
404} 405}
405 406
406 407
407 408
408QDateTime CalendarLocal::nextAlarm( int daysTo ) 409QDateTime CalendarLocal::nextAlarm( int daysTo )
409{ 410{
410 QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo ); 411 QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo );
411 QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); 412 QDateTime start = QDateTime::currentDateTime().addSecs( 30 );
412 QDateTime next; 413 QDateTime next;
413 Event *e; 414 Event *e;
414 bool ok; 415 bool ok;
415 bool found = false; 416 bool found = false;
416 int offset; 417 int offset;
417 mNextAlarmIncidence = 0; 418 mNextAlarmIncidence = 0;
418 for( e = mEventList.first(); e; e = mEventList.next() ) { 419 for( e = mEventList.first(); e; e = mEventList.next() ) {
419 next = e->getNextAlarmDateTime(& ok, &offset ) ; 420 next = e->getNextAlarmDateTime(& ok, &offset ) ;
420 if ( ok ) { 421 if ( ok ) {
421 if ( next < nextA ) { 422 if ( next < nextA ) {
422 nextA = next; 423 nextA = next;
423 found = true; 424 found = true;
424 mNextSummary = e->summary(); 425 mNextSummary = e->summary();
425 mNextAlarmEventDateTime = next.addSecs(offset ) ; 426 mNextAlarmEventDateTime = next.addSecs(offset ) ;
426 mNextAlarmIncidence = (Incidence *) e; 427 mNextAlarmIncidence = (Incidence *) e;
427 } 428 }
428 } 429 }
429 } 430 }
430 Todo *t; 431 Todo *t;
431 for( t = mTodoList.first(); t; t = mTodoList.next() ) { 432 for( t = mTodoList.first(); t; t = mTodoList.next() ) {
432 next = t->getNextAlarmDateTime(& ok, &offset ) ; 433 next = t->getNextAlarmDateTime(& ok, &offset ) ;
433 if ( ok ) { 434 if ( ok ) {
434 if ( next < nextA ) { 435 if ( next < nextA ) {
435 nextA = next; 436 nextA = next;
436 found = true; 437 found = true;
437 mNextSummary = t->summary(); 438 mNextSummary = t->summary();
438 mNextAlarmEventDateTime = next.addSecs(offset ); 439 mNextAlarmEventDateTime = next.addSecs(offset );
439 mNextAlarmIncidence = (Incidence *) t; 440 mNextAlarmIncidence = (Incidence *) t;
440 } 441 }
441 } 442 }
442 } 443 }
443 if ( mNextAlarmIncidence ) { 444 if ( mNextAlarmIncidence ) {
444 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); 445 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime);
445 mNextAlarmDateTime = nextA; 446 mNextAlarmDateTime = nextA;
446 } 447 }
447 return nextA; 448 return nextA;
448} 449}
449Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) 450Alarm::List CalendarLocal::alarmsTo( const QDateTime &to )
450{ 451{
451 return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); 452 return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to );
452} 453}
453 454
454Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) 455Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to )
455{ 456{
456 kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - " 457 kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - "
457 << to.toString() << ")\n"; 458 << to.toString() << ")\n";
458 459
459 Alarm::List alarms; 460 Alarm::List alarms;
460 461
461 Event *e; 462 Event *e;
462 463
463 for( e = mEventList.first(); e; e = mEventList.next() ) { 464 for( e = mEventList.first(); e; e = mEventList.next() ) {
464 if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); 465 if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to );
465 else appendAlarms( alarms, e, from, to ); 466 else appendAlarms( alarms, e, from, to );
466 } 467 }
467 468
468 Todo *t; 469 Todo *t;
469 for( t = mTodoList.first(); t; t = mTodoList.next() ) { 470 for( t = mTodoList.first(); t; t = mTodoList.next() ) {
470 appendAlarms( alarms, t, from, to ); 471 appendAlarms( alarms, t, from, to );
471 } 472 }
472 473
473 return alarms; 474 return alarms;
474} 475}
475 476
476void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, 477void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence,
477 const QDateTime &from, const QDateTime &to ) 478 const QDateTime &from, const QDateTime &to )
478{ 479{
479 QPtrList<Alarm> alarmList = incidence->alarms(); 480 QPtrList<Alarm> alarmList = incidence->alarms();
480 Alarm *alarm; 481 Alarm *alarm;
481 for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { 482 for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) {
482// kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() 483// kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text()
483// << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; 484// << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl;
484 if ( alarm->enabled() ) { 485 if ( alarm->enabled() ) {
485 if ( alarm->time() >= from && alarm->time() <= to ) { 486 if ( alarm->time() >= from && alarm->time() <= to ) {
486 kdDebug(5800) << "CalendarLocal::appendAlarms() '" << incidence->summary() 487 kdDebug(5800) << "CalendarLocal::appendAlarms() '" << incidence->summary()
487 << "': " << alarm->time().toString() << endl; 488 << "': " << alarm->time().toString() << endl;
488 alarms.append( alarm ); 489 alarms.append( alarm );
489 } 490 }
490 } 491 }
491 } 492 }
492} 493}