-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 8 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 6 | ||||
-rw-r--r-- | libkcal/recurrence.cpp | 12 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 8 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwminit.cpp | 8 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmview.cpp | 2 |
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 | |||
@@ -1191,102 +1191,110 @@ | |||
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 | |||
@@ -48,246 +48,246 @@ | |||
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 | ||
70 | class KOListViewWhatsThis :public QWhatsThis | 70 | class KOListViewWhatsThis :public QWhatsThis |
71 | { | 71 | { |
72 | public: | 72 | public: |
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 | ||
75 | protected: | 75 | protected: |
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 | } |
80 | private: | 80 | private: |
81 | QWidget* _wid; | 81 | QWidget* _wid; |
82 | KOListView * _view; | 82 | KOListView * _view; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | 85 | ||
86 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 86 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
87 | { | 87 | { |
88 | mItem = item; | 88 | mItem = item; |
89 | mDate = date; | 89 | mDate = date; |
90 | } | 90 | } |
91 | 91 | ||
92 | ListItemVisitor::~ListItemVisitor() | 92 | ListItemVisitor::~ListItemVisitor() |
93 | { | 93 | { |
94 | } | 94 | } |
95 | 95 | ||
96 | bool ListItemVisitor::visit(Event *e) | 96 | bool 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 | ||
142 | bool ListItemVisitor::visit(Todo *t) | 142 | bool 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 | ||
191 | bool ListItemVisitor::visit(Journal * j) | 191 | bool 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 | ||
218 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 218 | KOListView::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 | /* |
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp index 5181eaf..8a175c9 100644 --- a/libkcal/recurrence.cpp +++ b/libkcal/recurrence.cpp | |||
@@ -98,211 +98,217 @@ Recurrence::~Recurrence() | |||
98 | 98 | ||
99 | 99 | ||
100 | bool Recurrence::operator==( const Recurrence& r2 ) const | 100 | bool 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 | /* |
178 | bool Recurrence::compareLists( const QPtrList<int> &l1 ,const QPtrList<int> &l2) | 178 | bool 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 | */ |
192 | QString Recurrence::recurrenceText() const | 192 | QString 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 | ||
216 | void Recurrence::setCompatVersion(int version) | 222 | void Recurrence::setCompatVersion(int version) |
217 | { | 223 | { |
218 | mCompatVersion = version ? version : INT_MAX; | 224 | mCompatVersion = version ? version : INT_MAX; |
219 | } | 225 | } |
220 | 226 | ||
221 | ushort Recurrence::doesRecur() const | 227 | ushort Recurrence::doesRecur() const |
222 | { | 228 | { |
223 | return recurs; | 229 | return recurs; |
224 | } | 230 | } |
225 | 231 | ||
226 | bool Recurrence::recursOnPure(const QDate &qd) const | 232 | bool 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 | ||
254 | bool Recurrence::recursAtPure(const QDateTime &dt) const | 260 | bool 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 | ||
287 | QDate Recurrence::endDate() const | 293 | QDate 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: |
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 | |||
@@ -104,193 +104,193 @@ enum { | |||
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 |
112 | enum { | 112 | enum { |
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 |
119 | enum { | 119 | enum { |
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) |
126 | enum { | 126 | enum { |
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) |
135 | enum { | 135 | enum { |
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 |
146 | enum { | 146 | enum { |
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 |
156 | enum { | 156 | enum { |
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 | ||
172 | PwM::PwM(PwMInit *_init, PwMDoc *doc, | 172 | PwM::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 | ||
198 | PwM::~PwM() | 198 | PwM::~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 | ||
212 | void PwM::initMenubar() | 212 | void 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); |
@@ -806,201 +806,201 @@ void PwM::deletePwd_slot() | |||
806 | void PwM::changeMasterPwd_slot() | 806 | void PwM::changeMasterPwd_slot() |
807 | { | 807 | { |
808 | PWM_ASSERT(curDoc()); | 808 | PWM_ASSERT(curDoc()); |
809 | curDoc()->changeCurrentPw(); | 809 | curDoc()->changeCurrentPw(); |
810 | } | 810 | } |
811 | 811 | ||
812 | void PwM::lockWnd_slot() | 812 | void 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 | ||
818 | void PwM::deepLockWnd_slot() | 818 | void PwM::deepLockWnd_slot() |
819 | { | 819 | { |
820 | PWM_ASSERT(curDoc()); | 820 | PWM_ASSERT(curDoc()); |
821 | curDoc()->deepLock(); | 821 | curDoc()->deepLock(); |
822 | } | 822 | } |
823 | 823 | ||
824 | void PwM::unlockWnd_slot() | 824 | void 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 | ||
830 | void PwM::config_slot() | 830 | void 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 | ||
895 | void PwM::activateMpButton(bool activate) | 895 | void 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 | ||
900 | void PwM::closeEvent(QCloseEvent *e) | 900 | void 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 | ||
908 | void PwM::docClosed(PwMDoc *doc) | 908 | void 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 | ||
916 | void PwM::find_slot() | 916 | void 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 | ||
929 | void PwM::exportToText() | 929 | void 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 | ||
961 | bool PwM::importFromText() | 961 | bool 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")); |
@@ -1291,193 +1291,193 @@ void PwM::print_slot() | |||
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 | ||
1300 | void PwM::genNewCard_slot() | 1300 | void 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 | ||
1307 | void PwM::eraseCard_slot() | 1307 | void 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 | ||
1314 | void PwM::readCardId_slot() | 1314 | void 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 | ||
1321 | void PwM::makeCardBackup_slot() | 1321 | void 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 | ||
1328 | void PwM::replayCardBackup_slot() | 1328 | void 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 | ||
1335 | void PwM::execLauncher_slot() | 1335 | void 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 | ||
1351 | void PwM::goToURL_slot() | 1351 | void 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 | ||
1367 | void PwM::copyToClipboard(const QString &s) | 1367 | void 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 | ||
1382 | void PwM::showStatMsg(const QString &msg) | 1382 | void 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 | ||
1392 | void PwM::focusInEvent(QFocusEvent *e) | 1392 | void 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 | ||
1404 | void PwM::category_slot() | 1404 | void 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 | ||
1463 | void PwM::whatsnew_slot() | 1463 | void 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 | ||
1468 | void PwM::showLicense_slot() | 1468 | void PwM::showLicense_slot() |
1469 | { | 1469 | { |
1470 | KApplication::showLicence(); | 1470 | KApplication::showLicence(); |
1471 | } | 1471 | } |
1472 | 1472 | ||
1473 | void PwM::faq_slot() | 1473 | void 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 | ||
1478 | void PwM::syncHowTo_slot() | 1478 | void 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 | ||
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,254 +1,254 @@ | |||
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 | ||
57 | static PwMInit *sig_init_pointer; | 57 | static PwMInit *sig_init_pointer; |
58 | #ifdef _WIN32_ | 58 | #ifdef _WIN32_ |
59 | static void sig_handler(int signum) | 59 | static void sig_handler(int signum) |
60 | #else | 60 | #else |
61 | static NOREGPARM void sig_handler(int signum) | 61 | static 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 | ||
77 | PwMInit::PwMInit(PwMApplication *_app) | 77 | PwMInit::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 | ||
89 | PwMInit::~PwMInit() | 89 | PwMInit::~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 | ||
134 | void PwMInit::initializeApp() | 134 | void 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 | ||
186 | void PwMInit::shutdownApp(int exitStatus) | 186 | void 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 | ||
208 | void PwMInit::initPosixSignalHandler() | 208 | void 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 | ||
214 | void PwMInit::initDCOP() | 214 | void 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 | ||
223 | void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload) | 223 | void 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 | ||
250 | void PwMInit::initKeycard() | 250 | void 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); |
@@ -306,209 +306,209 @@ PwM * PwMInit::createMainWnd(const QString &loadFile, | |||
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 | ||
348 | PwMDoc * PwMInit::createDoc() | 348 | PwMDoc * 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 | ||
366 | void PwMInit::mainWndClosed(PwM *wnd) | 366 | void 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 |
374 | again: | 374 | again: |
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(); |
459 | out_success: | 459 | out_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 | ||
490 | void PwMInit::trayIconClosed(PwMTray *tray) | 490 | void 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 | ||
508 | void PwMInit::handleCmdLineArgs(bool initial) | 508 | void 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; |
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 | |||
@@ -112,193 +112,193 @@ void PwMView::refreshCommentTextEdit(QListViewItem *curItem) | |||
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 | ||
129 | void PwMView::keyReleaseEvent(QKeyEvent * /*e*/) | 129 | void PwMView::keyReleaseEvent(QKeyEvent * /*e*/) |
130 | { | 130 | { |
131 | refreshCommentTextEdit(lv->currentItem()); | 131 | refreshCommentTextEdit(lv->currentItem()); |
132 | } | 132 | } |
133 | 133 | ||
134 | bool PwMView::getCurEntryIndex(unsigned int *index) | 134 | bool 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 | ||
142 | bool PwMView::getDocEntryIndex(unsigned int *index, | 142 | bool 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 | ||
166 | void PwMView::handleToggle(QListViewItem *item) | 166 | void 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 | ||
195 | void PwMView::handleRightClick(QListViewItem *item, const QPoint &point, int) | 195 | void 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 | ||
206 | void PwMView::updateCategories() | 206 | void 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 | ||
228 | void PwMView::shiftToView() | 228 | void 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); |