author | zautrix <zautrix> | 2005-07-01 14:47:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-01 14:47:16 (UTC) |
commit | f330b9d0a7f755660ddd59739e3ab9b98d60bc18 (patch) (unidiff) | |
tree | c29630a799dc39906e57ba1d23cba6861f1cc0bb | |
parent | eee2e65aebe1c93a0c391a927b86ce87a278a4df (diff) | |
download | kdepimpi-f330b9d0a7f755660ddd59739e3ab9b98d60bc18.zip kdepimpi-f330b9d0a7f755660ddd59739e3ab9b98d60bc18.tar.gz kdepimpi-f330b9d0a7f755660ddd59739e3ab9b98d60bc18.tar.bz2 |
fixii
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 6 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 20 | ||||
-rw-r--r-- | korganizer/koeditordetails.cpp | 2 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 9 | ||||
-rw-r--r-- | korganizer/koeditorgeneralevent.cpp | 5 | ||||
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 2 | ||||
-rw-r--r-- | korganizer/koeventeditor.cpp | 6 | ||||
-rw-r--r-- | korganizer/koincidenceeditor.cpp | 2 | ||||
-rw-r--r-- | korganizer/kotodoeditor.cpp | 4 |
9 files changed, 43 insertions, 13 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 11a0413..44e6bdf 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt | |||
@@ -1090,392 +1090,392 @@ | |||
1090 | { "KO/Pi","KO/Pi" }, | 1090 | { "KO/Pi","KO/Pi" }, |
1091 | { "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" }, | 1091 | { "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" }, |
1092 | { "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." }, | 1092 | { "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." }, |
1093 | { "Sound.Al.: ","Sound.Al.: " }, | 1093 | { "Sound.Al.: ","Sound.Al.: " }, |
1094 | { "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" }, | 1094 | { "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" }, |
1095 | { "Restore","Wiederherstellen" }, | 1095 | { "Restore","Wiederherstellen" }, |
1096 | { "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklich\nwiederherstellen?" }, | 1096 | { "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklich\nwiederherstellen?" }, |
1097 | { "% completed","% erledigt" }, | 1097 | { "% completed","% erledigt" }, |
1098 | { "%d item(s) found.","%d Item(s) gefunden." }, | 1098 | { "%d item(s) found.","%d Item(s) gefunden." }, |
1099 | { "Set complete","Setze auf erledigt" }, | 1099 | { "Set complete","Setze auf erledigt" }, |
1100 | { "(cancelled)","(gecancelt)" }, | 1100 | { "(cancelled)","(gecancelt)" }, |
1101 | { "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" }, | 1101 | { "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" }, |
1102 | { " Local time "," Locale Zeit " }, | 1102 | { " Local time "," Locale Zeit " }, |
1103 | { "Form2","Form2" }, | 1103 | { "Form2","Form2" }, |
1104 | { "Filter enabled","Filter angeschaltet" }, | 1104 | { "Filter enabled","Filter angeschaltet" }, |
1105 | { "Edit Filters","Ändere Filter" }, | 1105 | { "Edit Filters","Ändere Filter" }, |
1106 | { "Print What's Next View...","Drucke What's Next Ansicht..." }, | 1106 | { "Print What's Next View...","Drucke What's Next Ansicht..." }, |
1107 | { "Agenda","Agenda" }, | 1107 | { "Agenda","Agenda" }, |
1108 | { " ("," (" }, | 1108 | { " ("," (" }, |
1109 | { "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" }, | 1109 | { "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" }, |
1110 | { "Print","Print" }, | 1110 | { "Print","Print" }, |
1111 | { "&Setup Printer...","Drucker &Setup..." }, | 1111 | { "&Setup Printer...","Drucker &Setup..." }, |
1112 | { "View Type","Zeige Typ" }, | 1112 | { "View Type","Zeige Typ" }, |
1113 | { "Page &orientation:","Seiten Ausrichtung:" }, | 1113 | { "Page &orientation:","Seiten Ausrichtung:" }, |
1114 | { "Use Default of Selected Style","Default des selektierten Stils" }, | 1114 | { "Use Default of Selected Style","Default des selektierten Stils" }, |
1115 | { "Use Default Setting of Printer","Default Einstellung des Druckers" }, | 1115 | { "Use Default Setting of Printer","Default Einstellung des Druckers" }, |
1116 | { "Portrait","Portrait" }, | 1116 | { "Portrait","Portrait" }, |
1117 | { "Landscape","Landschaft" }, | 1117 | { "Landscape","Landschaft" }, |
1118 | { "Print day","Drucke Tag" }, | 1118 | { "Print day","Drucke Tag" }, |
1119 | { "CalPrintDay_Base","CalPrintDay_Base" }, | 1119 | { "CalPrintDay_Base","CalPrintDay_Base" }, |
1120 | { "Date && Time Range","Datum && Zeitspanne" }, | 1120 | { "Date && Time Range","Datum && Zeitspanne" }, |
1121 | { "&End date:","&Enddatum:" }, | 1121 | { "&End date:","&Enddatum:" }, |
1122 | { "&Start date:","&Startdatum:" }, | 1122 | { "&Start date:","&Startdatum:" }, |
1123 | { "Start &time:","Startzeit:" }, | 1123 | { "Start &time:","Startzeit:" }, |
1124 | { "End ti&me:","Endzeit:" }, | 1124 | { "End ti&me:","Endzeit:" }, |
1125 | { "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" }, | 1125 | { "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" }, |
1126 | { "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" }, | 1126 | { "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" }, |
1127 | { "Alt+D","Alt+D" }, | 1127 | { "Alt+D","Alt+D" }, |
1128 | { "&Use colors","Nutze Farben" }, | 1128 | { "&Use colors","Nutze Farben" }, |
1129 | { "Alt+U","Alt+U" }, | 1129 | { "Alt+U","Alt+U" }, |
1130 | { "Print week","Drucke Woche" }, | 1130 | { "Print week","Drucke Woche" }, |
1131 | { "CalPrintWeek_Base","CalPrintWeek_Base" }, | 1131 | { "CalPrintWeek_Base","CalPrintWeek_Base" }, |
1132 | { "Use &colors","Nutze Farben" }, | 1132 | { "Use &colors","Nutze Farben" }, |
1133 | { "Type of View","Typ der Ansicht" }, | 1133 | { "Type of View","Typ der Ansicht" }, |
1134 | { "Print as &Filofax page","Drucke als &Filofax Seite" }, | 1134 | { "Print as &Filofax page","Drucke als &Filofax Seite" }, |
1135 | { "Alt+F","Alt+F" }, | 1135 | { "Alt+F","Alt+F" }, |
1136 | { "Print as &timetable view:","Drucke als Zeittabelle:" }, | 1136 | { "Print as &timetable view:","Drucke als Zeittabelle:" }, |
1137 | { "Alt+T","Alt+T" }, | 1137 | { "Alt+T","Alt+T" }, |
1138 | { "Print as split week view","Drucke als gesplittete Wochenansicht" }, | 1138 | { "Print as split week view","Drucke als gesplittete Wochenansicht" }, |
1139 | { "Print month","Drucke Monat" }, | 1139 | { "Print month","Drucke Monat" }, |
1140 | { "CalPrintMonth_Base","CalPrintMonth_Base" }, | 1140 | { "CalPrintMonth_Base","CalPrintMonth_Base" }, |
1141 | { "&Start month:","&Startmonat:" }, | 1141 | { "&Start month:","&Startmonat:" }, |
1142 | { "&End month:","&Endmonat:" }, | 1142 | { "&End month:","&Endmonat:" }, |
1143 | { "Print week &numbers","Drucke Wochen Nummer(n)" }, | 1143 | { "Print week &numbers","Drucke Wochen Nummer(n)" }, |
1144 | { "Print todos","Drucke Todos" }, | 1144 | { "Print todos","Drucke Todos" }, |
1145 | { "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" }, | 1145 | { "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" }, |
1146 | { "Include &description of the item","Inclusive Itembeschreibung" }, | 1146 | { "Include &description of the item","Inclusive Itembeschreibung" }, |
1147 | { "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" }, | 1147 | { "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" }, |
1148 | { "Include &priority of the item","Inclusive Priorität des Items" }, | 1148 | { "Include &priority of the item","Inclusive Priorität des Items" }, |
1149 | { "Items to Print","Zu druckende Items" }, | 1149 | { "Items to Print","Zu druckende Items" }, |
1150 | { "&From:","Von:" }, | 1150 | { "&From:","Von:" }, |
1151 | { "&To:","Bis:" }, | 1151 | { "&To:","Bis:" }, |
1152 | { "Print &all todo items","Drucke alle Todo Items" }, | 1152 | { "Print &all todo items","Drucke alle Todo Items" }, |
1153 | { "Print only &uncompleted items","Drucke nur nicht erledigte Todos" }, | 1153 | { "Print only &uncompleted items","Drucke nur nicht erledigte Todos" }, |
1154 | { "Only items due in the &range:","Nur Items in dem Zeitraum:" }, | 1154 | { "Only items due in the &range:","Nur Items in dem Zeitraum:" }, |
1155 | { "Todo List","Todo Liste" }, | 1155 | { "Todo List","Todo Liste" }, |
1156 | { "&Title:","&Titel:" }, | 1156 | { "&Title:","&Titel:" }, |
1157 | { "Co&nnect subtodos with its parent","Verbinde Untertodos mit ihren Ober-Todos" }, | 1157 | { "Co&nnect subtodos with its parent","Verbinde Untertodos mit ihren Ober-Todos" }, |
1158 | { "Todo list","Todo Liste" }, | 1158 | { "Todo list","Todo Liste" }, |
1159 | { "&Print...","Drucke..." }, | 1159 | { "&Print...","Drucke..." }, |
1160 | { "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" }, | 1160 | { "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" }, |
1161 | { "[Unconfigured]","[Unkonfiguriert]" }, | 1161 | { "[Unconfigured]","[Unkonfiguriert]" }, |
1162 | { "OK","OK" }, | 1162 | { "OK","OK" }, |
1163 | { "FilterEditor","FilterEditor" }, | 1163 | { "FilterEditor","FilterEditor" }, |
1164 | { "Include","Inclusive" }, | 1164 | { "Include","Inclusive" }, |
1165 | { "Exclude","Exclusive" }, | 1165 | { "Exclude","Exclusive" }, |
1166 | { "Edit Selection...","Editiere Auswahl" }, | 1166 | { "Edit Selection...","Editiere Auswahl" }, |
1167 | { "recurring events","wiederholende Termine" }, | 1167 | { "recurring events","wiederholende Termine" }, |
1168 | { "recurr. events","wiederh.Termine" }, | 1168 | { "recurr. events","wiederh.Termine" }, |
1169 | { "completed to-dos","erledigte Todos" }, | 1169 | { "completed to-dos","erledigte Todos" }, |
1170 | { "events","Termine" }, | 1170 | { "events","Termine" }, |
1171 | { "todos","Todos" }, | 1171 | { "todos","Todos" }, |
1172 | { "journals","Journale" }, | 1172 | { "journals","Journale" }, |
1173 | { "public","öffentl." }, | 1173 | { "public","öffentl." }, |
1174 | { "private","privat" }, | 1174 | { "private","privat" }, |
1175 | { "confidential","vertraul." }, | 1175 | { "confidential","vertraul." }, |
1176 | { "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Untertodos.\nAlle erledigten Untertodos\nwerden auch gelöscht!" }, | 1176 | { "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Untertodos.\nAlle erledigten Untertodos\nwerden auch gelöscht!" }, |
1177 | { "Yesterday","Gestern" }, | 1177 | { "Yesterday","Gestern" }, |
1178 | { "Day after tomorrow","Übermorgen" }, | 1178 | { "Day after tomorrow","Übermorgen" }, |
1179 | { "Tomorrow","Morgen" }, | 1179 | { "Tomorrow","Morgen" }, |
1180 | { "Day before yesterday","Vorgestern" }, | 1180 | { "Day before yesterday","Vorgestern" }, |
1181 | { "Size %1","Größe %1" }, | 1181 | { "Size %1","Größe %1" }, |
1182 | { "New Agendasize: %1","Neue Agendagröße: %1" }, | 1182 | { "New Agendasize: %1","Neue Agendagröße: %1" }, |
1183 | { " (%1 y.)"," (%1 J.)" }, | 1183 | { " (%1 y.)"," (%1 J.)" }, |
1184 | { "Allday:","Ganztägig:" }, | 1184 | { "Allday:","Ganztägig:" }, |
1185 | { "compl.todos","erled.Todos" }, | 1185 | { "compl.todos","erled.Todos" }, |
1186 | { "Day view","Tagesansicht" }, | 1186 | { "Day view","Tagesansicht" }, |
1187 | { "Next days","Nächste Tage" }, | 1187 | { "Next days","Nächste Tage" }, |
1188 | { "Next week","Nächste Woche" }, | 1188 | { "Next week","Nächste Woche" }, |
1189 | { "Next two weeks","Nächste zwei Wochen" }, | 1189 | { "Next two weeks","Nächste zwei Wochen" }, |
1190 | { "This month","Dieser Monat" }, | 1190 | { "This month","Dieser Monat" }, |
1191 | { "Journal view","Journal" }, | 1191 | { "Journal view","Journal" }, |
1192 | { "Display all opened","Zeige alle geöffnet" }, | 1192 | { "Display all opened","Zeige alle geöffnet" }, |
1193 | { "Display all closed","Zeige alle geschlossen" }, | 1193 | { "Display all closed","Zeige alle geschlossen" }, |
1194 | { "Display all flat","Zeige alle flach" }, | 1194 | { "Display all flat","Zeige alle flach" }, |
1195 | { "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, | 1195 | { "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, |
1196 | { "Default todo done color:","Standard Todo erledigt Farbe" }, | 1196 | { "Default todo done color:","Standard Todo erledigt Farbe" }, |
1197 | { "Select week %1-%2","Wähle Woche %1-%2" }, | 1197 | { "Select week %1-%2","Wähle Woche %1-%2" }, |
1198 | { "Select Week","Wähle Woche" }, | 1198 | { "Select Week","Wähle Woche" }, |
1199 | { "Set alarm for selected...","Setze Alarm für Selekt..." }, | 1199 | { "Set alarm for selected...","Setze Alarm für Selekt..." }, |
1200 | { "Set Alarm!","Setze Alarm!" }, | 1200 | { "Set Alarm!","Setze Alarm!" }, |
1201 | { "Changed alarm for %1 items","Alarm für %1 Items geändert" }, | 1201 | { "Changed alarm for %1 items","Alarm für %1 Items geändert" }, |
1202 | { " and "," und " }, | 1202 | { " and "," und " }, |
1203 | { "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, | 1203 | { "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, |
1204 | { "Mail to selected","Mail an Ausgewählte" }, | 1204 | { "Mail to selected","Mail an Ausgewählte" }, |
1205 | { "Mail to all","Mail an Alle" }, | 1205 | { "Mail to all","Mail an Alle" }, |
1206 | { "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, | 1206 | { "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, |
1207 | { "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, | 1207 | { "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, |
1208 | { " on"," am" }, | 1208 | { " on"," am" }, |
1209 | { " completed on "," erledigt am " }, | 1209 | { " completed on "," erledigt am " }, |
1210 | { "Save as Event template","Speichere als Vorlage" }, | 1210 | { "Save as Event template","Speichere als Vorlage" }, |
1211 | { "Load Event template","Lade Termin Vorlage" }, | 1211 | { "Load Event template","Lade Termin Vorlage" }, |
1212 | { "Save as Journal template","Speichere als Journal Vorlage" }, | 1212 | { "Save as Journal template","Speichere als Journal Vorlage" }, |
1213 | { "Insert Journal template","Füge Journal Vorlage ein" }, | 1213 | { "Insert Journal template","Füge Journal Vorlage ein" }, |
1214 | { "Sub todos:<br>","Unter Todos:<br>" }, | 1214 | { "Sub todos:<br>","Unter Todos:<br>" }, |
1215 | { "Parent todo:<br>","Über Todo:<br>" }, | 1215 | { "Parent todo:<br>","Über Todo:<br>" }, |
1216 | { "Set current as color category","Setze Gewählte als Farbkategorie" }, | 1216 | { "Set current as color category","Setze Gewählte als Farbkategorie" }, |
1217 | { " completed"," erledigt" }, | 1217 | { " completed"," erledigt" }, |
1218 | { "(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!" }, | 1218 | { "(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!" }, |
1219 | { "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." }, | 1219 | { "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." }, |
1220 | { "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." }, | 1220 | { "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." }, |
1221 | { "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." }, | 1221 | { "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." }, |
1222 | { "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?" }, | 1222 | { "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?" }, |
1223 | { "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." }, | 1223 | { "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." }, |
1224 | { "Error","Fehler" }, | 1224 | { "Error","Fehler" }, |
1225 | { ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." }, | 1225 | { ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." }, |
1226 | { "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." }, | 1226 | { "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." }, |
1227 | { "Warning","Warnung" }, | 1227 | { "Warning","Warnung" }, |
1228 | { "Select week number","Wähle Wochen Nummer" }, | 1228 | { "Select week number","Wähle Wochen Nummer" }, |
1229 | { "Februar","Februar" }, | 1229 | { "Februar","Februar" }, |
1230 | { "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" }, | 1230 | { "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" }, |
1231 | { "W","W" }, | 1231 | { "W","W" }, |
1232 | { "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" }, | 1232 | { "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" }, |
1233 | { "T: %1","T: %1" }, | 1233 | { "T: %1","T: %1" }, |
1234 | { "Start: ","Start: " }, | 1234 | { "Start: ","Start: " }, |
1235 | { "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " }, | 1235 | { "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " }, |
1236 | { "Password for remote access:","Passwort für fernen Zugriff:" }, | 1236 | { "Password for remote access:","Passwort für fernen Zugriff:" }, |
1237 | { "Remote IP address:","Ferne IP Adresse:" }, | 1237 | { "Remote IP address:","Ferne IP Adresse:" }, |
1238 | { "Remote port number:","Ferne Port Nummer:" }, | 1238 | { "Remote port number:","Ferne Port Nummer:" }, |
1239 | { "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." }, | 1239 | { "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." }, |
1240 | { "Remote from: ","Fern von: " }, | 1240 | { "Remote from: ","Fern von: " }, |
1241 | { "Local from: ","Lokal von: " }, | 1241 | { "Local from: ","Lokal von: " }, |
1242 | { "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" }, | 1242 | { "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" }, |
1243 | { "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, | 1243 | { "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, |
1244 | { "Write back","Schreibe zurück" }, | 1244 | { "Write back","Schreibe zurück" }, |
1245 | { "KO/Pi Synchronization","KO/Pi Synchronisation" }, | 1245 | { "KO/Pi Synchronization","KO/Pi Synchronisation" }, |
1246 | { "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, | 1246 | { "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, |
1247 | { "Received sync request","Sync Anfrage erhalten" }, | 1247 | { "Received sync request","Sync Anfrage erhalten" }, |
1248 | { "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." }, | 1248 | { "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." }, |
1249 | { "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, | 1249 | { "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, |
1250 | { "Data saved to temp file!","Daten in temp Datei gespeichert!" }, | 1250 | { "Data saved to temp file!","Daten in temp Datei gespeichert!" }, |
1251 | { "Sending file...","Sende Datei..." }, | 1251 | { "Sending file...","Sende Datei..." }, |
1252 | { "Waiting for synced file...","Warte auf gesyncte Daten..." }, | 1252 | { "Waiting for synced file...","Warte auf gesyncte Daten..." }, |
1253 | { "Receiving synced file...","Gesyncte Daten erhalten..." }, | 1253 | { "Receiving synced file...","Gesyncte Daten erhalten..." }, |
1254 | { "Received %1 bytes","%1 Bytes erhalten" }, | 1254 | { "Received %1 bytes","%1 Bytes erhalten" }, |
1255 | { "Writing file to disk...","Speichere Datei..." }, | 1255 | { "Writing file to disk...","Speichere Datei..." }, |
1256 | { "Pi-Sync successful!","Pi-Sync erfolgreich!" }, | 1256 | { "Pi-Sync successful!","Pi-Sync erfolgreich!" }, |
1257 | { "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, | 1257 | { "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, |
1258 | { "Synchronize!","Synchronisiere!" }, | 1258 | { "Synchronize!","Synchronisiere!" }, |
1259 | { "High clock skew!","Großer Uhrzeitunterschied!" }, | 1259 | { "High clock skew!","Großer Uhrzeitunterschied!" }, |
1260 | { "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, | 1260 | { "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, |
1261 | { "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!" }, | 1261 | { "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!" }, |
1262 | { "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, | 1262 | { "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, |
1263 | { "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, | 1263 | { "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, |
1264 | { "List week view","Listenwochenansicht" }, | 1264 | { "List week view","Listenwochenansicht" }, |
1265 | { "List week","Listenwochenansicht" }, | 1265 | { "List week","Listenwochenansicht" }, |
1266 | { "Next Week","Nächste Woche" }, | 1266 | { "Next Week","Nächste Woche" }, |
1267 | { "Previous Week","Vorherige Woche" }, | 1267 | { "Previous Week","Vorherige Woche" }, |
1268 | { "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." }, | 1268 | { "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." }, |
1269 | { "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, | 1269 | { "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, |
1270 | { "Details","Details" }, | 1270 | { "Details","Details" }, |
1271 | { "Created time","Erstellt Zeit" }, | 1271 | { "Created time","Erstellt Zeit" }, |
1272 | { "Last modified time","Geändert Zeit" }, | 1272 | { "Last modified time","Geändert Zeit" }, |
1273 | { "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, | 1273 | { "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, |
1274 | { "View Options","Anzeige Optionen" }, | 1274 | { "View Options","Anzeige Optionen" }, |
1275 | { "<b>Created: ","<b>Erstellt am: " }, | 1275 | { "<b>Created: ","<b>Erstellt am: " }, |
1276 | { "<b>Last modified: ","<b>Zuletzt geändert am: " }, | 1276 | { "<b>Last modified: ","<b>Zuletzt geändert am: " }, |
1277 | { "Journal: ","Journal: " }, | 1277 | { "Journal: ","Journal: " }, |
1278 | { "yearly","jährlich" }, | 1278 | { "yearly","jährlich" }, |
1279 | { "(%1) ","%1-" }, | 1279 | { "(%1) ","%1-" }, |
1280 | { "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, | 1280 | { "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, |
1281 | { "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, | 1281 | { "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, |
1282 | { "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, | 1282 | { "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, |
1283 | { "Summary/Loc.","Titel/Ort" }, | 1283 | { "Summary/Loc.","Titel/Ort" }, |
1284 | { "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, | 1284 | { "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, |
1285 | { "Week Number","Wochennummer" }, | 1285 | { "Week Number","Wochennummer" }, |
1286 | { "Import","Importiere" }, | 1286 | { "Import","Importiere" }, |
1287 | { "Export","Exportiere" }, | 1287 | { "Export","Exportiere" }, |
1288 | { "Beam","Beame" }, | 1288 | { "Beam","Beame" }, |
1289 | { "Export selected","Exportiere Selektierte" }, | 1289 | { "Export selected","Exportiere Selektierte" }, |
1290 | { "As iCal (ics) file...","Als iCal (ics) Datei..." }, | 1290 | { "As iCal (ics) file...","Als iCal (ics) Datei..." }, |
1291 | { "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, | 1291 | { "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, |
1292 | { "Journal/Details...","Journale/Details..." }, | 1292 | { "Journal/Details...","Journale/Details..." }, |
1293 | { "Agenda View","Agenda Ansicht" }, | 1293 | { "Agenda View","Agenda Ansicht" }, |
1294 | { "Show current time","Zeige aktuelle Zeit" }, | 1294 | { "Show current time","Zeige aktuelle Zeit" }, |
1295 | { "Edit new item","Bearbeite neuen Eintrag" }, | 1295 | { "Edit new item","Bearbeite neuen Eintrag" }, |
1296 | { "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" }, | 1296 | { "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" }, |
1297 | { "There is no next alarm.","Es gibt keinen nächsten Alarm." }, | 1297 | { "There is no next alarm.","Es gibt keinen nächsten Alarm." }, |
1298 | { "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, | 1298 | { "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, |
1299 | { "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, | 1299 | { "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, |
1300 | { "%1 days\n","%1 Tagen\n" }, | 1300 | { "%1 days\n","%1 Tagen\n" }, |
1301 | { "1 day\n","1 Tag\n" }, | 1301 | { "1 day\n","1 Tag\n" }, |
1302 | { "%1 hours\n","%1 Stunden\n" }, | 1302 | { "%1 hours\n","%1 Stunden\n" }, |
1303 | { "1 hour\n","1 Stunde\n" }, | 1303 | { "1 hour\n","1 Stunde\n" }, |
1304 | { "%1 minutes\n","%1 Minuten\n" }, | 1304 | { "%1 minutes\n","%1 Minuten\n" }, |
1305 | { "1 minute\n","1 Minute\n" }, | 1305 | { "1 minute\n","1 Minute\n" }, |
1306 | { "Only one toolbar","Nur eine Toolbar" }, | 1306 | { "Only one toolbar","Nur eine Toolbar" }, |
1307 | { "Print","Drucke" }, | 1307 | { "Print","Drucke" }, |
1308 | { "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, | 1308 | { "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, |
1309 | { "There is nothing selected!","Es ist nichts ausgewählt!" }, | 1309 | { "There is nothing selected!","Es ist nichts ausgewählt!" }, |
1310 | { "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, | 1310 | { "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, |
1311 | { "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, | 1311 | { "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, |
1312 | { "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" }, | 1312 | { "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" }, |
1313 | { "KO/Pi Printout","KO/Pi Ausdruck" }, | 1313 | { "KO/Pi Printout","KO/Pi Ausdruck" }, |
1314 | { "Print unscaled","Drucke unskaliert" }, | 1314 | { "Print unscaled","Drucke unskaliert" }, |
1315 | { "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, | 1315 | { "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, |
1316 | { "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, | 1316 | { "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, |
1317 | { "Printout Mode","Druck Modus" }, | 1317 | { "Printout Mode","Druck Modus" }, |
1318 | { "Filter menu icon","Filtermenu Icon" }, | 1318 | { "Filter menu icon","Filtermenu Icon" }, |
1319 | { "<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" }, | 1319 | { "<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" }, |
1320 | { "<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" }, | 1320 | { "<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" }, |
1321 | { "%1d","%1t" }, | 1321 | { "%1d","%1t" }, |
1322 | { "%1h","%1std" }, | 1322 | { "%1h","%1std" }, |
1323 | { "%1min","%1min" }, | 1323 | { "%1min","%1min" }, |
1324 | { "( %1 before )","( %1 vorher )" }, | 1324 | { "( %1 before )","( %1 vorher )" }, |
1325 | { "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, | 1325 | { "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, |
1326 | { "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, | 1326 | { "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, |
1327 | { "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, | 1327 | { "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, |
1328 | { "Show Sync Events","Zeige Sync-Ereignisse" }, | 1328 | { "Show Sync Events","Zeige Sync-Ereignisse" }, |
1329 | { "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, | 1329 | { "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, |
1330 | { "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, | 1330 | { "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, |
1331 | { " on "," am " }, | 1331 | { " on "," am " }, |
1332 | { "On: ","Am: " }, | 1332 | { "On: ","Am: " }, |
1333 | { "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, | 1333 | { "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, |
1334 | { "Start/Stop todo...","Starte/Stoppe Todo..." }, | 1334 | { "Start/Stop todo...","Starte/Stoppe Todo..." }, |
1335 | { "Color for running todos:","Farbe für laufende Todos:" }, | 1335 | { "Color for running todos:","Farbe für laufende Todos:" }, |
1336 | { "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" }, | 1336 | { "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" }, |
1337 | { "Todo is started","Todo ist gestartet" }, | 1337 | { "Todo is started","Todo ist gestartet" }, |
1338 | { "Stop todo","Stoppe Todo" }, | 1338 | { "Stop todo","Stoppe Todo" }, |
1339 | { "Todo is stopped","Todo ist gestoppt" }, | 1339 | { "Todo is stopped","Todo ist gestoppt" }, |
1340 | { "Start todo","Starte Todo" }, | 1340 | { "Start todo","Starte Todo" }, |
1341 | { "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, | 1341 | { "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, |
1342 | { "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, | 1342 | { "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, |
1343 | { "Todo has subtodos","Todo hat Untertodos" }, | 1343 | { "Todo has subtodos","Todo hat Untertodos" }, |
1344 | { "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, | 1344 | { "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, |
1345 | { "Colors","Farben" }, | 1345 | { "Colors","Farben" }, |
1346 | { "Click on new parent item","Klicke auf neues Übertodo" }, | 1346 | { "Click on new parent item","Klicke auf neues Übertodo" }, |
1347 | { "Reparenting aborted!","Übertodo setzen abgebrochen" }, | 1347 | { "Reparenting aborted!","Übertodo setzen abgebrochen" }, |
1348 | { "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, | 1348 | { "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, |
1349 | { "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, | 1349 | { "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, |
1350 | { "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, | 1350 | { "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, |
1351 | { "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, | 1351 | { "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, |
1352 | { "times","Zeiten" }, | 1352 | { "times","Zeiten" }, |
1353 | { "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" }, | 1353 | { "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" }, |
1354 | { "Backup enabled","Backup angeschaltet" }, | 1354 | { "Backup enabled","Backup angeschaltet" }, |
1355 | { "Use standard backup dir","Standard Backupverzeichnis" }, | 1355 | { "Use standard backup dir","Standard Backupverzeichnis" }, |
1356 | { "Number of Backups:","Anzahl der Backups" }, | 1356 | { "Number of Backups:","Anzahl der Backups" }, |
1357 | { "Make backup every ","Mache ein Backup alle " }, | 1357 | { "Make backup every ","Mache ein Backup alle " }, |
1358 | { " days"," Tage" }, | 1358 | { " days"," Tage" }, |
1359 | { "Creating backup ... please wait ...","Erstelle Backup ... bitte warten ..." }, | 1359 | { "Creating backup ... please wait ...","Erstelle Backup ... bitte warten ..." }, |
1360 | { "Backup Failed!","Backup Problem!" }, | 1360 | { "Backup Failed!","Backup Problem!" }, |
1361 | { "Try again now","Versuche jetzt nochmal" }, | 1361 | { "Try again now","Versuche jetzt nochmal" }, |
1362 | { "Try again later","Versuche später nochmal" }, | 1362 | { "Try again later","Versuche später nochmal" }, |
1363 | { "Try again tomorrow","Versuche morgen nochmal" }, | 1363 | { "Try again tomorrow","Versuche morgen nochmal" }, |
1364 | { "Disable backup","Schalte Backup ab" }, | 1364 | { "Disable backup","Schalte Backup ab" }, |
1365 | { "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, | 1365 | { "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, |
1366 | { "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, | 1366 | { "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, |
1367 | { "Choose action","Wähle Aktion" }, | 1367 | { "Choose action","Wähle Aktion" }, |
1368 | { "Comment for todo:","Kommentar zum Todo:" }, | 1368 | { "Comment for todo:","Kommentar zum Todo:" }, |
1369 | { "Stop+note","Stop+Notiz" }, | 1369 | { "Stop+note","Stop+Notiz" }, |
1370 | { "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, | 1370 | { "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, |
1371 | { "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" }, | 1371 | { "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" }, |
1372 | { "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" }, | 1372 | { "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" }, |
1373 | { "Print complete list","Drucke komplette Liste" }, | 1373 | { "Print complete list","Drucke komplette Liste" }, |
1374 | { "Hide all selected","Verstecke Selektierte" }, | 1374 | { "Hide all selected","Verstecke Selektierte" }, |
1375 | { "Add items","hinzufügen" }, | 1375 | { "Add items","hinzufügen" }, |
1376 | { "One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?","Ein (oder mehrere) ausgewähltes\nTodo hat Untertodos!\nMöchten Sie der Auswahlliste\nalle Untertodos von allen\nausgewählten Todos hinzufügen?" }, | 1376 | { "One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?","Ein (oder mehrere) ausgewähltes\nTodo hat Untertodos!\nMöchten Sie der Auswahlliste\nalle Untertodos von allen\nausgewählten Todos hinzufügen?" }, |
1377 | { "Print List View...","Drucke Listenansicht..." }, | 1377 | { "Print List View...","Drucke Listenansicht..." }, |
1378 | { "You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.","Sie können die <b>Listenansicht</b> und die Listenansicht im <b>Suchdialog</b> ausdrucken! Um das zu machen gehen Sie bitte zur <b>Listenansicht</b> oder zum <b>Suchdialog</b>. Rechtsklicken Sie auf die Liste. Wählen Sie im Popupmenu den Eintrag <b>Drucke komplette Liste</b>. Das druckt die Liste so, wie man sie sieht. Sie können Listeneinträge entfernen ohne die korrespondierenden Ereignisse/Todos zu löschen! Selektieren sie einfach alle Einträge, die sie nicht ausdrucken möchten. Dann Rechtsklicken Sie auf einen Eintrag und wählen <b>Verstecke Selektierte</b>. Danach können Sie die Liste ohne diese Einträge ausdrucken." }, | 1378 | { "You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.","Sie können die <b>Listenansicht</b> und die Listenansicht im <b>Suchdialog</b> ausdrucken! Um das zu machen gehen Sie bitte zur <b>Listenansicht</b> oder zum <b>Suchdialog</b>. Rechtsklicken Sie auf die Liste. Wählen Sie im Popupmenu den Eintrag <b>Drucke komplette Liste</b>. Das druckt die Liste so, wie man sie sieht. Sie können Listeneinträge entfernen ohne die korrespondierenden Ereignisse/Todos zu löschen! Selektieren sie einfach alle Einträge, die sie nicht ausdrucken möchten. Dann Rechtsklicken Sie auf einen Eintrag und wählen <b>Verstecke Selektierte</b>. Danach können Sie die Liste ohne diese Einträge ausdrucken." }, |
1379 | { "Configure KO/Pi...","Konfiguriere KO/Pi..." }, | 1379 | { "Configure KO/Pi...","Konfiguriere KO/Pi..." }, |
1380 | { "Global Settings...","Globale Einstellungen..." }, | 1380 | { "Global Settings...","Globale Einstellungen..." }, |
1381 | { "<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n","<p><b>R</b>: Zeige Resource Ansicht | <b>F</b>: Editiere Filter </p>\n" }, | 1381 | { "<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n","<p><b>R</b>: Zeige Resource Ansicht | <b>F</b>: Editiere Filter </p>\n" }, |
1382 | { "(disabled)","(abgeschaltet)" }, | 1382 | { "(disabled)","(abgeschaltet)" }, |
1383 | { "New Calendar","Neuer Kalender" }, | 1383 | { "New Calendar","Neuer Kalender" }, |
1384 | { "Calendar","Kalender" }, | 1384 | { "Calendar","Kalender" }, |
1385 | { "Filter selector","Filterauswahl" }, | 1385 | { "Filter selector","Filterauswahl" }, |
1386 | { "Filtermenu","Filtermenu" }, | 1386 | { "Filtermenu","Filtermenu" }, |
1387 | { "Toggle Fullscreen","Vollbild umschalten" }, | 1387 | { "Toggle Fullscreen","Vollbild umschalten" }, |
1388 | { "Toggle Resource View","Resourcenansicht umschalten" }, | 1388 | { "Toggle Resource View","Resourcenansicht umschalten" }, |
1389 | { "Storage HowTo...","Speicherort HowTo..." }, | 1389 | { "Storage HowTo...","Speicherort HowTo..." }, |
1390 | { "Timetracking HowTo...","Timetracking HowTo..." }, | 1390 | { "Timetracking HowTo...","Timetracking HowTo..." }, |
1391 | { "Juni","Juni" }, | 1391 | { "Juni","Juni" }, |
1392 | { "Juli","Juli" }, | 1392 | { "Juli","Juli" }, |
1393 | { "ToDo:","ToDo:" }, | 1393 | { "ToDo:","ToDo:" }, |
1394 | { "Set Calendar","Setze Kalender" }, | 1394 | { "Set Calendar","Setze Kalender" }, |
1395 | { "Todo: %1","Todo: %1" }, | 1395 | { "Todo: %1","Todo: %1" }, |
1396 | { ": (Prio ",": (Prio " }, | 1396 | { ": (Prio ",": (Prio " }, |
1397 | { "Todos","Todos" }, | 1397 | { "Todos","Todos" }, |
1398 | { "Todo Viewer","Todo Viewer" }, | 1398 | { "Todo Viewer","Todo Viewer" }, |
1399 | { "Todo ","Todo " }, | 1399 | { "Todo ","Todo " }, |
1400 | { " Calendar \n Resource "," Kalender \n Resource " }, | 1400 | { " Calendar \n Resource "," Kalender \n Resource " }, |
1401 | { " Color "," Farbe " }, | 1401 | { " Color "," Farbe " }, |
1402 | { "The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>. Möchten Sie diesen Kalender aus KO/Pi entfernen? (Die Datei wird dabei nicht gelöscht!)" }, | 1402 | { "The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>. Möchten Sie diesen Kalender aus KO/Pi entfernen? (Die Datei wird dabei nicht gelöscht!)" }, |
1403 | { "The calendar <b>%1</b> is displaying file <b>%2</b>","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>" }, | 1403 | { "The calendar <b>%1</b> is displaying file <b>%2</b>","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>" }, |
1404 | { "Add new Calendar","Füge Kalender hinzu" }, | 1404 | { "Add new Calendar","Füge Kalender hinzu" }, |
1405 | { "<b>Name of new calendar:</b>","<b>Name des Kalenders:</b>" }, | 1405 | { "<b>Name of new calendar:</b>","<b>Name des Kalenders:</b>" }, |
1406 | { "<b>Local ical (*.ics) file:</b>","<b>Lokale ical (*.ics) Datei:</b>" }, | 1406 | { "<b>Local ical (*.ics) file:</b>","<b>Lokale ical (*.ics) Datei:</b>" }, |
1407 | { "Sorry, the calendar name is empty!","Sorry, der Kalendername ist leer!" }, | 1407 | { "Sorry, the calendar name is empty!","Sorry, der Kalendername ist leer!" }, |
1408 | { "Sorry, the file name is empty!","Sorry, der Dateiname ist leer!" }, | 1408 | { "Sorry, the file name is empty!","Sorry, der Dateiname ist leer!" }, |
1409 | { "Error loading calendar file\n%1.","Fehler beim Laden der Kalenderdatei\n%1." }, | 1409 | { "Error loading calendar file\n%1.","Fehler beim Laden der Kalenderdatei\n%1." }, |
1410 | { "The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>","Der Kalender <b>%1</b> ist nicht geladen! Das Laden der Datei <b>%2</b> schlug fehl! <b>Soll erneut versucht werden den Kalender zu laden?</b>" }, | 1410 | { "The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>","Der Kalender <b>%1</b> ist nicht geladen! Das Laden der Datei <b>%2</b> schlug fehl! <b>Soll erneut versucht werden den Kalender zu laden?</b>" }, |
1411 | { "Global application font for all apps:","Globale Schriftart:" }, | 1411 | { "Global application font for all apps:","Globale Schriftart:" }, |
1412 | { "Application Font","Applikationsschriftart" }, | 1412 | { "Application Font","Applikationsschriftart" }, |
1413 | { "Kx/Pi","Kx/Pi" }, | 1413 | { "Kx/Pi","Kx/Pi" }, |
1414 | { "Backup","Backup" }, | 1414 | { "Backup","Backup" }, |
1415 | { "KDE-Pim Global Settings","KDE-Pim Globale Einstellungen" }, | 1415 | { "KDE-Pim Global Settings","KDE-Pim Globale Einstellungen" }, |
1416 | { "Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!","Sorry, der Kalendername \n%1\nist schon in Benutzung!\nBitte wählen Sie einen anderen!" }, | 1416 | { "Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!","Sorry, der Kalendername \n%1\nist schon in Benutzung!\nBitte wählen Sie einen anderen!" }, |
1417 | { "Sorry, the file \n%1\nis already loaded!\nPlease choose another file!","Sorry, die Datei \n%1\nist schon geladen!\nBitte wählen Sie eine andere!" }, | 1417 | { "Sorry, the file \n%1\nis already loaded!\nPlease choose another file!","Sorry, die Datei \n%1\nist schon geladen!\nBitte wählen Sie eine andere!" }, |
1418 | { "Choose Color","Wähle Farbe" }, | 1418 | { "Choose Color","Wähle Farbe" }, |
1419 | { " OK "," OK " }, | 1419 | { " OK "," OK " }, |
1420 | { " Cancel "," Abbrechen " }, | 1420 | { " Cancel "," Abbrechen " }, |
1421 | { "Matching items will be added to list","Passende werden zur Liste hinzugefügt" }, | 1421 | { "Matching items will be added to list","Passende werden zur Liste hinzugefügt" }, |
1422 | { "Matching items will be removed from list","Passende werden von der Liste entfernt" }, | 1422 | { "Matching items will be removed from list","Passende werden von der Liste entfernt" }, |
1423 | { "Search on displayed list only","Suche auf der dargestellten Liste" }, | 1423 | { "Search on displayed list only","Suche auf der dargestellten Liste" }, |
1424 | { "List will be cleared before search","Liste wird vor der Suche gelöscht" }, | 1424 | { "List will be cleared before search","Liste wird vor der Suche gelöscht" }, |
1425 | { "<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>","<center>%1</center> <center>ist nicht am Laufen. Möchten Sie den Zustand auf "laufend" setzen?</center>" }, | 1425 | { "<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>","<center>%1</center> <center>ist nicht am Laufen. Möchten Sie den Zustand auf "laufend" setzen?</center>" }, |
1426 | { "%1\nis running!","%1\nist am Laufen!" }, | 1426 | { "%1\nis running!","%1\nist am Laufen!" }, |
1427 | { "Additional Comment:","Zusätzlicher Kommentar:" }, | 1427 | { "Additional Comment:","Zusätzlicher Kommentar:" }, |
1428 | { "Stop and save","Stopp und Speichern" }, | 1428 | { "Stop and save","Stopp und Speichern" }, |
1429 | { "Continue running","Weiter laufen lassen" }, | 1429 | { "Continue running","Weiter laufen lassen" }, |
1430 | { "Stop - do not save","Stopp - nicht Speichern" }, | 1430 | { "Stop - do not save","Stopp - nicht Speichern" }, |
1431 | { "Do you really want to set\nthe state to stopped\nwithout saving the data?","Möchten sie den Zustand\nwirklich auf gestoppt setzen\nohne die Daten abzuspeichern?" }, | 1431 | { "Do you really want to set\nthe state to stopped\nwithout saving the data?","Möchten sie den Zustand\nwirklich auf gestoppt setzen\nohne die Daten abzuspeichern?" }, |
1432 | { "Time mismatch!","Zeiten stimmen nicht!" }, | 1432 | { "Time mismatch!","Zeiten stimmen nicht!" }, |
1433 | { "The start time is\nafter the end time!","Die Startzeit ist\nhinter der Endzeit!" }, | 1433 | { "The start time is\nafter the end time!","Die Startzeit ist\nhinter der Endzeit!" }, |
1434 | { "Yes, stop todo","Ja, stoppe Todo" }, | 1434 | { "Yes, stop todo","Ja, stoppe Todo" }, |
1435 | { "Todo stopped - no data saved because runtime was < 15 sec!","Todo gestoppt - nichts gespeichert da Laufzeit < 15 sec!" }, | 1435 | { "Todo stopped - no data saved because runtime was < 15 sec!","Todo gestoppt - nichts gespeichert da Laufzeit < 15 sec!" }, |
1436 | { "Todo started! Double click again to stop!","Todo gestartet! Doppelklicke um es zu stoppen!" }, | 1436 | { "Todo started! Double click again to stop!","Todo gestartet! Doppelklicke um es zu stoppen!" }, |
1437 | { "Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.","Bitte wählen Sie den <b>Default-Kalender</b> in dieser Spalte. Neu angelegte oder importierte Einträge werden dem Default-Kalender hinzugefügt." }, | 1437 | { "Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.","Bitte wählen Sie den <b>Default-Kalender</b> in dieser Spalte. Neu angelegte oder importierte Einträge werden dem Default-Kalender hinzugefügt." }, |
1438 | { "Spouse","Ehegatte" }, | 1438 | { "Spouse","Ehegatte" }, |
1439 | { "Notes","Notizen" }, | 1439 | { "Notes","Notizen" }, |
1440 | { "Messanger","Messanger" }, | 1440 | { "Messanger","Messanger" }, |
1441 | { "Assistant","Assistent" }, | 1441 | { "Assistant","Assistent" }, |
1442 | { "Manager","Manager" }, | 1442 | { "Manager","Manager" }, |
1443 | { "Secrecy","Sichtbar" }, | 1443 | { "Secrecy","Sichtbar" }, |
1444 | { "male","männlich" }, | 1444 | { "male","männlich" }, |
1445 | { "female","weiblich" }, | 1445 | { "female","weiblich" }, |
1446 | { "Hide!","Verbergen!" }, | 1446 | { "Hide!","Verbergen!" }, |
1447 | { "Show!","Anzeigen!" }, | 1447 | { "Show!","Anzeigen!" }, |
1448 | { "Details","Details" }, | 1448 | { "Details","Details" }, |
1449 | { "Profession","Beruf" }, | 1449 | { "Profession","Beruf" }, |
1450 | { "Children","Kinder" }, | 1450 | { "Children","Kinder" }, |
1451 | { "Department","Abteilung" }, | 1451 | { "Department","Abteilung" }, |
1452 | { "Backup cancelled","Backup abgebrochen" }, | 1452 | { "Backup cancelled","Backup abgebrochen" }, |
1453 | { "Backup globally disabled","Backup global abgeschaltet" }, | 1453 | { "Backup globally disabled","Backup global abgeschaltet" }, |
1454 | { "Backup succesfully finished","Backup erfolgreich beendet" }, | 1454 | { "Backup succesfully finished","Backup erfolgreich beendet" }, |
1455 | { "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" }, | 1455 | { "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" }, |
1456 | { "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" }, | 1456 | { "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" }, |
1457 | { "Birthdays","Geburtstage" }, | 1457 | { "Birthdays","Geburtstage" }, |
1458 | { "KO/Pi import information!","KO/Pi Import Information!" }, | 1458 | { "KO/Pi import information!","KO/Pi Import Information!" }, |
1459 | { "Start this todo\nand stop all running","Starte dieses Todo\nund stoppe alle Laufenden" }, | 1459 | { "Start this todo\nand stop all running","Starte dieses Todo\nund stoppe alle Laufenden" }, |
1460 | { "Cancel - do not start"," Abbrechen - Todo nicht starten" }, | 1460 | { "Cancel - do not start"," Abbrechen - Todo nicht starten" }, |
1461 | { "The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n"How do I change the timezone?"\nas well!","Die Zeitzone wurde geändert!\nSollen die Kalender neu geladen\nwerden num die Zeiten\nder Termine zu ändern?\nBitte lesen Sie auch\nMenu: Help->FAQ:\n"How do I change the timezone?"" }, | 1461 | { "The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n"How do I change the timezone?"\nas well!","Die Zeitzone wurde geändert!\nSollen die Kalender neu geladen\nwerden num die Zeiten\nder Termine zu ändern?\nBitte lesen Sie auch\nMenu: Help->FAQ:\n"How do I change the timezone?"" }, |
1462 | { "Reload","Neu laden" }, | 1462 | { "Reload","Neu laden" }, |
1463 | { "Timezone settings","Zeitzoneneinstellung" }, | 1463 | { "Timezone settings","Zeitzoneneinstellung" }, |
1464 | { "Title: ","Titel: " }, | 1464 | { "Title: ","Titel: " }, |
1465 | { "Journal from: ","Journal vom: " }, | 1465 | { "Journal from: ","Journal vom: " }, |
1466 | { "Journal: %1 from ","Journal: %1 vom " }, | 1466 | { "Journal: %1 from ","Journal: %1 vom " }, |
1467 | { "<b>Click here to edit categories: </b>","<b>Klicke hier um Kategorien zu ändern: </b>" }, | 1467 | { "<b>Click here to edit categories: </b>","<b>Klicke hier um Kategorien zu ändern: </b>" }, |
1468 | { "Selected Item","Ausgewähltes Item" }, | 1468 | { "Selected Item","Ausgewähltes Item" }, |
1469 | { "Select Date...","Wähle Datum..." }, | 1469 | { "Select Date...","Wähle Datum..." }, |
1470 | { "After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:","Nach dem Importieren/Laden/Syncen kann es neue Kategorien in den Terminen oder Todos geben, die nicht automatisch der Kategorieliste hinzugefügt werden. Bitte wählen Sie, was <b>jetzt</b> passieren soll:" }, | 1470 | { "After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:","Nach dem Importieren/Laden/Syncen kann es neue Kategorien in den Terminen oder Todos geben, die nicht automatisch der Kategorieliste hinzugefügt werden. Bitte wählen Sie, was <b>jetzt</b> passieren soll:" }, |
1471 | { "Change category list now!","Ändere Kategorieliste jetzt!" }, | 1471 | { "Change category list now!","Ändere Kategorieliste jetzt!" }, |
1472 | { "Edit category list...","Ändere Kategorieliste..." }, | 1472 | { "Edit category list...","Ändere Kategorieliste..." }, |
1473 | { "Toolbar changes needs a restart!","Neustart benötigt für Toolbaränderungen!" }, | 1473 | { "Toolbar changes needs a restart!","Neustart benötigt für Toolbaränderungen!" }, |
1474 | { "","" }, | 1474 | { "Filepath: ","Dateipfad: " }, |
1475 | { "","" }, | 1475 | { "The loading of one or more calendar failed:","Das Laden eines oder mehrerer Kalender schlug fehl:" }, |
1476 | { "","" }, | 1476 | { "You can try to reload the calendar in the Resource View!","In der Resourcenansicht können Sie erneut versuchen den Kalender zu laden!" }, |
1477 | { "","" }, | 1477 | { "","" }, |
1478 | { "","" }, | 1478 | { "","" }, |
1479 | { "","" }, | 1479 | { "","" }, |
1480 | { "","" }, | 1480 | { "","" }, |
1481 | { "","" }, \ No newline at end of file | 1481 | { "","" }, \ No newline at end of file |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index c0f3be7..fd026fa 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -303,768 +303,782 @@ class KOBeamPrefs : public QDialog | |||
303 | bool beamLocal() { return local->isChecked(); } | 303 | bool beamLocal() { return local->isChecked(); } |
304 | private: | 304 | private: |
305 | QRadioButton* vcal, *ical, *local, *tz; | 305 | QRadioButton* vcal, *ical, *local, *tz; |
306 | }; | 306 | }; |
307 | class KOCatPrefs : public QDialog | 307 | class KOCatPrefs : public QDialog |
308 | { | 308 | { |
309 | public: | 309 | public: |
310 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 310 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
311 | QDialog( parent, name, true ) | 311 | QDialog( parent, name, true ) |
312 | { | 312 | { |
313 | setCaption( i18n("Manage new Categories") ); | 313 | setCaption( i18n("Manage new Categories") ); |
314 | QVBoxLayout* lay = new QVBoxLayout( this ); | 314 | QVBoxLayout* lay = new QVBoxLayout( this ); |
315 | lay->setSpacing( 3 ); | 315 | lay->setSpacing( 3 ); |
316 | lay->setMargin( 3 ); | 316 | lay->setMargin( 3 ); |
317 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); | 317 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); |
318 | lay->addWidget( lab ); | 318 | lay->addWidget( lab ); |
319 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 319 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
320 | lay->addWidget( format ); | 320 | lay->addWidget( format ); |
321 | format->setExclusive ( true ) ; | 321 | format->setExclusive ( true ) ; |
322 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 322 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
323 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 323 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
324 | addCatBut->setChecked( true ); | 324 | addCatBut->setChecked( true ); |
325 | QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); | 325 | QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); |
326 | lay->addWidget( ok ); | 326 | lay->addWidget( ok ); |
327 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 327 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
328 | lay->addWidget( cancel ); | 328 | lay->addWidget( cancel ); |
329 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 329 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
330 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 330 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
331 | resize( 200, 200 ); | 331 | resize( 200, 200 ); |
332 | } | 332 | } |
333 | 333 | ||
334 | bool addCat() { return addCatBut->isChecked(); } | 334 | bool addCat() { return addCatBut->isChecked(); } |
335 | private: | 335 | private: |
336 | QRadioButton* addCatBut; | 336 | QRadioButton* addCatBut; |
337 | }; | 337 | }; |
338 | 338 | ||
339 | 339 | ||
340 | 340 | ||
341 | CalendarView::CalendarView( CalendarResources *calendar, | 341 | CalendarView::CalendarView( CalendarResources *calendar, |
342 | QWidget *parent, const char *name ) | 342 | QWidget *parent, const char *name ) |
343 | : CalendarViewBase( parent, name ), | 343 | : CalendarViewBase( parent, name ), |
344 | mCalendar( calendar ), | 344 | mCalendar( calendar ), |
345 | mResourceManager( calendar->resourceManager() ) | 345 | mResourceManager( calendar->resourceManager() ) |
346 | { | 346 | { |
347 | 347 | ||
348 | mEventEditor = 0; | 348 | mEventEditor = 0; |
349 | mTodoEditor = 0; | 349 | mTodoEditor = 0; |
350 | 350 | ||
351 | init(); | 351 | init(); |
352 | } | 352 | } |
353 | 353 | ||
354 | CalendarView::CalendarView( Calendar *calendar, | 354 | CalendarView::CalendarView( Calendar *calendar, |
355 | QWidget *parent, const char *name ) | 355 | QWidget *parent, const char *name ) |
356 | : CalendarViewBase( parent, name ), | 356 | : CalendarViewBase( parent, name ), |
357 | mCalendar( calendar ), | 357 | mCalendar( calendar ), |
358 | mResourceManager( 0 ) | 358 | mResourceManager( 0 ) |
359 | { | 359 | { |
360 | 360 | ||
361 | mEventEditor = 0; | 361 | mEventEditor = 0; |
362 | mTodoEditor = 0; | 362 | mTodoEditor = 0; |
363 | init(); | 363 | init(); |
364 | } | 364 | } |
365 | 365 | ||
366 | void CalendarView::init() | 366 | void CalendarView::init() |
367 | { | 367 | { |
368 | mNextAlarmDateTime = QDateTime::currentDateTime(); | 368 | mNextAlarmDateTime = QDateTime::currentDateTime(); |
369 | setFocusPolicy ( NoFocus ); | 369 | setFocusPolicy ( NoFocus ); |
370 | mViewerCallerIsSearchDialog = false; | 370 | mViewerCallerIsSearchDialog = false; |
371 | mBlockShowDates = false; | 371 | mBlockShowDates = false; |
372 | 372 | ||
373 | mDatePickerMode = 0; | 373 | mDatePickerMode = 0; |
374 | mCurrentSyncDevice = ""; | 374 | mCurrentSyncDevice = ""; |
375 | mViewManager = new KOViewManager( this ); | 375 | mViewManager = new KOViewManager( this ); |
376 | mDialogManager = new KODialogManager( this ); | 376 | mDialogManager = new KODialogManager( this ); |
377 | mEventViewerDialog = 0; | 377 | mEventViewerDialog = 0; |
378 | mModified = false; | 378 | mModified = false; |
379 | mReadOnly = false; | 379 | mReadOnly = false; |
380 | mSelectedIncidence = 0; | 380 | mSelectedIncidence = 0; |
381 | mCalPrinter = 0; | 381 | mCalPrinter = 0; |
382 | mFilters.setAutoDelete(true); | 382 | mFilters.setAutoDelete(true); |
383 | 383 | ||
384 | mCalendar->registerObserver( this ); | 384 | mCalendar->registerObserver( this ); |
385 | // TODO: Make sure that view is updated, when calendar is changed. | 385 | // TODO: Make sure that view is updated, when calendar is changed. |
386 | 386 | ||
387 | mStorage = new FileStorage( mCalendar ); | 387 | mStorage = new FileStorage( mCalendar ); |
388 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 388 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
389 | 389 | ||
390 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 390 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
391 | #ifndef KORG_NOSPLITTER | 391 | #ifndef KORG_NOSPLITTER |
392 | // create the main layout frames. | 392 | // create the main layout frames. |
393 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 393 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
394 | topLayout->addWidget(mPanner); | 394 | topLayout->addWidget(mPanner); |
395 | 395 | ||
396 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 396 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
397 | "CalendarView::LeftFrame"); | 397 | "CalendarView::LeftFrame"); |
398 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 398 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
399 | 399 | ||
400 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 400 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
401 | "CalendarView::DateNavigator" ); | 401 | "CalendarView::DateNavigator" ); |
402 | 402 | ||
403 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 403 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
404 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 404 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
405 | mTodoList->setNavigator( mNavigator ); | 405 | mTodoList->setNavigator( mNavigator ); |
406 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 406 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
407 | 407 | ||
408 | #ifdef KORG_NORESOURCEVIEW | 408 | #ifdef KORG_NORESOURCEVIEW |
409 | mResourceView = 0; | 409 | mResourceView = 0; |
410 | #else | 410 | #else |
411 | if ( mResourceManager ) { | 411 | if ( mResourceManager ) { |
412 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 412 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
413 | mResourceView->updateView(); | 413 | mResourceView->updateView(); |
414 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 414 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
415 | SLOT( updateView() ) ); | 415 | SLOT( updateView() ) ); |
416 | } else { | 416 | } else { |
417 | mResourceView = 0; | 417 | mResourceView = 0; |
418 | } | 418 | } |
419 | #endif | 419 | #endif |
420 | QWidget *rightBox = new QWidget( mPanner ); | 420 | QWidget *rightBox = new QWidget( mPanner ); |
421 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 421 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
422 | 422 | ||
423 | mRightFrame = new QWidgetStack( rightBox ); | 423 | mRightFrame = new QWidgetStack( rightBox ); |
424 | rightLayout->addWidget( mRightFrame, 1 ); | 424 | rightLayout->addWidget( mRightFrame, 1 ); |
425 | 425 | ||
426 | mLeftFrame = mLeftSplitter; | 426 | mLeftFrame = mLeftSplitter; |
427 | #else | 427 | #else |
428 | //QWidget *mainBox = new QWidget( this ); | 428 | //QWidget *mainBox = new QWidget( this ); |
429 | //QWidget *leftFrame = new QWidget( mainBox ); | 429 | //QWidget *leftFrame = new QWidget( mainBox ); |
430 | //QBoxLayout * mainBoxLayout; | 430 | //QBoxLayout * mainBoxLayout; |
431 | if ( KOPrefs::instance()->mVerticalScreen ) { | 431 | if ( KOPrefs::instance()->mVerticalScreen ) { |
432 | //mainBoxLayout = new QVBoxLayout(mainBox); | 432 | //mainBoxLayout = new QVBoxLayout(mainBox); |
433 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 433 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
434 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); | 434 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
435 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 435 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
436 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | 436 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; |
437 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 437 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
438 | } else { | 438 | } else { |
439 | //mainBoxLayout = new QHBoxLayout(mainBox); | 439 | //mainBoxLayout = new QHBoxLayout(mainBox); |
440 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 440 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
441 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 441 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
442 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | 442 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); |
443 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | 443 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); |
444 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 444 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
445 | } | 445 | } |
446 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 446 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
447 | //QBoxLayout * leftFrameLayout; | 447 | //QBoxLayout * leftFrameLayout; |
448 | topLayout->addWidget( mMainFrame ); | 448 | topLayout->addWidget( mMainFrame ); |
449 | #ifdef DESKTOP_VERSION | 449 | #ifdef DESKTOP_VERSION |
450 | mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this ); | 450 | mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this ); |
451 | topLayout->addWidget( mDateScrollBar ); | 451 | topLayout->addWidget( mDateScrollBar ); |
452 | connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); | 452 | connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); |
453 | if ( QApplication::desktop()->width() < 800 ) | 453 | if ( QApplication::desktop()->width() < 800 ) |
454 | mDateScrollBar->hide(); | 454 | mDateScrollBar->hide(); |
455 | #endif | 455 | #endif |
456 | //mainBoxLayout->addWidget (mLeftFrame); | 456 | //mainBoxLayout->addWidget (mLeftFrame); |
457 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 457 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
458 | "CalendarView::DateNavigator" ); | 458 | "CalendarView::DateNavigator" ); |
459 | #if 0 | 459 | #if 0 |
460 | // FIXME | 460 | // FIXME |
461 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 461 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
462 | "CalendarView::DateNavigator", QDate::currentDate()); | 462 | "CalendarView::DateNavigator", QDate::currentDate()); |
463 | #endif | 463 | #endif |
464 | // mDateNavigator->blockSignals( true ); | 464 | // mDateNavigator->blockSignals( true ); |
465 | //leftFrameLayout->addWidget( mDateNavigator ); | 465 | //leftFrameLayout->addWidget( mDateNavigator ); |
466 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 466 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
467 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 467 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
468 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); | 468 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); |
469 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); | 469 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); |
470 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); | 470 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); |
471 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); | 471 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); |
472 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); | 472 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); |
473 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); | 473 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); |
474 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); | 474 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); |
475 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); | 475 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); |
476 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); | 476 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); |
477 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); | 477 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); |
478 | 478 | ||
479 | mTodoList->setNavigator( mNavigator ); | 479 | mTodoList->setNavigator( mNavigator ); |
480 | #if 0 | 480 | #if 0 |
481 | if ( QApplication::desktop()->width() < 480 ) { | 481 | if ( QApplication::desktop()->width() < 480 ) { |
482 | leftFrameLayout->addWidget(mFilterView); | 482 | leftFrameLayout->addWidget(mFilterView); |
483 | leftFrameLayout->addWidget(mTodoList, 2 ); | 483 | leftFrameLayout->addWidget(mTodoList, 2 ); |
484 | 484 | ||
485 | } else { | 485 | } else { |
486 | leftFrameLayout->addWidget(mTodoList,2 ); | 486 | leftFrameLayout->addWidget(mTodoList,2 ); |
487 | leftFrameLayout->addWidget(mFilterView ); | 487 | leftFrameLayout->addWidget(mFilterView ); |
488 | } | 488 | } |
489 | #endif | 489 | #endif |
490 | mFilterView->hide(); | 490 | mFilterView->hide(); |
491 | mCalEditView->hide(); | 491 | mCalEditView->hide(); |
492 | QWidget *rightBox = new QWidget( mMainFrame ); | 492 | QWidget *rightBox = new QWidget( mMainFrame ); |
493 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 493 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
494 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 494 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
495 | mRightFrame = new QWidgetStack( rightBox ); | 495 | mRightFrame = new QWidgetStack( rightBox ); |
496 | rightLayout->addWidget( mRightFrame, 10 ); | 496 | rightLayout->addWidget( mRightFrame, 10 ); |
497 | 497 | ||
498 | //mLeftFrame = (QWidget *)leftFrame; | 498 | //mLeftFrame = (QWidget *)leftFrame; |
499 | if ( KOPrefs::instance()->mVerticalScreen ) { | 499 | if ( KOPrefs::instance()->mVerticalScreen ) { |
500 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 500 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
501 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 501 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
502 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 502 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
503 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 503 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
504 | } else { | 504 | } else { |
505 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 505 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
506 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 506 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
507 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 507 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
508 | } | 508 | } |
509 | if ( !KOPrefs::instance()->mShowDateNavigator) | 509 | if ( !KOPrefs::instance()->mShowDateNavigator) |
510 | mDateNavigator->hide(); | 510 | mDateNavigator->hide(); |
511 | //qDebug("Calendarview Size %d %d ", width(), height()); | 511 | //qDebug("Calendarview Size %d %d ", width(), height()); |
512 | #endif | 512 | #endif |
513 | 513 | ||
514 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 514 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
515 | SLOT( showDates( const KCal::DateList & ) ) ); | 515 | SLOT( showDates( const KCal::DateList & ) ) ); |
516 | 516 | ||
517 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 517 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
518 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 518 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
519 | 519 | ||
520 | 520 | ||
521 | 521 | ||
522 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), | 522 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), |
523 | mViewManager, SLOT( showMonth( const QDate & ) ) ); | 523 | mViewManager, SLOT( showMonth( const QDate & ) ) ); |
524 | 524 | ||
525 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 525 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
526 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 526 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
527 | 527 | ||
528 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 528 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
529 | mNavigator, SLOT( selectPreviousYear() ) ); | 529 | mNavigator, SLOT( selectPreviousYear() ) ); |
530 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 530 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
531 | mNavigator, SLOT( selectNextYear() ) ); | 531 | mNavigator, SLOT( selectNextYear() ) ); |
532 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 532 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
533 | mNavigator, SLOT( selectPreviousMonth() ) ); | 533 | mNavigator, SLOT( selectPreviousMonth() ) ); |
534 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 534 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
535 | mNavigator, SLOT( selectNextMonth() ) ); | 535 | mNavigator, SLOT( selectNextMonth() ) ); |
536 | 536 | ||
537 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 537 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
538 | mNavigator, SLOT( selectPrevious() ) ); | 538 | mNavigator, SLOT( selectPrevious() ) ); |
539 | connect( mDateNavigator, SIGNAL( goNext() ), | 539 | connect( mDateNavigator, SIGNAL( goNext() ), |
540 | mNavigator, SLOT( selectNext() ) ); | 540 | mNavigator, SLOT( selectNext() ) ); |
541 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 541 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
542 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 542 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
543 | 543 | ||
544 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 544 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
545 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 545 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
546 | #if 0 | 546 | #if 0 |
547 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 547 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
548 | SLOT( incidenceAdded( Incidence *) ) ); | 548 | SLOT( incidenceAdded( Incidence *) ) ); |
549 | #endif | 549 | #endif |
550 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 550 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
551 | 551 | ||
552 | connect( this, SIGNAL( configChanged() ), | 552 | connect( this, SIGNAL( configChanged() ), |
553 | mDateNavigator, SLOT( updateConfig() ) ); | 553 | mDateNavigator, SLOT( updateConfig() ) ); |
554 | 554 | ||
555 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 555 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
556 | SLOT( newTodo() ) ); | 556 | SLOT( newTodo() ) ); |
557 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 557 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
558 | SLOT( newSubTodo( Todo * ) ) ); | 558 | SLOT( newSubTodo( Todo * ) ) ); |
559 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 559 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
560 | SLOT( editTodo( Todo * ) ) ); | 560 | SLOT( editTodo( Todo * ) ) ); |
561 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 561 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
562 | SLOT( showTodo( Todo *) ) ); | 562 | SLOT( showTodo( Todo *) ) ); |
563 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 563 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
564 | SLOT( deleteTodo( Todo *) ) ); | 564 | SLOT( deleteTodo( Todo *) ) ); |
565 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 565 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
566 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 566 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
567 | SLOT( purgeCompleted() ) ); | 567 | SLOT( purgeCompleted() ) ); |
568 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 568 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
569 | SIGNAL( todoModified( Todo *, int ) ) ); | 569 | SIGNAL( todoModified( Todo *, int ) ) ); |
570 | 570 | ||
571 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 571 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
572 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 572 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
573 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 573 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
574 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 574 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
575 | 575 | ||
576 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 576 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
577 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 577 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
578 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 578 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
579 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 579 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
580 | 580 | ||
581 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 581 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
582 | this, SLOT ( todo_unsub( Todo * ) ) ); | 582 | this, SLOT ( todo_unsub( Todo * ) ) ); |
583 | 583 | ||
584 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 584 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
585 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 585 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
586 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 586 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
587 | SLOT( updateTodo( Todo *, int ) ) ); | 587 | SLOT( updateTodo( Todo *, int ) ) ); |
588 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 588 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
589 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 589 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
590 | 590 | ||
591 | 591 | ||
592 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 592 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
593 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 593 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
594 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 594 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
595 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 595 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
596 | 596 | ||
597 | 597 | ||
598 | 598 | ||
599 | 599 | ||
600 | 600 | ||
601 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 601 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
602 | SLOT(checkClipboard())); | 602 | SLOT(checkClipboard())); |
603 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 603 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
604 | SLOT( processTodoListSelection( Incidence * ) ) ); | 604 | SLOT( processTodoListSelection( Incidence * ) ) ); |
605 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 605 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
606 | 606 | ||
607 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 607 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
608 | 608 | ||
609 | mDateFrame = new QVBox(0,0,WType_Popup); | 609 | mDateFrame = new QVBox(0,0,WType_Popup); |
610 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 610 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
611 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 611 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
612 | mDateFrame->setLineWidth(3); | 612 | mDateFrame->setLineWidth(3); |
613 | mDateFrame->hide(); | 613 | mDateFrame->hide(); |
614 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 614 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
615 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 615 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
616 | 616 | ||
617 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 617 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
618 | 618 | ||
619 | mEventEditor = mDialogManager->getEventEditor(); | 619 | mEventEditor = mDialogManager->getEventEditor(); |
620 | mTodoEditor = mDialogManager->getTodoEditor(); | 620 | mTodoEditor = mDialogManager->getTodoEditor(); |
621 | 621 | ||
622 | mFlagEditDescription = false; | 622 | mFlagEditDescription = false; |
623 | 623 | ||
624 | mSuspendTimer = new QTimer( this ); | 624 | mSuspendTimer = new QTimer( this ); |
625 | mAlarmTimer = new QTimer( this ); | 625 | mAlarmTimer = new QTimer( this ); |
626 | mRecheckAlarmTimer = new QTimer( this ); | 626 | mRecheckAlarmTimer = new QTimer( this ); |
627 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 627 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
628 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 628 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
629 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 629 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
630 | mAlarmDialog = new AlarmDialog( this ); | 630 | mAlarmDialog = new AlarmDialog( this ); |
631 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 631 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
632 | mAlarmDialog->setServerNotification( false ); | 632 | mAlarmDialog->setServerNotification( false ); |
633 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 633 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
634 | 634 | ||
635 | 635 | ||
636 | #ifndef DESKTOP_VERSION | 636 | #ifndef DESKTOP_VERSION |
637 | //US listen for arriving address resultsets | 637 | //US listen for arriving address resultsets |
638 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 638 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
639 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 639 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
640 | #endif | 640 | #endif |
641 | mDateNavigator->setCalendar( mCalendar ); | 641 | mDateNavigator->setCalendar( mCalendar ); |
642 | } | 642 | } |
643 | 643 | ||
644 | 644 | ||
645 | CalendarView::~CalendarView() | 645 | CalendarView::~CalendarView() |
646 | { | 646 | { |
647 | // kdDebug() << "~CalendarView()" << endl; | 647 | // kdDebug() << "~CalendarView()" << endl; |
648 | //qDebug("CalendarView::~CalendarView() "); | 648 | //qDebug("CalendarView::~CalendarView() "); |
649 | delete mDialogManager; | 649 | delete mDialogManager; |
650 | delete mViewManager; | 650 | delete mViewManager; |
651 | delete mStorage; | 651 | delete mStorage; |
652 | delete mDateFrame ; | 652 | delete mDateFrame ; |
653 | delete mEventViewerDialog; | 653 | delete mEventViewerDialog; |
654 | //kdDebug() << "~CalendarView() done" << endl; | 654 | //kdDebug() << "~CalendarView() done" << endl; |
655 | } | 655 | } |
656 | void CalendarView::setScrollBarStep(int val ) | 656 | void CalendarView::setScrollBarStep(int val ) |
657 | { | 657 | { |
658 | #ifdef DESKTOP_VERSION | 658 | #ifdef DESKTOP_VERSION |
659 | mDateScrollBar->setLineStep ( val ); | 659 | mDateScrollBar->setLineStep ( val ); |
660 | #endif | 660 | #endif |
661 | } | 661 | } |
662 | void CalendarView::scrollBarValue(int val ) | 662 | void CalendarView::scrollBarValue(int val ) |
663 | { | 663 | { |
664 | #ifdef DESKTOP_VERSION | 664 | #ifdef DESKTOP_VERSION |
665 | if ( QApplication::desktop()->width() < 800 ) return; | 665 | if ( QApplication::desktop()->width() < 800 ) return; |
666 | static bool block = false; | 666 | static bool block = false; |
667 | if ( block ) return; | 667 | if ( block ) return; |
668 | block = true; | 668 | block = true; |
669 | val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | 669 | val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); |
670 | //qDebug("VAL %d ",val ); | 670 | //qDebug("VAL %d ",val ); |
671 | int count = mNavigator->selectedDates().count(); | 671 | int count = mNavigator->selectedDates().count(); |
672 | int year = mNavigator->selectedDates().first().year(); | 672 | int year = mNavigator->selectedDates().first().year(); |
673 | int day = mNavigator->selectedDates().first().dayOfYear(); | 673 | int day = mNavigator->selectedDates().first().dayOfYear(); |
674 | if ( val == day -1 ) { | 674 | if ( val == day -1 ) { |
675 | block = false; | 675 | block = false; |
676 | return; | 676 | return; |
677 | } | 677 | } |
678 | QDate d ( year,1,1 ); | 678 | QDate d ( year,1,1 ); |
679 | mNavigator->selectDates( d.addDays( val ), count ); | 679 | mNavigator->selectDates( d.addDays( val ), count ); |
680 | block = false; | 680 | block = false; |
681 | #endif | 681 | #endif |
682 | 682 | ||
683 | } | 683 | } |
684 | 684 | ||
685 | void CalendarView::checkAlarms() | 685 | void CalendarView::checkAlarms() |
686 | { | 686 | { |
687 | |||
688 | QString message; | ||
689 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | ||
690 | KopiCalendarFile * cal = calendars.first(); | ||
691 | while ( cal ) { | ||
692 | if ( cal->mErrorOnLoad ) { | ||
693 | message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; | ||
694 | } | ||
695 | cal = calendars.next(); | ||
696 | } | ||
697 | if ( !message.isEmpty() ) { | ||
698 | message = KGlobal::formatMessage( i18n("The loading of one or more calendar failed:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); | ||
699 | KMessageBox::error(this,message); | ||
700 | } | ||
687 | KConfig *config = KOGlobals::config(); | 701 | KConfig *config = KOGlobals::config(); |
688 | config->setGroup( "AppRun" ); | 702 | config->setGroup( "AppRun" ); |
689 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 703 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
690 | int daysto = dt.daysTo( QDate::currentDate() ); | 704 | int daysto = dt.daysTo( QDate::currentDate() ); |
691 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); | 705 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); |
692 | dt = dt.addDays( days ); | 706 | dt = dt.addDays( days ); |
693 | int secto = dt.secsTo( QDateTime::currentDateTime() ); | 707 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
694 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; | 708 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; |
695 | //qDebug("KO: Reading program stop %d ", secs); | 709 | //qDebug("KO: Reading program stop %d ", secs); |
696 | //secs -= ( 3600 * 24*3 ); // debug only | 710 | //secs -= ( 3600 * 24*3 ); // debug only |
697 | QDateTime latest = dt.addSecs ( secs ); | 711 | QDateTime latest = dt.addSecs ( secs ); |
698 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 712 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
699 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 713 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
700 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 714 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
701 | QPtrList<Incidence> al; | 715 | QPtrList<Incidence> al; |
702 | Incidence* inL = el.first(); | 716 | Incidence* inL = el.first(); |
703 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); | 717 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); |
704 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); | 718 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); |
705 | while ( inL ) { | 719 | while ( inL ) { |
706 | bool ok = false; | 720 | bool ok = false; |
707 | int offset = 0; | 721 | int offset = 0; |
708 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 722 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
709 | if ( ok ) { | 723 | if ( ok ) { |
710 | //qDebug("OK %s",next.toString().latin1()); | 724 | //qDebug("OK %s",next.toString().latin1()); |
711 | if ( next < cur ) { | 725 | if ( next < cur ) { |
712 | al.append( inL ); | 726 | al.append( inL ); |
713 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 727 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
714 | } | 728 | } |
715 | } | 729 | } |
716 | inL = el.next(); | 730 | inL = el.next(); |
717 | } | 731 | } |
718 | if ( al.count() ) { | 732 | if ( al.count() ) { |
719 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); | 733 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); |
720 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); | 734 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); |
721 | QVBoxLayout* lay = new QVBoxLayout( dia ); | 735 | QVBoxLayout* lay = new QVBoxLayout( dia ); |
722 | lay->setSpacing( 0 ); | 736 | lay->setSpacing( 0 ); |
723 | lay->setMargin( 0 ); | 737 | lay->setMargin( 0 ); |
724 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); | 738 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); |
725 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 739 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
726 | lay->addWidget( matb ); | 740 | lay->addWidget( matb ); |
727 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { | 741 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { |
728 | int wid = 210; | 742 | int wid = 210; |
729 | int x = QApplication::desktop()->width() - wid - 7; | 743 | int x = QApplication::desktop()->width() - wid - 7; |
730 | int y = QApplication::desktop()->height() - wid - 70; | 744 | int y = QApplication::desktop()->height() - wid - 70; |
731 | dia->setGeometry ( x,y,wid,wid); | 745 | dia->setGeometry ( x,y,wid,wid); |
732 | } else { | 746 | } else { |
733 | int si = 220; | 747 | int si = 220; |
734 | if ( QApplication::desktop()->width() > 470 ) | 748 | if ( QApplication::desktop()->width() > 470 ) |
735 | si = 400; | 749 | si = 400; |
736 | dia->resize(si,si/2); | 750 | dia->resize(si,si/2); |
737 | } | 751 | } |
738 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); | 752 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); |
739 | dia->show(); | 753 | dia->show(); |
740 | 754 | ||
741 | } | 755 | } |
742 | } | 756 | } |
743 | void CalendarView::showDay( QDate d ) | 757 | void CalendarView::showDay( QDate d ) |
744 | { | 758 | { |
745 | dateNavigator()->blockSignals( true ); | 759 | dateNavigator()->blockSignals( true ); |
746 | dateNavigator()->selectDate( d ); | 760 | dateNavigator()->selectDate( d ); |
747 | dateNavigator()->blockSignals( false ); | 761 | dateNavigator()->blockSignals( false ); |
748 | mViewManager->showDayView(); | 762 | mViewManager->showDayView(); |
749 | //dateNavigator()->selectDate( d ); | 763 | //dateNavigator()->selectDate( d ); |
750 | } | 764 | } |
751 | void CalendarView::timerAlarm() | 765 | void CalendarView::timerAlarm() |
752 | { | 766 | { |
753 | //qDebug("CalendarView::timerAlarm() "); | 767 | //qDebug("CalendarView::timerAlarm() "); |
754 | computeAlarm(mAlarmNotification ); | 768 | computeAlarm(mAlarmNotification ); |
755 | } | 769 | } |
756 | 770 | ||
757 | void CalendarView::suspendAlarm() | 771 | void CalendarView::suspendAlarm() |
758 | { | 772 | { |
759 | //qDebug(" CalendarView::suspendAlarm() "); | 773 | //qDebug(" CalendarView::suspendAlarm() "); |
760 | computeAlarm(mSuspendAlarmNotification ); | 774 | computeAlarm(mSuspendAlarmNotification ); |
761 | 775 | ||
762 | } | 776 | } |
763 | 777 | ||
764 | void CalendarView::startAlarm( QString mess , QString filename) | 778 | void CalendarView::startAlarm( QString mess , QString filename) |
765 | { | 779 | { |
766 | 780 | ||
767 | topLevelWidget()->showNormal(); | 781 | topLevelWidget()->showNormal(); |
768 | topLevelWidget()->setActiveWindow(); | 782 | topLevelWidget()->setActiveWindow(); |
769 | topLevelWidget()->raise(); | 783 | topLevelWidget()->raise(); |
770 | 784 | ||
771 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 785 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
772 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 786 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
773 | 787 | ||
774 | } | 788 | } |
775 | 789 | ||
776 | void CalendarView::checkNextTimerAlarm() | 790 | void CalendarView::checkNextTimerAlarm() |
777 | { | 791 | { |
778 | mCalendar->checkAlarmForIncidence( 0, true ); | 792 | mCalendar->checkAlarmForIncidence( 0, true ); |
779 | } | 793 | } |
780 | 794 | ||
781 | void CalendarView::computeAlarm( QString msg ) | 795 | void CalendarView::computeAlarm( QString msg ) |
782 | { | 796 | { |
783 | 797 | ||
784 | QString mess = msg; | 798 | QString mess = msg; |
785 | QString mAlarmMessage = mess.mid( 9 ); | 799 | QString mAlarmMessage = mess.mid( 9 ); |
786 | QString filename = MainWindow::resourcePath(); | 800 | QString filename = MainWindow::resourcePath(); |
787 | filename += "koalarm.wav"; | 801 | filename += "koalarm.wav"; |
788 | QString tempfilename; | 802 | QString tempfilename; |
789 | if ( mess.left( 13 ) == "suspend_alarm") { | 803 | if ( mess.left( 13 ) == "suspend_alarm") { |
790 | bool error = false; | 804 | bool error = false; |
791 | int len = mess.mid( 13 ).find("+++"); | 805 | int len = mess.mid( 13 ).find("+++"); |
792 | if ( len < 2 ) | 806 | if ( len < 2 ) |
793 | error = true; | 807 | error = true; |
794 | else { | 808 | else { |
795 | tempfilename = mess.mid( 13, len ); | 809 | tempfilename = mess.mid( 13, len ); |
796 | if ( !QFile::exists( tempfilename ) ) | 810 | if ( !QFile::exists( tempfilename ) ) |
797 | error = true; | 811 | error = true; |
798 | } | 812 | } |
799 | if ( ! error ) { | 813 | if ( ! error ) { |
800 | filename = tempfilename; | 814 | filename = tempfilename; |
801 | } | 815 | } |
802 | mAlarmMessage = mess.mid( 13+len+3 ); | 816 | mAlarmMessage = mess.mid( 13+len+3 ); |
803 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 817 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
804 | startAlarm( mAlarmMessage, filename); | 818 | startAlarm( mAlarmMessage, filename); |
805 | return; | 819 | return; |
806 | } | 820 | } |
807 | if ( mess.left( 11 ) == "timer_alarm") { | 821 | if ( mess.left( 11 ) == "timer_alarm") { |
808 | //mTimerTime = 0; | 822 | //mTimerTime = 0; |
809 | startAlarm( mess.mid( 11 ), filename ); | 823 | startAlarm( mess.mid( 11 ), filename ); |
810 | return; | 824 | return; |
811 | } | 825 | } |
812 | if ( mess.left( 10 ) == "proc_alarm") { | 826 | if ( mess.left( 10 ) == "proc_alarm") { |
813 | bool error = false; | 827 | bool error = false; |
814 | int len = mess.mid( 10 ).find("+++"); | 828 | int len = mess.mid( 10 ).find("+++"); |
815 | if ( len < 2 ) | 829 | if ( len < 2 ) |
816 | error = true; | 830 | error = true; |
817 | else { | 831 | else { |
818 | tempfilename = mess.mid( 10, len ); | 832 | tempfilename = mess.mid( 10, len ); |
819 | if ( !QFile::exists( tempfilename ) ) | 833 | if ( !QFile::exists( tempfilename ) ) |
820 | error = true; | 834 | error = true; |
821 | } | 835 | } |
822 | if ( error ) { | 836 | if ( error ) { |
823 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 837 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
824 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 838 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
825 | } else { | 839 | } else { |
826 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 840 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
827 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 841 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
828 | #ifndef _WIN32_ | 842 | #ifndef _WIN32_ |
829 | if ( vfork () == 0 ) { | 843 | if ( vfork () == 0 ) { |
830 | execl ( tempfilename.latin1(), 0 ); | 844 | execl ( tempfilename.latin1(), 0 ); |
831 | return; | 845 | return; |
832 | } | 846 | } |
833 | #else | 847 | #else |
834 | QProcess* p = new QProcess(); | 848 | QProcess* p = new QProcess(); |
835 | p->addArgument( tempfilename.latin1() ); | 849 | p->addArgument( tempfilename.latin1() ); |
836 | p->start(); | 850 | p->start(); |
837 | return; | 851 | return; |
838 | #endif | 852 | #endif |
839 | 853 | ||
840 | return; | 854 | return; |
841 | } | 855 | } |
842 | 856 | ||
843 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 857 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
844 | } | 858 | } |
845 | if ( mess.left( 11 ) == "audio_alarm") { | 859 | if ( mess.left( 11 ) == "audio_alarm") { |
846 | bool error = false; | 860 | bool error = false; |
847 | int len = mess.mid( 11 ).find("+++"); | 861 | int len = mess.mid( 11 ).find("+++"); |
848 | if ( len < 2 ) | 862 | if ( len < 2 ) |
849 | error = true; | 863 | error = true; |
850 | else { | 864 | else { |
851 | tempfilename = mess.mid( 11, len ); | 865 | tempfilename = mess.mid( 11, len ); |
852 | if ( !QFile::exists( tempfilename ) ) | 866 | if ( !QFile::exists( tempfilename ) ) |
853 | error = true; | 867 | error = true; |
854 | } | 868 | } |
855 | if ( ! error ) { | 869 | if ( ! error ) { |
856 | filename = tempfilename; | 870 | filename = tempfilename; |
857 | } | 871 | } |
858 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 872 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
859 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 873 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
860 | } | 874 | } |
861 | if ( mess.left( 9 ) == "cal_alarm") { | 875 | if ( mess.left( 9 ) == "cal_alarm") { |
862 | mAlarmMessage = mess.mid( 9 ) ; | 876 | mAlarmMessage = mess.mid( 9 ) ; |
863 | } | 877 | } |
864 | 878 | ||
865 | startAlarm( mAlarmMessage, filename ); | 879 | startAlarm( mAlarmMessage, filename ); |
866 | 880 | ||
867 | 881 | ||
868 | } | 882 | } |
869 | 883 | ||
870 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 884 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
871 | { | 885 | { |
872 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 886 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
873 | 887 | ||
874 | mSuspendAlarmNotification = noti; | 888 | mSuspendAlarmNotification = noti; |
875 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 889 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
876 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 890 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
877 | mSuspendTimer->start( ms , true ); | 891 | mSuspendTimer->start( ms , true ); |
878 | 892 | ||
879 | } | 893 | } |
880 | 894 | ||
881 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 895 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
882 | { | 896 | { |
883 | mNextAlarmDateTime = qdt; | 897 | mNextAlarmDateTime = qdt; |
884 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 898 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
885 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 899 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
886 | #ifndef DESKTOP_VERSION | 900 | #ifndef DESKTOP_VERSION |
887 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); | 901 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); |
888 | #endif | 902 | #endif |
889 | return; | 903 | return; |
890 | } | 904 | } |
891 | int maxSec; | 905 | int maxSec; |
892 | //maxSec = 5; //testing only | 906 | //maxSec = 5; //testing only |
893 | maxSec = 86400+3600; // one day+1hour | 907 | maxSec = 86400+3600; // one day+1hour |
894 | mAlarmNotification = noti; | 908 | mAlarmNotification = noti; |
895 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 909 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
896 | if ( sec > maxSec ) { | 910 | if ( sec > maxSec ) { |
897 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 911 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
898 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 912 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
899 | return; | 913 | return; |
900 | } else { | 914 | } else { |
901 | mRecheckAlarmTimer->stop(); | 915 | mRecheckAlarmTimer->stop(); |
902 | } | 916 | } |
903 | //qDebug("Alarm timer started with secs: %d ", sec); | 917 | //qDebug("Alarm timer started with secs: %d ", sec); |
904 | mAlarmTimer->start( sec *1000 , true ); | 918 | mAlarmTimer->start( sec *1000 , true ); |
905 | 919 | ||
906 | } | 920 | } |
907 | // called by mRecheckAlarmTimer to get next alarm | 921 | // called by mRecheckAlarmTimer to get next alarm |
908 | // we need this, because a QTimer has only a max range of 25 days | 922 | // we need this, because a QTimer has only a max range of 25 days |
909 | void CalendarView::recheckTimerAlarm() | 923 | void CalendarView::recheckTimerAlarm() |
910 | { | 924 | { |
911 | mAlarmTimer->stop(); | 925 | mAlarmTimer->stop(); |
912 | mRecheckAlarmTimer->stop(); | 926 | mRecheckAlarmTimer->stop(); |
913 | mCalendar->checkAlarmForIncidence( 0, true ); | 927 | mCalendar->checkAlarmForIncidence( 0, true ); |
914 | } | 928 | } |
915 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 929 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
916 | { | 930 | { |
917 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 931 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
918 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 932 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
919 | #ifndef DESKTOP_VERSION | 933 | #ifndef DESKTOP_VERSION |
920 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 934 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
921 | #endif | 935 | #endif |
922 | return; | 936 | return; |
923 | } | 937 | } |
924 | mAlarmTimer->stop(); | 938 | mAlarmTimer->stop(); |
925 | } | 939 | } |
926 | void CalendarView::selectWeekNum ( int num ) | 940 | void CalendarView::selectWeekNum ( int num ) |
927 | { | 941 | { |
928 | dateNavigator()->blockSignals( true ); | 942 | dateNavigator()->blockSignals( true ); |
929 | dateNavigator()->selectWeek( num ); | 943 | dateNavigator()->selectWeek( num ); |
930 | dateNavigator()->blockSignals( false ); | 944 | dateNavigator()->blockSignals( false ); |
931 | mViewManager->showWeekView(); | 945 | mViewManager->showWeekView(); |
932 | } | 946 | } |
933 | KOViewManager *CalendarView::viewManager() | 947 | KOViewManager *CalendarView::viewManager() |
934 | { | 948 | { |
935 | return mViewManager; | 949 | return mViewManager; |
936 | } | 950 | } |
937 | 951 | ||
938 | KODialogManager *CalendarView::dialogManager() | 952 | KODialogManager *CalendarView::dialogManager() |
939 | { | 953 | { |
940 | return mDialogManager; | 954 | return mDialogManager; |
941 | } | 955 | } |
942 | 956 | ||
943 | QDate CalendarView::startDate() | 957 | QDate CalendarView::startDate() |
944 | { | 958 | { |
945 | DateList dates = mNavigator->selectedDates(); | 959 | DateList dates = mNavigator->selectedDates(); |
946 | 960 | ||
947 | return dates.first(); | 961 | return dates.first(); |
948 | } | 962 | } |
949 | 963 | ||
950 | QDate CalendarView::endDate() | 964 | QDate CalendarView::endDate() |
951 | { | 965 | { |
952 | DateList dates = mNavigator->selectedDates(); | 966 | DateList dates = mNavigator->selectedDates(); |
953 | 967 | ||
954 | return dates.last(); | 968 | return dates.last(); |
955 | } | 969 | } |
956 | 970 | ||
957 | 971 | ||
958 | void CalendarView::createPrinter() | 972 | void CalendarView::createPrinter() |
959 | { | 973 | { |
960 | #ifndef KORG_NOPRINTER | 974 | #ifndef KORG_NOPRINTER |
961 | if (!mCalPrinter) { | 975 | if (!mCalPrinter) { |
962 | mCalPrinter = new CalPrinter(this, mCalendar); | 976 | mCalPrinter = new CalPrinter(this, mCalendar); |
963 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); | 977 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); |
964 | } | 978 | } |
965 | #endif | 979 | #endif |
966 | } | 980 | } |
967 | 981 | ||
968 | 982 | ||
969 | //KOPrefs::instance()->mWriteBackFile | 983 | //KOPrefs::instance()->mWriteBackFile |
970 | //KOPrefs::instance()->mWriteBackExistingOnly | 984 | //KOPrefs::instance()->mWriteBackExistingOnly |
971 | 985 | ||
972 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 986 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
973 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 987 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
974 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 988 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
975 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 989 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
976 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 990 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
977 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 991 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
978 | 992 | ||
979 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 993 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
980 | { | 994 | { |
981 | 995 | ||
982 | // 0 equal | 996 | // 0 equal |
983 | // 1 take local | 997 | // 1 take local |
984 | // 2 take remote | 998 | // 2 take remote |
985 | // 3 cancel | 999 | // 3 cancel |
986 | QDateTime lastSync = mLastCalendarSync; | 1000 | QDateTime lastSync = mLastCalendarSync; |
987 | QDateTime localMod = local->lastModified(); | 1001 | QDateTime localMod = local->lastModified(); |
988 | QDateTime remoteMod = remote->lastModified(); | 1002 | QDateTime remoteMod = remote->lastModified(); |
989 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1003 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
990 | bool remCh, locCh; | 1004 | bool remCh, locCh; |
991 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 1005 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
992 | //if ( remCh ) | 1006 | //if ( remCh ) |
993 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 1007 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
994 | locCh = ( localMod > mLastCalendarSync ); | 1008 | locCh = ( localMod > mLastCalendarSync ); |
995 | if ( !remCh && ! locCh ) { | 1009 | if ( !remCh && ! locCh ) { |
996 | //qDebug("both not changed "); | 1010 | //qDebug("both not changed "); |
997 | lastSync = localMod.addDays(1); | 1011 | lastSync = localMod.addDays(1); |
998 | if ( mode <= SYNC_PREF_ASK ) | 1012 | if ( mode <= SYNC_PREF_ASK ) |
999 | return 0; | 1013 | return 0; |
1000 | } else { | 1014 | } else { |
1001 | if ( locCh ) { | 1015 | if ( locCh ) { |
1002 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); | 1016 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); |
1003 | lastSync = localMod.addDays( -1 ); | 1017 | lastSync = localMod.addDays( -1 ); |
1004 | if ( !remCh ) | 1018 | if ( !remCh ) |
1005 | remoteMod = ( lastSync.addDays( -1 ) ); | 1019 | remoteMod = ( lastSync.addDays( -1 ) ); |
1006 | } else { | 1020 | } else { |
1007 | //qDebug(" not loc changed "); | 1021 | //qDebug(" not loc changed "); |
1008 | lastSync = localMod.addDays( 1 ); | 1022 | lastSync = localMod.addDays( 1 ); |
1009 | if ( remCh ) | 1023 | if ( remCh ) |
1010 | remoteMod =( lastSync.addDays( 1 ) ); | 1024 | remoteMod =( lastSync.addDays( 1 ) ); |
1011 | 1025 | ||
1012 | } | 1026 | } |
1013 | } | 1027 | } |
1014 | full = true; | 1028 | full = true; |
1015 | if ( mode < SYNC_PREF_ASK ) | 1029 | if ( mode < SYNC_PREF_ASK ) |
1016 | mode = SYNC_PREF_ASK; | 1030 | mode = SYNC_PREF_ASK; |
1017 | } else { | 1031 | } else { |
1018 | if ( localMod == remoteMod ) | 1032 | if ( localMod == remoteMod ) |
1019 | // if ( local->revision() == remote->revision() ) | 1033 | // if ( local->revision() == remote->revision() ) |
1020 | return 0; | 1034 | return 0; |
1021 | 1035 | ||
1022 | } | 1036 | } |
1023 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 1037 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
1024 | 1038 | ||
1025 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); | 1039 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); |
1026 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); | 1040 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); |
1027 | //full = true; //debug only | 1041 | //full = true; //debug only |
1028 | if ( full ) { | 1042 | if ( full ) { |
1029 | bool equ = false; | 1043 | bool equ = false; |
1030 | if ( local->typeID() == eventID ) { | 1044 | if ( local->typeID() == eventID ) { |
1031 | equ = (*((Event*) local) == *((Event*) remote)); | 1045 | equ = (*((Event*) local) == *((Event*) remote)); |
1032 | } | 1046 | } |
1033 | else if ( local->typeID() == todoID ) | 1047 | else if ( local->typeID() == todoID ) |
1034 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 1048 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
1035 | else if ( local->typeID() == journalID ) | 1049 | else if ( local->typeID() == journalID ) |
1036 | equ = (*((Journal*) local) == *((Journal*) remote)); | 1050 | equ = (*((Journal*) local) == *((Journal*) remote)); |
1037 | if ( equ ) { | 1051 | if ( equ ) { |
1038 | //qDebug("equal "); | 1052 | //qDebug("equal "); |
1039 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1053 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1040 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 1054 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
1041 | } | 1055 | } |
1042 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 1056 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
1043 | return 0; | 1057 | return 0; |
1044 | 1058 | ||
1045 | }//else //debug only | 1059 | }//else //debug only |
1046 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 1060 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
1047 | } | 1061 | } |
1048 | int result; | 1062 | int result; |
1049 | bool localIsNew; | 1063 | bool localIsNew; |
1050 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); | 1064 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); |
1051 | 1065 | ||
1052 | 1066 | ||
1053 | // ************************************************ | 1067 | // ************************************************ |
1054 | // ************************************************ | 1068 | // ************************************************ |
1055 | // ************************************************ | 1069 | // ************************************************ |
1056 | // We may have that lastSync > remoteMod AND lastSync > localMod | 1070 | // We may have that lastSync > remoteMod AND lastSync > localMod |
1057 | // BUT remoteMod != localMod | 1071 | // BUT remoteMod != localMod |
1058 | 1072 | ||
1059 | 1073 | ||
1060 | if ( full && mode < SYNC_PREF_NEWEST ) | 1074 | if ( full && mode < SYNC_PREF_NEWEST ) |
1061 | mode = SYNC_PREF_ASK; | 1075 | mode = SYNC_PREF_ASK; |
1062 | 1076 | ||
1063 | switch( mode ) { | 1077 | switch( mode ) { |
1064 | case SYNC_PREF_LOCAL: | 1078 | case SYNC_PREF_LOCAL: |
1065 | if ( lastSync > remoteMod ) | 1079 | if ( lastSync > remoteMod ) |
1066 | return 1; | 1080 | return 1; |
1067 | if ( lastSync > localMod ) | 1081 | if ( lastSync > localMod ) |
1068 | return 2; | 1082 | return 2; |
1069 | return 1; | 1083 | return 1; |
1070 | break; | 1084 | break; |
@@ -1542,779 +1556,779 @@ bool CalendarView::syncCalendar(QString filename, int mode) | |||
1542 | } | 1556 | } |
1543 | } | 1557 | } |
1544 | setModified( true ); | 1558 | setModified( true ); |
1545 | } | 1559 | } |
1546 | delete storage; | 1560 | delete storage; |
1547 | delete calendar; | 1561 | delete calendar; |
1548 | if ( syncOK ) | 1562 | if ( syncOK ) |
1549 | updateView(); | 1563 | updateView(); |
1550 | return syncOK; | 1564 | return syncOK; |
1551 | } | 1565 | } |
1552 | 1566 | ||
1553 | void CalendarView::syncExternal( int mode ) | 1567 | void CalendarView::syncExternal( int mode ) |
1554 | { | 1568 | { |
1555 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1569 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1556 | 1570 | ||
1557 | qApp->processEvents(); | 1571 | qApp->processEvents(); |
1558 | CalendarLocal* calendar = new CalendarLocal(); | 1572 | CalendarLocal* calendar = new CalendarLocal(); |
1559 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1573 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1560 | bool syncOK = false; | 1574 | bool syncOK = false; |
1561 | bool loadSuccess = false; | 1575 | bool loadSuccess = false; |
1562 | PhoneFormat* phoneFormat = 0; | 1576 | PhoneFormat* phoneFormat = 0; |
1563 | emit tempDisableBR(true); | 1577 | emit tempDisableBR(true); |
1564 | #ifndef DESKTOP_VERSION | 1578 | #ifndef DESKTOP_VERSION |
1565 | SharpFormat* sharpFormat = 0; | 1579 | SharpFormat* sharpFormat = 0; |
1566 | if ( mode == 0 ) { // sharp | 1580 | if ( mode == 0 ) { // sharp |
1567 | sharpFormat = new SharpFormat () ; | 1581 | sharpFormat = new SharpFormat () ; |
1568 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1582 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1569 | 1583 | ||
1570 | } else | 1584 | } else |
1571 | #endif | 1585 | #endif |
1572 | if ( mode == 1 ) { // phone | 1586 | if ( mode == 1 ) { // phone |
1573 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1587 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1574 | mSyncManager->mPhoneDevice, | 1588 | mSyncManager->mPhoneDevice, |
1575 | mSyncManager->mPhoneConnection, | 1589 | mSyncManager->mPhoneConnection, |
1576 | mSyncManager->mPhoneModel); | 1590 | mSyncManager->mPhoneModel); |
1577 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 1591 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
1578 | 1592 | ||
1579 | } else { | 1593 | } else { |
1580 | emit tempDisableBR(false); | 1594 | emit tempDisableBR(false); |
1581 | return; | 1595 | return; |
1582 | } | 1596 | } |
1583 | if ( loadSuccess ) { | 1597 | if ( loadSuccess ) { |
1584 | getEventViewerDialog()->setSyncMode( true ); | 1598 | getEventViewerDialog()->setSyncMode( true ); |
1585 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1599 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1586 | getEventViewerDialog()->setSyncMode( false ); | 1600 | getEventViewerDialog()->setSyncMode( false ); |
1587 | qApp->processEvents(); | 1601 | qApp->processEvents(); |
1588 | if ( syncOK ) { | 1602 | if ( syncOK ) { |
1589 | if ( mSyncManager->mWriteBackFile ) | 1603 | if ( mSyncManager->mWriteBackFile ) |
1590 | { | 1604 | { |
1591 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1605 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1592 | Incidence* inc = iL.first(); | 1606 | Incidence* inc = iL.first(); |
1593 | if ( phoneFormat ) { | 1607 | if ( phoneFormat ) { |
1594 | while ( inc ) { | 1608 | while ( inc ) { |
1595 | inc->removeID(mCurrentSyncDevice); | 1609 | inc->removeID(mCurrentSyncDevice); |
1596 | inc = iL.next(); | 1610 | inc = iL.next(); |
1597 | } | 1611 | } |
1598 | } | 1612 | } |
1599 | #ifndef DESKTOP_VERSION | 1613 | #ifndef DESKTOP_VERSION |
1600 | if ( sharpFormat ) | 1614 | if ( sharpFormat ) |
1601 | sharpFormat->save(calendar); | 1615 | sharpFormat->save(calendar); |
1602 | #endif | 1616 | #endif |
1603 | if ( phoneFormat ) | 1617 | if ( phoneFormat ) |
1604 | phoneFormat->save(calendar); | 1618 | phoneFormat->save(calendar); |
1605 | iL = calendar->rawIncidences(); | 1619 | iL = calendar->rawIncidences(); |
1606 | inc = iL.first(); | 1620 | inc = iL.first(); |
1607 | Incidence* loc; | 1621 | Incidence* loc; |
1608 | while ( inc ) { | 1622 | while ( inc ) { |
1609 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1623 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1610 | loc = mCalendar->incidence(inc->uid() ); | 1624 | loc = mCalendar->incidence(inc->uid() ); |
1611 | if ( loc ) { | 1625 | if ( loc ) { |
1612 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1626 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1613 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1627 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1614 | } | 1628 | } |
1615 | } | 1629 | } |
1616 | inc = iL.next(); | 1630 | inc = iL.next(); |
1617 | } | 1631 | } |
1618 | Incidence* lse = getLastSyncEvent(); | 1632 | Incidence* lse = getLastSyncEvent(); |
1619 | if ( lse ) { | 1633 | if ( lse ) { |
1620 | lse->setReadOnly( false ); | 1634 | lse->setReadOnly( false ); |
1621 | lse->setDescription( "" ); | 1635 | lse->setDescription( "" ); |
1622 | lse->setReadOnly( true ); | 1636 | lse->setReadOnly( true ); |
1623 | } | 1637 | } |
1624 | } | 1638 | } |
1625 | } else { | 1639 | } else { |
1626 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 1640 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
1627 | } | 1641 | } |
1628 | setModified( true ); | 1642 | setModified( true ); |
1629 | } else { | 1643 | } else { |
1630 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1644 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1631 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1645 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1632 | question, i18n("Ok")) ; | 1646 | question, i18n("Ok")) ; |
1633 | 1647 | ||
1634 | } | 1648 | } |
1635 | delete calendar; | 1649 | delete calendar; |
1636 | updateView(); | 1650 | updateView(); |
1637 | emit tempDisableBR(false); | 1651 | emit tempDisableBR(false); |
1638 | return ;//syncOK; | 1652 | return ;//syncOK; |
1639 | 1653 | ||
1640 | } | 1654 | } |
1641 | 1655 | ||
1642 | bool CalendarView::importBday() | 1656 | bool CalendarView::importBday() |
1643 | { | 1657 | { |
1644 | #ifndef KORG_NOKABC | 1658 | #ifndef KORG_NOKABC |
1645 | 1659 | ||
1646 | #ifdef DESKTOP_VERSION | 1660 | #ifdef DESKTOP_VERSION |
1647 | int curCal = mCalendar->defaultCalendar(); | 1661 | int curCal = mCalendar->defaultCalendar(); |
1648 | int bd = mCalEditView->getBirtdayID(); | 1662 | int bd = mCalEditView->getBirtdayID(); |
1649 | if ( bd == 0 ) | 1663 | if ( bd == 0 ) |
1650 | return false; | 1664 | return false; |
1651 | mCalendar->setDefaultCalendar( bd ); | 1665 | mCalendar->setDefaultCalendar( bd ); |
1652 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1666 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1653 | KABC::AddressBook::Iterator it; | 1667 | KABC::AddressBook::Iterator it; |
1654 | int count = 0; | 1668 | int count = 0; |
1655 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1669 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1656 | ++count; | 1670 | ++count; |
1657 | } | 1671 | } |
1658 | QProgressBar bar(count,0 ); | 1672 | QProgressBar bar(count,0 ); |
1659 | int w = 300; | 1673 | int w = 300; |
1660 | if ( QApplication::desktop()->width() < 320 ) | 1674 | if ( QApplication::desktop()->width() < 320 ) |
1661 | w = 220; | 1675 | w = 220; |
1662 | int h = bar.sizeHint().height() ; | 1676 | int h = bar.sizeHint().height() ; |
1663 | int dw = QApplication::desktop()->width(); | 1677 | int dw = QApplication::desktop()->width(); |
1664 | int dh = QApplication::desktop()->height(); | 1678 | int dh = QApplication::desktop()->height(); |
1665 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1679 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1666 | bar.show(); | 1680 | bar.show(); |
1667 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1681 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1668 | qApp->processEvents(); | 1682 | qApp->processEvents(); |
1669 | count = 0; | 1683 | count = 0; |
1670 | int addCount = 0; | 1684 | int addCount = 0; |
1671 | KCal::Attendee* a = 0; | 1685 | KCal::Attendee* a = 0; |
1672 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1686 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1673 | if ( ! bar.isVisible() ) | 1687 | if ( ! bar.isVisible() ) |
1674 | return false; | 1688 | return false; |
1675 | bar.setProgress( count++ ); | 1689 | bar.setProgress( count++ ); |
1676 | qApp->processEvents(); | 1690 | qApp->processEvents(); |
1677 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1691 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1678 | if ( (*it).birthday().date().isValid() ){ | 1692 | if ( (*it).birthday().date().isValid() ){ |
1679 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1693 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1680 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1694 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1681 | ++addCount; | 1695 | ++addCount; |
1682 | } | 1696 | } |
1683 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1697 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1684 | if ( anni.isValid() ){ | 1698 | if ( anni.isValid() ){ |
1685 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1699 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1686 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1700 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1687 | ++addCount; | 1701 | ++addCount; |
1688 | } | 1702 | } |
1689 | } | 1703 | } |
1690 | mCalendar->setDefaultCalendar( curCal ); | 1704 | mCalendar->setDefaultCalendar( curCal ); |
1691 | updateView(); | 1705 | updateView(); |
1692 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1706 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1693 | #else //DESKTOP_VERSION | 1707 | #else //DESKTOP_VERSION |
1694 | 1708 | ||
1695 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 1709 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
1696 | // the result should now arrive through method insertBirthdays | 1710 | // the result should now arrive through method insertBirthdays |
1697 | 1711 | ||
1698 | #endif //DESKTOP_VERSION | 1712 | #endif //DESKTOP_VERSION |
1699 | 1713 | ||
1700 | #endif //KORG_NOKABC | 1714 | #endif //KORG_NOKABC |
1701 | 1715 | ||
1702 | 1716 | ||
1703 | return true; | 1717 | return true; |
1704 | } | 1718 | } |
1705 | 1719 | ||
1706 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI | 1720 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI |
1707 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | 1721 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, |
1708 | const QStringList& anniversaryList, const QStringList& realNameList, | 1722 | const QStringList& anniversaryList, const QStringList& realNameList, |
1709 | const QStringList& emailList, const QStringList& assembledNameList, | 1723 | const QStringList& emailList, const QStringList& assembledNameList, |
1710 | const QStringList& uidList) | 1724 | const QStringList& uidList) |
1711 | { | 1725 | { |
1712 | 1726 | ||
1713 | //qDebug("KO::CalendarView::insertBirthdays"); | 1727 | //qDebug("KO::CalendarView::insertBirthdays"); |
1714 | if (uid == this->name()) | 1728 | if (uid == this->name()) |
1715 | { | 1729 | { |
1716 | int curCal = mCalendar->defaultCalendar(); | 1730 | int curCal = mCalendar->defaultCalendar(); |
1717 | int bd = mCalEditView->getBirtdayID(); | 1731 | int bd = mCalEditView->getBirtdayID(); |
1718 | if ( bd == 0 ) | 1732 | if ( bd == 0 ) |
1719 | return; | 1733 | return; |
1720 | mCalendar->setDefaultCalendar( bd ); | 1734 | mCalendar->setDefaultCalendar( bd ); |
1721 | 1735 | ||
1722 | 1736 | ||
1723 | int count = birthdayList.count(); | 1737 | int count = birthdayList.count(); |
1724 | int addCount = 0; | 1738 | int addCount = 0; |
1725 | KCal::Attendee* a = 0; | 1739 | KCal::Attendee* a = 0; |
1726 | 1740 | ||
1727 | //qDebug("CalView 1 %i", count); | 1741 | //qDebug("CalView 1 %i", count); |
1728 | 1742 | ||
1729 | QProgressBar bar(count,0 ); | 1743 | QProgressBar bar(count,0 ); |
1730 | int w = 300; | 1744 | int w = 300; |
1731 | if ( QApplication::desktop()->width() < 320 ) | 1745 | if ( QApplication::desktop()->width() < 320 ) |
1732 | w = 220; | 1746 | w = 220; |
1733 | int h = bar.sizeHint().height() ; | 1747 | int h = bar.sizeHint().height() ; |
1734 | int dw = QApplication::desktop()->width(); | 1748 | int dw = QApplication::desktop()->width(); |
1735 | int dh = QApplication::desktop()->height(); | 1749 | int dh = QApplication::desktop()->height(); |
1736 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1750 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1737 | bar.show(); | 1751 | bar.show(); |
1738 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); | 1752 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); |
1739 | qApp->processEvents(); | 1753 | qApp->processEvents(); |
1740 | 1754 | ||
1741 | QDate birthday; | 1755 | QDate birthday; |
1742 | QDate anniversary; | 1756 | QDate anniversary; |
1743 | QString realName; | 1757 | QString realName; |
1744 | QString email; | 1758 | QString email; |
1745 | QString assembledName; | 1759 | QString assembledName; |
1746 | QString uid; | 1760 | QString uid; |
1747 | bool ok = true; | 1761 | bool ok = true; |
1748 | for ( int i = 0; i < count; i++) | 1762 | for ( int i = 0; i < count; i++) |
1749 | { | 1763 | { |
1750 | if ( ! bar.isVisible() ) | 1764 | if ( ! bar.isVisible() ) |
1751 | return; | 1765 | return; |
1752 | bar.setProgress( i ); | 1766 | bar.setProgress( i ); |
1753 | qApp->processEvents(); | 1767 | qApp->processEvents(); |
1754 | 1768 | ||
1755 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); | 1769 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); |
1756 | if (!ok) { | 1770 | if (!ok) { |
1757 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); | 1771 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); |
1758 | } | 1772 | } |
1759 | 1773 | ||
1760 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); | 1774 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); |
1761 | if (!ok) { | 1775 | if (!ok) { |
1762 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); | 1776 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); |
1763 | } | 1777 | } |
1764 | realName = realNameList[i]; | 1778 | realName = realNameList[i]; |
1765 | email = emailList[i]; | 1779 | email = emailList[i]; |
1766 | assembledName = assembledNameList[i]; | 1780 | assembledName = assembledNameList[i]; |
1767 | uid = uidList[i]; | 1781 | uid = uidList[i]; |
1768 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); | 1782 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); |
1769 | 1783 | ||
1770 | if ( birthday.isValid() ){ | 1784 | if ( birthday.isValid() ){ |
1771 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1785 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1772 | KCal::Attendee::ReqParticipant,uid) ; | 1786 | KCal::Attendee::ReqParticipant,uid) ; |
1773 | if ( addAnniversary( birthday, assembledName, a, true ) ) | 1787 | if ( addAnniversary( birthday, assembledName, a, true ) ) |
1774 | ++addCount; | 1788 | ++addCount; |
1775 | } | 1789 | } |
1776 | 1790 | ||
1777 | if ( anniversary.isValid() ){ | 1791 | if ( anniversary.isValid() ){ |
1778 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1792 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1779 | KCal::Attendee::ReqParticipant,uid) ; | 1793 | KCal::Attendee::ReqParticipant,uid) ; |
1780 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | 1794 | if ( addAnniversary( anniversary, assembledName, a, false ) ) |
1781 | ++addCount; | 1795 | ++addCount; |
1782 | } | 1796 | } |
1783 | } | 1797 | } |
1784 | 1798 | ||
1785 | mCalendar->setDefaultCalendar( curCal ); | 1799 | mCalendar->setDefaultCalendar( curCal ); |
1786 | updateView(); | 1800 | updateView(); |
1787 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1801 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1788 | 1802 | ||
1789 | } | 1803 | } |
1790 | 1804 | ||
1791 | } | 1805 | } |
1792 | 1806 | ||
1793 | 1807 | ||
1794 | 1808 | ||
1795 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1809 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1796 | { | 1810 | { |
1797 | //qDebug("addAnni "); | 1811 | //qDebug("addAnni "); |
1798 | Event * ev = new Event(); | 1812 | Event * ev = new Event(); |
1799 | ev->setOrganizer(KOPrefs::instance()->email()); | 1813 | ev->setOrganizer(KOPrefs::instance()->email()); |
1800 | if ( a ) { | 1814 | if ( a ) { |
1801 | ev->addAttendee( a ); | 1815 | ev->addAttendee( a ); |
1802 | } | 1816 | } |
1803 | QString kind; | 1817 | QString kind; |
1804 | if ( birthday ) { | 1818 | if ( birthday ) { |
1805 | kind = i18n( "Birthday" ); | 1819 | kind = i18n( "Birthday" ); |
1806 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); | 1820 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); |
1807 | } | 1821 | } |
1808 | else { | 1822 | else { |
1809 | kind = i18n( "Anniversary" ); | 1823 | kind = i18n( "Anniversary" ); |
1810 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); | 1824 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); |
1811 | } | 1825 | } |
1812 | ev->setCategories( kind ); | 1826 | ev->setCategories( kind ); |
1813 | ev->setDtStart( QDateTime(date) ); | 1827 | ev->setDtStart( QDateTime(date) ); |
1814 | ev->setDtEnd( QDateTime(date) ); | 1828 | ev->setDtEnd( QDateTime(date) ); |
1815 | ev->setFloats( true ); | 1829 | ev->setFloats( true ); |
1816 | Recurrence * rec = ev->recurrence(); | 1830 | Recurrence * rec = ev->recurrence(); |
1817 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1831 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1818 | rec->addYearlyNum( date.month() ); | 1832 | rec->addYearlyNum( date.month() ); |
1819 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1833 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1820 | delete ev; | 1834 | delete ev; |
1821 | return false; | 1835 | return false; |
1822 | } | 1836 | } |
1823 | return true; | 1837 | return true; |
1824 | 1838 | ||
1825 | } | 1839 | } |
1826 | bool CalendarView::importQtopia( const QString &categories, | 1840 | bool CalendarView::importQtopia( const QString &categories, |
1827 | const QString &datebook, | 1841 | const QString &datebook, |
1828 | const QString &todolist ) | 1842 | const QString &todolist ) |
1829 | { | 1843 | { |
1830 | 1844 | ||
1831 | QtopiaFormat qtopiaFormat; | 1845 | QtopiaFormat qtopiaFormat; |
1832 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1846 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1833 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1847 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1834 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1848 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1835 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1849 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1836 | 1850 | ||
1837 | updateView(); | 1851 | updateView(); |
1838 | return true; | 1852 | return true; |
1839 | 1853 | ||
1840 | #if 0 | 1854 | #if 0 |
1841 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1855 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1842 | mCurrentSyncDevice = "qtopia-XML"; | 1856 | mCurrentSyncDevice = "qtopia-XML"; |
1843 | if ( mSyncManager->mAskForPreferences ) | 1857 | if ( mSyncManager->mAskForPreferences ) |
1844 | edit_sync_options(); | 1858 | edit_sync_options(); |
1845 | qApp->processEvents(); | 1859 | qApp->processEvents(); |
1846 | CalendarLocal* calendar = new CalendarLocal(); | 1860 | CalendarLocal* calendar = new CalendarLocal(); |
1847 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1861 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1848 | bool syncOK = false; | 1862 | bool syncOK = false; |
1849 | QtopiaFormat qtopiaFormat; | 1863 | QtopiaFormat qtopiaFormat; |
1850 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1864 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1851 | bool loadOk = true; | 1865 | bool loadOk = true; |
1852 | if ( !categories.isEmpty() ) | 1866 | if ( !categories.isEmpty() ) |
1853 | loadOk = qtopiaFormat.load( calendar, categories ); | 1867 | loadOk = qtopiaFormat.load( calendar, categories ); |
1854 | if ( loadOk && !datebook.isEmpty() ) | 1868 | if ( loadOk && !datebook.isEmpty() ) |
1855 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1869 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1856 | if ( loadOk && !todolist.isEmpty() ) | 1870 | if ( loadOk && !todolist.isEmpty() ) |
1857 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1871 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1858 | 1872 | ||
1859 | if ( loadOk ) { | 1873 | if ( loadOk ) { |
1860 | getEventViewerDialog()->setSyncMode( true ); | 1874 | getEventViewerDialog()->setSyncMode( true ); |
1861 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1875 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1862 | getEventViewerDialog()->setSyncMode( false ); | 1876 | getEventViewerDialog()->setSyncMode( false ); |
1863 | qApp->processEvents(); | 1877 | qApp->processEvents(); |
1864 | if ( syncOK ) { | 1878 | if ( syncOK ) { |
1865 | if ( mSyncManager->mWriteBackFile ) | 1879 | if ( mSyncManager->mWriteBackFile ) |
1866 | { | 1880 | { |
1867 | // write back XML file | 1881 | // write back XML file |
1868 | 1882 | ||
1869 | } | 1883 | } |
1870 | setModified( true ); | 1884 | setModified( true ); |
1871 | } | 1885 | } |
1872 | } else { | 1886 | } else { |
1873 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1887 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1874 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1888 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1875 | question, i18n("Ok")) ; | 1889 | question, i18n("Ok")) ; |
1876 | } | 1890 | } |
1877 | delete calendar; | 1891 | delete calendar; |
1878 | updateView(); | 1892 | updateView(); |
1879 | return syncOK; | 1893 | return syncOK; |
1880 | 1894 | ||
1881 | 1895 | ||
1882 | #endif | 1896 | #endif |
1883 | 1897 | ||
1884 | } | 1898 | } |
1885 | 1899 | ||
1886 | void CalendarView::setSyncEventsReadOnly() | 1900 | void CalendarView::setSyncEventsReadOnly() |
1887 | { | 1901 | { |
1888 | mCalendar->setSyncEventsReadOnly(); | 1902 | mCalendar->setSyncEventsReadOnly(); |
1889 | } | 1903 | } |
1890 | 1904 | ||
1891 | bool CalendarView::loadCalendars() | 1905 | bool CalendarView::loadCalendars() |
1892 | { | 1906 | { |
1893 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1907 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1894 | KopiCalendarFile * cal = calendars.first(); | 1908 | KopiCalendarFile * cal = calendars.first(); |
1895 | mCalendar->setDefaultCalendar( 1 ); | 1909 | mCalendar->setDefaultCalendar( 1 ); |
1896 | openCalendar( MainWindow::defaultFileName(), false ); | 1910 | openCalendar( MainWindow::defaultFileName(), false ); |
1897 | cal = calendars.next(); | 1911 | cal = calendars.next(); |
1898 | while ( cal ) { | 1912 | while ( cal ) { |
1899 | addCalendar( cal ); | 1913 | addCalendar( cal ); |
1900 | cal = calendars.next(); | 1914 | cal = calendars.next(); |
1901 | } | 1915 | } |
1902 | restoreCalendarSettings(); | 1916 | restoreCalendarSettings(); |
1903 | return true; | 1917 | return true; |
1904 | } | 1918 | } |
1905 | bool CalendarView::restoreCalendarSettings() | 1919 | bool CalendarView::restoreCalendarSettings() |
1906 | { | 1920 | { |
1907 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1921 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1908 | KopiCalendarFile * cal = calendars.first(); | 1922 | KopiCalendarFile * cal = calendars.first(); |
1909 | while ( cal ) { | 1923 | while ( cal ) { |
1910 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 1924 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
1911 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 1925 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
1912 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 1926 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
1913 | if ( cal->isStandard ) | 1927 | if ( cal->isStandard ) |
1914 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 1928 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
1915 | cal = calendars.next(); | 1929 | cal = calendars.next(); |
1916 | } | 1930 | } |
1917 | setSyncEventsReadOnly(); | 1931 | setSyncEventsReadOnly(); |
1918 | mCalendar->reInitAlarmSettings(); | 1932 | mCalendar->reInitAlarmSettings(); |
1919 | updateUnmanagedViews(); | 1933 | updateUnmanagedViews(); |
1920 | updateView(); | 1934 | updateView(); |
1921 | return true; | 1935 | return true; |
1922 | } | 1936 | } |
1923 | void CalendarView::addCalendarId( int id ) | 1937 | void CalendarView::addCalendarId( int id ) |
1924 | { | 1938 | { |
1925 | KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); | 1939 | KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); |
1926 | addCalendar( cal ); | 1940 | if ( cal ) |
1941 | addCalendar( cal ); | ||
1927 | } | 1942 | } |
1928 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) | 1943 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) |
1929 | { | 1944 | { |
1930 | cal->mErrorOnLoad = false; | 1945 | cal->mErrorOnLoad = false; |
1931 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) { | 1946 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) { |
1932 | cal->mLoadDt = QDateTime::currentDateTime(); | 1947 | cal->mLoadDt = QDateTime::currentDateTime(); |
1933 | return true; | 1948 | return true; |
1934 | } | 1949 | } |
1935 | qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() ); | 1950 | qDebug("KO: Error adding calendar file %s ",cal->mFileName.latin1() ); |
1936 | KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName)); | ||
1937 | cal->mErrorOnLoad = true; | 1951 | cal->mErrorOnLoad = true; |
1938 | return false; | 1952 | return false; |
1939 | } | 1953 | } |
1940 | bool CalendarView::openCalendar(QString filename, bool merge) | 1954 | bool CalendarView::openCalendar(QString filename, bool merge) |
1941 | { | 1955 | { |
1942 | 1956 | ||
1943 | if (filename.isEmpty()) { | 1957 | if (filename.isEmpty()) { |
1944 | return false; | 1958 | return false; |
1945 | } | 1959 | } |
1946 | 1960 | ||
1947 | if (!QFile::exists(filename)) { | 1961 | if (!QFile::exists(filename)) { |
1948 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1962 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1949 | return false; | 1963 | return false; |
1950 | } | 1964 | } |
1951 | 1965 | ||
1952 | globalFlagBlockAgenda = 1; | 1966 | globalFlagBlockAgenda = 1; |
1953 | clearAllViews(); | 1967 | clearAllViews(); |
1954 | if (!merge) { | 1968 | if (!merge) { |
1955 | mViewManager->setDocumentId( filename ); | 1969 | mViewManager->setDocumentId( filename ); |
1956 | mCalendar->close(); | 1970 | mCalendar->close(); |
1957 | } | 1971 | } |
1958 | mStorage->setFileName( filename ); | 1972 | mStorage->setFileName( filename ); |
1959 | 1973 | ||
1960 | if ( mStorage->load() ) { | 1974 | if ( mStorage->load() ) { |
1961 | if ( merge ) ;//setModified( true ); | 1975 | if ( merge ) ;//setModified( true ); |
1962 | else { | 1976 | else { |
1963 | //setModified( true ); | 1977 | //setModified( true ); |
1964 | mViewManager->setDocumentId( filename ); | 1978 | mViewManager->setDocumentId( filename ); |
1965 | mDialogManager->setDocumentId( filename ); | 1979 | mDialogManager->setDocumentId( filename ); |
1966 | mTodoList->setDocumentId( filename ); | 1980 | mTodoList->setDocumentId( filename ); |
1967 | } | 1981 | } |
1968 | globalFlagBlockAgenda = 2; | 1982 | globalFlagBlockAgenda = 2; |
1969 | // if ( getLastSyncEvent() ) | 1983 | // if ( getLastSyncEvent() ) |
1970 | // getLastSyncEvent()->setReadOnly( true ); | 1984 | // getLastSyncEvent()->setReadOnly( true ); |
1971 | mCalendar->reInitAlarmSettings(); | 1985 | mCalendar->reInitAlarmSettings(); |
1972 | setSyncEventsReadOnly(); | 1986 | setSyncEventsReadOnly(); |
1973 | updateUnmanagedViews(); | 1987 | updateUnmanagedViews(); |
1974 | updateView(); | 1988 | updateView(); |
1975 | if ( filename != MainWindow::defaultFileName() ) { | 1989 | if ( filename != MainWindow::defaultFileName() ) { |
1976 | saveCalendar( MainWindow::defaultFileName() ); | 1990 | saveCalendar( MainWindow::defaultFileName() ); |
1977 | } else { | 1991 | } else { |
1978 | QFileInfo finf ( MainWindow::defaultFileName()); | 1992 | QFileInfo finf ( MainWindow::defaultFileName()); |
1979 | if ( finf.exists() ) { | 1993 | if ( finf.exists() ) { |
1980 | setLoadedFileVersion( finf.lastModified () ); | 1994 | setLoadedFileVersion( finf.lastModified () ); |
1981 | } | 1995 | } |
1982 | } | 1996 | } |
1983 | return true; | 1997 | return true; |
1984 | } else { | 1998 | } else { |
1985 | // while failing to load, the calendar object could | 1999 | // while failing to load, the calendar object could |
1986 | // have become partially populated. Clear it out. | 2000 | // have become partially populated. Clear it out. |
1987 | if ( !merge ) { | 2001 | if ( !merge ) { |
1988 | mCalendar->close(); | 2002 | mCalendar->close(); |
1989 | mViewManager->setDocumentId( filename ); | 2003 | mViewManager->setDocumentId( filename ); |
1990 | mDialogManager->setDocumentId( filename ); | 2004 | mDialogManager->setDocumentId( filename ); |
1991 | mTodoList->setDocumentId( filename ); | 2005 | mTodoList->setDocumentId( filename ); |
1992 | } | 2006 | } |
1993 | 2007 | ||
1994 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 2008 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1995 | 2009 | ||
1996 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 2010 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
1997 | globalFlagBlockAgenda = 2; | 2011 | globalFlagBlockAgenda = 2; |
1998 | mCalendar->reInitAlarmSettings(); | 2012 | mCalendar->reInitAlarmSettings(); |
1999 | setSyncEventsReadOnly(); | 2013 | setSyncEventsReadOnly(); |
2000 | updateUnmanagedViews(); | 2014 | updateUnmanagedViews(); |
2001 | updateView(); | 2015 | updateView(); |
2002 | } | 2016 | } |
2003 | return false; | 2017 | return false; |
2004 | } | 2018 | } |
2005 | void CalendarView::showOpenError() | 2019 | void CalendarView::showOpenError() |
2006 | { | 2020 | { |
2007 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 2021 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
2008 | } | 2022 | } |
2009 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 2023 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
2010 | { | 2024 | { |
2011 | loadedFileVersion = dt; | 2025 | loadedFileVersion = dt; |
2012 | } | 2026 | } |
2013 | bool CalendarView::checkFileChanged(QString fn) | 2027 | bool CalendarView::checkFileChanged(QString fn) |
2014 | { | 2028 | { |
2015 | QFileInfo finf ( fn ); | 2029 | QFileInfo finf ( fn ); |
2016 | if ( !finf.exists() ) | 2030 | if ( !finf.exists() ) |
2017 | return true; | 2031 | return true; |
2018 | QDateTime dt = finf.lastModified (); | 2032 | QDateTime dt = finf.lastModified (); |
2019 | if ( dt <= loadedFileVersion ) | 2033 | if ( dt <= loadedFileVersion ) |
2020 | return false; | 2034 | return false; |
2021 | return true; | 2035 | return true; |
2022 | 2036 | ||
2023 | } | 2037 | } |
2024 | void CalendarView::watchSavedFile() | 2038 | void CalendarView::watchSavedFile() |
2025 | { | 2039 | { |
2026 | QFileInfo finf ( MainWindow::defaultFileName()); | 2040 | QFileInfo finf ( MainWindow::defaultFileName()); |
2027 | if ( !finf.exists() ) | 2041 | if ( !finf.exists() ) |
2028 | return; | 2042 | return; |
2029 | QDateTime dt = finf.lastModified (); | 2043 | QDateTime dt = finf.lastModified (); |
2030 | if ( dt < loadedFileVersion ) { | 2044 | if ( dt < loadedFileVersion ) { |
2031 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | 2045 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); |
2032 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 2046 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
2033 | return; | 2047 | return; |
2034 | } | 2048 | } |
2035 | loadedFileVersion = dt; | 2049 | loadedFileVersion = dt; |
2036 | } | 2050 | } |
2037 | bool CalendarView::checkAllFileVersions() | 2051 | bool CalendarView::checkAllFileVersions() |
2038 | { | 2052 | { |
2039 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 2053 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
2040 | KopiCalendarFile * cal = calendars.first(); | 2054 | KopiCalendarFile * cal = calendars.first(); |
2041 | mCalendar->setDefaultCalendar( 1 ); | 2055 | mCalendar->setDefaultCalendar( 1 ); |
2042 | mCalendar->setDefaultCalendarEnabledOnly(); | 2056 | mCalendar->setDefaultCalendarEnabledOnly(); |
2043 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { | 2057 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { |
2044 | if ( !checkFileVersion(MainWindow::defaultFileName())) { | 2058 | if ( !checkFileVersion(MainWindow::defaultFileName())) { |
2045 | restoreCalendarSettings(); | 2059 | restoreCalendarSettings(); |
2046 | return false; | 2060 | return false; |
2047 | } | 2061 | } |
2048 | } | 2062 | } |
2049 | cal = calendars.next(); | 2063 | cal = calendars.next(); |
2050 | QDateTime storeTemp = loadedFileVersion; | 2064 | QDateTime storeTemp = loadedFileVersion; |
2051 | while ( cal ) { | 2065 | while ( cal ) { |
2052 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { | 2066 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { |
2053 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 2067 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
2054 | mCalendar->setDefaultCalendarEnabledOnly(); | 2068 | mCalendar->setDefaultCalendarEnabledOnly(); |
2055 | loadedFileVersion = cal->mLoadDt.addSecs( 15 ); | 2069 | loadedFileVersion = cal->mLoadDt.addSecs( 15 ); |
2056 | if ( !checkFileVersion(cal->mFileName )) { | 2070 | if ( !checkFileVersion(cal->mFileName )) { |
2057 | loadedFileVersion = storeTemp; | 2071 | loadedFileVersion = storeTemp; |
2058 | restoreCalendarSettings(); | 2072 | restoreCalendarSettings(); |
2059 | return false; | 2073 | return false; |
2060 | } | 2074 | } |
2061 | } | 2075 | } |
2062 | cal = calendars.next(); | 2076 | cal = calendars.next(); |
2063 | } | 2077 | } |
2064 | loadedFileVersion = storeTemp; | 2078 | loadedFileVersion = storeTemp; |
2065 | return true; | 2079 | return true; |
2066 | } | 2080 | } |
2067 | bool CalendarView::checkFileVersion(QString fn) | 2081 | bool CalendarView::checkFileVersion(QString fn) |
2068 | { | 2082 | { |
2069 | QFileInfo finf ( fn ); | 2083 | QFileInfo finf ( fn ); |
2070 | if ( !finf.exists() ) | 2084 | if ( !finf.exists() ) |
2071 | return true; | 2085 | return true; |
2072 | QDateTime dt = finf.lastModified (); | 2086 | QDateTime dt = finf.lastModified (); |
2073 | qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1()); | 2087 | qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1()); |
2074 | qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1()); | 2088 | qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1()); |
2075 | if ( dt <= loadedFileVersion ) | 2089 | if ( dt <= loadedFileVersion ) |
2076 | return true; | 2090 | return true; |
2077 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\n on disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(fn).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , | 2091 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\n on disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(fn).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , |
2078 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 2092 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
2079 | i18n("Sync+save")); | 2093 | i18n("Sync+save")); |
2080 | 2094 | ||
2081 | if ( km == KMessageBox::Cancel ) | 2095 | if ( km == KMessageBox::Cancel ) |
2082 | return false; | 2096 | return false; |
2083 | if ( km == KMessageBox::Yes ) | 2097 | if ( km == KMessageBox::Yes ) |
2084 | return true; | 2098 | return true; |
2085 | 2099 | ||
2086 | setSyncDevice("deleteaftersync" ); | 2100 | setSyncDevice("deleteaftersync" ); |
2087 | mSyncManager->mAskForPreferences = true; | 2101 | mSyncManager->mAskForPreferences = true; |
2088 | mSyncManager->mSyncAlgoPrefs = 3; | 2102 | mSyncManager->mSyncAlgoPrefs = 3; |
2089 | mSyncManager->mWriteBackFile = false; | 2103 | mSyncManager->mWriteBackFile = false; |
2090 | mSyncManager->mWriteBackExistingOnly = false; | 2104 | mSyncManager->mWriteBackExistingOnly = false; |
2091 | mSyncManager->mShowSyncSummary = false; | 2105 | mSyncManager->mShowSyncSummary = false; |
2092 | syncCalendar( fn, 3 ); | 2106 | syncCalendar( fn, 3 ); |
2093 | Event * e = getLastSyncEvent(); | 2107 | Event * e = getLastSyncEvent(); |
2094 | if ( e ) | 2108 | if ( e ) |
2095 | mCalendar->deleteEvent( e ); | 2109 | mCalendar->deleteEvent( e ); |
2096 | return true; | 2110 | return true; |
2097 | } | 2111 | } |
2098 | bool CalendarView::saveCalendars() | 2112 | bool CalendarView::saveCalendars() |
2099 | { | 2113 | { |
2100 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 2114 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
2101 | KopiCalendarFile * cal = calendars.first(); | 2115 | KopiCalendarFile * cal = calendars.first(); |
2102 | mCalendar->setDefaultCalendar( 1 ); | 2116 | mCalendar->setDefaultCalendar( 1 ); |
2103 | mCalendar->setDefaultCalendarEnabledOnly(); | 2117 | mCalendar->setDefaultCalendarEnabledOnly(); |
2104 | saveCalendar( MainWindow::defaultFileName() ); | 2118 | saveCalendar( MainWindow::defaultFileName() ); |
2105 | cal = calendars.next(); | 2119 | cal = calendars.next(); |
2106 | while ( cal ) { | 2120 | while ( cal ) { |
2107 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { | 2121 | if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { |
2108 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 2122 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
2109 | mCalendar->setDefaultCalendarEnabledOnly(); | 2123 | mCalendar->setDefaultCalendarEnabledOnly(); |
2110 | if ( saveCalendar( cal->mFileName ) ) | 2124 | if ( saveCalendar( cal->mFileName ) ) |
2111 | cal->mLoadDt = QDateTime::currentDateTime(); | 2125 | cal->mLoadDt = QDateTime::currentDateTime(); |
2112 | } | 2126 | } |
2113 | cal = calendars.next(); | 2127 | cal = calendars.next(); |
2114 | } | 2128 | } |
2115 | restoreCalendarSettings(); | 2129 | restoreCalendarSettings(); |
2116 | return true; | 2130 | return true; |
2117 | } | 2131 | } |
2118 | bool CalendarView::saveCalendar( QString filename ) | 2132 | bool CalendarView::saveCalendar( QString filename ) |
2119 | { | 2133 | { |
2120 | 2134 | ||
2121 | // Store back all unsaved data into calendar object | 2135 | // Store back all unsaved data into calendar object |
2122 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 2136 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
2123 | if ( mViewManager->currentView() ) | 2137 | if ( mViewManager->currentView() ) |
2124 | mViewManager->currentView()->flushView(); | 2138 | mViewManager->currentView()->flushView(); |
2125 | 2139 | ||
2126 | 2140 | ||
2127 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 2141 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
2128 | mStorage->setSaveFormat( new ICalFormat() ); | 2142 | mStorage->setSaveFormat( new ICalFormat() ); |
2129 | mStorage->setFileName( filename ); | 2143 | mStorage->setFileName( filename ); |
2130 | bool success; | 2144 | bool success; |
2131 | success = mStorage->save(); | 2145 | success = mStorage->save(); |
2132 | if ( !success ) { | 2146 | if ( !success ) { |
2133 | return false; | 2147 | return false; |
2134 | } | 2148 | } |
2135 | if ( filename == MainWindow::defaultFileName() ) { | 2149 | if ( filename == MainWindow::defaultFileName() ) { |
2136 | setLoadedFileVersion( lfv ); | 2150 | setLoadedFileVersion( lfv ); |
2137 | watchSavedFile(); | 2151 | watchSavedFile(); |
2138 | } | 2152 | } |
2139 | return true; | 2153 | return true; |
2140 | } | 2154 | } |
2141 | 2155 | ||
2142 | void CalendarView::closeCalendar() | 2156 | void CalendarView::closeCalendar() |
2143 | { | 2157 | { |
2144 | 2158 | ||
2145 | // child windows no longer valid | 2159 | // child windows no longer valid |
2146 | clearAllViews(); | 2160 | clearAllViews(); |
2147 | emit closingDown(); | 2161 | emit closingDown(); |
2148 | 2162 | ||
2149 | mCalendar->close(); | 2163 | mCalendar->close(); |
2150 | setModified(false); | 2164 | setModified(false); |
2151 | updateView(); | 2165 | updateView(); |
2152 | } | 2166 | } |
2153 | 2167 | ||
2154 | void CalendarView::archiveCalendar() | 2168 | void CalendarView::archiveCalendar() |
2155 | { | 2169 | { |
2156 | mDialogManager->showArchiveDialog(); | 2170 | mDialogManager->showArchiveDialog(); |
2157 | } | 2171 | } |
2158 | 2172 | ||
2159 | 2173 | ||
2160 | void CalendarView::readSettings() | 2174 | void CalendarView::readSettings() |
2161 | { | 2175 | { |
2162 | 2176 | ||
2163 | 2177 | ||
2164 | // mViewManager->showAgendaView(); | 2178 | // mViewManager->showAgendaView(); |
2165 | QString str; | 2179 | QString str; |
2166 | //qDebug("CalendarView::readSettings() "); | 2180 | //qDebug("CalendarView::readSettings() "); |
2167 | // read settings from the KConfig, supplying reasonable | 2181 | // read settings from the KConfig, supplying reasonable |
2168 | // defaults where none are to be found | 2182 | // defaults where none are to be found |
2169 | KConfig *config = KOGlobals::config(); | 2183 | KConfig *config = KOGlobals::config(); |
2170 | #ifndef KORG_NOSPLITTER | 2184 | #ifndef KORG_NOSPLITTER |
2171 | config->setGroup("KOrganizer Geometry"); | 2185 | config->setGroup("KOrganizer Geometry"); |
2172 | 2186 | ||
2173 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 2187 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
2174 | if (sizes.count() != 2) { | 2188 | if (sizes.count() != 2) { |
2175 | sizes << mDateNavigator->minimumSizeHint().width(); | 2189 | sizes << mDateNavigator->minimumSizeHint().width(); |
2176 | sizes << 300; | 2190 | sizes << 300; |
2177 | } | 2191 | } |
2178 | mPanner->setSizes(sizes); | 2192 | mPanner->setSizes(sizes); |
2179 | 2193 | ||
2180 | sizes = config->readIntListEntry("Separator2"); | 2194 | sizes = config->readIntListEntry("Separator2"); |
2181 | if ( ( mResourceView && sizes.count() == 4 ) || | 2195 | if ( ( mResourceView && sizes.count() == 4 ) || |
2182 | ( !mResourceView && sizes.count() == 3 ) ) { | 2196 | ( !mResourceView && sizes.count() == 3 ) ) { |
2183 | mLeftSplitter->setSizes(sizes); | 2197 | mLeftSplitter->setSizes(sizes); |
2184 | } | 2198 | } |
2185 | #endif | 2199 | #endif |
2186 | globalFlagBlockAgenda = 1; | 2200 | globalFlagBlockAgenda = 1; |
2187 | mViewManager->showAgendaView(); | 2201 | mViewManager->showAgendaView(); |
2188 | //mViewManager->readSettings( config ); | 2202 | //mViewManager->readSettings( config ); |
2189 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 2203 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
2190 | readFilterSettings(config); | 2204 | readFilterSettings(config); |
2191 | 2205 | ||
2192 | #ifdef DESKTOP_VERSION | 2206 | #ifdef DESKTOP_VERSION |
2193 | config->setGroup("WidgetLayout"); | 2207 | config->setGroup("WidgetLayout"); |
2194 | QStringList list; | 2208 | QStringList list; |
2195 | list = config->readListEntry("MainLayout"); | 2209 | list = config->readListEntry("MainLayout"); |
2196 | int x,y,w,h; | 2210 | int x,y,w,h; |
2197 | if ( ! list.isEmpty() ) { | 2211 | if ( ! list.isEmpty() ) { |
2198 | x = list[0].toInt(); | 2212 | x = list[0].toInt(); |
2199 | y = list[1].toInt(); | 2213 | y = list[1].toInt(); |
2200 | w = list[2].toInt(); | 2214 | w = list[2].toInt(); |
2201 | h = list[3].toInt(); | 2215 | h = list[3].toInt(); |
2202 | KApplication::testCoords( &x,&y,&w,&h ); | 2216 | KApplication::testCoords( &x,&y,&w,&h ); |
2203 | topLevelWidget()->setGeometry(x,y,w,h); | 2217 | topLevelWidget()->setGeometry(x,y,w,h); |
2204 | 2218 | ||
2205 | } else { | 2219 | } else { |
2206 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 2220 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
2207 | } | 2221 | } |
2208 | list = config->readListEntry("EditEventLayout"); | 2222 | list = config->readListEntry("EditEventLayout"); |
2209 | if ( ! list.isEmpty() ) { | 2223 | if ( ! list.isEmpty() ) { |
2210 | x = list[0].toInt(); | 2224 | x = list[0].toInt(); |
2211 | y = list[1].toInt(); | 2225 | y = list[1].toInt(); |
2212 | w = list[2].toInt(); | 2226 | w = list[2].toInt(); |
2213 | h = list[3].toInt(); | 2227 | h = list[3].toInt(); |
2214 | KApplication::testCoords( &x,&y,&w,&h ); | 2228 | KApplication::testCoords( &x,&y,&w,&h ); |
2215 | mEventEditor->setGeometry(x,y,w,h); | 2229 | mEventEditor->setGeometry(x,y,w,h); |
2216 | 2230 | ||
2217 | } | 2231 | } |
2218 | list = config->readListEntry("EditTodoLayout"); | 2232 | list = config->readListEntry("EditTodoLayout"); |
2219 | if ( ! list.isEmpty() ) { | 2233 | if ( ! list.isEmpty() ) { |
2220 | x = list[0].toInt(); | 2234 | x = list[0].toInt(); |
2221 | y = list[1].toInt(); | 2235 | y = list[1].toInt(); |
2222 | w = list[2].toInt(); | 2236 | w = list[2].toInt(); |
2223 | h = list[3].toInt(); | 2237 | h = list[3].toInt(); |
2224 | KApplication::testCoords( &x,&y,&w,&h ); | 2238 | KApplication::testCoords( &x,&y,&w,&h ); |
2225 | mTodoEditor->setGeometry(x,y,w,h); | 2239 | mTodoEditor->setGeometry(x,y,w,h); |
2226 | 2240 | ||
2227 | } | 2241 | } |
2228 | list = config->readListEntry("ViewerLayout"); | 2242 | list = config->readListEntry("ViewerLayout"); |
2229 | if ( ! list.isEmpty() ) { | 2243 | if ( ! list.isEmpty() ) { |
2230 | x = list[0].toInt(); | 2244 | x = list[0].toInt(); |
2231 | y = list[1].toInt(); | 2245 | y = list[1].toInt(); |
2232 | w = list[2].toInt(); | 2246 | w = list[2].toInt(); |
2233 | h = list[3].toInt(); | 2247 | h = list[3].toInt(); |
2234 | KApplication::testCoords( &x,&y,&w,&h ); | 2248 | KApplication::testCoords( &x,&y,&w,&h ); |
2235 | getEventViewerDialog()->setGeometry(x,y,w,h); | 2249 | getEventViewerDialog()->setGeometry(x,y,w,h); |
2236 | } | 2250 | } |
2237 | #endif | 2251 | #endif |
2238 | config->setGroup( "Views" ); | 2252 | config->setGroup( "Views" ); |
2239 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 2253 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
2240 | 2254 | ||
2241 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 2255 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
2242 | 2256 | ||
2243 | int resetval = 0; | 2257 | int resetval = 0; |
2244 | int maxVal = 0; | 2258 | int maxVal = 0; |
2245 | if (sizes.count() != 3) { | 2259 | if (sizes.count() != 3) { |
2246 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2260 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2247 | resetval = mDateNavigator->sizeHint().width()+2; | 2261 | resetval = mDateNavigator->sizeHint().width()+2; |
2248 | } else { | 2262 | } else { |
2249 | resetval = mDateNavigator->sizeHint().height()+2; | 2263 | resetval = mDateNavigator->sizeHint().height()+2; |
2250 | } | 2264 | } |
2251 | } | 2265 | } |
2252 | if ( resetval ) { | 2266 | if ( resetval ) { |
2253 | sizes.clear(); | 2267 | sizes.clear(); |
2254 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2268 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2255 | maxVal = QApplication::desktop()->width() -10; | 2269 | maxVal = QApplication::desktop()->width() -10; |
2256 | } else { | 2270 | } else { |
2257 | maxVal = QApplication::desktop()->height()-10; | 2271 | maxVal = QApplication::desktop()->height()-10; |
2258 | } | 2272 | } |
2259 | sizes << resetval; | 2273 | sizes << resetval; |
2260 | if ( maxVal < resetval + resetval) | 2274 | if ( maxVal < resetval + resetval) |
2261 | resetval = maxVal - resetval; | 2275 | resetval = maxVal - resetval; |
2262 | sizes << resetval; | 2276 | sizes << resetval; |
2263 | sizes << 100; | 2277 | sizes << 100; |
2264 | } | 2278 | } |
2265 | mLeftFrame->setSizes(sizes); | 2279 | mLeftFrame->setSizes(sizes); |
2266 | sizes = config->readIntListEntry("Main Splitter Frame"); | 2280 | sizes = config->readIntListEntry("Main Splitter Frame"); |
2267 | resetval = 0; | 2281 | resetval = 0; |
2268 | maxVal = 0; | 2282 | maxVal = 0; |
2269 | if (sizes.count() != 2) { | 2283 | if (sizes.count() != 2) { |
2270 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2284 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2271 | resetval = mDateNavigator->sizeHint().width()+2; | 2285 | resetval = mDateNavigator->sizeHint().width()+2; |
2272 | } else { | 2286 | } else { |
2273 | resetval = mDateNavigator->sizeHint().height()+2; | 2287 | resetval = mDateNavigator->sizeHint().height()+2; |
2274 | } | 2288 | } |
2275 | } | 2289 | } |
2276 | if ( resetval ) { | 2290 | if ( resetval ) { |
2277 | sizes.clear(); | 2291 | sizes.clear(); |
2278 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2292 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2279 | maxVal = QApplication::desktop()->width() -10; | 2293 | maxVal = QApplication::desktop()->width() -10; |
2280 | } else { | 2294 | } else { |
2281 | maxVal = QApplication::desktop()->height()-10; | 2295 | maxVal = QApplication::desktop()->height()-10; |
2282 | } | 2296 | } |
2283 | sizes << resetval; | 2297 | sizes << resetval; |
2284 | if ( maxVal < resetval + resetval) | 2298 | if ( maxVal < resetval + resetval) |
2285 | resetval = maxVal - resetval; | 2299 | resetval = maxVal - resetval; |
2286 | sizes << resetval; | 2300 | sizes << resetval; |
2287 | } | 2301 | } |
2288 | mMainFrame->setSizes(sizes); | 2302 | mMainFrame->setSizes(sizes); |
2289 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 2303 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
2290 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 2304 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
2291 | else mNavigator->selectDates( dateCount ); | 2305 | else mNavigator->selectDates( dateCount ); |
2292 | // mViewManager->readSettings( config ); | 2306 | // mViewManager->readSettings( config ); |
2293 | updateConfig(); | 2307 | updateConfig(); |
2294 | globalFlagBlockAgenda = 2; | 2308 | globalFlagBlockAgenda = 2; |
2295 | mViewManager->readSettings( config ); | 2309 | mViewManager->readSettings( config ); |
2296 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 2310 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
2297 | } | 2311 | } |
2298 | 2312 | ||
2299 | 2313 | ||
2300 | void CalendarView::writeSettings() | 2314 | void CalendarView::writeSettings() |
2301 | { | 2315 | { |
2302 | // kdDebug() << "CalendarView::writeSettings" << endl; | 2316 | // kdDebug() << "CalendarView::writeSettings" << endl; |
2303 | 2317 | ||
2304 | KConfig *config = KOGlobals::config(); | 2318 | KConfig *config = KOGlobals::config(); |
2305 | 2319 | ||
2306 | mViewManager->writeSettings( config ); | 2320 | mViewManager->writeSettings( config ); |
2307 | mTodoList->saveLayout(config,QString("Todo Layout")); | 2321 | mTodoList->saveLayout(config,QString("Todo Layout")); |
2308 | mDialogManager->writeSettings( config ); | 2322 | mDialogManager->writeSettings( config ); |
2309 | //KOPrefs::instance()->usrWriteConfig(); | 2323 | //KOPrefs::instance()->usrWriteConfig(); |
2310 | KOPrefs::instance()->writeConfig(); | 2324 | KOPrefs::instance()->writeConfig(); |
2311 | 2325 | ||
2312 | writeFilterSettings(config); | 2326 | writeFilterSettings(config); |
2313 | config->setGroup( "AppRun" ); | 2327 | config->setGroup( "AppRun" ); |
2314 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 2328 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
2315 | int days = dt.daysTo( QDate::currentDate() ); | 2329 | int days = dt.daysTo( QDate::currentDate() ); |
2316 | dt = dt.addDays( days ); | 2330 | dt = dt.addDays( days ); |
2317 | int secs = dt.secsTo( QDateTime::currentDateTime() ); | 2331 | int secs = dt.secsTo( QDateTime::currentDateTime() ); |
2318 | config->writeEntry( "LatestProgramStopDays", days ); | 2332 | config->writeEntry( "LatestProgramStopDays", days ); |
2319 | config->writeEntry( "LatestProgramStopSecs", secs ); | 2333 | config->writeEntry( "LatestProgramStopSecs", secs ); |
2320 | //qDebug("KO: Writing stop time: %d ", secs); | 2334 | //qDebug("KO: Writing stop time: %d ", secs); |
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp index 7354940..479bd8b 100644 --- a/korganizer/koeditordetails.cpp +++ b/korganizer/koeditordetails.cpp | |||
@@ -1,467 +1,469 @@ | |||
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 thse hope that it will be useful, | 10 | This program is distributed in thse hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qfiledialog.h> | 25 | #include <qfiledialog.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qbuttongroup.h> | 28 | #include <qbuttongroup.h> |
29 | #include <qvgroupbox.h> | 29 | #include <qvgroupbox.h> |
30 | #include <qwidgetstack.h> | 30 | #include <qwidgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qapp.h> | 32 | #include <qapp.h> |
33 | 33 | ||
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kglobal.h> | 35 | #include <kglobal.h> |
36 | #include <kdialog.h> | ||
36 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
37 | #include <kstandarddirs.h> | 38 | #include <kstandarddirs.h> |
38 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
39 | #ifndef KORG_NOKABC | 40 | #ifndef KORG_NOKABC |
40 | 41 | ||
41 | #ifdef DESKTOP_VERSION | 42 | #ifdef DESKTOP_VERSION |
42 | #include <kabc/addresseedialog.h> | 43 | #include <kabc/addresseedialog.h> |
43 | #else //DESKTOP_VERSION | 44 | #else //DESKTOP_VERSION |
44 | #include <externalapphandler.h> | 45 | #include <externalapphandler.h> |
45 | #endif //DESKTOP_VERSION | 46 | #endif //DESKTOP_VERSION |
46 | 47 | ||
47 | #endif | 48 | #endif |
48 | 49 | ||
49 | #include <libkcal/incidence.h> | 50 | #include <libkcal/incidence.h> |
50 | 51 | ||
51 | #include "koprefs.h" | 52 | #include "koprefs.h" |
52 | 53 | ||
53 | #include "koeditordetails.h" | 54 | #include "koeditordetails.h" |
54 | 55 | ||
55 | template <> | 56 | template <> |
56 | CustomListViewItem<class Attendee *>::~CustomListViewItem() | 57 | CustomListViewItem<class Attendee *>::~CustomListViewItem() |
57 | { | 58 | { |
58 | delete mData; | 59 | delete mData; |
59 | } | 60 | } |
60 | 61 | ||
61 | template <> | 62 | template <> |
62 | void CustomListViewItem<class Attendee *>::updateItem() | 63 | void CustomListViewItem<class Attendee *>::updateItem() |
63 | { | 64 | { |
64 | setText(0,mData->name()); | 65 | setText(0,mData->name()); |
65 | setText(1,mData->email()); | 66 | setText(1,mData->email()); |
66 | setText(2,mData->roleStr()); | 67 | setText(2,mData->roleStr()); |
67 | setText(3,mData->statusStr()); | 68 | setText(3,mData->statusStr()); |
68 | if (mData->RSVP() && !mData->email().isEmpty()) { | 69 | if (mData->RSVP() && !mData->email().isEmpty()) { |
69 | setPixmap(4,SmallIcon("mailappt")); | 70 | setPixmap(4,SmallIcon("mailappt")); |
70 | setSortKey(4,"j"); | 71 | setSortKey(4,"j"); |
71 | } | 72 | } |
72 | else { | 73 | else { |
73 | setPixmap(4,SmallIcon("nomailappt")); | 74 | setPixmap(4,SmallIcon("nomailappt")); |
74 | setSortKey(4,"n"); | 75 | setSortKey(4,"n"); |
75 | } | 76 | } |
76 | } | 77 | } |
77 | 78 | ||
78 | 79 | ||
79 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) | 80 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) |
80 | : QWidget( parent, name), mDisableItemUpdate( false ) | 81 | : QWidget( parent, name), mDisableItemUpdate( false ) |
81 | { | 82 | { |
82 | QGridLayout *topLayout = new QGridLayout(this); | 83 | QGridLayout *topLayout = new QGridLayout(this); |
83 | topLayout->setSpacing(spacing); | 84 | topLayout->setSpacing(spacing); |
85 | topLayout->setMargin(KDialog::marginHint()-2); | ||
84 | 86 | ||
85 | QString organizer = KOPrefs::instance()->email(); | 87 | QString organizer = KOPrefs::instance()->email(); |
86 | mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); | 88 | mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); |
87 | 89 | ||
88 | mListView = new KListView(this,"mListView"); | 90 | mListView = new KListView(this,"mListView"); |
89 | mListView->addColumn(i18n("Name"),180); | 91 | mListView->addColumn(i18n("Name"),180); |
90 | mListView->addColumn(i18n("Email"),180); | 92 | mListView->addColumn(i18n("Email"),180); |
91 | mListView->addColumn(i18n("Role"),60); | 93 | mListView->addColumn(i18n("Role"),60); |
92 | mListView->addColumn(i18n("Status"),100); | 94 | mListView->addColumn(i18n("Status"),100); |
93 | mListView->addColumn(i18n("RSVP"),35); | 95 | mListView->addColumn(i18n("RSVP"),35); |
94 | if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) { | 96 | if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) { |
95 | int hei = 80; | 97 | int hei = 80; |
96 | if ( QApplication::desktop()->height() <= 240 ) | 98 | if ( QApplication::desktop()->height() <= 240 ) |
97 | hei = 60; | 99 | hei = 60; |
98 | mListView->setFixedHeight(hei); | 100 | mListView->setFixedHeight(hei); |
99 | } | 101 | } |
100 | mListView->setAllColumnsShowFocus (true ); | 102 | mListView->setAllColumnsShowFocus (true ); |
101 | //mListView->setSingleClick( true ); | 103 | //mListView->setSingleClick( true ); |
102 | connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), | 104 | connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), |
103 | SLOT(updateAttendeeInput())); | 105 | SLOT(updateAttendeeInput())); |
104 | 106 | ||
105 | connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), | 107 | connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), |
106 | SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); | 108 | SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); |
107 | 109 | ||
108 | mRsvpButton = new QCheckBox(this); | 110 | mRsvpButton = new QCheckBox(this); |
109 | mRsvpButton->setText(i18n("Request response")); | 111 | mRsvpButton->setText(i18n("Request response")); |
110 | mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); | 112 | mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); |
111 | QLabel *attendeeLabel = new QLabel(this); | 113 | QLabel *attendeeLabel = new QLabel(this); |
112 | attendeeLabel->setText(i18n("Name:")); | 114 | attendeeLabel->setText(i18n("Name:")); |
113 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); | 115 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); |
114 | mNameEdit = new QLineEdit(this); | 116 | mNameEdit = new QLineEdit(this); |
115 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), | 117 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), |
116 | SLOT(updateAttendeeItem())); | 118 | SLOT(updateAttendeeItem())); |
117 | 119 | ||
118 | mUidEdit = new QLineEdit(0); | 120 | mUidEdit = new QLineEdit(0); |
119 | mUidEdit->setText(""); | 121 | mUidEdit->setText(""); |
120 | 122 | ||
121 | QLabel *emailLabel = new QLabel(this); | 123 | QLabel *emailLabel = new QLabel(this); |
122 | emailLabel->setText(i18n("Email:")); | 124 | emailLabel->setText(i18n("Email:")); |
123 | mEmailEdit = new QLineEdit(this); | 125 | mEmailEdit = new QLineEdit(this); |
124 | connect(mEmailEdit,SIGNAL(textChanged(const QString &)), | 126 | connect(mEmailEdit,SIGNAL(textChanged(const QString &)), |
125 | SLOT(updateAttendeeItem())); | 127 | SLOT(updateAttendeeItem())); |
126 | 128 | ||
127 | QLabel *attendeeRoleLabel = new QLabel(this); | 129 | QLabel *attendeeRoleLabel = new QLabel(this); |
128 | attendeeRoleLabel->setText(i18n("Role:")); | 130 | attendeeRoleLabel->setText(i18n("Role:")); |
129 | mRoleCombo = new QComboBox(false,this); | 131 | mRoleCombo = new QComboBox(false,this); |
130 | mRoleCombo->insertStringList(Attendee::roleList()); | 132 | mRoleCombo->insertStringList(Attendee::roleList()); |
131 | connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); | 133 | connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); |
132 | 134 | ||
133 | QLabel *statusLabel = new QLabel(this); | 135 | QLabel *statusLabel = new QLabel(this); |
134 | statusLabel->setText( i18n("Status:") ); | 136 | statusLabel->setText( i18n("Status:") ); |
135 | 137 | ||
136 | mStatusCombo = new QComboBox(false,this); | 138 | mStatusCombo = new QComboBox(false,this); |
137 | mStatusCombo->insertStringList(Attendee::statusList()); | 139 | mStatusCombo->insertStringList(Attendee::statusList()); |
138 | connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); | 140 | connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); |
139 | 141 | ||
140 | 142 | ||
141 | connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); | 143 | connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); |
142 | QWidget *buttonBox = new QWidget(this); | 144 | QWidget *buttonBox = new QWidget(this); |
143 | QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); | 145 | QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); |
144 | 146 | ||
145 | QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); | 147 | QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); |
146 | buttonLayout->addWidget(newButton); | 148 | buttonLayout->addWidget(newButton); |
147 | connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); | 149 | connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); |
148 | 150 | ||
149 | mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); | 151 | mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); |
150 | buttonLayout->addWidget(mRemoveButton); | 152 | buttonLayout->addWidget(mRemoveButton); |
151 | connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); | 153 | connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); |
152 | 154 | ||
153 | // buttonLayout->addWidget(mAddressBookButton); | 155 | // buttonLayout->addWidget(mAddressBookButton); |
154 | connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); | 156 | connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); |
155 | //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); | 157 | //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); |
156 | if ( QApplication::desktop()->height() <= 240 ) { | 158 | if ( QApplication::desktop()->height() <= 240 ) { |
157 | mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); | 159 | mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); |
158 | mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); | 160 | mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); |
159 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); | 161 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); |
160 | topLayout->addMultiCellWidget(mListView,1,1,0,5); | 162 | topLayout->addMultiCellWidget(mListView,1,1,0,5); |
161 | topLayout->addWidget(attendeeLabel,3,0); | 163 | topLayout->addWidget(attendeeLabel,3,0); |
162 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); | 164 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); |
163 | topLayout->addWidget(emailLabel,4,0); | 165 | topLayout->addWidget(emailLabel,4,0); |
164 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); | 166 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); |
165 | topLayout->addWidget(attendeeRoleLabel,5,0); | 167 | topLayout->addWidget(attendeeRoleLabel,5,0); |
166 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); | 168 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); |
167 | topLayout->addWidget(statusLabel,5,3); | 169 | topLayout->addWidget(statusLabel,5,3); |
168 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); | 170 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); |
169 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,5); | 171 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,5); |
170 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | 172 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); |
171 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); | 173 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); |
172 | topLayout->setRowStretch(1,5); | 174 | topLayout->setRowStretch(1,5); |
173 | topLayout->setColStretch(0,0); | 175 | topLayout->setColStretch(0,0); |
174 | } else { | 176 | } else { |
175 | if (qApp->desktop()->width() < 640 ) { | 177 | if (qApp->desktop()->width() < 640 ) { |
176 | if ( qApp->desktop()->width() < 300 ) | 178 | if ( qApp->desktop()->width() < 300 ) |
177 | topLayout->setSpacing(1); | 179 | topLayout->setSpacing(1); |
178 | ;//mListView->setFixedHeight(80); | 180 | ;//mListView->setFixedHeight(80); |
179 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); | 181 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); |
180 | topLayout->addMultiCellWidget(mListView,1,1,0,3); | 182 | topLayout->addMultiCellWidget(mListView,1,1,0,3); |
181 | topLayout->addWidget(attendeeLabel,3,0); | 183 | topLayout->addWidget(attendeeLabel,3,0); |
182 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); | 184 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); |
183 | topLayout->addWidget(emailLabel,4,0); | 185 | topLayout->addWidget(emailLabel,4,0); |
184 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); | 186 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); |
185 | topLayout->addWidget(attendeeRoleLabel,5,0); | 187 | topLayout->addWidget(attendeeRoleLabel,5,0); |
186 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,3); | 188 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,3); |
187 | topLayout->addWidget(statusLabel,6,0); | 189 | topLayout->addWidget(statusLabel,6,0); |
188 | topLayout->addMultiCellWidget(mStatusCombo,6,6,1,3); | 190 | topLayout->addMultiCellWidget(mStatusCombo,6,6,1,3); |
189 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); | 191 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); |
190 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | 192 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); |
191 | topLayout->addMultiCellWidget(buttonBox,3,4,3,3); | 193 | topLayout->addMultiCellWidget(buttonBox,3,4,3,3); |
192 | topLayout->setRowStretch(1,2); | 194 | topLayout->setRowStretch(1,2); |
193 | topLayout->setColStretch(0,0); | 195 | topLayout->setColStretch(0,0); |
194 | topLayout->setColStretch(1,2); | 196 | topLayout->setColStretch(1,2); |
195 | topLayout->setColStretch(2,1); | 197 | topLayout->setColStretch(2,1); |
196 | topLayout->setColStretch(3,1); | 198 | topLayout->setColStretch(3,1); |
197 | } else { | 199 | } else { |
198 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); | 200 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); |
199 | topLayout->addMultiCellWidget(mListView,1,1,0,5); | 201 | topLayout->addMultiCellWidget(mListView,1,1,0,5); |
200 | topLayout->addWidget(attendeeLabel,3,0); | 202 | topLayout->addWidget(attendeeLabel,3,0); |
201 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); | 203 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); |
202 | topLayout->addWidget(emailLabel,4,0); | 204 | topLayout->addWidget(emailLabel,4,0); |
203 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); | 205 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); |
204 | topLayout->addWidget(attendeeRoleLabel,5,0); | 206 | topLayout->addWidget(attendeeRoleLabel,5,0); |
205 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); | 207 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); |
206 | topLayout->addWidget(statusLabel,5,3); | 208 | topLayout->addWidget(statusLabel,5,3); |
207 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); | 209 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); |
208 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); | 210 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); |
209 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | 211 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); |
210 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); | 212 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); |
211 | topLayout->setRowStretch(1,5); | 213 | topLayout->setRowStretch(1,5); |
212 | topLayout->setColStretch(0,0); | 214 | topLayout->setColStretch(0,0); |
213 | } | 215 | } |
214 | } | 216 | } |
215 | // #if 0 | 217 | // #if 0 |
216 | // topLayout->setColStretch(2,1); | 218 | // topLayout->setColStretch(2,1); |
217 | // topLayout->addWidget(statusLabel,3,3); | 219 | // topLayout->addWidget(statusLabel,3,3); |
218 | // topLayout->addWidget(mStatusCombo,3,4); | 220 | // topLayout->addWidget(mStatusCombo,3,4); |
219 | // #else | 221 | // #else |
220 | // topLayout->addWidget(statusLabel,4,3); | 222 | // topLayout->addWidget(statusLabel,4,3); |
221 | // // topLayout->addWidget(mStatusCombo,4,3); | 223 | // // topLayout->addWidget(mStatusCombo,4,3); |
222 | // topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); | 224 | // topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); |
223 | 225 | ||
224 | // #endif | 226 | // #endif |
225 | // // topLayout->setRowStretch(5,1); | 227 | // // topLayout->setRowStretch(5,1); |
226 | // topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); | 228 | // topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); |
227 | // topLayout->addMultiCellWidget(buttonBox,2,3,5,5); | 229 | // topLayout->addMultiCellWidget(buttonBox,2,3,5,5); |
228 | // topLayout->setRowStretch(1,5); | 230 | // topLayout->setRowStretch(1,5); |
229 | // topLayout->setColStretch(0,0); | 231 | // topLayout->setColStretch(0,0); |
230 | 232 | ||
231 | #ifdef KORG_NOKABC | 233 | #ifdef KORG_NOKABC |
232 | mAddressBookButton->hide(); | 234 | mAddressBookButton->hide(); |
233 | #endif | 235 | #endif |
234 | 236 | ||
235 | updateAttendeeInput(); | 237 | updateAttendeeInput(); |
236 | #ifndef DESKTOP_VERSION | 238 | #ifndef DESKTOP_VERSION |
237 | //US listen for arriving address resultsets | 239 | //US listen for arriving address resultsets |
238 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 240 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
239 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 241 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
240 | #endif | 242 | #endif |
241 | 243 | ||
242 | } | 244 | } |
243 | 245 | ||
244 | KOEditorDetails::~KOEditorDetails() | 246 | KOEditorDetails::~KOEditorDetails() |
245 | { | 247 | { |
246 | } | 248 | } |
247 | 249 | ||
248 | void KOEditorDetails::removeAttendee() | 250 | void KOEditorDetails::removeAttendee() |
249 | { | 251 | { |
250 | AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); | 252 | AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); |
251 | if (!aItem) return; | 253 | if (!aItem) return; |
252 | 254 | ||
253 | Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), | 255 | Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), |
254 | aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), | 256 | aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), |
255 | aItem->data()->uid()); | 257 | aItem->data()->uid()); |
256 | mdelAttendees.append(delA); | 258 | mdelAttendees.append(delA); |
257 | 259 | ||
258 | delete aItem; | 260 | delete aItem; |
259 | 261 | ||
260 | updateAttendeeInput(); | 262 | updateAttendeeInput(); |
261 | } | 263 | } |
262 | 264 | ||
263 | 265 | ||
264 | void KOEditorDetails::openAddressBook() | 266 | void KOEditorDetails::openAddressBook() |
265 | { | 267 | { |
266 | #ifndef KORG_NOKABC | 268 | #ifndef KORG_NOKABC |
267 | 269 | ||
268 | #ifdef DESKTOP_VERSION | 270 | #ifdef DESKTOP_VERSION |
269 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 271 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
270 | uint i=0; | 272 | uint i=0; |
271 | for (i=0; i < list.count(); i++) { | 273 | for (i=0; i < list.count(); i++) { |
272 | insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); | 274 | insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); |
273 | } | 275 | } |
274 | #else | 276 | #else |
275 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 277 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
276 | // the result should now arrive through method insertAttendees | 278 | // the result should now arrive through method insertAttendees |
277 | #endif | 279 | #endif |
278 | 280 | ||
279 | 281 | ||
280 | #if 0 | 282 | #if 0 |
281 | KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); | 283 | KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); |
282 | if (!a.isEmpty()) { | 284 | if (!a.isEmpty()) { |
283 | insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); | 285 | insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); |
284 | } | 286 | } |
285 | #endif | 287 | #endif |
286 | #endif | 288 | #endif |
287 | } | 289 | } |
288 | 290 | ||
289 | 291 | ||
290 | void KOEditorDetails::addNewAttendee() | 292 | void KOEditorDetails::addNewAttendee() |
291 | { | 293 | { |
292 | #if 0 | 294 | #if 0 |
293 | // this is cool. If they didn't enter an email address, | 295 | // this is cool. If they didn't enter an email address, |
294 | // try to look it up in the address book and fill it in for them. | 296 | // try to look it up in the address book and fill it in for them. |
295 | if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) { | 297 | if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) { |
296 | KabAPI addrBook; | 298 | KabAPI addrBook; |
297 | QString name; | 299 | QString name; |
298 | std::list<AddressBook::Entry> entries; | 300 | std::list<AddressBook::Entry> entries; |
299 | name = mNameEdit->text(); | 301 | name = mNameEdit->text(); |
300 | if (addrBook.init() == AddressBook::NoError) { | 302 | if (addrBook.init() == AddressBook::NoError) { |
301 | if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) { | 303 | if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) { |
302 | kdDebug() << "positive match" << endl; | 304 | kdDebug() << "positive match" << endl; |
303 | // take first email address | 305 | // take first email address |
304 | if (!entries.front().emails.isEmpty() && | 306 | if (!entries.front().emails.isEmpty() && |
305 | entries.front().emails.first().length()>0) | 307 | entries.front().emails.first().length()>0) |
306 | mEmailEdit->setText(entries.front().emails.first()); | 308 | mEmailEdit->setText(entries.front().emails.first()); |
307 | } | 309 | } |
308 | } | 310 | } |
309 | } | 311 | } |
310 | #endif | 312 | #endif |
311 | 313 | ||
312 | Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); | 314 | Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); |
313 | insertAttendee(a); | 315 | insertAttendee(a); |
314 | } | 316 | } |
315 | 317 | ||
316 | //the map includes name/email pairs, that comes from Ka/Pi | 318 | //the map includes name/email pairs, that comes from Ka/Pi |
317 | void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | 319 | void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) |
318 | { | 320 | { |
319 | if (uid == this->name()) | 321 | if (uid == this->name()) |
320 | { | 322 | { |
321 | for ( int i = 0; i < nameList.count(); i++) | 323 | for ( int i = 0; i < nameList.count(); i++) |
322 | { | 324 | { |
323 | QString _name = nameList[i]; | 325 | QString _name = nameList[i]; |
324 | QString _email = emailList[i]; | 326 | QString _email = emailList[i]; |
325 | QString _uid = uidList[i]; | 327 | QString _uid = uidList[i]; |
326 | 328 | ||
327 | Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid); | 329 | Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid); |
328 | insertAttendee(a); | 330 | insertAttendee(a); |
329 | } | 331 | } |
330 | } | 332 | } |
331 | 333 | ||
332 | } | 334 | } |
333 | 335 | ||
334 | void KOEditorDetails::insertAttendee(Attendee *a) | 336 | void KOEditorDetails::insertAttendee(Attendee *a) |
335 | { | 337 | { |
336 | AttendeeListItem *first = (AttendeeListItem*) mListView->firstChild(); | 338 | AttendeeListItem *first = (AttendeeListItem*) mListView->firstChild(); |
337 | while (first) { | 339 | while (first) { |
338 | if ( first->data()->name() == a->name() && first->data()->email() == a->email() ) | 340 | if ( first->data()->name() == a->name() && first->data()->email() == a->email() ) |
339 | return; | 341 | return; |
340 | first = (AttendeeListItem*) first->nextSibling(); | 342 | first = (AttendeeListItem*) first->nextSibling(); |
341 | } | 343 | } |
342 | 344 | ||
343 | AttendeeListItem *item = new AttendeeListItem(a,mListView); | 345 | AttendeeListItem *item = new AttendeeListItem(a,mListView); |
344 | mListView->setSelected( item, true ); | 346 | mListView->setSelected( item, true ); |
345 | } | 347 | } |
346 | 348 | ||
347 | void KOEditorDetails::setDefaults() | 349 | void KOEditorDetails::setDefaults() |
348 | { | 350 | { |
349 | mRsvpButton->setChecked(true); | 351 | mRsvpButton->setChecked(true); |
350 | mListView->clear(); | 352 | mListView->clear(); |
351 | mdelAttendees.clear(); | 353 | mdelAttendees.clear(); |
352 | clearAttendeeInput(); | 354 | clearAttendeeInput(); |
353 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); | 355 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); |
354 | 356 | ||
355 | mNameEdit->setText(""); | 357 | mNameEdit->setText(""); |
356 | mUidEdit->setText(""); | 358 | mUidEdit->setText(""); |
357 | mEmailEdit->setText(""); | 359 | mEmailEdit->setText(""); |
358 | mRoleCombo->setCurrentItem( 0 ); | 360 | mRoleCombo->setCurrentItem( 0 ); |
359 | mStatusCombo->setCurrentItem( 0 ); | 361 | mStatusCombo->setCurrentItem( 0 ); |
360 | 362 | ||
361 | } | 363 | } |
362 | 364 | ||
363 | void KOEditorDetails::readEvent(Incidence *event) | 365 | void KOEditorDetails::readEvent(Incidence *event) |
364 | { | 366 | { |
365 | setDefaults(); | 367 | setDefaults(); |
366 | //mListView->clear(); | 368 | //mListView->clear(); |
367 | //mdelAttendees.clear(); | 369 | //mdelAttendees.clear(); |
368 | QPtrList<Attendee> tmpAList = event->attendees(); | 370 | QPtrList<Attendee> tmpAList = event->attendees(); |
369 | Attendee *a; | 371 | Attendee *a; |
370 | for (a = tmpAList.first(); a; a = tmpAList.next()) | 372 | for (a = tmpAList.first(); a; a = tmpAList.next()) |
371 | insertAttendee(new Attendee(*a)); | 373 | insertAttendee(new Attendee(*a)); |
372 | 374 | ||
373 | mListView->setSelected( mListView->firstChild(), true ); | 375 | mListView->setSelected( mListView->firstChild(), true ); |
374 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); | 376 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); |
375 | } | 377 | } |
376 | 378 | ||
377 | void KOEditorDetails::writeEvent(Incidence *event) | 379 | void KOEditorDetails::writeEvent(Incidence *event) |
378 | { | 380 | { |
379 | event->clearAttendees(); | 381 | event->clearAttendees(); |
380 | QListViewItem *item; | 382 | QListViewItem *item; |
381 | AttendeeListItem *a; | 383 | AttendeeListItem *a; |
382 | for (item = mListView->firstChild(); item; | 384 | for (item = mListView->firstChild(); item; |
383 | item = item->nextSibling()) { | 385 | item = item->nextSibling()) { |
384 | a = (AttendeeListItem *)item; | 386 | a = (AttendeeListItem *)item; |
385 | event->addAttendee(new Attendee(*(a->data()))); | 387 | event->addAttendee(new Attendee(*(a->data()))); |
386 | } | 388 | } |
387 | event->setOrganizer(KOPrefs::instance()->email()); | 389 | event->setOrganizer(KOPrefs::instance()->email()); |
388 | } | 390 | } |
389 | 391 | ||
390 | void KOEditorDetails::cancelAttendeeEvent(Incidence *event) | 392 | void KOEditorDetails::cancelAttendeeEvent(Incidence *event) |
391 | { | 393 | { |
392 | event->clearAttendees(); | 394 | event->clearAttendees(); |
393 | Attendee * att; | 395 | Attendee * att; |
394 | for (att=mdelAttendees.first();att;att=mdelAttendees.next()) { | 396 | for (att=mdelAttendees.first();att;att=mdelAttendees.next()) { |
395 | event->addAttendee(new Attendee(*att)); | 397 | event->addAttendee(new Attendee(*att)); |
396 | } | 398 | } |
397 | mdelAttendees.clear(); | 399 | mdelAttendees.clear(); |
398 | } | 400 | } |
399 | 401 | ||
400 | bool KOEditorDetails::validateInput() | 402 | bool KOEditorDetails::validateInput() |
401 | { | 403 | { |
402 | return true; | 404 | return true; |
403 | } | 405 | } |
404 | 406 | ||
405 | void KOEditorDetails::updateAttendeeInput() | 407 | void KOEditorDetails::updateAttendeeInput() |
406 | { | 408 | { |
407 | QListViewItem *item = mListView->selectedItem(); | 409 | QListViewItem *item = mListView->selectedItem(); |
408 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); | 410 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); |
409 | if (aItem) { | 411 | if (aItem) { |
410 | fillAttendeeInput( aItem ); | 412 | fillAttendeeInput( aItem ); |
411 | } else { | 413 | } else { |
412 | clearAttendeeInput(); | 414 | clearAttendeeInput(); |
413 | } | 415 | } |
414 | } | 416 | } |
415 | 417 | ||
416 | void KOEditorDetails::clearAttendeeInput() | 418 | void KOEditorDetails::clearAttendeeInput() |
417 | { | 419 | { |
418 | mNameEdit->setText(""); | 420 | mNameEdit->setText(""); |
419 | mUidEdit->setText(""); | 421 | mUidEdit->setText(""); |
420 | mEmailEdit->setText(""); | 422 | mEmailEdit->setText(""); |
421 | mRoleCombo->setCurrentItem(0); | 423 | mRoleCombo->setCurrentItem(0); |
422 | mStatusCombo->setCurrentItem(0); | 424 | mStatusCombo->setCurrentItem(0); |
423 | mRsvpButton->setChecked(true); | 425 | mRsvpButton->setChecked(true); |
424 | setEnabledAttendeeInput( false ); | 426 | setEnabledAttendeeInput( false ); |
425 | } | 427 | } |
426 | 428 | ||
427 | void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) | 429 | void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) |
428 | { | 430 | { |
429 | Attendee *a = aItem->data(); | 431 | Attendee *a = aItem->data(); |
430 | mDisableItemUpdate = true; | 432 | mDisableItemUpdate = true; |
431 | mNameEdit->setText(a->name()); | 433 | mNameEdit->setText(a->name()); |
432 | mUidEdit->setText(a->uid()); | 434 | mUidEdit->setText(a->uid()); |
433 | mEmailEdit->setText(a->email()); | 435 | mEmailEdit->setText(a->email()); |
434 | mRoleCombo->setCurrentItem(a->role()); | 436 | mRoleCombo->setCurrentItem(a->role()); |
435 | mStatusCombo->setCurrentItem(a->status()); | 437 | mStatusCombo->setCurrentItem(a->status()); |
436 | mRsvpButton->setChecked(a->RSVP()); | 438 | mRsvpButton->setChecked(a->RSVP()); |
437 | 439 | ||
438 | mDisableItemUpdate = false; | 440 | mDisableItemUpdate = false; |
439 | 441 | ||
440 | setEnabledAttendeeInput( true ); | 442 | setEnabledAttendeeInput( true ); |
441 | } | 443 | } |
442 | 444 | ||
443 | void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) | 445 | void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) |
444 | { | 446 | { |
445 | mNameEdit->setEnabled( enabled ); | 447 | mNameEdit->setEnabled( enabled ); |
446 | mEmailEdit->setEnabled( enabled ); | 448 | mEmailEdit->setEnabled( enabled ); |
447 | mRoleCombo->setEnabled( enabled ); | 449 | mRoleCombo->setEnabled( enabled ); |
448 | mStatusCombo->setEnabled( enabled ); | 450 | mStatusCombo->setEnabled( enabled ); |
449 | mRsvpButton->setEnabled( enabled ); | 451 | mRsvpButton->setEnabled( enabled ); |
450 | 452 | ||
451 | mRemoveButton->setEnabled( enabled ); | 453 | mRemoveButton->setEnabled( enabled ); |
452 | } | 454 | } |
453 | 455 | ||
454 | void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c ) | 456 | void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c ) |
455 | { | 457 | { |
456 | if ( item && c == 4 ) { | 458 | if ( item && c == 4 ) { |
457 | mRsvpButton->setChecked( !mRsvpButton->isChecked() ); | 459 | mRsvpButton->setChecked( !mRsvpButton->isChecked() ); |
458 | updateAttendeeItem(); | 460 | updateAttendeeItem(); |
459 | } | 461 | } |
460 | } | 462 | } |
461 | void KOEditorDetails::updateAttendeeItem() | 463 | void KOEditorDetails::updateAttendeeItem() |
462 | { | 464 | { |
463 | if (mDisableItemUpdate) return; | 465 | if (mDisableItemUpdate) return; |
464 | 466 | ||
465 | QListViewItem *item = mListView->selectedItem(); | 467 | QListViewItem *item = mListView->selectedItem(); |
466 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); | 468 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); |
467 | if ( !aItem ) return; | 469 | if ( !aItem ) return; |
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index e07bc53..29e68b3 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -1,569 +1,572 @@ | |||
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 <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qtooltip.h> | 25 | #include <qtooltip.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qbuttongroup.h> | 28 | #include <qbuttongroup.h> |
29 | #include <qvgroupbox.h> | 29 | #include <qvgroupbox.h> |
30 | #include <qwidgetstack.h> | 30 | #include <qwidgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | 35 | ||
36 | 36 | ||
37 | #include <kglobal.h> | 37 | #include <kglobal.h> |
38 | #include <kdialog.h> | ||
38 | #include <kdebug.h> | 39 | #include <kdebug.h> |
39 | #include <klocale.h> | 40 | #include <klocale.h> |
40 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
41 | #include <kmessagebox.h> | 42 | #include <kmessagebox.h> |
42 | #include <kfiledialog.h> | 43 | #include <kfiledialog.h> |
43 | #include <kstandarddirs.h> | 44 | #include <kstandarddirs.h> |
44 | 45 | ||
45 | #include <libkcal/todo.h> | 46 | #include <libkcal/todo.h> |
46 | #include <libkcal/event.h> | 47 | #include <libkcal/event.h> |
47 | #include <libkdepim/categoryselectdialog.h> | 48 | #include <libkdepim/categoryselectdialog.h> |
48 | #include <libkdepim/kdateedit.h> | 49 | #include <libkdepim/kdateedit.h> |
49 | 50 | ||
50 | #include "koprefs.h" | 51 | #include "koprefs.h" |
51 | #include "koglobals.h" | 52 | #include "koglobals.h" |
52 | 53 | ||
53 | #include "koeditorgeneral.h" | 54 | #include "koeditorgeneral.h" |
54 | #include "kolocationbox.h" | 55 | #include "kolocationbox.h" |
55 | #ifndef DESKTOP_VERSION | 56 | #ifndef DESKTOP_VERSION |
56 | #include <qpe/qpeapplication.h> | 57 | #include <qpe/qpeapplication.h> |
57 | #else | 58 | #else |
58 | #include <qapplication.h> | 59 | #include <qapplication.h> |
59 | #endif | 60 | #endif |
60 | 61 | ||
61 | KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : | 62 | KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : |
62 | QObject( parent, name) | 63 | QObject( parent, name) |
63 | { | 64 | { |
64 | mNextFocus = 0; | 65 | mNextFocus = 0; |
65 | } | 66 | } |
66 | 67 | ||
67 | KOEditorGeneral::~KOEditorGeneral() | 68 | KOEditorGeneral::~KOEditorGeneral() |
68 | { | 69 | { |
69 | } | 70 | } |
70 | 71 | ||
71 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) | 72 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) |
72 | { | 73 | { |
73 | QGridLayout *headerLayout = new QGridLayout(topLayout); | 74 | QGridLayout *headerLayout = new QGridLayout(topLayout); |
74 | 75 | ||
75 | #if 0 | 76 | #if 0 |
76 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); | 77 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); |
77 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); | 78 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); |
78 | #endif | 79 | #endif |
79 | 80 | // 1 on pda | |
81 | // 11 on desktop | ||
82 | headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 ); | ||
80 | QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); | 83 | QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); |
81 | headerLayout->addWidget(summaryLabel,1,0); | 84 | headerLayout->addWidget(summaryLabel,1,0); |
82 | 85 | ||
83 | mSummaryEdit = new KOLocationBox(TRUE,parent, 10); | 86 | mSummaryEdit = new KOLocationBox(TRUE,parent, 10); |
84 | mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 87 | mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
85 | //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); | 88 | //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); |
86 | //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); | 89 | //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); |
87 | int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; | 90 | int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; |
88 | if ( QApplication::desktop()->width() > 320 ) | 91 | if ( QApplication::desktop()->width() > 320 ) |
89 | mSummaryEdit->setMaximumHeight( hei +6 ); | 92 | mSummaryEdit->setMaximumHeight( hei +6 ); |
90 | //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); | 93 | //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); |
91 | // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } | 94 | // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } |
92 | // mSummaryEdit = new QLineEdit(parent); | 95 | // mSummaryEdit = new QLineEdit(parent); |
93 | headerLayout->addWidget(mSummaryEdit,1,1); | 96 | headerLayout->addWidget(mSummaryEdit,1,1); |
94 | connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); | 97 | connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); |
95 | 98 | ||
96 | QLabel *locationLabel = new QLabel(i18n("Location:"),parent); | 99 | QLabel *locationLabel = new QLabel(i18n("Location:"),parent); |
97 | if ( QApplication::desktop()->height() < 320 ) | 100 | if ( QApplication::desktop()->height() < 320 ) |
98 | headerLayout->addWidget(locationLabel,1,2); | 101 | headerLayout->addWidget(locationLabel,1,2); |
99 | else | 102 | else |
100 | headerLayout->addWidget(locationLabel,2,0); | 103 | headerLayout->addWidget(locationLabel,2,0); |
101 | 104 | ||
102 | mLocationEdit = new KOLocationBox(TRUE,parent,10); | 105 | mLocationEdit = new KOLocationBox(TRUE,parent,10); |
103 | mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 106 | mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
104 | if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) | 107 | if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) |
105 | mLocationEdit->setMaximumHeight( hei + 6); | 108 | mLocationEdit->setMaximumHeight( hei + 6); |
106 | 109 | ||
107 | // mLocationEdit = new QLineEdit(parent); | 110 | // mLocationEdit = new QLineEdit(parent); |
108 | connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); | 111 | connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); |
109 | if ( QApplication::desktop()->height() < 320 ) { | 112 | if ( QApplication::desktop()->height() < 320 ) { |
110 | headerLayout->addWidget(mLocationEdit,1,3); | 113 | headerLayout->addWidget(mLocationEdit,1,3); |
111 | headerLayout->setColStretch( 1, 10); | 114 | headerLayout->setColStretch( 1, 10); |
112 | headerLayout->setColStretch( 3, 10); | 115 | headerLayout->setColStretch( 3, 10); |
113 | } | 116 | } |
114 | else { | 117 | else { |
115 | headerLayout->addWidget(mLocationEdit,2,1); | 118 | headerLayout->addWidget(mLocationEdit,2,1); |
116 | headerLayout->setColStretch( 1, 10); | 119 | headerLayout->setColStretch( 1, 10); |
117 | } | 120 | } |
118 | } | 121 | } |
119 | void KOEditorGeneral::setFocusOn( int i ) | 122 | void KOEditorGeneral::setFocusOn( int i ) |
120 | { | 123 | { |
121 | mNextFocus = i; | 124 | mNextFocus = i; |
122 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); | 125 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); |
123 | } | 126 | } |
124 | void KOEditorGeneral::slotSetFocusOn() | 127 | void KOEditorGeneral::slotSetFocusOn() |
125 | { | 128 | { |
126 | mNextFocus; | 129 | mNextFocus; |
127 | if ( mNextFocus == 1 ) { | 130 | if ( mNextFocus == 1 ) { |
128 | mDescriptionEdit->setFocus(); | 131 | mDescriptionEdit->setFocus(); |
129 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); | 132 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); |
130 | } | 133 | } |
131 | if ( mNextFocus == 2 ) { | 134 | if ( mNextFocus == 2 ) { |
132 | mSummaryEdit->setFocus(); | 135 | mSummaryEdit->setFocus(); |
133 | } | 136 | } |
134 | } | 137 | } |
135 | void KOEditorGeneral::editCategories() | 138 | void KOEditorGeneral::editCategories() |
136 | { | 139 | { |
137 | // qDebug("KOEditorGeneral::editCategories() "); | 140 | // qDebug("KOEditorGeneral::editCategories() "); |
138 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 141 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
139 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); | 142 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); |
140 | //KOGlobals::fitDialogToScreen( csd ); | 143 | //KOGlobals::fitDialogToScreen( csd ); |
141 | csd->setColorEnabled(); | 144 | csd->setColorEnabled(); |
142 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); | 145 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); |
143 | csd->exec(); | 146 | csd->exec(); |
144 | delete csd; | 147 | delete csd; |
145 | } | 148 | } |
146 | 149 | ||
147 | void KOEditorGeneral::showCatPopup() | 150 | void KOEditorGeneral::showCatPopup() |
148 | { | 151 | { |
149 | mCatPopup->clear(); | 152 | mCatPopup->clear(); |
150 | QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); | 153 | QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); |
151 | int index = 0; | 154 | int index = 0; |
152 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 155 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
153 | it != KOPrefs::instance()->mCustomCategories.end (); | 156 | it != KOPrefs::instance()->mCustomCategories.end (); |
154 | ++it) { | 157 | ++it) { |
155 | mCatPopup->insertItem (*it, index ); | 158 | mCatPopup->insertItem (*it, index ); |
156 | //mCategory[index] = *it; | 159 | //mCategory[index] = *it; |
157 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); | 160 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); |
158 | ++index; | 161 | ++index; |
159 | } | 162 | } |
160 | } | 163 | } |
161 | void KOEditorGeneral::selectedCatPopup( int index ) | 164 | void KOEditorGeneral::selectedCatPopup( int index ) |
162 | { | 165 | { |
163 | QStringList categories = QStringList::split (",", mCategoriesLabel->text()); | 166 | QStringList categories = QStringList::split (",", mCategoriesLabel->text()); |
164 | QString colcat = categories.first(); | 167 | QString colcat = categories.first(); |
165 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) | 168 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) |
166 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); | 169 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); |
167 | else | 170 | else |
168 | categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); | 171 | categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); |
169 | categories.sort (); | 172 | categories.sort (); |
170 | if ( !colcat.isEmpty() ) { | 173 | if ( !colcat.isEmpty() ) { |
171 | if ( categories.find ( colcat ) != categories.end () ) { | 174 | if ( categories.find ( colcat ) != categories.end () ) { |
172 | categories.remove( colcat ); | 175 | categories.remove( colcat ); |
173 | categories.prepend( colcat ); | 176 | categories.prepend( colcat ); |
174 | } | 177 | } |
175 | } | 178 | } |
176 | setCategories( categories.join(",") ); | 179 | setCategories( categories.join(",") ); |
177 | } | 180 | } |
178 | 181 | ||
179 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) | 182 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) |
180 | { | 183 | { |
181 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); | 184 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); |
182 | mCatPopup = new QPopupMenu ( parent ); | 185 | mCatPopup = new QPopupMenu ( parent ); |
183 | mCatPopup->setCheckable (true); | 186 | mCatPopup->setCheckable (true); |
184 | connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); | 187 | connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); |
185 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); | 188 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); |
186 | mCategoriesButton = new QPushButton(parent); | 189 | mCategoriesButton = new QPushButton(parent); |
187 | mCategoriesButton->setText(i18n("Categories...")); | 190 | mCategoriesButton->setText(i18n("Categories...")); |
188 | connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); | 191 | connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); |
189 | //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); | 192 | //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); |
190 | categoriesLayout->addWidget(mCategoriesButton); | 193 | categoriesLayout->addWidget(mCategoriesButton); |
191 | mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); | 194 | mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); |
192 | mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 195 | mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); |
193 | mCategoriesLabel->setPopup( mCatPopup ); | 196 | mCategoriesLabel->setPopup( mCatPopup ); |
194 | //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 197 | //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
195 | categoriesLayout->addWidget(mCategoriesLabel,1); | 198 | categoriesLayout->addWidget(mCategoriesLabel,1); |
196 | } | 199 | } |
197 | 200 | ||
198 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) | 201 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) |
199 | { | 202 | { |
200 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); | 203 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); |
201 | 204 | ||
202 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); | 205 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); |
203 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); | 206 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); |
204 | secrecyLayout->addWidget(mCancelBox); | 207 | secrecyLayout->addWidget(mCancelBox); |
205 | secrecyLayout->addWidget(secrecyLabel); | 208 | secrecyLayout->addWidget(secrecyLabel); |
206 | 209 | ||
207 | mSecrecyCombo = new QComboBox(parent); | 210 | mSecrecyCombo = new QComboBox(parent); |
208 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); | 211 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); |
209 | secrecyLayout->addWidget(mSecrecyCombo); | 212 | secrecyLayout->addWidget(mSecrecyCombo); |
210 | } | 213 | } |
211 | 214 | ||
212 | void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) | 215 | void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) |
213 | { | 216 | { |
214 | mDescriptionEdit = new KTextEdit(parent); | 217 | mDescriptionEdit = new KTextEdit(parent); |
215 | mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); | 218 | mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); |
216 | mDescriptionEdit->append(""); | 219 | mDescriptionEdit->append(""); |
217 | mDescriptionEdit->setReadOnly(false); | 220 | mDescriptionEdit->setReadOnly(false); |
218 | mDescriptionEdit->setOverwriteMode(false); | 221 | mDescriptionEdit->setOverwriteMode(false); |
219 | mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); | 222 | mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); |
220 | topLayout->addWidget(mDescriptionEdit); | 223 | topLayout->addWidget(mDescriptionEdit); |
221 | #ifndef DESKTOP_VERSION | 224 | #ifndef DESKTOP_VERSION |
222 | QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); | 225 | QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); |
223 | #endif | 226 | #endif |
224 | 227 | ||
225 | } | 228 | } |
226 | 229 | ||
227 | void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) | 230 | void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) |
228 | { | 231 | { |
229 | QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); | 232 | QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); |
230 | 233 | ||
231 | //mAlarmBell = new QLabel(parent); | 234 | //mAlarmBell = new QLabel(parent); |
232 | //mAlarmBell->setPixmap(SmallIcon("bell")); | 235 | //mAlarmBell->setPixmap(SmallIcon("bell")); |
233 | //alarmLayout->addWidget(mAlarmBell); | 236 | //alarmLayout->addWidget(mAlarmBell); |
234 | if ( QApplication::desktop()->width() < 320 ) | 237 | if ( QApplication::desktop()->width() < 320 ) |
235 | mAlarmButton = new QCheckBox(i18n("Rem."),parent); | 238 | mAlarmButton = new QCheckBox(i18n("Rem."),parent); |
236 | else | 239 | else |
237 | mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); | 240 | mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); |
238 | 241 | ||
239 | connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); | 242 | connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); |
240 | alarmLayout->addWidget(mAlarmButton); | 243 | alarmLayout->addWidget(mAlarmButton); |
241 | 244 | ||
242 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; | 245 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; |
243 | mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); | 246 | mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); |
244 | alarmLayout->addWidget(mAlarmTimeEdit); | 247 | alarmLayout->addWidget(mAlarmTimeEdit); |
245 | mAlarmIncrCombo = new QComboBox(false, parent); | 248 | mAlarmIncrCombo = new QComboBox(false, parent); |
246 | if ( QApplication::desktop()->width() < 320 ) { | 249 | if ( QApplication::desktop()->width() < 320 ) { |
247 | mAlarmIncrCombo->insertItem(i18n("min")); | 250 | mAlarmIncrCombo->insertItem(i18n("min")); |
248 | mAlarmIncrCombo->insertItem(i18n("hou")); | 251 | mAlarmIncrCombo->insertItem(i18n("hou")); |
249 | mAlarmIncrCombo->insertItem(i18n("day")); | 252 | mAlarmIncrCombo->insertItem(i18n("day")); |
250 | mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); | 253 | mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); |
251 | mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); | 254 | mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); |
252 | } else { | 255 | } else { |
253 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); | 256 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); |
254 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); | 257 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); |
255 | mAlarmIncrCombo->insertItem(i18n("day(s)")); | 258 | mAlarmIncrCombo->insertItem(i18n("day(s)")); |
256 | } | 259 | } |
257 | 260 | ||
258 | // mAlarmIncrCombo->setMinimumHeight(20); | 261 | // mAlarmIncrCombo->setMinimumHeight(20); |
259 | alarmLayout->addWidget(mAlarmIncrCombo); | 262 | alarmLayout->addWidget(mAlarmIncrCombo); |
260 | mAlarmSoundButton = new QPushButton(parent); | 263 | mAlarmSoundButton = new QPushButton(parent); |
261 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); | 264 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); |
262 | mAlarmSoundButton->setToggleButton(true); | 265 | mAlarmSoundButton->setToggleButton(true); |
263 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); | 266 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); |
264 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); | 267 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); |
265 | alarmLayout->addWidget(mAlarmSoundButton); | 268 | alarmLayout->addWidget(mAlarmSoundButton); |
266 | 269 | ||
267 | mAlarmProgramButton = new QPushButton(parent); | 270 | mAlarmProgramButton = new QPushButton(parent); |
268 | mAlarmProgramButton->setPixmap(SmallIcon("run")); | 271 | mAlarmProgramButton->setPixmap(SmallIcon("run")); |
269 | mAlarmProgramButton->setToggleButton(true); | 272 | mAlarmProgramButton->setToggleButton(true); |
270 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); | 273 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); |
271 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); | 274 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); |
272 | alarmLayout->addWidget(mAlarmProgramButton); | 275 | alarmLayout->addWidget(mAlarmProgramButton); |
273 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); | 276 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); |
274 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); | 277 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); |
275 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 278 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
276 | // mAlarmSoundButton->hide(); | 279 | // mAlarmSoundButton->hide(); |
277 | // mAlarmProgramButton->hide(); | 280 | // mAlarmProgramButton->hide(); |
278 | // } | 281 | // } |
279 | } | 282 | } |
280 | 283 | ||
281 | void KOEditorGeneral::pickAlarmSound() | 284 | void KOEditorGeneral::pickAlarmSound() |
282 | { | 285 | { |
283 | 286 | ||
284 | //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); | 287 | //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); |
285 | 288 | ||
286 | bool oldState = mAlarmSoundButton->isOn(); | 289 | bool oldState = mAlarmSoundButton->isOn(); |
287 | 290 | ||
288 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, | 291 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, |
289 | i18n("*.wav|Wav Files"), 0)); | 292 | i18n("*.wav|Wav Files"), 0)); |
290 | if (!fileName.isEmpty()) { | 293 | if (!fileName.isEmpty()) { |
291 | mAlarmSound = fileName; | 294 | mAlarmSound = fileName; |
292 | QToolTip::remove(mAlarmSoundButton); | 295 | QToolTip::remove(mAlarmSoundButton); |
293 | QString dispStr = i18n("Playing '%1'").arg(fileName); | 296 | QString dispStr = i18n("Playing '%1'").arg(fileName); |
294 | QToolTip::add(mAlarmSoundButton, dispStr); | 297 | QToolTip::add(mAlarmSoundButton, dispStr); |
295 | mAlarmProgramButton->setOn(false); | 298 | mAlarmProgramButton->setOn(false); |
296 | mAlarmSoundButton->setOn(true); | 299 | mAlarmSoundButton->setOn(true); |
297 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); | 300 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); |
298 | } else { | 301 | } else { |
299 | mAlarmProgramButton->setOn(oldState); | 302 | mAlarmProgramButton->setOn(oldState); |
300 | mAlarmSoundButton->setOn(!oldState); | 303 | mAlarmSoundButton->setOn(!oldState); |
301 | 304 | ||
302 | 305 | ||
303 | } | 306 | } |
304 | 307 | ||
305 | if (mAlarmProgramButton->isOn()) | 308 | if (mAlarmProgramButton->isOn()) |
306 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 309 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
307 | if ( mAlarmSoundButton->isOn()) | 310 | if ( mAlarmSoundButton->isOn()) |
308 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 311 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
309 | 312 | ||
310 | } | 313 | } |
311 | 314 | ||
312 | void KOEditorGeneral::pickAlarmProgram() | 315 | void KOEditorGeneral::pickAlarmProgram() |
313 | { | 316 | { |
314 | bool oldState = mAlarmProgramButton->isOn(); | 317 | bool oldState = mAlarmProgramButton->isOn(); |
315 | 318 | ||
316 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); | 319 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); |
317 | if (!fileName.isEmpty()) { | 320 | if (!fileName.isEmpty()) { |
318 | mAlarmProgram = fileName; | 321 | mAlarmProgram = fileName; |
319 | QToolTip::remove(mAlarmProgramButton); | 322 | QToolTip::remove(mAlarmProgramButton); |
320 | QString dispStr = i18n("Running '%1'").arg(fileName); | 323 | QString dispStr = i18n("Running '%1'").arg(fileName); |
321 | QToolTip::add(mAlarmProgramButton, dispStr); | 324 | QToolTip::add(mAlarmProgramButton, dispStr); |
322 | mAlarmSoundButton->setOn(false); | 325 | mAlarmSoundButton->setOn(false); |
323 | mAlarmProgramButton->setOn(true); | 326 | mAlarmProgramButton->setOn(true); |
324 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); | 327 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); |
325 | } else { | 328 | } else { |
326 | mAlarmProgramButton->setOn(!oldState); | 329 | mAlarmProgramButton->setOn(!oldState); |
327 | mAlarmSoundButton->setOn(oldState); | 330 | mAlarmSoundButton->setOn(oldState); |
328 | } | 331 | } |
329 | 332 | ||
330 | if (mAlarmProgramButton->isOn()) | 333 | if (mAlarmProgramButton->isOn()) |
331 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 334 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
332 | if ( mAlarmSoundButton->isOn()) | 335 | if ( mAlarmSoundButton->isOn()) |
333 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 336 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
334 | 337 | ||
335 | } | 338 | } |
336 | 339 | ||
337 | 340 | ||
338 | QString KOEditorGeneral::getFittingPath( const QString s ) | 341 | QString KOEditorGeneral::getFittingPath( const QString s ) |
339 | { | 342 | { |
340 | int maxlen = 50; | 343 | int maxlen = 50; |
341 | if ( QApplication::desktop()->width() < 640 ) { | 344 | if ( QApplication::desktop()->width() < 640 ) { |
342 | if ( QApplication::desktop()->width() < 320 ) | 345 | if ( QApplication::desktop()->width() < 320 ) |
343 | maxlen = 22; | 346 | maxlen = 22; |
344 | else | 347 | else |
345 | maxlen = 35; | 348 | maxlen = 35; |
346 | } | 349 | } |
347 | if ( s.length() > maxlen ) { | 350 | if ( s.length() > maxlen ) { |
348 | return "..."+s.right(maxlen -3); | 351 | return "..."+s.right(maxlen -3); |
349 | } | 352 | } |
350 | return s; | 353 | return s; |
351 | } | 354 | } |
352 | 355 | ||
353 | void KOEditorGeneral::enableAlarmEdit(bool enable) | 356 | void KOEditorGeneral::enableAlarmEdit(bool enable) |
354 | { | 357 | { |
355 | if ( enable ) { | 358 | if ( enable ) { |
356 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { | 359 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { |
357 | mAlarmSoundButton->setOn( true ); | 360 | mAlarmSoundButton->setOn( true ); |
358 | if ( mAlarmSound.isEmpty() ) | 361 | if ( mAlarmSound.isEmpty() ) |
359 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 362 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
360 | else { | 363 | else { |
361 | if ( ! QFile::exists( mAlarmSound ) ) | 364 | if ( ! QFile::exists( mAlarmSound ) ) |
362 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 365 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
363 | } | 366 | } |
364 | } | 367 | } |
365 | } | 368 | } |
366 | ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); | 369 | ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); |
367 | mAlarmTimeEdit->setEnabled(enable); | 370 | mAlarmTimeEdit->setEnabled(enable); |
368 | mAlarmSoundButton->setEnabled(enable); | 371 | mAlarmSoundButton->setEnabled(enable); |
369 | mAlarmProgramButton->setEnabled(enable); | 372 | mAlarmProgramButton->setEnabled(enable); |
370 | mAlarmIncrCombo->setEnabled(enable); | 373 | mAlarmIncrCombo->setEnabled(enable); |
371 | } | 374 | } |
372 | 375 | ||
373 | void KOEditorGeneral::disableAlarmEdit(bool disable) | 376 | void KOEditorGeneral::disableAlarmEdit(bool disable) |
374 | { | 377 | { |
375 | enableAlarmEdit( !disable ); | 378 | enableAlarmEdit( !disable ); |
376 | } | 379 | } |
377 | 380 | ||
378 | void KOEditorGeneral::enableAlarm( bool enable ) | 381 | void KOEditorGeneral::enableAlarm( bool enable ) |
379 | { | 382 | { |
380 | enableAlarmEdit( enable ); | 383 | enableAlarmEdit( enable ); |
381 | } | 384 | } |
382 | 385 | ||
383 | void KOEditorGeneral::alarmDisable(bool disable) | 386 | void KOEditorGeneral::alarmDisable(bool disable) |
384 | { | 387 | { |
385 | if (!disable) { | 388 | if (!disable) { |
386 | //mAlarmBell->setEnabled(true); | 389 | //mAlarmBell->setEnabled(true); |
387 | mAlarmButton->setEnabled(true); | 390 | mAlarmButton->setEnabled(true); |
388 | } else { | 391 | } else { |
389 | //mAlarmBell->setEnabled(false); | 392 | //mAlarmBell->setEnabled(false); |
390 | mAlarmButton->setEnabled(false); | 393 | mAlarmButton->setEnabled(false); |
391 | mAlarmButton->setChecked(false); | 394 | mAlarmButton->setChecked(false); |
392 | mAlarmTimeEdit->setEnabled(false); | 395 | mAlarmTimeEdit->setEnabled(false); |
393 | mAlarmSoundButton->setEnabled(false); | 396 | mAlarmSoundButton->setEnabled(false); |
394 | mAlarmProgramButton->setEnabled(false); | 397 | mAlarmProgramButton->setEnabled(false); |
395 | mAlarmIncrCombo->setEnabled(false); | 398 | mAlarmIncrCombo->setEnabled(false); |
396 | } | 399 | } |
397 | } | 400 | } |
398 | 401 | ||
399 | void KOEditorGeneral::setCategories(const QString &str) | 402 | void KOEditorGeneral::setCategories(const QString &str) |
400 | { | 403 | { |
401 | QString tt = str; | 404 | QString tt = str; |
402 | QToolTip::add( mCategoriesLabel, i18n("<b>Click here to edit categories: </b>") +"<em>"+tt.replace( QRegExp(","),", ")+"</em>"); | 405 | QToolTip::add( mCategoriesLabel, i18n("<b>Click here to edit categories: </b>") +"<em>"+tt.replace( QRegExp(","),", ")+"</em>"); |
403 | mCategoriesLabel->setText(str); | 406 | mCategoriesLabel->setText(str); |
404 | } | 407 | } |
405 | 408 | ||
406 | void KOEditorGeneral::setDefaults(bool allDay) | 409 | void KOEditorGeneral::setDefaults(bool allDay) |
407 | { | 410 | { |
408 | #if 0 | 411 | #if 0 |
409 | mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); | 412 | mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); |
410 | #endif | 413 | #endif |
411 | 414 | ||
412 | mAlarmMessage = i18n("Edit new item"); | 415 | mAlarmMessage = i18n("Edit new item"); |
413 | enableAlarmEdit( !allDay ); | 416 | enableAlarmEdit( !allDay ); |
414 | 417 | ||
415 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. | 418 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. |
416 | int alarmTime; | 419 | int alarmTime; |
417 | int a[] = { 1,5,10,15,30,60,180, 1440 }; | 420 | int a[] = { 1,5,10,15,30,60,180, 1440 }; |
418 | int index = KOPrefs::instance()->mAlarmTime; | 421 | int index = KOPrefs::instance()->mAlarmTime; |
419 | if (index < 0 || index > 7) { | 422 | if (index < 0 || index > 7) { |
420 | alarmTime = 15; | 423 | alarmTime = 15; |
421 | } else { | 424 | } else { |
422 | alarmTime = a[index]; | 425 | alarmTime = a[index]; |
423 | } | 426 | } |
424 | mAlarmButton ->setChecked( false ); | 427 | mAlarmButton ->setChecked( false ); |
425 | mAlarmTimeEdit->setValue(alarmTime); | 428 | mAlarmTimeEdit->setValue(alarmTime); |
426 | mAlarmIncrCombo->setCurrentItem(0); | 429 | mAlarmIncrCombo->setCurrentItem(0); |
427 | enableAlarmEdit( false ); | 430 | enableAlarmEdit( false ); |
428 | //alarmDisable (false); | 431 | //alarmDisable (false); |
429 | mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); | 432 | mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); |
430 | mCancelBox->setChecked( false ); | 433 | mCancelBox->setChecked( false ); |
431 | mSummaryEdit->setEditText(""); | 434 | mSummaryEdit->setEditText(""); |
432 | mLocationEdit->setEditText(""); | 435 | mLocationEdit->setEditText(""); |
433 | mDescriptionEdit->setText(""); | 436 | mDescriptionEdit->setText(""); |
434 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 437 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
435 | setCategories(""); | 438 | setCategories(""); |
436 | } | 439 | } |
437 | void KOEditorGeneral::setSecrecy( int num ) | 440 | void KOEditorGeneral::setSecrecy( int num ) |
438 | { | 441 | { |
439 | mSecrecyCombo->setCurrentItem(num); | 442 | mSecrecyCombo->setCurrentItem(num); |
440 | } | 443 | } |
441 | void KOEditorGeneral::readIncidence(Incidence *event) | 444 | void KOEditorGeneral::readIncidence(Incidence *event) |
442 | { | 445 | { |
443 | 446 | ||
444 | mAlarmMessage = event->summary(); | 447 | mAlarmMessage = event->summary(); |
445 | if ( ! event->location().isEmpty() ) | 448 | if ( ! event->location().isEmpty() ) |
446 | mAlarmMessage += " ("+event->location()+")"; | 449 | mAlarmMessage += " ("+event->location()+")"; |
447 | mAlarmIncrCombo->setCurrentItem(0); | 450 | mAlarmIncrCombo->setCurrentItem(0); |
448 | mSummaryEdit->setEditText(event->summary()); | 451 | mSummaryEdit->setEditText(event->summary()); |
449 | mLocationEdit->setEditText(event->location()); | 452 | mLocationEdit->setEditText(event->location()); |
450 | mDescriptionEdit->setText(event->description()); | 453 | mDescriptionEdit->setText(event->description()); |
451 | 454 | ||
452 | #if 0 | 455 | #if 0 |
453 | // organizer information | 456 | // organizer information |
454 | mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); | 457 | mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); |
455 | #endif | 458 | #endif |
456 | 459 | ||
457 | enableAlarmEdit( event->isAlarmEnabled() ); | 460 | enableAlarmEdit( event->isAlarmEnabled() ); |
458 | //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); | 461 | //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); |
459 | if(!event->isAlarmEnabled()) { | 462 | if(!event->isAlarmEnabled()) { |
460 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. | 463 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. |
461 | int alarmTime; | 464 | int alarmTime; |
462 | int a[] = { 1,5,10,15,30,60,180, 1440 }; | 465 | int a[] = { 1,5,10,15,30,60,180, 1440 }; |
463 | int index = KOPrefs::instance()->mAlarmTime; | 466 | int index = KOPrefs::instance()->mAlarmTime; |
464 | if (index < 0 || index > 7) { | 467 | if (index < 0 || index > 7) { |
465 | alarmTime = 15; | 468 | alarmTime = 15; |
466 | } else { | 469 | } else { |
467 | alarmTime = a[index]; | 470 | alarmTime = a[index]; |
468 | } | 471 | } |
469 | mAlarmTimeEdit->setValue(alarmTime); | 472 | mAlarmTimeEdit->setValue(alarmTime); |
470 | } | 473 | } |
471 | mAlarmButton->setChecked( event->isAlarmEnabled() ); | 474 | mAlarmButton->setChecked( event->isAlarmEnabled() ); |
472 | mSecrecyCombo->setCurrentItem(event->secrecy()); | 475 | mSecrecyCombo->setCurrentItem(event->secrecy()); |
473 | mCancelBox->setChecked( event->cancelled() ); | 476 | mCancelBox->setChecked( event->cancelled() ); |
474 | mAlarmProgramButton->setOn(false); | 477 | mAlarmProgramButton->setOn(false); |
475 | mAlarmSoundButton->setOn(false); | 478 | mAlarmSoundButton->setOn(false); |
476 | 479 | ||
477 | // set up alarm stuff | 480 | // set up alarm stuff |
478 | QPtrList<Alarm> alarms = event->alarms(); | 481 | QPtrList<Alarm> alarms = event->alarms(); |
479 | Alarm* alarm; | 482 | Alarm* alarm; |
480 | mAlarmIncrCombo->setCurrentItem(0); | 483 | mAlarmIncrCombo->setCurrentItem(0); |
481 | for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 484 | for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
482 | int offset; | 485 | int offset; |
483 | if ( alarm->hasTime() ) { | 486 | if ( alarm->hasTime() ) { |
484 | QDateTime t = alarm->time(); | 487 | QDateTime t = alarm->time(); |
485 | offset = event->dtStart().secsTo( t ); | 488 | offset = event->dtStart().secsTo( t ); |
486 | } else { | 489 | } else { |
487 | offset = alarm->startOffset().asSeconds(); | 490 | offset = alarm->startOffset().asSeconds(); |
488 | } | 491 | } |
489 | if ( offset != 0 ) { | 492 | if ( offset != 0 ) { |
490 | offset = offset / -60; // make minutes | 493 | offset = offset / -60; // make minutes |
491 | if (offset % 60 == 0) { // divides evenly into hours? | 494 | if (offset % 60 == 0) { // divides evenly into hours? |
492 | offset = offset / 60; | 495 | offset = offset / 60; |
493 | mAlarmIncrCombo->setCurrentItem(1); | 496 | mAlarmIncrCombo->setCurrentItem(1); |
494 | if (offset % 24 == 0) { // divides evenly into days? | 497 | if (offset % 24 == 0) { // divides evenly into days? |
495 | offset = offset / 24; | 498 | offset = offset / 24; |
496 | mAlarmIncrCombo->setCurrentItem(2); | 499 | mAlarmIncrCombo->setCurrentItem(2); |
497 | } | 500 | } |
498 | } | 501 | } |
499 | } | 502 | } |
500 | mAlarmTimeEdit->setValue( offset ); | 503 | mAlarmTimeEdit->setValue( offset ); |
501 | if (alarm->type() == Alarm::Procedure) { | 504 | if (alarm->type() == Alarm::Procedure) { |
502 | 505 | ||
503 | mAlarmProgram = alarm->programFile(); | 506 | mAlarmProgram = alarm->programFile(); |
504 | mAlarmProgramButton->setOn(true); | 507 | mAlarmProgramButton->setOn(true); |
505 | QString dispStr = i18n("Running '%1'").arg(mAlarmProgram); | 508 | QString dispStr = i18n("Running '%1'").arg(mAlarmProgram); |
506 | QToolTip::add(mAlarmProgramButton, dispStr); | 509 | QToolTip::add(mAlarmProgramButton, dispStr); |
507 | } | 510 | } |
508 | else if (alarm->type() == Alarm::Audio) { | 511 | else if (alarm->type() == Alarm::Audio) { |
509 | mAlarmSound = alarm->audioFile(); | 512 | mAlarmSound = alarm->audioFile(); |
510 | if ( ! QFile::exists( mAlarmSound ) ) | 513 | if ( ! QFile::exists( mAlarmSound ) ) |
511 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 514 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
512 | mAlarmSoundButton->setOn(true); | 515 | mAlarmSoundButton->setOn(true); |
513 | QString dispStr = i18n("Playing '%1'").arg(mAlarmSound); | 516 | QString dispStr = i18n("Playing '%1'").arg(mAlarmSound); |
514 | QToolTip::add(mAlarmSoundButton, dispStr); | 517 | QToolTip::add(mAlarmSoundButton, dispStr); |
515 | } | 518 | } |
516 | mAlarmButton->setChecked(alarm->enabled()); | 519 | mAlarmButton->setChecked(alarm->enabled()); |
517 | enableAlarmEdit( alarm->enabled() ); | 520 | enableAlarmEdit( alarm->enabled() ); |
518 | //qDebug("nableAlarmEdit( alarm->enabled() )********* "); | 521 | //qDebug("nableAlarmEdit( alarm->enabled() )********* "); |
519 | // TODO: Deal with multiple alarms | 522 | // TODO: Deal with multiple alarms |
520 | break; // For now, stop after the first alarm | 523 | break; // For now, stop after the first alarm |
521 | } | 524 | } |
522 | 525 | ||
523 | setCategories(event->categoriesStr()); | 526 | setCategories(event->categoriesStr()); |
524 | } | 527 | } |
525 | 528 | ||
526 | void KOEditorGeneral::writeIncidence(Incidence *event) | 529 | void KOEditorGeneral::writeIncidence(Incidence *event) |
527 | { | 530 | { |
528 | // kdDebug() << "KOEditorGeneral::writeEvent()" << endl; | 531 | // kdDebug() << "KOEditorGeneral::writeEvent()" << endl; |
529 | mLocationEdit->save(KOLocationBox::LOCATION); | 532 | mLocationEdit->save(KOLocationBox::LOCATION); |
530 | event->setSummary(mSummaryEdit->currentText()); | 533 | event->setSummary(mSummaryEdit->currentText()); |
531 | event->setLocation(mLocationEdit->currentText()); | 534 | event->setLocation(mLocationEdit->currentText()); |
532 | event->setDescription(mDescriptionEdit->text()); | 535 | event->setDescription(mDescriptionEdit->text()); |
533 | event->setCategories(mCategoriesLabel->text()); | 536 | event->setCategories(mCategoriesLabel->text()); |
534 | event->setSecrecy(mSecrecyCombo->currentItem()); | 537 | event->setSecrecy(mSecrecyCombo->currentItem()); |
535 | event->setCancelled(mCancelBox->isChecked() );; | 538 | event->setCancelled(mCancelBox->isChecked() );; |
536 | // alarm stuff | 539 | // alarm stuff |
537 | if (mAlarmButton->isChecked()) { | 540 | if (mAlarmButton->isChecked()) { |
538 | if (event->alarms().count() == 0) | 541 | if (event->alarms().count() == 0) |
539 | event->newAlarm(); | 542 | event->newAlarm(); |
540 | QPtrList<Alarm> alarms = event->alarms(); | 543 | QPtrList<Alarm> alarms = event->alarms(); |
541 | Alarm *alarm; | 544 | Alarm *alarm; |
542 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 545 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
543 | alarm->setEnabled(true); | 546 | alarm->setEnabled(true); |
544 | int j = mAlarmTimeEdit->value()* -60; | 547 | int j = mAlarmTimeEdit->value()* -60; |
545 | if (mAlarmIncrCombo->currentItem() == 1) | 548 | if (mAlarmIncrCombo->currentItem() == 1) |
546 | j = j * 60; | 549 | j = j * 60; |
547 | else if (mAlarmIncrCombo->currentItem() == 2) | 550 | else if (mAlarmIncrCombo->currentItem() == 2) |
548 | j = j * (60 * 24); | 551 | j = j * (60 * 24); |
549 | alarm->setStartOffset( j ); | 552 | alarm->setStartOffset( j ); |
550 | 553 | ||
551 | if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) { | 554 | if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) { |
552 | alarm->setProcedureAlarm(mAlarmProgram); | 555 | alarm->setProcedureAlarm(mAlarmProgram); |
553 | } | 556 | } |
554 | else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) | 557 | else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) |
555 | alarm->setAudioAlarm(mAlarmSound); | 558 | alarm->setAudioAlarm(mAlarmSound); |
556 | else | 559 | else |
557 | alarm->setType(Alarm::Invalid); | 560 | alarm->setType(Alarm::Invalid); |
558 | //alarm->setAudioAlarm("default"); | 561 | //alarm->setAudioAlarm("default"); |
559 | // TODO: Deal with multiple alarms | 562 | // TODO: Deal with multiple alarms |
560 | break; // For now, stop after the first alarm | 563 | break; // For now, stop after the first alarm |
561 | } | 564 | } |
562 | } else { | 565 | } else { |
563 | Alarm* alarm = event->alarms().first(); | 566 | Alarm* alarm = event->alarms().first(); |
564 | if ( alarm ) { | 567 | if ( alarm ) { |
565 | alarm->setEnabled(false); | 568 | alarm->setEnabled(false); |
566 | alarm->setType(Alarm::Invalid); | 569 | alarm->setType(Alarm::Invalid); |
567 | } | 570 | } |
568 | } | 571 | } |
569 | } | 572 | } |
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp index 3dd7f5c..2c6ed9f 100644 --- a/korganizer/koeditorgeneralevent.cpp +++ b/korganizer/koeditorgeneralevent.cpp | |||
@@ -1,443 +1,444 @@ | |||
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 <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qvbox.h> | 26 | #include <qvbox.h> |
27 | #include <qbuttongroup.h> | 27 | #include <qbuttongroup.h> |
28 | #include <qvgroupbox.h> | 28 | #include <qvgroupbox.h> |
29 | #include <qwidgetstack.h> | 29 | #include <qwidgetstack.h> |
30 | #include <qdatetime.h> | 30 | #include <qdatetime.h> |
31 | 31 | ||
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <kglobal.h> | 33 | #include <kglobal.h> |
34 | #include <kdialog.h> | ||
34 | #include <klocale.h> | 35 | #include <klocale.h> |
35 | #include <kiconloader.h> | 36 | #include <kiconloader.h> |
36 | #include <kmessagebox.h> | 37 | #include <kmessagebox.h> |
37 | #include <kfiledialog.h> | 38 | #include <kfiledialog.h> |
38 | #include <kstandarddirs.h> | 39 | #include <kstandarddirs.h> |
39 | 40 | ||
40 | #include <libkcal/event.h> | 41 | #include <libkcal/event.h> |
41 | 42 | ||
42 | #include <libkdepim/kdateedit.h> | 43 | #include <libkdepim/kdateedit.h> |
43 | 44 | ||
44 | #include "koprefs.h" | 45 | #include "koprefs.h" |
45 | 46 | ||
46 | #include "koeditorgeneralevent.h" | 47 | #include "koeditorgeneralevent.h" |
47 | #include "kolocationbox.h" | 48 | #include "kolocationbox.h" |
48 | 49 | ||
49 | KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent, | 50 | KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent, |
50 | const char* name) : | 51 | const char* name) : |
51 | KOEditorGeneral( parent, name) | 52 | KOEditorGeneral( parent, name) |
52 | { | 53 | { |
53 | mTemplate = false; | 54 | mTemplate = false; |
54 | connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), | 55 | connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), |
55 | SLOT(setDuration())); | 56 | SLOT(setDuration())); |
56 | connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), | 57 | connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), |
57 | SLOT(emitDateTimeStr())); | 58 | SLOT(emitDateTimeStr())); |
58 | } | 59 | } |
59 | 60 | ||
60 | KOEditorGeneralEvent::~KOEditorGeneralEvent() | 61 | KOEditorGeneralEvent::~KOEditorGeneralEvent() |
61 | { | 62 | { |
62 | } | 63 | } |
63 | 64 | ||
64 | void KOEditorGeneralEvent::finishSetup() | 65 | void KOEditorGeneralEvent::finishSetup() |
65 | { | 66 | { |
66 | 67 | ||
67 | //disabled | 68 | //disabled |
68 | // QWidget::setTabOrder( mSummaryEdit, mLocationEdit ); | 69 | // QWidget::setTabOrder( mSummaryEdit, mLocationEdit ); |
69 | // QWidget::setTabOrder( mLocationEdit, mStartDateEdit ); | 70 | // QWidget::setTabOrder( mLocationEdit, mStartDateEdit ); |
70 | // QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit ); | 71 | // QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit ); |
71 | // QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit ); | 72 | // QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit ); |
72 | // QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit ); | 73 | // QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit ); |
73 | // QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton ); | 74 | // QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton ); |
74 | // QWidget::setTabOrder( mNoTimeButton, mAlarmButton ); | 75 | // QWidget::setTabOrder( mNoTimeButton, mAlarmButton ); |
75 | // QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit ); | 76 | // QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit ); |
76 | // QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton ); | 77 | // QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton ); |
77 | // QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo ); | 78 | // QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo ); |
78 | // QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit ); | 79 | // QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit ); |
79 | 80 | ||
80 | 81 | ||
81 | 82 | ||
82 | mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); | 83 | mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); |
83 | mSummaryEdit->setFocus(); | 84 | mSummaryEdit->setFocus(); |
84 | } | 85 | } |
85 | 86 | ||
86 | void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout) | 87 | void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout) |
87 | { | 88 | { |
88 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); | 89 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); |
89 | 90 | ||
90 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, | 91 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, |
91 | i18n("Date && Time"),parent); | 92 | i18n("Date && Time"),parent); |
92 | timeLayout->addWidget(timeGroupBox); | 93 | timeLayout->addWidget(timeGroupBox); |
93 | 94 | ||
94 | timeGroupBox->layout()->setSpacing( 0 ); | 95 | timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() ); |
95 | timeGroupBox->layout()->setMargin( 5 ); | 96 | timeGroupBox->layout()->setMargin( KDialog::marginHint() ); |
96 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); | 97 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); |
97 | 98 | ||
98 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,2,3); | 99 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,2,3); |
99 | layoutTimeBox->setSpacing(topLayout->spacing()); | 100 | layoutTimeBox->setSpacing(topLayout->spacing()); |
100 | 101 | ||
101 | mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame); | 102 | mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame); |
102 | layoutTimeBox->addWidget(mStartDateLabel,0,0); | 103 | layoutTimeBox->addWidget(mStartDateLabel,0,0); |
103 | 104 | ||
104 | mStartDateEdit = new KDateEdit(timeBoxFrame); | 105 | mStartDateEdit = new KDateEdit(timeBoxFrame); |
105 | layoutTimeBox->addWidget(mStartDateEdit,0,1); | 106 | layoutTimeBox->addWidget(mStartDateEdit,0,1); |
106 | 107 | ||
107 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); | 108 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); |
108 | layoutTimeBox->addWidget(mStartTimeEdit,0,2); | 109 | layoutTimeBox->addWidget(mStartTimeEdit,0,2); |
109 | 110 | ||
110 | 111 | ||
111 | mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame); | 112 | mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame); |
112 | layoutTimeBox->addWidget(mEndDateLabel,1,0); | 113 | layoutTimeBox->addWidget(mEndDateLabel,1,0); |
113 | 114 | ||
114 | mEndDateEdit = new KDateEdit(timeBoxFrame); | 115 | mEndDateEdit = new KDateEdit(timeBoxFrame); |
115 | layoutTimeBox->addWidget(mEndDateEdit,1,1); | 116 | layoutTimeBox->addWidget(mEndDateEdit,1,1); |
116 | 117 | ||
117 | mEndTimeEdit = new KOTimeEdit(timeBoxFrame); | 118 | mEndTimeEdit = new KOTimeEdit(timeBoxFrame); |
118 | layoutTimeBox->addWidget(mEndTimeEdit,1,2); | 119 | layoutTimeBox->addWidget(mEndTimeEdit,1,2); |
119 | QWidget* duration = new QWidget( timeBoxFrame ); | 120 | QWidget* duration = new QWidget( timeBoxFrame ); |
120 | QHBoxLayout *flagsBox = new QHBoxLayout( duration ); | 121 | QHBoxLayout *flagsBox = new QHBoxLayout( duration ); |
121 | mNoTimeButton = new QCheckBox(i18n("All day event"),duration); | 122 | mNoTimeButton = new QCheckBox(i18n("All day event"),duration); |
122 | flagsBox->addWidget(mNoTimeButton); | 123 | flagsBox->addWidget(mNoTimeButton); |
123 | connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool))); | 124 | connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool))); |
124 | mDurationLabel = new QLabel( duration ); | 125 | mDurationLabel = new QLabel( duration ); |
125 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 126 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
126 | //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 ); | 127 | //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 ); |
127 | //} else { | 128 | //} else { |
128 | flagsBox->addWidget( mDurationLabel ); | 129 | flagsBox->addWidget( mDurationLabel ); |
129 | //} | 130 | //} |
130 | flagsBox->setStretchFactor(mDurationLabel, 10 ); | 131 | flagsBox->setStretchFactor(mDurationLabel, 10 ); |
131 | mDurationLabel->setAlignment( AlignRight | AlignVCenter); | 132 | mDurationLabel->setAlignment( AlignRight | AlignVCenter); |
132 | layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 ); | 133 | layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 ); |
133 | 134 | ||
134 | // time widgets are checked if they contain a valid time | 135 | // time widgets are checked if they contain a valid time |
135 | connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)), | 136 | connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)), |
136 | this, SLOT(startTimeChanged(QTime))); | 137 | this, SLOT(startTimeChanged(QTime))); |
137 | connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)), | 138 | connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)), |
138 | this, SLOT(endTimeChanged(QTime))); | 139 | this, SLOT(endTimeChanged(QTime))); |
139 | 140 | ||
140 | // date widgets are checked if they contain a valid date | 141 | // date widgets are checked if they contain a valid date |
141 | connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), | 142 | connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), |
142 | this, SLOT(startDateChanged(QDate))); | 143 | this, SLOT(startDateChanged(QDate))); |
143 | connect(mEndDateEdit, SIGNAL(dateChanged(QDate)), | 144 | connect(mEndDateEdit, SIGNAL(dateChanged(QDate)), |
144 | this, SLOT(endDateChanged(QDate))); | 145 | this, SLOT(endDateChanged(QDate))); |
145 | connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(sTimeChanged(QTime))); | 146 | connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(sTimeChanged(QTime))); |
146 | connect(mEndDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(eTimeChanged(QTime))); | 147 | connect(mEndDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(eTimeChanged(QTime))); |
147 | } | 148 | } |
148 | 149 | ||
149 | void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout) | 150 | void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout) |
150 | { | 151 | { |
151 | QBoxLayout *classLayout = new QHBoxLayout(topLayout); | 152 | QBoxLayout *classLayout = new QHBoxLayout(topLayout); |
152 | 153 | ||
153 | QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent); | 154 | QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent); |
154 | classLayout->addWidget(freeTimeLabel); | 155 | classLayout->addWidget(freeTimeLabel); |
155 | 156 | ||
156 | mFreeTimeCombo = new QComboBox(false, parent); | 157 | mFreeTimeCombo = new QComboBox(false, parent); |
157 | mFreeTimeCombo->insertItem(i18n("Busy")); | 158 | mFreeTimeCombo->insertItem(i18n("Busy")); |
158 | mFreeTimeCombo->insertItem(i18n("Free")); | 159 | mFreeTimeCombo->insertItem(i18n("Free")); |
159 | classLayout->addWidget(mFreeTimeCombo); | 160 | classLayout->addWidget(mFreeTimeCombo); |
160 | } | 161 | } |
161 | 162 | ||
162 | void KOEditorGeneralEvent::timeStuffDisable(bool disable) | 163 | void KOEditorGeneralEvent::timeStuffDisable(bool disable) |
163 | { | 164 | { |
164 | mStartTimeEdit->setEnabled( !disable ); | 165 | mStartTimeEdit->setEnabled( !disable ); |
165 | mEndTimeEdit->setEnabled( !disable ); | 166 | mEndTimeEdit->setEnabled( !disable ); |
166 | 167 | ||
167 | setDuration(); | 168 | setDuration(); |
168 | emitDateTimeStr(); | 169 | emitDateTimeStr(); |
169 | } | 170 | } |
170 | 171 | ||
171 | void KOEditorGeneralEvent::dontAssociateTime(bool noTime) | 172 | void KOEditorGeneralEvent::dontAssociateTime(bool noTime) |
172 | { | 173 | { |
173 | timeStuffDisable(noTime); | 174 | timeStuffDisable(noTime); |
174 | //if(alarmButton->isChecked()) alarmStuffDisable(noTime); | 175 | //if(alarmButton->isChecked()) alarmStuffDisable(noTime); |
175 | allDayChanged(noTime); | 176 | allDayChanged(noTime); |
176 | } | 177 | } |
177 | 178 | ||
178 | void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end) | 179 | void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end) |
179 | { | 180 | { |
180 | // kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl; | 181 | // kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl; |
181 | if ( !mTemplate ) | 182 | if ( !mTemplate ) |
182 | mStartDateEdit->setDate(start.date()); | 183 | mStartDateEdit->setDate(start.date()); |
183 | // KTimeEdit seems to emit some signals when setTime() is called. | 184 | // KTimeEdit seems to emit some signals when setTime() is called. |
184 | mStartTimeEdit->blockSignals( true ); | 185 | mStartTimeEdit->blockSignals( true ); |
185 | mStartTimeEdit->setTime(start.time()); | 186 | mStartTimeEdit->setTime(start.time()); |
186 | mStartTimeEdit->blockSignals( false ); | 187 | mStartTimeEdit->blockSignals( false ); |
187 | if ( !mTemplate ) | 188 | if ( !mTemplate ) |
188 | mEndDateEdit->setDate(end.date()); | 189 | mEndDateEdit->setDate(end.date()); |
189 | mEndTimeEdit->setTime(end.time()); | 190 | mEndTimeEdit->setTime(end.time()); |
190 | 191 | ||
191 | mCurrStartDateTime = start; | 192 | mCurrStartDateTime = start; |
192 | mCurrEndDateTime = end; | 193 | mCurrEndDateTime = end; |
193 | 194 | ||
194 | setDuration(); | 195 | setDuration(); |
195 | emitDateTimeStr(); | 196 | emitDateTimeStr(); |
196 | } | 197 | } |
197 | 198 | ||
198 | void KOEditorGeneralEvent::sTimeChanged(QTime ti) | 199 | void KOEditorGeneralEvent::sTimeChanged(QTime ti) |
199 | { | 200 | { |
200 | mStartTimeEdit->setTime( ti ); | 201 | mStartTimeEdit->setTime( ti ); |
201 | startTimeChanged ( ti); | 202 | startTimeChanged ( ti); |
202 | } | 203 | } |
203 | void KOEditorGeneralEvent::eTimeChanged(QTime ti ) | 204 | void KOEditorGeneralEvent::eTimeChanged(QTime ti ) |
204 | { | 205 | { |
205 | mEndTimeEdit->setTime( ti ); | 206 | mEndTimeEdit->setTime( ti ); |
206 | endTimeChanged( ti ); | 207 | endTimeChanged( ti ); |
207 | } | 208 | } |
208 | void KOEditorGeneralEvent::startTimeChanged(QTime newtime) | 209 | void KOEditorGeneralEvent::startTimeChanged(QTime newtime) |
209 | { | 210 | { |
210 | 211 | ||
211 | int secsep = mCurrStartDateTime.secsTo(mCurrEndDateTime); | 212 | int secsep = mCurrStartDateTime.secsTo(mCurrEndDateTime); |
212 | 213 | ||
213 | mCurrStartDateTime = QDateTime( mStartDateEdit->date(), QTime(newtime.hour(),newtime.minute(),0) ); | 214 | mCurrStartDateTime = QDateTime( mStartDateEdit->date(), QTime(newtime.hour(),newtime.minute(),0) ); |
214 | // adjust end time so that the event has the same duration as before. | 215 | // adjust end time so that the event has the same duration as before. |
215 | if( secsep > 0 ) | 216 | if( secsep > 0 ) |
216 | mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep); | 217 | mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep); |
217 | mEndTimeEdit->setTime(mCurrEndDateTime.time()); | 218 | mEndTimeEdit->setTime(mCurrEndDateTime.time()); |
218 | mEndDateEdit->setDate(mCurrEndDateTime.date()); | 219 | mEndDateEdit->setDate(mCurrEndDateTime.date()); |
219 | 220 | ||
220 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); | 221 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); |
221 | } | 222 | } |
222 | 223 | ||
223 | void KOEditorGeneralEvent::endTimeChanged(QTime newtime) | 224 | void KOEditorGeneralEvent::endTimeChanged(QTime newtime) |
224 | { | 225 | { |
225 | 226 | ||
226 | mCurrEndDateTime = QDateTime ( mEndDateEdit->date(), QTime(newtime.hour(),newtime.minute(),0)); | 227 | mCurrEndDateTime = QDateTime ( mEndDateEdit->date(), QTime(newtime.hour(),newtime.minute(),0)); |
227 | 228 | ||
228 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); | 229 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); |
229 | } | 230 | } |
230 | 231 | ||
231 | void KOEditorGeneralEvent::startDateChanged(QDate newdate) | 232 | void KOEditorGeneralEvent::startDateChanged(QDate newdate) |
232 | { | 233 | { |
233 | int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime); | 234 | int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime); |
234 | 235 | ||
235 | mCurrStartDateTime.setDate(newdate); | 236 | mCurrStartDateTime.setDate(newdate); |
236 | 237 | ||
237 | // adjust end date so that the event has the same duration as before | 238 | // adjust end date so that the event has the same duration as before |
238 | mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep)); | 239 | mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep)); |
239 | mEndDateEdit->setDate(mCurrEndDateTime.date()); | 240 | mEndDateEdit->setDate(mCurrEndDateTime.date()); |
240 | qDebug("KOEditorGeneralEvent::startDateChanged "); | 241 | qDebug("KOEditorGeneralEvent::startDateChanged "); |
241 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); | 242 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); |
242 | } | 243 | } |
243 | 244 | ||
244 | void KOEditorGeneralEvent::endDateChanged(QDate newdate) | 245 | void KOEditorGeneralEvent::endDateChanged(QDate newdate) |
245 | { | 246 | { |
246 | QDateTime newdt(newdate, mCurrEndDateTime.time()); | 247 | QDateTime newdt(newdate, mCurrEndDateTime.time()); |
247 | 248 | ||
248 | if(newdt < mCurrStartDateTime) { | 249 | if(newdt < mCurrStartDateTime) { |
249 | // oops, we can't let that happen. | 250 | // oops, we can't let that happen. |
250 | newdt = mCurrStartDateTime; | 251 | newdt = mCurrStartDateTime; |
251 | mEndDateEdit->setDate(newdt.date()); | 252 | mEndDateEdit->setDate(newdt.date()); |
252 | mEndTimeEdit->setTime(newdt.time()); | 253 | mEndTimeEdit->setTime(newdt.time()); |
253 | } | 254 | } |
254 | mCurrEndDateTime = newdt; | 255 | mCurrEndDateTime = newdt; |
255 | 256 | ||
256 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); | 257 | emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); |
257 | } | 258 | } |
258 | 259 | ||
259 | void KOEditorGeneralEvent::setDefaults(QDateTime from,QDateTime to,bool allDay) | 260 | void KOEditorGeneralEvent::setDefaults(QDateTime from,QDateTime to,bool allDay) |
260 | { | 261 | { |
261 | mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); | 262 | mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); |
262 | mLocationEdit->load(KOLocationBox::LOCATION); | 263 | mLocationEdit->load(KOLocationBox::LOCATION); |
263 | KOEditorGeneral::setDefaults(allDay); | 264 | KOEditorGeneral::setDefaults(allDay); |
264 | 265 | ||
265 | mNoTimeButton->setChecked(allDay); | 266 | mNoTimeButton->setChecked(allDay); |
266 | timeStuffDisable(allDay); | 267 | timeStuffDisable(allDay); |
267 | mFreeTimeCombo->setCurrentItem( 0 ); | 268 | mFreeTimeCombo->setCurrentItem( 0 ); |
268 | setDateTimes(from,to); | 269 | setDateTimes(from,to); |
269 | } | 270 | } |
270 | 271 | ||
271 | void KOEditorGeneralEvent::readEvent( Event *event, bool tmpl ) | 272 | void KOEditorGeneralEvent::readEvent( Event *event, bool tmpl ) |
272 | { | 273 | { |
273 | QString tmpStr; | 274 | QString tmpStr; |
274 | 275 | ||
275 | mTemplate = tmpl; | 276 | mTemplate = tmpl; |
276 | // the rest is for the events only | 277 | // the rest is for the events only |
277 | mNoTimeButton->setChecked(event->doesFloat()); | 278 | mNoTimeButton->setChecked(event->doesFloat()); |
278 | timeStuffDisable(event->doesFloat()); | 279 | timeStuffDisable(event->doesFloat()); |
279 | 280 | ||
280 | setDateTimes(event->dtStart(),event->dtEnd()); | 281 | setDateTimes(event->dtStart(),event->dtEnd()); |
281 | 282 | ||
282 | mTemplate = false; | 283 | mTemplate = false; |
283 | switch( event->transparency() ) { | 284 | switch( event->transparency() ) { |
284 | case Event::Transparent: | 285 | case Event::Transparent: |
285 | mFreeTimeCombo->setCurrentItem(1); | 286 | mFreeTimeCombo->setCurrentItem(1); |
286 | break; | 287 | break; |
287 | case Event::Opaque: | 288 | case Event::Opaque: |
288 | mFreeTimeCombo->setCurrentItem(0); | 289 | mFreeTimeCombo->setCurrentItem(0); |
289 | break; | 290 | break; |
290 | } | 291 | } |
291 | 292 | ||
292 | mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); | 293 | mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); |
293 | mLocationEdit->load(KOLocationBox::LOCATION); | 294 | mLocationEdit->load(KOLocationBox::LOCATION); |
294 | readIncidence(event); | 295 | readIncidence(event); |
295 | } | 296 | } |
296 | 297 | ||
297 | void KOEditorGeneralEvent::writeEvent(Event *event) | 298 | void KOEditorGeneralEvent::writeEvent(Event *event) |
298 | { | 299 | { |
299 | // kdDebug() << "KOEditorGeneralEvent::writeEvent()" << endl; | 300 | // kdDebug() << "KOEditorGeneralEvent::writeEvent()" << endl; |
300 | 301 | ||
301 | writeIncidence(event); | 302 | writeIncidence(event); |
302 | 303 | ||
303 | QDate tmpDate; | 304 | QDate tmpDate; |
304 | QTime tmpTime; | 305 | QTime tmpTime; |
305 | QDateTime tmpDT; | 306 | QDateTime tmpDT; |
306 | 307 | ||
307 | // temp. until something better happens. | 308 | // temp. until something better happens. |
308 | QString tmpStr; | 309 | QString tmpStr; |
309 | 310 | ||
310 | if (mNoTimeButton->isChecked()) { | 311 | if (mNoTimeButton->isChecked()) { |
311 | event->setFloats(true); | 312 | event->setFloats(true); |
312 | // need to change this. | 313 | // need to change this. |
313 | tmpDate = mStartDateEdit->date(); | 314 | tmpDate = mStartDateEdit->date(); |
314 | tmpTime.setHMS(0,0,0); | 315 | tmpTime.setHMS(0,0,0); |
315 | tmpDT.setDate(tmpDate); | 316 | tmpDT.setDate(tmpDate); |
316 | tmpDT.setTime(tmpTime); | 317 | tmpDT.setTime(tmpTime); |
317 | event->setDtStart(tmpDT); | 318 | event->setDtStart(tmpDT); |
318 | 319 | ||
319 | tmpDate = mEndDateEdit->date(); | 320 | tmpDate = mEndDateEdit->date(); |
320 | tmpTime.setHMS(0,0,0); | 321 | tmpTime.setHMS(0,0,0); |
321 | tmpDT.setDate(tmpDate); | 322 | tmpDT.setDate(tmpDate); |
322 | tmpDT.setTime(tmpTime); | 323 | tmpDT.setTime(tmpTime); |
323 | event->setDtEnd(tmpDT); | 324 | event->setDtEnd(tmpDT); |
324 | } else { | 325 | } else { |
325 | event->setFloats(false); | 326 | event->setFloats(false); |
326 | 327 | ||
327 | // set date/time end | 328 | // set date/time end |
328 | tmpDate = mEndDateEdit->date(); | 329 | tmpDate = mEndDateEdit->date(); |
329 | tmpTime = mEndTimeEdit->getTime(); | 330 | tmpTime = mEndTimeEdit->getTime(); |
330 | tmpDT.setDate(tmpDate); | 331 | tmpDT.setDate(tmpDate); |
331 | tmpDT.setTime(tmpTime); | 332 | tmpDT.setTime(tmpTime); |
332 | event->setDtEnd(tmpDT); | 333 | event->setDtEnd(tmpDT); |
333 | 334 | ||
334 | // set date/time start | 335 | // set date/time start |
335 | tmpDate = mStartDateEdit->date(); | 336 | tmpDate = mStartDateEdit->date(); |
336 | tmpTime = mStartTimeEdit->getTime(); | 337 | tmpTime = mStartTimeEdit->getTime(); |
337 | tmpDT.setDate(tmpDate); | 338 | tmpDT.setDate(tmpDate); |
338 | tmpDT.setTime(tmpTime); | 339 | tmpDT.setTime(tmpTime); |
339 | event->setDtStart(tmpDT); | 340 | event->setDtStart(tmpDT); |
340 | } // check for float | 341 | } // check for float |
341 | mSummaryEdit->save(KOLocationBox::SUMMARYEVENT); | 342 | mSummaryEdit->save(KOLocationBox::SUMMARYEVENT); |
342 | 343 | ||
343 | event->setTransparency(mFreeTimeCombo->currentItem() > 0 | 344 | event->setTransparency(mFreeTimeCombo->currentItem() > 0 |
344 | ? KCal::Event::Transparent | 345 | ? KCal::Event::Transparent |
345 | : KCal::Event::Opaque); | 346 | : KCal::Event::Opaque); |
346 | 347 | ||
347 | // kdDebug() << "KOEditorGeneralEvent::writeEvent() done" << endl; | 348 | // kdDebug() << "KOEditorGeneralEvent::writeEvent() done" << endl; |
348 | } | 349 | } |
349 | 350 | ||
350 | void KOEditorGeneralEvent::setDuration() | 351 | void KOEditorGeneralEvent::setDuration() |
351 | { | 352 | { |
352 | QString tmpStr = "", catStr; | 353 | QString tmpStr = "", catStr; |
353 | int hourdiff, minutediff; | 354 | int hourdiff, minutediff; |
354 | // end<date is an accepted temporary state while typing, but don't show | 355 | // end<date is an accepted temporary state while typing, but don't show |
355 | // any duration if this happens | 356 | // any duration if this happens |
356 | if(mCurrEndDateTime >= mCurrStartDateTime) { | 357 | if(mCurrEndDateTime >= mCurrStartDateTime) { |
357 | 358 | ||
358 | if (mNoTimeButton->isChecked()) { | 359 | if (mNoTimeButton->isChecked()) { |
359 | int daydiff = mCurrStartDateTime.date().daysTo(mCurrEndDateTime.date()) + 1; | 360 | int daydiff = mCurrStartDateTime.date().daysTo(mCurrEndDateTime.date()) + 1; |
360 | tmpStr = i18n("Duration: "); | 361 | tmpStr = i18n("Duration: "); |
361 | tmpStr.append(i18n("1 Day","%n Days",daydiff)); | 362 | tmpStr.append(i18n("1 Day","%n Days",daydiff)); |
362 | } else { | 363 | } else { |
363 | int secto = mCurrStartDateTime.secsTo( mCurrEndDateTime ); | 364 | int secto = mCurrStartDateTime.secsTo( mCurrEndDateTime ); |
364 | hourdiff = secto / 3600; | 365 | hourdiff = secto / 3600; |
365 | minutediff = (secto/60 ) % 60; | 366 | minutediff = (secto/60 ) % 60; |
366 | if (hourdiff || minutediff){ | 367 | if (hourdiff || minutediff){ |
367 | tmpStr = i18n("Duration: "); | 368 | tmpStr = i18n("Duration: "); |
368 | if (hourdiff){ | 369 | if (hourdiff){ |
369 | catStr = i18n("1 h","%n h",hourdiff); | 370 | catStr = i18n("1 h","%n h",hourdiff); |
370 | tmpStr.append(catStr); | 371 | tmpStr.append(catStr); |
371 | } | 372 | } |
372 | if (hourdiff && minutediff){ | 373 | if (hourdiff && minutediff){ |
373 | tmpStr += i18n(", "); | 374 | tmpStr += i18n(", "); |
374 | } | 375 | } |
375 | if (minutediff){ | 376 | if (minutediff){ |
376 | catStr = i18n("1 min","%n min",minutediff); | 377 | catStr = i18n("1 min","%n min",minutediff); |
377 | tmpStr += catStr; | 378 | tmpStr += catStr; |
378 | } | 379 | } |
379 | } else tmpStr = ""; | 380 | } else tmpStr = ""; |
380 | } | 381 | } |
381 | } | 382 | } |
382 | mDurationLabel->setText(tmpStr); | 383 | mDurationLabel->setText(tmpStr); |
383 | } | 384 | } |
384 | 385 | ||
385 | void KOEditorGeneralEvent::emitDateTimeStr() | 386 | void KOEditorGeneralEvent::emitDateTimeStr() |
386 | { | 387 | { |
387 | KLocale *l = KGlobal::locale(); | 388 | KLocale *l = KGlobal::locale(); |
388 | QString startString = ""; | 389 | QString startString = ""; |
389 | if ( mCurrStartDateTime.date() < mCurrEndDateTime.date() ) { | 390 | if ( mCurrStartDateTime.date() < mCurrEndDateTime.date() ) { |
390 | if ( mNoTimeButton->isChecked() ) { | 391 | if ( mNoTimeButton->isChecked() ) { |
391 | startString = i18n("From: ") + l->formatDate(mCurrStartDateTime.date() ); | 392 | startString = i18n("From: ") + l->formatDate(mCurrStartDateTime.date() ); |
392 | startString += "\n"+i18n("To: ")+ l->formatDate(mCurrEndDateTime.date()); | 393 | startString += "\n"+i18n("To: ")+ l->formatDate(mCurrEndDateTime.date()); |
393 | 394 | ||
394 | } else { | 395 | } else { |
395 | startString = i18n("From: ") +l->formatDateTime(mCurrStartDateTime, false); | 396 | startString = i18n("From: ") +l->formatDateTime(mCurrStartDateTime, false); |
396 | startString += "\n"+i18n("To: ")+l->formatDateTime(mCurrEndDateTime, false); | 397 | startString += "\n"+i18n("To: ")+l->formatDateTime(mCurrEndDateTime, false); |
397 | } | 398 | } |
398 | } else { | 399 | } else { |
399 | if ( mNoTimeButton->isChecked() ) { | 400 | if ( mNoTimeButton->isChecked() ) { |
400 | startString = i18n("On: ") + l->formatDate(mCurrStartDateTime.date() ); | 401 | startString = i18n("On: ") + l->formatDate(mCurrStartDateTime.date() ); |
401 | } else { | 402 | } else { |
402 | startString = i18n("From: ") + KGlobal::locale()->formatTime(mCurrStartDateTime.time())+ | 403 | startString = i18n("From: ") + KGlobal::locale()->formatTime(mCurrStartDateTime.time())+ |
403 | "-"+KGlobal::locale()->formatTime(mCurrEndDateTime.time()); | 404 | "-"+KGlobal::locale()->formatTime(mCurrEndDateTime.time()); |
404 | startString += i18n(" on ")+KGlobal::locale()->formatDate( mCurrStartDateTime.date(), true); | 405 | startString += i18n(" on ")+KGlobal::locale()->formatDate( mCurrStartDateTime.date(), true); |
405 | } | 406 | } |
406 | } | 407 | } |
407 | startString +="\n"+mDurationLabel->text(); | 408 | startString +="\n"+mDurationLabel->text(); |
408 | emit dateTimeStrChanged(startString); | 409 | emit dateTimeStrChanged(startString); |
409 | } | 410 | } |
410 | 411 | ||
411 | bool KOEditorGeneralEvent::validateInput() | 412 | bool KOEditorGeneralEvent::validateInput() |
412 | { | 413 | { |
413 | 414 | ||
414 | if (!mStartDateEdit->inputIsValid()) { | 415 | if (!mStartDateEdit->inputIsValid()) { |
415 | KMessageBox::sorry( 0, | 416 | KMessageBox::sorry( 0, |
416 | i18n("Please specify a valid start date,\nfor example '%1'.") | 417 | i18n("Please specify a valid start date,\nfor example '%1'.") |
417 | .arg( KGlobal::locale()->formatDate( QDate::currentDate(), true ) ) ); | 418 | .arg( KGlobal::locale()->formatDate( QDate::currentDate(), true ) ) ); |
418 | return false; | 419 | return false; |
419 | } | 420 | } |
420 | 421 | ||
421 | if (!mEndDateEdit->inputIsValid()) { | 422 | if (!mEndDateEdit->inputIsValid()) { |
422 | KMessageBox::sorry( 0, | 423 | KMessageBox::sorry( 0, |
423 | i18n("Please specify a valid end date,\nfor example '%1'.") | 424 | i18n("Please specify a valid end date,\nfor example '%1'.") |
424 | .arg( KGlobal::locale()->formatDate( QDate::currentDate(), true ) ) ); | 425 | .arg( KGlobal::locale()->formatDate( QDate::currentDate(), true ) ) ); |
425 | return false; | 426 | return false; |
426 | } | 427 | } |
427 | 428 | ||
428 | QDateTime startDt,endDt; | 429 | QDateTime startDt,endDt; |
429 | startDt.setDate(mStartDateEdit->date()); | 430 | startDt.setDate(mStartDateEdit->date()); |
430 | endDt.setDate(mEndDateEdit->date()); | 431 | endDt.setDate(mEndDateEdit->date()); |
431 | if (!mNoTimeButton->isChecked()) { | 432 | if (!mNoTimeButton->isChecked()) { |
432 | startDt.setTime(mStartTimeEdit->getTime()); | 433 | startDt.setTime(mStartTimeEdit->getTime()); |
433 | endDt.setTime(mEndTimeEdit->getTime()); | 434 | endDt.setTime(mEndTimeEdit->getTime()); |
434 | } | 435 | } |
435 | 436 | ||
436 | if (startDt > endDt) { | 437 | if (startDt > endDt) { |
437 | KMessageBox::sorry(0,i18n("The event ends before it starts.\n" | 438 | KMessageBox::sorry(0,i18n("The event ends before it starts.\n" |
438 | "Please correct dates and times.")); | 439 | "Please correct dates and times.")); |
439 | return false; | 440 | return false; |
440 | } | 441 | } |
441 | 442 | ||
442 | return KOEditorGeneral::validateInput(); | 443 | return KOEditorGeneral::validateInput(); |
443 | } | 444 | } |
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index 0a734ee..965cf47 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp | |||
@@ -1,476 +1,476 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qfiledialog.h> | 25 | #include <qfiledialog.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qbuttongroup.h> | 28 | #include <qbuttongroup.h> |
29 | #include <qvgroupbox.h> | 29 | #include <qvgroupbox.h> |
30 | #include <qwidgetstack.h> | 30 | #include <qwidgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | 33 | ||
34 | #include <kglobal.h> | 34 | #include <kglobal.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kiconloader.h> | 36 | #include <kiconloader.h> |
37 | #include <kmessagebox.h> | 37 | #include <kmessagebox.h> |
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <krestrictedline.h> | 39 | #include <krestrictedline.h> |
40 | #include <kstandarddirs.h> | 40 | #include <kstandarddirs.h> |
41 | #include <kfiledialog.h> | 41 | #include <kfiledialog.h> |
42 | #include <kdialog.h> | 42 | #include <kdialog.h> |
43 | 43 | ||
44 | #include <libkcal/todo.h> | 44 | #include <libkcal/todo.h> |
45 | 45 | ||
46 | #include <libkdepim/kdateedit.h> | 46 | #include <libkdepim/kdateedit.h> |
47 | 47 | ||
48 | #include "koprefs.h" | 48 | #include "koprefs.h" |
49 | #include "ktimeedit.h" | 49 | #include "ktimeedit.h" |
50 | 50 | ||
51 | #include "koeditorgeneraltodo.h" | 51 | #include "koeditorgeneraltodo.h" |
52 | #include "kolocationbox.h" | 52 | #include "kolocationbox.h" |
53 | 53 | ||
54 | KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, | 54 | KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, |
55 | const char* name) | 55 | const char* name) |
56 | : KOEditorGeneral( parent, name) | 56 | : KOEditorGeneral( parent, name) |
57 | { | 57 | { |
58 | } | 58 | } |
59 | 59 | ||
60 | KOEditorGeneralTodo::~KOEditorGeneralTodo() | 60 | KOEditorGeneralTodo::~KOEditorGeneralTodo() |
61 | { | 61 | { |
62 | } | 62 | } |
63 | 63 | ||
64 | void KOEditorGeneralTodo::finishSetup() | 64 | void KOEditorGeneralTodo::finishSetup() |
65 | { | 65 | { |
66 | 66 | ||
67 | // QWidget::setTabOrder(mSummaryEdit, mLocationEdit); | 67 | // QWidget::setTabOrder(mSummaryEdit, mLocationEdit); |
68 | // QWidget::setTabOrder(mLocationEdit, mDueCheck); | 68 | // QWidget::setTabOrder(mLocationEdit, mDueCheck); |
69 | // QWidget::setTabOrder(mDueCheck, mDueDateEdit); | 69 | // QWidget::setTabOrder(mDueCheck, mDueDateEdit); |
70 | // QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); | 70 | // QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); |
71 | // QWidget::setTabOrder(mDueTimeEdit, mStartCheck); | 71 | // QWidget::setTabOrder(mDueTimeEdit, mStartCheck); |
72 | // QWidget::setTabOrder(mStartCheck, mStartDateEdit); | 72 | // QWidget::setTabOrder(mStartCheck, mStartDateEdit); |
73 | // QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); | 73 | // QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); |
74 | // QWidget::setTabOrder(mStartTimeEdit, mTimeButton); | 74 | // QWidget::setTabOrder(mStartTimeEdit, mTimeButton); |
75 | // QWidget::setTabOrder(mTimeButton, mCompletedCombo); | 75 | // QWidget::setTabOrder(mTimeButton, mCompletedCombo); |
76 | // QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); | 76 | // QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); |
77 | // QWidget::setTabOrder(mPriorityCombo, mAlarmButton); | 77 | // QWidget::setTabOrder(mPriorityCombo, mAlarmButton); |
78 | // QWidget::setTabOrder(mAlarmButton, mCategoriesButton); | 78 | // QWidget::setTabOrder(mAlarmButton, mCategoriesButton); |
79 | // QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); | 79 | // QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); |
80 | // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); | 80 | // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); |
81 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 81 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
82 | mSummaryEdit->setFocus(); | 82 | mSummaryEdit->setFocus(); |
83 | } | 83 | } |
84 | 84 | ||
85 | void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) | 85 | void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) |
86 | { | 86 | { |
87 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); | 87 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); |
88 | 88 | ||
89 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, | 89 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, |
90 | i18n("Date && Time"),parent); | 90 | i18n("Date && Time"),parent); |
91 | timeLayout->addWidget(timeGroupBox); | 91 | timeLayout->addWidget(timeGroupBox); |
92 | timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() ); | 92 | timeGroupBox->layout()->setSpacing( KDialog::spacingHint()-2 ); |
93 | timeGroupBox->layout()->setMargin( KDialog::marginHint() ); | 93 | timeGroupBox->layout()->setMargin( KDialog::marginHint() ); |
94 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); | 94 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); |
95 | 95 | ||
96 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); | 96 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); |
97 | layoutTimeBox->setSpacing(KDialog::spacingHintSmall()); | 97 | layoutTimeBox->setSpacing(KDialog::spacingHintSmall()); |
98 | layoutTimeBox->setColStretch( 1, 1 ); | 98 | layoutTimeBox->setColStretch( 1, 1 ); |
99 | 99 | ||
100 | mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); | 100 | mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); |
101 | layoutTimeBox->addWidget(mDueCheck,1,0); | 101 | layoutTimeBox->addWidget(mDueCheck,1,0); |
102 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); | 102 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); |
103 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); | 103 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); |
104 | 104 | ||
105 | 105 | ||
106 | mDueDateEdit = new KDateEdit(timeBoxFrame); | 106 | mDueDateEdit = new KDateEdit(timeBoxFrame); |
107 | layoutTimeBox->addWidget(mDueDateEdit,1,1); | 107 | layoutTimeBox->addWidget(mDueDateEdit,1,1); |
108 | 108 | ||
109 | mDueTimeEdit = new KOTimeEdit(timeBoxFrame); | 109 | mDueTimeEdit = new KOTimeEdit(timeBoxFrame); |
110 | layoutTimeBox->addWidget(mDueTimeEdit,1,2); | 110 | layoutTimeBox->addWidget(mDueTimeEdit,1,2); |
111 | 111 | ||
112 | 112 | ||
113 | mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); | 113 | mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); |
114 | layoutTimeBox->addWidget(mStartCheck,0,0); | 114 | layoutTimeBox->addWidget(mStartCheck,0,0); |
115 | connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); | 115 | connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); |
116 | 116 | ||
117 | mStartDateEdit = new KDateEdit(timeBoxFrame); | 117 | mStartDateEdit = new KDateEdit(timeBoxFrame); |
118 | layoutTimeBox->addWidget(mStartDateEdit,0,1); | 118 | layoutTimeBox->addWidget(mStartDateEdit,0,1); |
119 | 119 | ||
120 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); | 120 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); |
121 | layoutTimeBox->addWidget(mStartTimeEdit,0,2); | 121 | layoutTimeBox->addWidget(mStartTimeEdit,0,2); |
122 | 122 | ||
123 | 123 | ||
124 | mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); | 124 | mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); |
125 | layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); | 125 | layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); |
126 | 126 | ||
127 | connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); | 127 | connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); |
128 | connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime))); | 128 | connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime))); |
129 | connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); | 129 | connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); |
130 | connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), | 130 | connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), |
131 | this, SLOT(startDateChanged(QDate))); | 131 | this, SLOT(startDateChanged(QDate))); |
132 | // some more layouting | 132 | // some more layouting |
133 | //layoutTimeBox->setColStretch(3,1); | 133 | //layoutTimeBox->setColStretch(3,1); |
134 | } | 134 | } |
135 | 135 | ||
136 | 136 | ||
137 | void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) | 137 | void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) |
138 | { | 138 | { |
139 | mCompletedCombo = new QComboBox(parent); | 139 | mCompletedCombo = new QComboBox(parent); |
140 | // xgettext:no-c-format | 140 | // xgettext:no-c-format |
141 | mCompletedCombo->insertItem(i18n(" 0 %")); | 141 | mCompletedCombo->insertItem(i18n(" 0 %")); |
142 | // xgettext:no-c-format | 142 | // xgettext:no-c-format |
143 | mCompletedCombo->insertItem(i18n(" 20 %")); | 143 | mCompletedCombo->insertItem(i18n(" 20 %")); |
144 | // xgettext:no-c-format | 144 | // xgettext:no-c-format |
145 | mCompletedCombo->insertItem(i18n(" 40 %")); | 145 | mCompletedCombo->insertItem(i18n(" 40 %")); |
146 | // xgettext:no-c-format | 146 | // xgettext:no-c-format |
147 | mCompletedCombo->insertItem(i18n(" 60 %")); | 147 | mCompletedCombo->insertItem(i18n(" 60 %")); |
148 | // xgettext:no-c-format | 148 | // xgettext:no-c-format |
149 | mCompletedCombo->insertItem(i18n(" 80 %")); | 149 | mCompletedCombo->insertItem(i18n(" 80 %")); |
150 | // xgettext:no-c-format | 150 | // xgettext:no-c-format |
151 | mCompletedCombo->insertItem(i18n("100 %")); | 151 | mCompletedCombo->insertItem(i18n("100 %")); |
152 | connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); | 152 | connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); |
153 | topLayout->addWidget(mCompletedCombo); | 153 | topLayout->addWidget(mCompletedCombo); |
154 | 154 | ||
155 | mCompletedLabel = new QLabel(i18n("completed"),parent); | 155 | mCompletedLabel = new QLabel(i18n("completed"),parent); |
156 | topLayout->addWidget(mCompletedLabel); | 156 | topLayout->addWidget(mCompletedLabel); |
157 | 157 | ||
158 | mCompleteDateEdit = new KDateEdit(parent); | 158 | mCompleteDateEdit = new KDateEdit(parent); |
159 | topLayout->addWidget(mCompleteDateEdit ); | 159 | topLayout->addWidget(mCompleteDateEdit ); |
160 | 160 | ||
161 | mCompleteTimeEdit = new KOTimeEdit(parent); | 161 | mCompleteTimeEdit = new KOTimeEdit(parent); |
162 | topLayout->addWidget( mCompleteTimeEdit); | 162 | topLayout->addWidget( mCompleteTimeEdit); |
163 | 163 | ||
164 | mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); | 164 | mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); |
165 | mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); | 165 | mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); |
166 | connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime))); | 166 | connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime))); |
167 | 167 | ||
168 | if ( QApplication::desktop()->width() <= 480 ) { | 168 | if ( QApplication::desktop()->width() <= 480 ) { |
169 | if ( QApplication::desktop()->width() < 320 ) | 169 | if ( QApplication::desktop()->width() < 320 ) |
170 | mCompleteDateEdit->setMaximumWidth( 85 ); | 170 | mCompleteDateEdit->setMaximumWidth( 85 ); |
171 | else | 171 | else |
172 | mCompleteDateEdit->setMaximumWidth( 140 ); | 172 | mCompleteDateEdit->setMaximumWidth( 140 ); |
173 | topLayout->setSpacing( 0 ); | 173 | topLayout->setSpacing( 0 ); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | 176 | ||
177 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) | 177 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) |
178 | { | 178 | { |
179 | 179 | ||
180 | QHBox* h = new QHBox ( parent ); | 180 | QHBox* h = new QHBox ( parent ); |
181 | topLayout->addWidget( h ); | 181 | topLayout->addWidget( h ); |
182 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); | 182 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); |
183 | // topLayout->addWidget(priorityLabel); | 183 | // topLayout->addWidget(priorityLabel); |
184 | mPriorityCombo = new QComboBox( h ); | 184 | mPriorityCombo = new QComboBox( h ); |
185 | mPriorityCombo->insertItem(i18n("1 (high)")); | 185 | mPriorityCombo->insertItem(i18n("1 (high)")); |
186 | mPriorityCombo->insertItem(i18n("2")); | 186 | mPriorityCombo->insertItem(i18n("2")); |
187 | mPriorityCombo->insertItem(i18n("3")); | 187 | mPriorityCombo->insertItem(i18n("3")); |
188 | mPriorityCombo->insertItem(i18n("4")); | 188 | mPriorityCombo->insertItem(i18n("4")); |
189 | mPriorityCombo->insertItem(i18n("5 (low)")); | 189 | mPriorityCombo->insertItem(i18n("5 (low)")); |
190 | //topLayout->addWidget(mPriorityCombo); | 190 | //topLayout->addWidget(mPriorityCombo); |
191 | } | 191 | } |
192 | 192 | ||
193 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) | 193 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) |
194 | { | 194 | { |
195 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); | 195 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); |
196 | 196 | ||
197 | initCompletion( parent, statusLayout ); | 197 | initCompletion( parent, statusLayout ); |
198 | 198 | ||
199 | statusLayout->addStretch( 1 ); | 199 | statusLayout->addStretch( 1 ); |
200 | 200 | ||
201 | initPriority( parent, statusLayout ); | 201 | initPriority( parent, statusLayout ); |
202 | } | 202 | } |
203 | 203 | ||
204 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) | 204 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) |
205 | { | 205 | { |
206 | 206 | ||
207 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 207 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
208 | mLocationEdit->load(KOLocationBox::LOCATION); | 208 | mLocationEdit->load(KOLocationBox::LOCATION); |
209 | KOEditorGeneral::setDefaults(allDay); | 209 | KOEditorGeneral::setDefaults(allDay); |
210 | 210 | ||
211 | mTimeButton->setChecked( !allDay ); | 211 | mTimeButton->setChecked( !allDay ); |
212 | if(mTimeButton->isChecked()) { | 212 | if(mTimeButton->isChecked()) { |
213 | mTimeButton->setEnabled(true); | 213 | mTimeButton->setEnabled(true); |
214 | } | 214 | } |
215 | else { | 215 | else { |
216 | mTimeButton->setEnabled(false); | 216 | mTimeButton->setEnabled(false); |
217 | } | 217 | } |
218 | 218 | ||
219 | enableTimeEdits( !allDay ); | 219 | enableTimeEdits( !allDay ); |
220 | if ( due.isValid() ) { | 220 | if ( due.isValid() ) { |
221 | mDueCheck->setChecked(true); | 221 | mDueCheck->setChecked(true); |
222 | enableDueEdit(true); | 222 | enableDueEdit(true); |
223 | alarmDisable(false); | 223 | alarmDisable(false); |
224 | } else { | 224 | } else { |
225 | mDueCheck->setChecked(false); | 225 | mDueCheck->setChecked(false); |
226 | enableDueEdit(false); | 226 | enableDueEdit(false); |
227 | due = QDateTime::currentDateTime().addDays(7); | 227 | due = QDateTime::currentDateTime().addDays(7); |
228 | alarmDisable(true); | 228 | alarmDisable(true); |
229 | } | 229 | } |
230 | 230 | ||
231 | 231 | ||
232 | mStartCheck->setChecked(false); | 232 | mStartCheck->setChecked(false); |
233 | enableStartEdit(false); | 233 | enableStartEdit(false); |
234 | 234 | ||
235 | mDueDateEdit->setDate(due.date()); | 235 | mDueDateEdit->setDate(due.date()); |
236 | mDueTimeEdit->setTime(due.time()); | 236 | mDueTimeEdit->setTime(due.time()); |
237 | due = due.addDays(-7); | 237 | due = due.addDays(-7); |
238 | mStartDateEdit->setDate(due.date()); | 238 | mStartDateEdit->setDate(due.date()); |
239 | mStartTimeEdit->setTime(due.time()); | 239 | mStartTimeEdit->setTime(due.time()); |
240 | 240 | ||
241 | mPriorityCombo->setCurrentItem(2); | 241 | mPriorityCombo->setCurrentItem(2); |
242 | mCompletedLabel->setText(i18n(" completed"));; | 242 | mCompletedLabel->setText(i18n(" completed"));; |
243 | mCompletedCombo->setCurrentItem(0); | 243 | mCompletedCombo->setCurrentItem(0); |
244 | mCompleteDateEdit->hide(); | 244 | mCompleteDateEdit->hide(); |
245 | mCompleteTimeEdit->hide(); | 245 | mCompleteTimeEdit->hide(); |
246 | } | 246 | } |
247 | 247 | ||
248 | void KOEditorGeneralTodo::readTodo(Todo *todo) | 248 | void KOEditorGeneralTodo::readTodo(Todo *todo) |
249 | { | 249 | { |
250 | 250 | ||
251 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 251 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
252 | mLocationEdit->load(KOLocationBox::LOCATION); | 252 | mLocationEdit->load(KOLocationBox::LOCATION); |
253 | KOEditorGeneral::readIncidence(todo); | 253 | KOEditorGeneral::readIncidence(todo); |
254 | 254 | ||
255 | QDateTime dueDT; | 255 | QDateTime dueDT; |
256 | 256 | ||
257 | if (todo->hasDueDate()) { | 257 | if (todo->hasDueDate()) { |
258 | enableAlarmEdit(true); | 258 | enableAlarmEdit(true); |
259 | dueDT = todo->dtDue(); | 259 | dueDT = todo->dtDue(); |
260 | mDueDateEdit->setDate(todo->dtDue().date()); | 260 | mDueDateEdit->setDate(todo->dtDue().date()); |
261 | mDueTimeEdit->setTime(todo->dtDue().time()); | 261 | mDueTimeEdit->setTime(todo->dtDue().time()); |
262 | mDueCheck->setChecked(true); | 262 | mDueCheck->setChecked(true); |
263 | } else { | 263 | } else { |
264 | alarmDisable(true); | 264 | alarmDisable(true); |
265 | mDueDateEdit->setEnabled(false); | 265 | mDueDateEdit->setEnabled(false); |
266 | mDueTimeEdit->setEnabled(false); | 266 | mDueTimeEdit->setEnabled(false); |
267 | mDueDateEdit->setDate(QDate::currentDate()); | 267 | mDueDateEdit->setDate(QDate::currentDate()); |
268 | mDueTimeEdit->setTime(QTime::currentTime()); | 268 | mDueTimeEdit->setTime(QTime::currentTime()); |
269 | mDueCheck->setChecked(false); | 269 | mDueCheck->setChecked(false); |
270 | } | 270 | } |
271 | 271 | ||
272 | if (todo->hasStartDate()) { | 272 | if (todo->hasStartDate()) { |
273 | mStartDateEdit->setDate(todo->dtStart().date()); | 273 | mStartDateEdit->setDate(todo->dtStart().date()); |
274 | mStartTimeEdit->setTime(todo->dtStart().time()); | 274 | mStartTimeEdit->setTime(todo->dtStart().time()); |
275 | mStartCheck->setChecked(true); | 275 | mStartCheck->setChecked(true); |
276 | } else { | 276 | } else { |
277 | mStartDateEdit->setEnabled(false); | 277 | mStartDateEdit->setEnabled(false); |
278 | mStartTimeEdit->setEnabled(false); | 278 | mStartTimeEdit->setEnabled(false); |
279 | mStartDateEdit->setDate(QDate::currentDate()); | 279 | mStartDateEdit->setDate(QDate::currentDate()); |
280 | mStartTimeEdit->setTime(QTime::currentTime()); | 280 | mStartTimeEdit->setTime(QTime::currentTime()); |
281 | mStartCheck->setChecked(false); | 281 | mStartCheck->setChecked(false); |
282 | } | 282 | } |
283 | 283 | ||
284 | mTimeButton->setChecked( !todo->doesFloat() ); | 284 | mTimeButton->setChecked( !todo->doesFloat() ); |
285 | 285 | ||
286 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); | 286 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); |
287 | if (todo->isCompleted() && todo->hasCompletedDate()) { | 287 | if (todo->isCompleted() && todo->hasCompletedDate()) { |
288 | mCompleted = todo->completed(); | 288 | mCompleted = todo->completed(); |
289 | } | 289 | } |
290 | setCompletedDate(); | 290 | setCompletedDate(); |
291 | 291 | ||
292 | mPriorityCombo->setCurrentItem(todo->priority()-1); | 292 | mPriorityCombo->setCurrentItem(todo->priority()-1); |
293 | } | 293 | } |
294 | 294 | ||
295 | void KOEditorGeneralTodo::writeTodo(Todo *todo) | 295 | void KOEditorGeneralTodo::writeTodo(Todo *todo) |
296 | { | 296 | { |
297 | KOEditorGeneral::writeIncidence(todo); | 297 | KOEditorGeneral::writeIncidence(todo); |
298 | 298 | ||
299 | // temp. until something better happens. | 299 | // temp. until something better happens. |
300 | QString tmpStr; | 300 | QString tmpStr; |
301 | 301 | ||
302 | todo->setHasDueDate(mDueCheck->isChecked()); | 302 | todo->setHasDueDate(mDueCheck->isChecked()); |
303 | todo->setHasStartDate(mStartCheck->isChecked()); | 303 | todo->setHasStartDate(mStartCheck->isChecked()); |
304 | 304 | ||
305 | QDate tmpDate; | 305 | QDate tmpDate; |
306 | QTime tmpTime; | 306 | QTime tmpTime; |
307 | QDateTime tmpDT; | 307 | QDateTime tmpDT; |
308 | if ( mTimeButton->isChecked() ) { | 308 | if ( mTimeButton->isChecked() ) { |
309 | todo->setFloats(false); | 309 | todo->setFloats(false); |
310 | 310 | ||
311 | // set due date/time | 311 | // set due date/time |
312 | tmpDate = mDueDateEdit->date(); | 312 | tmpDate = mDueDateEdit->date(); |
313 | tmpTime = mDueTimeEdit->getTime(); | 313 | tmpTime = mDueTimeEdit->getTime(); |
314 | tmpDT.setDate(tmpDate); | 314 | tmpDT.setDate(tmpDate); |
315 | tmpDT.setTime(tmpTime); | 315 | tmpDT.setTime(tmpTime); |
316 | todo->setDtDue(tmpDT); | 316 | todo->setDtDue(tmpDT); |
317 | 317 | ||
318 | // set start date/time | 318 | // set start date/time |
319 | tmpDate = mStartDateEdit->date(); | 319 | tmpDate = mStartDateEdit->date(); |
320 | tmpTime = mStartTimeEdit->getTime(); | 320 | tmpTime = mStartTimeEdit->getTime(); |
321 | tmpDT.setDate(tmpDate); | 321 | tmpDT.setDate(tmpDate); |
322 | tmpDT.setTime(tmpTime); | 322 | tmpDT.setTime(tmpTime); |
323 | todo->setDtStart(tmpDT); | 323 | todo->setDtStart(tmpDT); |
324 | } else { | 324 | } else { |
325 | todo->setFloats(true); | 325 | todo->setFloats(true); |
326 | 326 | ||
327 | // need to change this. | 327 | // need to change this. |
328 | tmpDate = mDueDateEdit->date(); | 328 | tmpDate = mDueDateEdit->date(); |
329 | tmpTime.setHMS(0,0,0); | 329 | tmpTime.setHMS(0,0,0); |
330 | tmpDT.setDate(tmpDate); | 330 | tmpDT.setDate(tmpDate); |
331 | tmpDT.setTime(tmpTime); | 331 | tmpDT.setTime(tmpTime); |
332 | todo->setDtDue(tmpDT); | 332 | todo->setDtDue(tmpDT); |
333 | 333 | ||
334 | tmpDate = mStartDateEdit->date(); | 334 | tmpDate = mStartDateEdit->date(); |
335 | tmpTime.setHMS(0,0,0); | 335 | tmpTime.setHMS(0,0,0); |
336 | tmpDT.setDate(tmpDate); | 336 | tmpDT.setDate(tmpDate); |
337 | tmpDT.setTime(tmpTime); | 337 | tmpDT.setTime(tmpTime); |
338 | todo->setDtStart(tmpDT); | 338 | todo->setDtStart(tmpDT); |
339 | } | 339 | } |
340 | todo->setPriority(mPriorityCombo->currentItem()+1); | 340 | todo->setPriority(mPriorityCombo->currentItem()+1); |
341 | 341 | ||
342 | // set completion state | 342 | // set completion state |
343 | if ( mCompletedCombo->currentItem() == 5 ) { | 343 | if ( mCompletedCombo->currentItem() == 5 ) { |
344 | QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() ); | 344 | QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() ); |
345 | if ( comp.isValid () ) { | 345 | if ( comp.isValid () ) { |
346 | todo->setPercentComplete(100); | 346 | todo->setPercentComplete(100); |
347 | todo->setCompleted(comp); | 347 | todo->setCompleted(comp); |
348 | } else { | 348 | } else { |
349 | todo->setPercentComplete( 100 ); | 349 | todo->setPercentComplete( 100 ); |
350 | if ( mCompleted.isValid() ) | 350 | if ( mCompleted.isValid() ) |
351 | todo->setCompleted(mCompleted); | 351 | todo->setCompleted(mCompleted); |
352 | } | 352 | } |
353 | } else { | 353 | } else { |
354 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); | 354 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); |
355 | } | 355 | } |
356 | 356 | ||
357 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); | 357 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); |
358 | } | 358 | } |
359 | 359 | ||
360 | void KOEditorGeneralTodo::enableDueEdit(bool enable) | 360 | void KOEditorGeneralTodo::enableDueEdit(bool enable) |
361 | { | 361 | { |
362 | mDueDateEdit->setEnabled( enable ); | 362 | mDueDateEdit->setEnabled( enable ); |
363 | 363 | ||
364 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 364 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
365 | mTimeButton->setEnabled(true); | 365 | mTimeButton->setEnabled(true); |
366 | } | 366 | } |
367 | else { | 367 | else { |
368 | mTimeButton->setEnabled(false); | 368 | mTimeButton->setEnabled(false); |
369 | mTimeButton->setChecked(false); | 369 | mTimeButton->setChecked(false); |
370 | } | 370 | } |
371 | 371 | ||
372 | if (enable) { | 372 | if (enable) { |
373 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); | 373 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); |
374 | } else { | 374 | } else { |
375 | mDueTimeEdit->setEnabled( false ); | 375 | mDueTimeEdit->setEnabled( false ); |
376 | } | 376 | } |
377 | emit datesChecked(); | 377 | emit datesChecked(); |
378 | } | 378 | } |
379 | 379 | ||
380 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) | 380 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) |
381 | { | 381 | { |
382 | mStartDateEdit->setEnabled( enable ); | 382 | mStartDateEdit->setEnabled( enable ); |
383 | 383 | ||
384 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 384 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
385 | mTimeButton->setEnabled(true); | 385 | mTimeButton->setEnabled(true); |
386 | } | 386 | } |
387 | else { | 387 | else { |
388 | mTimeButton->setEnabled(false); | 388 | mTimeButton->setEnabled(false); |
389 | mTimeButton->setChecked(false); | 389 | mTimeButton->setChecked(false); |
390 | } | 390 | } |
391 | 391 | ||
392 | if (enable) { | 392 | if (enable) { |
393 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); | 393 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); |
394 | } else { | 394 | } else { |
395 | mStartTimeEdit->setEnabled( false ); | 395 | mStartTimeEdit->setEnabled( false ); |
396 | } | 396 | } |
397 | emit datesChecked(); | 397 | emit datesChecked(); |
398 | } | 398 | } |
399 | void KOEditorGeneralTodo::startDateChanged(QDate newdate) | 399 | void KOEditorGeneralTodo::startDateChanged(QDate newdate) |
400 | { | 400 | { |
401 | if ( mDueCheck->isChecked() ) | 401 | if ( mDueCheck->isChecked() ) |
402 | emit dateTimesChanged(newdate,mDueDateEdit->date()); | 402 | emit dateTimesChanged(newdate,mDueDateEdit->date()); |
403 | } | 403 | } |
404 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) | 404 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) |
405 | { | 405 | { |
406 | if(mStartCheck->isChecked()) { | 406 | if(mStartCheck->isChecked()) { |
407 | mStartTimeEdit->setEnabled( enable ); | 407 | mStartTimeEdit->setEnabled( enable ); |
408 | } | 408 | } |
409 | if(mDueCheck->isChecked()) { | 409 | if(mDueCheck->isChecked()) { |
410 | mDueTimeEdit->setEnabled( enable ); | 410 | mDueTimeEdit->setEnabled( enable ); |
411 | } | 411 | } |
412 | } | 412 | } |
413 | 413 | ||
414 | void KOEditorGeneralTodo::showAlarm() | 414 | void KOEditorGeneralTodo::showAlarm() |
415 | { | 415 | { |
416 | if ( mDueCheck->isChecked() ) { | 416 | if ( mDueCheck->isChecked() ) { |
417 | alarmDisable(false); | 417 | alarmDisable(false); |
418 | } | 418 | } |
419 | else { | 419 | else { |
420 | alarmDisable(true); | 420 | alarmDisable(true); |
421 | } | 421 | } |
422 | } | 422 | } |
423 | 423 | ||
424 | bool KOEditorGeneralTodo::validateInput() | 424 | bool KOEditorGeneralTodo::validateInput() |
425 | { | 425 | { |
426 | if (mDueCheck->isChecked()) { | 426 | if (mDueCheck->isChecked()) { |
427 | if (!mDueDateEdit->inputIsValid()) { | 427 | if (!mDueDateEdit->inputIsValid()) { |
428 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); | 428 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); |
429 | return false; | 429 | return false; |
430 | } | 430 | } |
431 | } | 431 | } |
432 | 432 | ||
433 | if (mStartCheck->isChecked()) { | 433 | if (mStartCheck->isChecked()) { |
434 | if (!mStartDateEdit->inputIsValid()) { | 434 | if (!mStartDateEdit->inputIsValid()) { |
435 | KMessageBox::sorry(0,i18n("Please specify a valid start date.")); | 435 | KMessageBox::sorry(0,i18n("Please specify a valid start date.")); |
436 | return false; | 436 | return false; |
437 | } | 437 | } |
438 | } | 438 | } |
439 | 439 | ||
440 | if (mStartCheck->isChecked() && mDueCheck->isChecked()) { | 440 | if (mStartCheck->isChecked() && mDueCheck->isChecked()) { |
441 | QDateTime startDate; | 441 | QDateTime startDate; |
442 | QDateTime dueDate; | 442 | QDateTime dueDate; |
443 | startDate.setDate(mStartDateEdit->date()); | 443 | startDate.setDate(mStartDateEdit->date()); |
444 | dueDate.setDate(mDueDateEdit->date()); | 444 | dueDate.setDate(mDueDateEdit->date()); |
445 | if (mTimeButton->isChecked()) { | 445 | if (mTimeButton->isChecked()) { |
446 | startDate.setTime(mStartTimeEdit->getTime()); | 446 | startDate.setTime(mStartTimeEdit->getTime()); |
447 | dueDate.setTime(mDueTimeEdit->getTime()); | 447 | dueDate.setTime(mDueTimeEdit->getTime()); |
448 | } | 448 | } |
449 | if (startDate > dueDate) { | 449 | if (startDate > dueDate) { |
450 | KMessageBox::sorry(0, | 450 | KMessageBox::sorry(0, |
451 | i18n("The start date cannot be after the due date.")); | 451 | i18n("The start date cannot be after the due date.")); |
452 | return false; | 452 | return false; |
453 | } | 453 | } |
454 | } | 454 | } |
455 | 455 | ||
456 | return KOEditorGeneral::validateInput(); | 456 | return KOEditorGeneral::validateInput(); |
457 | } | 457 | } |
458 | 458 | ||
459 | void KOEditorGeneralTodo::completedChanged(int index) | 459 | void KOEditorGeneralTodo::completedChanged(int index) |
460 | { | 460 | { |
461 | if (index == 5) { | 461 | if (index == 5) { |
462 | //get rid of milli sec | 462 | //get rid of milli sec |
463 | mCompleted = QDateTime::currentDateTime(); | 463 | mCompleted = QDateTime::currentDateTime(); |
464 | } | 464 | } |
465 | setCompletedDate(); | 465 | setCompletedDate(); |
466 | } | 466 | } |
467 | 467 | ||
468 | void KOEditorGeneralTodo::setCompletedDate() | 468 | void KOEditorGeneralTodo::setCompletedDate() |
469 | { | 469 | { |
470 | if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) { | 470 | if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) { |
471 | if ( QApplication::desktop()->width() < 480 ) { | 471 | if ( QApplication::desktop()->width() < 480 ) { |
472 | mCompletedLabel->setText(i18n(" on")); | 472 | mCompletedLabel->setText(i18n(" on")); |
473 | } | 473 | } |
474 | else | 474 | else |
475 | mCompletedLabel->setText(i18n(" completed on ")); | 475 | mCompletedLabel->setText(i18n(" completed on ")); |
476 | mCompleteDateEdit->show(); | 476 | mCompleteDateEdit->show(); |
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp index 75dae34..9ede543 100644 --- a/korganizer/koeventeditor.cpp +++ b/korganizer/koeventeditor.cpp | |||
@@ -1,378 +1,384 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qpixmap.h> | 26 | #include <qpixmap.h> |
27 | #include <qhbox.h> | 27 | #include <qhbox.h> |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qwidgetstack.h> | 30 | #include <qwidgetstack.h> |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | 32 | ||
33 | #include <kiconloader.h> | 33 | #include <kiconloader.h> |
34 | #include <kstandarddirs.h> | 34 | #include <kstandarddirs.h> |
35 | #include <kdebug.h> | 35 | #include <kdebug.h> |
36 | #include <klocale.h> | 36 | #include <klocale.h> |
37 | #include <kfiledialog.h> | 37 | #include <kfiledialog.h> |
38 | #include <kmessagebox.h> | 38 | #include <kmessagebox.h> |
39 | #include <libkcal/calendarresources.h> | 39 | #include <libkcal/calendarresources.h> |
40 | #include <libkcal/resourcecalendar.h> | 40 | #include <libkcal/resourcecalendar.h> |
41 | #include <kresources/resourceselectdialog.h> | 41 | #include <kresources/resourceselectdialog.h> |
42 | 42 | ||
43 | #include <libkdepim/categoryselectdialog.h> | 43 | #include <libkdepim/categoryselectdialog.h> |
44 | #include <libkcal/calendarlocal.h> | 44 | #include <libkcal/calendarlocal.h> |
45 | #include <libkcal/icalformat.h> | 45 | #include <libkcal/icalformat.h> |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | 48 | ||
49 | #include "koeventeditor.h" | 49 | #include "koeventeditor.h" |
50 | extern int globalFlagBlockAgenda; | 50 | extern int globalFlagBlockAgenda; |
51 | 51 | ||
52 | KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) : | 52 | KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) : |
53 | KOIncidenceEditor( i18n("Edit Event"), calendar, parent ) | 53 | KOIncidenceEditor( i18n("Edit Event"), calendar, parent ) |
54 | { | 54 | { |
55 | mEvent = 0; | 55 | mEvent = 0; |
56 | init(); | 56 | init(); |
57 | if ( QApplication::desktop()->height() <= 240 ) | 57 | if ( QApplication::desktop()->height() <= 240 ) |
58 | hideButtons(); | 58 | hideButtons(); |
59 | } | 59 | } |
60 | 60 | ||
61 | KOEventEditor::~KOEventEditor() | 61 | KOEventEditor::~KOEventEditor() |
62 | { | 62 | { |
63 | //emit dialogClose( mEvent ); | 63 | //emit dialogClose( mEvent ); |
64 | } | 64 | } |
65 | 65 | ||
66 | void KOEventEditor::init() | 66 | void KOEventEditor::init() |
67 | { | 67 | { |
68 | 68 | ||
69 | setupGeneral(); | 69 | setupGeneral(); |
70 | setupAttendeesTab(); | 70 | setupAttendeesTab(); |
71 | setupRecurrence(); | 71 | setupRecurrence(); |
72 | 72 | ||
73 | // Propagate date time settings to recurrence tab | 73 | // Propagate date time settings to recurrence tab |
74 | connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), | 74 | connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), |
75 | mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime))); | 75 | mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime))); |
76 | connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)), | 76 | connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)), |
77 | mRecurrence,SLOT(setDateTimeStr(const QString &))); | 77 | mRecurrence,SLOT(setDateTimeStr(const QString &))); |
78 | 78 | ||
79 | // Category dialog | 79 | // Category dialog |
80 | // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); | 80 | // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); |
81 | //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)), | 81 | //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)), |
82 | // mGeneral,SLOT(setCategories(const QString &))); | 82 | // mGeneral,SLOT(setCategories(const QString &))); |
83 | 83 | ||
84 | 84 | ||
85 | } | 85 | } |
86 | 86 | ||
87 | void KOEventEditor::reload() | 87 | void KOEventEditor::reload() |
88 | { | 88 | { |
89 | if ( mEvent ) readEvent( mEvent ); | 89 | if ( mEvent ) readEvent( mEvent ); |
90 | } | 90 | } |
91 | 91 | ||
92 | void KOEventEditor::setSecrecy( int sec ) | 92 | void KOEventEditor::setSecrecy( int sec ) |
93 | { | 93 | { |
94 | mGeneral->setSecrecy( sec ); | 94 | mGeneral->setSecrecy( sec ); |
95 | } | 95 | } |
96 | void KOEventEditor::setCategories( QString s ) | 96 | void KOEventEditor::setCategories( QString s ) |
97 | { | 97 | { |
98 | mGeneral->setCategories(s); | 98 | mGeneral->setCategories(s); |
99 | 99 | ||
100 | } | 100 | } |
101 | void KOEventEditor::setupGeneral() | 101 | void KOEventEditor::setupGeneral() |
102 | { | 102 | { |
103 | mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" ); | 103 | mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" ); |
104 | connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); | 104 | connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); |
105 | 105 | ||
106 | if( KOPrefs::instance()->mCompactDialogs ) { | 106 | if( KOPrefs::instance()->mCompactDialogs ) { |
107 | QFrame *topFrame = addPage(i18n("General")); | 107 | QFrame *topFrame = addPage(i18n("General")); |
108 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); | 108 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); |
109 | topLayout->setSpacing(spacingHint()-1); | 109 | topLayout->setSpacing(spacingHint()-1); |
110 | topLayout->setMargin(marginHint()-1); | 110 | topLayout->setMargin(marginHint()-1); |
111 | topLayout->addStretch ( 1 ); | ||
111 | mGeneral->initHeader(topFrame,topLayout); | 112 | mGeneral->initHeader(topFrame,topLayout); |
113 | topLayout->addStretch ( 1 ); | ||
112 | mGeneral->initTime(topFrame,topLayout); | 114 | mGeneral->initTime(topFrame,topLayout); |
115 | topLayout->addStretch ( 1 ); | ||
113 | // QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); | 116 | // QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); |
114 | mGeneral->initAlarm(topFrame,topLayout); | 117 | mGeneral->initAlarm(topFrame,topLayout); |
118 | topLayout->addStretch ( 1 ); | ||
115 | mGeneral->enableAlarm( false ); | 119 | mGeneral->enableAlarm( false ); |
116 | 120 | ||
117 | QBoxLayout *buttonLayout; | 121 | QBoxLayout *buttonLayout; |
118 | if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 ) | 122 | if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 ) |
119 | buttonLayout = new QVBoxLayout( topLayout ); | 123 | buttonLayout = new QVBoxLayout( topLayout ); |
120 | else | 124 | else |
121 | buttonLayout = new QHBoxLayout( topLayout ); | 125 | buttonLayout = new QHBoxLayout( topLayout ); |
122 | QHBox* buttonWidget = new QHBox (topFrame); | 126 | QHBox* buttonWidget = new QHBox (topFrame); |
123 | QIconSet icon; | 127 | QIconSet icon; |
124 | if ( QApplication::desktop()->width() < 321 ) | 128 | if ( QApplication::desktop()->width() < 321 ) |
125 | icon = SmallIcon("fileexport16"); | 129 | icon = SmallIcon("fileexport16"); |
126 | else | 130 | else |
127 | icon = SmallIcon("fileexport"); | 131 | icon = SmallIcon("fileexport"); |
128 | QPushButton * loadTemplate = new QPushButton( buttonWidget); | 132 | QPushButton * loadTemplate = new QPushButton( buttonWidget); |
129 | QPushButton * saveTemplate = new QPushButton( buttonWidget); | 133 | QPushButton * saveTemplate = new QPushButton( buttonWidget); |
130 | saveTemplate->setIconSet (icon ) ; | 134 | saveTemplate->setIconSet (icon ) ; |
131 | int size = saveTemplate->sizeHint().height(); | 135 | int size = saveTemplate->sizeHint().height(); |
132 | saveTemplate->setFixedSize( size, size ); | 136 | saveTemplate->setFixedSize( size, size ); |
133 | if ( QApplication::desktop()->width() < 321 ) | 137 | if ( QApplication::desktop()->width() < 321 ) |
134 | icon = SmallIcon("fileimport16"); | 138 | icon = SmallIcon("fileimport16"); |
135 | else | 139 | else |
136 | icon = SmallIcon("fileimport"); | 140 | icon = SmallIcon("fileimport"); |
137 | loadTemplate->setIconSet (icon ) ; | 141 | loadTemplate->setIconSet (icon ) ; |
138 | loadTemplate->setFixedSize( size, size ); | 142 | loadTemplate->setFixedSize( size, size ); |
139 | buttonLayout->addWidget( buttonWidget ); | 143 | buttonLayout->addWidget( buttonWidget ); |
140 | mGeneral->initCategories( topFrame, buttonLayout ); | 144 | mGeneral->initCategories( topFrame, buttonLayout ); |
141 | 145 | ||
142 | topLayout->addStretch( 1 ); | 146 | topLayout->addStretch( 1 ); |
143 | 147 | ||
144 | QFrame *topFrame2 = addPage(i18n("Details")); | 148 | QFrame *topFrame2 = addPage(i18n("Details")); |
145 | 149 | ||
146 | QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); | 150 | QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); |
151 | topLayout2->setSpacing(spacingHint()-1); | ||
152 | topLayout2->setMargin(marginHint()-1); | ||
147 | topLayout2->setSpacing(spacingHint()); | 153 | topLayout2->setSpacing(spacingHint()); |
148 | 154 | ||
149 | mGeneral->initClass(topFrame2,topLayout2); | 155 | mGeneral->initClass(topFrame2,topLayout2); |
150 | mGeneral->initSecrecy( topFrame2, topLayout2 ); | 156 | mGeneral->initSecrecy( topFrame2, topLayout2 ); |
151 | mGeneral->initDescription(topFrame2,topLayout2); | 157 | mGeneral->initDescription(topFrame2,topLayout2); |
152 | 158 | ||
153 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 159 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
154 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 160 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
155 | } else { | 161 | } else { |
156 | QFrame *topFrame = addPage(i18n("General")); | 162 | QFrame *topFrame = addPage(i18n("General")); |
157 | 163 | ||
158 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); | 164 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); |
159 | topLayout->setSpacing(spacingHint()); | 165 | topLayout->setSpacing(spacingHint()); |
160 | 166 | ||
161 | mGeneral->initHeader(topFrame,topLayout); | 167 | mGeneral->initHeader(topFrame,topLayout); |
162 | mGeneral->initTime(topFrame,topLayout); | 168 | mGeneral->initTime(topFrame,topLayout); |
163 | QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); | 169 | QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); |
164 | mGeneral->initAlarm(topFrame,alarmLineLayout); | 170 | mGeneral->initAlarm(topFrame,alarmLineLayout); |
165 | mGeneral->initClass(topFrame,alarmLineLayout); | 171 | mGeneral->initClass(topFrame,alarmLineLayout); |
166 | mGeneral->initDescription(topFrame,topLayout); | 172 | mGeneral->initDescription(topFrame,topLayout); |
167 | QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); | 173 | QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); |
168 | mGeneral->initCategories( topFrame, detailsLayout ); | 174 | mGeneral->initCategories( topFrame, detailsLayout ); |
169 | mGeneral->initSecrecy( topFrame, detailsLayout ); | 175 | mGeneral->initSecrecy( topFrame, detailsLayout ); |
170 | } | 176 | } |
171 | 177 | ||
172 | mGeneral->finishSetup(); | 178 | mGeneral->finishSetup(); |
173 | 179 | ||
174 | } | 180 | } |
175 | 181 | ||
176 | void KOEventEditor::setupRecurrence() | 182 | void KOEventEditor::setupRecurrence() |
177 | { | 183 | { |
178 | QFrame *topFrame = addPage( i18n("Recurrence") ); | 184 | QFrame *topFrame = addPage( i18n("Recurrence") ); |
179 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); | 185 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); |
180 | 186 | ||
181 | mRecurrence = new KOEditorRecurrence( topFrame ); | 187 | mRecurrence = new KOEditorRecurrence( topFrame ); |
182 | topLayout->addWidget( mRecurrence ); | 188 | topLayout->addWidget( mRecurrence ); |
183 | } | 189 | } |
184 | 190 | ||
185 | void KOEventEditor::editEvent(Event *event, bool showDescription) | 191 | void KOEventEditor::editEvent(Event *event, bool showDescription) |
186 | { | 192 | { |
187 | // init(); | 193 | // init(); |
188 | 194 | ||
189 | mEvent = event; | 195 | mEvent = event; |
190 | readEvent(mEvent); | 196 | readEvent(mEvent); |
191 | if ( showDescription ) { | 197 | if ( showDescription ) { |
192 | showPage( 1 ); | 198 | showPage( 1 ); |
193 | mGeneral->setFocusOn( 1 ); | 199 | mGeneral->setFocusOn( 1 ); |
194 | } else { | 200 | } else { |
195 | showPage( 0 ); | 201 | showPage( 0 ); |
196 | mGeneral->setFocusOn( 2 ); | 202 | mGeneral->setFocusOn( 2 ); |
197 | } | 203 | } |
198 | } | 204 | } |
199 | 205 | ||
200 | void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay ) | 206 | void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay ) |
201 | { | 207 | { |
202 | // init(); | 208 | // init(); |
203 | 209 | ||
204 | mEvent = 0; | 210 | mEvent = 0; |
205 | setDefaults(from,to,allDay); | 211 | setDefaults(from,to,allDay); |
206 | } | 212 | } |
207 | 213 | ||
208 | void KOEventEditor::loadDefaults() | 214 | void KOEventEditor::loadDefaults() |
209 | { | 215 | { |
210 | int fmt = KOPrefs::instance()->mStartTime; | 216 | int fmt = KOPrefs::instance()->mStartTime; |
211 | 217 | ||
212 | QDateTime from(QDate::currentDate(), QTime(fmt,0,0)); | 218 | QDateTime from(QDate::currentDate(), QTime(fmt,0,0)); |
213 | QDateTime to(QDate::currentDate(), | 219 | QDateTime to(QDate::currentDate(), |
214 | QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0)); | 220 | QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0)); |
215 | 221 | ||
216 | setDefaults(from,to,false); | 222 | setDefaults(from,to,false); |
217 | } | 223 | } |
218 | 224 | ||
219 | bool KOEventEditor::processInput( bool emitTime ) | 225 | bool KOEventEditor::processInput( bool emitTime ) |
220 | { | 226 | { |
221 | if (!validateInput()) return false; | 227 | if (!validateInput()) return false; |
222 | 228 | ||
223 | Event *event = 0; | 229 | Event *event = 0; |
224 | 230 | ||
225 | if (mEvent) event = mEvent; | 231 | if (mEvent) event = mEvent; |
226 | else { | 232 | else { |
227 | event = new Event; | 233 | event = new Event; |
228 | event->setOrganizer(KOPrefs::instance()->email()); | 234 | event->setOrganizer(KOPrefs::instance()->email()); |
229 | } | 235 | } |
230 | 236 | ||
231 | writeEvent(event); | 237 | writeEvent(event); |
232 | if ( emitTime ) { | 238 | if ( emitTime ) { |
233 | globalFlagBlockAgenda = 1; | 239 | globalFlagBlockAgenda = 1; |
234 | emit showAgendaView( false ); | 240 | emit showAgendaView( false ); |
235 | emit jumpToTime( event->dtStart().date() ); | 241 | emit jumpToTime( event->dtStart().date() ); |
236 | globalFlagBlockAgenda = 2; | 242 | globalFlagBlockAgenda = 2; |
237 | 243 | ||
238 | } | 244 | } |
239 | if (mEvent) { | 245 | if (mEvent) { |
240 | event->setRevision(event->revision()+1); | 246 | event->setRevision(event->revision()+1); |
241 | emit eventChanged(event); | 247 | emit eventChanged(event); |
242 | } else { | 248 | } else { |
243 | mCalendar->addEvent(event); | 249 | mCalendar->addEvent(event); |
244 | mEvent = event; | 250 | mEvent = event; |
245 | emit eventAdded(event); | 251 | emit eventAdded(event); |
246 | } | 252 | } |
247 | 253 | ||
248 | return true; | 254 | return true; |
249 | } | 255 | } |
250 | 256 | ||
251 | void KOEventEditor::deleteEvent() | 257 | void KOEventEditor::deleteEvent() |
252 | { | 258 | { |
253 | kdDebug() << "Delete event" << endl; | 259 | kdDebug() << "Delete event" << endl; |
254 | 260 | ||
255 | if (mEvent) { | 261 | if (mEvent) { |
256 | if (KOPrefs::instance()->mConfirm) { | 262 | if (KOPrefs::instance()->mConfirm) { |
257 | switch (msgItemDelete()) { | 263 | switch (msgItemDelete()) { |
258 | case KMessageBox::Continue: // OK | 264 | case KMessageBox::Continue: // OK |
259 | emit eventToBeDeleted(mEvent); | 265 | emit eventToBeDeleted(mEvent); |
260 | emit dialogClose(mEvent); | 266 | emit dialogClose(mEvent); |
261 | mCalendar->deleteEvent(mEvent); | 267 | mCalendar->deleteEvent(mEvent); |
262 | emit eventDeleted(); | 268 | emit eventDeleted(); |
263 | reject(); | 269 | reject(); |
264 | break; | 270 | break; |
265 | } | 271 | } |
266 | } | 272 | } |
267 | else { | 273 | else { |
268 | emit eventToBeDeleted(mEvent); | 274 | emit eventToBeDeleted(mEvent); |
269 | emit dialogClose(mEvent); | 275 | emit dialogClose(mEvent); |
270 | mCalendar->deleteEvent(mEvent); | 276 | mCalendar->deleteEvent(mEvent); |
271 | emit eventDeleted(); | 277 | emit eventDeleted(); |
272 | reject(); | 278 | reject(); |
273 | } | 279 | } |
274 | } else { | 280 | } else { |
275 | reject(); | 281 | reject(); |
276 | } | 282 | } |
277 | } | 283 | } |
278 | 284 | ||
279 | void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay) | 285 | void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay) |
280 | { | 286 | { |
281 | mGeneral->setDefaults(from,to,allDay); | 287 | mGeneral->setDefaults(from,to,allDay); |
282 | mDetails->setDefaults(); | 288 | mDetails->setDefaults(); |
283 | mRecurrence->setDefaults(from,to); | 289 | mRecurrence->setDefaults(from,to); |
284 | showPage( 0 ); | 290 | showPage( 0 ); |
285 | mGeneral->setFocusOn( 2 ); | 291 | mGeneral->setFocusOn( 2 ); |
286 | } | 292 | } |
287 | 293 | ||
288 | void KOEventEditor::readEvent( Event *event, bool tmpl ) | 294 | void KOEventEditor::readEvent( Event *event, bool tmpl ) |
289 | { | 295 | { |
290 | mGeneral->readEvent( event, tmpl ); | 296 | mGeneral->readEvent( event, tmpl ); |
291 | mDetails->readEvent( event ); | 297 | mDetails->readEvent( event ); |
292 | mRecurrence->readEvent( event ); | 298 | mRecurrence->readEvent( event ); |
293 | 299 | ||
294 | // categories | 300 | // categories |
295 | //mCategoryDialog->setSelected( event->categories() ); | 301 | //mCategoryDialog->setSelected( event->categories() ); |
296 | } | 302 | } |
297 | 303 | ||
298 | void KOEventEditor::writeEvent(Event *event) | 304 | void KOEventEditor::writeEvent(Event *event) |
299 | { | 305 | { |
300 | mGeneral->writeEvent( event ); | 306 | mGeneral->writeEvent( event ); |
301 | mDetails->writeEvent( event ); | 307 | mDetails->writeEvent( event ); |
302 | 308 | ||
303 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 309 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
304 | Event *ev = new Event( *event ); | 310 | Event *ev = new Event( *event ); |
305 | ev->registerObserver(0); | 311 | ev->registerObserver(0); |
306 | mDetails->cancelAttendeeEvent( ev ); | 312 | mDetails->cancelAttendeeEvent( ev ); |
307 | if ( ev->attendeeCount() > 0 ) { | 313 | if ( ev->attendeeCount() > 0 ) { |
308 | emit deleteAttendee( ev ); | 314 | emit deleteAttendee( ev ); |
309 | } | 315 | } |
310 | delete(ev); | 316 | delete(ev); |
311 | } | 317 | } |
312 | 318 | ||
313 | mRecurrence->writeEvent(event); | 319 | mRecurrence->writeEvent(event); |
314 | } | 320 | } |
315 | 321 | ||
316 | bool KOEventEditor::validateInput() | 322 | bool KOEventEditor::validateInput() |
317 | { | 323 | { |
318 | if (!mGeneral->validateInput()) return false; | 324 | if (!mGeneral->validateInput()) return false; |
319 | if (!mDetails->validateInput()) return false; | 325 | if (!mDetails->validateInput()) return false; |
320 | if (!mRecurrence->validateInput()) return false; | 326 | if (!mRecurrence->validateInput()) return false; |
321 | return true; | 327 | return true; |
322 | } | 328 | } |
323 | 329 | ||
324 | int KOEventEditor::msgItemDelete() | 330 | int KOEventEditor::msgItemDelete() |
325 | { | 331 | { |
326 | return KMessageBox::warningContinueCancel(this, | 332 | return KMessageBox::warningContinueCancel(this, |
327 | i18n("This item will be permanently deleted."), | 333 | i18n("This item will be permanently deleted."), |
328 | i18n("KOrganizer Confirmation"),i18n("Delete")); | 334 | i18n("KOrganizer Confirmation"),i18n("Delete")); |
329 | } | 335 | } |
330 | 336 | ||
331 | void KOEventEditor::slotLoadTemplate() | 337 | void KOEventEditor::slotLoadTemplate() |
332 | { | 338 | { |
333 | 339 | ||
334 | QString fileName =locateLocal( "templates", "events" ); | 340 | QString fileName =locateLocal( "templates", "events" ); |
335 | QDir t_dir; | 341 | QDir t_dir; |
336 | if ( !t_dir.exists(fileName) ) | 342 | if ( !t_dir.exists(fileName) ) |
337 | t_dir.mkdir ( fileName ); | 343 | t_dir.mkdir ( fileName ); |
338 | fileName += "/event"; | 344 | fileName += "/event"; |
339 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Load Event template"), this ); | 345 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Load Event template"), this ); |
340 | if ( fileName.length() == 0 ) | 346 | if ( fileName.length() == 0 ) |
341 | return; | 347 | return; |
342 | CalendarLocal cal; | 348 | CalendarLocal cal; |
343 | ICalFormat format; | 349 | ICalFormat format; |
344 | if ( !format.load( &cal, fileName ) ) { | 350 | if ( !format.load( &cal, fileName ) ) { |
345 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") | 351 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") |
346 | .arg( fileName ) ); | 352 | .arg( fileName ) ); |
347 | return ; | 353 | return ; |
348 | } | 354 | } |
349 | QPtrList<Event> events = cal.events(); | 355 | QPtrList<Event> events = cal.events(); |
350 | Event* event = events.first(); | 356 | Event* event = events.first(); |
351 | if ( !event ) { | 357 | if ( !event ) { |
352 | KMessageBox::error( this, | 358 | KMessageBox::error( this, |
353 | i18n("Template does not contain\na valid Event.")); | 359 | i18n("Template does not contain\na valid Event.")); |
354 | } else { | 360 | } else { |
355 | kdDebug() << "KOEventEditor::slotLoadTemplate(): readTemplate" << endl; | 361 | kdDebug() << "KOEventEditor::slotLoadTemplate(): readTemplate" << endl; |
356 | readEvent( event, true ); | 362 | readEvent( event, true ); |
357 | } | 363 | } |
358 | } | 364 | } |
359 | 365 | ||
360 | 366 | ||
361 | void KOEventEditor::slotSaveTemplate() | 367 | void KOEventEditor::slotSaveTemplate() |
362 | { | 368 | { |
363 | QString fileName =locateLocal( "templates", "events" ); | 369 | QString fileName =locateLocal( "templates", "events" ); |
364 | QDir t_dir; | 370 | QDir t_dir; |
365 | if ( !t_dir.exists(fileName) ) | 371 | if ( !t_dir.exists(fileName) ) |
366 | t_dir.mkdir ( fileName ); | 372 | t_dir.mkdir ( fileName ); |
367 | fileName += "/event"; | 373 | fileName += "/event"; |
368 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Event template"), this ); | 374 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Event template"), this ); |
369 | if ( fileName.length() > 0 ) | 375 | if ( fileName.length() > 0 ) |
370 | saveTemplate( fileName ); | 376 | saveTemplate( fileName ); |
371 | } | 377 | } |
372 | 378 | ||
373 | void KOEventEditor::saveTemplate( const QString &templateName ) | 379 | void KOEventEditor::saveTemplate( const QString &templateName ) |
374 | { | 380 | { |
375 | Event *event = new Event; | 381 | Event *event = new Event; |
376 | writeEvent( event ); | 382 | writeEvent( event ); |
377 | saveAsTemplate( event, templateName ); | 383 | saveAsTemplate( event, templateName ); |
378 | } | 384 | } |
diff --git a/korganizer/koincidenceeditor.cpp b/korganizer/koincidenceeditor.cpp index 9813a80..9bc0302 100644 --- a/korganizer/koincidenceeditor.cpp +++ b/korganizer/koincidenceeditor.cpp | |||
@@ -1,185 +1,185 @@ | |||
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 <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qpixmap.h> | 26 | #include <qpixmap.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qwidgetstack.h> | 28 | #include <qwidgetstack.h> |
29 | #include <qdatetime.h> | 29 | #include <qdatetime.h> |
30 | #include <qdir.h> | 30 | #include <qdir.h> |
31 | 31 | ||
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kstandarddirs.h> | 34 | #include <kstandarddirs.h> |
35 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
36 | #include <kfiledialog.h> | 36 | #include <kfiledialog.h> |
37 | 37 | ||
38 | #include <libkdepim/categoryselectdialog.h> | 38 | #include <libkdepim/categoryselectdialog.h> |
39 | #include <libkdepim/kinputdialog.h> | 39 | #include <libkdepim/kinputdialog.h> |
40 | 40 | ||
41 | #include <libkcal/calendarlocal.h> | 41 | #include <libkcal/calendarlocal.h> |
42 | #include <libkcal/icalformat.h> | 42 | #include <libkcal/icalformat.h> |
43 | 43 | ||
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | 45 | ||
46 | #include "koincidenceeditor.h" | 46 | #include "koincidenceeditor.h" |
47 | 47 | ||
48 | KOIncidenceEditor::KOIncidenceEditor( const QString &caption, | 48 | KOIncidenceEditor::KOIncidenceEditor( const QString &caption, |
49 | Calendar *calendar, QWidget *parent ) : | 49 | Calendar *calendar, QWidget *parent ) : |
50 | KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok, | 50 | KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok, |
51 | parent, caption, true, false ), | 51 | parent, caption, true, false ), |
52 | mSaveTemplateDialog( 0 ) | 52 | mSaveTemplateDialog( 0 ) |
53 | { | 53 | { |
54 | mCalendar = calendar; | 54 | mCalendar = calendar; |
55 | 55 | ||
56 | setButtonText( Default, i18n("Template...") ); | 56 | setButtonText( Default, i18n("Template...") ); |
57 | 57 | ||
58 | QString saveTemplateText; | 58 | QString saveTemplateText; |
59 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 59 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
60 | // showButton( User1, false ); | 60 | // showButton( User1, false ); |
61 | // showButton( Apply, false ); | 61 | // showButton( Apply, false ); |
62 | // } else { | 62 | // } else { |
63 | showButton( Apply, false ); | 63 | showButton( Apply, false ); |
64 | saveTemplateText = i18n("Ok+Agenda"); | 64 | saveTemplateText = i18n("Ok+Agenda"); |
65 | // } | 65 | // } |
66 | setButtonText( User1, saveTemplateText ); | 66 | setButtonText( User1, saveTemplateText ); |
67 | 67 | ||
68 | //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this ); | 68 | //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this ); |
69 | // KOGlobals::fitDialogToScreen( mCategoryDialog ); | 69 | // KOGlobals::fitDialogToScreen( mCategoryDialog ); |
70 | 70 | ||
71 | //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories())); | 71 | //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories())); |
72 | 72 | ||
73 | //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) ); | 73 | //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) ); |
74 | // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) ); | 74 | // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) ); |
75 | connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) ); | 75 | connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) ); |
76 | } | 76 | } |
77 | 77 | ||
78 | KOIncidenceEditor::~KOIncidenceEditor() | 78 | KOIncidenceEditor::~KOIncidenceEditor() |
79 | { | 79 | { |
80 | //delete mCategoryDialog; | 80 | //delete mCategoryDialog; |
81 | } | 81 | } |
82 | 82 | ||
83 | void KOIncidenceEditor::setupAttendeesTab() | 83 | void KOIncidenceEditor::setupAttendeesTab() |
84 | { | 84 | { |
85 | QFrame *topFrame = addPage(i18n("Attendees")); | 85 | QFrame *topFrame = addPage(i18n("Attendees")); |
86 | 86 | ||
87 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); | 87 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); |
88 | 88 | ||
89 | mDetails = new KOEditorDetails(spacingHint(),topFrame); | 89 | mDetails = new KOEditorDetails(spacingHint()-2,topFrame); |
90 | topLayout->addWidget(mDetails); | 90 | topLayout->addWidget(mDetails); |
91 | } | 91 | } |
92 | 92 | ||
93 | 93 | ||
94 | void KOIncidenceEditor::slotApply() | 94 | void KOIncidenceEditor::slotApply() |
95 | { | 95 | { |
96 | processInput( false ); | 96 | processInput( false ); |
97 | } | 97 | } |
98 | void KOIncidenceEditor::accept() | 98 | void KOIncidenceEditor::accept() |
99 | { | 99 | { |
100 | slotOk(); | 100 | slotOk(); |
101 | } | 101 | } |
102 | void KOIncidenceEditor::slotOk() | 102 | void KOIncidenceEditor::slotOk() |
103 | { | 103 | { |
104 | if ( processInput( false ) ) QDialog::accept(); | 104 | if ( processInput( false ) ) QDialog::accept(); |
105 | } | 105 | } |
106 | 106 | ||
107 | void KOIncidenceEditor::updateCategoryConfig() | 107 | void KOIncidenceEditor::updateCategoryConfig() |
108 | { | 108 | { |
109 | qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! "); | 109 | qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! "); |
110 | //mCategoryDialog->updateCategoryConfig(); | 110 | //mCategoryDialog->updateCategoryConfig(); |
111 | } | 111 | } |
112 | 112 | ||
113 | void KOIncidenceEditor::slotCancel() | 113 | void KOIncidenceEditor::slotCancel() |
114 | { | 114 | { |
115 | reject(); | 115 | reject(); |
116 | } | 116 | } |
117 | 117 | ||
118 | void KOIncidenceEditor::slotLoadTemplate() | 118 | void KOIncidenceEditor::slotLoadTemplate() |
119 | { | 119 | { |
120 | kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl; | 120 | kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl; |
121 | } | 121 | } |
122 | void KOIncidenceEditor::slotShowIncidence() | 122 | void KOIncidenceEditor::slotShowIncidence() |
123 | { | 123 | { |
124 | 124 | ||
125 | if ( processInput(true ) ) { | 125 | if ( processInput(true ) ) { |
126 | accept(); | 126 | accept(); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | void KOIncidenceEditor::slotSaveTemplate() | 130 | void KOIncidenceEditor::slotSaveTemplate() |
131 | { | 131 | { |
132 | kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl; | 132 | kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl; |
133 | } | 133 | } |
134 | 134 | ||
135 | void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type ) | 135 | void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type ) |
136 | { | 136 | { |
137 | if ( !mSaveTemplateDialog ) { | 137 | if ( !mSaveTemplateDialog ) { |
138 | mSaveTemplateDialog = new SaveTemplateDialog( type, this ); | 138 | mSaveTemplateDialog = new SaveTemplateDialog( type, this ); |
139 | connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ), | 139 | connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ), |
140 | SLOT( saveTemplate( const QString & ) ) ); | 140 | SLOT( saveTemplate( const QString & ) ) ); |
141 | } | 141 | } |
142 | mSaveTemplateDialog->show(); | 142 | mSaveTemplateDialog->show(); |
143 | mSaveTemplateDialog->raise(); | 143 | mSaveTemplateDialog->raise(); |
144 | } | 144 | } |
145 | 145 | ||
146 | void KOIncidenceEditor::saveAsTemplate( Incidence *incidence, | 146 | void KOIncidenceEditor::saveAsTemplate( Incidence *incidence, |
147 | const QString &templateName ) | 147 | const QString &templateName ) |
148 | { | 148 | { |
149 | CalendarLocal cal; | 149 | CalendarLocal cal; |
150 | cal.addIncidence( incidence ); | 150 | cal.addIncidence( incidence ); |
151 | ICalFormat format; | 151 | ICalFormat format; |
152 | format.save( &cal, templateName ); | 152 | format.save( &cal, templateName ); |
153 | } | 153 | } |
154 | 154 | ||
155 | QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type, | 155 | QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type, |
156 | const QStringList &templates ) | 156 | const QStringList &templates ) |
157 | { | 157 | { |
158 | // bool ok = false; | 158 | // bool ok = false; |
159 | // QString templateName = KInputDialog::getItem( i18n("Load Template"), | 159 | // QString templateName = KInputDialog::getItem( i18n("Load Template"), |
160 | // i18n("Select a template to load:"), templates, 0, &ok ); | 160 | // i18n("Select a template to load:"), templates, 0, &ok ); |
161 | // if ( !ok || templateName.isEmpty() ) return QString::null; | 161 | // if ( !ok || templateName.isEmpty() ) return QString::null; |
162 | 162 | ||
163 | // QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" + | 163 | // QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" + |
164 | // templateName ); | 164 | // templateName ); |
165 | // fn =KFileDialog:: getOpenFileName( fn, "Import filename(*.ics/*.vcs)", this ); | 165 | // fn =KFileDialog:: getOpenFileName( fn, "Import filename(*.ics/*.vcs)", this ); |
166 | 166 | ||
167 | // QString fileName;// =locateLocal( "templates", incidence->type() ); | 167 | // QString fileName;// =locateLocal( "templates", incidence->type() ); |
168 | // fileName=KFileDialog:: getOpenFileName( fileName, "Load "+incidence()->type(), this ); | 168 | // fileName=KFileDialog:: getOpenFileName( fileName, "Load "+incidence()->type(), this ); |
169 | // if ( fileNamelength() == 0) | 169 | // if ( fileNamelength() == 0) |
170 | // return QString::null; | 170 | // return QString::null; |
171 | // if ( fileName.isEmpty() ) { | 171 | // if ( fileName.isEmpty() ) { |
172 | // KMessageBox::error( this, i18n("Unable to find template '%1'.") | 172 | // KMessageBox::error( this, i18n("Unable to find template '%1'.") |
173 | // .arg( fileName ) ); | 173 | // .arg( fileName ) ); |
174 | // return QString::null; | 174 | // return QString::null; |
175 | // } else { | 175 | // } else { |
176 | // ICalFormat format; | 176 | // ICalFormat format; |
177 | // if ( !format.load( cal, fileName ) ) { | 177 | // if ( !format.load( cal, fileName ) ) { |
178 | // KMessageBox::error( this, i18n("Error loading template file '%1'.") | 178 | // KMessageBox::error( this, i18n("Error loading template file '%1'.") |
179 | // .arg( fileName ) ); | 179 | // .arg( fileName ) ); |
180 | // return QString::null; | 180 | // return QString::null; |
181 | // } | 181 | // } |
182 | // } | 182 | // } |
183 | 183 | ||
184 | return ""; | 184 | return ""; |
185 | } | 185 | } |
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp index 8b90ae5..555c1b1 100644 --- a/korganizer/kotodoeditor.cpp +++ b/korganizer/kotodoeditor.cpp | |||
@@ -1,448 +1,452 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1997, 1998 Preston Brown | 3 | Copyright (c) 1997, 1998 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qtooltip.h> | 25 | #include <qtooltip.h> |
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | #include <qpixmap.h> | 27 | #include <qpixmap.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qhbox.h> | 29 | #include <qhbox.h> |
30 | #include <qdir.h> | 30 | #include <qdir.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | #include <qtabwidget.h> | 33 | #include <qtabwidget.h> |
34 | 34 | ||
35 | #include <kiconloader.h> | 35 | #include <kiconloader.h> |
36 | #include <klocale.h> | 36 | #include <klocale.h> |
37 | #include <kfiledialog.h> | 37 | #include <kfiledialog.h> |
38 | #include <kstandarddirs.h> | 38 | #include <kstandarddirs.h> |
39 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
40 | 40 | ||
41 | #include <libkdepim/categoryselectdialog.h> | 41 | #include <libkdepim/categoryselectdialog.h> |
42 | #include <libkcal/calendarlocal.h> | 42 | #include <libkcal/calendarlocal.h> |
43 | #include <libkcal/calendarresources.h> | 43 | #include <libkcal/calendarresources.h> |
44 | #include <libkcal/resourcecalendar.h> | 44 | #include <libkcal/resourcecalendar.h> |
45 | #include <libkcal/icalformat.h> | 45 | #include <libkcal/icalformat.h> |
46 | #include <kresources/resourceselectdialog.h> | 46 | #include <kresources/resourceselectdialog.h> |
47 | #include <libkdepim/kdateedit.h> | 47 | #include <libkdepim/kdateedit.h> |
48 | 48 | ||
49 | #include "koprefs.h" | 49 | #include "koprefs.h" |
50 | #include "kolocationbox.h" | 50 | #include "kolocationbox.h" |
51 | 51 | ||
52 | #include "kotodoeditor.h" | 52 | #include "kotodoeditor.h" |
53 | extern int globalFlagBlockAgenda; | 53 | extern int globalFlagBlockAgenda; |
54 | 54 | ||
55 | KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : | 55 | KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : |
56 | KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) | 56 | KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) |
57 | { | 57 | { |
58 | mTodo = 0; | 58 | mTodo = 0; |
59 | mRelatedTodo = 0; | 59 | mRelatedTodo = 0; |
60 | findButton(User1)->hide(); | 60 | findButton(User1)->hide(); |
61 | init(); | 61 | init(); |
62 | if ( QApplication::desktop()->height() <= 240 ) | 62 | if ( QApplication::desktop()->height() <= 240 ) |
63 | hideButtons(); | 63 | hideButtons(); |
64 | } | 64 | } |
65 | 65 | ||
66 | KOTodoEditor::~KOTodoEditor() | 66 | KOTodoEditor::~KOTodoEditor() |
67 | { | 67 | { |
68 | emit dialogClose( mTodo ); | 68 | emit dialogClose( mTodo ); |
69 | } | 69 | } |
70 | 70 | ||
71 | void KOTodoEditor::init() | 71 | void KOTodoEditor::init() |
72 | { | 72 | { |
73 | setupGeneral(); | 73 | setupGeneral(); |
74 | setupAttendeesTab(); | 74 | setupAttendeesTab(); |
75 | setupRecurrence(); | 75 | setupRecurrence(); |
76 | connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence())); | 76 | connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence())); |
77 | mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") ); | 77 | mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") ); |
78 | connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), | 78 | connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), |
79 | mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime))); | 79 | mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime))); |
80 | } | 80 | } |
81 | void KOTodoEditor::setupRecurrence() | 81 | void KOTodoEditor::setupRecurrence() |
82 | { | 82 | { |
83 | QFrame *topFrame = addPage( i18n("Recurrence") ); | 83 | QFrame *topFrame = addPage( i18n("Recurrence") ); |
84 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); | 84 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); |
85 | 85 | ||
86 | mRecurrence = new KOEditorRecurrence( topFrame ); | 86 | mRecurrence = new KOEditorRecurrence( topFrame ); |
87 | topLayout->addWidget( mRecurrence ); | 87 | topLayout->addWidget( mRecurrence ); |
88 | } | 88 | } |
89 | 89 | ||
90 | void KOTodoEditor::setCategories( QString s ) | 90 | void KOTodoEditor::setCategories( QString s ) |
91 | { | 91 | { |
92 | mGeneral->setCategories(s); | 92 | mGeneral->setCategories(s); |
93 | } | 93 | } |
94 | void KOTodoEditor::setSecrecy( int sec ) | 94 | void KOTodoEditor::setSecrecy( int sec ) |
95 | { | 95 | { |
96 | mGeneral->setSecrecy( sec ); | 96 | mGeneral->setSecrecy( sec ); |
97 | } | 97 | } |
98 | void KOTodoEditor::reload() | 98 | void KOTodoEditor::reload() |
99 | { | 99 | { |
100 | if ( mTodo ) readTodo( mTodo ); | 100 | if ( mTodo ) readTodo( mTodo ); |
101 | } | 101 | } |
102 | 102 | ||
103 | void KOTodoEditor::setupGeneral() | 103 | void KOTodoEditor::setupGeneral() |
104 | { | 104 | { |
105 | mGeneral = new KOEditorGeneralTodo(this); | 105 | mGeneral = new KOEditorGeneralTodo(this); |
106 | connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); | 106 | connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); |
107 | 107 | ||
108 | // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); | 108 | // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); |
109 | //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), | 109 | //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), |
110 | // mGeneral,SLOT(setCategories(const QString &))); | 110 | // mGeneral,SLOT(setCategories(const QString &))); |
111 | 111 | ||
112 | if (KOPrefs::instance()->mCompactDialogs) { | 112 | if (KOPrefs::instance()->mCompactDialogs) { |
113 | QFrame *topFrame = addPage(i18n("General")); | 113 | QFrame *topFrame = addPage(i18n("General")); |
114 | 114 | ||
115 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); | 115 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); |
116 | if ( QApplication::desktop()->width() < 480 ) { | 116 | if ( QApplication::desktop()->width() < 480 ) { |
117 | topLayout->setMargin(marginHintSmall()); | 117 | topLayout->setMargin(marginHintSmall()); |
118 | topLayout->setSpacing(spacingHintSmall()); | 118 | topLayout->setSpacing(spacingHintSmall()); |
119 | } else { | 119 | } else { |
120 | topLayout->setMargin(marginHint()); | 120 | topLayout->setMargin(marginHint()); |
121 | topLayout->setSpacing(spacingHint()); | 121 | topLayout->setSpacing(spacingHint()); |
122 | } | 122 | } |
123 | topLayout->addStretch( 1 ); | ||
123 | mGeneral->initHeader(topFrame,topLayout); | 124 | mGeneral->initHeader(topFrame,topLayout); |
125 | topLayout->addStretch( 1 ); | ||
124 | mGeneral->initTime(topFrame,topLayout); | 126 | mGeneral->initTime(topFrame,topLayout); |
127 | topLayout->addStretch( 1 ); | ||
125 | mGeneral->initAlarm(topFrame,topLayout); | 128 | mGeneral->initAlarm(topFrame,topLayout); |
129 | topLayout->addStretch( 1 ); | ||
126 | mGeneral->enableAlarm( false ); | 130 | mGeneral->enableAlarm( false ); |
127 | 131 | ||
128 | 132 | ||
129 | QBoxLayout *priorityLayout; | 133 | QBoxLayout *priorityLayout; |
130 | if ( QApplication::desktop()->width() < 500 ) | 134 | if ( QApplication::desktop()->width() < 500 ) |
131 | priorityLayout = new QVBoxLayout( topLayout ); | 135 | priorityLayout = new QVBoxLayout( topLayout ); |
132 | else | 136 | else |
133 | priorityLayout = new QHBoxLayout( topLayout ); | 137 | priorityLayout = new QHBoxLayout( topLayout ); |
134 | QWidget* prioWidget = new QWidget (topFrame); | 138 | QWidget* prioWidget = new QWidget (topFrame); |
135 | priorityLayout->addWidget( prioWidget ); | 139 | priorityLayout->addWidget( prioWidget ); |
136 | QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget); | 140 | QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget); |
137 | 141 | ||
138 | 142 | ||
139 | QIconSet icon; | 143 | QIconSet icon; |
140 | if ( QApplication::desktop()->width() < 321 ) | 144 | if ( QApplication::desktop()->width() < 321 ) |
141 | icon = SmallIcon("fileimport16"); | 145 | icon = SmallIcon("fileimport16"); |
142 | else | 146 | else |
143 | icon = SmallIcon("fileimport"); | 147 | icon = SmallIcon("fileimport"); |
144 | QPushButton * loadTemplate = new QPushButton( prioWidget); | 148 | QPushButton * loadTemplate = new QPushButton( prioWidget); |
145 | loadTemplate->setIconSet (icon ) ; | 149 | loadTemplate->setIconSet (icon ) ; |
146 | int size = loadTemplate->sizeHint().height(); | 150 | int size = loadTemplate->sizeHint().height(); |
147 | loadTemplate->setFixedSize( size, size ); | 151 | loadTemplate->setFixedSize( size, size ); |
148 | if ( QApplication::desktop()->width() < 321 ) | 152 | if ( QApplication::desktop()->width() < 321 ) |
149 | icon = SmallIcon("fileexport16"); | 153 | icon = SmallIcon("fileexport16"); |
150 | else | 154 | else |
151 | icon = SmallIcon("fileexport"); | 155 | icon = SmallIcon("fileexport"); |
152 | QPushButton * saveTemplate = new QPushButton( prioWidget); | 156 | QPushButton * saveTemplate = new QPushButton( prioWidget); |
153 | saveTemplate->setIconSet (icon ) ; | 157 | saveTemplate->setIconSet (icon ) ; |
154 | saveTemplate->setFixedSize( size, size ); | 158 | saveTemplate->setFixedSize( size, size ); |
155 | 159 | ||
156 | priorityLayout2->addWidget(loadTemplate); | 160 | priorityLayout2->addWidget(loadTemplate); |
157 | priorityLayout2->addWidget(saveTemplate); | 161 | priorityLayout2->addWidget(saveTemplate); |
158 | mGeneral->initPriority(prioWidget,priorityLayout2); | 162 | mGeneral->initPriority(prioWidget,priorityLayout2); |
159 | mGeneral->initCategories( topFrame, priorityLayout ); | 163 | mGeneral->initCategories( topFrame, priorityLayout ); |
160 | topLayout->addStretch(1); | 164 | topLayout->addStretch(1); |
161 | 165 | ||
162 | QFrame *topFrame2 = addPage(i18n("Details")); | 166 | QFrame *topFrame2 = addPage(i18n("Details")); |
163 | 167 | ||
164 | QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); | 168 | QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); |
165 | topLayout2->setMargin(marginHint()); | 169 | topLayout2->setMargin(marginHint()); |
166 | topLayout2->setSpacing(spacingHint()); | 170 | topLayout2->setSpacing(spacingHint()); |
167 | 171 | ||
168 | QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 ); | 172 | QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 ); |
169 | mGeneral->initCompletion(topFrame2,completionLayout); | 173 | mGeneral->initCompletion(topFrame2,completionLayout); |
170 | 174 | ||
171 | 175 | ||
172 | mGeneral->initSecrecy( topFrame2, topLayout2 ); | 176 | mGeneral->initSecrecy( topFrame2, topLayout2 ); |
173 | mGeneral->initDescription(topFrame2,topLayout2); | 177 | mGeneral->initDescription(topFrame2,topLayout2); |
174 | 178 | ||
175 | // QHBox * hb = new QHBox ( topFrame2 ); | 179 | // QHBox * hb = new QHBox ( topFrame2 ); |
176 | // topLayout2->addWidget(hb); | 180 | // topLayout2->addWidget(hb); |
177 | // hb->setSpacing( 3 ); | 181 | // hb->setSpacing( 3 ); |
178 | 182 | ||
179 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 183 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
180 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 184 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
181 | 185 | ||
182 | } else { | 186 | } else { |
183 | QFrame *topFrame = addPage(i18n("General")); | 187 | QFrame *topFrame = addPage(i18n("General")); |
184 | 188 | ||
185 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); | 189 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); |
186 | topLayout->setSpacing(spacingHint()); | 190 | topLayout->setSpacing(spacingHint()); |
187 | 191 | ||
188 | mGeneral->initHeader(topFrame,topLayout); | 192 | mGeneral->initHeader(topFrame,topLayout); |
189 | mGeneral->initTime(topFrame,topLayout); | 193 | mGeneral->initTime(topFrame,topLayout); |
190 | mGeneral->initStatus(topFrame,topLayout); | 194 | mGeneral->initStatus(topFrame,topLayout); |
191 | QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); | 195 | QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); |
192 | mGeneral->initAlarm(topFrame,alarmLineLayout); | 196 | mGeneral->initAlarm(topFrame,alarmLineLayout); |
193 | mGeneral->initDescription(topFrame,topLayout); | 197 | mGeneral->initDescription(topFrame,topLayout); |
194 | QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); | 198 | QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); |
195 | mGeneral->initCategories( topFrame, detailsLayout ); | 199 | mGeneral->initCategories( topFrame, detailsLayout ); |
196 | mGeneral->initSecrecy( topFrame, detailsLayout ); | 200 | mGeneral->initSecrecy( topFrame, detailsLayout ); |
197 | } | 201 | } |
198 | mGeneral->finishSetup(); | 202 | mGeneral->finishSetup(); |
199 | 203 | ||
200 | } | 204 | } |
201 | 205 | ||
202 | void KOTodoEditor::editTodo(Todo *todo, bool editDescription) | 206 | void KOTodoEditor::editTodo(Todo *todo, bool editDescription) |
203 | { | 207 | { |
204 | //init(); | 208 | //init(); |
205 | 209 | ||
206 | mTodo = todo; | 210 | mTodo = todo; |
207 | readTodo(mTodo); | 211 | readTodo(mTodo); |
208 | if ( editDescription ) { | 212 | if ( editDescription ) { |
209 | showPage( 1 ); | 213 | showPage( 1 ); |
210 | mGeneral->setFocusOn( 1 ); | 214 | mGeneral->setFocusOn( 1 ); |
211 | } else { | 215 | } else { |
212 | showPage( 0 ); | 216 | showPage( 0 ); |
213 | mGeneral->setFocusOn( 2 ); | 217 | mGeneral->setFocusOn( 2 ); |
214 | } | 218 | } |
215 | checkRecurrence(); | 219 | checkRecurrence(); |
216 | } | 220 | } |
217 | 221 | ||
218 | void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay) | 222 | void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay) |
219 | { | 223 | { |
220 | //init(); | 224 | //init(); |
221 | 225 | ||
222 | mTodo = 0; | 226 | mTodo = 0; |
223 | setDefaults(due,relatedTodo,allDay); | 227 | setDefaults(due,relatedTodo,allDay); |
224 | } | 228 | } |
225 | 229 | ||
226 | void KOTodoEditor::loadDefaults() | 230 | void KOTodoEditor::loadDefaults() |
227 | { | 231 | { |
228 | setDefaults(QDateTime::currentDateTime().addDays(7),0,false); | 232 | setDefaults(QDateTime::currentDateTime().addDays(7),0,false); |
229 | } | 233 | } |
230 | 234 | ||
231 | bool KOTodoEditor::processInput( bool emitTime ) | 235 | bool KOTodoEditor::processInput( bool emitTime ) |
232 | { | 236 | { |
233 | if (!validateInput()) return false; | 237 | if (!validateInput()) return false; |
234 | 238 | ||
235 | Todo *todo = 0; | 239 | Todo *todo = 0; |
236 | 240 | ||
237 | if (mTodo) todo = mTodo; | 241 | if (mTodo) todo = mTodo; |
238 | else { | 242 | else { |
239 | todo = new Todo; | 243 | todo = new Todo; |
240 | todo->setOrganizer(KOPrefs::instance()->email()); | 244 | todo->setOrganizer(KOPrefs::instance()->email()); |
241 | } | 245 | } |
242 | 246 | ||
243 | writeTodo(todo); | 247 | writeTodo(todo); |
244 | if ( emitTime ) { | 248 | if ( emitTime ) { |
245 | globalFlagBlockAgenda = 1; | 249 | globalFlagBlockAgenda = 1; |
246 | emit showAgendaView( false ); | 250 | emit showAgendaView( false ); |
247 | if ( todo->hasDueDate() ) | 251 | if ( todo->hasDueDate() ) |
248 | emit jumpToTime( todo->dtDue().date() ); | 252 | emit jumpToTime( todo->dtDue().date() ); |
249 | globalFlagBlockAgenda = 2; | 253 | globalFlagBlockAgenda = 2; |
250 | } | 254 | } |
251 | if (mTodo) { | 255 | if (mTodo) { |
252 | todo->setRevision(todo->revision()+1); | 256 | todo->setRevision(todo->revision()+1); |
253 | emit todoChanged(todo); | 257 | emit todoChanged(todo); |
254 | } else { | 258 | } else { |
255 | mCalendar->addTodo(todo); | 259 | mCalendar->addTodo(todo); |
256 | mTodo = todo; | 260 | mTodo = todo; |
257 | emit todoAdded(todo); | 261 | emit todoAdded(todo); |
258 | } | 262 | } |
259 | 263 | ||
260 | return true; | 264 | return true; |
261 | } | 265 | } |
262 | 266 | ||
263 | void KOTodoEditor::deleteTodo() | 267 | void KOTodoEditor::deleteTodo() |
264 | { | 268 | { |
265 | if (mTodo) { | 269 | if (mTodo) { |
266 | if (KOPrefs::instance()->mConfirm) { | 270 | if (KOPrefs::instance()->mConfirm) { |
267 | switch (msgItemDelete()) { | 271 | switch (msgItemDelete()) { |
268 | case KMessageBox::Continue: // OK | 272 | case KMessageBox::Continue: // OK |
269 | emit todoToBeDeleted(mTodo); | 273 | emit todoToBeDeleted(mTodo); |
270 | emit dialogClose(mTodo); | 274 | emit dialogClose(mTodo); |
271 | mCalendar->deleteTodo(mTodo); | 275 | mCalendar->deleteTodo(mTodo); |
272 | emit todoDeleted(); | 276 | emit todoDeleted(); |
273 | reject(); | 277 | reject(); |
274 | break; | 278 | break; |
275 | } | 279 | } |
276 | } | 280 | } |
277 | else { | 281 | else { |
278 | emit todoToBeDeleted(mTodo); | 282 | emit todoToBeDeleted(mTodo); |
279 | emit dialogClose(mTodo); | 283 | emit dialogClose(mTodo); |
280 | mCalendar->deleteTodo(mTodo); | 284 | mCalendar->deleteTodo(mTodo); |
281 | emit todoDeleted(); | 285 | emit todoDeleted(); |
282 | reject(); | 286 | reject(); |
283 | } | 287 | } |
284 | } else { | 288 | } else { |
285 | reject(); | 289 | reject(); |
286 | } | 290 | } |
287 | } | 291 | } |
288 | 292 | ||
289 | void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) | 293 | void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) |
290 | { | 294 | { |
291 | mRelatedTodo = relatedEvent; | 295 | mRelatedTodo = relatedEvent; |
292 | 296 | ||
293 | mGeneral->setDefaults(due,allDay); | 297 | mGeneral->setDefaults(due,allDay); |
294 | mDetails->setDefaults(); | 298 | mDetails->setDefaults(); |
295 | showPage( 0 ); | 299 | showPage( 0 ); |
296 | if ( mRelatedTodo ) { | 300 | if ( mRelatedTodo ) { |
297 | mGeneral->setCategories (mRelatedTodo->categoriesStr ()); | 301 | mGeneral->setCategories (mRelatedTodo->categoriesStr ()); |
298 | mGeneral->setSecrecy (mRelatedTodo->secrecy ()); | 302 | mGeneral->setSecrecy (mRelatedTodo->secrecy ()); |
299 | if ( mRelatedTodo->priority() < 3 ) | 303 | if ( mRelatedTodo->priority() < 3 ) |
300 | mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1); | 304 | mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1); |
301 | mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": "); | 305 | mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": "); |
302 | int len = mRelatedTodo->summary().length(); | 306 | int len = mRelatedTodo->summary().length(); |
303 | mGeneral->mSummaryEdit->lineEdit()->setFocus(); | 307 | mGeneral->mSummaryEdit->lineEdit()->setFocus(); |
304 | mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 ); | 308 | mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 ); |
305 | mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 ); | 309 | mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 ); |
306 | 310 | ||
307 | } else | 311 | } else |
308 | mGeneral->setFocusOn( 2 ); | 312 | mGeneral->setFocusOn( 2 ); |
309 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); | 313 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); |
310 | mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 )); | 314 | mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 )); |
311 | } | 315 | } |
312 | void KOTodoEditor::checkRecurrence() | 316 | void KOTodoEditor::checkRecurrence() |
313 | { | 317 | { |
314 | if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { | 318 | if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { |
315 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true ); | 319 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true ); |
316 | 320 | ||
317 | if ( mTodo ) | 321 | if ( mTodo ) |
318 | mRecurrence->readEvent( mTodo ); | 322 | mRecurrence->readEvent( mTodo ); |
319 | else { | 323 | else { |
320 | bool time = mGeneral->mTimeButton->isChecked(); | 324 | bool time = mGeneral->mTimeButton->isChecked(); |
321 | QDateTime from,to; | 325 | QDateTime from,to; |
322 | if ( time ) { | 326 | if ( time ) { |
323 | to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ; | 327 | to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ; |
324 | from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ; | 328 | from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ; |
325 | } else { | 329 | } else { |
326 | to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ; | 330 | to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ; |
327 | from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ; | 331 | from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ; |
328 | } | 332 | } |
329 | if ( to < from ) | 333 | if ( to < from ) |
330 | to = from; | 334 | to = from; |
331 | mRecurrence->setDefaults(from,to); | 335 | mRecurrence->setDefaults(from,to); |
332 | } | 336 | } |
333 | } else { | 337 | } else { |
334 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); | 338 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); |
335 | mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 )); | 339 | mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 )); |
336 | } | 340 | } |
337 | } | 341 | } |
338 | void KOTodoEditor::readTodo(Todo *todo) | 342 | void KOTodoEditor::readTodo(Todo *todo) |
339 | { | 343 | { |
340 | mGeneral->readTodo(todo); | 344 | mGeneral->readTodo(todo); |
341 | mDetails->readEvent(todo); | 345 | mDetails->readEvent(todo); |
342 | mRelatedTodo = 0;//todo->relatedTo(); | 346 | mRelatedTodo = 0;//todo->relatedTo(); |
343 | // categories | 347 | // categories |
344 | // mCategoryDialog->setSelected(todo->categories()); | 348 | // mCategoryDialog->setSelected(todo->categories()); |
345 | 349 | ||
346 | // We should handle read-only events here. | 350 | // We should handle read-only events here. |
347 | } | 351 | } |
348 | 352 | ||
349 | void KOTodoEditor::writeTodo(Todo *event) | 353 | void KOTodoEditor::writeTodo(Todo *event) |
350 | { | 354 | { |
351 | bool maybeComputeRecurrenceTime = false; | 355 | bool maybeComputeRecurrenceTime = false; |
352 | if( event->hasRecurrenceID() && event->percentComplete() < 100) | 356 | if( event->hasRecurrenceID() && event->percentComplete() < 100) |
353 | maybeComputeRecurrenceTime = true; | 357 | maybeComputeRecurrenceTime = true; |
354 | event->setHasRecurrenceID( false ); | 358 | event->setHasRecurrenceID( false ); |
355 | mGeneral->writeTodo(event); | 359 | mGeneral->writeTodo(event); |
356 | mDetails->writeEvent(event); | 360 | mDetails->writeEvent(event); |
357 | 361 | ||
358 | // set related event, i.e. parent to-do in this case. | 362 | // set related event, i.e. parent to-do in this case. |
359 | if (mRelatedTodo) { | 363 | if (mRelatedTodo) { |
360 | event->setRelatedTo(mRelatedTodo); | 364 | event->setRelatedTo(mRelatedTodo); |
361 | } | 365 | } |
362 | if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { | 366 | if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { |
363 | mRecurrence->writeEvent(event); | 367 | mRecurrence->writeEvent(event); |
364 | if ( event->doesRecur() ) { | 368 | if ( event->doesRecur() ) { |
365 | int addSec = -1 ; | 369 | int addSec = -1 ; |
366 | if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 ) | 370 | if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 ) |
367 | addSec = 1; | 371 | addSec = 1; |
368 | event->setRecurrenceID( event->dtStart().addSecs( addSec ) ); | 372 | event->setRecurrenceID( event->dtStart().addSecs( addSec ) ); |
369 | event->setRecurDates(); | 373 | event->setRecurDates(); |
370 | } else { | 374 | } else { |
371 | event->setHasRecurrenceID( false ); | 375 | event->setHasRecurrenceID( false ); |
372 | } | 376 | } |
373 | } else { | 377 | } else { |
374 | event->setHasRecurrenceID( false ); | 378 | event->setHasRecurrenceID( false ); |
375 | event->recurrence()->unsetRecurs(); | 379 | event->recurrence()->unsetRecurs(); |
376 | } | 380 | } |
377 | } | 381 | } |
378 | 382 | ||
379 | bool KOTodoEditor::validateInput() | 383 | bool KOTodoEditor::validateInput() |
380 | { | 384 | { |
381 | if (!mGeneral->validateInput()) return false; | 385 | if (!mGeneral->validateInput()) return false; |
382 | if (!mDetails->validateInput()) return false; | 386 | if (!mDetails->validateInput()) return false; |
383 | return true; | 387 | return true; |
384 | } | 388 | } |
385 | 389 | ||
386 | int KOTodoEditor::msgItemDelete() | 390 | int KOTodoEditor::msgItemDelete() |
387 | { | 391 | { |
388 | return KMessageBox::warningContinueCancel(this, | 392 | return KMessageBox::warningContinueCancel(this, |
389 | i18n("This item will be permanently deleted."), | 393 | i18n("This item will be permanently deleted."), |
390 | i18n("KOrganizer Confirmation"),i18n("Delete")); | 394 | i18n("KOrganizer Confirmation"),i18n("Delete")); |
391 | } | 395 | } |
392 | 396 | ||
393 | void KOTodoEditor::modified (int modification) | 397 | void KOTodoEditor::modified (int modification) |
394 | { | 398 | { |
395 | if (modification == KOGlobals::CATEGORY_MODIFIED || | 399 | if (modification == KOGlobals::CATEGORY_MODIFIED || |
396 | KOGlobals::UNKNOWN_MODIFIED == modification ) | 400 | KOGlobals::UNKNOWN_MODIFIED == modification ) |
397 | // mCategoryDialog->setSelected (mTodo->categories ()); | 401 | // mCategoryDialog->setSelected (mTodo->categories ()); |
398 | mGeneral->modified (mTodo, modification); | 402 | mGeneral->modified (mTodo, modification); |
399 | 403 | ||
400 | } | 404 | } |
401 | 405 | ||
402 | void KOTodoEditor::slotLoadTemplate() | 406 | void KOTodoEditor::slotLoadTemplate() |
403 | { | 407 | { |
404 | 408 | ||
405 | QString fileName =locateLocal( "templates", "todos" ); | 409 | QString fileName =locateLocal( "templates", "todos" ); |
406 | QDir t_dir; | 410 | QDir t_dir; |
407 | if ( !t_dir.exists(fileName) ) | 411 | if ( !t_dir.exists(fileName) ) |
408 | t_dir.mkdir ( fileName ); | 412 | t_dir.mkdir ( fileName ); |
409 | fileName += "/todo"; | 413 | fileName += "/todo"; |
410 | fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this ); | 414 | fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this ); |
411 | if ( fileName.length() == 0 ) | 415 | if ( fileName.length() == 0 ) |
412 | return; | 416 | return; |
413 | CalendarLocal cal; | 417 | CalendarLocal cal; |
414 | ICalFormat format; | 418 | ICalFormat format; |
415 | if ( !format.load( &cal, fileName ) ) { | 419 | if ( !format.load( &cal, fileName ) ) { |
416 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") | 420 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") |
417 | .arg( fileName ) ); | 421 | .arg( fileName ) ); |
418 | return ; | 422 | return ; |
419 | } | 423 | } |
420 | QPtrList<Todo> todos = cal.todos(); | 424 | QPtrList<Todo> todos = cal.todos(); |
421 | Todo * todo = todos.first(); | 425 | Todo * todo = todos.first(); |
422 | if ( !todo ) { | 426 | if ( !todo ) { |
423 | KMessageBox::error( this, | 427 | KMessageBox::error( this, |
424 | i18n("Template does not\ncontain a valid Todo.")); | 428 | i18n("Template does not\ncontain a valid Todo.")); |
425 | } else { | 429 | } else { |
426 | readTodo( todo ); | 430 | readTodo( todo ); |
427 | } | 431 | } |
428 | 432 | ||
429 | } | 433 | } |
430 | 434 | ||
431 | void KOTodoEditor::slotSaveTemplate() | 435 | void KOTodoEditor::slotSaveTemplate() |
432 | { | 436 | { |
433 | QString fileName =locateLocal( "templates", "todos" ); | 437 | QString fileName =locateLocal( "templates", "todos" ); |
434 | QDir t_dir; | 438 | QDir t_dir; |
435 | if ( !t_dir.exists(fileName) ) | 439 | if ( !t_dir.exists(fileName) ) |
436 | t_dir.mkdir ( fileName ); | 440 | t_dir.mkdir ( fileName ); |
437 | fileName += "/todo"; | 441 | fileName += "/todo"; |
438 | fileName = KFileDialog::getSaveFileName( fileName , "Save as Todo template", this ); | 442 | fileName = KFileDialog::getSaveFileName( fileName , "Save as Todo template", this ); |
439 | if ( fileName.length() > 0 ) | 443 | if ( fileName.length() > 0 ) |
440 | saveTemplate( fileName ); | 444 | saveTemplate( fileName ); |
441 | } | 445 | } |
442 | 446 | ||
443 | void KOTodoEditor::saveTemplate( const QString &templateName ) | 447 | void KOTodoEditor::saveTemplate( const QString &templateName ) |
444 | { | 448 | { |
445 | Todo *todo = new Todo; | 449 | Todo *todo = new Todo; |
446 | writeTodo( todo ); | 450 | writeTodo( todo ); |
447 | saveAsTemplate( todo, templateName ); | 451 | saveAsTemplate( todo, templateName ); |
448 | } | 452 | } |