summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt8
-rw-r--r--kabc/addresseedialog.cpp80
-rw-r--r--kalarmd/alarmdialog.cpp13
-rw-r--r--korganizer/calendarview.cpp19
-rw-r--r--korganizer/koagendaview.cpp4
-rw-r--r--korganizer/koeditorgeneral.cpp69
-rw-r--r--korganizer/kotodoview.cpp11
-rw-r--r--korganizer/kotodoview.h1
8 files changed, 135 insertions, 70 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 6b739ba..711509d 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1143,201 +1143,201 @@
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{ "This month","Dieser Monat" }, 1200{ "This month","Dieser 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 in:\n","Der nächste Alarm ist in:\n" }, 1309{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" },
1310{ "%1 days\n","%1 Tagen\n" }, 1310{ "%1 days\n","%1 Tagen\n" },
1311{ "1 day\n","1 Tag\n" }, 1311{ "1 day\n","1 Tag\n" },
1312{ "%1 hours\n","%1 Stunden\n" }, 1312{ "%1 hours\n","%1 Stunden\n" },
1313{ "1 hour\n","1 Stunde\n" }, 1313{ "1 hour\n","1 Stunde\n" },
1314{ "%1 minutes\n","%1 Minuten\n" }, 1314{ "%1 minutes\n","%1 Minuten\n" },
1315{ "1 minute\n","1 Minute\n" }, 1315{ "1 minute\n","1 Minute\n" },
1316{ "Only one toolbar","Nur eine Toolbar" }, 1316{ "Only one toolbar","Nur eine Toolbar" },
1317{ "Print","Drucke" }, 1317{ "Print","Drucke" },
1318{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, 1318{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." },
1319{ "There is nothing selected!","Es ist nichts ausgewählt!" }, 1319{ "There is nothing selected!","Es ist nichts ausgewählt!" },
1320{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, 1320{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " },
1321{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, 1321{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" },
1322{ "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" }, 1322{ "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" },
1323{ "KO/Pi Printout","KO/Pi Ausdruck" }, 1323{ "KO/Pi Printout","KO/Pi Ausdruck" },
1324{ "Print unscaled","Drucke unskaliert" }, 1324{ "Print unscaled","Drucke unskaliert" },
1325{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, 1325{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." },
1326{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, 1326{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." },
1327{ "Printout Mode","Druck Modus" }, 1327{ "Printout Mode","Druck Modus" },
1328{ "Filter menu icon","Filtermenu Icon" }, 1328{ "Filter menu icon","Filtermenu Icon" },
1329{ "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" }, 1329{ "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" },
1330{ "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" }, 1330{ "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" },
1331{ "%1d","%1t" }, 1331{ "%1d","%1t" },
1332{ "%1h","%1std" }, 1332{ "%1h","%1std" },
1333{ "%1min","%1min" }, 1333{ "%1min","%1min" },
1334{ "( %1 before )","( %1 vorher )" }, 1334{ "( %1 before )","( %1 vorher )" },
1335{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" },
1336{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" },
1337{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." },
1335{ "","" }, 1338{ "","" },
1336{ "","" }, 1339{ "","" },
1337{ "","" }, 1340{ "","" },
1338{ "","" }, 1341{ "","" },
1339{ "","" }, 1342{ "","" },
1340{ "","" }, 1343{ "","" }, \ No newline at end of file
1341{ "","" },
1342{ "","" },
1343{ "","" } \ No newline at end of file
diff --git a/kabc/addresseedialog.cpp b/kabc/addresseedialog.cpp
index 648e780..19b52bb 100644
--- a/kabc/addresseedialog.cpp
+++ b/kabc/addresseedialog.cpp
@@ -1,311 +1,353 @@
1/* 1/*
2 This file is part of libkabc. 2 This file is part of libkabc.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qpushbutton.h> 22#include <qpushbutton.h>
23#include <qgroupbox.h> 23#include <qgroupbox.h>
24#include <qapplication.h> 24#include <qapplication.h>
25#include <qregexp.h> 25#include <qregexp.h>
26#include <qvbox.h> 26#include <qvbox.h>
27#include <qlabel.h> 27#include <qlabel.h>
28 28
29#include <klocale.h> 29#include <klocale.h>
30#include <kdebug.h> 30#include <kdebug.h>
31#include <kglobalsettings.h> 31#include <kglobalsettings.h>
32 32
33#include "stdaddressbook.h" 33#include "stdaddressbook.h"
34 34
35#include "addresseedialog.h" 35#include "addresseedialog.h"
36#include "KDGanttMinimizeSplitter.h" 36#include "KDGanttMinimizeSplitter.h"
37//#include "addresseedialog.moc" 37//#include "addresseedialog.moc"
38 38
39using namespace KABC; 39using namespace KABC;
40 40
41AddresseeItem::AddresseeItem( QListView *parent, const Addressee &addressee ) : 41AddresseeItem::AddresseeItem( QListView *parent, const Addressee &addressee ) :
42 QListViewItem( parent ), 42 QListViewItem( parent ),
43 mAddressee( addressee ) 43 mAddressee( addressee )
44{ 44{
45 QString name = addressee.familyName()+", "+ addressee.givenName(); 45 QString name = addressee.familyName()+", "+ addressee.givenName();
46 if ( name.length() == 2 ) 46 if ( name.length() == 2 )
47 name = addressee.organization(); 47 name = addressee.organization();
48 setText( Name,name); 48 setText( Name,name);
49 setText( Email, addressee.preferredEmail() ); 49 setText( Email, addressee.preferredEmail() );
50} 50}
51 51
52QString AddresseeItem::key( int column, bool ) const 52QString AddresseeItem::key( int column, bool ) const
53{ 53{
54 54
55 if (column == Email) { 55 if (column == Email) {
56 QString value = text(Email); 56 QString value = text(Email);
57 int val = value.findRev("@"); 57 int val = value.findRev("@");
58 return value.mid( val) + value.left( val ); 58 return value.mid( val) + value.left( val );
59 } 59 }
60 return text(column).lower(); 60 return text(column).lower();
61} 61}
62 62
63AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) : 63AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) :
64 KDialogBase( KDialogBase::Plain, i18n("Select Addressee"), 64 KDialogBase( KDialogBase::Plain, i18n("Select Addressee"),
65 Ok|Cancel, No, parent ), mMultiple( multiple ) 65 Ok|Cancel, No, parent ), mMultiple( multiple )
66{ 66{
67 qDebug("NEW AddresseeDialog "); 67 qDebug("NEW AddresseeDialog ");
68 QWidget *topWidget = plainPage(); 68 QWidget *topWidget = plainPage();
69 69
70 QBoxLayout *topLayout = new QHBoxLayout( topWidget ); 70 QBoxLayout *topLayout = new QHBoxLayout( topWidget );
71 71
72 72
73 KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, topWidget); 73 KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, topWidget);
74 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 74 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
75 75
76 topLayout->addWidget(mMiniSplitter ); 76 topLayout->addWidget(mMiniSplitter );
77 77
78 QWidget *listWidget = new QWidget( mMiniSplitter ); 78 QWidget *listWidget = new QWidget( mMiniSplitter );
79 79
80 QBoxLayout *listLayout = new QVBoxLayout (listWidget) ; 80 QBoxLayout *listLayout = new QVBoxLayout (listWidget) ;
81 //topLayout->addLayout( listLayout ); 81 //topLayout->addLayout( listLayout );
82 82
83 mAddresseeList = new KListView( listWidget ); 83 mAddresseeList = new KListView( listWidget );
84 mAddresseeList->addColumn( i18n("Name") ); 84 mAddresseeList->addColumn( i18n("Name") );
85 mAddresseeList->addColumn( i18n("Email") ); 85 mAddresseeList->addColumn( i18n("Email") );
86 mAddresseeList->setAllColumnsShowFocus( true ); 86 mAddresseeList->setAllColumnsShowFocus( true );
87 mAddresseeList->setFullWidth( true ); 87 mAddresseeList->setFullWidth( true );
88 listLayout->addWidget( mAddresseeList ); 88 listLayout->addWidget( mAddresseeList );
89 connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ), 89 connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ),
90 SLOT( slotOk() ) ); 90 SLOT( slotOk() ) );
91 91
92 mAddresseeEdit = new QLineEdit( listWidget ); 92 mAddresseeEdit = new QLineEdit( listWidget );
93 connect( mAddresseeEdit, SIGNAL( returnPressed() ), 93 connect( mAddresseeEdit, SIGNAL( returnPressed() ),
94 SLOT( loadAddressBook() ) ); 94 SLOT( loadAddressBook() ) );
95 mAddresseeEdit->setFocus(); 95 mAddresseeEdit->setFocus();
96 96
97 listLayout->addWidget( mAddresseeEdit ); 97 listLayout->addWidget( mAddresseeEdit );
98 98
99 if ( mMultiple ) { 99 if ( mMultiple ) {
100 //QBoxLayout *selectedLayout = new QVBoxLayout; 100 //QBoxLayout *selectedLayout = new QVBoxLayout;
101 //topLayout->addLayout( selectedLayout ); 101 //topLayout->addLayout( selectedLayout );
102 //topLayout->setSpacing( spacingHint() ); 102 //topLayout->setSpacing( spacingHint() );
103 103
104 QVBox *selectedGroup = new QVBox( mMiniSplitter ); 104 QVBox *selectedGroup = new QVBox( mMiniSplitter );
105 new QLabel ( i18n("Selected:"), selectedGroup ); 105 new QLabel ( i18n("Selected:"), selectedGroup );
106 //selectedLayout->addWidget( selectedGroup ); 106 //selectedLayout->addWidget( selectedGroup );
107 107
108 mSelectedList = new KListView( selectedGroup ); 108 mSelectedList = new KListView( selectedGroup );
109 mSelectedList->addColumn( i18n("Name") ); 109 mSelectedList->addColumn( i18n("Name") );
110 mSelectedList->addColumn( i18n("Email") ); 110 mSelectedList->addColumn( i18n("Email") );
111 mSelectedList->setAllColumnsShowFocus( true ); 111 mSelectedList->setAllColumnsShowFocus( true );
112 mSelectedList->setFullWidth( true ); 112 mSelectedList->setFullWidth( true );
113 connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ), 113 connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ),
114 SLOT( removeSelected() ) ); 114 SLOT( removeSelected() ) );
115 115
116 QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup ); 116 QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup );
117 connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) ); 117 connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) );
118 118
119 connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ), 119 connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ),
120 SLOT( addSelected( QListViewItem * ) ) ); 120 SLOT( addSelected( QListViewItem * ) ) );
121 connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ), 121 connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ),
122 SLOT( selectNextItem( QListViewItem * ) ) ); 122 SLOT( selectNextItem( QListViewItem * ) ) );
123 123
124 } 124 }
125 125
126 mAddressBook = StdAddressBook::self( true ); 126 mAddressBook = StdAddressBook::self( true );
127 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ), 127 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ),
128 SLOT( addressBookChanged() ) ); 128 SLOT( addressBookChanged() ) );
129#if 0
129 connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ), 130 connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ),
130 SLOT( addressBookChanged() ) ); 131 SLOT( addressBookChanged() ) );
131 132#endif
132 loadAddressBook(); 133 loadAddressBook();
133 QValueList<int> splitterSize; 134 QValueList<int> splitterSize;
134 splitterSize.append( ( width() / 5 ) * 3 ); 135 splitterSize.append( ( width() / 5 ) * 3 );
135 splitterSize.append( ( width() / 5 ) *2 ); 136 splitterSize.append( ( width() / 5 ) *2 );
136 mMiniSplitter->setSizes( splitterSize ); 137 mMiniSplitter->setSizes( splitterSize );
137} 138}
138 139
139AddresseeDialog::~AddresseeDialog() 140AddresseeDialog::~AddresseeDialog()
140{ 141{
141 qDebug("DELETE AddresseeDialog "); 142 qDebug("DELETE AddresseeDialog ");
142} 143}
143 144
144void AddresseeDialog::loadAddressBook() 145void AddresseeDialog::loadAddressBook()
145{ 146{
146 mAddresseeList->clear(); 147 mAddresseeList->clear();
147 mItemDict.clear(); 148 mItemDict.clear();
148 if ( mAddresseeEdit->text().isEmpty() ) { 149 if ( mAddresseeEdit->text().isEmpty() ) {
149 AddressBook::Iterator it; 150 AddressBook::Iterator it;
150 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 151 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
151 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 152 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
152 continue; 153 continue;
153 new AddresseeItem( mAddresseeList, (*it) ); 154 new AddresseeItem( mAddresseeList, (*it) );
154 } 155 }
155 return; 156 return;
156 } 157 }
157 //mAddresseeEdit->completionObject()->clear(); 158 //mAddresseeEdit->completionObject()->clear();
158 QRegExp re; 159 QRegExp re;
159 re.setWildcard(true); // most people understand these better. 160 re.setWildcard(true); // most people understand these better.
160 re.setCaseSensitive(false); 161 re.setCaseSensitive(false);
161 re.setPattern( "*"+ mAddresseeEdit->text() + "*"); 162 re.setPattern( "*"+ mAddresseeEdit->text() + "*");
162 163
163 AddressBook::Iterator it; 164 AddressBook::Iterator it;
164 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 165 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
165 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 166 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
166 continue; 167 continue;
167 QString name = (*it).familyName()+", "+ (*it).givenName(); 168 QString name = (*it).familyName()+", "+ (*it).givenName();
168 if ( name.length() == 2 ) 169 if ( name.length() == 2 )
169 name = (*it).realName(); 170 name = (*it).realName();
170 name += (*it).preferredEmail(); 171 name += (*it).preferredEmail();
171#if QT_VERSION >= 0x030000 172#if QT_VERSION >= 0x030000
172 if (re.search(name) != -1) 173 if (re.search(name) != -1)
173#else 174#else
174 if (re.match(name) != -1) 175 if (re.match(name) != -1)
175#endif 176#endif
176 AddresseeItem *item = new AddresseeItem( mAddresseeList, (*it) ); 177 AddresseeItem *item = new AddresseeItem( mAddresseeList, (*it) );
177 } 178 }
178} 179}
179 180
180void AddresseeDialog::addCompletionItem( const QString &str, QListViewItem *item ) 181void AddresseeDialog::addCompletionItem( const QString &str, QListViewItem *item )
181{ 182{
182 if ( str.isEmpty() ) return; 183 if ( str.isEmpty() ) return;
183 184
184 mItemDict.insert( str, item ); 185 mItemDict.insert( str, item );
185 //mAddresseeEdit->completionObject()->addItem( str ); 186 //mAddresseeEdit->completionObject()->addItem( str );
186} 187}
187 188
188void AddresseeDialog::selectItem( const QString &str ) 189void AddresseeDialog::selectItem( const QString &str )
189{ 190{
190 if ( str.isEmpty() ) return; 191 if ( str.isEmpty() ) return;
191 192
192 QListViewItem *item = mItemDict.find( str ); 193 QListViewItem *item = mItemDict.find( str );
193 if ( item ) { 194 if ( item ) {
194 mAddresseeList->blockSignals( true ); 195 mAddresseeList->blockSignals( true );
195 mAddresseeList->setSelected( item, true ); 196 mAddresseeList->setSelected( item, true );
196 mAddresseeList->ensureItemVisible( item ); 197 mAddresseeList->ensureItemVisible( item );
197 mAddresseeList->blockSignals( false ); 198 mAddresseeList->blockSignals( false );
198 } 199 }
199} 200}
200 201
201void AddresseeDialog::updateEdit( QListViewItem *item ) 202void AddresseeDialog::updateEdit( QListViewItem *item )
202{ 203{
203 mAddresseeEdit->setText( item->text( 0 ) ); 204 mAddresseeEdit->setText( item->text( 0 ) );
204 mAddresseeEdit->setSelection( 0, item->text( 0 ).length() ); 205 mAddresseeEdit->setSelection( 0, item->text( 0 ).length() );
205} 206}
206 207
207void AddresseeDialog::selectNextItem( QListViewItem *item ) 208void AddresseeDialog::selectNextItem( QListViewItem *item )
208{ 209{
209 addSelected( item ); 210 addSelected( item );
210 QListViewItem *next = item->nextSibling(); 211 QListViewItem *next = item->nextSibling();
211 if ( next ) { 212 if ( next ) {
212 next->setSelected( true ); 213 next->setSelected( true );
213 item->setSelected( false ); 214 item->setSelected( false );
214 mAddresseeList->setCurrentItem( next ); 215 mAddresseeList->setCurrentItem( next );
215 } 216 }
216} 217}
217void AddresseeDialog::addSelected( QListViewItem *item ) 218void AddresseeDialog::addSelected( QListViewItem *item )
218{ 219{
219 AddresseeItem *addrItem = (AddresseeItem *)( item ); 220 AddresseeItem *addrItem = (AddresseeItem *)( item );
220 if ( !addrItem ) return; 221 if ( !addrItem ) return;
221 222
222 Addressee a = addrItem->addressee(); 223 Addressee a = addrItem->addressee();
223 224
224 QListViewItem *selectedItem = mSelectedDict.find( a.uid() ); 225 QListViewItem *selectedItem = mSelectedDict.find( a.uid() );
225 if ( !selectedItem ) { 226 if ( !selectedItem ) {
226 selectedItem = new AddresseeItem( mSelectedList, a ); 227 selectedItem = new AddresseeItem( mSelectedList, a );
227 mSelectedDict.insert( a.uid(), selectedItem ); 228 mSelectedDict.insert( a.uid(), selectedItem );
228 } 229 }
229 230
230} 231}
231 232
232void AddresseeDialog::removeSelected() 233void AddresseeDialog::removeSelected()
233{ 234{
234 QListViewItem *item = mSelectedList->selectedItem(); 235 QListViewItem *item = mSelectedList->selectedItem();
235 AddresseeItem *addrItem = (AddresseeItem *)( item ); 236 AddresseeItem *addrItem = (AddresseeItem *)( item );
236 if ( !addrItem ) return; 237 if ( !addrItem ) return;
237 QListViewItem *next = item->nextSibling(); 238 QListViewItem *next = item->nextSibling();
238 mSelectedDict.remove( addrItem->addressee().uid() ); 239 mSelectedDict.remove( addrItem->addressee().uid() );
239 delete addrItem; 240 delete addrItem;
240 if ( next ) 241 if ( next )
241 next->setSelected( true ); 242 next->setSelected( true );
242} 243}
243 244
244Addressee AddresseeDialog::addressee() 245Addressee AddresseeDialog::addressee()
245{ 246{
246 AddresseeItem *aItem = 0; 247 AddresseeItem *aItem = 0;
247 248
248 if ( mMultiple ) 249 if ( mMultiple )
249 aItem = (AddresseeItem *)( mSelectedList->firstChild() ); 250 aItem = (AddresseeItem *)( mSelectedList->firstChild() );
250 else 251 else
251 aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); 252 aItem = (AddresseeItem *)( mAddresseeList->selectedItem() );
252 253
253 if (aItem) return aItem->addressee(); 254 if (aItem) return aItem->addressee();
254 return Addressee(); 255 return Addressee();
255} 256}
256 257
257Addressee::List AddresseeDialog::addressees() 258Addressee::List AddresseeDialog::addressees()
258{ 259{
259 Addressee::List al; 260 Addressee::List al;
260 AddresseeItem *aItem = 0; 261 AddresseeItem *aItem = 0;
261 262
262 if ( mMultiple ) { 263 if ( mMultiple ) {
263 QListViewItem *item = mSelectedList->firstChild(); 264 QListViewItem *item = mSelectedList->firstChild();
264 while( item ) { 265 while( item ) {
265 aItem = (AddresseeItem *)( item ); 266 aItem = (AddresseeItem *)( item );
266 if ( aItem ) al.append( aItem->addressee() ); 267 if ( aItem ) al.append( aItem->addressee() );
267 item = item->nextSibling(); 268 item = item->nextSibling();
268 } 269 }
269 } 270 }
270 else 271 else
271 { 272 {
272 aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); 273 aItem = (AddresseeItem *)( mAddresseeList->selectedItem() );
273 if (aItem) al.append( aItem->addressee() ); 274 if (aItem) al.append( aItem->addressee() );
274 } 275 }
275 276
276 return al; 277 return al;
277} 278}
278 279
279Addressee AddresseeDialog::getAddressee( QWidget *parent ) 280Addressee AddresseeDialog::getAddressee( QWidget *parent )
280{ 281{
281 AddresseeDialog *dlg = new AddresseeDialog( parent ); 282 AddresseeDialog *dlg = new AddresseeDialog( parent );
282 Addressee addressee; 283 Addressee addressee;
283 int result = dlg->exec(); 284#ifdef DESKTOP_VERSION
285 static int geoX = 0;
286 static int geoY = 0;
287 static int geoW = 0;
288 static int geoH = 0;
289 if ( !geoX && ! geoY && !geoW &&!geoH ) {
290 geoX = dlg->geometry().x();
291 geoY = dlg->geometry().y();
292 geoW = dlg->width();
293 geoH = dlg->height();
294 } else {
295 dlg->show();
296 dlg->setGeometry(geoX , geoY,geoW , geoH );
284 297
285 if ( result == QDialog::Accepted ) { 298 }
286 addressee = dlg->addressee(); 299#endif
287 } 300 int result = dlg->exec();
301#ifdef DESKTOP_VERSION
302 geoX = dlg->geometry().x();
303 geoY = dlg->geometry().y();
304 geoW = dlg->width();
305 geoH = dlg->height();
306#endif
307 if ( result == QDialog::Accepted ) {
308 addressee = dlg->addressee();
309 }
288 310
289 delete dlg; 311 delete dlg;
290 return addressee; 312 return addressee;
291} 313}
292 314
293Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) 315Addressee::List AddresseeDialog::getAddressees( QWidget *parent )
294{ 316{
295 AddresseeDialog *dlg = new AddresseeDialog( parent, true ); 317 AddresseeDialog *dlg = new AddresseeDialog( parent, true );
296 Addressee::List addressees; 318 Addressee::List addressees;
297 if ( QApplication::desktop()->width() <= 640 ) 319 static int geoX = 0;
298 dlg->showMaximized(); 320 static int geoY = 0;
299 int result = dlg->exec(); 321 static int geoW = 0;
300 if ( result == QDialog::Accepted ) { 322 static int geoH = 0;
301 addressees = dlg->addressees(); 323 if ( QApplication::desktop()->width() <= 640 )
302 } 324 dlg->showMaximized();
325 else {
326 if ( !geoX && ! geoY && !geoW &&!geoH ) {
327 geoX = dlg->geometry().x();
328 geoY = dlg->geometry().y();
329 geoW = dlg->width();
330 geoH = dlg->height();
331 } else {
332 dlg->show();
333 dlg->setGeometry(geoX , geoY,geoW , geoH );
334
335 }
336 }
337 int result = dlg->exec();
338 geoX = dlg->geometry().x();
339 geoY = dlg->geometry().y();
340 geoW = dlg->width();
341 geoH = dlg->height();
342 if ( result == QDialog::Accepted ) {
343 addressees = dlg->addressees();
344 }
303 345
304 delete dlg; 346 delete dlg;
305 return addressees; 347 return addressees;
306} 348}
307 349
308void AddresseeDialog::addressBookChanged() 350void AddresseeDialog::addressBookChanged()
309{ 351{
310 loadAddressBook(); 352 loadAddressBook();
311} 353}
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp
index bdeee4a..53ff488 100644
--- a/kalarmd/alarmdialog.cpp
+++ b/kalarmd/alarmdialog.cpp
@@ -1,320 +1,323 @@
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#include <qregexp.h>
35#ifndef DESKTOP_VERSION 36#ifndef DESKTOP_VERSION
36#define protected public 37#define protected public
37#include <qspinbox.h> 38#include <qspinbox.h>
38#undef protected 39#undef protected
39#else 40#else
40#include <qspinbox.h> 41#include <qspinbox.h>
41#endif 42#endif
42#include <stdlib.h> 43#include <stdlib.h>
43#ifndef _WIN32_ 44#ifndef _WIN32_
44#include <unistd.h> 45#include <unistd.h>
45#include <sys/ioctl.h> 46#include <sys/ioctl.h>
46#endif 47#endif
47#include <stdio.h> 48#include <stdio.h>
48#include <fcntl.h> 49#include <fcntl.h>
49 50
50#ifndef DESKTOP_VERSION 51#ifndef DESKTOP_VERSION
51#include <qtopia/alarmserver.h> 52#include <qtopia/alarmserver.h>
52#include <qpe/resource.h> 53#include <qpe/resource.h>
53#include <qtopia/sound.h> 54#include <qtopia/sound.h>
54 55
55#endif 56#endif
56 57
57#include "alarmdialog.h" 58#include "alarmdialog.h"
58 59
59 60
60AlarmDialog::AlarmDialog(QWidget *parent,const char *name) 61AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
61 : QDialog (parent, name, true, Qt::WStyle_StaysOnTop ) 62 : QDialog (parent, name, true, Qt::WStyle_Customize |Qt::WStyle_StaysOnTop | Qt::WStyle_DialogBorder)
62{ 63{
63 setCaption( "KO/Pi Alarm!" ); 64 setCaption( "KO/Pi Alarm!" );
64 QVBoxLayout* layout = new QVBoxLayout( this); 65 QVBoxLayout* layout = new QVBoxLayout( this);
65 QLabel* l = new QLabel("The following event triggered alarm:",this); 66 QLabel* l = new QLabel("The following event triggered alarm:",this);
66 layout->addWidget ( l ); 67 layout->addWidget ( l );
67 l->setAlignment( AlignCenter); 68 l->setAlignment( AlignCenter);
68 mMessage = new QLabel ( " ", this ); 69 mMessage = new QLabel ( " ", this );
69 int fs = 18; 70 int fs = 18;
70 int fs2 = 12; 71 int fs2 = 12;
71 int baseSize = 6; 72 int baseSize = 6;
72 if ( QApplication::desktop()->width() < 480 ) { 73 if ( QApplication::desktop()->width() < 480 ) {
73 fs2 = 10; 74 fs2 = 10;
74 fs = 12; 75 fs = 12;
75 baseSize = 4; 76 baseSize = 4;
76 } 77 }
77 layout->setSpacing( 3 ); 78 layout->setSpacing( 3 );
78 layout->setMargin( 3 ); 79 layout->setMargin( 3 );
79 QFont fo = QApplication::font(); 80 QFont fo = QApplication::font();
80 fo.setBold( true ); 81 fo.setBold( true );
81 fo.setPointSize( fs2 ); 82 fo.setPointSize( fs2 );
82 l->setFont( fo ); 83 l->setFont( fo );
83 fo.setPointSize( fs ); 84 fo.setPointSize( fs );
84 mMessage->setFont(fo ); 85 mMessage->setFont(fo );
85 mMessage->setAlignment( AlignCenter); 86 mMessage->setAlignment( AlignCenter);
86 layout->addWidget ( mMessage ); 87 layout->addWidget ( mMessage );
87 mMissedAlarms= new QLabel ( "(No missed Alarms)", this ); 88 mMissedAlarms= new QLabel ( "(No missed Alarms)", this );
88 mMissedAlarms->setAlignment( AlignCenter); 89 mMissedAlarms->setAlignment( AlignCenter);
89 90
90 playSoundTimer = new QTimer( this ); 91 playSoundTimer = new QTimer( this );
91 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) ); 92 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) );
92 93
93 playSoundTimer->stop(); 94 playSoundTimer->stop();
94 95
95 layout->addWidget ( mMissedAlarms ); 96 layout->addWidget ( mMissedAlarms );
96 mMissedAlarmsCombo = new QComboBox ( this ); 97 mMissedAlarmsCombo = new QComboBox ( this );
97 layout->addWidget ( mMissedAlarmsCombo ); 98 layout->addWidget ( mMissedAlarmsCombo );
98 99
99 QLabel* labb = new QLabel("Suspend duration (minutes):",this); 100 QLabel* labb = new QLabel("Suspend duration (minutes):",this);
100 labb->setAlignment(AlignCenter); 101 labb->setAlignment(AlignCenter);
101 layout->addWidget ( labb ); 102 layout->addWidget ( labb );
102 fo = font(); 103 fo = font();
103 int pointSize = 36; 104 int pointSize = 36;
104 if ( QApplication::desktop()->width() <= 320 ) 105 if ( QApplication::desktop()->width() <= 320 )
105 pointSize = 18; 106 pointSize = 18;
106 fo.setPointSize( pointSize ); 107 fo.setPointSize( pointSize );
107 mSuspendSpin = new QSpinBox(1,1440,1,this); 108 mSuspendSpin = new QSpinBox(1,1440,1,this);
108 mSuspendSpin->setFont( fo ); 109 mSuspendSpin->setFont( fo );
109 mSuspendSpin->setValue(7); // default suspend duration 110 mSuspendSpin->setValue(7); // default suspend duration
110 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 111 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
111 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 112 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
112 113
113#if QT_VERSION < 0x030000 114#if QT_VERSION < 0x030000
114 mSuspendSpin->upButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize )); 115 mSuspendSpin->upButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize ));
115 mSuspendSpin->downButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize )); 116 mSuspendSpin->downButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize ));
116#endif 117#endif
117 mSuspendSpin->setFixedSize( 18*baseSize, 10*baseSize+2 ); 118 mSuspendSpin->setFixedSize( 18*baseSize, 10*baseSize+2 );
118 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 119 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
119 QHBoxLayout* layoutSpin = new QHBoxLayout( layout ); 120 QHBoxLayout* layoutSpin = new QHBoxLayout( layout );
120 layoutSpin->addStretch (); 121 layoutSpin->addStretch ();
121 layoutSpin->addWidget ( mSuspendSpin ); 122 layoutSpin->addWidget ( mSuspendSpin );
122 layoutSpin->addStretch (); 123 layoutSpin->addStretch ();
123 124
124 QVBox * bbox = new QVBox ( this ); 125 QVBox * bbox = new QVBox ( this );
125 layout->addWidget ( bbox ); 126 layout->addWidget ( bbox );
126 bbox->layout()->setSpacing( 2 ); 127 bbox->layout()->setSpacing( 2 );
127 labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox); 128 labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox);
128 labb->setAlignment(AlignCenter); 129 labb->setAlignment(AlignCenter);
129 mSuspendButton = new QPushButton( "Suspend", bbox); 130 mSuspendButton = new QPushButton( "Suspend", bbox);
130 QPushButton* silen = new QPushButton( " Stop sound ", bbox); 131 QPushButton* silen = new QPushButton( " Stop sound ", bbox);
131 QPushButton* okbut = new QPushButton( "Ok", bbox); 132 QPushButton* okbut = new QPushButton( "Ok", bbox);
132 mSuspendButton->setFont( fo ); 133 mSuspendButton->setFont( fo );
133 silen->setFont( fo ); 134 silen->setFont( fo );
134 okbut->setFont( fo ); 135 okbut->setFont( fo );
135 okbut->setDefault( true ); 136 okbut->setDefault( true );
136 connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); 137 connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) );
137 connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); 138 connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) );
138 connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) ); 139 connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) );
139#ifndef _WIN32_ 140#ifndef _WIN32_
140 if ( QFile::exists ( "/dev/sharp_led" ) ) 141 if ( QFile::exists ( "/dev/sharp_led" ) )
141 fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 142 fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
142 else 143 else
143#endif 144#endif
144 fd_led = 0; 145 fd_led = 0;
145 statusLED.which = SHARP_LED_SALARM; 146 statusLED.which = SHARP_LED_SALARM;
146 mSilent = false; 147 mSilent = false;
147 mSuspendCounter = 0; 148 mSuspendCounter = 0;
148 setServerNotification( true ); 149 setServerNotification( true );
149} 150}
150void AlarmDialog::reject () 151void AlarmDialog::reject ()
151{ 152{
152 QTimer::singleShot ( 3000, this, SLOT (suspend()) ); 153 QTimer::singleShot ( 3000, this, SLOT (suspend()) );
153 slotSuspend(); 154 slotSuspend();
154} 155}
155AlarmDialog::~AlarmDialog() 156AlarmDialog::~AlarmDialog()
156{ 157{
157} 158}
158void AlarmDialog::silent () 159void AlarmDialog::silent ()
159{ 160{
160 mSilent = true; 161 mSilent = true;
161} 162}
162void AlarmDialog::accept() 163void AlarmDialog::accept()
163{ 164{
164 slotOk(); 165 slotOk();
165} 166}
166 167
167void AlarmDialog::suspend() 168void AlarmDialog::suspend()
168{ 169{
169#ifdef DESKTOP_VERSION 170#ifdef DESKTOP_VERSION
170 171
171#else 172#else
172 Sound::soundAlarm (); 173 Sound::soundAlarm ();
173#endif 174#endif
174} 175}
175void AlarmDialog::slotOk() 176void AlarmDialog::slotOk()
176{ 177{
177 mStopAlarm = true; 178 mStopAlarm = true;
178 mMissedAlarms->setText("(No missed Alarms)"); 179 mMissedAlarms->setText("(No missed Alarms)");
179 mMessage->setText(""); 180 mMessage->setText("");
180 mMissedAlarmsCombo->clear(); 181 mMissedAlarmsCombo->clear();
181#ifndef _WIN32_ 182#ifndef _WIN32_
182 if ( fd_led > 0 ) { 183 if ( fd_led > 0 ) {
183 statusLED.status = LED_SALARM_OFF ; 184 statusLED.status = LED_SALARM_OFF ;
184 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); 185 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED);
185 } 186 }
186#endif 187#endif
187 QDialog::accept(); 188 QDialog::accept();
188} 189}
189 190
190void AlarmDialog::slotSuspend() 191void AlarmDialog::slotSuspend()
191{ 192{
192 //qDebug("AlarmDialog::suspend() "); // emit suspendSignal(mSuspendSpin->value()); 193 //qDebug("AlarmDialog::suspend() "); // emit suspendSignal(mSuspendSpin->value());
193 mStopAlarm = true; 194 mStopAlarm = true;
194 QDateTime nextA = QDateTime::currentDateTime().addSecs( mSuspendSpin->value() * 60 ); 195 QDateTime nextA = QDateTime::currentDateTime().addSecs( mSuspendSpin->value() * 60 );
195 QString mess = "suspend_alarm" +mFileName+"+++" ; 196 QString mess = "suspend_alarm" +mFileName+"+++" ;
196 if ( mMessage->text().left( 10 ) !="Suspended:" ) 197 if ( mMessage->text().left( 10 ) !="Suspended:" )
197 mess += "Suspended:\n"; 198 mess += "Suspended:\n";
198 mess +=mMessage->text(); 199 mess +=mMessage->text();
199#ifndef DESKTOP_VERSION 200#ifndef DESKTOP_VERSION
200 if ( mServerNotification ) 201 if ( mServerNotification )
201 AlarmServer::addAlarm ( nextA,"koalarm",mess.latin1()); 202 AlarmServer::addAlarm ( nextA,"koalarm",mess.latin1());
202#endif 203#endif
203 emit addAlarm( nextA , mess ); 204 emit addAlarm( nextA , mess );
204 slotOk(); 205 slotOk();
205} 206}
206 207
207void AlarmDialog::setServerNotification( bool b ) 208void AlarmDialog::setServerNotification( bool b )
208{ 209{
209 mServerNotification = b; 210 mServerNotification = b;
210} 211}
211int AlarmDialog::getSuspendTime( ) 212int AlarmDialog::getSuspendTime( )
212{ 213{
213 return mSuspendSpin->value(); 214 return mSuspendSpin->value();
214 215
215} 216}
216void AlarmDialog::setSuspendTime( int val ) 217void AlarmDialog::setSuspendTime( int val )
217{ 218{
218 mSuspendSpin->setValue( val ); 219 mSuspendSpin->setValue( val );
219} 220}
220bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, bool playwav, int pause , int suspendtimes) 221bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, bool playwav, int pause , int suspendtimes)
221{ 222{
222 if ( mess.left( 9) != "Suspended" ) 223 if ( mess.left( 9) != "Suspended" )
223 mSuspendCounter = suspendtimes; 224 mSuspendCounter = suspendtimes;
224 mPauseCount = pause; 225 mPauseCount = pause;
225 mFileName = fn; 226 mFileName = fn;
226 mPlayWav = playwav; 227 mPlayWav = playwav;
227 if ( !QFile::exists( fn ) ) 228 if ( !QFile::exists( fn ) )
228 mFileName = ""; 229 mFileName = "";
229 alarmCounter = 0 ; 230 alarmCounter = 0 ;
230 maxAlarmReplay = replay ; 231 maxAlarmReplay = replay ;
231 mStopAlarm = false; 232 mStopAlarm = false;
232 mSilent = false; 233 mSilent = false;
233 if ( !mMessage->text().stripWhiteSpace().isEmpty() ) { 234 if ( !mMessage->text().stripWhiteSpace().isEmpty() ) {
234 mMissedAlarmsCombo->show(); 235 mMissedAlarmsCombo->show();
235 mMissedAlarmsCombo->insertItem( mMessage->text().stripWhiteSpace() ); 236 QString newItem = mMessage->text().stripWhiteSpace();
237 newItem.replace( QRegExp("\n"), QString(" ") );
238 mMissedAlarmsCombo->insertItem( newItem );
236 mMissedAlarms->setText( "Missed alarms:"); 239 mMissedAlarms->setText( "Missed alarms:");
237 } else 240 } else
238 mMissedAlarmsCombo->hide(); 241 mMissedAlarmsCombo->hide();
239 mMessage->setText(mess); 242 mMessage->setText(mess);
240 int w =sizeHint().width() ; 243 int w =sizeHint().width() ;
241 int h = sizeHint().height() ; 244 int h = sizeHint().height() ;
242 int dw = QApplication::desktop()->width(); 245 int dw = QApplication::desktop()->width();
243 int dh = QApplication::desktop()->height(); 246 int dh = QApplication::desktop()->height();
244 setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 247 setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
245 show(); 248 show();
246 raise(); 249 raise();
247 //qApp->processEvents(); 250 //qApp->processEvents();
248 //repaint(); 251 //repaint();
249 qApp->processEvents(); 252 qApp->processEvents();
250 253
251#ifndef _WIN32_ 254#ifndef _WIN32_
252 if ( fd_led > 0 ) { 255 if ( fd_led > 0 ) {
253 statusLED.status = LED_SALARM_ON ; 256 statusLED.status = LED_SALARM_ON ;
254 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); 257 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED);
255 } 258 }
256#endif 259#endif
257 playSoundTimer->start( 1000, true ); 260 playSoundTimer->start( 1000, true );
258 return true; 261 return true;
259 262
260} 263}
261 264
262 265
263void AlarmDialog::playSound () 266void AlarmDialog::playSound ()
264{ 267{
265 268
266 if (mStopAlarm ) 269 if (mStopAlarm )
267 return; 270 return;
268 if (mSilent ) 271 if ( mSilent )
269 return; 272 return;
270 showNormal(); 273 showNormal();
271 setActiveWindow(); 274 setActiveWindow();
275 raise();
272 mSuspendSpin->setFocus(); 276 mSuspendSpin->setFocus();
273 raise(); 277
274 repaint();
275 278
276 qApp->processEvents(); 279 qApp->processEvents();
277 if ( alarmCounter < maxAlarmReplay && ! mSilent) { 280 if ( alarmCounter < maxAlarmReplay && ! mSilent) {
278 ++alarmCounter; 281 ++alarmCounter;
279#ifdef DESKTOP_VERSION 282#ifdef DESKTOP_VERSION
280 mPlayWav = true; 283 mPlayWav = true;
281#endif 284#endif
282 if ( !mPlayWav || mFileName.length() < 2 ) { 285 if ( !mPlayWav || mFileName.length() < 2 ) {
283 286
284#ifdef DESKTOP_VERSION 287#ifdef DESKTOP_VERSION
285 qDebug("Sound play not possible - file not found"); 288 qDebug("Sound play not possible - file not found");
286#else 289#else
287 Sound::soundAlarm (); 290 Sound::soundAlarm ();
288#endif 291#endif
289 } else 292 } else
290 293
291 { 294 {
292#ifdef DESKTOP_VERSION 295#ifdef DESKTOP_VERSION
293#ifdef _WIN32_ 296#ifdef _WIN32_
294 QSound::play ( mFileName ); 297 QSound::play ( mFileName );
295#else 298#else
296 299
297 QString command = "playwave -r 22050 " + mFileName; 300 QString command = "playwave -r 22050 " + mFileName;
298 qDebug("KO: Playing file %s with 22kHz",mFileName.latin1() ); 301 qDebug("KO: Playing file %s with 22kHz",mFileName.latin1() );
299 int ret = system ( command.latin1() ); 302 int ret = system ( command.latin1() );
300 if ( ret != 0 ) { 303 if ( ret != 0 ) {
301 qDebug("Sound play command failed: %s ",command.latin1() ); 304 qDebug("Sound play command failed: %s ",command.latin1() );
302 } 305 }
303 306
304#endif 307#endif
305 308
306#else 309#else
307 QSound::play ( mFileName ); 310 QSound::play ( mFileName );
308#endif 311#endif
309 qDebug("BEEP!"); 312 qDebug("BEEP!");
310 } 313 }
311 } else { 314 } else {
312 if ( ! mSilent && mSuspendCounter > 0 ) { 315 if ( ! mSilent && mSuspendCounter > 0 ) {
313 --mSuspendCounter; 316 --mSuspendCounter;
314 reject (); 317 reject ();
315 hide(); 318 hide();
316 return; 319 return;
317 } 320 }
318 } 321 }
319 playSoundTimer->start( mPauseCount * 1000, true ); 322 playSoundTimer->start( mPauseCount * 1000, true );
320} 323}
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index beb19d9..76cce26 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -341,384 +341,389 @@ void CalendarView::init()
341 } 341 }
342#endif 342#endif
343 mFilterView->hide(); 343 mFilterView->hide();
344 QWidget *rightBox = new QWidget( mMainFrame ); 344 QWidget *rightBox = new QWidget( mMainFrame );
345 //mainBoxLayout->addWidget ( rightBox, 10 ); 345 //mainBoxLayout->addWidget ( rightBox, 10 );
346 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 346 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
347 mRightFrame = new QWidgetStack( rightBox ); 347 mRightFrame = new QWidgetStack( rightBox );
348 rightLayout->addWidget( mRightFrame, 10 ); 348 rightLayout->addWidget( mRightFrame, 10 );
349 349
350 //mLeftFrame = (QWidget *)leftFrame; 350 //mLeftFrame = (QWidget *)leftFrame;
351 if ( KOPrefs::instance()->mVerticalScreen ) { 351 if ( KOPrefs::instance()->mVerticalScreen ) {
352 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 352 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
353 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 353 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
354 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 354 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
355 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 355 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
356 } else { 356 } else {
357 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 357 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
358 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 358 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
359 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 359 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
360 } 360 }
361 if ( !KOPrefs::instance()->mShowDateNavigator) 361 if ( !KOPrefs::instance()->mShowDateNavigator)
362 mDateNavigator->hide(); 362 mDateNavigator->hide();
363 //qDebug("Calendarview Size %d %d ", width(), height()); 363 //qDebug("Calendarview Size %d %d ", width(), height());
364#endif 364#endif
365 365
366 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 366 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
367 SLOT( showDates( const KCal::DateList & ) ) ); 367 SLOT( showDates( const KCal::DateList & ) ) );
368 368
369 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 369 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
370 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 370 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
371 371
372 372
373 373
374 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 374 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
375 mViewManager, SLOT( showMonth( const QDate & ) ) ); 375 mViewManager, SLOT( showMonth( const QDate & ) ) );
376 376
377 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 377 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
378 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 378 mNavigator, SLOT( selectWeek( const QDate & ) ) );
379 379
380 connect( mDateNavigator, SIGNAL( goPrevYear() ), 380 connect( mDateNavigator, SIGNAL( goPrevYear() ),
381 mNavigator, SLOT( selectPreviousYear() ) ); 381 mNavigator, SLOT( selectPreviousYear() ) );
382 connect( mDateNavigator, SIGNAL( goNextYear() ), 382 connect( mDateNavigator, SIGNAL( goNextYear() ),
383 mNavigator, SLOT( selectNextYear() ) ); 383 mNavigator, SLOT( selectNextYear() ) );
384 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 384 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
385 mNavigator, SLOT( selectPreviousMonth() ) ); 385 mNavigator, SLOT( selectPreviousMonth() ) );
386 connect( mDateNavigator, SIGNAL( goNextMonth() ), 386 connect( mDateNavigator, SIGNAL( goNextMonth() ),
387 mNavigator, SLOT( selectNextMonth() ) ); 387 mNavigator, SLOT( selectNextMonth() ) );
388 388
389 connect( mDateNavigator, SIGNAL( goPrevious() ), 389 connect( mDateNavigator, SIGNAL( goPrevious() ),
390 mNavigator, SLOT( selectPrevious() ) ); 390 mNavigator, SLOT( selectPrevious() ) );
391 connect( mDateNavigator, SIGNAL( goNext() ), 391 connect( mDateNavigator, SIGNAL( goNext() ),
392 mNavigator, SLOT( selectNext() ) ); 392 mNavigator, SLOT( selectNext() ) );
393 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 393 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
394 mNavigator, SLOT( slotMonthSelect( int ) ) ); 394 mNavigator, SLOT( slotMonthSelect( int ) ) );
395 395
396 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 396 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
397 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 397 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
398#if 0 398#if 0
399 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 399 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
400 SLOT( incidenceAdded( Incidence *) ) ); 400 SLOT( incidenceAdded( Incidence *) ) );
401#endif 401#endif
402 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 402 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
403 403
404 connect( this, SIGNAL( configChanged() ), 404 connect( this, SIGNAL( configChanged() ),
405 mDateNavigator, SLOT( updateConfig() ) ); 405 mDateNavigator, SLOT( updateConfig() ) );
406 406
407 connect( mTodoList, SIGNAL( newTodoSignal() ), 407 connect( mTodoList, SIGNAL( newTodoSignal() ),
408 SLOT( newTodo() ) ); 408 SLOT( newTodo() ) );
409 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 409 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
410 SLOT( newSubTodo( Todo * ) ) ); 410 SLOT( newSubTodo( Todo * ) ) );
411 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 411 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
412 SLOT( editTodo( Todo * ) ) ); 412 SLOT( editTodo( Todo * ) ) );
413 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 413 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
414 SLOT( showTodo( Todo *) ) ); 414 SLOT( showTodo( Todo *) ) );
415 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 415 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
416 SLOT( deleteTodo( Todo *) ) ); 416 SLOT( deleteTodo( Todo *) ) );
417 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 417 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
418 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 418 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
419 SLOT( purgeCompleted() ) ); 419 SLOT( purgeCompleted() ) );
420 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 420 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
421 SIGNAL( todoModified( Todo *, int ) ) ); 421 SIGNAL( todoModified( Todo *, int ) ) );
422 422
423 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 423 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
424 this, SLOT ( cloneIncidence( Incidence * ) ) ); 424 this, SLOT ( cloneIncidence( Incidence * ) ) );
425 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 425 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
426 this, SLOT (cancelIncidence( Incidence * ) ) ); 426 this, SLOT (cancelIncidence( Incidence * ) ) );
427 427
428 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 428 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
429 this, SLOT ( moveIncidence( Incidence * ) ) ); 429 this, SLOT ( moveIncidence( Incidence * ) ) );
430 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 430 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
431 this, SLOT ( beamIncidence( Incidence * ) ) ); 431 this, SLOT ( beamIncidence( Incidence * ) ) );
432 432
433 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 433 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
434 this, SLOT ( todo_unsub( Todo * ) ) ); 434 this, SLOT ( todo_unsub( Todo * ) ) );
435 435
436 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 436 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
437 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 437 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
438 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 438 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
439 SLOT( updateTodo( Todo *, int ) ) ); 439 SLOT( updateTodo( Todo *, int ) ) );
440 connect( this, SIGNAL( todoModified( Todo *, int )), this, 440 connect( this, SIGNAL( todoModified( Todo *, int )), this,
441 SLOT( changeTodoDisplay( Todo *, int ) ) ); 441 SLOT( changeTodoDisplay( Todo *, int ) ) );
442 442
443 443
444 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 444 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
445 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 445 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
446 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 446 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
447 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 447 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
448 448
449 449
450 450
451 451
452 452
453 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 453 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
454 SLOT(checkClipboard())); 454 SLOT(checkClipboard()));
455 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 455 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
456 SLOT( processTodoListSelection( Incidence * ) ) ); 456 SLOT( processTodoListSelection( Incidence * ) ) );
457 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 457 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
458 458
459 // kdDebug() << "CalendarView::CalendarView() done" << endl; 459 // kdDebug() << "CalendarView::CalendarView() done" << endl;
460 460
461 mDateFrame = new QVBox(0,0,WType_Popup); 461 mDateFrame = new QVBox(0,0,WType_Popup);
462 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 462 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
463 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 463 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
464 mDateFrame->setLineWidth(3); 464 mDateFrame->setLineWidth(3);
465 mDateFrame->hide(); 465 mDateFrame->hide();
466 mDateFrame->setCaption( i18n( "Pick a date to display")); 466 mDateFrame->setCaption( i18n( "Pick a date to display"));
467 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 467 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
468 468
469 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 469 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
470 470
471 mEventEditor = mDialogManager->getEventEditor(); 471 mEventEditor = mDialogManager->getEventEditor();
472 mTodoEditor = mDialogManager->getTodoEditor(); 472 mTodoEditor = mDialogManager->getTodoEditor();
473 473
474 mFlagEditDescription = false; 474 mFlagEditDescription = false;
475 475
476 mSuspendTimer = new QTimer( this ); 476 mSuspendTimer = new QTimer( this );
477 mAlarmTimer = new QTimer( this ); 477 mAlarmTimer = new QTimer( this );
478 mRecheckAlarmTimer = new QTimer( this ); 478 mRecheckAlarmTimer = new QTimer( this );
479 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 479 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
480 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 480 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
481 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 481 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
482 mAlarmDialog = new AlarmDialog( this ); 482 mAlarmDialog = new AlarmDialog( this );
483 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 483 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
484 mAlarmDialog->setServerNotification( false ); 484 mAlarmDialog->setServerNotification( false );
485 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 485 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
486 486
487 487
488#ifndef DESKTOP_VERSION 488#ifndef DESKTOP_VERSION
489//US listen for arriving address resultsets 489//US listen for arriving address resultsets
490 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 490 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
491 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 491 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
492#endif 492#endif
493 mDateNavigator->setCalendar( mCalendar ); 493 mDateNavigator->setCalendar( mCalendar );
494} 494}
495 495
496 496
497CalendarView::~CalendarView() 497CalendarView::~CalendarView()
498{ 498{
499 // kdDebug() << "~CalendarView()" << endl; 499 // kdDebug() << "~CalendarView()" << endl;
500 //qDebug("CalendarView::~CalendarView() "); 500 //qDebug("CalendarView::~CalendarView() ");
501 delete mDialogManager; 501 delete mDialogManager;
502 delete mViewManager; 502 delete mViewManager;
503 delete mStorage; 503 delete mStorage;
504 delete mDateFrame ; 504 delete mDateFrame ;
505 delete beamDialog; 505 delete beamDialog;
506 delete mEventViewerDialog; 506 delete mEventViewerDialog;
507 //kdDebug() << "~CalendarView() done" << endl; 507 //kdDebug() << "~CalendarView() done" << endl;
508} 508}
509 509
510void CalendarView::showDay( QDate d ) 510void CalendarView::showDay( QDate d )
511{ 511{
512 dateNavigator()->blockSignals( true ); 512 dateNavigator()->blockSignals( true );
513 dateNavigator()->selectDate( d ); 513 dateNavigator()->selectDate( d );
514 dateNavigator()->blockSignals( false ); 514 dateNavigator()->blockSignals( false );
515 mViewManager->showDayView(); 515 mViewManager->showDayView();
516 //dateNavigator()->selectDate( d ); 516 //dateNavigator()->selectDate( d );
517} 517}
518void CalendarView::timerAlarm() 518void CalendarView::timerAlarm()
519{ 519{
520 //qDebug("CalendarView::timerAlarm() "); 520 //qDebug("CalendarView::timerAlarm() ");
521 computeAlarm(mAlarmNotification ); 521 computeAlarm(mAlarmNotification );
522} 522}
523 523
524void CalendarView::suspendAlarm() 524void CalendarView::suspendAlarm()
525{ 525{
526 //qDebug(" CalendarView::suspendAlarm() "); 526 //qDebug(" CalendarView::suspendAlarm() ");
527 computeAlarm(mSuspendAlarmNotification ); 527 computeAlarm(mSuspendAlarmNotification );
528 528
529} 529}
530 530
531void CalendarView::startAlarm( QString mess , QString filename) 531void CalendarView::startAlarm( QString mess , QString filename)
532{ 532{
533
534 topLevelWidget()->showNormal();
535 topLevelWidget()->setActiveWindow();
536 topLevelWidget()->raise();
537
533 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 538 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
534 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 539 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
535 540
536} 541}
537 542
538void CalendarView::checkNextTimerAlarm() 543void CalendarView::checkNextTimerAlarm()
539{ 544{
540 mCalendar->checkAlarmForIncidence( 0, true ); 545 mCalendar->checkAlarmForIncidence( 0, true );
541} 546}
542 547
543void CalendarView::computeAlarm( QString msg ) 548void CalendarView::computeAlarm( QString msg )
544{ 549{
545 550
546 QString mess = msg; 551 QString mess = msg;
547 QString mAlarmMessage = mess.mid( 9 ); 552 QString mAlarmMessage = mess.mid( 9 );
548 QString filename = MainWindow::resourcePath(); 553 QString filename = MainWindow::resourcePath();
549 filename += "koalarm.wav"; 554 filename += "koalarm.wav";
550 QString tempfilename; 555 QString tempfilename;
551 if ( mess.left( 13 ) == "suspend_alarm") { 556 if ( mess.left( 13 ) == "suspend_alarm") {
552 bool error = false; 557 bool error = false;
553 int len = mess.mid( 13 ).find("+++"); 558 int len = mess.mid( 13 ).find("+++");
554 if ( len < 2 ) 559 if ( len < 2 )
555 error = true; 560 error = true;
556 else { 561 else {
557 tempfilename = mess.mid( 13, len ); 562 tempfilename = mess.mid( 13, len );
558 if ( !QFile::exists( tempfilename ) ) 563 if ( !QFile::exists( tempfilename ) )
559 error = true; 564 error = true;
560 } 565 }
561 if ( ! error ) { 566 if ( ! error ) {
562 filename = tempfilename; 567 filename = tempfilename;
563 } 568 }
564 mAlarmMessage = mess.mid( 13+len+3 ); 569 mAlarmMessage = mess.mid( 13+len+3 );
565 //qDebug("suspend file %s ",tempfilename.latin1() ); 570 //qDebug("suspend file %s ",tempfilename.latin1() );
566 startAlarm( mAlarmMessage, filename); 571 startAlarm( mAlarmMessage, filename);
567 return; 572 return;
568 } 573 }
569 if ( mess.left( 11 ) == "timer_alarm") { 574 if ( mess.left( 11 ) == "timer_alarm") {
570 //mTimerTime = 0; 575 //mTimerTime = 0;
571 startAlarm( mess.mid( 11 ), filename ); 576 startAlarm( mess.mid( 11 ), filename );
572 return; 577 return;
573 } 578 }
574 if ( mess.left( 10 ) == "proc_alarm") { 579 if ( mess.left( 10 ) == "proc_alarm") {
575 bool error = false; 580 bool error = false;
576 int len = mess.mid( 10 ).find("+++"); 581 int len = mess.mid( 10 ).find("+++");
577 if ( len < 2 ) 582 if ( len < 2 )
578 error = true; 583 error = true;
579 else { 584 else {
580 tempfilename = mess.mid( 10, len ); 585 tempfilename = mess.mid( 10, len );
581 if ( !QFile::exists( tempfilename ) ) 586 if ( !QFile::exists( tempfilename ) )
582 error = true; 587 error = true;
583 } 588 }
584 if ( error ) { 589 if ( error ) {
585 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 590 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
586 mAlarmMessage += mess.mid( 10+len+3+9 ); 591 mAlarmMessage += mess.mid( 10+len+3+9 );
587 } else { 592 } else {
588 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 593 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
589 //qDebug("-----system command %s ",tempfilename.latin1() ); 594 //qDebug("-----system command %s ",tempfilename.latin1() );
590#ifndef _WIN32_ 595#ifndef _WIN32_
591 if ( vfork () == 0 ) { 596 if ( vfork () == 0 ) {
592 execl ( tempfilename.latin1(), 0 ); 597 execl ( tempfilename.latin1(), 0 );
593 return; 598 return;
594 } 599 }
595#else 600#else
596 QProcess* p = new QProcess(); 601 QProcess* p = new QProcess();
597 p->addArgument( tempfilename.latin1() ); 602 p->addArgument( tempfilename.latin1() );
598 p->start(); 603 p->start();
599 return; 604 return;
600#endif 605#endif
601 606
602 return; 607 return;
603 } 608 }
604 609
605 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 610 //qDebug("+++++++system command %s ",tempfilename.latin1() );
606 } 611 }
607 if ( mess.left( 11 ) == "audio_alarm") { 612 if ( mess.left( 11 ) == "audio_alarm") {
608 bool error = false; 613 bool error = false;
609 int len = mess.mid( 11 ).find("+++"); 614 int len = mess.mid( 11 ).find("+++");
610 if ( len < 2 ) 615 if ( len < 2 )
611 error = true; 616 error = true;
612 else { 617 else {
613 tempfilename = mess.mid( 11, len ); 618 tempfilename = mess.mid( 11, len );
614 if ( !QFile::exists( tempfilename ) ) 619 if ( !QFile::exists( tempfilename ) )
615 error = true; 620 error = true;
616 } 621 }
617 if ( ! error ) { 622 if ( ! error ) {
618 filename = tempfilename; 623 filename = tempfilename;
619 } 624 }
620 mAlarmMessage = mess.mid( 11+len+3+9 ); 625 mAlarmMessage = mess.mid( 11+len+3+9 );
621 //qDebug("audio file command %s ",tempfilename.latin1() ); 626 //qDebug("audio file command %s ",tempfilename.latin1() );
622 } 627 }
623 if ( mess.left( 9 ) == "cal_alarm") { 628 if ( mess.left( 9 ) == "cal_alarm") {
624 mAlarmMessage = mess.mid( 9 ) ; 629 mAlarmMessage = mess.mid( 9 ) ;
625 } 630 }
626 631
627 startAlarm( mAlarmMessage, filename ); 632 startAlarm( mAlarmMessage, filename );
628 633
629 634
630} 635}
631 636
632void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 637void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
633{ 638{
634 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 639 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
635 640
636 mSuspendAlarmNotification = noti; 641 mSuspendAlarmNotification = noti;
637 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 642 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
638 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 643 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
639 mSuspendTimer->start( ms , true ); 644 mSuspendTimer->start( ms , true );
640 645
641} 646}
642 647
643void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 648void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
644{ 649{
645 mNextAlarmDateTime = qdt; 650 mNextAlarmDateTime = qdt;
646 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 651 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
647 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 652 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
648#ifndef DESKTOP_VERSION 653#ifndef DESKTOP_VERSION
649 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 654 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
650#endif 655#endif
651 return; 656 return;
652 } 657 }
653 int maxSec; 658 int maxSec;
654 //maxSec = 5; //testing only 659 //maxSec = 5; //testing only
655 maxSec = 86400+3600; // one day+1hour 660 maxSec = 86400+3600; // one day+1hour
656 mAlarmNotification = noti; 661 mAlarmNotification = noti;
657 int sec = QDateTime::currentDateTime().secsTo( qdt ); 662 int sec = QDateTime::currentDateTime().secsTo( qdt );
658 if ( sec > maxSec ) { 663 if ( sec > maxSec ) {
659 mRecheckAlarmTimer->start( maxSec * 1000 ); 664 mRecheckAlarmTimer->start( maxSec * 1000 );
660 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 665 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
661 return; 666 return;
662 } else { 667 } else {
663 mRecheckAlarmTimer->stop(); 668 mRecheckAlarmTimer->stop();
664 } 669 }
665 //qDebug("Alarm timer started with secs: %d ", sec); 670 //qDebug("Alarm timer started with secs: %d ", sec);
666 mAlarmTimer->start( sec *1000 , true ); 671 mAlarmTimer->start( sec *1000 , true );
667 672
668} 673}
669// called by mRecheckAlarmTimer to get next alarm 674// called by mRecheckAlarmTimer to get next alarm
670// we need this, because a QTimer has only a max range of 25 days 675// we need this, because a QTimer has only a max range of 25 days
671void CalendarView::recheckTimerAlarm() 676void CalendarView::recheckTimerAlarm()
672{ 677{
673 mAlarmTimer->stop(); 678 mAlarmTimer->stop();
674 mRecheckAlarmTimer->stop(); 679 mRecheckAlarmTimer->stop();
675 mCalendar->checkAlarmForIncidence( 0, true ); 680 mCalendar->checkAlarmForIncidence( 0, true );
676} 681}
677void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 682void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
678{ 683{
679 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 684 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
680 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 685 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
681#ifndef DESKTOP_VERSION 686#ifndef DESKTOP_VERSION
682 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 687 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
683#endif 688#endif
684 return; 689 return;
685 } 690 }
686 mAlarmTimer->stop(); 691 mAlarmTimer->stop();
687} 692}
688void CalendarView::selectWeekNum ( int num ) 693void CalendarView::selectWeekNum ( int num )
689{ 694{
690 dateNavigator()->blockSignals( true ); 695 dateNavigator()->blockSignals( true );
691 dateNavigator()->selectWeek( num ); 696 dateNavigator()->selectWeek( num );
692 dateNavigator()->blockSignals( false ); 697 dateNavigator()->blockSignals( false );
693 mViewManager->showWeekView(); 698 mViewManager->showWeekView();
694} 699}
695KOViewManager *CalendarView::viewManager() 700KOViewManager *CalendarView::viewManager()
696{ 701{
697 return mViewManager; 702 return mViewManager;
698} 703}
699 704
700KODialogManager *CalendarView::dialogManager() 705KODialogManager *CalendarView::dialogManager()
701{ 706{
702 return mDialogManager; 707 return mDialogManager;
703} 708}
704 709
705QDate CalendarView::startDate() 710QDate CalendarView::startDate()
706{ 711{
707 DateList dates = mNavigator->selectedDates(); 712 DateList dates = mNavigator->selectedDates();
708 713
709 return dates.first(); 714 return dates.first();
710} 715}
711 716
712QDate CalendarView::endDate() 717QDate CalendarView::endDate()
713{ 718{
714 DateList dates = mNavigator->selectedDates(); 719 DateList dates = mNavigator->selectedDates();
715 720
716 return dates.last(); 721 return dates.last();
717} 722}
718 723
719 724
720void CalendarView::createPrinter() 725void CalendarView::createPrinter()
721{ 726{
722#ifndef KORG_NOPRINTER 727#ifndef KORG_NOPRINTER
723 if (!mCalPrinter) { 728 if (!mCalPrinter) {
724 mCalPrinter = new CalPrinter(this, mCalendar); 729 mCalPrinter = new CalPrinter(this, mCalendar);
@@ -3905,213 +3910,223 @@ void CalendarView::showIncidence(Incidence *incidence)
3905 } 3910 }
3906 } 3911 }
3907 if ( incidence ) { 3912 if ( incidence ) {
3908 ShowIncidenceVisitor v; 3913 ShowIncidenceVisitor v;
3909 v.act( incidence, this ); 3914 v.act( incidence, this );
3910 } 3915 }
3911} 3916}
3912 3917
3913void CalendarView::editIncidence(Incidence *incidence) 3918void CalendarView::editIncidence(Incidence *incidence)
3914{ 3919{
3915 if ( incidence ) { 3920 if ( incidence ) {
3916 3921
3917 EditIncidenceVisitor v; 3922 EditIncidenceVisitor v;
3918 v.act( incidence, this ); 3923 v.act( incidence, this );
3919 3924
3920 } 3925 }
3921} 3926}
3922 3927
3923void CalendarView::deleteIncidence(Incidence *incidence) 3928void CalendarView::deleteIncidence(Incidence *incidence)
3924{ 3929{
3925 //qDebug(" CalendarView::deleteIncidence "); 3930 //qDebug(" CalendarView::deleteIncidence ");
3926 if ( incidence ) { 3931 if ( incidence ) {
3927 DeleteIncidenceVisitor v; 3932 DeleteIncidenceVisitor v;
3928 v.act( incidence, this ); 3933 v.act( incidence, this );
3929 } 3934 }
3930} 3935}
3931 3936
3932 3937
3933void CalendarView::lookForOutgoingMessages() 3938void CalendarView::lookForOutgoingMessages()
3934{ 3939{
3935 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 3940 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
3936 ogd->loadMessages(); 3941 ogd->loadMessages();
3937} 3942}
3938 3943
3939void CalendarView::lookForIncomingMessages() 3944void CalendarView::lookForIncomingMessages()
3940{ 3945{
3941 IncomingDialog *icd = mDialogManager->incomingDialog(); 3946 IncomingDialog *icd = mDialogManager->incomingDialog();
3942 icd->retrieve(); 3947 icd->retrieve();
3943} 3948}
3944 3949
3945bool CalendarView::removeCompletedSubTodos( Todo* t ) 3950bool CalendarView::removeCompletedSubTodos( Todo* t )
3946{ 3951{
3947 bool deleteTodo = true; 3952 bool deleteTodo = true;
3948 QPtrList<Incidence> subTodos; 3953 QPtrList<Incidence> subTodos;
3949 Incidence *aTodo; 3954 Incidence *aTodo;
3950 subTodos = t->relations(); 3955 subTodos = t->relations();
3951 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 3956 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3952 if (! removeCompletedSubTodos( (Todo*) aTodo )) 3957 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3953 deleteTodo = false; 3958 deleteTodo = false;
3954 } 3959 }
3955 if ( deleteTodo ) { 3960 if ( deleteTodo ) {
3956 if ( t->isCompleted() && !t->doesRecur()) { 3961 if ( t->isCompleted() && !t->doesRecur()) {
3957 checkExternalId( t ); 3962 checkExternalId( t );
3958 mCalendar->deleteTodo( t ); 3963 mCalendar->deleteTodo( t );
3959 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 3964 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3960 } 3965 }
3961 else 3966 else
3962 deleteTodo = false; 3967 deleteTodo = false;
3963 } 3968 }
3964 return deleteTodo; 3969 return deleteTodo;
3965 3970
3966} 3971}
3967void CalendarView::purgeCompleted() 3972void CalendarView::purgeCompleted()
3968{ 3973{
3969 int result = KMessageBox::warningContinueCancel(this, 3974 int result = KMessageBox::warningContinueCancel(this,
3970 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); 3975 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge"));
3971 3976
3972 if (result == KMessageBox::Continue) { 3977 if (result == KMessageBox::Continue) {
3973 3978
3974 QPtrList<Todo> todoCal; 3979 QPtrList<Todo> todoCal;
3975 QPtrList<Todo> rootTodos; 3980 QPtrList<Todo> rootTodos;
3976 //QPtrList<Incidence> rel; 3981 //QPtrList<Incidence> rel;
3977 Todo *aTodo;//, *rTodo; 3982 Todo *aTodo;//, *rTodo;
3978 Incidence *rIncidence; 3983 Incidence *rIncidence;
3979 bool childDelete = false; 3984 bool childDelete = false;
3980 bool deletedOne = true; 3985 bool deletedOne = true;
3981 todoCal = calendar()->todos(); 3986 todoCal = calendar()->todos();
3982 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 3987 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
3983 if ( !aTodo->relatedTo() ) 3988 if ( !aTodo->relatedTo() )
3984 rootTodos.append( aTodo ); 3989 rootTodos.append( aTodo );
3985 } 3990 }
3986 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3991 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3987 removeCompletedSubTodos( aTodo ); 3992 removeCompletedSubTodos( aTodo );
3988 } 3993 }
3989 3994
3990 updateView(); 3995 updateView();
3991 } 3996 }
3992} 3997}
3993 3998
3994void CalendarView::slotCalendarChanged() 3999void CalendarView::slotCalendarChanged()
3995{ 4000{
3996 ; 4001 ;
3997} 4002}
3998 4003
3999void CalendarView::keyPressEvent ( QKeyEvent *e) 4004void CalendarView::keyPressEvent ( QKeyEvent *e)
4000{ 4005{
4001 //qDebug(" alendarView::keyPressEvent "); 4006 //qDebug(" alendarView::keyPressEvent ");
4002 e->ignore(); 4007 e->ignore();
4003} 4008}
4004 4009
4005 4010
4006bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 4011bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
4007{ 4012{
4008 // mSyncManager = manager; 4013 // mSyncManager = manager;
4009 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 4014 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
4010 qDebug("KO: SyncKDE request detected!"); 4015 qDebug("KO: SyncKDE request detected!");
4011 } 4016 }
4012 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4017 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4013 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4018 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4014 return syncCalendar( filename, mode ); 4019 return syncCalendar( filename, mode );
4015} 4020}
4016bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 4021bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
4017{ 4022{
4018 //mSyncManager = manager; 4023 //mSyncManager = manager;
4019 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4024 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4020 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4025 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4021 if ( resource == "sharp" ) 4026 if ( resource == "sharp" )
4022 syncExternal( 0 ); 4027 syncExternal( 0 );
4023 if ( resource == "phone" ) 4028 if ( resource == "phone" )
4024 syncExternal( 1 ); 4029 syncExternal( 1 );
4025 // pending setmodified 4030 // pending setmodified
4026 return true; 4031 return true;
4027} 4032}
4028void CalendarView::setSyncManager(KSyncManager* manager) 4033void CalendarView::setSyncManager(KSyncManager* manager)
4029{ 4034{
4030 mSyncManager = manager; 4035 mSyncManager = manager;
4031} 4036}
4032 4037
4033void CalendarView::removeSyncInfo( QString syncProfile) 4038void CalendarView::removeSyncInfo( QString syncProfile)
4034{ 4039{
4035 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 4040 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
4036 mCalendar->removeSyncInfo( syncProfile ); 4041 mCalendar->removeSyncInfo( syncProfile );
4037 4042
4038} 4043}
4039 4044
4040void CalendarView::undo_delete() 4045void CalendarView::undo_delete()
4041{ 4046{
4042 //qDebug("undo_delete() "); 4047 //qDebug("undo_delete() ");
4043 Incidence* undo = mCalendar->undoIncidence(); 4048 Incidence* undo = mCalendar->undoIncidence();
4044 if ( !undo ) { 4049 if ( !undo ) {
4045 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 4050 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
4046 i18n("KO/Pi")); 4051 i18n("KO/Pi"));
4047 return; 4052 return;
4048 } 4053 }
4049 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 4054 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
4050 i18n("\nAre you sure you want\nto restore this?"), 4055 i18n("\nAre you sure you want\nto restore this?"),
4051 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 4056 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
4052 mCalendar->undoDeleteIncidence(); 4057 mCalendar->undoDeleteIncidence();
4053 updateView(); 4058 updateView();
4054 } 4059 }
4055} 4060}
4056 4061
4057void CalendarView::slotViewerClosed() 4062void CalendarView::slotViewerClosed()
4058{ 4063{
4059 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 4064 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
4060} 4065}
4061 4066
4062void CalendarView::resetFocus() 4067void CalendarView::resetFocus()
4063{ 4068{
4064 if ( mViewerCallerIsSearchDialog ) { 4069 if ( mViewerCallerIsSearchDialog ) {
4065 if ( mDialogManager->getSearchDialog()->isVisible() ){ 4070 if ( mDialogManager->getSearchDialog()->isVisible() ){
4066 mDialogManager->getSearchDialog()->raise(); 4071 mDialogManager->getSearchDialog()->raise();
4067 mDialogManager->getSearchDialog()->setActiveWindow(); 4072 mDialogManager->getSearchDialog()->setActiveWindow();
4068 mDialogManager->getSearchDialog()->listview()->resetFocus(); 4073 mDialogManager->getSearchDialog()->listview()->resetFocus();
4069 } else 4074 } else
4070 mViewerCallerIsSearchDialog = false; 4075 mViewerCallerIsSearchDialog = false;
4071 } 4076 }
4072 if ( !mViewerCallerIsSearchDialog ) { 4077 if ( !mViewerCallerIsSearchDialog ) {
4073 //mViewManager->currentView()->setFocus(); 4078 //mViewManager->currentView()->setFocus();
4074 //qDebug("sssssssssssssssset focus "); 4079 //qDebug("sssssssssssssssset focus ");
4075 topLevelWidget()->raise(); 4080 topLevelWidget()->raise();
4076 setActiveWindow(); 4081 setActiveWindow();
4077 //setFocus(); 4082 //setFocus();
4078 } 4083 }
4079 mViewerCallerIsSearchDialog = false; 4084 mViewerCallerIsSearchDialog = false;
4080} 4085}
4081 4086
4082void CalendarView::showNextAlarms() 4087void CalendarView::showNextAlarms()
4083{ 4088{
4084 QString message; 4089 QString message;
4085 QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); 4090 QDateTime nextAl = mCalendar->nextAlarmEventDateTime();
4086 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { 4091 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) {
4087 QString sum = mCalendar->nextSummary(); 4092 QString sum = mCalendar->nextSummary();
4088 QDateTime nextA = mNextAlarmDateTime; 4093 QDateTime nextA = mNextAlarmDateTime;
4089 QDateTime cur = QDateTime::currentDateTime(); 4094 QDateTime cur = QDateTime::currentDateTime();
4090 int secs = cur.secsTo( nextA ); 4095 int secs = cur.secsTo( nextA );
4091 int min = secs /60; 4096 int min = secs /60;
4092 int hours = min /60; 4097 int hours = min /60;
4093 min = min % 60; 4098 min = min % 60;
4094 int days = hours /24; 4099 int days = hours /24;
4095 hours = hours % 24; 4100 hours = hours % 24;
4096 4101
4097 message = i18n("The next alarm is in:\n"); 4102 //message = i18n("The next alarm is in:\n");
4098 if ( days > 1 ) 4103 if ( days > 1 )
4099 message += i18n("%1 days\n").arg( days ); 4104 message += i18n("%1 days\n").arg( days );
4100 else if ( days == 1 ) 4105 else if ( days == 1 )
4101 message += i18n("1 day\n"); 4106 message += i18n("1 day\n");
4102 if ( hours > 1 ) 4107 if ( hours > 1 )
4103 message += i18n("%1 hours\n").arg( hours ); 4108 message += i18n("%1 hours\n").arg( hours );
4104 else if ( hours == 1 ) 4109 else if ( hours == 1 )
4105 message += i18n("1 hour\n"); 4110 message += i18n("1 hour\n");
4106 if ( min > 1 ) 4111 if ( min > 1 )
4107 message += i18n("%1 minutes\n").arg( min ); 4112 message += i18n("%1 minutes\n").arg( min );
4108 else if ( min == 1 ) 4113 else if ( min == 1 )
4109 message += i18n("1 minute\n"); 4114 message += i18n("1 minute\n");
4110 4115 if ( message.isEmpty() )
4116 message = i18n("The next alarm is in\nless than one minute!");
4117 else
4118 message = i18n("The next alarm is in:\n") + message;
4111 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; 4119 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ;
4112 } else { 4120 } else {
4113 message = i18n("There is no next alarm."); 4121 message = i18n("There is no next alarm.");
4114 4122
4115 } 4123 }
4124#ifdef DESKTOP_VERSION
4125 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
4126 message += i18n("\nThe internal alarm notification is disabled!\n");
4127 message += i18n("Enable it in the settings menu, TAB alarm.");
4128 }
4129
4130#endif
4116 KMessageBox::information( this, message); 4131 KMessageBox::information( this, message);
4117} 4132}
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index d450a97..6d1e6d5 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1,410 +1,410 @@
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 myPix.resize( 1, 1 ); 84 myPix.resize( 1, 1 );
85 mRows = rows; 85 mRows = rows;
86 86
87 mRedrawNeeded = true; 87 mRedrawNeeded = true;
88 setMinimumHeight( 20 ); 88 setMinimumHeight( 20 );
89 mCellHeight = KOPrefs::instance()->mHourSize*4; 89 mCellHeight = KOPrefs::instance()->mHourSize*4;
90 90
91 enableClipper(true); 91 enableClipper(true);
92 92
93 setHScrollBarMode(AlwaysOff); 93 setHScrollBarMode(AlwaysOff);
94 setVScrollBarMode(AlwaysOff); 94 setVScrollBarMode(AlwaysOff);
95 95
96 resizeContents(50,mRows * mCellHeight); 96 resizeContents(50,mRows * mCellHeight);
97 97
98 viewport()->setBackgroundMode( PaletteBackground ); 98 viewport()->setBackgroundMode( PaletteBackground );
99} 99}
100 100
101void TimeLabels::setCellHeight(int height) 101void TimeLabels::setCellHeight(int height)
102{ 102{
103 mCellHeight = height; 103 mCellHeight = height;
104} 104}
105 105
106/* 106/*
107 Optimization so that only the "dirty" portion of the scroll view 107 Optimization so that only the "dirty" portion of the scroll view
108 is redrawn. Unfortunately, this is not called by default paintEvent() method. 108 is redrawn. Unfortunately, this is not called by default paintEvent() method.
109*/ 109*/
110void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) 110void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
111{ 111{
112 112
113 cx = contentsX() + frameWidth()*2; 113 cx = contentsX() + frameWidth()*2;
114 cw = contentsWidth() ; 114 cw = contentsWidth() ;
115 // end of workaround 115 // end of workaround
116 116
117 int cell = ((int)(cy/mCellHeight)); 117 int cell = ((int)(cy/mCellHeight));
118 int y = cell * mCellHeight; 118 int y = cell * mCellHeight;
119 QFontMetrics fm = fontMetrics(); 119 QFontMetrics fm = fontMetrics();
120 QString hour; 120 QString hour;
121 QString suffix = "am"; 121 QString suffix = "am";
122 int timeHeight = fm.ascent(); 122 int timeHeight = fm.ascent();
123 QFont nFont = font(); 123 QFont nFont = font();
124 p->setFont( font()); 124 p->setFont( font());
125 125
126 if (!KGlobal::locale()->use12Clock()) { 126 if (!KGlobal::locale()->use12Clock()) {
127 suffix = "00"; 127 suffix = "00";
128 } else 128 } else
129 if (cell > 11) suffix = "pm"; 129 if (cell > 11) suffix = "pm";
130 130
131 if ( timeHeight > mCellHeight ) { 131 if ( timeHeight > mCellHeight ) {
132 timeHeight = mCellHeight-1; 132 timeHeight = mCellHeight-1;
133 int pointS = nFont.pointSize(); 133 int pointS = nFont.pointSize();
134 while ( pointS > 4 ) { 134 while ( pointS > 4 ) {
135 nFont.setPointSize( pointS ); 135 nFont.setPointSize( pointS );
136 fm = QFontMetrics( nFont ); 136 fm = QFontMetrics( nFont );
137 if ( fm.ascent() < mCellHeight ) 137 if ( fm.ascent() < mCellHeight )
138 break; 138 break;
139 -- pointS; 139 -- pointS;
140 } 140 }
141 fm = QFontMetrics( nFont ); 141 fm = QFontMetrics( nFont );
142 timeHeight = fm.ascent(); 142 timeHeight = fm.ascent();
143 } 143 }
144 //timeHeight -= (timeHeight/4-2); 144 //timeHeight -= (timeHeight/4-2);
145 QFont sFont = nFont; 145 QFont sFont = nFont;
146 sFont.setPointSize( sFont.pointSize()/2 ); 146 sFont.setPointSize( sFont.pointSize()/2 );
147 QFontMetrics fmS( sFont ); 147 QFontMetrics fmS( sFont );
148 int sHei = fmS.ascent() ; 148 int sHei = fmS.ascent() ;
149 //sHei -= (sHei/4-2); 149 //sHei -= (sHei/4-2);
150 int startW = mMiniWidth - frameWidth()-2 ; 150 int startW = mMiniWidth - frameWidth()-2 ;
151 int tw2 = fmS.width(suffix); 151 int tw2 = fmS.width(suffix);
152 timeHeight = (timeHeight-1) /2 -1; 152 timeHeight = (timeHeight-1) /2 -1;
153 //testline 153 //testline
154 //p->drawLine(0,0,0,contentsHeight()); 154 //p->drawLine(0,0,0,contentsHeight());
155 while (y < cy + ch+mCellHeight) { 155 while (y < cy + ch+mCellHeight) {
156 p->drawLine(startW-tw2 ,y,cw+2,y); 156 p->drawLine(startW-tw2+1 ,y,cw+2,y);
157 hour.setNum(cell); 157 hour.setNum(cell);
158 // handle 24h and am/pm time formats 158 // handle 24h and am/pm time formats
159 if (KGlobal::locale()->use12Clock()) { 159 if (KGlobal::locale()->use12Clock()) {
160 if (cell == 12) suffix = "pm"; 160 if (cell == 12) suffix = "pm";
161 if (cell == 0) hour.setNum(12); 161 if (cell == 0) hour.setNum(12);
162 if (cell > 12) hour.setNum(cell - 12); 162 if (cell > 12) hour.setNum(cell - 12);
163 } 163 }
164 164
165 // center and draw the time label 165 // center and draw the time label
166 int timeWidth = fm.width(hour); 166 int timeWidth = fm.width(hour);
167 int offset = startW - timeWidth - tw2 -1 ; 167 int offset = startW - timeWidth - tw2 -1 ;
168 p->setFont( nFont ); 168 p->setFont( nFont );
169 p->drawText( offset, y+ timeHeight, hour); 169 p->drawText( offset, y+ timeHeight, hour);
170 p->setFont( sFont ); 170 p->setFont( sFont );
171 offset = startW - tw2; 171 offset = startW - tw2;
172 p->drawText( offset, y -1, suffix); 172 p->drawText( offset, y -1, suffix);
173 173
174 // increment indices 174 // increment indices
175 y += mCellHeight; 175 y += mCellHeight;
176 cell++; 176 cell++;
177 } 177 }
178 178
179 179
180 180
181 181
182} 182}
183 183
184/** 184/**
185 Calculates the minimum width. 185 Calculates the minimum width.
186*/ 186*/
187int TimeLabels::minimumWidth() const 187int TimeLabels::minimumWidth() const
188{ 188{
189 return mMiniWidth; 189 return mMiniWidth;
190} 190}
191 191
192/** updates widget's internal state */ 192/** updates widget's internal state */
193void TimeLabels::updateConfig() 193void TimeLabels::updateConfig()
194{ 194{
195 mRedrawNeeded = true; 195 mRedrawNeeded = true;
196 // set the font 196 // set the font
197 // config->setGroup("Fonts"); 197 // config->setGroup("Fonts");
198 // QFont font = config->readFontEntry("TimeBar Font"); 198 // QFont font = config->readFontEntry("TimeBar Font");
199 setFont(KOPrefs::instance()->mTimeBarFont); 199 setFont(KOPrefs::instance()->mTimeBarFont);
200 QString test = "20"; 200 QString test = "20";
201 if (KGlobal::locale()->use12Clock()) 201 if (KGlobal::locale()->use12Clock())
202 test = "12"; 202 test = "12";
203 mMiniWidth = fontMetrics().width(test); 203 mMiniWidth = fontMetrics().width(test);
204 if (KGlobal::locale()->use12Clock()) 204 if (KGlobal::locale()->use12Clock())
205 test = "pm"; 205 test = "pm";
206 else { 206 else {
207 test = "00"; 207 test = "00";
208 } 208 }
209 QFont sFont = font(); 209 QFont sFont = font();
210 sFont.setPointSize( sFont.pointSize()/2 ); 210 sFont.setPointSize( sFont.pointSize()/2 );
211 QFontMetrics fmS( sFont ); 211 QFontMetrics fmS( sFont );
212 mMiniWidth += fmS.width( test ) + frameWidth()*2+4 ; 212 mMiniWidth += fmS.width( test ) + frameWidth()*2+4 ;
213 // update geometry restrictions based on new settings 213 // update geometry restrictions based on new settings
214 setFixedWidth( mMiniWidth ); 214 setFixedWidth( mMiniWidth );
215 215
216 // update HourSize 216 // update HourSize
217 mCellHeight = KOPrefs::instance()->mHourSize*4; 217 mCellHeight = KOPrefs::instance()->mHourSize*4;
218 resizeContents(50,mRows * mCellHeight); 218 resizeContents(mMiniWidth,mRows * mCellHeight+1);
219} 219}
220 220
221/** update time label positions */ 221/** update time label positions */
222void TimeLabels::positionChanged() 222void TimeLabels::positionChanged()
223{ 223{
224 int adjustment = mAgenda->contentsY(); 224 int adjustment = mAgenda->contentsY();
225 setContentsPos(0, adjustment); 225 setContentsPos(0, adjustment);
226} 226}
227 227
228/** */ 228/** */
229void TimeLabels::setAgenda(KOAgenda* agenda) 229void TimeLabels::setAgenda(KOAgenda* agenda)
230{ 230{
231 mAgenda = agenda; 231 mAgenda = agenda;
232} 232}
233 233
234void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) 234void TimeLabels::contentsMousePressEvent ( QMouseEvent * e)
235{ 235{
236 mMouseDownY = e->pos().y(); 236 mMouseDownY = e->pos().y();
237 mOrgCap = topLevelWidget()->caption(); 237 mOrgCap = topLevelWidget()->caption();
238} 238}
239 239
240void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) 240void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e )
241{ 241{
242 int diff = mMouseDownY - e->pos().y(); 242 int diff = mMouseDownY - e->pos().y();
243 if ( diff < 10 && diff > -10 ) 243 if ( diff < 10 && diff > -10 )
244 return; 244 return;
245 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; 245 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ;
246 if ( tSize < 4 ) 246 if ( tSize < 4 )
247 tSize = 4; 247 tSize = 4;
248 if ( tSize > 22 ) 248 if ( tSize > 22 )
249 tSize = 22; 249 tSize = 22;
250 tSize = (tSize-2)/2; 250 tSize = (tSize-2)/2;
251 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); 251 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize));
252 252
253} 253}
254void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) 254void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e )
255{ 255{
256 topLevelWidget()->setCaption( mOrgCap ); 256 topLevelWidget()->setCaption( mOrgCap );
257 int diff = mMouseDownY - e->pos().y(); 257 int diff = mMouseDownY - e->pos().y();
258 if ( diff < 10 && diff > -10 ) 258 if ( diff < 10 && diff > -10 )
259 return; 259 return;
260 int tSize = KOPrefs::instance()->mHourSize + (diff/10); 260 int tSize = KOPrefs::instance()->mHourSize + (diff/10);
261 if ( tSize < 4 ) 261 if ( tSize < 4 )
262 tSize = 4; 262 tSize = 4;
263 if ( tSize > 22 ) 263 if ( tSize > 22 )
264 tSize = 22; 264 tSize = 22;
265 tSize = (tSize/2)*2; 265 tSize = (tSize/2)*2;
266 if ( tSize == KOPrefs::instance()->mHourSize ) 266 if ( tSize == KOPrefs::instance()->mHourSize )
267 return; 267 return;
268 KOPrefs::instance()->mHourSize = tSize; 268 KOPrefs::instance()->mHourSize = tSize;
269 emit scaleChanged(); 269 emit scaleChanged();
270} 270}
271 271
272/** This is called in response to repaint() */ 272/** This is called in response to repaint() */
273void TimeLabels::paintEvent(QPaintEvent*) 273void TimeLabels::paintEvent(QPaintEvent*)
274{ 274{
275 275
276 // kdDebug() << "paintevent..." << endl; 276 // kdDebug() << "paintevent..." << endl;
277 // this is another hack! 277 // this is another hack!
278 // QPainter painter(this); 278 // QPainter painter(this);
279 //QString c 279 //QString c
280 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); 280 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight());
281} 281}
282 282
283//////////////////////////////////////////////////////////////////////////// 283////////////////////////////////////////////////////////////////////////////
284 284
285EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) 285EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name)
286 : QFrame(parent,name) 286 : QFrame(parent,name)
287{ 287{
288 mColumns = 1; 288 mColumns = 1;
289 mTopBox = 0; 289 mTopBox = 0;
290 mLocation = loc; 290 mLocation = loc;
291 mTopLayout = 0; 291 mTopLayout = 0;
292 mPaintWidget = 0; 292 mPaintWidget = 0;
293 mXOffset = 0; 293 mXOffset = 0;
294 if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); 294 if (mLocation == Top) mPixmap = SmallIcon("1uparrow");
295 else mPixmap = SmallIcon("1downarrow"); 295 else mPixmap = SmallIcon("1downarrow");
296 mEnabled.resize(mColumns); 296 mEnabled.resize(mColumns);
297 mEnabled.fill( false ); 297 mEnabled.fill( false );
298 setMinimumHeight(mPixmap.height()); 298 setMinimumHeight(mPixmap.height());
299} 299}
300 300
301EventIndicator::~EventIndicator() 301EventIndicator::~EventIndicator()
302{ 302{
303} 303}
304 304
305void EventIndicator::drawContents(QPainter *p) 305void EventIndicator::drawContents(QPainter *p)
306{ 306{
307 307
308 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; 308 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl;
309 KDGanttSplitterHandle* han = 0; 309 KDGanttSplitterHandle* han = 0;
310 if ( mPaintWidget ) 310 if ( mPaintWidget )
311 han = mPaintWidget->firstHandle(); 311 han = mPaintWidget->firstHandle();
312 if ( ! han ) { 312 if ( ! han ) {
313 int i; 313 int i;
314 for(i=0;i<mColumns;++i) { 314 for(i=0;i<mColumns;++i) {
315 if (mEnabled[i]) { 315 if (mEnabled[i]) {
316 int cellWidth = contentsRect().right()/mColumns; 316 int cellWidth = contentsRect().right()/mColumns;
317 int xOffset = KOGlobals::self()->reverseLayout() ? 317 int xOffset = KOGlobals::self()->reverseLayout() ?
318 (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : 318 (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 :
319 i*cellWidth + (cellWidth -mPixmap.width()) /2; 319 i*cellWidth + (cellWidth -mPixmap.width()) /2;
320 p->drawPixmap(QPoint(1+xOffset,0),mPixmap); 320 p->drawPixmap(QPoint(1+xOffset,0),mPixmap);
321 } 321 }
322 } 322 }
323 } else { 323 } else {
324 han->repaint(); 324 han->repaint();
325 //mPaintWidget->setBackgroundColor( red ); 325 //mPaintWidget->setBackgroundColor( red );
326 326
327 QPainter pa( han ); 327 QPainter pa( han );
328 int i; 328 int i;
329 bool setColor = false; 329 bool setColor = false;
330 for(i=0;i<mColumns;++i) { 330 for(i=0;i<mColumns;++i) {
331 if (mEnabled[i]) { 331 if (mEnabled[i]) {
332 setColor = true; 332 setColor = true;
333 333
334 int cellWidth = contentsRect().right()/mColumns; 334 int cellWidth = contentsRect().right()/mColumns;
335 int xOffset = KOGlobals::self()->reverseLayout() ? 335 int xOffset = KOGlobals::self()->reverseLayout() ?
336 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : 336 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 :
337 i*cellWidth + cellWidth/2 -mPixmap.width()/2; 337 i*cellWidth + cellWidth/2 -mPixmap.width()/2;
338 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); 338 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap);
339 //qDebug("222draw pix %d ",xOffset ); 339 //qDebug("222draw pix %d ",xOffset );
340 340
341 } 341 }
342 342
343 } 343 }
344 pa.end(); 344 pa.end();
345 345
346 } 346 }
347} 347}
348 348
349void EventIndicator::setXOffset( int x ) 349void EventIndicator::setXOffset( int x )
350{ 350{
351 mXOffset = x; 351 mXOffset = x;
352} 352}
353void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) 353void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w )
354{ 354{
355 mPaintWidget = w; 355 mPaintWidget = w;
356 setMaximumHeight(0); 356 setMaximumHeight(0);
357 setMinimumHeight(0); 357 setMinimumHeight(0);
358} 358}
359void EventIndicator::changeColumns(int columns) 359void EventIndicator::changeColumns(int columns)
360{ 360{
361 mColumns = columns; 361 mColumns = columns;
362 mEnabled.resize(mColumns); 362 mEnabled.resize(mColumns);
363 363
364 update(); 364 update();
365} 365}
366 366
367void EventIndicator::enableColumn(int column, bool enable) 367void EventIndicator::enableColumn(int column, bool enable)
368{ 368{
369 mEnabled[column] = enable; 369 mEnabled[column] = enable;
370} 370}
371 371
372 372
373//////////////////////////////////////////////////////////////////////////// 373////////////////////////////////////////////////////////////////////////////
374//////////////////////////////////////////////////////////////////////////// 374////////////////////////////////////////////////////////////////////////////
375//////////////////////////////////////////////////////////////////////////// 375////////////////////////////////////////////////////////////////////////////
376 376
377KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : 377KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
378 KOEventView (cal,parent,name) 378 KOEventView (cal,parent,name)
379{ 379{
380 mBlockUpdating = true; 380 mBlockUpdating = true;
381 mStartHour = 8; 381 mStartHour = 8;
382 mSelectedDates.append(QDate::currentDate()); 382 mSelectedDates.append(QDate::currentDate());
383 383
384 mLayoutDayLabels = 0; 384 mLayoutDayLabels = 0;
385 mDayLabelsFrame = 0; 385 mDayLabelsFrame = 0;
386 mDayLabels = 0; 386 mDayLabels = 0;
387 bool isRTL = KOGlobals::self()->reverseLayout(); 387 bool isRTL = KOGlobals::self()->reverseLayout();
388 QPixmap expandPix; 388 QPixmap expandPix;
389 if ( KOPrefs::instance()->mVerticalScreen ) { 389 if ( KOPrefs::instance()->mVerticalScreen ) {
390 expandPix = SmallIcon( "1updownarrow" ); 390 expandPix = SmallIcon( "1updownarrow" );
391 } else { 391 } else {
392 expandPix = SmallIcon("1leftrightarrow" ); 392 expandPix = SmallIcon("1leftrightarrow" );
393 } 393 }
394 394
395 QBoxLayout *topLayout = new QVBoxLayout(this); 395 QBoxLayout *topLayout = new QVBoxLayout(this);
396 396
397 // Create day name labels for agenda columns 397 // Create day name labels for agenda columns
398 // Create agenda splitter 398 // Create agenda splitter
399 399
400 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); 400 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this);
401 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 401 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
402 topLayout->addWidget( mSplitterAgenda ); 402 topLayout->addWidget( mSplitterAgenda );
403 mAllDayFrame = new QHBox(mSplitterAgenda); 403 mAllDayFrame = new QHBox(mSplitterAgenda);
404 mAllDayFrame->setFocusPolicy(NoFocus); 404 mAllDayFrame->setFocusPolicy(NoFocus);
405 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 405 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
406 agendaFrame->setFocusPolicy(NoFocus); 406 agendaFrame->setFocusPolicy(NoFocus);
407 407
408 // Create all-day agenda widget 408 // Create all-day agenda widget
409 mDummyAllDayLeft = new QVBox( mAllDayFrame ); 409 mDummyAllDayLeft = new QVBox( mAllDayFrame );
410 410
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index b14ca43..abc80d4 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -38,437 +38,434 @@
38#include <kiconloader.h> 38#include <kiconloader.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40#include <kfiledialog.h> 40#include <kfiledialog.h>
41#include <kstandarddirs.h> 41#include <kstandarddirs.h>
42 42
43#include <libkcal/todo.h> 43#include <libkcal/todo.h>
44#include <libkcal/event.h> 44#include <libkcal/event.h>
45#include <libkdepim/categoryselectdialog.h> 45#include <libkdepim/categoryselectdialog.h>
46#include <libkdepim/kdateedit.h> 46#include <libkdepim/kdateedit.h>
47 47
48#include "koprefs.h" 48#include "koprefs.h"
49#include "koglobals.h" 49#include "koglobals.h"
50 50
51#include "koeditorgeneral.h" 51#include "koeditorgeneral.h"
52#include "kolocationbox.h" 52#include "kolocationbox.h"
53#ifndef DESKTOP_VERSION 53#ifndef DESKTOP_VERSION
54#include <qpe/qpeapplication.h> 54#include <qpe/qpeapplication.h>
55#else 55#else
56#include <qapplication.h> 56#include <qapplication.h>
57#endif 57#endif
58 58
59KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 59KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
60 QObject( parent, name) 60 QObject( parent, name)
61{ 61{
62} 62}
63 63
64KOEditorGeneral::~KOEditorGeneral() 64KOEditorGeneral::~KOEditorGeneral()
65{ 65{
66} 66}
67 67
68void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 68void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
69{ 69{
70 QGridLayout *headerLayout = new QGridLayout(topLayout); 70 QGridLayout *headerLayout = new QGridLayout(topLayout);
71 71
72#if 0 72#if 0
73 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 73 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
74 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 74 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
75#endif 75#endif
76 76
77 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 77 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
78 headerLayout->addWidget(summaryLabel,1,0); 78 headerLayout->addWidget(summaryLabel,1,0);
79 79
80 mSummaryEdit = new KOLocationBox(TRUE,parent, 10); 80 mSummaryEdit = new KOLocationBox(TRUE,parent, 10);
81 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 81 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
82 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 82 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
83 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 83 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
84 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 84 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
85 if ( QApplication::desktop()->width() > 320 ) 85 if ( QApplication::desktop()->width() > 320 )
86 mSummaryEdit->setMaximumHeight( hei +6 ); 86 mSummaryEdit->setMaximumHeight( hei +6 );
87 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 87 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
88 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 88 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
89 // mSummaryEdit = new QLineEdit(parent); 89 // mSummaryEdit = new QLineEdit(parent);
90 headerLayout->addWidget(mSummaryEdit,1,1); 90 headerLayout->addWidget(mSummaryEdit,1,1);
91 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 91 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
92 92
93 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 93 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
94 headerLayout->addWidget(locationLabel,2,0); 94 headerLayout->addWidget(locationLabel,2,0);
95 95
96 mLocationEdit = new KOLocationBox(TRUE,parent,10); 96 mLocationEdit = new KOLocationBox(TRUE,parent,10);
97 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 97 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
98 if ( QApplication::desktop()->width() > 320 ) 98 if ( QApplication::desktop()->width() > 320 )
99 mLocationEdit->setMaximumHeight( hei + 6); 99 mLocationEdit->setMaximumHeight( hei + 6);
100 100
101 // mLocationEdit = new QLineEdit(parent); 101 // mLocationEdit = new QLineEdit(parent);
102 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 102 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
103 headerLayout->addWidget(mLocationEdit,2,1); 103 headerLayout->addWidget(mLocationEdit,2,1);
104 headerLayout->setColStretch( 1, 10); 104 headerLayout->setColStretch( 1, 10);
105} 105}
106void KOEditorGeneral::setFocusOn( int i ) 106void KOEditorGeneral::setFocusOn( int i )
107{ 107{
108 qApp->processEvents(); 108 qApp->processEvents();
109 if ( i == 1 ) { 109 if ( i == 1 ) {
110 mDescriptionEdit->setFocus(); 110 mDescriptionEdit->setFocus();
111 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 111 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
112 } 112 }
113 if ( i == 2 ) { 113 if ( i == 2 ) {
114 mSummaryEdit->setFocus(); 114 mSummaryEdit->setFocus();
115 } 115 }
116 116
117} 117}
118void KOEditorGeneral::editCategories() 118void KOEditorGeneral::editCategories()
119{ 119{
120 // qDebug("KOEditorGeneral::editCategories() "); 120 // qDebug("KOEditorGeneral::editCategories() ");
121 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 121 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
122 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 122 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
123 //KOGlobals::fitDialogToScreen( csd ); 123 //KOGlobals::fitDialogToScreen( csd );
124 csd->setColorEnabled(); 124 csd->setColorEnabled();
125 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 125 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
126 csd->exec(); 126 csd->exec();
127 delete csd; 127 delete csd;
128} 128}
129void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 129void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
130{ 130{
131 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 131 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
132 132
133 mCategoriesButton = new QPushButton(parent); 133 mCategoriesButton = new QPushButton(parent);
134 mCategoriesButton->setText(i18n("Categories...")); 134 mCategoriesButton->setText(i18n("Categories..."));
135 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 135 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
136 categoriesLayout->addWidget(mCategoriesButton); 136 categoriesLayout->addWidget(mCategoriesButton);
137 137
138 mCategoriesLabel = new QLabel(parent); 138 mCategoriesLabel = new QLabel(parent);
139 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 139 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
140 categoriesLayout->addWidget(mCategoriesLabel,1); 140 categoriesLayout->addWidget(mCategoriesLabel,1);
141} 141}
142 142
143void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 143void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
144{ 144{
145 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 145 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
146 146
147 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 147 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
148 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 148 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
149 secrecyLayout->addWidget(mCancelBox); 149 secrecyLayout->addWidget(mCancelBox);
150 secrecyLayout->addWidget(secrecyLabel); 150 secrecyLayout->addWidget(secrecyLabel);
151 151
152 mSecrecyCombo = new QComboBox(parent); 152 mSecrecyCombo = new QComboBox(parent);
153 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 153 mSecrecyCombo->insertStringList(Incidence::secrecyList());
154 secrecyLayout->addWidget(mSecrecyCombo); 154 secrecyLayout->addWidget(mSecrecyCombo);
155} 155}
156 156
157void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 157void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
158{ 158{
159 mDescriptionEdit = new KTextEdit(parent); 159 mDescriptionEdit = new KTextEdit(parent);
160 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 160 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
161 mDescriptionEdit->append(""); 161 mDescriptionEdit->append("");
162 mDescriptionEdit->setReadOnly(false); 162 mDescriptionEdit->setReadOnly(false);
163 mDescriptionEdit->setOverwriteMode(false); 163 mDescriptionEdit->setOverwriteMode(false);
164 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 164 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
165 topLayout->addWidget(mDescriptionEdit); 165 topLayout->addWidget(mDescriptionEdit);
166#ifndef DESKTOP_VERSION 166#ifndef DESKTOP_VERSION
167 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 167 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
168#endif 168#endif
169 169
170} 170}
171 171
172void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 172void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
173{ 173{
174 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 174 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
175 175
176 //mAlarmBell = new QLabel(parent); 176 //mAlarmBell = new QLabel(parent);
177 //mAlarmBell->setPixmap(SmallIcon("bell")); 177 //mAlarmBell->setPixmap(SmallIcon("bell"));
178 //alarmLayout->addWidget(mAlarmBell); 178 //alarmLayout->addWidget(mAlarmBell);
179 if ( QApplication::desktop()->width() < 320 ) 179 if ( QApplication::desktop()->width() < 320 )
180 mAlarmButton = new QCheckBox(i18n("Rem."),parent); 180 mAlarmButton = new QCheckBox(i18n("Rem."),parent);
181 else 181 else
182 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); 182 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
183 183
184 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); 184 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
185 alarmLayout->addWidget(mAlarmButton); 185 alarmLayout->addWidget(mAlarmButton);
186 186
187 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 187 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
188 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); 188 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus );
189 alarmLayout->addWidget(mAlarmTimeEdit); 189 alarmLayout->addWidget(mAlarmTimeEdit);
190 mAlarmIncrCombo = new QComboBox(false, parent); 190 mAlarmIncrCombo = new QComboBox(false, parent);
191 if ( QApplication::desktop()->width() < 320 ) { 191 if ( QApplication::desktop()->width() < 320 ) {
192 mAlarmIncrCombo->insertItem(i18n("min")); 192 mAlarmIncrCombo->insertItem(i18n("min"));
193 mAlarmIncrCombo->insertItem(i18n("hou")); 193 mAlarmIncrCombo->insertItem(i18n("hou"));
194 mAlarmIncrCombo->insertItem(i18n("day")); 194 mAlarmIncrCombo->insertItem(i18n("day"));
195 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); 195 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
196 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); 196 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
197 } else { 197 } else {
198 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 198 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
199 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 199 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
200 mAlarmIncrCombo->insertItem(i18n("day(s)")); 200 mAlarmIncrCombo->insertItem(i18n("day(s)"));
201 } 201 }
202 202
203 // mAlarmIncrCombo->setMinimumHeight(20); 203 // mAlarmIncrCombo->setMinimumHeight(20);
204 alarmLayout->addWidget(mAlarmIncrCombo); 204 alarmLayout->addWidget(mAlarmIncrCombo);
205 mAlarmSoundButton = new QPushButton(parent); 205 mAlarmSoundButton = new QPushButton(parent);
206 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 206 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
207 mAlarmSoundButton->setToggleButton(true); 207 mAlarmSoundButton->setToggleButton(true);
208 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 208 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
209 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 209 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
210 alarmLayout->addWidget(mAlarmSoundButton); 210 alarmLayout->addWidget(mAlarmSoundButton);
211 211
212 mAlarmProgramButton = new QPushButton(parent); 212 mAlarmProgramButton = new QPushButton(parent);
213 mAlarmProgramButton->setPixmap(SmallIcon("run")); 213 mAlarmProgramButton->setPixmap(SmallIcon("run"));
214 mAlarmProgramButton->setToggleButton(true); 214 mAlarmProgramButton->setToggleButton(true);
215 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 215 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
216 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 216 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
217 alarmLayout->addWidget(mAlarmProgramButton); 217 alarmLayout->addWidget(mAlarmProgramButton);
218 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 218 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
219 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 219 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
220 // if ( KOPrefs::instance()->mCompactDialogs ) { 220 // if ( KOPrefs::instance()->mCompactDialogs ) {
221 // mAlarmSoundButton->hide(); 221 // mAlarmSoundButton->hide();
222 // mAlarmProgramButton->hide(); 222 // mAlarmProgramButton->hide();
223 // } 223 // }
224} 224}
225 225
226void KOEditorGeneral::pickAlarmSound() 226void KOEditorGeneral::pickAlarmSound()
227{ 227{
228 228
229 qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); 229 qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() );
230 //QString prefix = mAlarmSound; 230
231 if (!mAlarmSoundButton->isOn()) { 231 bool oldState = mAlarmSoundButton->isOn();
232
233 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
234 i18n("*.wav|Wav Files"), 0));
235 if (!fileName.isEmpty()) {
236 mAlarmSound = fileName;
237 QToolTip::remove(mAlarmSoundButton);
238 QString dispStr = i18n("Playing '%1'").arg(fileName);
239 QToolTip::add(mAlarmSoundButton, dispStr);
240 mAlarmProgramButton->setOn(false);
232 mAlarmSoundButton->setOn(true); 241 mAlarmSoundButton->setOn(true);
233 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 242 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
234 } else { 243 } else {
235 QString fileName(KFileDialog::getOpenFileName(mAlarmSound, 244 mAlarmProgramButton->setOn(oldState);
236 i18n("*.wav|Wav Files"), 0)); 245 mAlarmSoundButton->setOn(!oldState);
237 if (!fileName.isEmpty()) { 246
238 mAlarmSound = fileName; 247
239 QToolTip::remove(mAlarmSoundButton);
240 QString dispStr = i18n("Playing '%1'").arg(fileName);
241 QToolTip::add(mAlarmSoundButton, dispStr);
242 mAlarmProgramButton->setOn(false);
243 mAlarmSoundButton->setOn(true);
244 } else {
245 mAlarmProgramButton->setOn(true);
246 mAlarmSoundButton->setOn(false);
247
248 }
249 } 248 }
250#if 0 249
251 if (mAlarmProgramButton->isOn()) 250 if (mAlarmProgramButton->isOn())
252 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 251 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
253 if ( mAlarmSoundButton->isOn()) 252 if ( mAlarmSoundButton->isOn())
254 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 253 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
255#endif 254
256} 255}
257 256
258void KOEditorGeneral::pickAlarmProgram() 257void KOEditorGeneral::pickAlarmProgram()
259{ 258{
260 if (!mAlarmProgramButton->isOn()) { 259 bool oldState = mAlarmProgramButton->isOn();
260
261 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0));
262 if (!fileName.isEmpty()) {
263 mAlarmProgram = fileName;
264 QToolTip::remove(mAlarmProgramButton);
265 QString dispStr = i18n("Running '%1'").arg(fileName);
266 QToolTip::add(mAlarmProgramButton, dispStr);
267 mAlarmSoundButton->setOn(false);
261 mAlarmProgramButton->setOn(true); 268 mAlarmProgramButton->setOn(true);
262 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 269 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
263 } else { 270 } else {
264 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); 271 mAlarmProgramButton->setOn(!oldState);
265 if (!fileName.isEmpty()) { 272 mAlarmSoundButton->setOn(oldState);
266 mAlarmProgram = fileName;
267 QToolTip::remove(mAlarmProgramButton);
268 QString dispStr = i18n("Running '%1'").arg(fileName);
269 QToolTip::add(mAlarmProgramButton, dispStr);
270 mAlarmSoundButton->setOn(false);
271 mAlarmProgramButton->setOn(true);
272 } else {
273 mAlarmProgramButton->setOn(false);
274 mAlarmSoundButton->setOn(true);
275 }
276 } 273 }
277#if 0 274
278 if (mAlarmProgramButton->isOn()) 275 if (mAlarmProgramButton->isOn())
279 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 276 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
280 if ( mAlarmSoundButton->isOn()) 277 if ( mAlarmSoundButton->isOn())
281 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 278 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
282#endif 279
283} 280}
284 281
285 282
286QString KOEditorGeneral::getFittingPath( const QString s ) 283QString KOEditorGeneral::getFittingPath( const QString s )
287{ 284{
288 int maxlen = 50; 285 int maxlen = 50;
289 if ( QApplication::desktop()->width() < 640 ) { 286 if ( QApplication::desktop()->width() < 640 ) {
290 if ( QApplication::desktop()->width() < 320 ) 287 if ( QApplication::desktop()->width() < 320 )
291 maxlen = 22; 288 maxlen = 22;
292 else 289 else
293 maxlen = 35; 290 maxlen = 35;
294 } 291 }
295 if ( s.length() > maxlen ) { 292 if ( s.length() > maxlen ) {
296 return "..."+s.right(maxlen -3); 293 return "..."+s.right(maxlen -3);
297 } 294 }
298 return s; 295 return s;
299} 296}
300 297
301void KOEditorGeneral::enableAlarmEdit(bool enable) 298void KOEditorGeneral::enableAlarmEdit(bool enable)
302{ 299{
303 if ( enable ) { 300 if ( enable ) {
304 if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { 301 if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) {
305 mAlarmSoundButton->setOn( true ); 302 mAlarmSoundButton->setOn( true );
306 if ( mAlarmSound.isEmpty() ) 303 if ( mAlarmSound.isEmpty() )
307 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 304 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
308 else { 305 else {
309 if ( ! QFile::exists( mAlarmSound ) ) 306 if ( ! QFile::exists( mAlarmSound ) )
310 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 307 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
311 } 308 }
312 } 309 }
313 } 310 }
314 ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); 311 ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage);
315 mAlarmTimeEdit->setEnabled(enable); 312 mAlarmTimeEdit->setEnabled(enable);
316 mAlarmSoundButton->setEnabled(enable); 313 mAlarmSoundButton->setEnabled(enable);
317 mAlarmProgramButton->setEnabled(enable); 314 mAlarmProgramButton->setEnabled(enable);
318 mAlarmIncrCombo->setEnabled(enable); 315 mAlarmIncrCombo->setEnabled(enable);
319} 316}
320 317
321void KOEditorGeneral::disableAlarmEdit(bool disable) 318void KOEditorGeneral::disableAlarmEdit(bool disable)
322{ 319{
323 enableAlarmEdit( !disable ); 320 enableAlarmEdit( !disable );
324} 321}
325 322
326void KOEditorGeneral::enableAlarm( bool enable ) 323void KOEditorGeneral::enableAlarm( bool enable )
327{ 324{
328 enableAlarmEdit( enable ); 325 enableAlarmEdit( enable );
329} 326}
330 327
331void KOEditorGeneral::alarmDisable(bool disable) 328void KOEditorGeneral::alarmDisable(bool disable)
332{ 329{
333 if (!disable) { 330 if (!disable) {
334 //mAlarmBell->setEnabled(true); 331 //mAlarmBell->setEnabled(true);
335 mAlarmButton->setEnabled(true); 332 mAlarmButton->setEnabled(true);
336 } else { 333 } else {
337 //mAlarmBell->setEnabled(false); 334 //mAlarmBell->setEnabled(false);
338 mAlarmButton->setEnabled(false); 335 mAlarmButton->setEnabled(false);
339 mAlarmButton->setChecked(false); 336 mAlarmButton->setChecked(false);
340 mAlarmTimeEdit->setEnabled(false); 337 mAlarmTimeEdit->setEnabled(false);
341 mAlarmSoundButton->setEnabled(false); 338 mAlarmSoundButton->setEnabled(false);
342 mAlarmProgramButton->setEnabled(false); 339 mAlarmProgramButton->setEnabled(false);
343 mAlarmIncrCombo->setEnabled(false); 340 mAlarmIncrCombo->setEnabled(false);
344 } 341 }
345} 342}
346 343
347void KOEditorGeneral::setCategories(const QString &str) 344void KOEditorGeneral::setCategories(const QString &str)
348{ 345{
349 mCategoriesLabel->setText(str); 346 mCategoriesLabel->setText(str);
350} 347}
351 348
352void KOEditorGeneral::setDefaults(bool allDay) 349void KOEditorGeneral::setDefaults(bool allDay)
353{ 350{
354#if 0 351#if 0
355 mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); 352 mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName());
356#endif 353#endif
357 354
358 mAlarmMessage = i18n("Edit new item"); 355 mAlarmMessage = i18n("Edit new item");
359 enableAlarmEdit( !allDay ); 356 enableAlarmEdit( !allDay );
360 357
361 // TODO: Implement a KPrefsComboItem to solve this in a clean way. 358 // TODO: Implement a KPrefsComboItem to solve this in a clean way.
362 int alarmTime; 359 int alarmTime;
363 int a[] = { 1,5,10,15,30,60,180, 1440 }; 360 int a[] = { 1,5,10,15,30,60,180, 1440 };
364 int index = KOPrefs::instance()->mAlarmTime; 361 int index = KOPrefs::instance()->mAlarmTime;
365 if (index < 0 || index > 7) { 362 if (index < 0 || index > 7) {
366 alarmTime = 15; 363 alarmTime = 15;
367 } else { 364 } else {
368 alarmTime = a[index]; 365 alarmTime = a[index];
369 } 366 }
370 mAlarmButton ->setChecked( false ); 367 mAlarmButton ->setChecked( false );
371 mAlarmTimeEdit->setValue(alarmTime); 368 mAlarmTimeEdit->setValue(alarmTime);
372 mAlarmIncrCombo->setCurrentItem(0); 369 mAlarmIncrCombo->setCurrentItem(0);
373 enableAlarmEdit( false ); 370 enableAlarmEdit( false );
374 //alarmDisable (false); 371 //alarmDisable (false);
375 mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); 372 mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic);
376 mCancelBox->setChecked( false ); 373 mCancelBox->setChecked( false );
377 mSummaryEdit->setEditText(""); 374 mSummaryEdit->setEditText("");
378 mLocationEdit->setEditText(""); 375 mLocationEdit->setEditText("");
379 mDescriptionEdit->setText(""); 376 mDescriptionEdit->setText("");
380 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 377 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
381 setCategories(""); 378 setCategories("");
382} 379}
383void KOEditorGeneral::setSecrecy( int num ) 380void KOEditorGeneral::setSecrecy( int num )
384{ 381{
385 mSecrecyCombo->setCurrentItem(num); 382 mSecrecyCombo->setCurrentItem(num);
386} 383}
387void KOEditorGeneral::readIncidence(Incidence *event) 384void KOEditorGeneral::readIncidence(Incidence *event)
388{ 385{
389 386
390 mAlarmMessage = event->summary(); 387 mAlarmMessage = event->summary();
391 if ( ! event->location().isEmpty() ) 388 if ( ! event->location().isEmpty() )
392 mAlarmMessage += " ("+event->location()+")"; 389 mAlarmMessage += " ("+event->location()+")";
393 mAlarmIncrCombo->setCurrentItem(0); 390 mAlarmIncrCombo->setCurrentItem(0);
394 mSummaryEdit->setEditText(event->summary()); 391 mSummaryEdit->setEditText(event->summary());
395 mLocationEdit->setEditText(event->location()); 392 mLocationEdit->setEditText(event->location());
396 mDescriptionEdit->setText(event->description()); 393 mDescriptionEdit->setText(event->description());
397 394
398#if 0 395#if 0
399 // organizer information 396 // organizer information
400 mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); 397 mOwnerLabel->setText(i18n("Owner: ") + event->organizer());
401#endif 398#endif
402 399
403 enableAlarmEdit( event->isAlarmEnabled() ); 400 enableAlarmEdit( event->isAlarmEnabled() );
404 //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); 401 //qDebug("KOEditorGeneral::readIncidence(Incidence *event) ");
405 if(!event->isAlarmEnabled()) { 402 if(!event->isAlarmEnabled()) {
406 // TODO: Implement a KPrefsComboItem to solve this in a clean way. 403 // TODO: Implement a KPrefsComboItem to solve this in a clean way.
407 int alarmTime; 404 int alarmTime;
408 int a[] = { 1,5,10,15,30,60,180, 1440 }; 405 int a[] = { 1,5,10,15,30,60,180, 1440 };
409 int index = KOPrefs::instance()->mAlarmTime; 406 int index = KOPrefs::instance()->mAlarmTime;
410 if (index < 0 || index > 7) { 407 if (index < 0 || index > 7) {
411 alarmTime = 15; 408 alarmTime = 15;
412 } else { 409 } else {
413 alarmTime = a[index]; 410 alarmTime = a[index];
414 } 411 }
415 mAlarmTimeEdit->setValue(alarmTime); 412 mAlarmTimeEdit->setValue(alarmTime);
416 } 413 }
417 mAlarmButton->setChecked( event->isAlarmEnabled() ); 414 mAlarmButton->setChecked( event->isAlarmEnabled() );
418 mSecrecyCombo->setCurrentItem(event->secrecy()); 415 mSecrecyCombo->setCurrentItem(event->secrecy());
419 mCancelBox->setChecked( event->cancelled() ); 416 mCancelBox->setChecked( event->cancelled() );
420 mAlarmProgramButton->setOn(false); 417 mAlarmProgramButton->setOn(false);
421 mAlarmSoundButton->setOn(false); 418 mAlarmSoundButton->setOn(false);
422 419
423 // set up alarm stuff 420 // set up alarm stuff
424 QPtrList<Alarm> alarms = event->alarms(); 421 QPtrList<Alarm> alarms = event->alarms();
425 Alarm* alarm; 422 Alarm* alarm;
426 mAlarmIncrCombo->setCurrentItem(0); 423 mAlarmIncrCombo->setCurrentItem(0);
427 for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { 424 for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) {
428 int offset; 425 int offset;
429 if ( alarm->hasTime() ) { 426 if ( alarm->hasTime() ) {
430 QDateTime t = alarm->time(); 427 QDateTime t = alarm->time();
431 offset = event->dtStart().secsTo( t ); 428 offset = event->dtStart().secsTo( t );
432 } else { 429 } else {
433 offset = alarm->startOffset().asSeconds(); 430 offset = alarm->startOffset().asSeconds();
434 } 431 }
435 if ( offset != 0 ) { 432 if ( offset != 0 ) {
436 offset = offset / -60; // make minutes 433 offset = offset / -60; // make minutes
437 if (offset % 60 == 0) { // divides evenly into hours? 434 if (offset % 60 == 0) { // divides evenly into hours?
438 offset = offset / 60; 435 offset = offset / 60;
439 mAlarmIncrCombo->setCurrentItem(1); 436 mAlarmIncrCombo->setCurrentItem(1);
440 if (offset % 24 == 0) { // divides evenly into days? 437 if (offset % 24 == 0) { // divides evenly into days?
441 offset = offset / 24; 438 offset = offset / 24;
442 mAlarmIncrCombo->setCurrentItem(2); 439 mAlarmIncrCombo->setCurrentItem(2);
443 } 440 }
444 } 441 }
445 } 442 }
446 mAlarmTimeEdit->setValue( offset ); 443 mAlarmTimeEdit->setValue( offset );
447 if (alarm->type() == Alarm::Procedure) { 444 if (alarm->type() == Alarm::Procedure) {
448 445
449 mAlarmProgram = alarm->programFile(); 446 mAlarmProgram = alarm->programFile();
450 mAlarmProgramButton->setOn(true); 447 mAlarmProgramButton->setOn(true);
451 QString dispStr = i18n("Running '%1'").arg(mAlarmProgram); 448 QString dispStr = i18n("Running '%1'").arg(mAlarmProgram);
452 QToolTip::add(mAlarmProgramButton, dispStr); 449 QToolTip::add(mAlarmProgramButton, dispStr);
453 } 450 }
454 else if (alarm->type() == Alarm::Audio) { 451 else if (alarm->type() == Alarm::Audio) {
455 mAlarmSound = alarm->audioFile(); 452 mAlarmSound = alarm->audioFile();
456 if ( ! QFile::exists( mAlarmSound ) ) 453 if ( ! QFile::exists( mAlarmSound ) )
457 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 454 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
458 mAlarmSoundButton->setOn(true); 455 mAlarmSoundButton->setOn(true);
459 QString dispStr = i18n("Playing '%1'").arg(mAlarmSound); 456 QString dispStr = i18n("Playing '%1'").arg(mAlarmSound);
460 QToolTip::add(mAlarmSoundButton, dispStr); 457 QToolTip::add(mAlarmSoundButton, dispStr);
461 } 458 }
462 mAlarmButton->setChecked(alarm->enabled()); 459 mAlarmButton->setChecked(alarm->enabled());
463 enableAlarmEdit( alarm->enabled() ); 460 enableAlarmEdit( alarm->enabled() );
464 //qDebug("nableAlarmEdit( alarm->enabled() )********* "); 461 //qDebug("nableAlarmEdit( alarm->enabled() )********* ");
465 // TODO: Deal with multiple alarms 462 // TODO: Deal with multiple alarms
466 break; // For now, stop after the first alarm 463 break; // For now, stop after the first alarm
467 } 464 }
468 465
469 setCategories(event->categoriesStr()); 466 setCategories(event->categoriesStr());
470} 467}
471 468
472void KOEditorGeneral::writeIncidence(Incidence *event) 469void KOEditorGeneral::writeIncidence(Incidence *event)
473{ 470{
474 // kdDebug() << "KOEditorGeneral::writeEvent()" << endl; 471 // kdDebug() << "KOEditorGeneral::writeEvent()" << endl;
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 01cf0ff..395325c 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -15,410 +15,416 @@
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 <qlayout.h> 24#include <qlayout.h>
25#include <qheader.h> 25#include <qheader.h>
26#include <qcursor.h> 26#include <qcursor.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28 28
29#include <qvbox.h> 29#include <qvbox.h>
30#include <kdebug.h> 30#include <kdebug.h>
31#include "koprefs.h" 31#include "koprefs.h"
32#include <klocale.h> 32#include <klocale.h>
33#include <kglobal.h> 33#include <kglobal.h>
34#include <kiconloader.h> 34#include <kiconloader.h>
35#include <kmessagebox.h> 35#include <kmessagebox.h>
36 36
37#include <libkcal/icaldrag.h> 37#include <libkcal/icaldrag.h>
38#include <libkcal/vcaldrag.h> 38#include <libkcal/vcaldrag.h>
39#include <libkcal/calfilter.h> 39#include <libkcal/calfilter.h>
40#include <libkcal/dndfactory.h> 40#include <libkcal/dndfactory.h>
41#include <libkcal/calendarresources.h> 41#include <libkcal/calendarresources.h>
42#include <libkcal/resourcecalendar.h> 42#include <libkcal/resourcecalendar.h>
43#include <kresources/resourceselectdialog.h> 43#include <kresources/resourceselectdialog.h>
44#include <libkcal/kincidenceformatter.h> 44#include <libkcal/kincidenceformatter.h>
45#ifndef DESKTOP_VERSION 45#ifndef DESKTOP_VERSION
46#include <qpe/qpeapplication.h> 46#include <qpe/qpeapplication.h>
47#else 47#else
48#include <qapplication.h> 48#include <qapplication.h>
49#endif 49#endif
50#ifndef KORG_NOPRINTER 50#ifndef KORG_NOPRINTER
51#include "calprinter.h" 51#include "calprinter.h"
52#endif 52#endif
53#include "docprefs.h" 53#include "docprefs.h"
54 54
55#include "kotodoview.h" 55#include "kotodoview.h"
56using namespace KOrg; 56using namespace KOrg;
57 57
58 58
59class KOTodoViewWhatsThis :public QWhatsThis 59class KOTodoViewWhatsThis :public QWhatsThis
60{ 60{
61public: 61public:
62 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 62 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
63 63
64protected: 64protected:
65 virtual QString text( const QPoint& p) 65 virtual QString text( const QPoint& p)
66 { 66 {
67 return _view->getWhatsThisText(p) ; 67 return _view->getWhatsThisText(p) ;
68 } 68 }
69private: 69private:
70 QWidget* _wid; 70 QWidget* _wid;
71 KOTodoView * _view; 71 KOTodoView * _view;
72}; 72};
73 73
74KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 74KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
75 const char *name) : 75 const char *name) :
76 KListView(parent,name) 76 KListView(parent,name)
77{ 77{
78 mName = QString ( name ); 78 mName = QString ( name );
79 mCalendar = calendar; 79 mCalendar = calendar;
80#ifndef DESKTOP_VERSION 80#ifndef DESKTOP_VERSION
81 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 81 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
82#endif 82#endif
83 mOldCurrent = 0; 83 mOldCurrent = 0;
84 mMousePressed = false; 84 mMousePressed = false;
85 85
86 setAcceptDrops(true); 86 setAcceptDrops(true);
87 viewport()->setAcceptDrops(true); 87 viewport()->setAcceptDrops(true);
88 int size = 16; 88 int size = 16;
89 if (qApp->desktop()->width() < 300 ) 89 if (qApp->desktop()->width() < 300 )
90 size = 12; 90 size = 12;
91 setTreeStepSize( size + 6 ); 91 setTreeStepSize( size + 6 );
92 92
93} 93}
94 94
95void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) 95void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e)
96{ 96{
97#ifndef KORG_NODND 97#ifndef KORG_NODND
98// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; 98// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl;
99 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 99 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
100 !QTextDrag::canDecode( e ) ) { 100 !QTextDrag::canDecode( e ) ) {
101 e->ignore(); 101 e->ignore();
102 return; 102 return;
103 } 103 }
104 104
105 mOldCurrent = currentItem(); 105 mOldCurrent = currentItem();
106#endif 106#endif
107} 107}
108 108
109 109
110void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) 110void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e)
111{ 111{
112#ifndef KORG_NODND 112#ifndef KORG_NODND
113// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; 113// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl;
114 114
115 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 115 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
116 !QTextDrag::canDecode( e ) ) { 116 !QTextDrag::canDecode( e ) ) {
117 e->ignore(); 117 e->ignore();
118 return; 118 return;
119 } 119 }
120 120
121 e->accept(); 121 e->accept();
122#endif 122#endif
123} 123}
124 124
125void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) 125void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *)
126{ 126{
127#ifndef KORG_NODND 127#ifndef KORG_NODND
128// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; 128// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl;
129 129
130 setCurrentItem(mOldCurrent); 130 setCurrentItem(mOldCurrent);
131 setSelected(mOldCurrent,true); 131 setSelected(mOldCurrent,true);
132#endif 132#endif
133} 133}
134 134
135void KOTodoListView::contentsDropEvent(QDropEvent *e) 135void KOTodoListView::contentsDropEvent(QDropEvent *e)
136{ 136{
137#ifndef KORG_NODND 137#ifndef KORG_NODND
138// kdDebug() << "KOTodoListView::contentsDropEvent" << endl; 138// kdDebug() << "KOTodoListView::contentsDropEvent" << endl;
139 139
140 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 140 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
141 !QTextDrag::canDecode( e ) ) { 141 !QTextDrag::canDecode( e ) ) {
142 e->ignore(); 142 e->ignore();
143 return; 143 return;
144 } 144 }
145 145
146 DndFactory factory( mCalendar ); 146 DndFactory factory( mCalendar );
147 Todo *todo = factory.createDropTodo(e); 147 Todo *todo = factory.createDropTodo(e);
148 148
149 if (todo) { 149 if (todo) {
150 e->acceptAction(); 150 e->acceptAction();
151 151
152 KOTodoViewItem *destination = 152 KOTodoViewItem *destination =
153 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); 153 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos()));
154 Todo *destinationEvent = 0; 154 Todo *destinationEvent = 0;
155 if (destination) destinationEvent = destination->todo(); 155 if (destination) destinationEvent = destination->todo();
156 156
157 Todo *existingTodo = mCalendar->todo(todo->uid()); 157 Todo *existingTodo = mCalendar->todo(todo->uid());
158 158
159 if(existingTodo) { 159 if(existingTodo) {
160 Incidence *to = destinationEvent; 160 Incidence *to = destinationEvent;
161 while(to) { 161 while(to) {
162 if (to->uid() == todo->uid()) { 162 if (to->uid() == todo->uid()) {
163 KMessageBox::sorry(this, 163 KMessageBox::sorry(this,
164 i18n("Cannot move To-Do to itself\nor a child of itself"), 164 i18n("Cannot move To-Do to itself\nor a child of itself"),
165 i18n("Drop To-Do")); 165 i18n("Drop To-Do"));
166 delete todo; 166 delete todo;
167 return; 167 return;
168 } 168 }
169 to = to->relatedTo(); 169 to = to->relatedTo();
170 } 170 }
171 internalDrop = true; 171 internalDrop = true;
172 if ( destinationEvent ) 172 if ( destinationEvent )
173 reparentTodoSignal( destinationEvent, existingTodo ); 173 reparentTodoSignal( destinationEvent, existingTodo );
174 else 174 else
175 unparentTodoSignal(existingTodo); 175 unparentTodoSignal(existingTodo);
176 delete todo; 176 delete todo;
177 } else { 177 } else {
178 mCalendar->addTodo(todo); 178 mCalendar->addTodo(todo);
179 emit todoDropped(todo, KOGlobals::EVENTADDED); 179 emit todoDropped(todo, KOGlobals::EVENTADDED);
180 if ( destinationEvent ) 180 if ( destinationEvent )
181 reparentTodoSignal( destinationEvent, todo ); 181 reparentTodoSignal( destinationEvent, todo );
182 } 182 }
183 } 183 }
184 else { 184 else {
185 QString text; 185 QString text;
186 if (QTextDrag::decode(e,text)) { 186 if (QTextDrag::decode(e,text)) {
187 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); 187 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) );
188 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); 188 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) ));
189 qDebug("Dropped : " + text); 189 qDebug("Dropped : " + text);
190 QStringList emails = QStringList::split(",",text); 190 QStringList emails = QStringList::split(",",text);
191 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { 191 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
192 int pos = (*it).find("<"); 192 int pos = (*it).find("<");
193 QString name = (*it).left(pos); 193 QString name = (*it).left(pos);
194 QString email = (*it).mid(pos); 194 QString email = (*it).mid(pos);
195 if (!email.isEmpty() && todoi) { 195 if (!email.isEmpty() && todoi) {
196 todoi->todo()->addAttendee(new Attendee(name,email)); 196 todoi->todo()->addAttendee(new Attendee(name,email));
197 } 197 }
198 } 198 }
199 } 199 }
200 else { 200 else {
201 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); 201 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable ");
202 e->ignore(); 202 e->ignore();
203 } 203 }
204 } 204 }
205#endif 205#endif
206} 206}
207void KOTodoListView::wheelEvent (QWheelEvent *e)
208{
209 QListView::wheelEvent (e);
210}
207 211
208void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 212void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
209{ 213{
210 214
211 QPoint p(contentsToViewport(e->pos())); 215 QPoint p(contentsToViewport(e->pos()));
212 QListViewItem *i = itemAt(p); 216 QListViewItem *i = itemAt(p);
213 bool rootClicked = true; 217 bool rootClicked = true;
214 if (i) { 218 if (i) {
215 // if the user clicked into the root decoration of the item, don't 219 // if the user clicked into the root decoration of the item, don't
216 // try to start a drag! 220 // try to start a drag!
217 int X = p.x(); 221 int X = p.x();
218 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); 222 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() );
219 if (X > header()->sectionPos(0) + 223 if (X > header()->sectionPos(0) +
220 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + 224 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
221 itemMargin() +i->height()|| 225 itemMargin() +i->height()||
222 X < header()->sectionPos(0)) { 226 X < header()->sectionPos(0)) {
223 rootClicked = false; 227 rootClicked = false;
224 } 228 }
225 } else { 229 } else {
226 rootClicked = false; 230 rootClicked = false;
227 } 231 }
228#ifndef KORG_NODND 232#ifndef KORG_NODND
229 mMousePressed = false; 233 mMousePressed = false;
230 if (! rootClicked ) { 234 if (! rootClicked && !( e->button() == RightButton) ) {
231 mPressPos = e->pos(); 235 mPressPos = e->pos();
232 mMousePressed = true; 236 mMousePressed = true;
237 } else {
238 mMousePressed = false;
233 } 239 }
234#endif 240#endif
235 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); 241 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked);
236#ifndef DESKTOP_VERSION 242#ifndef DESKTOP_VERSION
237 if (!( e->button() == RightButton && rootClicked) ) 243 if (!( e->button() == RightButton && rootClicked) )
238 QListView::contentsMousePressEvent(e); 244 QListView::contentsMousePressEvent(e);
239#else 245#else
240 QListView::contentsMousePressEvent(e); 246 QListView::contentsMousePressEvent(e);
241#endif 247#endif
242} 248}
243void KOTodoListView::paintEvent(QPaintEvent* e) 249void KOTodoListView::paintEvent(QPaintEvent* e)
244{ 250{
245 emit paintNeeded(); 251 emit paintNeeded();
246 QListView::paintEvent( e); 252 QListView::paintEvent( e);
247} 253}
248void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 254void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
249{ 255{
250 256
251#ifndef KORG_NODND 257#ifndef KORG_NODND
252 //QListView::contentsMouseMoveEvent(e); 258 //QListView::contentsMouseMoveEvent(e);
253 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > 259 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
254 QApplication::startDragDistance()*3) { 260 QApplication::startDragDistance()*3) {
255 mMousePressed = false; 261 mMousePressed = false;
256 QListViewItem *item = itemAt(contentsToViewport(mPressPos)); 262 QListViewItem *item = itemAt(contentsToViewport(mPressPos));
257 if (item) { 263 if (item) {
258 DndFactory factory( mCalendar ); 264 DndFactory factory( mCalendar );
259 ICalDrag *vd = factory.createDrag( 265 ICalDrag *vd = factory.createDrag(
260 ((KOTodoViewItem *)item)->todo(),viewport()); 266 ((KOTodoViewItem *)item)->todo(),viewport());
261 internalDrop = false; 267 internalDrop = false;
262 // we cannot do any senseful here, because the DnD is still broken in Qt 268 // we cannot do any senseful here, because the DnD is still broken in Qt
263 if (vd->drag()) { 269 if (vd->drag()) {
264 if ( !internalDrop ) { 270 if ( !internalDrop ) {
265 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); 271 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() );
266 qDebug("Dnd: External move: Delete drag source "); 272 qDebug("Dnd: External move: Delete drag source ");
267 } else 273 } else
268 qDebug("Dnd: Internal move "); 274 qDebug("Dnd: Internal move ");
269 275
270 } else { 276 } else {
271 if ( !internalDrop ) { 277 if ( !internalDrop ) {
272 qDebug("Dnd: External Copy"); 278 qDebug("Dnd: External Copy");
273 } else 279 } else
274 qDebug("DnD: Internal copy: Copy pending"); 280 qDebug("DnD: Internal copy: Copy pending");
275 } 281 }
276 } 282 }
277 } 283 }
278#endif 284#endif
279} 285}
280void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) 286void KOTodoListView::keyReleaseEvent ( QKeyEvent *e )
281{ 287{
282 if ( !e->isAutoRepeat() ) { 288 if ( !e->isAutoRepeat() ) {
283 mFlagKeyPressed = false; 289 mFlagKeyPressed = false;
284 } 290 }
285} 291}
286 292
287 293
288void KOTodoListView::keyPressEvent ( QKeyEvent * e ) 294void KOTodoListView::keyPressEvent ( QKeyEvent * e )
289{ 295{
290 qApp->processEvents(); 296 qApp->processEvents();
291 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 297 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
292 e->ignore(); 298 e->ignore();
293 // qDebug(" ignore %d",e->isAutoRepeat() ); 299 // qDebug(" ignore %d",e->isAutoRepeat() );
294 return; 300 return;
295 } 301 }
296 if (! e->isAutoRepeat() ) 302 if (! e->isAutoRepeat() )
297 mFlagKeyPressed = true; 303 mFlagKeyPressed = true;
298 QListViewItem* cn; 304 QListViewItem* cn;
299 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { 305 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) {
300 cn = currentItem(); 306 cn = currentItem();
301 if ( cn ) { 307 if ( cn ) {
302 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 308 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
303 if ( ci ){ 309 if ( ci ){
304 if ( e->state() == ShiftButton ) 310 if ( e->state() == ShiftButton )
305 ci->setOn( false ); 311 ci->setOn( false );
306 else 312 else
307 ci->setOn( true ); 313 ci->setOn( true );
308 cn = cn->itemBelow(); 314 cn = cn->itemBelow();
309 if ( cn ) { 315 if ( cn ) {
310 setCurrentItem ( cn ); 316 setCurrentItem ( cn );
311 ensureItemVisible ( cn ); 317 ensureItemVisible ( cn );
312 } 318 }
313 319
314 } 320 }
315 } 321 }
316 322
317 return; 323 return;
318 } 324 }
319 325
320 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 326 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
321 switch ( e->key() ) { 327 switch ( e->key() ) {
322 case Qt::Key_Down: 328 case Qt::Key_Down:
323 case Qt::Key_Up: 329 case Qt::Key_Up:
324 QListView::keyPressEvent ( e ); 330 QListView::keyPressEvent ( e );
325 break; 331 break;
326 case Qt::Key_Left: 332 case Qt::Key_Left:
327 case Qt::Key_Right: 333 case Qt::Key_Right:
328 QListView::keyPressEvent ( e ); 334 QListView::keyPressEvent ( e );
329 e->accept(); 335 e->accept();
330 return; 336 return;
331 break; 337 break;
332 default: 338 default:
333 e->ignore(); 339 e->ignore();
334 break; 340 break;
335 } 341 }
336 return; 342 return;
337 } 343 }
338 e->ignore(); 344 e->ignore();
339} 345}
340void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 346void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
341{ 347{
342 QListView::contentsMouseReleaseEvent(e); 348 QListView::contentsMouseReleaseEvent(e);
343 mMousePressed = false; 349 mMousePressed = false;
344} 350}
345 351
346void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 352void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
347{ 353{
348 if (!e) return; 354 if (!e) return;
349 355
350 QPoint vp = contentsToViewport(e->pos()); 356 QPoint vp = contentsToViewport(e->pos());
351 357
352 QListViewItem *item = itemAt(vp); 358 QListViewItem *item = itemAt(vp);
353 359
354 emit double_Clicked(item); 360 emit double_Clicked(item);
355 if (!item) return; 361 if (!item) return;
356 362
357 emit doubleClicked(item,vp,0); 363 emit doubleClicked(item,vp,0);
358} 364}
359 365
360///////////////////////////////////////////////////////////////////////////// 366/////////////////////////////////////////////////////////////////////////////
361 367
362KOQuickTodo::KOQuickTodo(QWidget *parent) : 368KOQuickTodo::KOQuickTodo(QWidget *parent) :
363 QLineEdit(parent) 369 QLineEdit(parent)
364{ 370{
365 setText(i18n("Click to add a new Todo")); 371 setText(i18n("Click to add a new Todo"));
366} 372}
367 373
368void KOQuickTodo::focusInEvent(QFocusEvent *ev) 374void KOQuickTodo::focusInEvent(QFocusEvent *ev)
369{ 375{
370 if ( text()==i18n("Click to add a new Todo") ) 376 if ( text()==i18n("Click to add a new Todo") )
371 setText(""); 377 setText("");
372 QLineEdit::focusInEvent(ev); 378 QLineEdit::focusInEvent(ev);
373} 379}
374 380
375void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 381void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
376{ 382{
377 setText(i18n("Click to add a new Todo")); 383 setText(i18n("Click to add a new Todo"));
378 QLineEdit::focusOutEvent(ev); 384 QLineEdit::focusOutEvent(ev);
379} 385}
380 386
381///////////////////////////////////////////////////////////////////////////// 387/////////////////////////////////////////////////////////////////////////////
382 388
383KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 389KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
384 KOrg::BaseView(calendar,parent,name) 390 KOrg::BaseView(calendar,parent,name)
385{ 391{
386 mPendingUpdateBeforeRepaint = false; 392 mPendingUpdateBeforeRepaint = false;
387 isFlatDisplay = false; 393 isFlatDisplay = false;
388 mNavigator = 0; 394 mNavigator = 0;
389 QBoxLayout *topLayout = new QVBoxLayout(this); 395 QBoxLayout *topLayout = new QVBoxLayout(this);
390 mName = QString ( name ); 396 mName = QString ( name );
391 mBlockUpdate = false; 397 mBlockUpdate = false;
392 mQuickAdd = new KOQuickTodo(this); 398 mQuickAdd = new KOQuickTodo(this);
393 topLayout->addWidget(mQuickAdd); 399 topLayout->addWidget(mQuickAdd);
394 400
395 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 401 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
396 402
397 mTodoListView = new KOTodoListView(calendar,this, name ); 403 mTodoListView = new KOTodoListView(calendar,this, name );
398 topLayout->addWidget(mTodoListView); 404 topLayout->addWidget(mTodoListView);
399 //mTodoListView->header()->setMaximumHeight(30); 405 //mTodoListView->header()->setMaximumHeight(30);
400 mTodoListView->setRootIsDecorated(true); 406 mTodoListView->setRootIsDecorated(true);
401 mTodoListView->setAllColumnsShowFocus(true); 407 mTodoListView->setAllColumnsShowFocus(true);
402 408
403 mTodoListView->setShowSortIndicator(true); 409 mTodoListView->setShowSortIndicator(true);
404 410
405 mTodoListView->addColumn(i18n("Todo")); 411 mTodoListView->addColumn(i18n("Todo"));
406 mTodoListView->addColumn(i18n("Prio")); 412 mTodoListView->addColumn(i18n("Prio"));
407 mTodoListView->setColumnAlignment(1,AlignHCenter); 413 mTodoListView->setColumnAlignment(1,AlignHCenter);
408 mTodoListView->addColumn(i18n("Complete")); 414 mTodoListView->addColumn(i18n("Complete"));
409 mTodoListView->setColumnAlignment(2,AlignCenter); 415 mTodoListView->setColumnAlignment(2,AlignCenter);
410 416
411 mTodoListView->addColumn(i18n("Due Date")); 417 mTodoListView->addColumn(i18n("Due Date"));
412 mTodoListView->setColumnAlignment(3,AlignLeft); 418 mTodoListView->setColumnAlignment(3,AlignLeft);
413 mTodoListView->addColumn(i18n("Due Time")); 419 mTodoListView->addColumn(i18n("Due Time"));
414 mTodoListView->setColumnAlignment(4,AlignHCenter); 420 mTodoListView->setColumnAlignment(4,AlignHCenter);
415 421
416 mTodoListView->addColumn(i18n("Start Date")); 422 mTodoListView->addColumn(i18n("Start Date"));
417 mTodoListView->setColumnAlignment(5,AlignLeft); 423 mTodoListView->setColumnAlignment(5,AlignLeft);
418 mTodoListView->addColumn(i18n("Start Time")); 424 mTodoListView->addColumn(i18n("Start Time"));
419 mTodoListView->setColumnAlignment(6,AlignHCenter); 425 mTodoListView->setColumnAlignment(6,AlignHCenter);
420 426
421 mTodoListView->addColumn(i18n("Cancelled")); 427 mTodoListView->addColumn(i18n("Cancelled"));
422 mTodoListView->addColumn(i18n("Categories")); 428 mTodoListView->addColumn(i18n("Categories"));
423#if 0 429#if 0
424 mTodoListView->addColumn(i18n("Sort Id")); 430 mTodoListView->addColumn(i18n("Sort Id"));
@@ -893,531 +899,532 @@ void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
893 899
894void KOTodoView::editItem(QListViewItem *item ) 900void KOTodoView::editItem(QListViewItem *item )
895{ 901{
896 // qDebug("editItem(QListViewItem *item ) "); 902 // qDebug("editItem(QListViewItem *item ) ");
897 emit editTodoSignal(((KOTodoViewItem *)item)->todo()); 903 emit editTodoSignal(((KOTodoViewItem *)item)->todo());
898} 904}
899 905
900void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) 906void KOTodoView::showItem(QListViewItem *item,const QPoint &,int)
901{ 907{
902 emit showTodoSignal(((KOTodoViewItem *)item)->todo()); 908 emit showTodoSignal(((KOTodoViewItem *)item)->todo());
903} 909}
904 910
905void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) 911void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column)
906{ 912{
907 pendingSubtodo = 0; 913 pendingSubtodo = 0;
908 mActiveItem = (KOTodoViewItem *)item; 914 mActiveItem = (KOTodoViewItem *)item;
909 if (item) { 915 if (item) {
910 switch (column){ 916 switch (column){
911 case 1: 917 case 1:
912 mPriorityPopupMenu->popup(QCursor::pos ()); break; 918 mPriorityPopupMenu->popup(QCursor::pos ()); break;
913 case 2: 919 case 2:
914 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; 920 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break;
915 case 3: 921 case 3:
916 moveTodo(); 922 moveTodo();
917 break; 923 break;
918 case 8: 924 case 8:
919 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; 925 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break;
920 default: 926 default:
921 mItemPopupMenu->popup(QCursor::pos()); 927 mItemPopupMenu->popup(QCursor::pos());
922 } 928 }
923 } else mPopupMenu->popup(QCursor::pos()); 929 } else mPopupMenu->popup(QCursor::pos());
924} 930}
925void KOTodoView::newTodo() 931void KOTodoView::newTodo()
926{ 932{
927 emit newTodoSignal(); 933 emit newTodoSignal();
928} 934}
929 935
930void KOTodoView::newSubTodo() 936void KOTodoView::newSubTodo()
931{ 937{
932 if (mActiveItem) { 938 if (mActiveItem) {
933 emit newSubTodoSignal(mActiveItem->todo()); 939 emit newSubTodoSignal(mActiveItem->todo());
934 } 940 }
935} 941}
936void KOTodoView::unparentTodo() 942void KOTodoView::unparentTodo()
937{ 943{
938 if (mActiveItem) { 944 if (mActiveItem) {
939 emit unparentTodoSignal(mActiveItem->todo()); 945 emit unparentTodoSignal(mActiveItem->todo());
940 } 946 }
941} 947}
942 948
943void KOTodoView::reparentTodo() 949void KOTodoView::reparentTodo()
944{ 950{
945 if (mActiveItem) { 951 if (mActiveItem) {
946 qDebug("KOTodoView::reparentTodo() "); 952 qDebug("KOTodoView::reparentTodo() ");
947 topLevelWidget()->setCaption(i18n("Click on new parent item")); 953 topLevelWidget()->setCaption(i18n("Click on new parent item"));
948 pendingSubtodo = mActiveItem; 954 pendingSubtodo = mActiveItem;
949 } 955 }
950} 956}
951void KOTodoView::editTodo() 957void KOTodoView::editTodo()
952{ 958{
953 if (mActiveItem) { 959 if (mActiveItem) {
954 emit editTodoSignal(mActiveItem->todo()); 960 emit editTodoSignal(mActiveItem->todo());
955 } 961 }
956} 962}
957void KOTodoView::cloneTodo() 963void KOTodoView::cloneTodo()
958{ 964{
959 if (mActiveItem) { 965 if (mActiveItem) {
960 emit cloneTodoSignal((Incidence*)mActiveItem->todo()); 966 emit cloneTodoSignal((Incidence*)mActiveItem->todo());
961 } 967 }
962} 968}
963void KOTodoView::cancelTodo() 969void KOTodoView::cancelTodo()
964{ 970{
965 if (mActiveItem) { 971 if (mActiveItem) {
966 emit cancelTodoSignal((Incidence*)mActiveItem->todo()); 972 emit cancelTodoSignal((Incidence*)mActiveItem->todo());
967 } 973 }
968} 974}
969void KOTodoView::moveTodo() 975void KOTodoView::moveTodo()
970{ 976{
971 if (mActiveItem) { 977 if (mActiveItem) {
972 emit moveTodoSignal((Incidence*)mActiveItem->todo()); 978 emit moveTodoSignal((Incidence*)mActiveItem->todo());
973 } 979 }
974} 980}
975void KOTodoView::beamTodo() 981void KOTodoView::beamTodo()
976{ 982{
977 if (mActiveItem) { 983 if (mActiveItem) {
978 emit beamTodoSignal((Incidence*)mActiveItem->todo()); 984 emit beamTodoSignal((Incidence*)mActiveItem->todo());
979 } 985 }
980} 986}
981 987
982 988
983void KOTodoView::showTodo() 989void KOTodoView::showTodo()
984{ 990{
985 if (mActiveItem) { 991 if (mActiveItem) {
986 emit showTodoSignal(mActiveItem->todo()); 992 emit showTodoSignal(mActiveItem->todo());
987 } 993 }
988} 994}
989 995
990void KOTodoView::deleteTodo() 996void KOTodoView::deleteTodo()
991{ 997{
992 if (mActiveItem) { 998 if (mActiveItem) {
993 emit deleteTodoSignal(mActiveItem->todo()); 999 emit deleteTodoSignal(mActiveItem->todo());
994 } 1000 }
995} 1001}
996 1002
997void KOTodoView::setNewPriority(int index) 1003void KOTodoView::setNewPriority(int index)
998{ 1004{
999 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1005 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1000 mActiveItem->todo()->setPriority(mPriority[index]); 1006 mActiveItem->todo()->setPriority(mPriority[index]);
1001 mActiveItem->construct(); 1007 mActiveItem->construct();
1002 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); 1008 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED);
1003 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1009 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1004 } 1010 }
1005} 1011}
1006 1012
1007void KOTodoView::setNewPercentage(int index) 1013void KOTodoView::setNewPercentage(int index)
1008{ 1014{
1009 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1015 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1010 1016
1011 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { 1017 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) {
1012 mActiveItem->setOn( true ); 1018 mActiveItem->setOn( true );
1013 return; 1019 return;
1014 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { 1020 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) {
1015 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); 1021 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent()));
1016 if ( par && par->isOn() ) 1022 if ( par && par->isOn() )
1017 par->setOn( false ); 1023 par->setOn( false );
1018 } 1024 }
1019 if (mPercentage[index] == 100) { 1025 if (mPercentage[index] == 100) {
1020 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); 1026 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
1021 } else { 1027 } else {
1022 mActiveItem->todo()->setCompleted(false); 1028 mActiveItem->todo()->setCompleted(false);
1023 } 1029 }
1024 mActiveItem->todo()->setPercentComplete(mPercentage[index]); 1030 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
1025 mActiveItem->construct(); 1031 mActiveItem->construct();
1026 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); 1032 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
1027 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1033 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1028 } 1034 }
1029} 1035}
1030 1036
1031 1037
1032QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) 1038QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
1033{ 1039{
1034 QPopupMenu* tempMenu = new QPopupMenu (this); 1040 QPopupMenu* tempMenu = new QPopupMenu (this);
1035 QStringList checkedCategories = todoItem->todo()->categories (); 1041 QStringList checkedCategories = todoItem->todo()->categories ();
1036 1042
1037 tempMenu->setCheckable (true); 1043 tempMenu->setCheckable (true);
1038 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 1044 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
1039 it != KOPrefs::instance()->mCustomCategories.end (); 1045 it != KOPrefs::instance()->mCustomCategories.end ();
1040 ++it) { 1046 ++it) {
1041 int index = tempMenu->insertItem (*it); 1047 int index = tempMenu->insertItem (*it);
1042 mCategory[index] = *it; 1048 mCategory[index] = *it;
1043 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); 1049 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
1044 } 1050 }
1045 1051
1046 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 1052 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
1047 return tempMenu; 1053 return tempMenu;
1048 1054
1049 1055
1050} 1056}
1051void KOTodoView::changedCategories(int index) 1057void KOTodoView::changedCategories(int index)
1052{ 1058{
1053 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1059 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1054 QStringList categories = mActiveItem->todo()->categories (); 1060 QStringList categories = mActiveItem->todo()->categories ();
1055 QString colcat = categories.first(); 1061 QString colcat = categories.first();
1056 if (categories.find (mCategory[index]) != categories.end ()) 1062 if (categories.find (mCategory[index]) != categories.end ())
1057 categories.remove (mCategory[index]); 1063 categories.remove (mCategory[index]);
1058 else 1064 else
1059 categories.insert (categories.end(), mCategory[index]); 1065 categories.insert (categories.end(), mCategory[index]);
1060 categories.sort (); 1066 categories.sort ();
1061 if ( !colcat.isEmpty() ) { 1067 if ( !colcat.isEmpty() ) {
1062 if ( categories.find ( colcat ) != categories.end () ) { 1068 if ( categories.find ( colcat ) != categories.end () ) {
1063 categories.remove( colcat ); 1069 categories.remove( colcat );
1064 categories.prepend( colcat ); 1070 categories.prepend( colcat );
1065 } 1071 }
1066 } 1072 }
1067 mActiveItem->todo()->setCategories (categories); 1073 mActiveItem->todo()->setCategories (categories);
1068 mActiveItem->construct(); 1074 mActiveItem->construct();
1069 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1075 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1070 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1076 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1071 } 1077 }
1072} 1078}
1073void KOTodoView::itemDoubleClicked(QListViewItem *item) 1079void KOTodoView::itemDoubleClicked(QListViewItem *item)
1074{ 1080{
1075 if ( pendingSubtodo != 0 ) { 1081 if ( pendingSubtodo != 0 ) {
1076 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1082 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1077 } 1083 }
1078 pendingSubtodo = 0; 1084 pendingSubtodo = 0;
1079 int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1085 int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1080 //qDebug("ROW %d ", row); 1086 //qDebug("ROW %d ", row);
1081 if (!item) { 1087 if (!item) {
1082 newTodo(); 1088 newTodo();
1083 return; 1089 return;
1084 } else { 1090 } else {
1085 if ( row == 1 ) { 1091 if ( row == 1 || row == 2 ) {
1086 mActiveItem = (KOTodoViewItem *) item; 1092 mActiveItem = (KOTodoViewItem *) item;
1087 newSubTodo(); 1093 newSubTodo();
1088 return; 1094 return;
1089 } 1095 }
1090 } 1096 }
1091 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1097 if ( KOPrefs::instance()->mEditOnDoubleClick )
1092 editItem( item ); 1098 editItem( item );
1093 else 1099 else
1094 showItem( item , QPoint(), 0 ); 1100 showItem( item , QPoint(), 0 );
1095} 1101}
1096void KOTodoView::itemClicked(QListViewItem *item) 1102void KOTodoView::itemClicked(QListViewItem *item)
1097{ 1103{
1098 //qDebug("KOTodoView::itemClicked %d", item); 1104 //qDebug("KOTodoView::itemClicked %d", item);
1099 if (!item) { 1105 if (!item) {
1100 if ( pendingSubtodo != 0 ) { 1106 if ( pendingSubtodo != 0 ) {
1101 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1107 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1102 } 1108 }
1103 pendingSubtodo = 0; 1109 pendingSubtodo = 0;
1104 return; 1110 return;
1105 } 1111 }
1106 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1112 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1107 if ( pendingSubtodo != 0 ) { 1113 if ( pendingSubtodo != 0 ) {
1108 bool allowReparent = true; 1114 bool allowReparent = true;
1109 QListViewItem *par = item; 1115 QListViewItem *par = item;
1110 while ( par ) { 1116 while ( par ) {
1111 if ( par == pendingSubtodo ) { 1117 if ( par == pendingSubtodo ) {
1112 allowReparent = false; 1118 allowReparent = false;
1113 break; 1119 break;
1114 } 1120 }
1115 par = par->parent(); 1121 par = par->parent();
1116 } 1122 }
1117 if ( !allowReparent ) { 1123 if ( !allowReparent ) {
1118 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1124 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1119 qDebug("Recursive reparenting not possible "); 1125 qDebug("Recursive reparenting not possible ");
1120 pendingSubtodo = 0; 1126 pendingSubtodo = 0;
1121 } else { 1127 } else {
1122 Todo* newParent = todoItem->todo(); 1128 Todo* newParent = todoItem->todo();
1123 Todo* newSub = pendingSubtodo->todo(); 1129 Todo* newSub = pendingSubtodo->todo();
1124 pendingSubtodo = 0; 1130 pendingSubtodo = 0;
1125 emit reparentTodoSignal( newParent,newSub ); 1131 emit reparentTodoSignal( newParent,newSub );
1126 return; 1132 return;
1127 } 1133 }
1128 } 1134 }
1129#if 0 1135#if 0
1130 // handled by the item itself 1136 // handled by the item itself
1131 bool completed = todoItem->todo()->isCompleted(); // Completed or not? 1137 bool completed = todoItem->todo()->isCompleted(); // Completed or not?
1132 qDebug("com %d ",completed ); 1138 qDebug("com %d ",completed );
1133 qDebug("itemclicked "); 1139 qDebug("itemclicked ");
1134 if (todoItem->isOn()) { 1140 if (todoItem->isOn()) {
1135 qDebug("on "); 1141 qDebug("on ");
1136 if (!completed) { 1142 if (!completed) {
1137 qDebug("set true "); 1143 qDebug("set true ");
1138 todoItem->todo()->setCompleted(QDateTime::currentDateTime()); 1144 todoItem->todo()->setCompleted(QDateTime::currentDateTime());
1139 } 1145 }
1140 } else { 1146 } else {
1141 qDebug("not on "); 1147 qDebug("not on ");
1142 if (completed) { 1148 if (completed) {
1143 qDebug("set false "); 1149 qDebug("set false ");
1144 todoItem->todo()->setCompleted(false); 1150 todoItem->todo()->setCompleted(false);
1145 } 1151 }
1146 } 1152 }
1147#endif 1153#endif
1148} 1154}
1149 1155
1150void KOTodoView::setDocumentId( const QString &id ) 1156void KOTodoView::setDocumentId( const QString &id )
1151{ 1157{
1152 kdDebug() << "KOTodoView::setDocumentId()" << endl; 1158 kdDebug() << "KOTodoView::setDocumentId()" << endl;
1153 1159
1154 mDocPrefs->setDoc( id ); 1160 mDocPrefs->setDoc( id );
1155} 1161}
1156 1162
1157void KOTodoView::itemStateChanged( QListViewItem *item ) 1163void KOTodoView::itemStateChanged( QListViewItem *item )
1158{ 1164{
1159 if (!item) return; 1165 if (!item) return;
1160 1166
1161 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1167 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1162 1168
1163// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1169// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1164 1170
1165 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1171 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1166} 1172}
1167 1173
1168void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1174void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1169{ 1175{
1170 mTodoListView->saveLayout(config,group); 1176 mTodoListView->saveLayout(config,group);
1171} 1177}
1172 1178
1173void KOTodoView::restoreLayout(KConfig *config, const QString &group) 1179void KOTodoView::restoreLayout(KConfig *config, const QString &group)
1174{ 1180{
1175 mTodoListView->restoreLayout(config,group); 1181 mTodoListView->restoreLayout(config,group);
1176} 1182}
1177 1183
1178void KOTodoView::processSelectionChange() 1184void KOTodoView::processSelectionChange()
1179{ 1185{
1180// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 1186// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
1181 1187
1182 KOTodoViewItem *item = 1188 KOTodoViewItem *item =
1183 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 1189 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
1184 1190
1185 if ( !item ) { 1191 if ( !item ) {
1186 emit incidenceSelected( 0 ); 1192 emit incidenceSelected( 0 );
1187 } else { 1193 } else {
1188 emit incidenceSelected( item->todo() ); 1194 emit incidenceSelected( item->todo() );
1189 } 1195 }
1190} 1196}
1191 1197
1192void KOTodoView::modified(bool b) 1198void KOTodoView::modified(bool b)
1193{ 1199{
1194 emit isModified(b); 1200 emit isModified(b);
1195} 1201}
1196void KOTodoView::setTodoModified( Todo* todo ) 1202void KOTodoView::setTodoModified( Todo* todo )
1197{ 1203{
1198 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 1204 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
1199} 1205}
1200void KOTodoView::clearSelection() 1206void KOTodoView::clearSelection()
1201{ 1207{
1202 mTodoListView->selectAll( false ); 1208 mTodoListView->selectAll( false );
1203} 1209}
1204void KOTodoView::setAllOpen() 1210void KOTodoView::setAllOpen()
1205{ 1211{
1206 if ( isFlatDisplay ) { 1212 if ( isFlatDisplay ) {
1207 isFlatDisplay = false; 1213 isFlatDisplay = false;
1208 mPopupMenu->setItemChecked( 8,false ); 1214 mPopupMenu->setItemChecked( 8,false );
1209 updateView(); 1215 updateView();
1210 } else { 1216 } else {
1211 storeCurrentItem(); 1217 storeCurrentItem();
1212 } 1218 }
1213 setOpen(mTodoListView->firstChild(), true); 1219 setOpen(mTodoListView->firstChild(), true);
1214 resetCurrentItem(); 1220 resetCurrentItem();
1215} 1221}
1216void KOTodoView::setAllClose() 1222void KOTodoView::setAllClose()
1217{ 1223{
1218 if ( isFlatDisplay ) { 1224 if ( isFlatDisplay ) {
1219 isFlatDisplay = false; 1225 isFlatDisplay = false;
1220 mPopupMenu->setItemChecked( 8,false ); 1226 mPopupMenu->setItemChecked( 8,false );
1221 updateView(); 1227 updateView();
1222 } else { 1228 } else {
1223 storeCurrentItem(); 1229 storeCurrentItem();
1224 } 1230 }
1225 setOpen(mTodoListView->firstChild(), false); 1231 setOpen(mTodoListView->firstChild(), false);
1226 resetCurrentItem(); 1232 resetCurrentItem();
1227} 1233}
1228void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) 1234void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
1229{ 1235{
1230 1236
1231 while ( item ) { 1237 while ( item ) {
1232 setOpen( item->firstChild(), setOpenI ); 1238 setOpen( item->firstChild(), setOpenI );
1233 item->setOpen( setOpenI ); 1239 item->setOpen( setOpenI );
1234 item = item->nextSibling(); 1240 item = item->nextSibling();
1235 } 1241 }
1236} 1242}
1237 1243
1238void KOTodoView::displayAllFlat() 1244void KOTodoView::displayAllFlat()
1239{ 1245{
1240 pendingSubtodo = 0; 1246 pendingSubtodo = 0;
1241 if ( mBlockUpdate ) { 1247 if ( mBlockUpdate ) {
1242 return; 1248 return;
1243 } 1249 }
1244 mPopupMenu->setItemChecked( 8,true ); 1250 mPopupMenu->setItemChecked( 8,true );
1245 isFlatDisplay = true; 1251 isFlatDisplay = true;
1246 QPtrList<Todo> todoList = calendar()->todos(); 1252 QPtrList<Todo> todoList = calendar()->todos();
1247 mTodoMap.clear(); 1253 mTodoMap.clear();
1248 mTodoListView->clear(); 1254 mTodoListView->clear();
1249 Todo *todo; 1255 Todo *todo;
1250 for(todo = todoList.first(); todo; todo = todoList.next()) { 1256 for(todo = todoList.first(); todo; todo = todoList.next()) {
1251 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 1257 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
1252 mTodoMap.insert(todo,todoItem); 1258 mTodoMap.insert(todo,todoItem);
1253 } 1259 }
1254 mTodoListView->setFocus(); 1260 mTodoListView->setFocus();
1255 processSelectionChange(); 1261 processSelectionChange();
1256} 1262}
1257 1263
1258void KOTodoView::setAllFlat() 1264void KOTodoView::setAllFlat()
1259{ 1265{
1260 if ( isFlatDisplay ) { 1266 if ( isFlatDisplay ) {
1261 isFlatDisplay = false; 1267 isFlatDisplay = false;
1262 mPopupMenu->setItemChecked( 8,false ); 1268 mPopupMenu->setItemChecked( 8,false );
1263 updateView(); 1269 updateView();
1264 return; 1270 return;
1265 } 1271 }
1266 storeCurrentItem(); 1272 storeCurrentItem();
1267 displayAllFlat(); 1273 displayAllFlat();
1268 resetCurrentItem(); 1274 resetCurrentItem();
1269} 1275}
1270 1276
1271void KOTodoView::purgeCompleted() 1277void KOTodoView::purgeCompleted()
1272{ 1278{
1273 emit purgeCompletedSignal(); 1279 emit purgeCompletedSignal();
1280
1274} 1281}
1275void KOTodoView::toggleQuickTodo() 1282void KOTodoView::toggleQuickTodo()
1276{ 1283{
1277 if ( mQuickAdd->isVisible() ) { 1284 if ( mQuickAdd->isVisible() ) {
1278 mQuickAdd->hide(); 1285 mQuickAdd->hide();
1279 KOPrefs::instance()->mEnableQuickTodo = false; 1286 KOPrefs::instance()->mEnableQuickTodo = false;
1280 } 1287 }
1281 else { 1288 else {
1282 mQuickAdd->show(); 1289 mQuickAdd->show();
1283 KOPrefs::instance()->mEnableQuickTodo = true; 1290 KOPrefs::instance()->mEnableQuickTodo = true;
1284 } 1291 }
1285 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 1292 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
1286 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 1293 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
1287} 1294}
1288 1295
1289void KOTodoView::toggleRunning() 1296void KOTodoView::toggleRunning()
1290{ 1297{
1291 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; 1298 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos;
1292 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 1299 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
1293 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 1300 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
1294 updateView(); 1301 updateView();
1295} 1302}
1296 1303
1297void KOTodoView::toggleCompleted() 1304void KOTodoView::toggleCompleted()
1298{ 1305{
1299 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; 1306 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo;
1300 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 1307 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
1301 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 1308 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
1302 updateView(); 1309 updateView();
1303} 1310}
1304 1311
1305void KOTodoView::addQuickTodo() 1312void KOTodoView::addQuickTodo()
1306{ 1313{
1307 Todo *todo = new Todo(); 1314 Todo *todo = new Todo();
1308 todo->setSummary(mQuickAdd->text()); 1315 todo->setSummary(mQuickAdd->text());
1309 todo->setOrganizer(KOPrefs::instance()->email()); 1316 todo->setOrganizer(KOPrefs::instance()->email());
1310 CalFilter * cf = mCalendar->filter(); 1317 CalFilter * cf = mCalendar->filter();
1311 if ( cf ) { 1318 if ( cf ) {
1312 if ( cf->isEnabled()&& cf->showCategories()) { 1319 if ( cf->isEnabled()&& cf->showCategories()) {
1313 todo->setCategories(cf->categoryList()); 1320 todo->setCategories(cf->categoryList());
1314 } 1321 }
1315 if ( cf->isEnabled() ) 1322 if ( cf->isEnabled() )
1316 todo->setSecrecy( cf->getSecrecy()); 1323 todo->setSecrecy( cf->getSecrecy());
1317 } 1324 }
1318 mCalendar->addTodo(todo); 1325 mCalendar->addTodo(todo);
1319 mQuickAdd->setText(""); 1326 mQuickAdd->setText("");
1320 todoModified (todo, KOGlobals::EVENTADDED ); 1327 todoModified (todo, KOGlobals::EVENTADDED );
1321 updateView(); 1328 updateView();
1322} 1329}
1323 1330
1324void KOTodoView::keyPressEvent ( QKeyEvent * e ) 1331void KOTodoView::keyPressEvent ( QKeyEvent * e )
1325{ 1332{
1326 // e->ignore(); 1333 // e->ignore();
1327 //return; 1334 //return;
1328 //qDebug("KOTodoView::keyPressEvent "); 1335 //qDebug("KOTodoView::keyPressEvent ");
1329 switch ( e->key() ) { 1336 switch ( e->key() ) {
1330 case Qt::Key_Down: 1337 case Qt::Key_Down:
1331 case Qt::Key_Up: 1338 case Qt::Key_Up:
1332 QWidget::keyPressEvent ( e ); 1339 QWidget::keyPressEvent ( e );
1333 break; 1340 break;
1334 1341
1335 case Qt::Key_Q: 1342 case Qt::Key_Q:
1336 toggleQuickTodo(); 1343 toggleQuickTodo();
1337 break; 1344 break;
1338 case Qt::Key_U: 1345 case Qt::Key_U:
1339 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1346 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1340 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1347 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1341 unparentTodo(); 1348 unparentTodo();
1342 e->accept(); 1349 e->accept();
1343 } else 1350 } else
1344 e->ignore(); 1351 e->ignore();
1345 break; 1352 break;
1346 case Qt::Key_S: 1353 case Qt::Key_S:
1347 if ( e->state() == Qt::ControlButton ) { 1354 if ( e->state() == Qt::ControlButton ) {
1348 e->ignore(); 1355 e->ignore();
1349 break; 1356 break;
1350 } 1357 }
1351 if ( e->state() == Qt::ShiftButton ) { 1358 if ( e->state() == Qt::ShiftButton ) {
1352 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1359 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1353 reparentTodo(); 1360 reparentTodo();
1354 e->accept(); 1361 e->accept();
1355 } else 1362 } else
1356 e->ignore(); 1363 e->ignore();
1357 break; 1364 break;
1358 case Qt::Key_P: 1365 case Qt::Key_P:
1359 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1366 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1360 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1367 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1361 if ( pendingSubtodo ) 1368 if ( pendingSubtodo )
1362 itemClicked(mActiveItem); 1369 itemClicked(mActiveItem);
1363 e->accept(); 1370 e->accept();
1364 } else 1371 } else
1365 e->ignore(); 1372 e->ignore();
1366 break; 1373 break;
1367 case Qt::Key_Escape: 1374 case Qt::Key_Escape:
1368 if ( pendingSubtodo ) { 1375 if ( pendingSubtodo ) {
1369 itemClicked(0); 1376 itemClicked(0);
1370 e->accept(); 1377 e->accept();
1371 } else 1378 } else
1372 e->ignore(); 1379 e->ignore();
1373 break; 1380 break;
1374 default: 1381 default:
1375 e->ignore(); 1382 e->ignore();
1376 } 1383 }
1377 1384
1378 if ( true ) { 1385 if ( true ) {
1379 if ( e->key() == Qt::Key_I ) { 1386 if ( e->key() == Qt::Key_I ) {
1380 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); 1387 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem();
1381 if ( cn ) { 1388 if ( cn ) {
1382 mActiveItem = cn; 1389 mActiveItem = cn;
1383 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 1390 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
1384 if ( ci ){ 1391 if ( ci ){
1385 showTodo(); 1392 showTodo();
1386 cn = (KOTodoViewItem*)cn->itemBelow(); 1393 cn = (KOTodoViewItem*)cn->itemBelow();
1387 if ( cn ) { 1394 if ( cn ) {
1388 mTodoListView->setCurrentItem ( cn ); 1395 mTodoListView->setCurrentItem ( cn );
1389 mTodoListView->ensureItemVisible ( cn ); 1396 mTodoListView->ensureItemVisible ( cn );
1390 } 1397 }
1391 1398
1392 } 1399 }
1393 } 1400 }
1394 e->accept(); 1401 e->accept();
1395 1402
1396 } 1403 }
1397 1404
1398 } 1405 }
1399 1406
1400} 1407}
1401void KOTodoView::updateTodo( Todo * t, int type ) 1408void KOTodoView::updateTodo( Todo * t, int type )
1402{ 1409{
1403 if ( mBlockUpdate) 1410 if ( mBlockUpdate)
1404 return; 1411 return;
1405 1412
1406 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 1413 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
1407 itemIterator = mTodoMap.find(t); 1414 itemIterator = mTodoMap.find(t);
1408 if (itemIterator != mTodoMap.end()) { 1415 if (itemIterator != mTodoMap.end()) {
1409 (*itemIterator)->construct(); 1416 (*itemIterator)->construct();
1410 } else { 1417 } else {
1411 if ( type == KOGlobals::EVENTADDED ) { 1418 if ( type == KOGlobals::EVENTADDED ) {
1412 insertTodoItem( t ); 1419 insertTodoItem( t );
1413 } 1420 }
1414 } 1421 }
1415 1422
1416} 1423}
1417 1424
1418void KOTodoView::todoModified(Todo * t , int p ) 1425void KOTodoView::todoModified(Todo * t , int p )
1419{ 1426{
1420 mBlockUpdate = true; 1427 mBlockUpdate = true;
1421 emit todoModifiedSignal ( t, p ); 1428 emit todoModifiedSignal ( t, p );
1422 mBlockUpdate = false; 1429 mBlockUpdate = false;
1423} 1430}
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index e553d0e..39976cf 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -1,262 +1,263 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOTODOVIEW_H 23#ifndef KOTODOVIEW_H
24#define KOTODOVIEW_H 24#define KOTODOVIEW_H
25 25
26#include <qfont.h> 26#include <qfont.h>
27#include <qfontmetrics.h> 27#include <qfontmetrics.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qptrlist.h> 29#include <qptrlist.h>
30#include <qstrlist.h> 30#include <qstrlist.h>
31#include <qlistbox.h> 31#include <qlistbox.h>
32#include <qpopupmenu.h> 32#include <qpopupmenu.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qmap.h> 34#include <qmap.h>
35#include <qlistview.h> 35#include <qlistview.h>
36#include <klistview.h> 36#include <klistview.h>
37 37
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40 40
41#include <korganizer/baseview.h> 41#include <korganizer/baseview.h>
42 42
43#include "kotodoviewitem.h" 43#include "kotodoviewitem.h"
44#include "koprefs.h" 44#include "koprefs.h"
45#include "koglobals.h" 45#include "koglobals.h"
46#include "datenavigator.h" 46#include "datenavigator.h"
47 47
48class QDragEnterEvent; 48class QDragEnterEvent;
49class QDragMoveEvent; 49class QDragMoveEvent;
50class QDragLeaveEvent; 50class QDragLeaveEvent;
51class QDropEvent; 51class QDropEvent;
52class KOTodoViewWhatsThis; 52class KOTodoViewWhatsThis;
53 53
54class DocPrefs; 54class DocPrefs;
55 55
56class KOTodoListView : public KListView 56class KOTodoListView : public KListView
57{ 57{
58 Q_OBJECT 58 Q_OBJECT
59 public: 59 public:
60 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); 60 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
61 virtual ~KOTodoListView() {} 61 virtual ~KOTodoListView() {}
62 62
63 signals: 63 signals:
64 void paintNeeded(); 64 void paintNeeded();
65 void todoDropped(Todo *, int); 65 void todoDropped(Todo *, int);
66 void double_Clicked(QListViewItem *item); 66 void double_Clicked(QListViewItem *item);
67 void reparentTodoSignal( Todo *,Todo * ); 67 void reparentTodoSignal( Todo *,Todo * );
68 void unparentTodoSignal(Todo *); 68 void unparentTodoSignal(Todo *);
69 void deleteTodo( Todo * ); 69 void deleteTodo( Todo * );
70 protected: 70 protected:
71 void wheelEvent (QWheelEvent *e);
71 void contentsDragEnterEvent(QDragEnterEvent *); 72 void contentsDragEnterEvent(QDragEnterEvent *);
72 void contentsDragMoveEvent(QDragMoveEvent *); 73 void contentsDragMoveEvent(QDragMoveEvent *);
73 void contentsDragLeaveEvent(QDragLeaveEvent *); 74 void contentsDragLeaveEvent(QDragLeaveEvent *);
74 void contentsDropEvent(QDropEvent *); 75 void contentsDropEvent(QDropEvent *);
75 76
76 void contentsMousePressEvent(QMouseEvent *); 77 void contentsMousePressEvent(QMouseEvent *);
77 void contentsMouseMoveEvent(QMouseEvent *); 78 void contentsMouseMoveEvent(QMouseEvent *);
78 void contentsMouseReleaseEvent(QMouseEvent *); 79 void contentsMouseReleaseEvent(QMouseEvent *);
79 void contentsMouseDoubleClickEvent(QMouseEvent *); 80 void contentsMouseDoubleClickEvent(QMouseEvent *);
80 81
81 private: 82 private:
82 void paintEvent(QPaintEvent * pevent); 83 void paintEvent(QPaintEvent * pevent);
83 bool internalDrop; 84 bool internalDrop;
84 QString mName; 85 QString mName;
85 Calendar *mCalendar; 86 Calendar *mCalendar;
86 QPoint mPressPos; 87 QPoint mPressPos;
87 bool mMousePressed; 88 bool mMousePressed;
88 QListViewItem *mOldCurrent; 89 QListViewItem *mOldCurrent;
89 bool mFlagKeyPressed; 90 bool mFlagKeyPressed;
90 void keyPressEvent ( QKeyEvent * ) ; 91 void keyPressEvent ( QKeyEvent * ) ;
91 void keyReleaseEvent ( QKeyEvent * ) ; 92 void keyReleaseEvent ( QKeyEvent * ) ;
92}; 93};
93 94
94 95
95/** 96/**
96 This is the line-edit on top of the todoview for fast addition of new todos 97 This is the line-edit on top of the todoview for fast addition of new todos
97*/ 98*/
98class KOQuickTodo : public QLineEdit 99class KOQuickTodo : public QLineEdit
99{ 100{
100 public: 101 public:
101 KOQuickTodo(QWidget *parent=0); 102 KOQuickTodo(QWidget *parent=0);
102 protected: 103 protected:
103 void focusInEvent(QFocusEvent *ev); 104 void focusInEvent(QFocusEvent *ev);
104 void focusOutEvent(QFocusEvent *ev); 105 void focusOutEvent(QFocusEvent *ev);
105}; 106};
106 107
107 108
108/** 109/**
109 This class provides a multi-column list view of todo events. 110 This class provides a multi-column list view of todo events.
110 111
111 @short multi-column list view of todo events. 112 @short multi-column list view of todo events.
112 @author Cornelius Schumacher <schumacher@kde.org> 113 @author Cornelius Schumacher <schumacher@kde.org>
113*/ 114*/
114class KOTodoView : public KOrg::BaseView 115class KOTodoView : public KOrg::BaseView
115{ 116{
116 Q_OBJECT 117 Q_OBJECT
117 public: 118 public:
118 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); 119 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
119 ~KOTodoView(); 120 ~KOTodoView();
120 121
121 QPtrList<Incidence> selectedIncidences(); 122 QPtrList<Incidence> selectedIncidences();
122 QPtrList<Todo> selectedTodos(); 123 QPtrList<Todo> selectedTodos();
123 124
124 DateList selectedDates() 125 DateList selectedDates()
125 {DateList q; 126 {DateList q;
126 return q;} 127 return q;}
127 128
128 /** Return number of shown dates. TodoView does not show dates, */ 129 /** Return number of shown dates. TodoView does not show dates, */
129 int currentDateCount() { return 0; } 130 int currentDateCount() { return 0; }
130 131
131 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); 132 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
132 133
133 void setDocumentId( const QString & ); 134 void setDocumentId( const QString & );
134 135
135 void saveLayout(KConfig *config, const QString &group) const; 136 void saveLayout(KConfig *config, const QString &group) const;
136 void restoreLayout(KConfig *config, const QString &group); 137 void restoreLayout(KConfig *config, const QString &group);
137 /** Create a popup menu to set categories */ 138 /** Create a popup menu to set categories */
138 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); 139 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem);
139 void setNavigator( DateNavigator* nav ) {mNavigator = nav;} 140 void setNavigator( DateNavigator* nav ) {mNavigator = nav;}
140 QString getWhatsThisText(QPoint p); 141 QString getWhatsThisText(QPoint p);
141 142
142 public slots: 143 public slots:
143 void updateView(); 144 void updateView();
144 void updateConfig(); 145 void updateConfig();
145 146
146 void changeEventDisplay(Event *, int); 147 void changeEventDisplay(Event *, int);
147 148
148 void showDates(const QDate &start, const QDate &end); 149 void showDates(const QDate &start, const QDate &end);
149 void showEvents(QPtrList<Event> eventList); 150 void showEvents(QPtrList<Event> eventList);
150 151
151 void clearSelection(); 152 void clearSelection();
152 void jumpToDate (); 153 void jumpToDate ();
153 154
154 void editItem(QListViewItem *item); 155 void editItem(QListViewItem *item);
155 void showItem(QListViewItem *item,const QPoint &,int); 156 void showItem(QListViewItem *item,const QPoint &,int);
156 void popupMenu(QListViewItem *item,const QPoint &,int); 157 void popupMenu(QListViewItem *item,const QPoint &,int);
157 void newTodo(); 158 void newTodo();
158 void newSubTodo(); 159 void newSubTodo();
159 void unparentTodo(); 160 void unparentTodo();
160 void reparentTodo(); 161 void reparentTodo();
161 void showTodo(); 162 void showTodo();
162 void editTodo(); 163 void editTodo();
163 void cloneTodo(); 164 void cloneTodo();
164 void cancelTodo(); 165 void cancelTodo();
165 void moveTodo(); 166 void moveTodo();
166 void beamTodo(); 167 void beamTodo();
167 void deleteTodo(); 168 void deleteTodo();
168 169
169 void setNewPriority(int); 170 void setNewPriority(int);
170 void setNewPercentage(int); 171 void setNewPercentage(int);
171 void changedCategories(int); 172 void changedCategories(int);
172 173
173 void setAllOpen(); 174 void setAllOpen();
174 void setAllClose(); 175 void setAllClose();
175 void setAllFlat(); 176 void setAllFlat();
176 void displayAllFlat(); 177 void displayAllFlat();
177 178
178 void purgeCompleted(); 179 void purgeCompleted();
179 void toggleCompleted(); 180 void toggleCompleted();
180 void toggleRunning(); 181 void toggleRunning();
181 void toggleQuickTodo(); 182 void toggleQuickTodo();
182 void updateTodo( Todo *, int ); 183 void updateTodo( Todo *, int );
183 184
184 void itemClicked(QListViewItem *); 185 void itemClicked(QListViewItem *);
185 void itemStateChanged(QListViewItem *); 186 void itemStateChanged(QListViewItem *);
186 void modified(bool); 187 void modified(bool);
187 void itemDoubleClicked(QListViewItem *item); 188 void itemDoubleClicked(QListViewItem *item);
188 189
189 signals: 190 signals:
190 void newTodoSignal(); 191 void newTodoSignal();
191 void newSubTodoSignal(Todo *); 192 void newSubTodoSignal(Todo *);
192 void unparentTodoSignal(Todo *); 193 void unparentTodoSignal(Todo *);
193 void reparentTodoSignal( Todo *,Todo * ); 194 void reparentTodoSignal( Todo *,Todo * );
194 void showTodoSignal(Todo *); 195 void showTodoSignal(Todo *);
195 196
196 void editTodoSignal(Todo *); 197 void editTodoSignal(Todo *);
197 void deleteTodoSignal(Todo *); 198 void deleteTodoSignal(Todo *);
198 void todoModifiedSignal (Todo *, int); 199 void todoModifiedSignal (Todo *, int);
199 200
200 void isModified(bool); 201 void isModified(bool);
201 void cloneTodoSignal( Incidence * ); 202 void cloneTodoSignal( Incidence * );
202 void cancelTodoSignal( Incidence * ); 203 void cancelTodoSignal( Incidence * );
203 void moveTodoSignal( Incidence * ); 204 void moveTodoSignal( Incidence * );
204 void beamTodoSignal( Incidence * ); 205 void beamTodoSignal( Incidence * );
205 void purgeCompletedSignal(); 206 void purgeCompletedSignal();
206 207
207 protected slots: 208 protected slots:
208 void paintNeeded(); 209 void paintNeeded();
209 void processSelectionChange(); 210 void processSelectionChange();
210 void addQuickTodo(); 211 void addQuickTodo();
211 void setTodoModified( Todo* ); 212 void setTodoModified( Todo* );
212 void todoModified(Todo *, int ); 213 void todoModified(Todo *, int );
213 214
214 private: 215 private:
215 /* 216 /*
216 * the TodoEditor approach is rather unscaling in the long 217 * the TodoEditor approach is rather unscaling in the long
217 * run. 218 * run.
218 * Korganizer keeps it in memory and we need to update 219 * Korganizer keeps it in memory and we need to update
219 * 1. make KOTodoViewItem a QObject again? 220 * 1. make KOTodoViewItem a QObject again?
220 * 2. add a public method for setting one todo modified? 221 * 2. add a public method for setting one todo modified?
221 * 3. add a private method for setting a todo modified + friend here? 222 * 3. add a private method for setting a todo modified + friend here?
222 * -- zecke 2002-07-08 223 * -- zecke 2002-07-08
223 */ 224 */
224 KOTodoViewWhatsThis* mKOTodoViewWhatsThis; 225 KOTodoViewWhatsThis* mKOTodoViewWhatsThis;
225 friend class KOTodoListView; 226 friend class KOTodoListView;
226 void paintEvent(QPaintEvent * pevent); 227 void paintEvent(QPaintEvent * pevent);
227 bool mPendingUpdateBeforeRepaint; 228 bool mPendingUpdateBeforeRepaint;
228 friend class KOTodoViewItem; 229 friend class KOTodoViewItem;
229 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); 230 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
230 void restoreItemState( QListViewItem * ); 231 void restoreItemState( QListViewItem * );
231 232
232 bool checkTodo( Todo * ); 233 bool checkTodo( Todo * );
233 bool isFlatDisplay; 234 bool isFlatDisplay;
234 void setOpen( QListViewItem*, bool setOpen); 235 void setOpen( QListViewItem*, bool setOpen);
235 KOTodoListView *mTodoListView; 236 KOTodoListView *mTodoListView;
236 QPopupMenu *mItemPopupMenu; 237 QPopupMenu *mItemPopupMenu;
237 QPopupMenu *mPopupMenu; 238 QPopupMenu *mPopupMenu;
238 QPopupMenu *mPriorityPopupMenu; 239 QPopupMenu *mPriorityPopupMenu;
239 QPopupMenu *mPercentageCompletedPopupMenu; 240 QPopupMenu *mPercentageCompletedPopupMenu;
240 QPopupMenu *mCategoryPopupMenu; 241 QPopupMenu *mCategoryPopupMenu;
241 242
242 QMap<int, int> mPercentage; 243 QMap<int, int> mPercentage;
243 QMap<int, int> mPriority; 244 QMap<int, int> mPriority;
244 QMap<int, QString> mCategory; 245 QMap<int, QString> mCategory;
245 KOTodoViewItem *mActiveItem; 246 KOTodoViewItem *mActiveItem;
246 247
247 QMap<Todo *,KOTodoViewItem *> mTodoMap; 248 QMap<Todo *,KOTodoViewItem *> mTodoMap;
248 QString mName; 249 QString mName;
249 250
250 DocPrefs *mDocPrefs; 251 DocPrefs *mDocPrefs;
251 QString mCurrentDoc; 252 QString mCurrentDoc;
252 KOQuickTodo *mQuickAdd; 253 KOQuickTodo *mQuickAdd;
253 bool mBlockUpdate; 254 bool mBlockUpdate;
254 void keyPressEvent ( QKeyEvent * ) ; 255 void keyPressEvent ( QKeyEvent * ) ;
255 KOTodoViewItem * pendingSubtodo; 256 KOTodoViewItem * pendingSubtodo;
256 DateNavigator* mNavigator; 257 DateNavigator* mNavigator;
257 void storeCurrentItem(); 258 void storeCurrentItem();
258 void resetCurrentItem(); 259 void resetCurrentItem();
259 Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; 260 Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
260}; 261};
261 262
262#endif 263#endif