summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-18 09:36:33 (UTC)
committer zautrix <zautrix>2005-02-18 09:36:33 (UTC)
commit59a00e603e2ba14885e81c09daf3bb89859ff176 (patch) (unidiff)
treee257e5b0e338675c5448f9d4c57eadf68ed5e76b
parentb1e885da3b0a083121f940485d9c0eea53ff5139 (diff)
downloadkdepimpi-59a00e603e2ba14885e81c09daf3bb89859ff176.zip
kdepimpi-59a00e603e2ba14885e81c09daf3bb89859ff176.tar.gz
kdepimpi-59a00e603e2ba14885e81c09daf3bb89859ff176.tar.bz2
recur fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt8
-rw-r--r--korganizer/kolistview.cpp6
-rw-r--r--libkcal/recurrence.cpp12
-rw-r--r--pwmanager/pwmanager/pwm.cpp8
-rw-r--r--pwmanager/pwmanager/pwminit.cpp8
-rw-r--r--pwmanager/pwmanager/pwmview.cpp2
6 files changed, 29 insertions, 15 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index ab6d220..58be545 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1095,198 +1095,206 @@
1095{ "Show time in agenda items","Zeige Zeit in Agenda Items" }, 1095{ "Show time in agenda items","Zeige Zeit in Agenda Items" },
1096{ "Color for Sundays + category "Holiday"","Farbe für Sonntags + Kategorie "Feiertag"" }, 1096{ "Color for Sundays + category "Holiday"","Farbe für Sonntags + Kategorie "Feiertag"" },
1097{ "Show events, that are done in \nWhat's Next view","Zeige abgelaufene Termine in\nWhat's Next Ansicht" }, 1097{ "Show events, that are done in \nWhat's Next view","Zeige abgelaufene Termine in\nWhat's Next Ansicht" },
1098{ "Hide not running Todos in To-do view","Verstecke nicht laufende Todos" }, 1098{ "Hide not running Todos in To-do view","Verstecke nicht laufende Todos" },
1099{ "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" }, 1099{ "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" },
1100{ "KO/Pi","KO/Pi" }, 1100{ "KO/Pi","KO/Pi" },
1101{ "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" }, 1101{ "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" },
1102{ "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." }, 1102{ "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." },
1103{ "Sound.Al.: ","Sound.Al.: " }, 1103{ "Sound.Al.: ","Sound.Al.: " },
1104{ "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" }, 1104{ "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" },
1105{ "Restore","Wiederherstellen" }, 1105{ "Restore","Wiederherstellen" },
1106{ "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklicht\nwiederherstellen?" }, 1106{ "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklicht\nwiederherstellen?" },
1107{ "% completed","% komplett" }, 1107{ "% completed","% komplett" },
1108{ "%d item(s) found.","%d Item(s) gefunden." }, 1108{ "%d item(s) found.","%d Item(s) gefunden." },
1109{ "Set complete","Setze auf erledigt" }, 1109{ "Set complete","Setze auf erledigt" },
1110{ "(cancelled)","(gecancelt)" }, 1110{ "(cancelled)","(gecancelt)" },
1111{ "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" }, 1111{ "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" },
1112{ " Local time "," Locale Zeit " }, 1112{ " Local time "," Locale Zeit " },
1113{ "Form2","Form2" }, 1113{ "Form2","Form2" },
1114{ "Filter enabled","Filter angeschaltet" }, 1114{ "Filter enabled","Filter angeschaltet" },
1115{ "Edit Filters","Ändere Filter" }, 1115{ "Edit Filters","Ändere Filter" },
1116{ "Print What's Next View...","Drucke What's Next Ansicht..." }, 1116{ "Print What's Next View...","Drucke What's Next Ansicht..." },
1117{ "Agenda","Agenda" }, 1117{ "Agenda","Agenda" },
1118{ " ("," (" }, 1118{ " ("," (" },
1119{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" }, 1119{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" },
1120{ "Print","Print" }, 1120{ "Print","Print" },
1121{ "&Setup Printer...","Drucker &Setup..." }, 1121{ "&Setup Printer...","Drucker &Setup..." },
1122{ "View Type","Zeige Typ" }, 1122{ "View Type","Zeige Typ" },
1123{ "Page &orientation:","Seiten Ausrichtung:" }, 1123{ "Page &orientation:","Seiten Ausrichtung:" },
1124{ "Use Default of Selected Style","Default des selektierten Stils" }, 1124{ "Use Default of Selected Style","Default des selektierten Stils" },
1125{ "Use Default Setting of Printer","Default Einstellung des Druckers" }, 1125{ "Use Default Setting of Printer","Default Einstellung des Druckers" },
1126{ "Portrait","Portrait" }, 1126{ "Portrait","Portrait" },
1127{ "Landscape","Landschaft" }, 1127{ "Landscape","Landschaft" },
1128{ "Print day","Drucke Tag" }, 1128{ "Print day","Drucke Tag" },
1129{ "CalPrintDay_Base","CalPrintDay_Base" }, 1129{ "CalPrintDay_Base","CalPrintDay_Base" },
1130{ "Date && Time Range","Datum && Zeitspanne" }, 1130{ "Date && Time Range","Datum && Zeitspanne" },
1131{ "&End date:","&Enddatum:" }, 1131{ "&End date:","&Enddatum:" },
1132{ "&Start date:","&Startdatum:" }, 1132{ "&Start date:","&Startdatum:" },
1133{ "Start &time:","Startzeit:" }, 1133{ "Start &time:","Startzeit:" },
1134{ "End ti&me:","Endzeit:" }, 1134{ "End ti&me:","Endzeit:" },
1135{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" }, 1135{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" },
1136{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" }, 1136{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" },
1137{ "Alt+D","Alt+D" }, 1137{ "Alt+D","Alt+D" },
1138{ "&Use colors","Nutze Farben" }, 1138{ "&Use colors","Nutze Farben" },
1139{ "Alt+U","Alt+U" }, 1139{ "Alt+U","Alt+U" },
1140{ "Print week","Drucke Woche" }, 1140{ "Print week","Drucke Woche" },
1141{ "CalPrintWeek_Base","CalPrintWeek_Base" }, 1141{ "CalPrintWeek_Base","CalPrintWeek_Base" },
1142{ "Use &colors","Nutze Farben" }, 1142{ "Use &colors","Nutze Farben" },
1143{ "Type of View","Typ der Ansicht" }, 1143{ "Type of View","Typ der Ansicht" },
1144{ "Print as &Filofax page","Drucke als &Filofax Seite" }, 1144{ "Print as &Filofax page","Drucke als &Filofax Seite" },
1145{ "Alt+F","Alt+F" }, 1145{ "Alt+F","Alt+F" },
1146{ "Print as &timetable view:","Drucke als Zeittabelle:" }, 1146{ "Print as &timetable view:","Drucke als Zeittabelle:" },
1147{ "Alt+T","Alt+T" }, 1147{ "Alt+T","Alt+T" },
1148{ "Print as split week view","Drucke als gesplittete Wochenansicht" }, 1148{ "Print as split week view","Drucke als gesplittete Wochenansicht" },
1149{ "Print month","Drucke Monat" }, 1149{ "Print month","Drucke Monat" },
1150{ "CalPrintMonth_Base","CalPrintMonth_Base" }, 1150{ "CalPrintMonth_Base","CalPrintMonth_Base" },
1151{ "&Start month:","&Startmonat:" }, 1151{ "&Start month:","&Startmonat:" },
1152{ "&End month:","&Endmonat:" }, 1152{ "&End month:","&Endmonat:" },
1153{ "Print week &numbers","Drucke Wochen Nummer(n)" }, 1153{ "Print week &numbers","Drucke Wochen Nummer(n)" },
1154{ "Print todos","Drucke Todos" }, 1154{ "Print todos","Drucke Todos" },
1155{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" }, 1155{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" },
1156{ "Include &description of the item","Inclusive Itembeschreibung" }, 1156{ "Include &description of the item","Inclusive Itembeschreibung" },
1157{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" }, 1157{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" },
1158{ "Include &priority of the item","Inclusive Priorität des Items" }, 1158{ "Include &priority of the item","Inclusive Priorität des Items" },
1159{ "Items to Print","Zu druckende Items" }, 1159{ "Items to Print","Zu druckende Items" },
1160{ "&From:","Von:" }, 1160{ "&From:","Von:" },
1161{ "&To:","Bis:" }, 1161{ "&To:","Bis:" },
1162{ "Print &all todo items","Drucke alle Todo Items" }, 1162{ "Print &all todo items","Drucke alle Todo Items" },
1163{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" }, 1163{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" },
1164{ "Only items due in the &range:","Nur Items in dem Zeitraum:" }, 1164{ "Only items due in the &range:","Nur Items in dem Zeitraum:" },
1165{ "Todo List","Todo Liste" }, 1165{ "Todo List","Todo Liste" },
1166{ "&Title:","&Titel:" }, 1166{ "&Title:","&Titel:" },
1167{ "Co&nnect subtodos with its parent","Verbinde Unter-Todos mit ihren Ober-Todos" }, 1167{ "Co&nnect subtodos with its parent","Verbinde Unter-Todos mit ihren Ober-Todos" },
1168{ "Todo list","Todo Liste" }, 1168{ "Todo list","Todo Liste" },
1169{ "&Print...","Drucke..." }, 1169{ "&Print...","Drucke..." },
1170{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" }, 1170{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" },
1171{ "[Unconfigured]","[Unkonfiguriert]" }, 1171{ "[Unconfigured]","[Unkonfiguriert]" },
1172{ "OK","OK" }, 1172{ "OK","OK" },
1173{ "FilterEditor","FilterEditor" }, 1173{ "FilterEditor","FilterEditor" },
1174{ "Include","Inclusive" }, 1174{ "Include","Inclusive" },
1175{ "Exclude","Exclusive" }, 1175{ "Exclude","Exclusive" },
1176{ "Edit Selection...","Editiere Auswahl" }, 1176{ "Edit Selection...","Editiere Auswahl" },
1177{ "recurring events","wiederholende Termine" }, 1177{ "recurring events","wiederholende Termine" },
1178{ "recurr. events","wiederh.Termine" }, 1178{ "recurr. events","wiederh.Termine" },
1179{ "completed to-dos","erledigte Todos" }, 1179{ "completed to-dos","erledigte Todos" },
1180{ "events","Termine" }, 1180{ "events","Termine" },
1181{ "todos","Todos" }, 1181{ "todos","Todos" },
1182{ "journals","Journale" }, 1182{ "journals","Journale" },
1183{ "public","öffentl." }, 1183{ "public","öffentl." },
1184{ "private","privat" }, 1184{ "private","privat" },
1185{ "confidential","vertraul." }, 1185{ "confidential","vertraul." },
1186{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" }, 1186{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" },
1187{ "Yesterday","Gestern" }, 1187{ "Yesterday","Gestern" },
1188{ "Day after tomorrow","Übermorgen" }, 1188{ "Day after tomorrow","Übermorgen" },
1189{ "Tomorrow","Morgen" }, 1189{ "Tomorrow","Morgen" },
1190{ "Day before yesterday","Vorgestern" }, 1190{ "Day before yesterday","Vorgestern" },
1191{ "Size %1","Größe %1" }, 1191{ "Size %1","Größe %1" },
1192{ "New Agendasize: %1","Neue Agendagröße: %1" }, 1192{ "New Agendasize: %1","Neue Agendagröße: %1" },
1193{ " (%1 y.)"," (%1 J.)" }, 1193{ " (%1 y.)"," (%1 J.)" },
1194{ "Allday:","Ganztägig:" }, 1194{ "Allday:","Ganztägig:" },
1195{ "compl.todos","erled.Todos" }, 1195{ "compl.todos","erled.Todos" },
1196{ "Day view","Tagesansicht" }, 1196{ "Day view","Tagesansicht" },
1197{ "Next days","Nächste Tage" }, 1197{ "Next days","Nächste Tage" },
1198{ "Next week","Nächste Woche" }, 1198{ "Next week","Nächste Woche" },
1199{ "Next two weeks","Nächste zwei Wochen" }, 1199{ "Next two weeks","Nächste zwei Wochen" },
1200{ "Next month","Nächster Monat" }, 1200{ "Next month","Nächster Monat" },
1201{ "Journal view","Journal" }, 1201{ "Journal view","Journal" },
1202{ "Display all opened","Zeige alle geöffnet" }, 1202{ "Display all opened","Zeige alle geöffnet" },
1203{ "Display all closed","Zeige alle geschlossen" }, 1203{ "Display all closed","Zeige alle geschlossen" },
1204{ "Display all flat","Zeige alle flach" }, 1204{ "Display all flat","Zeige alle flach" },
1205{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, 1205{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" },
1206{ "Default todo done color:","Standard Todo erledigt Farbe" }, 1206{ "Default todo done color:","Standard Todo erledigt Farbe" },
1207{ "Select week %1-%2","Wähle Woche %1-%2" }, 1207{ "Select week %1-%2","Wähle Woche %1-%2" },
1208{ "Select Week","Wähle Woche" }, 1208{ "Select Week","Wähle Woche" },
1209{ "Set alarm for selected...","Setze Alarm für Selekt..." }, 1209{ "Set alarm for selected...","Setze Alarm für Selekt..." },
1210{ "Set Alarm!","Setze Alarm!" }, 1210{ "Set Alarm!","Setze Alarm!" },
1211{ "Canged alarm for %1 items","Alarm für %1 Items geändert" }, 1211{ "Canged alarm for %1 items","Alarm für %1 Items geändert" },
1212{ " and "," und " }, 1212{ " and "," und " },
1213{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, 1213{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" },
1214{ "Mail to selected","Mail an Ausgewählte" }, 1214{ "Mail to selected","Mail an Ausgewählte" },
1215{ "Mail to all","Mail an Alle" }, 1215{ "Mail to all","Mail an Alle" },
1216{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, 1216{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" },
1217{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, 1217{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" },
1218{ " on"," am" }, 1218{ " on"," am" },
1219{ " completed on "," erledigt am " }, 1219{ " completed on "," erledigt am " },
1220{ "Save as Event template","Speichere als Vorlage" }, 1220{ "Save as Event template","Speichere als Vorlage" },
1221{ "Load Event template","Lade Termin Vorlage" }, 1221{ "Load Event template","Lade Termin Vorlage" },
1222{ "Save as Journal template","Speichere als Journal Vorlage" }, 1222{ "Save as Journal template","Speichere als Journal Vorlage" },
1223{ "Insert Journal template","Füge Journal Vorlage ein" }, 1223{ "Insert Journal template","Füge Journal Vorlage ein" },
1224{ "Sub todos:<br>","Unter Todos:<br>" }, 1224{ "Sub todos:<br>","Unter Todos:<br>" },
1225{ "Parent todo:<br>","Über Todo:<br>" }, 1225{ "Parent todo:<br>","Über Todo:<br>" },
1226{ "Set current as color category","Setze Gewählte als Farbkategorie" }, 1226{ "Set current as color category","Setze Gewählte als Farbkategorie" },
1227{ " completed"," erledigt" }, 1227{ " completed"," erledigt" },
1228{ "(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- 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.net --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" }, 1228{ "(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- 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.net --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" },
1229{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." }, 1229{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." },
1230{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." }, 1230{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." },
1231{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." }, 1231{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." },
1232{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" }, 1232{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" },
1233{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." }, 1233{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." },
1234{ "Error","Fehler" }, 1234{ "Error","Fehler" },
1235{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." }, 1235{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." },
1236{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." }, 1236{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." },
1237{ "Warning","Warnung" }, 1237{ "Warning","Warnung" },
1238{ "Select week number","Wähle Wochen Nummer" }, 1238{ "Select week number","Wähle Wochen Nummer" },
1239{ "Februar","Februar" }, 1239{ "Februar","Februar" },
1240{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" }, 1240{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" },
1241{ "W","W" }, 1241{ "W","W" },
1242{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" }, 1242{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" },
1243{ "T: %1","T: %1" }, 1243{ "T: %1","T: %1" },
1244{ "Start: ","Start: " }, 1244{ "Start: ","Start: " },
1245{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " }, 1245{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " },
1246{ "Password for remote access:","Passwort für fernen Zugriff:" }, 1246{ "Password for remote access:","Passwort für fernen Zugriff:" },
1247{ "Remote IP address:","Ferne IP Adresse:" }, 1247{ "Remote IP address:","Ferne IP Adresse:" },
1248{ "Remote port number:","Ferne Port Nummer:" }, 1248{ "Remote port number:","Ferne Port Nummer:" },
1249{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." }, 1249{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." },
1250{ "Remote from: ","Fern von: " }, 1250{ "Remote from: ","Fern von: " },
1251{ "Local from: ","Lokal von: " }, 1251{ "Local from: ","Lokal von: " },
1252{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" }, 1252{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" },
1253{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, 1253{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" },
1254{ "Write back","Schreibe zurück" }, 1254{ "Write back","Schreibe zurück" },
1255{ "KO/Pi Synchronization","KO/Pi Synchronisation" }, 1255{ "KO/Pi Synchronization","KO/Pi Synchronisation" },
1256{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, 1256{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" },
1257{ "Received sync request","Sync Anfrage erhalten" }, 1257{ "Received sync request","Sync Anfrage erhalten" },
1258{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." }, 1258{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." },
1259{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, 1259{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." },
1260{ "Data saved to temp file!","Daten in temp Datei gespeichert!" }, 1260{ "Data saved to temp file!","Daten in temp Datei gespeichert!" },
1261{ "Sending file...","Sende Datei..." }, 1261{ "Sending file...","Sende Datei..." },
1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." }, 1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." },
1263{ "Receiving synced file...","Gesyncte Daten erhalten..." }, 1263{ "Receiving synced file...","Gesyncte Daten erhalten..." },
1264{ "Received %1 bytes","%1 Bytes erhalten" }, 1264{ "Received %1 bytes","%1 Bytes erhalten" },
1265{ "Writing file to disk...","Speichere Datei..." }, 1265{ "Writing file to disk...","Speichere Datei..." },
1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" }, 1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" },
1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, 1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" },
1268{ "Synchronize!","Synchronisiere!" }, 1268{ "Synchronize!","Synchronisiere!" },
1269{ "High clock skew!","Großer Uhrzeitunterschied!" }, 1269{ "High clock skew!","Großer Uhrzeitunterschied!" },
1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, 1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" },
1271{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" }, 1271{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" },
1272{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, 1272{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." },
1273{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, 1273{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" },
1274{ "List week view","Listenwochenansicht" }, 1274{ "List week view","Listenwochenansicht" },
1275{ "List week","Listenwochenansicht" }, 1275{ "List week","Listenwochenansicht" },
1276{ "Next Week","Nächste Woche" }, 1276{ "Next Week","Nächste Woche" },
1277{ "Previous Week","Vorherige Woche" }, 1277{ "Previous Week","Vorherige Woche" },
1278{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." }, 1278{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." },
1279{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, 1279{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" },
1280{ "Details","Details" }, 1280{ "Details","Details" },
1281{ "Created time","Erstellt Zeit" }, 1281{ "Created time","Erstellt Zeit" },
1282{ "Last modified time","Geändert Zeit" }, 1282{ "Last modified time","Geändert Zeit" },
1283{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, 1283{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" },
1284{ "View Options","Anzeige Optionen" }, 1284{ "View Options","Anzeige Optionen" },
1285{ "<b>Created: ","<b>Erstellt am: " }, 1285{ "<b>Created: ","<b>Erstellt am: " },
1286{ "<b>Last modified: ","<b>Zuletzt geändert am: " }, 1286{ "<b>Last modified: ","<b>Zuletzt geändert am: " },
1287{ "Journal: ","Journal: " },
1288{ "yearly","jährlich" },
1289{ "(%1) ","%1-" },
1290{ "","" },
1291{ "","" },
1292{ "","" },
1293{ "","" },
1294{ "","" },
1287{ "","" }, 1295{ "","" },
1288{ "","" }, 1296{ "","" },
1289{ "","" }, 1297{ "","" },
1290{ "","" }, 1298{ "","" },
1291{ "","" }, 1299{ "","" },
1292 1300
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 1f5afc0..4a6e17d 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1,389 +1,389 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1999 Preston Brown 3 Copyright (c) 1999 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 <qlistview.h> 25#include <qlistview.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qprogressbar.h> 29#include <qprogressbar.h>
30#include <qfileinfo.h> 30#include <qfileinfo.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qwhatsthis.h> 35#include <qwhatsthis.h>
36#include <qregexp.h> 36#include <qregexp.h>
37 37
38#include <klocale.h> 38#include <klocale.h>
39#include <kdebug.h> 39#include <kdebug.h>
40#include <kiconloader.h> 40#include <kiconloader.h>
41#include <kglobal.h> 41#include <kglobal.h>
42 42
43#include <libkdepim/kpimglobalprefs.h> 43#include <libkdepim/kpimglobalprefs.h>
44#include <libkcal/calendar.h> 44#include <libkcal/calendar.h>
45#include <libkcal/calendarlocal.h> 45#include <libkcal/calendarlocal.h>
46#include <libkcal/icalformat.h> 46#include <libkcal/icalformat.h>
47#include <libkcal/vcalformat.h> 47#include <libkcal/vcalformat.h>
48#include <libkcal/recurrence.h> 48#include <libkcal/recurrence.h>
49#include <libkcal/filestorage.h> 49#include <libkcal/filestorage.h>
50#include <libkdepim/categoryselectdialog.h> 50#include <libkdepim/categoryselectdialog.h>
51#include <libkcal/kincidenceformatter.h> 51#include <libkcal/kincidenceformatter.h>
52#ifndef DESKTOP_VERSION 52#ifndef DESKTOP_VERSION
53#include <qpe/qpeapplication.h> 53#include <qpe/qpeapplication.h>
54#else 54#else
55#include <qapplication.h> 55#include <qapplication.h>
56#endif 56#endif
57 57
58#ifndef KORG_NOPRINTER 58#ifndef KORG_NOPRINTER
59#include "calprinter.h" 59#include "calprinter.h"
60#endif 60#endif
61#include "koglobals.h" 61#include "koglobals.h"
62#include "koprefs.h" 62#include "koprefs.h"
63#include "kfiledialog.h" 63#include "kfiledialog.h"
64 64
65#include "kolistview.h" 65#include "kolistview.h"
66 66
67 67
68 68
69 69
70class KOListViewWhatsThis :public QWhatsThis 70class KOListViewWhatsThis :public QWhatsThis
71{ 71{
72public: 72public:
73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
74 74
75protected: 75protected:
76 virtual QString text( const QPoint& p) 76 virtual QString text( const QPoint& p)
77 { 77 {
78 return _view->getWhatsThisText(p) ; 78 return _view->getWhatsThisText(p) ;
79 } 79 }
80private: 80private:
81 QWidget* _wid; 81 QWidget* _wid;
82 KOListView * _view; 82 KOListView * _view;
83}; 83};
84 84
85 85
86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
87{ 87{
88 mItem = item; 88 mItem = item;
89 mDate = date; 89 mDate = date;
90} 90}
91 91
92ListItemVisitor::~ListItemVisitor() 92ListItemVisitor::~ListItemVisitor()
93{ 93{
94} 94}
95 95
96bool ListItemVisitor::visit(Event *e) 96bool ListItemVisitor::visit(Event *e)
97{ 97{
98 98
99 bool ok = false; 99 bool ok = false;
100 QString start, end; 100 QString start, end;
101 QDate ds, de; 101 QDate ds, de;
102 if ( e->doesRecur() ) { 102 if ( e->doesRecur() ) {
103 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 103 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
104 if ( ok ) { 104 if ( ok ) {
105 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 105 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
106 start = KGlobal::locale()->formatDate(ds,true); 106 start = KGlobal::locale()->formatDate(ds,true);
107 de = ds.addDays( days); 107 de = ds.addDays( days);
108 end = KGlobal::locale()->formatDate(de,true); 108 end = KGlobal::locale()->formatDate(de,true);
109 } 109 }
110 110
111 } 111 }
112 if ( ! ok ) { 112 if ( ! ok ) {
113 start =e->dtStartDateStr(); 113 start =e->dtStartDateStr();
114 end = e->dtEndDateStr(); 114 end = e->dtEndDateStr();
115 ds = e->dtStart().date(); 115 ds = e->dtStart().date();
116 de = e->dtEnd().date(); 116 de = e->dtEnd().date();
117 } 117 }
118 mItem->setText(0,e->summary()); 118 mItem->setText(0,e->summary());
119 mItem->setText(1,start); 119 mItem->setText(1,start);
120 mItem->setText(2,e->dtStartTimeStr()); 120 mItem->setText(2,e->dtStartTimeStr());
121 mItem->setText(3,end); 121 mItem->setText(3,end);
122 mItem->setText(4,e->dtEndTimeStr()); 122 mItem->setText(4,e->dtEndTimeStr());
123 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 123 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
124 mItem->setText(6, e->recurrence()->recurrenceText()); 124 mItem->setText(6, e->recurrence()->recurrenceText());
125 mItem->setText(7,"---"); 125 mItem->setText(7,"---");
126 mItem->setText(8,"---"); 126 mItem->setText(8,"---");
127 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 127 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
128 mItem->setText(10,e->categoriesStr()); 128 mItem->setText(10,e->categoriesStr());
129 129
130 QString key; 130 QString key;
131 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 131 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
132 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); 132 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
133 mItem->setSortKey(1,key); 133 mItem->setSortKey(1,key);
134 134
135 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 135 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
136 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); 136 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
137 mItem->setSortKey(3,key); 137 mItem->setSortKey(3,key);
138 138
139 return true; 139 return true;
140} 140}
141 141
142bool ListItemVisitor::visit(Todo *t) 142bool ListItemVisitor::visit(Todo *t)
143{ 143{
144 mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); 144 mItem->setText(0,i18n("Todo: %1").arg(t->summary()));
145 if (t->hasStartDate()) { 145 if (t->hasStartDate()) {
146 mItem->setText(1,t->dtStartDateStr()); 146 mItem->setText(1,t->dtStartDateStr());
147 if (t->doesFloat()) { 147 if (t->doesFloat()) {
148 mItem->setText(2,"---"); 148 mItem->setText(2,"---");
149 } else { 149 } else {
150 mItem->setText(2,t->dtStartTimeStr()); 150 mItem->setText(2,t->dtStartTimeStr());
151 } 151 }
152 } else { 152 } else {
153 mItem->setText(1,"---"); 153 mItem->setText(1,"---");
154 mItem->setText(2,"---"); 154 mItem->setText(2,"---");
155 } 155 }
156 mItem->setText(3,"---"); 156 mItem->setText(3,"---");
157 mItem->setText(4,"---"); 157 mItem->setText(4,"---");
158 mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 158 mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
159 mItem->setText(6, t->recurrence()->recurrenceText()); 159 mItem->setText(6, t->recurrence()->recurrenceText());
160 if (t->hasDueDate()) { 160 if (t->hasDueDate()) {
161 mItem->setText(7,t->dtDueDateStr()); 161 mItem->setText(7,t->dtDueDateStr());
162 if (t->doesFloat()) { 162 if (t->doesFloat()) {
163 mItem->setText(8,"---"); 163 mItem->setText(8,"---");
164 } else { 164 } else {
165 mItem->setText(8,t->dtDueTimeStr()); 165 mItem->setText(8,t->dtDueTimeStr());
166 } 166 }
167 } else { 167 } else {
168 mItem->setText(7,"---"); 168 mItem->setText(7,"---");
169 mItem->setText(8,"---"); 169 mItem->setText(8,"---");
170 } 170 }
171 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 171 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
172 mItem->setText(10,t->categoriesStr()); 172 mItem->setText(10,t->categoriesStr());
173 173
174 QString key; 174 QString key;
175 QDate d; 175 QDate d;
176 if (t->hasDueDate()) { 176 if (t->hasDueDate()) {
177 d = t->dtDue().date(); 177 d = t->dtDue().date();
178 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 178 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
179 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 179 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
180 mItem->setSortKey(7,key); 180 mItem->setSortKey(7,key);
181 } 181 }
182 if ( t->hasStartDate() ) { 182 if ( t->hasStartDate() ) {
183 d = t->dtStart().date(); 183 d = t->dtStart().date();
184 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 184 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
185 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 185 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
186 mItem->setSortKey(1,key); 186 mItem->setSortKey(1,key);
187 } 187 }
188 return true; 188 return true;
189} 189}
190 190
191bool ListItemVisitor::visit(Journal * j) 191bool ListItemVisitor::visit(Journal * j)
192{ 192{
193 QString des = j->description().left(50); 193 QString des = j->description().left(30);
194 des = des.simplifyWhiteSpace (); 194 des = des.simplifyWhiteSpace ();
195 des.replace (QRegExp ("\\n"),"" ); 195 des.replace (QRegExp ("\\n"),"" );
196 des.replace (QRegExp ("\\r"),"" ); 196 des.replace (QRegExp ("\\r"),"" );
197 mItem->setText(0,i18n("Journal")+": "+des.left(25)); 197 mItem->setText(0,i18n("Journal: ")+des.left(25));
198 mItem->setText(1,j->dtStartDateStr()); 198 mItem->setText(1,j->dtStartDateStr());
199 mItem->setText(2,"---"); 199 mItem->setText(2,"---");
200 mItem->setText(3,"---"); 200 mItem->setText(3,"---");
201 mItem->setText(4,"---"); 201 mItem->setText(4,"---");
202 mItem->setText(5,"---"); 202 mItem->setText(5,"---");
203 mItem->setText(6,"---"); 203 mItem->setText(6,"---");
204 mItem->setText(7,j->dtStartDateStr()); 204 mItem->setText(7,j->dtStartDateStr());
205 mItem->setText(8,"---"); 205 mItem->setText(8,"---");
206 mItem->setText(9,"---"); 206 mItem->setText(9,"---");
207 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 207 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
208 208
209 QString key; 209 QString key;
210 QDate d = j->dtStart().date(); 210 QDate d = j->dtStart().date();
211 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 211 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
212 mItem->setSortKey(1,key); 212 mItem->setSortKey(1,key);
213 mItem->setSortKey(7,key); 213 mItem->setSortKey(7,key);
214 214
215 return true; 215 return true;
216} 216}
217 217
218KOListView::KOListView(Calendar *calendar, QWidget *parent, 218KOListView::KOListView(Calendar *calendar, QWidget *parent,
219 const char *name) 219 const char *name)
220 : KOEventView(calendar, parent, name) 220 : KOEventView(calendar, parent, name)
221{ 221{
222 mActiveItem = 0; 222 mActiveItem = 0;
223 mListView = new KOListViewListView(this); 223 mListView = new KOListViewListView(this);
224 mListView->addColumn(i18n("Summary")); 224 mListView->addColumn(i18n("Summary"));
225 mListView->addColumn(i18n("Start Date")); 225 mListView->addColumn(i18n("Start Date"));
226 mListView->addColumn(i18n("Start Time")); 226 mListView->addColumn(i18n("Start Time"));
227 mListView->addColumn(i18n("End Date")); 227 mListView->addColumn(i18n("End Date"));
228 mListView->addColumn(i18n("End Time")); 228 mListView->addColumn(i18n("End Time"));
229 mListView->addColumn(i18n("Alarm")); // alarm set? 229 mListView->addColumn(i18n("Alarm")); // alarm set?
230 mListView->addColumn(i18n("Recurs")); // recurs? 230 mListView->addColumn(i18n("Recurs")); // recurs?
231 mListView->addColumn(i18n("Due Date")); 231 mListView->addColumn(i18n("Due Date"));
232 mListView->addColumn(i18n("Due Time")); 232 mListView->addColumn(i18n("Due Time"));
233 mListView->addColumn(i18n("Cancelled")); 233 mListView->addColumn(i18n("Cancelled"));
234 mListView->addColumn(i18n("Categories")); 234 mListView->addColumn(i18n("Categories"));
235 235
236 mListView->setColumnAlignment(0,AlignLeft); 236 mListView->setColumnAlignment(0,AlignLeft);
237 mListView->setColumnAlignment(1,AlignLeft); 237 mListView->setColumnAlignment(1,AlignLeft);
238 mListView->setColumnAlignment(2,AlignHCenter); 238 mListView->setColumnAlignment(2,AlignHCenter);
239 mListView->setColumnAlignment(3,AlignLeft); 239 mListView->setColumnAlignment(3,AlignLeft);
240 mListView->setColumnAlignment(4,AlignHCenter); 240 mListView->setColumnAlignment(4,AlignHCenter);
241 mListView->setColumnAlignment(5,AlignLeft); 241 mListView->setColumnAlignment(5,AlignLeft);
242 mListView->setColumnAlignment(6,AlignLeft); 242 mListView->setColumnAlignment(6,AlignLeft);
243 mListView->setColumnAlignment(7,AlignLeft); 243 mListView->setColumnAlignment(7,AlignLeft);
244 mListView->setColumnAlignment(8,AlignLeft); 244 mListView->setColumnAlignment(8,AlignLeft);
245 mListView->setColumnAlignment(9,AlignLeft); 245 mListView->setColumnAlignment(9,AlignLeft);
246 mListView->setColumnAlignment(10,AlignLeft); 246 mListView->setColumnAlignment(10,AlignLeft);
247 mListView->setColumnWidthMode(10, QListView::Manual); 247 mListView->setColumnWidthMode(10, QListView::Manual);
248 new KOListViewWhatsThis(mListView->viewport(),this); 248 new KOListViewWhatsThis(mListView->viewport(),this);
249 249
250 int iii = 0; 250 int iii = 0;
251 for ( iii = 0; iii< 10 ; ++iii ) 251 for ( iii = 0; iii< 10 ; ++iii )
252 mListView->setColumnWidthMode( iii, QListView::Manual ); 252 mListView->setColumnWidthMode( iii, QListView::Manual );
253 253
254 QBoxLayout *layoutTop = new QVBoxLayout(this); 254 QBoxLayout *layoutTop = new QVBoxLayout(this);
255 layoutTop->addWidget(mListView); 255 layoutTop->addWidget(mListView);
256 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 256 mListView->setFont ( KOPrefs::instance()->mListViewFont );
257 mPopupMenu = eventPopup(); 257 mPopupMenu = eventPopup();
258 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 258 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
259 i18n("Select all"),this, 259 i18n("Select all"),this,
260 SLOT(allSelection()),true); 260 SLOT(allSelection()),true);
261 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 261 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
262 i18n("Deselect all"),this, 262 i18n("Deselect all"),this,
263 SLOT(clearSelection()),true); 263 SLOT(clearSelection()),true);
264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
265 i18n("Delete all selected"),this, 265 i18n("Delete all selected"),this,
266 SLOT(deleteAll()),true); 266 SLOT(deleteAll()),true);
267 mPopupMenu->insertSeparator(); 267 mPopupMenu->insertSeparator();
268 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 268 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
269 i18n("Save selected to file..."),this, 269 i18n("Save selected to file..."),this,
270 SLOT(saveToFile()),true); 270 SLOT(saveToFile()),true);
271 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 271 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
272 i18n("Save Journal/Description..."),this, 272 i18n("Save Journal/Description..."),this,
273 SLOT(saveDescriptionToFile()),true); 273 SLOT(saveDescriptionToFile()),true);
274 // mPopupMenu->insertSeparator(); 274 // mPopupMenu->insertSeparator();
275 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 275 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
276 i18n("Add Categ. to selected..."),this, 276 i18n("Add Categ. to selected..."),this,
277 SLOT(addCat()),true); 277 SLOT(addCat()),true);
278 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 278 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
279 i18n("Set Categ. for selected..."),this, 279 i18n("Set Categ. for selected..."),this,
280 SLOT(setCat()),true); 280 SLOT(setCat()),true);
281 //mPopupMenu->insertSeparator(); 281 //mPopupMenu->insertSeparator();
282 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 282 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
283 i18n("Set alarm for selected..."),this, 283 i18n("Set alarm for selected..."),this,
284 SLOT(setAlarm()),true); 284 SLOT(setAlarm()),true);
285 285
286 286
287#ifndef DESKTOP_VERSION 287#ifndef DESKTOP_VERSION
288 mPopupMenu->insertSeparator(); 288 mPopupMenu->insertSeparator();
289 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 289 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
290 i18n("Beam selected via IR"),this, 290 i18n("Beam selected via IR"),this,
291 SLOT(beamSelected()),true); 291 SLOT(beamSelected()),true);
292#endif 292#endif
293 /* 293 /*
294 mPopupMenu = new QPopupMenu; 294 mPopupMenu = new QPopupMenu;
295 mPopupMenu->insertItem(i18n("Edit Event"), this, 295 mPopupMenu->insertItem(i18n("Edit Event"), this,
296 SLOT (editEvent())); 296 SLOT (editEvent()));
297 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 297 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
298 SLOT (deleteEvent())); 298 SLOT (deleteEvent()));
299 mPopupMenu->insertSeparator(); 299 mPopupMenu->insertSeparator();
300 mPopupMenu->insertItem(i18n("Show Dates"), this, 300 mPopupMenu->insertItem(i18n("Show Dates"), this,
301 SLOT(showDates())); 301 SLOT(showDates()));
302 mPopupMenu->insertItem(i18n("Hide Dates"), this, 302 mPopupMenu->insertItem(i18n("Hide Dates"), this,
303 SLOT(hideDates())); 303 SLOT(hideDates()));
304 */ 304 */
305 QObject::connect(mListView,SIGNAL( newEvent()), 305 QObject::connect(mListView,SIGNAL( newEvent()),
306 this,SIGNAL(signalNewEvent())); 306 this,SIGNAL(signalNewEvent()));
307 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 307 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
308 this,SLOT(defaultItemAction(QListViewItem *))); 308 this,SLOT(defaultItemAction(QListViewItem *)));
309 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, 309 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *,
310 const QPoint &, int )), 310 const QPoint &, int )),
311 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 311 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
312 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 312 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
313 SLOT(processSelectionChange(QListViewItem *))); 313 SLOT(processSelectionChange(QListViewItem *)));
314 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 314 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
315 SIGNAL(showIncidenceSignal(Incidence *)) ); 315 SIGNAL(showIncidenceSignal(Incidence *)) );
316 316
317 readSettings(KOGlobals::config(),"KOListView Layout"); 317 readSettings(KOGlobals::config(),"KOListView Layout");
318} 318}
319 319
320KOListView::~KOListView() 320KOListView::~KOListView()
321{ 321{
322 delete mPopupMenu; 322 delete mPopupMenu;
323} 323}
324QString KOListView::getWhatsThisText(QPoint p) 324QString KOListView::getWhatsThisText(QPoint p)
325{ 325{
326 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 326 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
327 if ( item ) 327 if ( item )
328 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 328 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
329 KOPrefs::instance()->mWTshowDetails, 329 KOPrefs::instance()->mWTshowDetails,
330 KOPrefs::instance()->mWTshowCreated, 330 KOPrefs::instance()->mWTshowCreated,
331 KOPrefs::instance()->mWTshowChanged); 331 KOPrefs::instance()->mWTshowChanged);
332 return i18n("That is the list view" ); 332 return i18n("That is the list view" );
333 333
334} 334}
335 335
336void KOListView::updateList() 336void KOListView::updateList()
337{ 337{
338 // qDebug(" KOListView::updateList() "); 338 // qDebug(" KOListView::updateList() ");
339 339
340} 340}
341 341
342void KOListView::addCat( ) 342void KOListView::addCat( )
343{ 343{
344 setCategories( false ); 344 setCategories( false );
345} 345}
346void KOListView::setCat() 346void KOListView::setCat()
347{ 347{
348 setCategories( true ); 348 setCategories( true );
349} 349}
350void KOListView::setAlarm() 350void KOListView::setAlarm()
351{ 351{
352 KOAlarmPrefs kap( this); 352 KOAlarmPrefs kap( this);
353 if ( !kap.exec() ) 353 if ( !kap.exec() )
354 return; 354 return;
355 355
356 356
357 QStringList itemList; 357 QStringList itemList;
358 QPtrList<KOListViewItem> sel ; 358 QPtrList<KOListViewItem> sel ;
359 QListViewItem *qitem = mListView->firstChild (); 359 QListViewItem *qitem = mListView->firstChild ();
360 while ( qitem ) { 360 while ( qitem ) {
361 if ( qitem->isSelected() ) { 361 if ( qitem->isSelected() ) {
362 Incidence* inc = ((KOListViewItem *) qitem)->data(); 362 Incidence* inc = ((KOListViewItem *) qitem)->data();
363 if ( inc->type() != "Journal" ) { 363 if ( inc->type() != "Journal" ) {
364 if ( inc->type() == "Todo" ) { 364 if ( inc->type() == "Todo" ) {
365 if ( ((Todo*)inc)->hasDueDate() ) 365 if ( ((Todo*)inc)->hasDueDate() )
366 sel.append(((KOListViewItem *)qitem)); 366 sel.append(((KOListViewItem *)qitem));
367 } else 367 } else
368 sel.append(((KOListViewItem *)qitem)); 368 sel.append(((KOListViewItem *)qitem));
369 } 369 }
370 } 370 }
371 qitem = qitem->nextSibling(); 371 qitem = qitem->nextSibling();
372 } 372 }
373 int count = 0; 373 int count = 0;
374 KOListViewItem * item, *temp; 374 KOListViewItem * item, *temp;
375 item = sel.first(); 375 item = sel.first();
376 Incidence* inc; 376 Incidence* inc;
377 while ( item ) { 377 while ( item ) {
378 inc = item->data(); 378 inc = item->data();
379 ++count; 379 ++count;
380 if (kap.mAlarmButton->isChecked()) { 380 if (kap.mAlarmButton->isChecked()) {
381 if (inc->alarms().count() == 0) 381 if (inc->alarms().count() == 0)
382 inc->newAlarm(); 382 inc->newAlarm();
383 QPtrList<Alarm> alarms = inc->alarms(); 383 QPtrList<Alarm> alarms = inc->alarms();
384 Alarm *alarm; 384 Alarm *alarm;
385 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 385 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
386 alarm->setEnabled(true); 386 alarm->setEnabled(true);
387 int j = kap.mAlarmTimeEdit->value()* -60; 387 int j = kap.mAlarmTimeEdit->value()* -60;
388 if (kap.mAlarmIncrCombo->currentItem() == 1) 388 if (kap.mAlarmIncrCombo->currentItem() == 1)
389 j = j * 60; 389 j = j * 60;
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp
index 5181eaf..8a175c9 100644
--- a/libkcal/recurrence.cpp
+++ b/libkcal/recurrence.cpp
@@ -2,403 +2,409 @@
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (c) 2002 David Jarvie <software@astrojar.org.uk> 5 Copyright (c) 2002 David Jarvie <software@astrojar.org.uk>
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This library is distributed in the hope that it will be useful, 12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 Library General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23#include <limits.h> 23#include <limits.h>
24 24
25#include <kdebug.h> 25#include <kdebug.h>
26#include <kglobal.h> 26#include <kglobal.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29#include "incidence.h" 29#include "incidence.h"
30 30
31#include "recurrence.h" 31#include "recurrence.h"
32 32
33using namespace KCal; 33using namespace KCal;
34 34
35Recurrence::Feb29Type Recurrence::mFeb29YearlyDefaultType = Recurrence::rMar1; 35Recurrence::Feb29Type Recurrence::mFeb29YearlyDefaultType = Recurrence::rMar1;
36 36
37 37
38Recurrence::Recurrence(Incidence *parent, int compatVersion) 38Recurrence::Recurrence(Incidence *parent, int compatVersion)
39: recurs(rNone), // by default, it's not a recurring event 39: recurs(rNone), // by default, it's not a recurring event
40 rWeekStart(1), // default is Monday 40 rWeekStart(1), // default is Monday
41 rDays(7), 41 rDays(7),
42 mFloats(parent ? parent->doesFloat() : false), 42 mFloats(parent ? parent->doesFloat() : false),
43 mRecurReadOnly(false), 43 mRecurReadOnly(false),
44 mRecurExDatesCount(0), 44 mRecurExDatesCount(0),
45 mFeb29YearlyType(mFeb29YearlyDefaultType), 45 mFeb29YearlyType(mFeb29YearlyDefaultType),
46 mCompatVersion(compatVersion ? compatVersion : INT_MAX), 46 mCompatVersion(compatVersion ? compatVersion : INT_MAX),
47 mCompatRecurs(rNone), 47 mCompatRecurs(rNone),
48 mCompatDuration(0), 48 mCompatDuration(0),
49 mParent(parent) 49 mParent(parent)
50{ 50{
51 rMonthDays.setAutoDelete( true ); 51 rMonthDays.setAutoDelete( true );
52 rMonthPositions.setAutoDelete( true ); 52 rMonthPositions.setAutoDelete( true );
53 rYearNums.setAutoDelete( true ); 53 rYearNums.setAutoDelete( true );
54} 54}
55 55
56Recurrence::Recurrence(const Recurrence &r, Incidence *parent) 56Recurrence::Recurrence(const Recurrence &r, Incidence *parent)
57: recurs(r.recurs), 57: recurs(r.recurs),
58 rWeekStart(r.rWeekStart), 58 rWeekStart(r.rWeekStart),
59 rDays(r.rDays.copy()), 59 rDays(r.rDays.copy()),
60 rFreq(r.rFreq), 60 rFreq(r.rFreq),
61 rDuration(r.rDuration), 61 rDuration(r.rDuration),
62 rEndDateTime(r.rEndDateTime), 62 rEndDateTime(r.rEndDateTime),
63 mRecurStart(r.mRecurStart), 63 mRecurStart(r.mRecurStart),
64 mFloats(r.mFloats), 64 mFloats(r.mFloats),
65 mRecurReadOnly(r.mRecurReadOnly), 65 mRecurReadOnly(r.mRecurReadOnly),
66 mRecurExDatesCount(r.mRecurExDatesCount), 66 mRecurExDatesCount(r.mRecurExDatesCount),
67 mFeb29YearlyType(r.mFeb29YearlyType), 67 mFeb29YearlyType(r.mFeb29YearlyType),
68 mCompatVersion(r.mCompatVersion), 68 mCompatVersion(r.mCompatVersion),
69 mCompatRecurs(r.mCompatRecurs), 69 mCompatRecurs(r.mCompatRecurs),
70 mCompatDuration(r.mCompatDuration), 70 mCompatDuration(r.mCompatDuration),
71 mParent(parent) 71 mParent(parent)
72{ 72{
73 for (QPtrListIterator<rMonthPos> mp(r.rMonthPositions); mp.current(); ++mp) { 73 for (QPtrListIterator<rMonthPos> mp(r.rMonthPositions); mp.current(); ++mp) {
74 rMonthPos *tmp = new rMonthPos; 74 rMonthPos *tmp = new rMonthPos;
75 tmp->rPos = mp.current()->rPos; 75 tmp->rPos = mp.current()->rPos;
76 tmp->negative = mp.current()->negative; 76 tmp->negative = mp.current()->negative;
77 tmp->rDays = mp.current()->rDays.copy(); 77 tmp->rDays = mp.current()->rDays.copy();
78 rMonthPositions.append(tmp); 78 rMonthPositions.append(tmp);
79 } 79 }
80 for (QPtrListIterator<int> md(r.rMonthDays); md.current(); ++md) { 80 for (QPtrListIterator<int> md(r.rMonthDays); md.current(); ++md) {
81 int *tmp = new int; 81 int *tmp = new int;
82 *tmp = *md.current(); 82 *tmp = *md.current();
83 rMonthDays.append(tmp); 83 rMonthDays.append(tmp);
84 } 84 }
85 for (QPtrListIterator<int> yn(r.rYearNums); yn.current(); ++yn) { 85 for (QPtrListIterator<int> yn(r.rYearNums); yn.current(); ++yn) {
86 int *tmp = new int; 86 int *tmp = new int;
87 *tmp = *yn.current(); 87 *tmp = *yn.current();
88 rYearNums.append(tmp); 88 rYearNums.append(tmp);
89 } 89 }
90 rMonthDays.setAutoDelete( true ); 90 rMonthDays.setAutoDelete( true );
91 rMonthPositions.setAutoDelete( true ); 91 rMonthPositions.setAutoDelete( true );
92 rYearNums.setAutoDelete( true ); 92 rYearNums.setAutoDelete( true );
93} 93}
94 94
95Recurrence::~Recurrence() 95Recurrence::~Recurrence()
96{ 96{
97} 97}
98 98
99 99
100bool Recurrence::operator==( const Recurrence& r2 ) const 100bool Recurrence::operator==( const Recurrence& r2 ) const
101{ 101{
102 102
103 // the following line is obvious 103 // the following line is obvious
104 if ( recurs == rNone && r2.recurs == rNone ) 104 if ( recurs == rNone && r2.recurs == rNone )
105 return true; 105 return true;
106 // we need the above line, because two non recurring events may 106 // we need the above line, because two non recurring events may
107 // differ in the other settings, because one (or both) 107 // differ in the other settings, because one (or both)
108 // may be not initialized properly 108 // may be not initialized properly
109 109
110 if ( recurs != r2.recurs 110 if ( recurs != r2.recurs
111 || rFreq != r2.rFreq 111 || rFreq != r2.rFreq
112 || rDuration != r2.rDuration 112 || rDuration != r2.rDuration
113 || !rDuration && rEndDateTime != r2.rEndDateTime 113 || !rDuration && rEndDateTime != r2.rEndDateTime
114 || mRecurStart != r2.mRecurStart 114 || mRecurStart != r2.mRecurStart
115 || mFloats != r2.mFloats 115 || mFloats != r2.mFloats
116 || mRecurReadOnly != r2.mRecurReadOnly 116 || mRecurReadOnly != r2.mRecurReadOnly
117 || mRecurExDatesCount != r2.mRecurExDatesCount ) 117 || mRecurExDatesCount != r2.mRecurExDatesCount )
118 return false; 118 return false;
119 // no need to compare mCompat* and mParent 119 // no need to compare mCompat* and mParent
120 // OK to compare the pointers 120 // OK to compare the pointers
121 switch ( recurs ) 121 switch ( recurs )
122 { 122 {
123 case rWeekly: 123 case rWeekly:
124 return rDays == r2.rDays 124 return rDays == r2.rDays
125 && rWeekStart == r2.rWeekStart; 125 && rWeekStart == r2.rWeekStart;
126 case rMonthlyPos: { 126 case rMonthlyPos: {
127 QPtrList<rMonthPos> MonthPositions = rMonthPositions; 127 QPtrList<rMonthPos> MonthPositions = rMonthPositions;
128 QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions; 128 QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions;
129 if ( !MonthPositions.count() ) 129 if ( !MonthPositions.count() )
130 return false; 130 return false;
131 if ( !MonthPositions2.count() ) 131 if ( !MonthPositions2.count() )
132 return false; 132 return false;
133 return MonthPositions.first()->rPos == MonthPositions2.first()->rPos; 133 return MonthPositions.first()->rPos == MonthPositions2.first()->rPos;
134 } 134 }
135 case rMonthlyDay: { 135 case rMonthlyDay: {
136 QPtrList<int> MonthDays = rMonthDays ; 136 QPtrList<int> MonthDays = rMonthDays ;
137 QPtrList<int> MonthDays2 = r2.rMonthDays ; 137 QPtrList<int> MonthDays2 = r2.rMonthDays ;
138 if ( !MonthDays.count() ) 138 if ( !MonthDays.count() )
139 return false; 139 return false;
140 if ( !MonthDays2.count() ) 140 if ( !MonthDays2.count() )
141 return false; 141 return false;
142 return *MonthDays.first() == *MonthDays2.first() ; 142 return *MonthDays.first() == *MonthDays2.first() ;
143 } 143 }
144 case rYearlyPos: { 144 case rYearlyPos: {
145 145
146 QPtrList<int> YearNums = rYearNums; 146 QPtrList<int> YearNums = rYearNums;
147 QPtrList<int> YearNums2 = r2.rYearNums; 147 QPtrList<int> YearNums2 = r2.rYearNums;
148 if ( *YearNums.first() != *YearNums2.first() ) 148 if ( *YearNums.first() != *YearNums2.first() )
149 return false; 149 return false;
150 QPtrList<rMonthPos> MonthPositions = rMonthPositions; 150 QPtrList<rMonthPos> MonthPositions = rMonthPositions;
151 QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions; 151 QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions;
152 if ( !MonthPositions.count() ) 152 if ( !MonthPositions.count() )
153 return false; 153 return false;
154 if ( !MonthPositions2.count() ) 154 if ( !MonthPositions2.count() )
155 return false; 155 return false;
156 return MonthPositions.first()->rPos == MonthPositions2.first()->rPos; 156 return MonthPositions.first()->rPos == MonthPositions2.first()->rPos;
157 157
158 } 158 }
159 case rYearlyMonth: { 159 case rYearlyMonth: {
160 QPtrList<int> YearNums = rYearNums; 160 QPtrList<int> YearNums = rYearNums;
161 QPtrList<int> YearNums2 = r2.rYearNums; 161 QPtrList<int> YearNums2 = r2.rYearNums;
162 return ( *YearNums.first() == *YearNums2.first() && mFeb29YearlyType == r2.mFeb29YearlyType); 162 return ( *YearNums.first() == *YearNums2.first() && mFeb29YearlyType == r2.mFeb29YearlyType);
163 } 163 }
164 case rYearlyDay: { 164 case rYearlyDay: {
165 QPtrList<int> YearNums = rYearNums; 165 QPtrList<int> YearNums = rYearNums;
166 QPtrList<int> YearNums2 = r2.rYearNums; 166 QPtrList<int> YearNums2 = r2.rYearNums;
167 return ( *YearNums.first() == *YearNums2.first() ); 167 return ( *YearNums.first() == *YearNums2.first() );
168 } 168 }
169 case rNone: 169 case rNone:
170 case rMinutely: 170 case rMinutely:
171 case rHourly: 171 case rHourly:
172 case rDaily: 172 case rDaily:
173 default: 173 default:
174 return true; 174 return true;
175 } 175 }
176} 176}
177/* 177/*
178bool Recurrence::compareLists( const QPtrList<int> &l1 ,const QPtrList<int> &l2) 178bool Recurrence::compareLists( const QPtrList<int> &l1 ,const QPtrList<int> &l2)
179{ 179{
180 if ( l1.count() != l2.count() ) 180 if ( l1.count() != l2.count() )
181 return false; 181 return false;
182 int count = l1.count(); 182 int count = l1.count();
183 int i; 183 int i;
184 for ( i = 0; i < count ; ++i ) { 184 for ( i = 0; i < count ; ++i ) {
185 // if ( l1.at(i) != l2.at(i) ) 185 // if ( l1.at(i) != l2.at(i) )
186 return false; 186 return false;
187 qDebug("compüare "); 187 qDebug("compüare ");
188 } 188 }
189 return true; 189 return true;
190} 190}
191*/ 191*/
192QString Recurrence::recurrenceText() const 192QString Recurrence::recurrenceText() const
193{ 193{
194 QString recurText = i18n("No"); 194 QString recurText;
195 if ( recurs == Recurrence::rMinutely ) 195 if ( recurs == Recurrence::rMinutely )
196 recurText = i18n("minutely"); 196 recurText = i18n("minutely");
197 else if ( recurs == Recurrence::rHourly ) 197 else if ( recurs == Recurrence::rHourly )
198 recurText = i18n("hourly"); 198 recurText = i18n("hourly");
199 else if ( recurs == Recurrence::rDaily ) 199 else if ( recurs == Recurrence::rDaily )
200 recurText = i18n("daily"); 200 recurText = i18n("daily");
201 else if ( recurs == Recurrence::rWeekly ) 201 else if ( recurs == Recurrence::rWeekly )
202 recurText = i18n("weekly"); 202 recurText = i18n("weekly");
203 else if ( recurs == Recurrence::rMonthlyPos ) 203 else if ( recurs == Recurrence::rMonthlyPos )
204 recurText = i18n("monthly"); 204 recurText = i18n("monthly");
205 else if ( recurs == Recurrence::rMonthlyDay ) 205 else if ( recurs == Recurrence::rMonthlyDay )
206 recurText = i18n("day-monthly"); 206 recurText = i18n("monthly");
207 else if ( recurs == Recurrence::rYearlyMonth ) 207 else if ( recurs == Recurrence::rYearlyMonth )
208 recurText = i18n("month-yearly"); 208 recurText = i18n("yearly");
209 else if ( recurs == Recurrence::rYearlyDay ) 209 else if ( recurs == Recurrence::rYearlyDay )
210 recurText = i18n("day-yearly"); 210 recurText = i18n("day-yearly");
211 else if ( recurs == Recurrence::rYearlyPos ) 211 else if ( recurs == Recurrence::rYearlyPos )
212 recurText = i18n("position-yearly"); 212 recurText = i18n("position-yearly");
213 if ( !recurText.isEmpty() ) {
214 if ( rFreq > 1 ){
215 recurText = i18n("(%1) ").arg(rFreq ) + recurText;
216 }
217 } else
218 recurText = i18n("No");
213 return recurText; 219 return recurText;
214} 220}
215 221
216void Recurrence::setCompatVersion(int version) 222void Recurrence::setCompatVersion(int version)
217{ 223{
218 mCompatVersion = version ? version : INT_MAX; 224 mCompatVersion = version ? version : INT_MAX;
219} 225}
220 226
221ushort Recurrence::doesRecur() const 227ushort Recurrence::doesRecur() const
222{ 228{
223 return recurs; 229 return recurs;
224} 230}
225 231
226bool Recurrence::recursOnPure(const QDate &qd) const 232bool Recurrence::recursOnPure(const QDate &qd) const
227{ 233{
228 switch(recurs) { 234 switch(recurs) {
229 case rMinutely: 235 case rMinutely:
230 return recursSecondly(qd, rFreq*60); 236 return recursSecondly(qd, rFreq*60);
231 case rHourly: 237 case rHourly:
232 return recursSecondly(qd, rFreq*3600); 238 return recursSecondly(qd, rFreq*3600);
233 case rDaily: 239 case rDaily:
234 return recursDaily(qd); 240 return recursDaily(qd);
235 case rWeekly: 241 case rWeekly:
236 return recursWeekly(qd); 242 return recursWeekly(qd);
237 case rMonthlyPos: 243 case rMonthlyPos:
238 case rMonthlyDay: 244 case rMonthlyDay:
239 return recursMonthly(qd); 245 return recursMonthly(qd);
240 case rYearlyMonth: 246 case rYearlyMonth:
241 return recursYearlyByMonth(qd); 247 return recursYearlyByMonth(qd);
242 case rYearlyDay: 248 case rYearlyDay:
243 return recursYearlyByDay(qd); 249 return recursYearlyByDay(qd);
244 case rYearlyPos: 250 case rYearlyPos:
245 return recursYearlyByPos(qd); 251 return recursYearlyByPos(qd);
246 default: 252 default:
247 return false; 253 return false;
248 case rNone: 254 case rNone:
249 return false; 255 return false;
250 } // case 256 } // case
251 return false; 257 return false;
252} 258}
253 259
254bool Recurrence::recursAtPure(const QDateTime &dt) const 260bool Recurrence::recursAtPure(const QDateTime &dt) const
255{ 261{
256 switch(recurs) { 262 switch(recurs) {
257 case rMinutely: 263 case rMinutely:
258 return recursMinutelyAt(dt, rFreq); 264 return recursMinutelyAt(dt, rFreq);
259 case rHourly: 265 case rHourly:
260 return recursMinutelyAt(dt, rFreq*60); 266 return recursMinutelyAt(dt, rFreq*60);
261 default: 267 default:
262 if (dt.time() != mRecurStart.time()) 268 if (dt.time() != mRecurStart.time())
263 return false; 269 return false;
264 switch(recurs) { 270 switch(recurs) {
265 case rDaily: 271 case rDaily:
266 return recursDaily(dt.date()); 272 return recursDaily(dt.date());
267 case rWeekly: 273 case rWeekly:
268 return recursWeekly(dt.date()); 274 return recursWeekly(dt.date());
269 case rMonthlyPos: 275 case rMonthlyPos:
270 case rMonthlyDay: 276 case rMonthlyDay:
271 return recursMonthly(dt.date()); 277 return recursMonthly(dt.date());
272 case rYearlyMonth: 278 case rYearlyMonth:
273 return recursYearlyByMonth(dt.date()); 279 return recursYearlyByMonth(dt.date());
274 case rYearlyDay: 280 case rYearlyDay:
275 return recursYearlyByDay(dt.date()); 281 return recursYearlyByDay(dt.date());
276 case rYearlyPos: 282 case rYearlyPos:
277 return recursYearlyByPos(dt.date()); 283 return recursYearlyByPos(dt.date());
278 default: 284 default:
279 return false; 285 return false;
280 case rNone: 286 case rNone:
281 return false; 287 return false;
282 } 288 }
283 } // case 289 } // case
284 return false; 290 return false;
285} 291}
286 292
287QDate Recurrence::endDate() const 293QDate Recurrence::endDate() const
288{ 294{
289 int count = 0; 295 int count = 0;
290 QDate end; 296 QDate end;
291 if (recurs != rNone) { 297 if (recurs != rNone) {
292 if (rDuration < 0) 298 if (rDuration < 0)
293 return QDate(); // infinite recurrence 299 return QDate(); // infinite recurrence
294 if (rDuration == 0) 300 if (rDuration == 0)
295 return rEndDateTime.date(); 301 return rEndDateTime.date();
296 302
297 // The end date is determined by the recurrence count 303 // The end date is determined by the recurrence count
298 QDate dStart = mRecurStart.date(); 304 QDate dStart = mRecurStart.date();
299 switch (recurs) 305 switch (recurs)
300 { 306 {
301 case rMinutely: 307 case rMinutely:
302 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*60).date(); 308 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*60).date();
303 case rHourly: 309 case rHourly:
304 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*3600).date(); 310 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*3600).date();
305 case rDaily: 311 case rDaily:
306 return dStart.addDays((rDuration-1+mRecurExDatesCount)*rFreq); 312 return dStart.addDays((rDuration-1+mRecurExDatesCount)*rFreq);
307 313
308 case rWeekly: 314 case rWeekly:
309 count = weeklyCalc(END_DATE_AND_COUNT, end); 315 count = weeklyCalc(END_DATE_AND_COUNT, end);
310 break; 316 break;
311 case rMonthlyPos: 317 case rMonthlyPos:
312 case rMonthlyDay: 318 case rMonthlyDay:
313 count = monthlyCalc(END_DATE_AND_COUNT, end); 319 count = monthlyCalc(END_DATE_AND_COUNT, end);
314 break; 320 break;
315 case rYearlyMonth: 321 case rYearlyMonth:
316 count = yearlyMonthCalc(END_DATE_AND_COUNT, end); 322 count = yearlyMonthCalc(END_DATE_AND_COUNT, end);
317 break; 323 break;
318 case rYearlyDay: 324 case rYearlyDay:
319 count = yearlyDayCalc(END_DATE_AND_COUNT, end); 325 count = yearlyDayCalc(END_DATE_AND_COUNT, end);
320 break; 326 break;
321 case rYearlyPos: 327 case rYearlyPos:
322 count = yearlyPosCalc(END_DATE_AND_COUNT, end); 328 count = yearlyPosCalc(END_DATE_AND_COUNT, end);
323 break; 329 break;
324 default: 330 default:
325 // catch-all. Should never get here. 331 // catch-all. Should never get here.
326 kdDebug(5800) << "Control should never reach here in endDate()!" << endl; 332 kdDebug(5800) << "Control should never reach here in endDate()!" << endl;
327 break; 333 break;
328 } 334 }
329 } 335 }
330 if (!count) 336 if (!count)
331 return QDate(); // error - there is no recurrence 337 return QDate(); // error - there is no recurrence
332 return end; 338 return end;
333} 339}
334 340
335QDateTime Recurrence::endDateTime() const 341QDateTime Recurrence::endDateTime() const
336{ 342{
337 int count = 0; 343 int count = 0;
338 QDate end; 344 QDate end;
339 if (recurs != rNone) { 345 if (recurs != rNone) {
340 if (rDuration < 0) 346 if (rDuration < 0)
341 return QDateTime(); // infinite recurrence 347 return QDateTime(); // infinite recurrence
342 if (rDuration == 0) 348 if (rDuration == 0)
343 return rEndDateTime; 349 return rEndDateTime;
344 350
345 // The end date is determined by the recurrence count 351 // The end date is determined by the recurrence count
346 QDate dStart = mRecurStart.date(); 352 QDate dStart = mRecurStart.date();
347 switch (recurs) 353 switch (recurs)
348 { 354 {
349 case rMinutely: 355 case rMinutely:
350 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*60); 356 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*60);
351 case rHourly: 357 case rHourly:
352 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*3600); 358 return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*3600);
353 case rDaily: 359 case rDaily:
354 return dStart.addDays((rDuration-1+mRecurExDatesCount)*rFreq); 360 return dStart.addDays((rDuration-1+mRecurExDatesCount)*rFreq);
355 361
356 case rWeekly: 362 case rWeekly:
357 count = weeklyCalc(END_DATE_AND_COUNT, end); 363 count = weeklyCalc(END_DATE_AND_COUNT, end);
358 break; 364 break;
359 case rMonthlyPos: 365 case rMonthlyPos:
360 case rMonthlyDay: 366 case rMonthlyDay:
361 count = monthlyCalc(END_DATE_AND_COUNT, end); 367 count = monthlyCalc(END_DATE_AND_COUNT, end);
362 break; 368 break;
363 case rYearlyMonth: 369 case rYearlyMonth:
364 count = yearlyMonthCalc(END_DATE_AND_COUNT, end); 370 count = yearlyMonthCalc(END_DATE_AND_COUNT, end);
365 break; 371 break;
366 case rYearlyDay: 372 case rYearlyDay:
367 count = yearlyDayCalc(END_DATE_AND_COUNT, end); 373 count = yearlyDayCalc(END_DATE_AND_COUNT, end);
368 break; 374 break;
369 case rYearlyPos: 375 case rYearlyPos:
370 count = yearlyPosCalc(END_DATE_AND_COUNT, end); 376 count = yearlyPosCalc(END_DATE_AND_COUNT, end);
371 break; 377 break;
372 default: 378 default:
373 // catch-all. Should never get here. 379 // catch-all. Should never get here.
374 kdDebug(5800) << "Control should never reach here in endDate()!" << endl; 380 kdDebug(5800) << "Control should never reach here in endDate()!" << endl;
375 break; 381 break;
376 } 382 }
377 } 383 }
378 if (!count) 384 if (!count)
379 return QDateTime(); // error - there is no recurrence 385 return QDateTime(); // error - there is no recurrence
380 return QDateTime(end, mRecurStart.time()); 386 return QDateTime(end, mRecurStart.time());
381} 387}
382 388
383int Recurrence::durationTo(const QDate &date) const 389int Recurrence::durationTo(const QDate &date) const
384{ 390{
385 QDate d = date; 391 QDate d = date;
386 return recurCalc(COUNT_TO_DATE, d); 392 return recurCalc(COUNT_TO_DATE, d);
387} 393}
388 394
389int Recurrence::durationTo(const QDateTime &datetime) const 395int Recurrence::durationTo(const QDateTime &datetime) const
390{ 396{
391 QDateTime dt = datetime; 397 QDateTime dt = datetime;
392 return recurCalc(COUNT_TO_DATE, dt); 398 return recurCalc(COUNT_TO_DATE, dt);
393} 399}
394 400
395void Recurrence::unsetRecurs() 401void Recurrence::unsetRecurs()
396{ 402{
397 if (mRecurReadOnly) return; 403 if (mRecurReadOnly) return;
398 recurs = rNone; 404 recurs = rNone;
399 rMonthPositions.clear(); 405 rMonthPositions.clear();
400 rMonthDays.clear(); 406 rMonthDays.clear();
401 rYearNums.clear(); 407 rYearNums.clear();
402} 408}
403 409
404void Recurrence::setRecurStart(const QDateTime &start) 410void Recurrence::setRecurStart(const QDateTime &start)
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index 083e6d1..48257ef 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -8,385 +8,385 @@
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include <klocale.h> 20#include <klocale.h>
21#include <klistview.h> 21#include <klistview.h>
22#include <ktoolbar.h> 22#include <ktoolbar.h>
23#include <kfiledialog.h> 23#include <kfiledialog.h>
24#include <kiconloader.h> 24#include <kiconloader.h>
25#include <kmessagebox.h> 25#include <kmessagebox.h>
26 26
27#include <qstatusbar.h> 27#include <qstatusbar.h>
28 28
29#ifndef PWM_EMBEDDED 29#ifndef PWM_EMBEDDED
30#include <kmenubar.h> 30#include <kmenubar.h>
31#include <kstatusbar.h> 31#include <kstatusbar.h>
32#include <dcopclient.h> 32#include <dcopclient.h>
33#include "configwndimpl.h" 33#include "configwndimpl.h"
34#include "configuration.h" 34#include "configuration.h"
35#else 35#else
36#include <qmenubar.h> 36#include <qmenubar.h>
37#include <qmessagebox.h> 37#include <qmessagebox.h>
38#include <pwmprefs.h> 38#include <pwmprefs.h>
39#include <kpimglobalprefs.h> 39#include <kpimglobalprefs.h>
40#include <kcmconfigs/kcmpwmconfig.h> 40#include <kcmconfigs/kcmpwmconfig.h>
41#include <kcmconfigs/kcmkdepimconfig.h> 41#include <kcmconfigs/kcmkdepimconfig.h>
42#include <kcmultidialog.h> 42#include <kcmultidialog.h>
43#include "editcategory.h" 43#include "editcategory.h"
44#endif 44#endif
45 45
46 46
47#ifndef DESKTOP_VERSION 47#ifndef DESKTOP_VERSION
48#include <qpe/global.h> 48#include <qpe/global.h>
49#endif 49#endif
50 50
51#include <qpixmap.h> 51#include <qpixmap.h>
52#include <qcheckbox.h> 52#include <qcheckbox.h>
53#include <qspinbox.h> 53#include <qspinbox.h>
54#include <qlineedit.h> 54#include <qlineedit.h>
55#include <qfileinfo.h> 55#include <qfileinfo.h>
56#include <qclipboard.h> 56#include <qclipboard.h>
57 57
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include "pwm.h" 61#include "pwm.h"
62#include "pwminit.h" 62#include "pwminit.h"
63#include "pwmprint.h" 63#include "pwmprint.h"
64#include "addentrywndimpl.h" 64#include "addentrywndimpl.h"
65#include "globalstuff.h" 65#include "globalstuff.h"
66#include "findwndimpl.h" 66#include "findwndimpl.h"
67#include "csv.h" 67#include "csv.h"
68 68
69#ifdef CONFIG_KWALLETIF 69#ifdef CONFIG_KWALLETIF
70# include "kwalletif.h" 70# include "kwalletif.h"
71# include "kwalletemu.h" 71# include "kwalletemu.h"
72#endif 72#endif
73#ifdef CONFIG_KEYCARD 73#ifdef CONFIG_KEYCARD
74# include "pwmkeycard.h" 74# include "pwmkeycard.h"
75#endif 75#endif
76 76
77 77
78 #define DEFAULT_SIZE (QSize(700, 400)) 78 #define DEFAULT_SIZE (QSize(700, 400))
79 79
80// Button IDs for "file" popup menu 80// Button IDs for "file" popup menu
81enum { 81enum {
82 BUTTON_POPUP_FILE_NEW = 0, 82 BUTTON_POPUP_FILE_NEW = 0,
83 BUTTON_POPUP_FILE_OPEN, 83 BUTTON_POPUP_FILE_OPEN,
84 BUTTON_POPUP_FILE_CLOSE, 84 BUTTON_POPUP_FILE_CLOSE,
85 BUTTON_POPUP_FILE_SAVE, 85 BUTTON_POPUP_FILE_SAVE,
86 BUTTON_POPUP_FILE_SAVEAS, 86 BUTTON_POPUP_FILE_SAVEAS,
87 BUTTON_POPUP_FILE_EXPORT, 87 BUTTON_POPUP_FILE_EXPORT,
88 BUTTON_POPUP_FILE_IMPORT, 88 BUTTON_POPUP_FILE_IMPORT,
89 BUTTON_POPUP_FILE_PRINT, 89 BUTTON_POPUP_FILE_PRINT,
90 BUTTON_POPUP_FILE_QUIT 90 BUTTON_POPUP_FILE_QUIT
91}; 91};
92// Button IDs for "manage" popup menu 92// Button IDs for "manage" popup menu
93enum { 93enum {
94 BUTTON_POPUP_MANAGE_ADD = 0, 94 BUTTON_POPUP_MANAGE_ADD = 0,
95 BUTTON_POPUP_MANAGE_EDIT, 95 BUTTON_POPUP_MANAGE_EDIT,
96 BUTTON_POPUP_MANAGE_DEL, 96 BUTTON_POPUP_MANAGE_DEL,
97 BUTTON_POPUP_MANAGE_CHANGEMP 97 BUTTON_POPUP_MANAGE_CHANGEMP
98}; 98};
99// Button IDs for chipcard popup menu 99// Button IDs for chipcard popup menu
100enum { 100enum {
101#ifdef CONFIG_KEYCARD 101#ifdef CONFIG_KEYCARD
102 BUTTON_POPUP_CHIPCARD_GENNEW = 0, 102 BUTTON_POPUP_CHIPCARD_GENNEW = 0,
103 BUTTON_POPUP_CHIPCARD_DEL, 103 BUTTON_POPUP_CHIPCARD_DEL,
104 BUTTON_POPUP_CHIPCARD_READID, 104 BUTTON_POPUP_CHIPCARD_READID,
105 BUTTON_POPUP_CHIPCARD_SAVEBACKUP, 105 BUTTON_POPUP_CHIPCARD_SAVEBACKUP,
106 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP 106 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP
107#else // CONFIG_KEYCARD 107#else // CONFIG_KEYCARD
108 BUTTON_POPUP_CHIPCARD_NO = 0 108 BUTTON_POPUP_CHIPCARD_NO = 0
109#endif // CONFIG_KEYCARD 109#endif // CONFIG_KEYCARD
110}; 110};
111// Button IDs for "view" popup menu 111// Button IDs for "view" popup menu
112enum { 112enum {
113 BUTTON_POPUP_VIEW_FIND = 0, 113 BUTTON_POPUP_VIEW_FIND = 0,
114 BUTTON_POPUP_VIEW_LOCK, 114 BUTTON_POPUP_VIEW_LOCK,
115 BUTTON_POPUP_VIEW_DEEPLOCK, 115 BUTTON_POPUP_VIEW_DEEPLOCK,
116 BUTTON_POPUP_VIEW_UNLOCK 116 BUTTON_POPUP_VIEW_UNLOCK
117}; 117};
118// Button IDs for "options" popup menu 118// Button IDs for "options" popup menu
119enum { 119enum {
120 BUTTON_POPUP_OPTIONS_CONFIG = 0 120 BUTTON_POPUP_OPTIONS_CONFIG = 0
121#ifdef PWM_EMBEDDED 121#ifdef PWM_EMBEDDED
122 ,BUTTON_POPUP_OPTIONS_CATEGORY 122 ,BUTTON_POPUP_OPTIONS_CATEGORY
123#endif 123#endif
124}; 124};
125// Button IDs for "export" popup menu (in "file" popup menu) 125// Button IDs for "export" popup menu (in "file" popup menu)
126enum { 126enum {
127 BUTTON_POPUP_EXPORT_TEXT = 0, 127 BUTTON_POPUP_EXPORT_TEXT = 0,
128 BUTTON_POPUP_EXPORT_GPASMAN, 128 BUTTON_POPUP_EXPORT_GPASMAN,
129 BUTTON_POPUP_EXPORT_CSV 129 BUTTON_POPUP_EXPORT_CSV
130#ifdef CONFIG_KWALLETIF 130#ifdef CONFIG_KWALLETIF
131 ,BUTTON_POPUP_EXPORT_KWALLET 131 ,BUTTON_POPUP_EXPORT_KWALLET
132#endif 132#endif
133}; 133};
134// Button IDs for "import" popup menu (in "file" popup menu) 134// Button IDs for "import" popup menu (in "file" popup menu)
135enum { 135enum {
136 BUTTON_POPUP_IMPORT_TEXT = 0, 136 BUTTON_POPUP_IMPORT_TEXT = 0,
137 BUTTON_POPUP_IMPORT_GPASMAN, 137 BUTTON_POPUP_IMPORT_GPASMAN,
138 BUTTON_POPUP_IMPORT_CSV 138 BUTTON_POPUP_IMPORT_CSV
139#ifdef CONFIG_KWALLETIF 139#ifdef CONFIG_KWALLETIF
140 ,BUTTON_POPUP_IMPORT_KWALLET 140 ,BUTTON_POPUP_IMPORT_KWALLET
141#endif 141#endif
142}; 142};
143 143
144#ifdef PWM_EMBEDDED 144#ifdef PWM_EMBEDDED
145// Button IDs for "help" popup menu 145// Button IDs for "help" popup menu
146enum { 146enum {
147 BUTTON_POPUP_HELP_LICENSE = 0, 147 BUTTON_POPUP_HELP_LICENSE = 0,
148 BUTTON_POPUP_HELP_FAQ, 148 BUTTON_POPUP_HELP_FAQ,
149 BUTTON_POPUP_HELP_ABOUT, 149 BUTTON_POPUP_HELP_ABOUT,
150 BUTTON_POPUP_HELP_SYNC, 150 BUTTON_POPUP_HELP_SYNC,
151 BUTTON_POPUP_HELP_WHATSNEW 151 BUTTON_POPUP_HELP_WHATSNEW
152}; 152};
153#endif 153#endif
154 154
155// Button IDs for toolbar 155// Button IDs for toolbar
156enum { 156enum {
157 BUTTON_TOOL_NEW = 0, 157 BUTTON_TOOL_NEW = 0,
158 BUTTON_TOOL_OPEN, 158 BUTTON_TOOL_OPEN,
159 BUTTON_TOOL_SAVE, 159 BUTTON_TOOL_SAVE,
160 BUTTON_TOOL_SAVEAS, 160 BUTTON_TOOL_SAVEAS,
161 BUTTON_TOOL_PRINT, 161 BUTTON_TOOL_PRINT,
162 BUTTON_TOOL_ADD, 162 BUTTON_TOOL_ADD,
163 BUTTON_TOOL_EDIT, 163 BUTTON_TOOL_EDIT,
164 BUTTON_TOOL_DEL, 164 BUTTON_TOOL_DEL,
165 BUTTON_TOOL_FIND, 165 BUTTON_TOOL_FIND,
166 BUTTON_TOOL_LOCK, 166 BUTTON_TOOL_LOCK,
167 BUTTON_TOOL_DEEPLOCK, 167 BUTTON_TOOL_DEEPLOCK,
168 BUTTON_TOOL_UNLOCK 168 BUTTON_TOOL_UNLOCK
169}; 169};
170 170
171 171
172PwM::PwM(PwMInit *_init, PwMDoc *doc, 172PwM::PwM(PwMInit *_init, PwMDoc *doc,
173 bool virginity, 173 bool virginity,
174 QWidget *parent, const char *name) 174 QWidget *parent, const char *name)
175 : KMainWindow(parent, "HALLO") 175 : KMainWindow(parent, "HALLO")
176 , forceQuit (false) 176 , forceQuit (false)
177 , forceMinimizeToTray (false) 177 , forceMinimizeToTray (false)
178{ 178{
179 syncManager = 0; 179 syncManager = 0;
180 virgin = !virginity; 180 virgin = !virginity;
181 init = _init; 181 init = _init;
182 connect(doc, SIGNAL(docClosed(PwMDoc *)), 182 connect(doc, SIGNAL(docClosed(PwMDoc *)),
183 this, SLOT(docClosed(PwMDoc *))); 183 this, SLOT(docClosed(PwMDoc *)));
184 initMenubar(); 184 initMenubar();
185 initToolbar(); 185 initToolbar();
186 initMetrics(); 186 initMetrics();
187 setVirgin(virginity); 187 setVirgin(virginity);
188 setFocusPolicy(QWidget::WheelFocus); 188 setFocusPolicy(QWidget::WheelFocus);
189#ifndef PWM_EMBEDDED 189#ifndef PWM_EMBEDDED
190 statusBar()->show(); 190 statusBar()->show();
191#endif 191#endif
192 view = makeNewListView(doc); 192 view = makeNewListView(doc);
193 setCentralWidget(view); 193 setCentralWidget(view);
194 updateCaption(); 194 updateCaption();
195 showStatMsg(i18n("Ready.")); 195 showStatMsg(i18n("Ready."));
196} 196}
197 197
198PwM::~PwM() 198PwM::~PwM()
199{ 199{
200 qDebug("PwM::~PwM() %x", this); 200 //qDebug("PwM::~PwM() %x", this);
201 disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), 201 disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)),
202 this, SLOT(docClosed(PwMDoc *))); 202 this, SLOT(docClosed(PwMDoc *)));
203 conf()->confWndMainWndSize(size()); 203 conf()->confWndMainWndSize(size());
204 //LR closing of windows changed 204 //LR closing of windows changed
205 //needed for fastload option on PDA 205 //needed for fastload option on PDA
206 //emit closed(this); 206 //emit closed(this);
207 //qDebug("PwM::~PwM() emited closed(this)"); 207 //qDebug("PwM::~PwM() emited closed(this)");
208 delete view; 208 delete view;
209 delete syncManager; 209 delete syncManager;
210} 210}
211 211
212void PwM::initMenubar() 212void PwM::initMenubar()
213{ 213{
214 KIconLoader* picons; 214 KIconLoader* picons;
215#ifndef PWM_EMBEDDED 215#ifndef PWM_EMBEDDED
216 KIconLoader icons; 216 KIconLoader icons;
217 picons = &icons; 217 picons = &icons;
218#else 218#else
219 picons = KGlobal::iconLoader(); 219 picons = KGlobal::iconLoader();
220 220
221 221
222 syncPopup = new KPopupMenu(this); 222 syncPopup = new KPopupMenu(this);
223 223
224 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup); 224 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup);
225 syncManager->setBlockSave(false); 225 syncManager->setBlockSave(false);
226 226
227 connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 227 connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
228 syncManager->fillSyncMenu(); 228 syncManager->fillSyncMenu();
229 229
230#endif 230#endif
231 filePopup = new KPopupMenu(this); 231 filePopup = new KPopupMenu(this);
232 importPopup = new KPopupMenu(filePopup); 232 importPopup = new KPopupMenu(filePopup);
233 exportPopup = new KPopupMenu(filePopup); 233 exportPopup = new KPopupMenu(filePopup);
234 managePopup = new KPopupMenu(this); 234 managePopup = new KPopupMenu(this);
235#ifdef CONFIG_KEYCARD 235#ifdef CONFIG_KEYCARD
236 chipcardPopup = new KPopupMenu(this); 236 chipcardPopup = new KPopupMenu(this);
237#endif // CONFIG_KEYCARD 237#endif // CONFIG_KEYCARD
238 viewPopup = new KPopupMenu(this); 238 viewPopup = new KPopupMenu(this);
239 optionsPopup = new KPopupMenu(this); 239 optionsPopup = new KPopupMenu(this);
240 240
241// "file" popup menu 241// "file" popup menu
242 filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), 242 filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
243 i18n("&New"), this, 243 i18n("&New"), this,
244 SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); 244 SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW);
245 filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), 245 filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)),
246 i18n("&Open"), this, 246 i18n("&Open"), this,
247 SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); 247 SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN);
248 filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), 248 filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)),
249 i18n("&Close"), this, 249 i18n("&Close"), this,
250 SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); 250 SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE);
251 filePopup->insertSeparator(); 251 filePopup->insertSeparator();
252 filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), 252 filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)),
253 i18n("&Save"), this, 253 i18n("&Save"), this,
254 SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); 254 SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE);
255 filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), 255 filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)),
256 i18n("Save &as..."), 256 i18n("Save &as..."),
257 this, SLOT(saveAs_slot()), 0, 257 this, SLOT(saveAs_slot()), 0,
258 BUTTON_POPUP_FILE_SAVEAS); 258 BUTTON_POPUP_FILE_SAVEAS);
259 filePopup->insertSeparator(); 259 filePopup->insertSeparator();
260 // "file/export" popup menu 260 // "file/export" popup menu
261 exportPopup->insertItem(i18n("&Text-file..."), this, 261 exportPopup->insertItem(i18n("&Text-file..."), this,
262 SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); 262 SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT);
263 exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, 263 exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
264 SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); 264 SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN);
265 exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, 265 exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this,
266 SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV); 266 SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV);
267#ifdef CONFIG_KWALLETIF 267#ifdef CONFIG_KWALLETIF
268 exportPopup->insertItem(i18n("&KWallet..."), this, 268 exportPopup->insertItem(i18n("&KWallet..."), this,
269 SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); 269 SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET);
270#endif 270#endif
271 filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), 271 filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)),
272 i18n("E&xport"), exportPopup, 272 i18n("E&xport"), exportPopup,
273 BUTTON_POPUP_FILE_EXPORT); 273 BUTTON_POPUP_FILE_EXPORT);
274 // "file/import" popup menu 274 // "file/import" popup menu
275 importPopup->insertItem(i18n("&Text-file..."), this, 275 importPopup->insertItem(i18n("&Text-file..."), this,
276 SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); 276 SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT);
277 importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, 277 importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
278 SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); 278 SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN);
279 importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, 279 importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this,
280 SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV); 280 SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV);
281#ifdef CONFIG_KWALLETIF 281#ifdef CONFIG_KWALLETIF
282 importPopup->insertItem(i18n("&KWallet..."), this, 282 importPopup->insertItem(i18n("&KWallet..."), this,
283 SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); 283 SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET);
284#endif 284#endif
285 filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), 285 filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)),
286 i18n("I&mport"), importPopup, 286 i18n("I&mport"), importPopup,
287 BUTTON_POPUP_FILE_IMPORT); 287 BUTTON_POPUP_FILE_IMPORT);
288 filePopup->insertSeparator(); 288 filePopup->insertSeparator();
289 filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), 289 filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)),
290 i18n("&Print..."), this, 290 i18n("&Print..."), this,
291 SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); 291 SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT);
292 filePopup->insertSeparator(); 292 filePopup->insertSeparator();
293 filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), 293 filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)),
294 i18n("&Quit"), this, 294 i18n("&Quit"), this,
295 SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); 295 SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT);
296 menuBar()->insertItem(i18n("&File"), filePopup); 296 menuBar()->insertItem(i18n("&File"), filePopup);
297// "manage" popup menu 297// "manage" popup menu
298 managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), 298 managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)),
299 i18n("&Add password"), this, 299 i18n("&Add password"), this,
300 SLOT(addPwd_slot()), 0, 300 SLOT(addPwd_slot()), 0,
301 BUTTON_POPUP_MANAGE_ADD); 301 BUTTON_POPUP_MANAGE_ADD);
302 managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), 302 managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)),
303 i18n("&Edit"), this, SLOT(editPwd_slot()), 0, 303 i18n("&Edit"), this, SLOT(editPwd_slot()), 0,
304 BUTTON_POPUP_MANAGE_EDIT); 304 BUTTON_POPUP_MANAGE_EDIT);
305 managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), 305 managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
306 i18n("&Delete"), this, SLOT(deletePwd_slot()), 306 i18n("&Delete"), this, SLOT(deletePwd_slot()),
307 0, BUTTON_POPUP_MANAGE_DEL); 307 0, BUTTON_POPUP_MANAGE_DEL);
308 managePopup->insertSeparator(); 308 managePopup->insertSeparator();
309 managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), 309 managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)),
310 i18n("Change &Master Password"), this, 310 i18n("Change &Master Password"), this,
311 SLOT(changeMasterPwd_slot()), 0, 311 SLOT(changeMasterPwd_slot()), 0,
312 BUTTON_POPUP_MANAGE_CHANGEMP); 312 BUTTON_POPUP_MANAGE_CHANGEMP);
313 menuBar()->insertItem(i18n("&Manage"), managePopup); 313 menuBar()->insertItem(i18n("&Manage"), managePopup);
314// "chipcard" popup menu 314// "chipcard" popup menu
315#ifdef CONFIG_KEYCARD 315#ifdef CONFIG_KEYCARD
316 chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), 316 chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
317 i18n("&Generate new key-card"), this, 317 i18n("&Generate new key-card"), this,
318 SLOT(genNewCard_slot()), 0, 318 SLOT(genNewCard_slot()), 0,
319 BUTTON_POPUP_CHIPCARD_GENNEW); 319 BUTTON_POPUP_CHIPCARD_GENNEW);
320 chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), 320 chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
321 i18n("&Erase key-card"), this, 321 i18n("&Erase key-card"), this,
322 SLOT(eraseCard_slot()), 0, 322 SLOT(eraseCard_slot()), 0,
323 BUTTON_POPUP_CHIPCARD_DEL); 323 BUTTON_POPUP_CHIPCARD_DEL);
324 chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), 324 chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)),
325 i18n("Read card-&ID"), this, 325 i18n("Read card-&ID"), this,
326 SLOT(readCardId_slot()), 0, 326 SLOT(readCardId_slot()), 0,
327 BUTTON_POPUP_CHIPCARD_READID); 327 BUTTON_POPUP_CHIPCARD_READID);
328 chipcardPopup->insertSeparator(); 328 chipcardPopup->insertSeparator();
329 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), 329 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)),
330 i18n("&Make card backup-image"), this, 330 i18n("&Make card backup-image"), this,
331 SLOT(makeCardBackup_slot()), 0, 331 SLOT(makeCardBackup_slot()), 0,
332 BUTTON_POPUP_CHIPCARD_SAVEBACKUP); 332 BUTTON_POPUP_CHIPCARD_SAVEBACKUP);
333 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), 333 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)),
334 i18n("&Replay card backup-image"), this, 334 i18n("&Replay card backup-image"), this,
335 SLOT(replayCardBackup_slot()), 0, 335 SLOT(replayCardBackup_slot()), 0,
336 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); 336 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP);
337 menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); 337 menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup);
338#endif // CONFIG_KEYCARD 338#endif // CONFIG_KEYCARD
339// "view" popup menu 339// "view" popup menu
340 viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), 340 viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)),
341 i18n("&Find"), this, 341 i18n("&Find"), this,
342 SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); 342 SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND);
343 viewPopup->insertSeparator(); 343 viewPopup->insertSeparator();
344 viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), 344 viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)),
345 i18n("&Lock all entries"), this, 345 i18n("&Lock all entries"), this,
346 SLOT(lockWnd_slot()), 0, 346 SLOT(lockWnd_slot()), 0,
347 BUTTON_POPUP_VIEW_LOCK); 347 BUTTON_POPUP_VIEW_LOCK);
348 viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), 348 viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)),
349 i18n("&Deep-lock all entries"), this, 349 i18n("&Deep-lock all entries"), this,
350 SLOT(deepLockWnd_slot()), 0, 350 SLOT(deepLockWnd_slot()), 0,
351 BUTTON_POPUP_VIEW_DEEPLOCK); 351 BUTTON_POPUP_VIEW_DEEPLOCK);
352 viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), 352 viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)),
353 i18n("&Unlock all entries"), this, 353 i18n("&Unlock all entries"), this,
354 SLOT(unlockWnd_slot()), 0, 354 SLOT(unlockWnd_slot()), 0,
355 BUTTON_POPUP_VIEW_UNLOCK); 355 BUTTON_POPUP_VIEW_UNLOCK);
356 menuBar()->insertItem(i18n("&View"), viewPopup); 356 menuBar()->insertItem(i18n("&View"), viewPopup);
357// "options" popup menu 357// "options" popup menu
358 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), 358 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
359 i18n("&Configure..."), this, 359 i18n("&Configure..."), this,
360 SLOT(config_slot()),0, 360 SLOT(config_slot()),0,
361 BUTTON_POPUP_OPTIONS_CONFIG); 361 BUTTON_POPUP_OPTIONS_CONFIG);
362 menuBar()->insertItem(i18n("&Options"), optionsPopup); 362 menuBar()->insertItem(i18n("&Options"), optionsPopup);
363// "help" popup menu 363// "help" popup menu
364#ifndef PWM_EMBEDDED 364#ifndef PWM_EMBEDDED
365 helpPopup = helpMenu(QString::null, false); 365 helpPopup = helpMenu(QString::null, false);
366#else 366#else
367 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), 367 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
368 i18n("C&ategories..."), this, 368 i18n("C&ategories..."), this,
369 SLOT(category_slot()),0, 369 SLOT(category_slot()),0,
370 BUTTON_POPUP_OPTIONS_CATEGORY); 370 BUTTON_POPUP_OPTIONS_CATEGORY);
371 371
372 372
373 menuBar()->insertItem(i18n("&Sync"), syncPopup); 373 menuBar()->insertItem(i18n("&Sync"), syncPopup);
374 374
375 375
376 376
377 377
378 378
379 helpPopup = new KPopupMenu(this); 379 helpPopup = new KPopupMenu(this);
380 380
381 381
382 helpPopup->insertItem(i18n("&License"), this, 382 helpPopup->insertItem(i18n("&License"), this,
383 SLOT(showLicense_slot()), 0, 383 SLOT(showLicense_slot()), 0,
384 BUTTON_POPUP_HELP_LICENSE); 384 BUTTON_POPUP_HELP_LICENSE);
385 385
386 helpPopup->insertItem(i18n("&Faq"), this, 386 helpPopup->insertItem(i18n("&Faq"), this,
387 SLOT(faq_slot()), 0, 387 SLOT(faq_slot()), 0,
388 BUTTON_POPUP_HELP_FAQ); 388 BUTTON_POPUP_HELP_FAQ);
389 389
390 helpPopup->insertItem(i18n("&About PwManager"), this, 390 helpPopup->insertItem(i18n("&About PwManager"), this,
391 SLOT(createAboutData_slot()), 0, 391 SLOT(createAboutData_slot()), 0,
392 BUTTON_POPUP_HELP_ABOUT); 392 BUTTON_POPUP_HELP_ABOUT);
@@ -710,393 +710,393 @@ void PwM::editPwd_slot3(const QString *category, const int *index,
710 return; 710 return;
711 doc->timer()->getLock(DocTimer::id_autoLockTimer); 711 doc->timer()->getLock(DocTimer::id_autoLockTimer);
712 unsigned int curEntryIndex; 712 unsigned int curEntryIndex;
713 if (index) { 713 if (index) {
714 curEntryIndex = *index; 714 curEntryIndex = *index;
715 } else { 715 } else {
716 if (!(view->getCurEntryIndex(&curEntryIndex))) { 716 if (!(view->getCurEntryIndex(&curEntryIndex))) {
717 printDebug("couldn't get index. Maybe we have a binary entry here."); 717 printDebug("couldn't get index. Maybe we have a binary entry here.");
718 doc->timer()->putLock(DocTimer::id_autoLockTimer); 718 doc->timer()->putLock(DocTimer::id_autoLockTimer);
719 return; 719 return;
720 } 720 }
721 } 721 }
722 QString curCategory; 722 QString curCategory;
723 if (category) { 723 if (category) {
724 curCategory = *category; 724 curCategory = *category;
725 } else { 725 } else {
726 curCategory = view->getCurrentCategory(); 726 curCategory = view->getCurrentCategory();
727 } 727 }
728 PwMDataItem currItem; 728 PwMDataItem currItem;
729 if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) { 729 if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) {
730 doc->timer()->putLock(DocTimer::id_autoLockTimer); 730 doc->timer()->putLock(DocTimer::id_autoLockTimer);
731 return; 731 return;
732 } 732 }
733 BUG_ON(currItem.binary); 733 BUG_ON(currItem.binary);
734 734
735 AddEntryWndImpl w(doc); 735 AddEntryWndImpl w(doc);
736 vector<string> catList; 736 vector<string> catList;
737 doc->getCategoryList(&catList); 737 doc->getCategoryList(&catList);
738 unsigned i, size = catList.size(); 738 unsigned i, size = catList.size();
739 for (i = 0; i < size; ++i) { 739 for (i = 0; i < size; ++i) {
740 w.addCategory(catList[i].c_str()); 740 w.addCategory(catList[i].c_str());
741 } 741 }
742 w.setCurrCategory(curCategory); 742 w.setCurrCategory(curCategory);
743 w.setDescription(currItem.desc.c_str()); 743 w.setDescription(currItem.desc.c_str());
744 w.setUsername(currItem.name.c_str()); 744 w.setUsername(currItem.name.c_str());
745 w.setPassword(currItem.pw.c_str()); 745 w.setPassword(currItem.pw.c_str());
746 w.setUrl(currItem.url.c_str()); 746 w.setUrl(currItem.url.c_str());
747 w.setLauncher(currItem.launcher.c_str()); 747 w.setLauncher(currItem.launcher.c_str());
748 w.setComment(currItem.comment.c_str()); 748 w.setComment(currItem.comment.c_str());
749 if (w.exec() == 1) { 749 if (w.exec() == 1) {
750 currItem.desc = w.getDescription().latin1(); 750 currItem.desc = w.getDescription().latin1();
751 currItem.name = w.getUsername().latin1(); 751 currItem.name = w.getUsername().latin1();
752 currItem.pw = w.getPassword().latin1(); 752 currItem.pw = w.getPassword().latin1();
753 currItem.comment = w.getComment().latin1(); 753 currItem.comment = w.getComment().latin1();
754 currItem.url = w.getUrl().latin1(); 754 currItem.url = w.getUrl().latin1();
755 currItem.launcher = w.getLauncher().latin1(); 755 currItem.launcher = w.getLauncher().latin1();
756 if (!doc->editEntry(curCategory, w.getCategory(), 756 if (!doc->editEntry(curCategory, w.getCategory(),
757 curEntryIndex, &currItem)) { 757 curEntryIndex, &currItem)) {
758 KMessageBox::error(this, 758 KMessageBox::error(this,
759 i18n("Couldn't edit the entry.\n" 759 i18n("Couldn't edit the entry.\n"
760 "Maybe you changed the category and\n" 760 "Maybe you changed the category and\n"
761 "this entry is already present\nin the new " 761 "this entry is already present\nin the new "
762 "category?"), 762 "category?"),
763 i18n("couldn't edit entry.")); 763 i18n("couldn't edit entry."));
764 doc->timer()->putLock(DocTimer::id_autoLockTimer); 764 doc->timer()->putLock(DocTimer::id_autoLockTimer);
765 return; 765 return;
766 } 766 }
767 } 767 }
768 doc->timer()->putLock(DocTimer::id_autoLockTimer); 768 doc->timer()->putLock(DocTimer::id_autoLockTimer);
769} 769}
770 770
771void PwM::deletePwd_slot() 771void PwM::deletePwd_slot()
772{ 772{
773 PWM_ASSERT(curDoc()); 773 PWM_ASSERT(curDoc());
774 if (curDoc()->isDocEmpty()) 774 if (curDoc()->isDocEmpty())
775 return; 775 return;
776 if (curDoc()->isDeepLocked()) 776 if (curDoc()->isDeepLocked())
777 return; 777 return;
778 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 778 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
779 unsigned int curEntryIndex = 0; 779 unsigned int curEntryIndex = 0;
780 if (!(view->getCurEntryIndex(&curEntryIndex))) { 780 if (!(view->getCurEntryIndex(&curEntryIndex))) {
781 printDebug("couldn't get index"); 781 printDebug("couldn't get index");
782 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 782 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
783 return; 783 return;
784 } 784 }
785 785
786 PwMDataItem currItem; 786 PwMDataItem currItem;
787 QString curCategory = view->getCurrentCategory(); 787 QString curCategory = view->getCurrentCategory();
788 if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) { 788 if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) {
789 printDebug("couldn't get entry"); 789 printDebug("couldn't get entry");
790 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 790 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
791 return; 791 return;
792 } 792 }
793 if (KMessageBox:: 793 if (KMessageBox::
794 questionYesNo(this, 794 questionYesNo(this,
795 i18n 795 i18n
796 ("Do you really want to delete\nthe selected entry") + 796 ("Do you really want to delete\nthe selected entry") +
797 " \n\"" + QString(currItem.desc.c_str()) 797 " \n\"" + QString(currItem.desc.c_str())
798 + "\" ?", i18n("delete?")) 798 + "\" ?", i18n("delete?"))
799 == KMessageBox::Yes) { 799 == KMessageBox::Yes) {
800 800
801 curDoc()->delEntry(curCategory, curEntryIndex); 801 curDoc()->delEntry(curCategory, curEntryIndex);
802 } 802 }
803 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 803 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
804} 804}
805 805
806void PwM::changeMasterPwd_slot() 806void PwM::changeMasterPwd_slot()
807{ 807{
808 PWM_ASSERT(curDoc()); 808 PWM_ASSERT(curDoc());
809 curDoc()->changeCurrentPw(); 809 curDoc()->changeCurrentPw();
810} 810}
811 811
812void PwM::lockWnd_slot() 812void PwM::lockWnd_slot()
813{ 813{
814 PWM_ASSERT(curDoc()); 814 PWM_ASSERT(curDoc());
815 curDoc()->lockAll(true); 815 curDoc()->lockAll(true);
816} 816}
817 817
818void PwM::deepLockWnd_slot() 818void PwM::deepLockWnd_slot()
819{ 819{
820 PWM_ASSERT(curDoc()); 820 PWM_ASSERT(curDoc());
821 curDoc()->deepLock(); 821 curDoc()->deepLock();
822} 822}
823 823
824void PwM::unlockWnd_slot() 824void PwM::unlockWnd_slot()
825{ 825{
826 PWM_ASSERT(curDoc()); 826 PWM_ASSERT(curDoc());
827 curDoc()->lockAll(false); 827 curDoc()->lockAll(false);
828} 828}
829 829
830void PwM::config_slot() 830void PwM::config_slot()
831{ 831{
832 int oldStyle = conf()->confWndMainViewStyle(); 832 int oldStyle = conf()->confWndMainViewStyle();
833#ifdef PWM_EMBEDDED 833#ifdef PWM_EMBEDDED
834 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"pwmconfigdialog", true ); 834 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"pwmconfigdialog", true );
835 835
836 KCMPwmConfig* pwmcfg = new KCMPwmConfig( ConfigureDialog->getNewVBoxPage(i18n( "PwManager")) , "KCMPwmConfig" ); 836 KCMPwmConfig* pwmcfg = new KCMPwmConfig( ConfigureDialog->getNewVBoxPage(i18n( "PwManager")) , "KCMPwmConfig" );
837 ConfigureDialog->addModule(pwmcfg ); 837 ConfigureDialog->addModule(pwmcfg );
838 838
839 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 839 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
840 ConfigureDialog->addModule(kdelibcfg ); 840 ConfigureDialog->addModule(kdelibcfg );
841 841
842#ifndef DESKTOP_VERSION 842#ifndef DESKTOP_VERSION
843 ConfigureDialog->showMaximized(); 843 ConfigureDialog->showMaximized();
844#endif 844#endif
845 if ( ConfigureDialog->exec() ) 845 if ( ConfigureDialog->exec() )
846 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 846 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
847 delete ConfigureDialog; 847 delete ConfigureDialog;
848 848
849#else //PWM_EMBEDDED 849#else //PWM_EMBEDDED
850 // display the configuration window (modal mode) 850 // display the configuration window (modal mode)
851 if (!conf()->showConfWnd(this)) 851 if (!conf()->showConfWnd(this))
852 return; 852 return;
853#endif 853#endif
854 854
855 int newStyle = conf()->confWndMainViewStyle(); 855 int newStyle = conf()->confWndMainViewStyle();
856 // reinitialize tray 856 // reinitialize tray
857 init->initTray(); 857 init->initTray();
858 // reinitialize KWallet emulation 858 // reinitialize KWallet emulation
859 init->initKWalletEmu(); 859 init->initKWalletEmu();
860 860
861 PwMDocList *_dl = PwMDoc::getOpenDocList(); 861 PwMDocList *_dl = PwMDoc::getOpenDocList();
862 const vector<PwMDocList::listItem> *dl = _dl->getList(); 862 const vector<PwMDocList::listItem> *dl = _dl->getList();
863 vector<PwMDocList::listItem>::const_iterator i = dl->begin(), 863 vector<PwMDocList::listItem>::const_iterator i = dl->begin(),
864 end = dl->end(); 864 end = dl->end();
865 PwMDoc *doc; 865 PwMDoc *doc;
866 while (i != end) { 866 while (i != end) {
867 doc = (*i).doc; 867 doc = (*i).doc;
868 // unlock-without-mpw timeout 868 // unlock-without-mpw timeout
869 doc->timer()->start(DocTimer::id_mpwTimer); 869 doc->timer()->start(DocTimer::id_mpwTimer);
870 // auto-lock timeout 870 // auto-lock timeout
871 doc->timer()->start(DocTimer::id_autoLockTimer); 871 doc->timer()->start(DocTimer::id_autoLockTimer);
872 ++i; 872 ++i;
873 } 873 }
874 874
875 const QValueList<PwM *> *ml = init->mainWndList(); 875 const QValueList<PwM *> *ml = init->mainWndList();
876#ifndef PWM_EMBEDDED 876#ifndef PWM_EMBEDDED
877 QValueList<PwM *>::const_iterator i2 = ml->begin(), 877 QValueList<PwM *>::const_iterator i2 = ml->begin(),
878 end2 = ml->end(); 878 end2 = ml->end();
879#else 879#else
880 QValueList<PwM *>::ConstIterator i2 = ml->begin(), 880 QValueList<PwM *>::ConstIterator i2 = ml->begin(),
881 end2 = ml->end(); 881 end2 = ml->end();
882#endif 882#endif
883 PwM *pwm; 883 PwM *pwm;
884 while (i2 != end2) { 884 while (i2 != end2) {
885 pwm = *i2; 885 pwm = *i2;
886 // reinitialize the window style. 886 // reinitialize the window style.
887 if (oldStyle != newStyle) 887 if (oldStyle != newStyle)
888 pwm->curView()->initStyle(newStyle); 888 pwm->curView()->initStyle(newStyle);
889 // set the new font 889 // set the new font
890 pwm->curView()->setFont(conf()->confGlobEntryFont()); 890 pwm->curView()->setFont(conf()->confGlobEntryFont());
891 ++i2; 891 ++i2;
892 } 892 }
893} 893}
894 894
895void PwM::activateMpButton(bool activate) 895void PwM::activateMpButton(bool activate)
896{ 896{
897 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate); 897 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate);
898} 898}
899 899
900void PwM::closeEvent(QCloseEvent *e) 900void PwM::closeEvent(QCloseEvent *e)
901{ 901{
902 qDebug("PwM::closeEvent "); 902 //qDebug("PwM::closeEvent ");
903 emit closed( this ); 903 emit closed( this );
904 return; 904 return;
905 e->accept(); 905 e->accept();
906} 906}
907 907
908void PwM::docClosed(PwMDoc *doc) 908void PwM::docClosed(PwMDoc *doc)
909{ 909{
910 qDebug("PwM::docClosed "); 910 //qDebug("PwM::docClosed ");
911 PARAM_UNUSED(doc); 911 PARAM_UNUSED(doc);
912 PWM_ASSERT(doc == curDoc()); 912 PWM_ASSERT(doc == curDoc());
913 close(); 913 close();
914} 914}
915 915
916void PwM::find_slot() 916void PwM::find_slot()
917{ 917{
918 PWM_ASSERT(curDoc()); 918 PWM_ASSERT(curDoc());
919 if (curDoc()->isDocEmpty()) 919 if (curDoc()->isDocEmpty())
920 return; 920 return;
921 if (curDoc()->isDeepLocked()) 921 if (curDoc()->isDeepLocked())
922 return; 922 return;
923 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 923 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
924 FindWndImpl findWnd(view); 924 FindWndImpl findWnd(view);
925 findWnd.exec(); 925 findWnd.exec();
926 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 926 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
927} 927}
928 928
929void PwM::exportToText() 929void PwM::exportToText()
930{ 930{
931 PWM_ASSERT(curDoc()); 931 PWM_ASSERT(curDoc());
932 if (curDoc()->isDocEmpty()) { 932 if (curDoc()->isDocEmpty()) {
933 KMessageBox::information(this, 933 KMessageBox::information(this,
934 i18n 934 i18n
935 ("Sorry, there's nothing to export.\n" 935 ("Sorry, there's nothing to export.\n"
936 "Please first add some passwords."), 936 "Please first add some passwords."),
937 i18n("nothing to do")); 937 i18n("nothing to do"));
938 return; 938 return;
939 } 939 }
940 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 940 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
941 QString fn(KFileDialog::getSaveFileName(QString::null, 941 QString fn(KFileDialog::getSaveFileName(QString::null,
942 i18n("*|plain-text file"), 942 i18n("*|plain-text file"),
943 this)); 943 this));
944 if (fn == "") { 944 if (fn == "") {
945 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 945 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
946 return; 946 return;
947 } 947 }
948 948
949 PwMerror ret = curDoc()->exportToText(&fn); 949 PwMerror ret = curDoc()->exportToText(&fn);
950 if (ret != e_success) { 950 if (ret != e_success) {
951 KMessageBox::error(this, 951 KMessageBox::error(this,
952 i18n("Error: Couldn't write to file.\n" 952 i18n("Error: Couldn't write to file.\n"
953 "Please check if you have permission to write\n" 953 "Please check if you have permission to write\n"
954 "to the file in that directory."), 954 "to the file in that directory."),
955 i18n("error while writing")); 955 i18n("error while writing"));
956 } else 956 } else
957 showStatMsg(i18n("Successfully exported data.")); 957 showStatMsg(i18n("Successfully exported data."));
958 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 958 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
959} 959}
960 960
961bool PwM::importFromText() 961bool PwM::importFromText()
962{ 962{
963 if (!isVirgin()) { 963 if (!isVirgin()) {
964 if (KMessageBox::questionYesNo(this, 964 if (KMessageBox::questionYesNo(this,
965 i18n("Do you want to import the data\n" 965 i18n("Do you want to import the data\n"
966 "into the current document? (If you\n" 966 "into the current document? (If you\n"
967 "select \"no\", a new document will be\n" 967 "select \"no\", a new document will be\n"
968 "opened.)"), 968 "opened.)"),
969 i18n("import into this document?")) 969 i18n("import into this document?"))
970 == KMessageBox::No) { 970 == KMessageBox::No) {
971 // import the data to a new window. 971 // import the data to a new window.
972 PwM *newInstance = init->createMainWnd(); 972 PwM *newInstance = init->createMainWnd();
973 bool ok = newInstance->importFromText(); 973 bool ok = newInstance->importFromText();
974 if (!ok) { 974 if (!ok) {
975 newInstance->setForceQuit(true); 975 newInstance->setForceQuit(true);
976 delete_and_null(newInstance); 976 delete_and_null(newInstance);
977 } 977 }
978 return ok; 978 return ok;
979 } 979 }
980 } 980 }
981 981
982 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 982 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
983 PwMerror ret; 983 PwMerror ret;
984 QString path(KFileDialog::getOpenFileName(QString::null, 984 QString path(KFileDialog::getOpenFileName(QString::null,
985 i18n("*|PWM-exported text file"), 985 i18n("*|PWM-exported text file"),
986 this)); 986 this));
987 if (path == "") 987 if (path == "")
988 goto cancelImport; 988 goto cancelImport;
989 989
990 ret = curDoc()->importFromText(&path, 0); 990 ret = curDoc()->importFromText(&path, 0);
991 if (ret == e_fileFormat) { 991 if (ret == e_fileFormat) {
992 KMessageBox::error(this, 992 KMessageBox::error(this,
993 i18n("Could not read file-format.\n" 993 i18n("Could not read file-format.\n"
994 "This seems to be _not_ a valid file\n" 994 "This seems to be _not_ a valid file\n"
995 "exported by PwM."), 995 "exported by PwM."),
996 i18n("invalid file-format")); 996 i18n("invalid file-format"));
997 goto cancelImport; 997 goto cancelImport;
998 } else if (ret == e_invalidArg) { 998 } else if (ret == e_invalidArg) {
999 BUG(); 999 BUG();
1000 goto cancelImport; 1000 goto cancelImport;
1001 } else if (ret != e_success) { 1001 } else if (ret != e_success) {
1002 KMessageBox::error(this, 1002 KMessageBox::error(this,
1003 i18n("Could not import file!\n" 1003 i18n("Could not import file!\n"
1004 "Do you have permission to read this file?\n" 1004 "Do you have permission to read this file?\n"
1005 "Do you have enough free memory?"), 1005 "Do you have enough free memory?"),
1006 i18n("import failed")); 1006 i18n("import failed"));
1007 goto cancelImport; 1007 goto cancelImport;
1008 } 1008 }
1009 setVirgin(false); 1009 setVirgin(false);
1010 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1010 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1011 return true; 1011 return true;
1012 1012
1013cancelImport: 1013cancelImport:
1014 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1014 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1015 return false; 1015 return false;
1016} 1016}
1017 1017
1018void PwM::exportToGpasman() 1018void PwM::exportToGpasman()
1019{ 1019{
1020 PWM_ASSERT(curDoc()); 1020 PWM_ASSERT(curDoc());
1021 if (curDoc()->isDocEmpty()) { 1021 if (curDoc()->isDocEmpty()) {
1022 KMessageBox::information(this, 1022 KMessageBox::information(this,
1023 i18n 1023 i18n
1024 ("Sorry, there's nothing to export.\n" 1024 ("Sorry, there's nothing to export.\n"
1025 "Please first add some passwords."), 1025 "Please first add some passwords."),
1026 i18n("nothing to do")); 1026 i18n("nothing to do"));
1027 return; 1027 return;
1028 } 1028 }
1029 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1029 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1030 QString fn(KFileDialog::getSaveFileName(QString::null, 1030 QString fn(KFileDialog::getSaveFileName(QString::null,
1031 i18n("*|Gpasman or Kpasman file"), 1031 i18n("*|Gpasman or Kpasman file"),
1032 this)); 1032 this));
1033 if (fn == "") { 1033 if (fn == "") {
1034 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1034 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1035 return; 1035 return;
1036 } 1036 }
1037 1037
1038 PwMerror ret = curDoc()->exportToGpasman(&fn); 1038 PwMerror ret = curDoc()->exportToGpasman(&fn);
1039 if (ret != e_success) { 1039 if (ret != e_success) {
1040 if (ret == e_noPw) { 1040 if (ret == e_noPw) {
1041 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1041 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1042 return; 1042 return;
1043 } 1043 }
1044 KMessageBox::error(this, 1044 KMessageBox::error(this,
1045 i18n("Error: Couldn't write to file.\n" 1045 i18n("Error: Couldn't write to file.\n"
1046 "Please check if you have permission to write " 1046 "Please check if you have permission to write "
1047 "to the file in that directory."), 1047 "to the file in that directory."),
1048 i18n("error while writing")); 1048 i18n("error while writing"));
1049 } else 1049 } else
1050 showStatMsg(i18n("Successfully exported data.")); 1050 showStatMsg(i18n("Successfully exported data."));
1051 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1051 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1052} 1052}
1053 1053
1054 1054
1055 1055
1056void PwM::exportToCsv() 1056void PwM::exportToCsv()
1057{ 1057{
1058 PWM_ASSERT(curDoc()); 1058 PWM_ASSERT(curDoc());
1059 if (curDoc()->isDocEmpty()) { 1059 if (curDoc()->isDocEmpty()) {
1060 KMessageBox::information(this, 1060 KMessageBox::information(this,
1061 i18n 1061 i18n
1062 ("Sorry, there is nothing to export;\n" 1062 ("Sorry, there is nothing to export;\n"
1063 "please add some passwords first."), 1063 "please add some passwords first."),
1064 i18n("Nothing to Do")); 1064 i18n("Nothing to Do"));
1065 return; 1065 return;
1066 } 1066 }
1067 1067
1068 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1068 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1069 QString fn(KFileDialog::getSaveFileName("*.csv", i18n("*|CSV Text File"), this)); 1069 QString fn(KFileDialog::getSaveFileName("*.csv", i18n("*|CSV Text File"), this));
1070 if (fn.isEmpty()) { 1070 if (fn.isEmpty()) {
1071 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1071 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1072 return; 1072 return;
1073 } 1073 }
1074 1074
1075 Csv csv(this); 1075 Csv csv(this);
1076 if (!csv.exportData(fn, curDoc())) { 1076 if (!csv.exportData(fn, curDoc())) {
1077 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1077 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1078 showStatMsg(i18n("CSV file export failed.")); 1078 showStatMsg(i18n("CSV file export failed."));
1079 return; 1079 return;
1080 } 1080 }
1081 showStatMsg(i18n("Successfully exported data.")); 1081 showStatMsg(i18n("Successfully exported data."));
1082 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1082 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1083} 1083}
1084 1084
1085bool PwM::importCsv() 1085bool PwM::importCsv()
1086{ 1086{
1087 Csv csv(this); 1087 Csv csv(this);
1088 if (!isVirgin()) { 1088 if (!isVirgin()) {
1089 if (KMessageBox::questionYesNo(this, 1089 if (KMessageBox::questionYesNo(this,
1090 i18n("Do you want to import the data\n" 1090 i18n("Do you want to import the data\n"
1091 "into the current document? (If you\n" 1091 "into the current document? (If you\n"
1092 "select \"no\", a new document will be\n" 1092 "select \"no\", a new document will be\n"
1093 "opened.)"), 1093 "opened.)"),
1094 i18n("Import into This Document?")) 1094 i18n("Import into This Document?"))
1095 == KMessageBox::No) { 1095 == KMessageBox::No) {
1096 // import the data to a new window. 1096 // import the data to a new window.
1097 PwM *newInstance = init->createMainWnd(); 1097 PwM *newInstance = init->createMainWnd();
1098 bool ok = newInstance->importCsv(); 1098 bool ok = newInstance->importCsv();
1099 if (!ok) { 1099 if (!ok) {
1100 newInstance->setForceQuit(true); 1100 newInstance->setForceQuit(true);
1101 delete_and_null(newInstance); 1101 delete_and_null(newInstance);
1102 } 1102 }
@@ -1195,355 +1195,355 @@ bool PwM::importFromGpasman()
1195 goto cancelImport; 1195 goto cancelImport;
1196 } 1196 }
1197 } else if (ret != e_success) { 1197 } else if (ret != e_success) {
1198 KMessageBox::error(this, 1198 KMessageBox::error(this,
1199 i18n("Could not import file!\n" 1199 i18n("Could not import file!\n"
1200 "Do you have permission to read this file?"), 1200 "Do you have permission to read this file?"),
1201 i18n("import failed")); 1201 i18n("import failed"));
1202 goto cancelImport; 1202 goto cancelImport;
1203 } 1203 }
1204 setVirgin(false); 1204 setVirgin(false);
1205 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1205 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1206 return true; 1206 return true;
1207 1207
1208cancelImport: 1208cancelImport:
1209 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1209 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1210 return false; 1210 return false;
1211} 1211}
1212 1212
1213#ifdef CONFIG_KWALLETIF 1213#ifdef CONFIG_KWALLETIF
1214bool PwM::checkAndAskForKWalletEmu() 1214bool PwM::checkAndAskForKWalletEmu()
1215{ 1215{
1216 if (init->kwalletEmu()) { 1216 if (init->kwalletEmu()) {
1217 /* KWallet emulation is enabled. We can't import/export 1217 /* KWallet emulation is enabled. We can't import/export
1218 * data from/to it, while emulation is active. 1218 * data from/to it, while emulation is active.
1219 */ 1219 */
1220 if (KMessageBox::questionYesNo(this, 1220 if (KMessageBox::questionYesNo(this,
1221 i18n("KWallet emulation is enabled.\n" 1221 i18n("KWallet emulation is enabled.\n"
1222 "You can't import or export data from/to " 1222 "You can't import or export data from/to "
1223 "the original KWallet, while the emulation " 1223 "the original KWallet, while the emulation "
1224 "is active.\n" 1224 "is active.\n"
1225 "Do you want to tempoarly disable the KWallet emulation?"), 1225 "Do you want to tempoarly disable the KWallet emulation?"),
1226 i18n("Tempoarly disable KWallet emulation?")) 1226 i18n("Tempoarly disable KWallet emulation?"))
1227 == KMessageBox::Yes) { 1227 == KMessageBox::Yes) {
1228 init->initKWalletEmu(true); 1228 init->initKWalletEmu(true);
1229 PWM_ASSERT(!init->kwalletEmu()); 1229 PWM_ASSERT(!init->kwalletEmu());
1230 return true; 1230 return true;
1231 } 1231 }
1232 return false; 1232 return false;
1233 } 1233 }
1234 return true; 1234 return true;
1235} 1235}
1236#endif // CONFIG_KWALLETIF 1236#endif // CONFIG_KWALLETIF
1237 1237
1238bool PwM::importKWallet() 1238bool PwM::importKWallet()
1239{ 1239{
1240#ifdef CONFIG_KWALLETIF 1240#ifdef CONFIG_KWALLETIF
1241 if (!checkAndAskForKWalletEmu()) 1241 if (!checkAndAskForKWalletEmu())
1242 return false; 1242 return false;
1243 KWalletIf walletIf(this); 1243 KWalletIf walletIf(this);
1244 if (!isVirgin()) { 1244 if (!isVirgin()) {
1245 if (KMessageBox::questionYesNo(this, 1245 if (KMessageBox::questionYesNo(this,
1246 i18n("Do you want to import the data " 1246 i18n("Do you want to import the data "
1247 "into the current document? (If you " 1247 "into the current document? (If you "
1248 "select \"no\", a new document will be " 1248 "select \"no\", a new document will be "
1249 "opened.)"), 1249 "opened.)"),
1250 i18n("import into this document?")) 1250 i18n("import into this document?"))
1251 == KMessageBox::No) { 1251 == KMessageBox::No) {
1252 // import the data to a new window. 1252 // import the data to a new window.
1253 PwM *newInstance = init->createMainWnd(); 1253 PwM *newInstance = init->createMainWnd();
1254 bool ok = newInstance->importKWallet(); 1254 bool ok = newInstance->importKWallet();
1255 if (!ok) { 1255 if (!ok) {
1256 newInstance->setForceQuit(true); 1256 newInstance->setForceQuit(true);
1257 delete_and_null(newInstance); 1257 delete_and_null(newInstance);
1258 goto exit_fail; 1258 goto exit_fail;
1259 } else { 1259 } else {
1260 goto exit_ok; 1260 goto exit_ok;
1261 } 1261 }
1262 } 1262 }
1263 } 1263 }
1264 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1264 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1265 if (!walletIf.kwalletImport(curDoc())) { 1265 if (!walletIf.kwalletImport(curDoc())) {
1266 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1266 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1267 showStatMsg(i18n("KWallet import failed")); 1267 showStatMsg(i18n("KWallet import failed"));
1268 goto exit_fail; 1268 goto exit_fail;
1269 } 1269 }
1270 KMessageBox::information(this, 1270 KMessageBox::information(this,
1271 i18n("Successfully imported the KWallet data " 1271 i18n("Successfully imported the KWallet data "
1272 "into the current document."), 1272 "into the current document."),
1273 i18n("successfully imported")); 1273 i18n("successfully imported"));
1274 showStatMsg(i18n("successfully imported")); 1274 showStatMsg(i18n("successfully imported"));
1275 setVirgin(false); 1275 setVirgin(false);
1276 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1276 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1277 1277
1278exit_ok: 1278exit_ok:
1279 init->initKWalletEmu(); 1279 init->initKWalletEmu();
1280 return true; 1280 return true;
1281 1281
1282exit_fail: 1282exit_fail:
1283 init->initKWalletEmu(); 1283 init->initKWalletEmu();
1284#endif // CONFIG_KWALLETIF 1284#endif // CONFIG_KWALLETIF
1285 return false; 1285 return false;
1286} 1286}
1287 1287
1288void PwM::print_slot() 1288void PwM::print_slot()
1289{ 1289{
1290 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1290 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1291#ifndef PWM_EMBEDDED 1291#ifndef PWM_EMBEDDED
1292 PwMPrint p(curDoc(), this); 1292 PwMPrint p(curDoc(), this);
1293 p.printNow(); 1293 p.printNow();
1294#else 1294#else
1295 qDebug("PwM::print_slot , PRINTING IS NOT IMPLEMENTED"); 1295 qDebug("PwM::print_slot , PRINTING IS NOT IMPLEMENTED");
1296#endif 1296#endif
1297 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1297 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1298} 1298}
1299 1299
1300void PwM::genNewCard_slot() 1300void PwM::genNewCard_slot()
1301{ 1301{
1302#ifdef CONFIG_KEYCARD 1302#ifdef CONFIG_KEYCARD
1303 init->keycard()->genNewCard(); 1303 init->keycard()->genNewCard();
1304#endif 1304#endif
1305} 1305}
1306 1306
1307void PwM::eraseCard_slot() 1307void PwM::eraseCard_slot()
1308{ 1308{
1309#ifdef CONFIG_KEYCARD 1309#ifdef CONFIG_KEYCARD
1310 init->keycard()->eraseCard(); 1310 init->keycard()->eraseCard();
1311#endif 1311#endif
1312} 1312}
1313 1313
1314void PwM::readCardId_slot() 1314void PwM::readCardId_slot()
1315{ 1315{
1316#ifdef CONFIG_KEYCARD 1316#ifdef CONFIG_KEYCARD
1317 init->keycard()->displayKey(); 1317 init->keycard()->displayKey();
1318#endif 1318#endif
1319} 1319}
1320 1320
1321void PwM::makeCardBackup_slot() 1321void PwM::makeCardBackup_slot()
1322{ 1322{
1323#ifdef CONFIG_KEYCARD 1323#ifdef CONFIG_KEYCARD
1324 init->keycard()->makeBackupImage(); 1324 init->keycard()->makeBackupImage();
1325#endif 1325#endif
1326} 1326}
1327 1327
1328void PwM::replayCardBackup_slot() 1328void PwM::replayCardBackup_slot()
1329{ 1329{
1330#ifdef CONFIG_KEYCARD 1330#ifdef CONFIG_KEYCARD
1331 init->keycard()->replayBackupImage(); 1331 init->keycard()->replayBackupImage();
1332#endif 1332#endif
1333} 1333}
1334 1334
1335void PwM::execLauncher_slot() 1335void PwM::execLauncher_slot()
1336{ 1336{
1337 PWM_ASSERT(curDoc()); 1337 PWM_ASSERT(curDoc());
1338 if (curDoc()->isDeepLocked()) 1338 if (curDoc()->isDeepLocked())
1339 return; 1339 return;
1340 unsigned int curEntryIndex; 1340 unsigned int curEntryIndex;
1341 if (!view->getCurEntryIndex(&curEntryIndex)) 1341 if (!view->getCurEntryIndex(&curEntryIndex))
1342 return; 1342 return;
1343 bool ret = curDoc()->execLauncher(view->getCurrentCategory(), 1343 bool ret = curDoc()->execLauncher(view->getCurrentCategory(),
1344 curEntryIndex); 1344 curEntryIndex);
1345 if (ret) 1345 if (ret)
1346 showStatMsg(i18n("Executed the \"Launcher\".")); 1346 showStatMsg(i18n("Executed the \"Launcher\"."));
1347 else 1347 else
1348 showStatMsg(i18n("ERROR: Couldn't execute the \"Launcher\"!")); 1348 showStatMsg(i18n("ERROR: Couldn't execute the \"Launcher\"!"));
1349} 1349}
1350 1350
1351void PwM::goToURL_slot() 1351void PwM::goToURL_slot()
1352{ 1352{
1353 PWM_ASSERT(curDoc()); 1353 PWM_ASSERT(curDoc());
1354 if (curDoc()->isDeepLocked()) 1354 if (curDoc()->isDeepLocked())
1355 return; 1355 return;
1356 unsigned int curEntryIndex; 1356 unsigned int curEntryIndex;
1357 if (!view->getCurEntryIndex(&curEntryIndex)) 1357 if (!view->getCurEntryIndex(&curEntryIndex))
1358 return; 1358 return;
1359 bool ret = curDoc()->goToURL(view->getCurrentCategory(), 1359 bool ret = curDoc()->goToURL(view->getCurrentCategory(),
1360 curEntryIndex); 1360 curEntryIndex);
1361 if (ret) 1361 if (ret)
1362 showStatMsg(i18n("started browser with current URL.")); 1362 showStatMsg(i18n("started browser with current URL."));
1363 else 1363 else
1364 showStatMsg(i18n("ERROR: Couldn't start browser! Maybe invalid URL?")); 1364 showStatMsg(i18n("ERROR: Couldn't start browser! Maybe invalid URL?"));
1365} 1365}
1366 1366
1367void PwM::copyToClipboard(const QString &s) 1367void PwM::copyToClipboard(const QString &s)
1368{ 1368{
1369 QClipboard *cb = QApplication::clipboard(); 1369 QClipboard *cb = QApplication::clipboard();
1370#ifndef PWM_EMBEDDED 1370#ifndef PWM_EMBEDDED
1371 if (cb->supportsSelection()) 1371 if (cb->supportsSelection())
1372 cb->setText(s, QClipboard::Selection); 1372 cb->setText(s, QClipboard::Selection);
1373 cb->setText(s, QClipboard::Clipboard); 1373 cb->setText(s, QClipboard::Clipboard);
1374#else 1374#else
1375 cb->setText(s); 1375 cb->setText(s);
1376 1376
1377#endif 1377#endif
1378 1378
1379} 1379}
1380 1380
1381 1381
1382void PwM::showStatMsg(const QString &msg) 1382void PwM::showStatMsg(const QString &msg)
1383{ 1383{
1384#ifdef DESKTOP_VERSION 1384#ifdef DESKTOP_VERSION
1385 statusBar()->message(msg, STATUSBAR_MSG_TIMEOUT * 1000); 1385 statusBar()->message(msg, STATUSBAR_MSG_TIMEOUT * 1000);
1386#else 1386#else
1387 qDebug("Statusbar : %s",msg.latin1()); 1387 //qDebug("Statusbar : %s",msg.latin1());
1388 Global::statusMessage(msg); 1388 Global::statusMessage(msg);
1389#endif 1389#endif
1390} 1390}
1391 1391
1392void PwM::focusInEvent(QFocusEvent *e) 1392void PwM::focusInEvent(QFocusEvent *e)
1393{ 1393{
1394 if (e->gotFocus()) { 1394 if (e->gotFocus()) {
1395 emit gotFocus(this); 1395 emit gotFocus(this);
1396 } else if (e->lostFocus()) { 1396 } else if (e->lostFocus()) {
1397 emit lostFocus(this); 1397 emit lostFocus(this);
1398 } 1398 }
1399} 1399}
1400 1400
1401 1401
1402#ifdef PWM_EMBEDDED 1402#ifdef PWM_EMBEDDED
1403 1403
1404void PwM::category_slot() 1404void PwM::category_slot()
1405{ 1405{
1406 PwMDoc *doc = curDoc(); 1406 PwMDoc *doc = curDoc();
1407 PWM_ASSERT(doc); 1407 PWM_ASSERT(doc);
1408 doc->timer()->getLock(DocTimer::id_autoLockTimer); 1408 doc->timer()->getLock(DocTimer::id_autoLockTimer);
1409 1409
1410 editCategoryWnd w(doc, this, "editcategory"); 1410 editCategoryWnd w(doc, this, "editcategory");
1411/* 1411/*
1412 vector<string> catList; 1412 vector<string> catList;
1413 doc->getCategoryList(&catList); 1413 doc->getCategoryList(&catList);
1414 unsigned i, size = catList.size(); 1414 unsigned i, size = catList.size();
1415 for (i = 0; i < size; ++i) { 1415 for (i = 0; i < size; ++i) {
1416 w.addCategory(catList[i].c_str()); 1416 w.addCategory(catList[i].c_str());
1417 } 1417 }
1418 w.setCurrCategory(view->getCurrentCategory()); 1418 w.setCurrCategory(view->getCurrentCategory());
1419 if (pw) 1419 if (pw)
1420 w.pwLineEdit->setText(*pw); 1420 w.pwLineEdit->setText(*pw);
1421*/ 1421*/
1422 w.setCurrCategory(view->getCurrentCategory()); 1422 w.setCurrCategory(view->getCurrentCategory());
1423 1423
1424 tryAgain: 1424 tryAgain:
1425 if (w.exec() == 1) 1425 if (w.exec() == 1)
1426 { 1426 {
1427 PwMDataItem d; 1427 PwMDataItem d;
1428 1428
1429 //US BUG: to initialize all values of curEntr with meaningfulldata, 1429 //US BUG: to initialize all values of curEntr with meaningfulldata,
1430 // we call clear on it. Reason: Metadata will be uninitialized otherwise. 1430 // we call clear on it. Reason: Metadata will be uninitialized otherwise.
1431 // another option would be to create a constructor for PwMDataItem 1431 // another option would be to create a constructor for PwMDataItem
1432 d.clear(true); 1432 d.clear(true);
1433 /* 1433 /*
1434 d.desc = w.getDescription().latin1(); 1434 d.desc = w.getDescription().latin1();
1435 d.name = w.getUsername().latin1(); 1435 d.name = w.getUsername().latin1();
1436 d.pw = w.getPassword().latin1(); 1436 d.pw = w.getPassword().latin1();
1437 d.comment = w.getComment().latin1(); 1437 d.comment = w.getComment().latin1();
1438 d.url = w.getUrl().latin1(); 1438 d.url = w.getUrl().latin1();
1439 d.launcher = w.getLauncher().latin1(); 1439 d.launcher = w.getLauncher().latin1();
1440 PwMerror ret = doc->addEntry(w.getCategory(), &d); 1440 PwMerror ret = doc->addEntry(w.getCategory(), &d);
1441 if (ret == e_entryExists) { 1441 if (ret == e_entryExists) {
1442 KMessageBox::error(this, 1442 KMessageBox::error(this,
1443 i18n 1443 i18n
1444 ("An entry with this \"Description\",\n" 1444 ("An entry with this \"Description\",\n"
1445 "does already exist.\n" 1445 "does already exist.\n"
1446 "Please select another description."), 1446 "Please select another description."),
1447 i18n("entry already exists.")); 1447 i18n("entry already exists."));
1448 goto tryAgain; 1448 goto tryAgain;
1449 } else if (ret == e_maxAllowedEntr) { 1449 } else if (ret == e_maxAllowedEntr) {
1450 KMessageBox::error(this, i18n("The maximum possible number of\nentries" 1450 KMessageBox::error(this, i18n("The maximum possible number of\nentries"
1451 "has been reached.\nYou can't add more entries."), 1451 "has been reached.\nYou can't add more entries."),
1452 i18n("maximum number of entries")); 1452 i18n("maximum number of entries"));
1453 doc->timer()->putLock(DocTimer::id_autoLockTimer); 1453 doc->timer()->putLock(DocTimer::id_autoLockTimer);
1454 return; 1454 return;
1455 } 1455 }
1456 */ 1456 */
1457 } 1457 }
1458 setVirgin(false); 1458 setVirgin(false);
1459 doc->timer()->putLock(DocTimer::id_autoLockTimer); 1459 doc->timer()->putLock(DocTimer::id_autoLockTimer);
1460} 1460}
1461 1461
1462 1462
1463void PwM::whatsnew_slot() 1463void PwM::whatsnew_slot()
1464{ 1464{
1465 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1465 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1466} 1466}
1467 1467
1468void PwM::showLicense_slot() 1468void PwM::showLicense_slot()
1469{ 1469{
1470 KApplication::showLicence(); 1470 KApplication::showLicence();
1471} 1471}
1472 1472
1473void PwM::faq_slot() 1473void PwM::faq_slot()
1474{ 1474{
1475 KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" ); 1475 KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" );
1476} 1476}
1477 1477
1478void PwM::syncHowTo_slot() 1478void PwM::syncHowTo_slot()
1479{ 1479{
1480 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1480 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1481} 1481}
1482 1482
1483 1483
1484void PwM::createAboutData_slot() 1484void PwM::createAboutData_slot()
1485{ 1485{
1486 QString version; 1486 QString version;
1487#include <../version> 1487#include <../version>
1488; 1488;
1489 QMessageBox::about( this, "About PwManager/Pi", 1489 QMessageBox::about( this, "About PwManager/Pi",
1490 "PwManager/Platform-independent\n" 1490 "PwManager/Platform-independent\n"
1491 "(PWM/Pi) " +version + " - " + 1491 "(PWM/Pi) " +version + " - " +
1492#ifdef DESKTOP_VERSION 1492#ifdef DESKTOP_VERSION
1493 "Desktop Edition\n" 1493 "Desktop Edition\n"
1494#else 1494#else
1495 "PDA-Edition\n" 1495 "PDA-Edition\n"
1496 "for: Zaurus 5500 / 7x0 / 8x0\n" 1496 "for: Zaurus 5500 / 7x0 / 8x0\n"
1497#endif 1497#endif
1498 1498
1499 "(c) 2004 Ulf Schenk\n" 1499 "(c) 2004 Ulf Schenk\n"
1500 "(c) 2004 Lutz Rogowski\n" 1500 "(c) 2004 Lutz Rogowski\n"
1501 "(c) 1997-2004, The KDE PIM Team\n" 1501 "(c) 1997-2004, The KDE PIM Team\n"
1502 1502
1503 "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n" 1503 "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n"
1504 "Matt Scifo - mscifo@o1.com\n" 1504 "Matt Scifo - mscifo@o1.com\n"
1505 "Elias Probst - elias.probst@gmx.de\n" 1505 "Elias Probst - elias.probst@gmx.de\n"
1506 "George Staikos - staikos@kde.org\n" 1506 "George Staikos - staikos@kde.org\n"
1507 "Matthew Palmer - mjp16@uow.edu.au\n" 1507 "Matthew Palmer - mjp16@uow.edu.au\n"
1508 "Olivier Sessink - gpasman@nl.linux.org\n" 1508 "Olivier Sessink - gpasman@nl.linux.org\n"
1509 "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" 1509 "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n"
1510 "Troy Engel - tengel@sonic.net\n" 1510 "Troy Engel - tengel@sonic.net\n"
1511 "Wickey - wickey@gmx.at\n" 1511 "Wickey - wickey@gmx.at\n"
1512 "Ian MacGregor - original documentation author.\n" 1512 "Ian MacGregor - original documentation author.\n"
1513 ); 1513 );
1514} 1514}
1515 1515
1516 1516
1517//this are the overwritten callbackmethods from the syncinterface 1517//this are the overwritten callbackmethods from the syncinterface
1518bool PwM::sync(KSyncManager* manager, QString filename, int mode) 1518bool PwM::sync(KSyncManager* manager, QString filename, int mode)
1519{ 1519{
1520 PWM_ASSERT(curDoc()); 1520 PWM_ASSERT(curDoc());
1521 1521
1522 bool ret = curDoc()->sync(manager, filename, mode); 1522 bool ret = curDoc()->sync(manager, filename, mode);
1523 1523
1524 qDebug("PwM::sync save now: ret=%i", ret); 1524 qDebug("PwM::sync save now: ret=%i", ret);
1525 1525
1526 if (ret == true) { 1526 if (ret == true) {
1527 //US BUG: what can we call here to update the view of the current doc? 1527 //US BUG: what can we call here to update the view of the current doc?
1528 //mViewManager->refreshView(); 1528 //mViewManager->refreshView();
1529 1529
1530 //US curDoc()->sync sets the dirtyFlag in case the sync was successfull. 1530 //US curDoc()->sync sets the dirtyFlag in case the sync was successfull.
1531 save(); 1531 save();
1532 } 1532 }
1533 1533
1534 return ret; 1534 return ret;
1535} 1535}
1536 1536
1537void PwM::removeSyncInfo( QString syncProfile) 1537void PwM::removeSyncInfo( QString syncProfile)
1538{ 1538{
1539 qDebug("PWM:removeSyncInfo for profile %s ", syncProfile.latin1()); 1539 qDebug("PWM:removeSyncInfo for profile %s ", syncProfile.latin1());
1540 curDoc()->removeSyncInfo( syncProfile ); 1540 curDoc()->removeSyncInfo( syncProfile );
1541 //US curDoc()->removeSyncInfo sets the dirtyFlag. 1541 //US curDoc()->removeSyncInfo sets the dirtyFlag.
1542} 1542}
1543 1543
1544#endif 1544#endif
1545 1545
1546 1546
1547#ifndef PWM_EMBEDDED 1547#ifndef PWM_EMBEDDED
1548#include "pwm.moc" 1548#include "pwm.moc"
1549#endif 1549#endif
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp
index 0cf248c..d59d4d8 100644
--- a/pwmanager/pwmanager/pwminit.cpp
+++ b/pwmanager/pwmanager/pwminit.cpp
@@ -1,610 +1,610 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2004 by Michael Buesch * 3 * copyright (C) 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
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 version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include "pwminit.h" 20#include "pwminit.h"
21#include "randomizer.h" 21#include "randomizer.h"
22#include <qdir.h> 22#include <qdir.h>
23 23
24#ifndef PWM_EMBEDDED 24#ifndef PWM_EMBEDDED
25#include "selftest.h" 25#include "selftest.h"
26#include "configuration.h" 26#include "configuration.h"
27#else 27#else
28#include "pwmprefs.h" 28#include "pwmprefs.h"
29#endif 29#endif
30 30
31#include "pwm.h" 31#include "pwm.h"
32#include "pwmexception.h" 32#include "pwmexception.h"
33#include "pwmtray.h" 33#include "pwmtray.h"
34#include "pwmdoc.h" 34#include "pwmdoc.h"
35 35
36#ifdef CONFIG_KWALLETIF 36#ifdef CONFIG_KWALLETIF
37# include "kwalletemu.h" 37# include "kwalletemu.h"
38#endif // CONFIG_KWALLETIF 38#endif // CONFIG_KWALLETIF
39#ifdef CONFIG_KEYCARD 39#ifdef CONFIG_KEYCARD
40# include "pwmkeycard.h" 40# include "pwmkeycard.h"
41#endif // CONFIG_KEYCARD 41#endif // CONFIG_KEYCARD
42 42
43#include <qmessagebox.h> 43#include <qmessagebox.h>
44 44
45#include <kmessagebox.h> 45#include <kmessagebox.h>
46#ifndef PWM_EMBEDDED 46#ifndef PWM_EMBEDDED
47#include <kcmdlineargs.h> 47#include <kcmdlineargs.h>
48#include <kwin.h> 48#include <kwin.h>
49#include <dcopclient.h> 49#include <dcopclient.h>
50#endif 50#endif
51 51
52#include <kapplication.h> 52#include <kapplication.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54 54
55#include <signal.h> 55#include <signal.h>
56 56
57static PwMInit *sig_init_pointer; 57static PwMInit *sig_init_pointer;
58#ifdef _WIN32_ 58#ifdef _WIN32_
59static void sig_handler(int signum) 59static void sig_handler(int signum)
60#else 60#else
61static NOREGPARM void sig_handler(int signum) 61static NOREGPARM void sig_handler(int signum)
62#endif 62#endif
63{ 63{
64 switch (signum) { 64 switch (signum) {
65 case SIGINT: 65 case SIGINT:
66 case SIGTERM: 66 case SIGTERM:
67 sig_init_pointer->shutdownApp(20 + signum); 67 sig_init_pointer->shutdownApp(20 + signum);
68 break; 68 break;
69 default: 69 default:
70 printDebug(string("unhandled signal ") 70 printDebug(string("unhandled signal ")
71 + tostr(signum)); 71 + tostr(signum));
72 } 72 }
73} 73}
74 74
75 75
76 76
77PwMInit::PwMInit(PwMApplication *_app) 77PwMInit::PwMInit(PwMApplication *_app)
78 : runStatus (unknown) 78 : runStatus (unknown)
79 , _curWidget (0) 79 , _curWidget (0)
80 , _dcopClient (0) 80 , _dcopClient (0)
81 , _kwalletEmu (0) 81 , _kwalletEmu (0)
82 , _keycard (0) 82 , _keycard (0)
83 , _tray (0) 83 , _tray (0)
84{ 84{
85 sig_init_pointer = this; 85 sig_init_pointer = this;
86 app = _app; 86 app = _app;
87} 87}
88 88
89PwMInit::~PwMInit() 89PwMInit::~PwMInit()
90{ 90{
91 qDebug("PwMInit::~PwMInit() "); 91 //qDebug("PwMInit::~PwMInit() ");
92#ifndef PWM_EMBEDDED 92#ifndef PWM_EMBEDDED
93 SelfTest::cancel(); 93 SelfTest::cancel();
94 // close all open mainwnds 94 // close all open mainwnds
95 QValueList<PwM *>::iterator i = _mainWndList.begin(), 95 QValueList<PwM *>::iterator i = _mainWndList.begin(),
96 end = _mainWndList.end(); 96 end = _mainWndList.end();
97 97
98#else 98#else
99 // close all open mainwnds 99 // close all open mainwnds
100 QValueList<PwM *>::Iterator i = _mainWndList.begin(), 100 QValueList<PwM *>::Iterator i = _mainWndList.begin(),
101 end = _mainWndList.end(); 101 end = _mainWndList.end();
102#endif 102#endif
103 while (i != end) { 103 while (i != end) {
104 disconnect(*i, SIGNAL(closed(PwM *)), 104 disconnect(*i, SIGNAL(closed(PwM *)),
105 this, SLOT(mainWndClosed(PwM *))); 105 this, SLOT(mainWndClosed(PwM *)));
106 delete *i; 106 delete *i;
107 ++i; 107 ++i;
108 } 108 }
109 _mainWndList.clear(); 109 _mainWndList.clear();
110 // close all remaining open documents 110 // close all remaining open documents
111 PwMDocList *_dl = PwMDoc::getOpenDocList(); 111 PwMDocList *_dl = PwMDoc::getOpenDocList();
112 vector<PwMDocList::listItem> dl = *(_dl->getList()); 112 vector<PwMDocList::listItem> dl = *(_dl->getList());
113 vector<PwMDocList::listItem>::iterator i2 = dl.begin(), 113 vector<PwMDocList::listItem>::iterator i2 = dl.begin(),
114 end2 = dl.end(); 114 end2 = dl.end();
115 while (i2 != end2) { 115 while (i2 != end2) {
116 delete (*i2).doc; 116 delete (*i2).doc;
117 ++i2; 117 ++i2;
118 } 118 }
119 119
120#ifdef CONFIG_KWALLETIF 120#ifdef CONFIG_KWALLETIF
121 delete_ifnot_null(_kwalletEmu); 121 delete_ifnot_null(_kwalletEmu);
122#endif // CONFIG_KWALLETIF 122#endif // CONFIG_KWALLETIF
123#ifdef CONFIG_KEYCARD 123#ifdef CONFIG_KEYCARD
124 delete_ifnot_null(_keycard); 124 delete_ifnot_null(_keycard);
125#endif // CONFIG_KEYCARD 125#endif // CONFIG_KEYCARD
126 delete_ifnot_null(_tray); 126 delete_ifnot_null(_tray);
127 127
128 Randomizer::cleanup(); 128 Randomizer::cleanup();
129#ifndef PWM_EMBEDDED 129#ifndef PWM_EMBEDDED
130 Configuration::cleanup(); 130 Configuration::cleanup();
131#endif 131#endif
132} 132}
133 133
134void PwMInit::initializeApp() 134void PwMInit::initializeApp()
135{ 135{
136 //qDebug("PwMInit::initializeApp() "); 136 //qDebug("PwMInit::initializeApp() ");
137 PWM_ASSERT(runStatus == unknown); 137 PWM_ASSERT(runStatus == unknown);
138 runStatus = init; 138 runStatus = init;
139 initPosixSignalHandler(); 139 initPosixSignalHandler();
140 Randomizer::init(); 140 Randomizer::init();
141#ifndef PWM_EMBEDDED 141#ifndef PWM_EMBEDDED
142 Configuration::init(); 142 Configuration::init();
143#endif 143#endif
144 initDCOP(); 144 initDCOP();
145 initKWalletEmu(); 145 initKWalletEmu();
146 initKeycard(); 146 initKeycard();
147 initTray(); 147 initTray();
148 handleCmdLineArgs(); 148 handleCmdLineArgs();
149 bool openDeeplocked = false; 149 bool openDeeplocked = false;
150 if (conf()->confGlobAutostartDeepLocked() || 150 if (conf()->confGlobAutostartDeepLocked() ||
151 savedCmd.open_deeplocked) 151 savedCmd.open_deeplocked)
152 openDeeplocked = true; 152 openDeeplocked = true;
153 if ( false ){ 153 if ( false ){
154 // LR is not working 154 // LR is not working
155 //if (conf()->confWndAutoMinimizeOnStart() || 155 //if (conf()->confWndAutoMinimizeOnStart() ||
156 // savedCmd.minToTray) { 156 // savedCmd.minToTray) {
157 PwMDoc *newDoc = createDoc(); 157 PwMDoc *newDoc = createDoc();
158 qDebug(" createDoc()"); 158 //qDebug(" createDoc()");
159 if (!newDoc->openDocUi(newDoc, 159 if (!newDoc->openDocUi(newDoc,
160 conf()->confGlobAutoStart(), 160 conf()->confGlobAutoStart(),
161 openDeeplocked)) { 161 openDeeplocked)) {
162 delete newDoc; 162 delete newDoc;
163 } 163 }
164 164
165 //US ENH for embedded devices: in the case of failure, open a document the default way 165 //US ENH for embedded devices: in the case of failure, open a document the default way
166 createMainWnd(conf()->confGlobAutoStart(), 166 createMainWnd(conf()->confGlobAutoStart(),
167 openDeeplocked, 167 openDeeplocked,
168 true, 168 true,
169 0, 169 0,
170 savedCmd.minimized); 170 savedCmd.minimized);
171 171
172 172
173 173
174 174
175 //} 175 //}
176 } else { 176 } else {
177 createMainWnd(conf()->confGlobAutoStart(), 177 createMainWnd(conf()->confGlobAutoStart(),
178 openDeeplocked, 178 openDeeplocked,
179 true, 179 true,
180 0, 180 0,
181 savedCmd.minimized); 181 savedCmd.minimized);
182 } 182 }
183 runStatus = running; 183 runStatus = running;
184} 184}
185 185
186void PwMInit::shutdownApp(int exitStatus) 186void PwMInit::shutdownApp(int exitStatus)
187{ 187{
188 188
189 189
190 PwM * iii;; 190 PwM * iii;;
191 while ( _mainWndList.count() ) { 191 while ( _mainWndList.count() ) {
192 iii = _mainWndList.first(); 192 iii = _mainWndList.first();
193 disconnect(iii, SIGNAL(closed(PwM *)), 193 disconnect(iii, SIGNAL(closed(PwM *)),
194 this, SLOT(mainWndClosed(PwM *))); 194 this, SLOT(mainWndClosed(PwM *)));
195 mainWndClosed((iii)); 195 mainWndClosed((iii));
196 } 196 }
197 197
198 printDebug(string("PwMInit::shutdownApp(") 198 printDebug(string("PwMInit::shutdownApp(")
199 + tostr(exitStatus) + ") called."); 199 + tostr(exitStatus) + ") called.");
200 PWM_ASSERT((runStatus == running) || (runStatus == init)); 200 PWM_ASSERT((runStatus == running) || (runStatus == init));
201 runStatus = shutdown; 201 runStatus = shutdown;
202 QApplication::exit(exitStatus); 202 QApplication::exit(exitStatus);
203 /* The destructor of PwMInit is called when control 203 /* The destructor of PwMInit is called when control
204 * leaves main() 204 * leaves main()
205 */ 205 */
206} 206}
207 207
208void PwMInit::initPosixSignalHandler() 208void PwMInit::initPosixSignalHandler()
209{ 209{
210 signal(SIGINT, sig_handler); 210 signal(SIGINT, sig_handler);
211 signal(SIGTERM, sig_handler); 211 signal(SIGTERM, sig_handler);
212} 212}
213 213
214void PwMInit::initDCOP() 214void PwMInit::initDCOP()
215{ 215{
216#ifndef PWM_EMBEDDED 216#ifndef PWM_EMBEDDED
217 _dcopClient = app->dcopClient(); 217 _dcopClient = app->dcopClient();
218 _dcopClient->setNotifications(true); 218 _dcopClient->setNotifications(true);
219#endif 219#endif
220 220
221} 221}
222 222
223void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload) 223void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload)
224{ 224{
225#ifdef CONFIG_KWALLETIF 225#ifdef CONFIG_KWALLETIF
226 if (!conf()->confGlobKwalletEmu() || 226 if (!conf()->confGlobKwalletEmu() ||
227 forceDisable) { 227 forceDisable) {
228 delete_ifnot_null(_kwalletEmu); 228 delete_ifnot_null(_kwalletEmu);
229 return; 229 return;
230 } 230 }
231 try { 231 try {
232 if (_kwalletEmu && forceReload) 232 if (_kwalletEmu && forceReload)
233 delete_and_null(_kwalletEmu); 233 delete_and_null(_kwalletEmu);
234 if (!_kwalletEmu) 234 if (!_kwalletEmu)
235 _kwalletEmu = new KWalletEmu(this); 235 _kwalletEmu = new KWalletEmu(this);
236 } catch (PwMException e) { 236 } catch (PwMException e) {
237 string errMsg("initializing KWallet emulation failed. ID: "); 237 string errMsg("initializing KWallet emulation failed. ID: ");
238 errMsg += tostr(static_cast<int>(e.getId())); 238 errMsg += tostr(static_cast<int>(e.getId()));
239 errMsg += " err-message: "; 239 errMsg += " err-message: ";
240 errMsg += e.getMessage(); 240 errMsg += e.getMessage();
241 printWarn(errMsg); 241 printWarn(errMsg);
242 return; 242 return;
243 } 243 }
244#else // CONFIG_KWALLETIF 244#else // CONFIG_KWALLETIF
245 PARAM_UNUSED(forceDisable); 245 PARAM_UNUSED(forceDisable);
246 PARAM_UNUSED(forceReload); 246 PARAM_UNUSED(forceReload);
247#endif // CONFIG_KWALLETIF 247#endif // CONFIG_KWALLETIF
248} 248}
249 249
250void PwMInit::initKeycard() 250void PwMInit::initKeycard()
251{ 251{
252#ifdef CONFIG_KEYCARD 252#ifdef CONFIG_KEYCARD
253 PWM_ASSERT(!_keycard); 253 PWM_ASSERT(!_keycard);
254 _keycard = new PwMKeyCard(this); 254 _keycard = new PwMKeyCard(this);
255#endif // CONFIG_KEYCARD 255#endif // CONFIG_KEYCARD
256} 256}
257 257
258void PwMInit::initTray() 258void PwMInit::initTray()
259{ 259{
260#ifdef PWM_EMBEDDED 260#ifdef PWM_EMBEDDED
261 //US ENH : embedded version does not support a tray 261 //US ENH : embedded version does not support a tray
262 return; 262 return;
263#endif 263#endif
264 264
265 if (!conf()->confGlobTray()) { 265 if (!conf()->confGlobTray()) {
266 if (!_tray) 266 if (!_tray)
267 return; 267 return;
268 _tray->hide(); 268 _tray->hide();
269 delete_and_null(_tray); 269 delete_and_null(_tray);
270 return; 270 return;
271 } 271 }
272 if (_tray) 272 if (_tray)
273 return; 273 return;
274 _tray = new PwMTray(this); 274 _tray = new PwMTray(this);
275 connect(_tray, SIGNAL(quitSelected()), 275 connect(_tray, SIGNAL(quitSelected()),
276 this, SLOT(removeTrayAndQuit())); 276 this, SLOT(removeTrayAndQuit()));
277 connect(_tray, SIGNAL(closed(PwMTray *)), 277 connect(_tray, SIGNAL(closed(PwMTray *)),
278 this, SLOT(trayIconClosed(PwMTray *))); 278 this, SLOT(trayIconClosed(PwMTray *)));
279 KIconLoader icons; 279 KIconLoader icons;
280#ifndef PWM_EMBEDDED 280#ifndef PWM_EMBEDDED
281 _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small)); 281 _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small));
282#endif 282#endif
283 _tray->show(); 283 _tray->show();
284 // connect the signals of all open documents. 284 // connect the signals of all open documents.
285 const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList(); 285 const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList();
286 vector<PwMDocList::listItem>::const_iterator i = dl->begin(), 286 vector<PwMDocList::listItem>::const_iterator i = dl->begin(),
287 end = dl->end(); 287 end = dl->end();
288 while (i != end) { 288 while (i != end) {
289 _tray->connectDocToTray((*i).doc); 289 _tray->connectDocToTray((*i).doc);
290 ++i; 290 ++i;
291 } 291 }
292} 292}
293 293
294void PwMInit::removeTrayAndQuit() 294void PwMInit::removeTrayAndQuit()
295{ 295{
296 PWM_ASSERT(_tray); 296 PWM_ASSERT(_tray);
297 // _tray is deleted in ~PwMInit 297 // _tray is deleted in ~PwMInit
298 shutdownApp(0); 298 shutdownApp(0);
299} 299}
300 300
301PwM * PwMInit::createMainWnd(const QString &loadFile, 301PwM * PwMInit::createMainWnd(const QString &loadFile,
302 bool loadFileDeepLocked, 302 bool loadFileDeepLocked,
303 bool virginity, 303 bool virginity,
304 PwMDoc *doc, 304 PwMDoc *doc,
305 bool minimized) 305 bool minimized)
306{ 306{
307 PwM *newWnd; 307 PwM *newWnd;
308 if (!doc) 308 if (!doc)
309 doc = createDoc(); 309 doc = createDoc();
310 newWnd = new PwM(this, doc, virginity); 310 newWnd = new PwM(this, doc, virginity);
311#ifndef PWM_EMBEDDED 311#ifndef PWM_EMBEDDED
312 _mainWndList.push_back(newWnd); 312 _mainWndList.push_back(newWnd);
313#else 313#else
314 _mainWndList.append(newWnd); 314 _mainWndList.append(newWnd);
315#endif 315#endif
316 connect(newWnd, SIGNAL(closed(PwM *)), 316 connect(newWnd, SIGNAL(closed(PwM *)),
317 this, SLOT(mainWndClosed(PwM *))); 317 this, SLOT(mainWndClosed(PwM *)));
318 connect(newWnd, SIGNAL(gotFocus(PwM *)), 318 connect(newWnd, SIGNAL(gotFocus(PwM *)),
319 this, SLOT(setCurWidget(PwM *))); 319 this, SLOT(setCurWidget(PwM *)));
320 connect(newWnd, SIGNAL(lostFocus(PwM *)), 320 connect(newWnd, SIGNAL(lostFocus(PwM *)),
321 this, SLOT(resetCurWidget())); 321 this, SLOT(resetCurWidget()));
322 322
323 //US ENH 323 //US ENH
324#ifndef PWM_EMBEDDED 324#ifndef PWM_EMBEDDED
325 if (minimized) 325 if (minimized)
326 newWnd->showMinimized(); 326 newWnd->showMinimized();
327 else 327 else
328 newWnd->show(); 328 newWnd->show();
329 329
330#else //PWM_EMBEDDED 330#else //PWM_EMBEDDED
331 331
332#ifndef DESKTOP_VERSION 332#ifndef DESKTOP_VERSION
333 app->showMainWidget( newWnd ); 333 app->showMainWidget( newWnd );
334#else //DESKTOP_VERSION 334#else //DESKTOP_VERSION
335 newWnd->resize (640, 480 ); 335 newWnd->resize (640, 480 );
336 newWnd->show(); 336 newWnd->show();
337#endif //DESKTOP_VERSION 337#endif //DESKTOP_VERSION
338 338
339#endif //PWM_EMBEDDED 339#endif //PWM_EMBEDDED
340 340
341 if (loadFile != QString::null && 341 if (loadFile != QString::null &&
342 loadFile != "") { 342 loadFile != "") {
343 newWnd->openDoc(loadFile, loadFileDeepLocked); 343 newWnd->openDoc(loadFile, loadFileDeepLocked);
344 } 344 }
345 return newWnd; 345 return newWnd;
346} 346}
347 347
348PwMDoc * PwMInit::createDoc() 348PwMDoc * PwMInit::createDoc()
349{ 349{
350 PwMDoc *doc = new PwMDoc(this); 350 PwMDoc *doc = new PwMDoc(this);
351#ifdef CONFIG_KEYCARD 351#ifdef CONFIG_KEYCARD
352 doc->setPwMKeyCard(keycard()); 352 doc->setPwMKeyCard(keycard());
353#endif 353#endif
354#ifdef CONFIG_KWALLETIF 354#ifdef CONFIG_KWALLETIF
355 if (kwalletEmu()) 355 if (kwalletEmu())
356 kwalletEmu()->connectDocSignals(doc); 356 kwalletEmu()->connectDocSignals(doc);
357#endif 357#endif
358 358
359 if (_tray) 359 if (_tray)
360 _tray->connectDocToTray(doc); 360 _tray->connectDocToTray(doc);
361 361
362 return doc; 362 return doc;
363 363
364} 364}
365 365
366void PwMInit::mainWndClosed(PwM *wnd) 366void PwMInit::mainWndClosed(PwM *wnd)
367{ 367{
368 bool doMinimizeToTray = false; 368 bool doMinimizeToTray = false;
369 bool doDeleteDoc = false; 369 bool doDeleteDoc = false;
370#ifndef PWM_EMBEDDED 370#ifndef PWM_EMBEDDED
371 dcopClient()->suspend(); 371 dcopClient()->suspend();
372 dcopClient()->setAcceptCalls(false); 372 dcopClient()->setAcceptCalls(false);
373#endif 373#endif
374again: 374again:
375 375
376 if (wnd->isForceMinimizeToTray()) { 376 if (wnd->isForceMinimizeToTray()) {
377 if (unlikely(!_tray)) { 377 if (unlikely(!_tray)) {
378 /* This should not happen! If we set forceMinimizeToTray , 378 /* This should not happen! If we set forceMinimizeToTray ,
379 * we must be sure that _tray exists. 379 * we must be sure that _tray exists.
380 */ 380 */
381 BUG(); 381 BUG();
382 wnd->setForceMinimizeToTray(false); 382 wnd->setForceMinimizeToTray(false);
383 goto again; 383 goto again;
384 } 384 }
385 doMinimizeToTray = true; 385 doMinimizeToTray = true;
386 } else { 386 } else {
387 // Ask to minimize to tray. If not, delete doc. 387 // Ask to minimize to tray. If not, delete doc.
388 if (_tray && 388 if (_tray &&
389 runStatus != shutdown && 389 runStatus != shutdown &&
390 !wnd->isForceQuit() && 390 !wnd->isForceQuit() &&
391 !wnd->curDoc()->isDeleted()) { 391 !wnd->curDoc()->isDeleted()) {
392 if (conf()->confWndClose()) 392 if (conf()->confWndClose())
393 doDeleteDoc = true; 393 doDeleteDoc = true;
394 else 394 else
395 doMinimizeToTray = true; 395 doMinimizeToTray = true;
396 } else { 396 } else {
397 doDeleteDoc = true; 397 doDeleteDoc = true;
398 } 398 }
399 } 399 }
400 400
401 if (doMinimizeToTray) { 401 if (doMinimizeToTray) {
402 qDebug("doMinimizeToTray "); 402 //qDebug("doMinimizeToTray ");
403 PWM_ASSERT(_tray); 403 PWM_ASSERT(_tray);
404 int mmlock = conf()->confGlobMinimizeLock(); 404 int mmlock = conf()->confGlobMinimizeLock();
405 switch (mmlock) { 405 switch (mmlock) {
406 case 0: // don't lock anything 406 case 0: // don't lock anything
407 break; 407 break;
408 case 1: // normal lock 408 case 1: // normal lock
409 wnd->curDoc()->lockAll(true); 409 wnd->curDoc()->lockAll(true);
410 break; 410 break;
411 case 2: // deep-lock 411 case 2: // deep-lock
412 wnd->curDoc()->deepLock(); 412 wnd->curDoc()->deepLock();
413 break; 413 break;
414 default: 414 default:
415 WARN(); 415 WARN();
416 } 416 }
417 } else if (doDeleteDoc) { 417 } else if (doDeleteDoc) {
418 qDebug("doDeleteDoc "); 418 //qDebug("doDeleteDoc ");
419 if (!wnd->curDoc()->tryDelete()) { 419 if (!wnd->curDoc()->tryDelete()) {
420 /* We failed deleting the doc, 420 /* We failed deleting the doc,
421 * so open a new window with it, again. 421 * so open a new window with it, again.
422 */ 422 */
423 createMainWnd(QString::null, false, 423 createMainWnd(QString::null, false,
424 false, wnd->curDoc()); 424 false, wnd->curDoc());
425 } 425 }
426 } 426 }
427#ifndef PWM_EMBEDDED 427#ifndef PWM_EMBEDDED
428 // find the closed window in the "mainWndList" and delete it. 428 // find the closed window in the "mainWndList" and delete it.
429 QValueList<PwM *>::iterator i = _mainWndList.begin(), 429 QValueList<PwM *>::iterator i = _mainWndList.begin(),
430 end = _mainWndList.end(); 430 end = _mainWndList.end();
431#else 431#else
432 // find the closed window in the "mainWndList" and delete it. 432 // find the closed window in the "mainWndList" and delete it.
433 QValueList<PwM *>::Iterator i = _mainWndList.begin(), 433 QValueList<PwM *>::Iterator i = _mainWndList.begin(),
434 end = _mainWndList.end(); 434 end = _mainWndList.end();
435#endif 435#endif
436 while (i != end) { 436 while (i != end) {
437 //qDebug("iii %x end %x wnd %x", (*i), (*end), wnd); 437 //qDebug("iii %x end %x wnd %x", (*i), (*end), wnd);
438 if (*i == wnd) { 438 if (*i == wnd) {
439#ifndef PWM_EMBEDDED 439#ifndef PWM_EMBEDDED
440 _mainWndList.erase(i); 440 _mainWndList.erase(i);
441#else 441#else
442 _mainWndList.remove(i); 442 _mainWndList.remove(i);
443#endif 443#endif
444 444
445 if ( app->mainWidget() == wnd ) { 445 if ( app->mainWidget() == wnd ) {
446 if ( _mainWndList.count() ) { 446 if ( _mainWndList.count() ) {
447#ifndef DESKTOP_VERSION 447#ifndef DESKTOP_VERSION
448 app->showMainWidget(_mainWndList.first() ); 448 app->showMainWidget(_mainWndList.first() );
449#endif //DESKTOP_VERSION 449#endif //DESKTOP_VERSION
450 450
451 } 451 }
452 } 452 }
453 delete wnd; 453 delete wnd;
454 goto out_success; 454 goto out_success;
455 } 455 }
456 ++i; 456 ++i;
457 } 457 }
458 BUG(); 458 BUG();
459out_success: 459out_success:
460#ifndef PWM_EMBEDDED 460#ifndef PWM_EMBEDDED
461 if (!_mainWndList.size()) 461 if (!_mainWndList.size())
462#else 462#else
463 if (!_mainWndList.count()) 463 if (!_mainWndList.count())
464#endif 464#endif
465 465
466 { 466 {
467 /* If there's no main window and no tray icon 467 /* If there's no main window and no tray icon
468 * left, we have no user interface, so we can 468 * left, we have no user interface, so we can
469 * shut down the application. 469 * shut down the application.
470 */ 470 */
471 if (!_tray) { 471 if (!_tray) {
472#ifndef PWM_EMBEDDED 472#ifndef PWM_EMBEDDED
473 dcopClient()->setAcceptCalls(true); 473 dcopClient()->setAcceptCalls(true);
474 dcopClient()->resume(); 474 dcopClient()->resume();
475#endif 475#endif
476 shutdownApp(0); 476 shutdownApp(0);
477 return; 477 return;
478 } 478 }
479 /* There is no widget left, so set 479 /* There is no widget left, so set
480 * _curWidget to 0 480 * _curWidget to 0
481 */ 481 */
482 resetCurWidget(); 482 resetCurWidget();
483 } 483 }
484#ifndef PWM_EMBEDDED 484#ifndef PWM_EMBEDDED
485 dcopClient()->setAcceptCalls(true); 485 dcopClient()->setAcceptCalls(true);
486 dcopClient()->resume(); 486 dcopClient()->resume();
487#endif 487#endif
488} 488}
489 489
490void PwMInit::trayIconClosed(PwMTray *tray) 490void PwMInit::trayIconClosed(PwMTray *tray)
491{ 491{
492 if (runStatus != running) 492 if (runStatus != running)
493 return; 493 return;
494 PARAM_UNUSED(tray); 494 PARAM_UNUSED(tray);
495 PWM_ASSERT(tray == _tray); 495 PWM_ASSERT(tray == _tray);
496 /* If there's no main wnd left we have to 496 /* If there's no main wnd left we have to
497 * shutdown the app (same as in mainWndClosed()) 497 * shutdown the app (same as in mainWndClosed())
498 */ 498 */
499#ifndef PWM_EMBEDDED 499#ifndef PWM_EMBEDDED
500 if (!_mainWndList.size()) 500 if (!_mainWndList.size())
501 shutdownApp(0); 501 shutdownApp(0);
502#else 502#else
503 if (!_mainWndList.count()) 503 if (!_mainWndList.count())
504 shutdownApp(0); 504 shutdownApp(0);
505#endif 505#endif
506} 506}
507 507
508void PwMInit::handleCmdLineArgs(bool initial) 508void PwMInit::handleCmdLineArgs(bool initial)
509{ 509{
510#ifndef PWM_EMBEDDED 510#ifndef PWM_EMBEDDED
511 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 511 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
512 PWM_ASSERT(args); 512 PWM_ASSERT(args);
513 int i, numArgs = args->count(); 513 int i, numArgs = args->count();
514 const char *curArg; 514 const char *curArg;
515 515
516 // read all cmdline options 516 // read all cmdline options
517 savedCmd.open_deeplocked = args->isSet("open-deeplocked"); 517 savedCmd.open_deeplocked = args->isSet("open-deeplocked");
518 savedCmd.minimized = args->isSet("minimized"); 518 savedCmd.minimized = args->isSet("minimized");
519 savedCmd.minToTray = args->isSet("mintray"); 519 savedCmd.minToTray = args->isSet("mintray");
520 savedCmd.skipSelfTest = args->isSet("skip-self-test"); 520 savedCmd.skipSelfTest = args->isSet("skip-self-test");
521 if (savedCmd.minimized && 521 if (savedCmd.minimized &&
522 savedCmd.minToTray) { 522 savedCmd.minToTray) {
523 printInfo(i18n("Commandline option \"--minimized\" and " 523 printInfo(i18n("Commandline option \"--minimized\" and "
524 "\"--mintray\" selected. These are incompatible. " 524 "\"--mintray\" selected. These are incompatible. "
525 "\"--mintray\" will be selected.").latin1()); 525 "\"--mintray\" will be selected.").latin1());
526 } 526 }
527 /* Iterate through all non-option arguments. 527 /* Iterate through all non-option arguments.
528 * Every non-option arg is a filename to open. 528 * Every non-option arg is a filename to open.
529 */ 529 */
530 for (i = 0; i < numArgs; ++i) { 530 for (i = 0; i < numArgs; ++i) {
531 curArg = args->arg(i); 531 curArg = args->arg(i);
532 PWM_ASSERT(curArg); 532 PWM_ASSERT(curArg);
533 if (savedCmd.minToTray) { 533 if (savedCmd.minToTray) {
534 PwMDoc *newDoc = createDoc(); 534 PwMDoc *newDoc = createDoc();
535 if (!newDoc->openDocUi(newDoc, 535 if (!newDoc->openDocUi(newDoc,
536 curArg, 536 curArg,
537 savedCmd.open_deeplocked)) { 537 savedCmd.open_deeplocked)) {
538 delete newDoc; 538 delete newDoc;
539 } 539 }
540 } else { 540 } else {
541 PwM *newInstance = createMainWnd(QString::null, 541 PwM *newInstance = createMainWnd(QString::null,
542 false, 542 false,
543 true, 543 true,
544 0, 544 0,
545 savedCmd.minimized); 545 savedCmd.minimized);
546 PwMDoc *newDoc = newInstance->openDoc(curArg, 546 PwMDoc *newDoc = newInstance->openDoc(curArg,
547 savedCmd.open_deeplocked); 547 savedCmd.open_deeplocked);
548 if (!newDoc) { 548 if (!newDoc) {
549 newInstance->setForceQuit(true); 549 newInstance->setForceQuit(true);
550 delete_and_null(newInstance); 550 delete_and_null(newInstance);
551 } 551 }
552 } 552 }
553 } 553 }
554 554
555 if (savedCmd.minToTray) { 555 if (savedCmd.minToTray) {
556 minimizeAllMainWnd(true); 556 minimizeAllMainWnd(true);
557 } else if (savedCmd.minimized) { 557 } else if (savedCmd.minimized) {
558 minimizeAllMainWnd(false); 558 minimizeAllMainWnd(false);
559 } 559 }
560 if (!savedCmd.skipSelfTest && initial) { 560 if (!savedCmd.skipSelfTest && initial) {
561 SelfTest::schedule(); 561 SelfTest::schedule();
562 } 562 }
563 args->clear(); 563 args->clear();
564#endif 564#endif
565} 565}
566 566
567void PwMInit::minimizeAllMainWnd(bool toTray) 567void PwMInit::minimizeAllMainWnd(bool toTray)
568{ 568{
569#ifndef PWM_EMBEDDED 569#ifndef PWM_EMBEDDED
570 if (!_mainWndList.size()) 570 if (!_mainWndList.size())
571 return; 571 return;
572#else 572#else
573 if (!_mainWndList.count()) 573 if (!_mainWndList.count())
574 return; 574 return;
575#endif 575#endif
576 const QValueList<PwM *> *ml = mainWndList(); 576 const QValueList<PwM *> *ml = mainWndList();
577#ifndef PWM_EMBEDDED 577#ifndef PWM_EMBEDDED
578 QValueList<PwM *>::const_iterator it = ml->begin(), 578 QValueList<PwM *>::const_iterator it = ml->begin(),
579 end = ml->end(); 579 end = ml->end();
580#else 580#else
581 QValueList<PwM *>::ConstIterator it = ml->begin(), 581 QValueList<PwM *>::ConstIterator it = ml->begin(),
582 end = ml->end(); 582 end = ml->end();
583#endif 583#endif
584 PwM *wnd; 584 PwM *wnd;
585 if (toTray && _tray) { 585 if (toTray && _tray) {
586 /* minimize to tray. 586 /* minimize to tray.
587 * close all mainWnd. 587 * close all mainWnd.
588 */ 588 */
589 while (it != end) { 589 while (it != end) {
590 wnd = *it; 590 wnd = *it;
591 wnd->setForceMinimizeToTray(true); 591 wnd->setForceMinimizeToTray(true);
592 wnd->close_slot(); 592 wnd->close_slot();
593 ++it; 593 ++it;
594 } 594 }
595 } else { 595 } else {
596 // normal minimize 596 // normal minimize
597 while (it != end) { 597 while (it != end) {
598 wnd = *it; 598 wnd = *it;
599 wnd->hide(); 599 wnd->hide();
600 wnd->showMinimized(); 600 wnd->showMinimized();
601 ++it; 601 ++it;
602 } 602 }
603 } 603 }
604} 604}
605 605
606#ifdef PWM_EMBEDDED 606#ifdef PWM_EMBEDDED
607 607
608#ifndef DESKTOP_VERSION 608#ifndef DESKTOP_VERSION
609 609
610PwMApplication::PwMApplication(int & argc, char ** argv) 610PwMApplication::PwMApplication(int & argc, char ** argv)
diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp
index cd816e5..8c4d9cc 100644
--- a/pwmanager/pwmanager/pwmview.cpp
+++ b/pwmanager/pwmanager/pwmview.cpp
@@ -16,385 +16,385 @@
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include "pwmview.h" 20#include "pwmview.h"
21#include "pwmexception.h" 21#include "pwmexception.h"
22#include "globalstuff.h" 22#include "globalstuff.h"
23#include "pwm.h" 23#include "pwm.h"
24#include "rencatwnd.h" 24#include "rencatwnd.h"
25#ifndef PWM_EMBEDDED 25#ifndef PWM_EMBEDDED
26#include "configuration.h" 26#include "configuration.h"
27#else 27#else
28#include "pwmprefs.h" 28#include "pwmprefs.h"
29#endif 29#endif
30#include "commentbox.h" 30#include "commentbox.h"
31 31
32#include <kmessagebox.h> 32#include <kmessagebox.h>
33#include <klocale.h> 33#include <klocale.h>
34 34
35#include <qlineedit.h> 35#include <qlineedit.h>
36#include <qpoint.h> 36#include <qpoint.h>
37#include <qapplication.h> 37#include <qapplication.h>
38#include <qlayout.h> 38#include <qlayout.h>
39 39
40//US ENH: wouldn't it be a good idea if we could use this consts everywhere else. 40//US ENH: wouldn't it be a good idea if we could use this consts everywhere else.
41//US ENH: for examle in listviewpwm.cpp 41//US ENH: for examle in listviewpwm.cpp
42//US ENH: Because of that I transfer them into the headerfile. 42//US ENH: Because of that I transfer them into the headerfile.
43/* 43/*
44 #define COLUMN_DESC 0 44 #define COLUMN_DESC 0
45 #define COLUMN_NAME 1 45 #define COLUMN_NAME 1
46 #define COLUMN_PW 2 46 #define COLUMN_PW 2
47 #define COLUMN_URL 3 47 #define COLUMN_URL 3
48 #define COLUMN_LAUNCHER 4 48 #define COLUMN_LAUNCHER 4
49*/ 49*/
50 50
51PwMView::PwMView(PwM *_mainClass, 51PwMView::PwMView(PwM *_mainClass,
52 QWidget *parent, PwMDoc *_doc, 52 QWidget *parent, PwMDoc *_doc,
53 const char *name) 53 const char *name)
54 : PwMViewStyle(parent, name) 54 : PwMViewStyle(parent, name)
55{ 55{
56 PWM_ASSERT(_mainClass); 56 PWM_ASSERT(_mainClass);
57 PWM_ASSERT(parent); 57 PWM_ASSERT(parent);
58 PWM_ASSERT(_doc); 58 PWM_ASSERT(_doc);
59 setView(this); 59 setView(this);
60 doc = _doc; 60 doc = _doc;
61 doc->setListViewPointer(this); 61 doc->setListViewPointer(this);
62 mainClass = _mainClass; 62 mainClass = _mainClass;
63 resize(_mainClass->size()); 63 resize(_mainClass->size());
64 initStyle(conf()->confWndMainViewStyle()); 64 initStyle(conf()->confWndMainViewStyle());
65 initCtxMenu(); 65 initCtxMenu();
66 doc->setCurrentView(this); 66 doc->setCurrentView(this);
67 connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView())); 67 connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView()));
68} 68}
69 69
70PwMView::~PwMView() 70PwMView::~PwMView()
71{ 71{
72} 72}
73 73
74void PwMView::initCtxMenu() 74void PwMView::initCtxMenu()
75{ 75{
76 ctxMenu = new QPopupMenu(this); 76 ctxMenu = new QPopupMenu(this);
77 ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot())); 77 ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot()));
78 ctxMenu->insertSeparator(); 78 ctxMenu->insertSeparator();
79 ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot())); 79 ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot()));
80 ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot())); 80 ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot()));
81 ctxMenu->insertSeparator(); 81 ctxMenu->insertSeparator();
82 ctxMenu->insertItem(i18n("copy password to clipboard"), 82 ctxMenu->insertItem(i18n("copy password to clipboard"),
83 this, SLOT(copyPwToClip())); 83 this, SLOT(copyPwToClip()));
84 ctxMenu->insertItem(i18n("copy username to clipboard"), 84 ctxMenu->insertItem(i18n("copy username to clipboard"),
85 this, SLOT(copyNameToClip())); 85 this, SLOT(copyNameToClip()));
86 ctxMenu->insertItem(i18n("copy description to clipboard"), 86 ctxMenu->insertItem(i18n("copy description to clipboard"),
87 this, SLOT(copyDescToClip())); 87 this, SLOT(copyDescToClip()));
88 ctxMenu->insertItem(i18n("copy url to clipboard"), 88 ctxMenu->insertItem(i18n("copy url to clipboard"),
89 this, SLOT(copyUrlToClip())); 89 this, SLOT(copyUrlToClip()));
90 ctxMenu->insertItem(i18n("copy launcher to clipboard"), 90 ctxMenu->insertItem(i18n("copy launcher to clipboard"),
91 this, SLOT(copyLauncherToClip())); 91 this, SLOT(copyLauncherToClip()));
92 ctxMenu->insertItem(i18n("copy comment to clipboard"), 92 ctxMenu->insertItem(i18n("copy comment to clipboard"),
93 this, SLOT(copyCommentToClip())); 93 this, SLOT(copyCommentToClip()));
94 ctxMenu->insertSeparator(); 94 ctxMenu->insertSeparator();
95 ctxMenu->insertItem(i18n("Execute \"Launcher\""), mainClass, 95 ctxMenu->insertItem(i18n("Execute \"Launcher\""), mainClass,
96 SLOT(execLauncher_slot())); 96 SLOT(execLauncher_slot()));
97 ctxMenu->insertItem(i18n("Go to \"URL\""), mainClass, 97 ctxMenu->insertItem(i18n("Go to \"URL\""), mainClass,
98 SLOT(goToURL_slot())); 98 SLOT(goToURL_slot()));
99} 99}
100 100
101void PwMView::resizeEvent(QResizeEvent *) 101void PwMView::resizeEvent(QResizeEvent *)
102{ 102{
103 resizeView(size()); 103 resizeView(size());
104} 104}
105 105
106void PwMView::refreshCommentTextEdit(QListViewItem *curItem) 106void PwMView::refreshCommentTextEdit(QListViewItem *curItem)
107{ 107{
108 PWM_ASSERT(commentBox); 108 PWM_ASSERT(commentBox);
109 if (!curItem) 109 if (!curItem)
110 return; 110 return;
111 string comment; 111 string comment;
112 PwMerror ret; 112 PwMerror ret;
113 ret = document()->getCommentByLvp(getCurrentCategory(), 113 ret = document()->getCommentByLvp(getCurrentCategory(),
114 lv->childCount() - lv->itemIndex(curItem) - 1, 114 lv->childCount() - lv->itemIndex(curItem) - 1,
115 &comment); 115 &comment);
116 if (ret == e_binEntry) { 116 if (ret == e_binEntry) {
117 commentBox->setContent(i18n("This is a binary entry.\n" 117 commentBox->setContent(i18n("This is a binary entry.\n"
118 "It is not a normal password-entry, as it contains " 118 "It is not a normal password-entry, as it contains "
119 "binary data, which PwManager can't display here.")); 119 "binary data, which PwManager can't display here."));
120 } else if (ret == e_normalEntry) { 120 } else if (ret == e_normalEntry) {
121 commentBox->setContent(comment.c_str()); 121 commentBox->setContent(comment.c_str());
122 } else { 122 } else {
123 BUG(); 123 BUG();
124 return; 124 return;
125 } 125 }
126 lv->ensureItemVisible(curItem); 126 lv->ensureItemVisible(curItem);
127} 127}
128 128
129void PwMView::keyReleaseEvent(QKeyEvent * /*e*/) 129void PwMView::keyReleaseEvent(QKeyEvent * /*e*/)
130{ 130{
131 refreshCommentTextEdit(lv->currentItem()); 131 refreshCommentTextEdit(lv->currentItem());
132} 132}
133 133
134bool PwMView::getCurEntryIndex(unsigned int *index) 134bool PwMView::getCurEntryIndex(unsigned int *index)
135{ 135{
136 QListViewItem *current = lv->currentItem(); 136 QListViewItem *current = lv->currentItem();
137 if (!current) 137 if (!current)
138 return false; 138 return false;
139 return getDocEntryIndex(index, current); 139 return getDocEntryIndex(index, current);
140} 140}
141 141
142bool PwMView::getDocEntryIndex(unsigned int *index, 142bool PwMView::getDocEntryIndex(unsigned int *index,
143 const QListViewItem *item) 143 const QListViewItem *item)
144{ 144{
145 vector<unsigned int> foundPositions; 145 vector<unsigned int> foundPositions;
146 PwMDataItem curItem; 146 PwMDataItem curItem;
147 curItem.desc = item->text(COLUMN_DESC).latin1(); 147 curItem.desc = item->text(COLUMN_DESC).latin1();
148 curItem.name = item->text(COLUMN_NAME).latin1(); 148 curItem.name = item->text(COLUMN_NAME).latin1();
149 document()->getCommentByLvp(getCurrentCategory(), 149 document()->getCommentByLvp(getCurrentCategory(),
150 lv->childCount() - lv->itemIndex(item) - 1, 150 lv->childCount() - lv->itemIndex(item) - 1,
151 &curItem.comment); 151 &curItem.comment);
152 curItem.url = item->text(COLUMN_URL).latin1(); 152 curItem.url = item->text(COLUMN_URL).latin1();
153 curItem.launcher = item->text(COLUMN_LAUNCHER).latin1(); 153 curItem.launcher = item->text(COLUMN_LAUNCHER).latin1();
154 document()->findEntry(getCurrentCategory(), curItem, SEARCH_IN_DESC | 154 document()->findEntry(getCurrentCategory(), curItem, SEARCH_IN_DESC |
155 SEARCH_IN_NAME | SEARCH_IN_COMMENT | SEARCH_IN_URL | 155 SEARCH_IN_NAME | SEARCH_IN_COMMENT | SEARCH_IN_URL |
156 SEARCH_IN_LAUNCHER, 156 SEARCH_IN_LAUNCHER,
157 &foundPositions, true); 157 &foundPositions, true);
158 if (foundPositions.size()) { 158 if (foundPositions.size()) {
159 *index = foundPositions[0]; 159 *index = foundPositions[0];
160 return true; 160 return true;
161 } 161 }
162 162
163 return false; 163 return false;
164} 164}
165 165
166void PwMView::handleToggle(QListViewItem *item) 166void PwMView::handleToggle(QListViewItem *item)
167{ 167{
168 PWM_ASSERT(doc); 168 PWM_ASSERT(doc);
169 if (!item) 169 if (!item)
170 return; 170 return;
171 QCheckListItem *clItem = (QCheckListItem *)item; 171 QCheckListItem *clItem = (QCheckListItem *)item;
172 QString curCat(getCurrentCategory()); 172 QString curCat(getCurrentCategory());
173 173
174 // find document position of this entry. 174 // find document position of this entry.
175 unsigned int curEntryDocIndex; 175 unsigned int curEntryDocIndex;
176 if (!getDocEntryIndex(&curEntryDocIndex, item)) 176 if (!getDocEntryIndex(&curEntryDocIndex, item))
177 return; 177 return;
178 178
179 // hack to refresh the comment, if only one item is present 179 // hack to refresh the comment, if only one item is present
180 if (lv->childCount() == 1) 180 if (lv->childCount() == 1)
181 refreshCommentTextEdit(lv->currentItem()); 181 refreshCommentTextEdit(lv->currentItem());
182 182
183 if (doc->isLocked(curCat, curEntryDocIndex) != clItem->isOn()) 183 if (doc->isLocked(curCat, curEntryDocIndex) != clItem->isOn())
184 return; // this is just a click somewhere on the entry 184 return; // this is just a click somewhere on the entry
185 if (doc->isDeepLocked()) { 185 if (doc->isDeepLocked()) {
186 PwMerror ret; 186 PwMerror ret;
187 ret = doc->deepLock(false); 187 ret = doc->deepLock(false);
188 if (ret != e_success) 188 if (ret != e_success)
189 clItem->setOn(false); 189 clItem->setOn(false);
190 return; 190 return;
191 } 191 }
192 doc->lockAt(curCat, curEntryDocIndex, !clItem->isOn()); 192 doc->lockAt(curCat, curEntryDocIndex, !clItem->isOn());
193} 193}
194 194
195void PwMView::handleRightClick(QListViewItem *item, const QPoint &point, int) 195void PwMView::handleRightClick(QListViewItem *item, const QPoint &point, int)
196{ 196{
197 if (!item) 197 if (!item)
198 return; 198 return;
199 ctxMenu->move(point); 199 ctxMenu->move(point);
200 /* don't use ctxMenu->exec() here, as it generates race conditions 200 /* don't use ctxMenu->exec() here, as it generates race conditions
201 * with the card interface code. Believe it or not. :) 201 * with the card interface code. Believe it or not. :)
202 */ 202 */
203 ctxMenu->show(); 203 ctxMenu->show();
204} 204}
205 205
206void PwMView::updateCategories() 206void PwMView::updateCategories()
207{ 207{
208 qDebug("PwMView::updateCategories() "); 208 //qDebug("PwMView::updateCategories() ");
209 QString oldSel(getCurrentCategory()); 209 QString oldSel(getCurrentCategory());
210 delAllCategories(); 210 delAllCategories();
211 QStringList catList; 211 QStringList catList;
212 document()->getCategoryList(&catList); 212 document()->getCategoryList(&catList);
213 catList.sort(); 213 catList.sort();
214#ifndef PWM_EMBEDDED 214#ifndef PWM_EMBEDDED
215 QStringList::iterator i = catList.begin(), 215 QStringList::iterator i = catList.begin(),
216 end = catList.end(); 216 end = catList.end();
217#else 217#else
218 QStringList::Iterator i = catList.begin(), 218 QStringList::Iterator i = catList.begin(),
219 end = catList.end(); 219 end = catList.end();
220#endif 220#endif
221 while (i != end) { 221 while (i != end) {
222 addCategory(*i); 222 addCategory(*i);
223 ++i; 223 ++i;
224 } 224 }
225 selectCategory(oldSel); 225 selectCategory(oldSel);
226} 226}
227 227
228void PwMView::shiftToView() 228void PwMView::shiftToView()
229{ 229{
230 int cX = lv->contentsX(); 230 int cX = lv->contentsX();
231 int cY = lv->contentsY(); 231 int cY = lv->contentsY();
232 commentBox->clear(); 232 commentBox->clear();
233 233
234 unsigned int catDocIndex; 234 unsigned int catDocIndex;
235 if (unlikely( 235 if (unlikely(
236 !(document()->findCategory(getCurrentCategory(), 236 !(document()->findCategory(getCurrentCategory(),
237 &catDocIndex)))) { 237 &catDocIndex)))) {
238 BUG(); 238 BUG();
239 } 239 }
240 240
241 // ensure all listViewPos are set 241 // ensure all listViewPos are set
242 doc->ensureLvp(); 242 doc->ensureLvp();
243 243
244 // clear all tmp-data vectors 244 // clear all tmp-data vectors
245 unsigned int i, entries = doc->numEntries(catDocIndex); 245 unsigned int i, entries = doc->numEntries(catDocIndex);
246 if (entries) { 246 if (entries) {
247 mainClass->setVirgin(false); 247 mainClass->setVirgin(false);
248 } 248 }
249 vector<PwMDataItem> tmpSorted; 249 vector<PwMDataItem> tmpSorted;
250 PwMDataItem currItem; 250 PwMDataItem currItem;
251 currItem.clear(); 251 currItem.clear();
252 tmpSorted.insert(tmpSorted.begin(), entries, currItem); 252 tmpSorted.insert(tmpSorted.begin(), entries, currItem);
253 253
254 // Sort items and store them in tempoary tmpSorted. 254 // Sort items and store them in tempoary tmpSorted.
255 for (i = 0; i < entries; ++i) { 255 for (i = 0; i < entries; ++i) {
256 doc->getEntry(catDocIndex, i, &currItem); 256 doc->getEntry(catDocIndex, i, &currItem);
257 //qDebug("PwMView::shiftToView: %s, %i", currItem.desc.c_str(), currItem.listViewPos); 257 //qDebug("PwMView::shiftToView: %s, %i", currItem.desc.c_str(), currItem.listViewPos);
258 tmpSorted[currItem.listViewPos] = currItem; 258 tmpSorted[currItem.listViewPos] = currItem;
259 } 259 }
260 260
261 // shift tempoary data to ListView. 261 // shift tempoary data to ListView.
262 tmpDisableSort(); 262 tmpDisableSort();
263 lv->clear(); 263 lv->clear();
264 264
265 //US ENH: adjust the headers of the table according the category texts 265 //US ENH: adjust the headers of the table according the category texts
266 { 266 {
267 PwMCategoryItem* catItem = doc->getCategoryEntry(catDocIndex); 267 PwMCategoryItem* catItem = doc->getCategoryEntry(catDocIndex);
268 // qDebug("PwMView::ShiftToView CAT: %i, %s", catDocIndex, catItem->name.c_str()); 268 // qDebug("PwMView::ShiftToView CAT: %i, %s", catDocIndex, catItem->name.c_str());
269 lv->setColumnText(COLUMN_DESC, catItem->desc_text.c_str()); 269 lv->setColumnText(COLUMN_DESC, catItem->desc_text.c_str());
270 lv->setColumnText(COLUMN_NAME, catItem->name_text.c_str()); 270 lv->setColumnText(COLUMN_NAME, catItem->name_text.c_str());
271 lv->setColumnText(COLUMN_PW, catItem->pw_text.c_str()); 271 lv->setColumnText(COLUMN_PW, catItem->pw_text.c_str());
272 } 272 }
273 273
274 QCheckListItem *newItem; 274 QCheckListItem *newItem;
275 vector<PwMDataItem>::iterator it = tmpSorted.begin(), 275 vector<PwMDataItem>::iterator it = tmpSorted.begin(),
276 end = tmpSorted.end(); 276 end = tmpSorted.end();
277 while (it != end) { 277 while (it != end) {
278 newItem = new ListViewItemPwM(lv); 278 newItem = new ListViewItemPwM(lv);
279 newItem->setText(COLUMN_DESC, (*it).desc.c_str()); 279 newItem->setText(COLUMN_DESC, (*it).desc.c_str());
280 if ((*it).binary) { 280 if ((*it).binary) {
281 newItem->setText(COLUMN_NAME, ""); 281 newItem->setText(COLUMN_NAME, "");
282 newItem->setText(COLUMN_PW, i18n("<BINARY ENTRY>")); 282 newItem->setText(COLUMN_PW, i18n("<BINARY ENTRY>"));
283 newItem->setText(COLUMN_URL, ""); 283 newItem->setText(COLUMN_URL, "");
284 newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str()); 284 newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str());
285 } else { 285 } else {
286 newItem->setText(COLUMN_NAME, (*it).name.c_str()); 286 newItem->setText(COLUMN_NAME, (*it).name.c_str());
287 if ((*it).lockStat) { 287 if ((*it).lockStat) {
288 newItem->setText(COLUMN_PW, QString((*it).pw.c_str()) 288 newItem->setText(COLUMN_PW, QString((*it).pw.c_str())
289 + " " 289 + " "
290 + i18n("To unlock click the icon on the left.")); 290 + i18n("To unlock click the icon on the left."));
291 } else { 291 } else {
292 newItem->setText(COLUMN_PW, (*it).pw.c_str()); 292 newItem->setText(COLUMN_PW, (*it).pw.c_str());
293 } 293 }
294 newItem->setText(COLUMN_URL, (*it).url.c_str()); 294 newItem->setText(COLUMN_URL, (*it).url.c_str());
295 newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str()); 295 newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str());
296 } 296 }
297 newItem->setOn(!((*it).lockStat)); 297 newItem->setOn(!((*it).lockStat));
298 lv->insertItem(newItem); 298 lv->insertItem(newItem);
299 ++it; 299 ++it;
300 } 300 }
301 tmpReEnableSort(); 301 tmpReEnableSort();
302 302
303 if (cY || cX) 303 if (cY || cX)
304 lv->setContentsPos(cX, cY); 304 lv->setContentsPos(cX, cY);
305} 305}
306 306
307void PwMView::reorgLp() 307void PwMView::reorgLp()
308{ 308{
309 if (!lv->childCount()) 309 if (!lv->childCount())
310 return; 310 return;
311 PWM_ASSERT(doc); 311 PWM_ASSERT(doc);
312 PWM_ASSERT(!doc->isDocEmpty()); 312 PWM_ASSERT(!doc->isDocEmpty());
313 QListViewItem *currItem; 313 QListViewItem *currItem;
314 vector<unsigned int> foundPos; 314 vector<unsigned int> foundPos;
315 /* This searchIn _should_ be: 315 /* This searchIn _should_ be:
316 *const unsigned int searchIn = SEARCH_IN_DESC; 316 *const unsigned int searchIn = SEARCH_IN_DESC;
317 * But we want backward compatibility (see comment in PwMDoc::addEntry()). 317 * But we want backward compatibility (see comment in PwMDoc::addEntry()).
318 * So we need to search again, if we don't find the entry. (see below) 318 * So we need to search again, if we don't find the entry. (see below)
319 */ 319 */
320 const unsigned int searchIn = SEARCH_IN_DESC | SEARCH_IN_NAME | 320 const unsigned int searchIn = SEARCH_IN_DESC | SEARCH_IN_NAME |
321 SEARCH_IN_URL | SEARCH_IN_LAUNCHER; 321 SEARCH_IN_URL | SEARCH_IN_LAUNCHER;
322 QString curCat(getCurrentCategory()); 322 QString curCat(getCurrentCategory());
323 PwMDataItem findThis; 323 PwMDataItem findThis;
324 unsigned int i, cnt = lv->childCount(); 324 unsigned int i, cnt = lv->childCount();
325 for (i = 0; i < cnt; ++i) { 325 for (i = 0; i < cnt; ++i) {
326 currItem = lv->itemAtIndex(i); 326 currItem = lv->itemAtIndex(i);
327 findThis.desc = currItem->text(COLUMN_DESC).latin1(); 327 findThis.desc = currItem->text(COLUMN_DESC).latin1();
328 findThis.name = currItem->text(COLUMN_NAME).latin1(); 328 findThis.name = currItem->text(COLUMN_NAME).latin1();
329 findThis.url = currItem->text(COLUMN_URL).latin1(); 329 findThis.url = currItem->text(COLUMN_URL).latin1();
330 findThis.launcher = currItem->text(COLUMN_LAUNCHER).latin1(); 330 findThis.launcher = currItem->text(COLUMN_LAUNCHER).latin1();
331 doc->findEntry(curCat, findThis, searchIn, 331 doc->findEntry(curCat, findThis, searchIn,
332 &foundPos, true); 332 &foundPos, true);
333 if (!foundPos.size()) { 333 if (!foundPos.size()) {
334 /* Did not find the entry. We seem to have a binary 334 /* Did not find the entry. We seem to have a binary
335 * entry here (pray for it!). So search again with 335 * entry here (pray for it!). So search again with
336 * the "correct" searchIn flags. 336 * the "correct" searchIn flags.
337 */ 337 */
338 const unsigned int searchIn2 = SEARCH_IN_DESC; 338 const unsigned int searchIn2 = SEARCH_IN_DESC;
339 doc->findEntry(curCat, findThis, searchIn2, 339 doc->findEntry(curCat, findThis, searchIn2,
340 &foundPos, true); 340 &foundPos, true);
341 if (unlikely(!foundPos.size())) { 341 if (unlikely(!foundPos.size())) {
342 BUG(); 342 BUG();
343 continue; 343 continue;
344 } 344 }
345 /* We assert that it's a binary entry, now. 345 /* We assert that it's a binary entry, now.
346 * No chance to efficiently verify it here. 346 * No chance to efficiently verify it here.
347 */ 347 */
348 } 348 }
349 doc->setListViewPos(curCat, foundPos[0], cnt - i - 1); 349 doc->setListViewPos(curCat, foundPos[0], cnt - i - 1);
350 } 350 }
351} 351}
352 352
353void PwMView::selAt(int index) 353void PwMView::selAt(int index)
354{ 354{
355 QListViewItem *item = lv->itemAtIndex(index); 355 QListViewItem *item = lv->itemAtIndex(index);
356 if (!item) 356 if (!item)
357 return; 357 return;
358 lv->setCurrentItem(item); 358 lv->setCurrentItem(item);
359 lv->ensureItemVisible(item); 359 lv->ensureItemVisible(item);
360} 360}
361 361
362void PwMView::renCatButton_slot() 362void PwMView::renCatButton_slot()
363{ 363{
364 if (doc->isDeepLocked()) 364 if (doc->isDeepLocked())
365 return; 365 return;
366 RenCatWnd wnd(this); 366 RenCatWnd wnd(this);
367 if (wnd.exec() == 1) { 367 if (wnd.exec() == 1) {
368 QString newName(wnd.getNewName()); 368 QString newName(wnd.getNewName());
369 if (newName == "") 369 if (newName == "")
370 return; 370 return;
371 document()->renameCategory(getCurrentCategory(), 371 document()->renameCategory(getCurrentCategory(),
372 newName); 372 newName);
373 } 373 }
374} 374}
375 375
376void PwMView::delCatButton_slot() 376void PwMView::delCatButton_slot()
377{ 377{
378 if (doc->isDeepLocked()) 378 if (doc->isDeepLocked())
379 return; 379 return;
380 if (numCategories() <= 1) { 380 if (numCategories() <= 1) {
381 mainClass->showStatMsg(i18n("Can't remove the last category.")); 381 mainClass->showStatMsg(i18n("Can't remove the last category."));
382 return; 382 return;
383 } 383 }
384 if (KMessageBox::questionYesNo(this, 384 if (KMessageBox::questionYesNo(this,
385 i18n("Do you really want to\n" 385 i18n("Do you really want to\n"
386 "delete the selected\n" 386 "delete the selected\n"
387 "category? All password-\n" 387 "category? All password-\n"
388 "entries will be lost in\n" 388 "entries will be lost in\n"
389 "this category!\n"), 389 "this category!\n"),
390 i18n("Delete category?")) 390 i18n("Delete category?"))
391 == KMessageBox::No) { 391 == KMessageBox::No) {
392 return; 392 return;
393 } 393 }
394 document()->delCategory(getCurrentCategory()); 394 document()->delCategory(getCurrentCategory());
395} 395}
396 396
397void PwMView::copyPwToClip() 397void PwMView::copyPwToClip()
398{ 398{
399 if (doc->isDeepLocked()) 399 if (doc->isDeepLocked())
400 return; 400 return;