summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-10-22 18:48:35 (UTC)
committer ulf69 <ulf69>2004-10-22 18:48:35 (UTC)
commita5274f27dc71e1a0ffae73f32f84f4dd013b4b76 (patch) (unidiff)
tree5c2e3e105fa9df8999752a314455d0f424bf474b
parent163b74a23d102074fc0adefddba5b4fa9d4dd2a5 (diff)
downloadkdepimpi-a5274f27dc71e1a0ffae73f32f84f4dd013b4b76.zip
kdepimpi-a5274f27dc71e1a0ffae73f32f84f4dd013b4b76.tar.gz
kdepimpi-a5274f27dc71e1a0ffae73f32f84f4dd013b4b76.tar.bz2
added csv import/export
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/csv.cpp428
-rw-r--r--pwmanager/pwmanager/csv.h91
-rw-r--r--pwmanager/pwmanager/pwm.cpp85
-rw-r--r--pwmanager/pwmanager/pwm.h4
-rw-r--r--pwmanager/pwmanager/pwmanagerE.pro2
5 files changed, 608 insertions, 2 deletions
diff --git a/pwmanager/pwmanager/csv.cpp b/pwmanager/pwmanager/csv.cpp
new file mode 100644
index 0000000..194edf2
--- a/dev/null
+++ b/pwmanager/pwmanager/csv.cpp
@@ -0,0 +1,428 @@
1/***************************************************************************
2 * *
3 * copyright (C) 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de *
5 * *
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 *
8 * as published by the Free Software Foundation. *
9 * *
10 ***************************************************************************/
11
12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde
16 * The original file version was 1.2
17 * $Id$
18 **************************************************************************/
19
20#include "csv.h"
21#include "pwmdoc.h"
22#include "pwmexception.h"
23
24#include <kmessagebox.h>
25#include <klocale.h>
26
27 #define MAX_CSV_FILE_SIZE(50 * 1024 * 1024) // bytes
28
29
30Csv::Csv(QWidget *_parent)
31 : parent (_parent)
32{
33}
34
35Csv::~Csv()
36{
37}
38
39bool Csv::importData(const QString &filepath,
40 PwMDoc *doc)
41{
42 bool ret = true;
43 QByteArray d;
44 QFile f(filepath);
45 if (!f.open(IO_ReadOnly)) {
46 KMessageBox::error(parent,
47 i18n("Could not open file.\n"
48 "Does the file exist?"),
49 i18n("Open error."));
50 ret = false;
51 goto out;
52 }
53 if (f.size() > MAX_CSV_FILE_SIZE) {
54 KMessageBox::error(parent,
55 i18n("File too big.\nMaximum file size is 1 Byte.", "File too big.\nMaximum file size is %n Bytes.", MAX_CSV_FILE_SIZE),
56 i18n("File too big."));
57 ret = false;
58 goto out_close;
59 }
60 d = f.readAll();
61 if (d.isEmpty()) {
62 KMessageBox::error(parent,
63 i18n("Could not read file or file empty."),
64 i18n("Reading failed."));
65 ret = false;
66 goto out_close;
67 }
68 if (!doImport(d, doc)) {
69 KMessageBox::error(parent,
70 i18n("Import failed.\n"
71 "Corrupt CSV data format."),
72 i18n("File corrupt."));
73 ret = false;
74 goto out_close;
75 }
76
77out_close:
78 f.close();
79out:
80 return ret;
81}
82
83bool Csv::doImport(const QByteArray &d,
84 PwMDoc *doc)
85{
86 PwMDataItem di;
87 //US ENH: initialize all members:
88 di.clear();
89
90 int refIndex = 0;
91 int ret;
92 QCString s, curCat;
93 int fieldIndex = 0;
94 bool inRecord = false;
95 /* fieldIndex is a reference count to see which
96 * value we are attaching to di.
97 * Valid counts are:
98 * 0 -> category
99 * 1 -> desc
100 * 2 -> name
101 * 3 -> pw
102 * 4 -> url
103 * 5 -> launcher
104 * 6 -> comment
105 */
106
107 while (1) {
108 ret = nextField(&s, d, inRecord, &refIndex);
109 switch (ret) {
110 case 0:
111 // successfully got next field.
112 inRecord = true;
113 switch (fieldIndex) {
114 case 0: // category
115 if (s.isEmpty()) {
116 /* This is special case. It's the category
117 * list terminating empty field.
118 */
119 ++fieldIndex;
120 } else
121 curCat = s;
122 break;
123 case 1:// desc
124 di.desc = s;
125 ++fieldIndex;
126 break;
127 case 2: // name
128 di.name = s;
129 ++fieldIndex;
130 break;
131 case 3: // pw
132 di.pw = s;
133 ++fieldIndex;
134 break;
135 case 4: // url
136 di.url = s;
137 ++fieldIndex;
138 break;
139 case 5: // launcher
140 di.launcher = s;
141 ++fieldIndex;
142 break;
143 case 6: // comment
144 di.comment = s;
145 ++fieldIndex;
146 break;
147 default:
148 /* Too many fields in a record.
149 * We simply throw it away.
150 */
151 break;
152 }
153 break;
154 case 1:
155 // record complete.
156 if (fieldIndex == 6)
157 di.comment = s;
158 inRecord = false;
159 fieldIndex = 0;
160 doc->addEntry(curCat, &di, true);
161 //US ENH: clear di for the next row
162 di.clear();
163 break;
164 case 2:
165 // data completely parsed.
166 doc->flagDirty();
167 return true;
168 case -1:
169 // parse error
170 doc->flagDirty();
171 return false;
172 }
173 }
174 BUG();
175 return false;
176}
177
178int Csv::nextField(QCString *ret,
179 const QByteArray &in,
180 bool inRecord,
181 int *_refIndex)
182{
183 int rv = -2;
184 char c;
185 bool inField = false;
186 bool isQuoted = false;
187 bool searchingTerminator = false;
188 int refIndex;
189 int inSize = static_cast<int>(in.size());
190 ret->truncate(0);
191
192 for (refIndex = *_refIndex; refIndex < inSize; ++refIndex) {
193 c = in.at(refIndex);
194 if (!inField) {
195 // we have to search the field beginning, now.
196 switch (c) {
197 case ' ': // space
198 case '': // tab
199 // hm, still not the beginning. Go on..
200 break;
201 case '\r':
202 case '\n':
203 if (inRecord) {
204 /* This is the end of the last field in
205 * the record.
206 */
207 PWM_ASSERT(ret->isEmpty());
208 rv = 1; // record end
209 goto out;
210 } else {
211 // hm, still not the beginning. Go on..
212 break;
213 }
214 case ',':
215 // Oh, an empty field. How sad.
216 PWM_ASSERT(ret->isEmpty());
217 rv = 0; // field end
218 goto out;
219 case '\"':
220 // this is the quoted beginning.
221 inField = true;
222 isQuoted = true;
223 if (refIndex + 1 >= inSize)
224 goto unexp_eof;
225 break;
226 default:
227 // this is the unquoted beginning.
228 inField = true;
229 isQuoted = false;
230 *ret += c;
231 break;
232 }
233 } else {
234 // we are in the field now. Search the end.
235 if (isQuoted) {
236 if (searchingTerminator) {
237 switch (c) {
238 case '\r':
239 case '\n':
240 rv = 1; // record end
241 goto out;
242 case ',':
243 // found it.
244 rv = 0; // field end
245 goto out;
246 default:
247 // go on.
248 continue;
249 }
250 }
251 switch (c) {
252 case '\"':
253 /* check if this is the end of the
254 * entry, or just an inline escaped quote.
255 */
256 char next;
257 if (refIndex + 1 >= inSize) {
258 // This is the last char, so it's the end.
259 rv = 2; // data end
260 goto out;
261 }
262 next = in.at(refIndex + 1);
263 switch (next) {
264 case '\"':
265 // This is an escaped double quote.
266 // So skip next iteration.
267 refIndex += 1;
268 *ret += c;
269 break;
270 default:
271 /* end of field.
272 * We have to search the comma (or newline...),
273 * which officially terminates the entry.
274 */
275 searchingTerminator = true;
276 break;
277 }
278 break;
279 default:
280 // nothing special about the char. Go on!
281 *ret += c;
282 break;
283 }
284 } else {
285 switch (c) {
286 case '\"':
287 // This is not allowed here.
288 return -1; // parser error
289 case '\r':
290 case '\n':
291 rv = 1; // record end
292 goto out;
293 case ',':
294 rv = 0; // field end
295 goto out;
296 default:
297 // nothing special about the char. Go on!
298 *ret += c;
299 break;
300 }
301 }
302 }
303 }
304 // we are at the end of the stream, now!
305 if (searchingTerminator) {
306 /* Ok, there's no terminating comma (or newline...),
307 * because we are at the end. That's perfectly fine.
308 */
309 PWM_ASSERT(inField);
310 rv = 2; // data end
311 goto out;
312 }
313 if (!isQuoted && inField) {
314 // That's the end of the last unquoted field.
315 rv = 2; // data end
316 goto out;
317 }
318 if (!inField) {
319 // This is expected EOF
320 rv = 2; // data end
321 goto out;
322 }
323
324unexp_eof:
325 printDebug("unexpected EOF :(");
326 return -1; // parser error
327
328out:
329 if (!isQuoted)
330 *ret = ret->stripWhiteSpace();
331 *_refIndex = refIndex + 1;
332 return rv;
333}
334
335bool Csv::exportData(const QString &filepath,
336 PwMDoc *doc)
337{
338 PWM_ASSERT(!doc->isDocEmpty());
339 bool ret = true;
340 if (QFile::exists(filepath)) {
341 int ret;
342 ret = KMessageBox::questionYesNo(parent,
343 i18n("This file does already exist.\n"
344 "Do you want to overwrite it?"),
345 i18n("Overwrite file?"));
346 if (ret == KMessageBox::No)
347 return false;
348 if (!QFile::remove(filepath)) {
349 KMessageBox::error(parent,
350 i18n("Could not delete the old file."),
351 i18n("Delete error."));
352 return false;
353 }
354 }
355 QFile f(filepath);
356 if (!f.open(IO_ReadWrite)) {
357 KMessageBox::error(parent,
358 i18n("Could not open file for writing."),
359 i18n("Open error."));
360 ret = false;
361 goto out;
362 }
363 doc->unlockAll_tempoary();
364 if (!doExport(f, doc))
365 ret = false;
366 doc->unlockAll_tempoary(true);
367 f.close();
368out:
369 return ret;
370}
371
372bool Csv::doExport(QFile &f,
373 PwMDoc *doc)
374{
375 unsigned int numCat = doc->numCategories();
376 unsigned int numEntr;
377 unsigned int i, j;
378 PwMDataItem d;
379 QCString s, catName;
380 QByteArray b;
381
382 for (i = 0; i < numCat; ++i) {
383 numEntr = doc->numEntries(i);
384 catName = newField(doc->getCategory(i)->c_str());
385 for (j = 0; j < numEntr; ++j) {
386 doc->getEntry(i, j, &d);
387 s = catName;
388 s += ",,";
389 s += newField(d.desc.c_str());
390 s += ",";
391 s += newField(d.name.c_str());
392 s += ",";
393 s += newField(d.pw.c_str());
394 s += ",";
395 s += newField(d.url.c_str());
396 s += ",";
397 s += newField(d.launcher.c_str());
398 s += ",";
399 s += newField(d.comment.c_str());
400 s += "\r\n";
401 b = s;
402 // remove \0 termination
403#ifndef PWM_EMBEDDED
404 b.resize(b.size() - 1, QGArray::SpeedOptim);
405#else
406 b.resize(b.size() - 1);
407#endif
408 if (!f.writeBlock(b))
409 return false;
410 }
411 }
412 return true;
413}
414
415QCString Csv::newField(QCString s)
416{
417 if (s.isEmpty())
418 return QCString();
419 QCString ret("\"");
420#ifndef PWM_EMBEDDED
421 s.replace('\"', "\"\"");
422#else
423 s.replace(QRegExp("\""), "\"\"");
424#endif
425 ret += s;
426 ret += "\"";
427 return ret;
428}
diff --git a/pwmanager/pwmanager/csv.h b/pwmanager/pwmanager/csv.h
new file mode 100644
index 0000000..6f3c1e1
--- a/dev/null
+++ b/pwmanager/pwmanager/csv.h
@@ -0,0 +1,91 @@
1/***************************************************************************
2 * *
3 * copyright (C) 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de *
5 * *
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 *
8 * as published by the Free Software Foundation. *
9 * *
10 ***************************************************************************/
11
12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde
16 * The original file version was 1.2
17 * $Id$
18 **************************************************************************/
19
20
21#ifndef __PWMANAGER_CSV_H
22#define __PWMANAGER_CSV_H
23
24#include <qcstring.h>
25#include <qfile.h>
26
27
28class PwMDoc;
29class QString;
30class QWidget;
31
32/** class for CSV (Comma Separated Value) export and import.
33 *
34 * http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm
35 * http://en.wikipedia.org/wiki/Comma-separated_values
36 *
37 * There are two types of CSV output we can produce.
38 * One with Category support (recommended):
39 * "Category 1",, "Desc 1", "Username 1", "Password 1", "URL 1", "Launcher 1", "Comment 1"
40 * "Category 1",, "Desc 2", "Username 2", "Password 2", "URL 2", "Launcher 2", "Comment 2"
41 * ...
42 * The empty "" is neccessary, because in future versions we will
43 * support nested Categories. We want to be future compatible, now.
44 *
45 * And one without Category support:
46 *FIXME: it's not implemented, yet. ;)
47 * "Desc 1", "Username 1", "Password 1", "URL 1", "Launcher 1", "Comment 1"
48 * "Desc 2", "Username 2", "Password 2", "URL 2", "Launcher 2", "Comment 2"
49 * ...
50 *
51 */
52class Csv
53{
54public:
55 Csv(QWidget *_parent);
56 ~Csv();
57
58 /** import data from "filepath" into "doc" */
59 bool importData(const QString &filepath,
60 PwMDoc *doc);
61 /** export data from "doc" to "filepath" */
62 bool exportData(const QString &filepath,
63 PwMDoc *doc);
64
65protected:
66 /** do the import process. */
67 bool doImport(const QByteArray &d,
68 PwMDoc *doc);
69 /** parse for the next field.
70 * @return Return values are:
71 * 0 -> successfully got the next field.
72 * 1 -> record end.
73 * 2 -> data end.
74 * -1 -> parser error.
75 */
76 int nextField(QCString *ret,
77 const QByteArray &in,
78 bool inRecord,
79 int *_refIndex);
80 /** do the export process. */
81 bool doExport(QFile &f,
82 PwMDoc *doc);
83 /** generate a new data field string. */
84 QCString newField(QCString s);
85
86protected:
87 /** current parent widget. */
88 QWidget *parent;
89};
90
91#endif // __PWMANAGER_CSV_H
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index 66d26d6..ac0c978 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -1,1373 +1,1454 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2003, 2004 by Michael Buesch * 3 * copyright (C) 2003, 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 <klocale.h> 20#include <klocale.h>
21#include <klistview.h> 21#include <klistview.h>
22#include <ktoolbar.h> 22#include <ktoolbar.h>
23#include <kfiledialog.h> 23#include <kfiledialog.h>
24#include <kiconloader.h> 24#include <kiconloader.h>
25#include <kmessagebox.h> 25#include <kmessagebox.h>
26 26
27#ifndef PWM_EMBEDDED 27#ifndef PWM_EMBEDDED
28#include <kmenubar.h> 28#include <kmenubar.h>
29#include <kstatusbar.h> 29#include <kstatusbar.h>
30#include <dcopclient.h> 30#include <dcopclient.h>
31#include "configwndimpl.h" 31#include "configwndimpl.h"
32#include "configuration.h" 32#include "configuration.h"
33#else 33#else
34#include <qmenubar.h> 34#include <qmenubar.h>
35#include <qmessagebox.h> 35#include <qmessagebox.h>
36#include <pwmprefs.h> 36#include <pwmprefs.h>
37#include <kpimglobalprefs.h> 37#include <kpimglobalprefs.h>
38#include <kcmconfigs/kcmpwmconfig.h> 38#include <kcmconfigs/kcmpwmconfig.h>
39#include <kcmconfigs/kcmkdepimconfig.h> 39#include <kcmconfigs/kcmkdepimconfig.h>
40#include <kcmultidialog.h> 40#include <kcmultidialog.h>
41#endif 41#endif
42 42
43#include <qpixmap.h> 43#include <qpixmap.h>
44#include <qcheckbox.h> 44#include <qcheckbox.h>
45#include <qspinbox.h> 45#include <qspinbox.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qfileinfo.h> 47#include <qfileinfo.h>
48#include <qclipboard.h> 48#include <qclipboard.h>
49 49
50 50
51#include <stdio.h> 51#include <stdio.h>
52 52
53#include "pwm.h" 53#include "pwm.h"
54#include "pwminit.h" 54#include "pwminit.h"
55#include "pwmprint.h" 55#include "pwmprint.h"
56#include "addentrywndimpl.h" 56#include "addentrywndimpl.h"
57#include "globalstuff.h" 57#include "globalstuff.h"
58#include "findwndimpl.h" 58#include "findwndimpl.h"
59#include "csv.h"
59 60
60#ifdef CONFIG_KWALLETIF 61#ifdef CONFIG_KWALLETIF
61# include "kwalletif.h" 62# include "kwalletif.h"
62# include "kwalletemu.h" 63# include "kwalletemu.h"
63#endif 64#endif
64#ifdef CONFIG_KEYCARD 65#ifdef CONFIG_KEYCARD
65# include "pwmkeycard.h" 66# include "pwmkeycard.h"
66#endif 67#endif
67 68
68 69
69 #define DEFAULT_SIZE (QSize(700, 400)) 70 #define DEFAULT_SIZE (QSize(700, 400))
70 71
71// Button IDs for "file" popup menu 72// Button IDs for "file" popup menu
72enum { 73enum {
73 BUTTON_POPUP_FILE_NEW = 0, 74 BUTTON_POPUP_FILE_NEW = 0,
74 BUTTON_POPUP_FILE_OPEN, 75 BUTTON_POPUP_FILE_OPEN,
75 BUTTON_POPUP_FILE_CLOSE, 76 BUTTON_POPUP_FILE_CLOSE,
76 BUTTON_POPUP_FILE_SAVE, 77 BUTTON_POPUP_FILE_SAVE,
77 BUTTON_POPUP_FILE_SAVEAS, 78 BUTTON_POPUP_FILE_SAVEAS,
78 BUTTON_POPUP_FILE_EXPORT, 79 BUTTON_POPUP_FILE_EXPORT,
79 BUTTON_POPUP_FILE_IMPORT, 80 BUTTON_POPUP_FILE_IMPORT,
80 BUTTON_POPUP_FILE_PRINT, 81 BUTTON_POPUP_FILE_PRINT,
81 BUTTON_POPUP_FILE_QUIT 82 BUTTON_POPUP_FILE_QUIT
82}; 83};
83// Button IDs for "manage" popup menu 84// Button IDs for "manage" popup menu
84enum { 85enum {
85 BUTTON_POPUP_MANAGE_ADD = 0, 86 BUTTON_POPUP_MANAGE_ADD = 0,
86 BUTTON_POPUP_MANAGE_EDIT, 87 BUTTON_POPUP_MANAGE_EDIT,
87 BUTTON_POPUP_MANAGE_DEL, 88 BUTTON_POPUP_MANAGE_DEL,
88 BUTTON_POPUP_MANAGE_CHANGEMP 89 BUTTON_POPUP_MANAGE_CHANGEMP
89}; 90};
90// Button IDs for chipcard popup menu 91// Button IDs for chipcard popup menu
91enum { 92enum {
92#ifdef CONFIG_KEYCARD 93#ifdef CONFIG_KEYCARD
93 BUTTON_POPUP_CHIPCARD_GENNEW = 0, 94 BUTTON_POPUP_CHIPCARD_GENNEW = 0,
94 BUTTON_POPUP_CHIPCARD_DEL, 95 BUTTON_POPUP_CHIPCARD_DEL,
95 BUTTON_POPUP_CHIPCARD_READID, 96 BUTTON_POPUP_CHIPCARD_READID,
96 BUTTON_POPUP_CHIPCARD_SAVEBACKUP, 97 BUTTON_POPUP_CHIPCARD_SAVEBACKUP,
97 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP 98 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP
98#else // CONFIG_KEYCARD 99#else // CONFIG_KEYCARD
99 BUTTON_POPUP_CHIPCARD_NO = 0 100 BUTTON_POPUP_CHIPCARD_NO = 0
100#endif // CONFIG_KEYCARD 101#endif // CONFIG_KEYCARD
101}; 102};
102// Button IDs for "view" popup menu 103// Button IDs for "view" popup menu
103enum { 104enum {
104 BUTTON_POPUP_VIEW_FIND = 0, 105 BUTTON_POPUP_VIEW_FIND = 0,
105 BUTTON_POPUP_VIEW_LOCK, 106 BUTTON_POPUP_VIEW_LOCK,
106 BUTTON_POPUP_VIEW_DEEPLOCK, 107 BUTTON_POPUP_VIEW_DEEPLOCK,
107 BUTTON_POPUP_VIEW_UNLOCK 108 BUTTON_POPUP_VIEW_UNLOCK
108}; 109};
109// Button IDs for "options" popup menu 110// Button IDs for "options" popup menu
110enum { 111enum {
111 BUTTON_POPUP_OPTIONS_CONFIG = 0 112 BUTTON_POPUP_OPTIONS_CONFIG = 0
112}; 113};
113// Button IDs for "export" popup menu (in "file" popup menu) 114// Button IDs for "export" popup menu (in "file" popup menu)
114enum { 115enum {
115 BUTTON_POPUP_EXPORT_TEXT = 0, 116 BUTTON_POPUP_EXPORT_TEXT = 0,
116 BUTTON_POPUP_EXPORT_GPASMAN 117 BUTTON_POPUP_EXPORT_GPASMAN,
118 BUTTON_POPUP_EXPORT_CSV
117#ifdef CONFIG_KWALLETIF 119#ifdef CONFIG_KWALLETIF
118 ,BUTTON_POPUP_EXPORT_KWALLET 120 ,BUTTON_POPUP_EXPORT_KWALLET
119#endif 121#endif
120}; 122};
121// Button IDs for "import" popup menu (in "file" popup menu) 123// Button IDs for "import" popup menu (in "file" popup menu)
122enum { 124enum {
123 BUTTON_POPUP_IMPORT_TEXT = 0, 125 BUTTON_POPUP_IMPORT_TEXT = 0,
124 BUTTON_POPUP_IMPORT_GPASMAN 126 BUTTON_POPUP_IMPORT_GPASMAN,
127 BUTTON_POPUP_IMPORT_CSV
125#ifdef CONFIG_KWALLETIF 128#ifdef CONFIG_KWALLETIF
126 ,BUTTON_POPUP_IMPORT_KWALLET 129 ,BUTTON_POPUP_IMPORT_KWALLET
127#endif 130#endif
128}; 131};
129 132
130#ifdef PWM_EMBEDDED 133#ifdef PWM_EMBEDDED
131// Button IDs for "help" popup menu 134// Button IDs for "help" popup menu
132enum { 135enum {
133 BUTTON_POPUP_HELP_LICENSE = 0, 136 BUTTON_POPUP_HELP_LICENSE = 0,
134 BUTTON_POPUP_HELP_FAQ, 137 BUTTON_POPUP_HELP_FAQ,
135 BUTTON_POPUP_HELP_ABOUT, 138 BUTTON_POPUP_HELP_ABOUT,
136 BUTTON_POPUP_HELP_SYNC, 139 BUTTON_POPUP_HELP_SYNC,
137 BUTTON_POPUP_HELP_WHATSNEW 140 BUTTON_POPUP_HELP_WHATSNEW
138}; 141};
139#endif 142#endif
140 143
141// Button IDs for toolbar 144// Button IDs for toolbar
142enum { 145enum {
143 BUTTON_TOOL_NEW = 0, 146 BUTTON_TOOL_NEW = 0,
144 BUTTON_TOOL_OPEN, 147 BUTTON_TOOL_OPEN,
145 BUTTON_TOOL_SAVE, 148 BUTTON_TOOL_SAVE,
146 BUTTON_TOOL_SAVEAS, 149 BUTTON_TOOL_SAVEAS,
147 BUTTON_TOOL_PRINT, 150 BUTTON_TOOL_PRINT,
148 BUTTON_TOOL_ADD, 151 BUTTON_TOOL_ADD,
149 BUTTON_TOOL_EDIT, 152 BUTTON_TOOL_EDIT,
150 BUTTON_TOOL_DEL, 153 BUTTON_TOOL_DEL,
151 BUTTON_TOOL_FIND, 154 BUTTON_TOOL_FIND,
152 BUTTON_TOOL_LOCK, 155 BUTTON_TOOL_LOCK,
153 BUTTON_TOOL_DEEPLOCK, 156 BUTTON_TOOL_DEEPLOCK,
154 BUTTON_TOOL_UNLOCK 157 BUTTON_TOOL_UNLOCK
155}; 158};
156 159
157 160
158PwM::PwM(PwMInit *_init, PwMDoc *doc, 161PwM::PwM(PwMInit *_init, PwMDoc *doc,
159 bool virginity, 162 bool virginity,
160 QWidget *parent, const char *name) 163 QWidget *parent, const char *name)
161 : KMainWindow(parent, "HALLO") 164 : KMainWindow(parent, "HALLO")
162 , forceQuit (false) 165 , forceQuit (false)
163 , forceMinimizeToTray (false) 166 , forceMinimizeToTray (false)
164{ 167{
165 init = _init; 168 init = _init;
166 connect(doc, SIGNAL(docClosed(PwMDoc *)), 169 connect(doc, SIGNAL(docClosed(PwMDoc *)),
167 this, SLOT(docClosed(PwMDoc *))); 170 this, SLOT(docClosed(PwMDoc *)));
168 initMenubar(); 171 initMenubar();
169 initToolbar(); 172 initToolbar();
170 initMetrics(); 173 initMetrics();
171 setVirgin(virginity); 174 setVirgin(virginity);
172 setFocusPolicy(QWidget::WheelFocus); 175 setFocusPolicy(QWidget::WheelFocus);
173#ifndef PWM_EMBEDDED 176#ifndef PWM_EMBEDDED
174 statusBar()->show(); 177 statusBar()->show();
175#endif 178#endif
176 view = makeNewListView(doc); 179 view = makeNewListView(doc);
177 setCentralWidget(view); 180 setCentralWidget(view);
178 updateCaption(); 181 updateCaption();
179 showStatMsg(i18n("Ready.")); 182 showStatMsg(i18n("Ready."));
180} 183}
181 184
182PwM::~PwM() 185PwM::~PwM()
183{ 186{
187 //qDebug("PwM::~PwM()");
184 disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), 188 disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)),
185 this, SLOT(docClosed(PwMDoc *))); 189 this, SLOT(docClosed(PwMDoc *)));
186 conf()->confWndMainWndSize(size()); 190 conf()->confWndMainWndSize(size());
187 emit closed(this); 191 emit closed(this);
192 //qDebug("PwM::~PwM() emited closed(this)");
188 delete view; 193 delete view;
189} 194}
190 195
191void PwM::initMenubar() 196void PwM::initMenubar()
192{ 197{
193 KIconLoader* picons; 198 KIconLoader* picons;
194#ifndef PWM_EMBEDDED 199#ifndef PWM_EMBEDDED
195 KIconLoader icons; 200 KIconLoader icons;
196 picons = &icons; 201 picons = &icons;
197#else 202#else
198 picons = KGlobal::iconLoader(); 203 picons = KGlobal::iconLoader();
199 204
200 205
201 syncPopup = new KPopupMenu(this); 206 syncPopup = new KPopupMenu(this);
202 207
203 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup); 208 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup);
204 syncManager->setBlockSave(false); 209 syncManager->setBlockSave(false);
205 210
206 connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 211 connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
207 syncManager->fillSyncMenu(); 212 syncManager->fillSyncMenu();
208 213
209#endif 214#endif
210 filePopup = new KPopupMenu(this); 215 filePopup = new KPopupMenu(this);
211 importPopup = new KPopupMenu(filePopup); 216 importPopup = new KPopupMenu(filePopup);
212 exportPopup = new KPopupMenu(filePopup); 217 exportPopup = new KPopupMenu(filePopup);
213 managePopup = new KPopupMenu(this); 218 managePopup = new KPopupMenu(this);
214#ifdef CONFIG_KEYCARD 219#ifdef CONFIG_KEYCARD
215 chipcardPopup = new KPopupMenu(this); 220 chipcardPopup = new KPopupMenu(this);
216#endif // CONFIG_KEYCARD 221#endif // CONFIG_KEYCARD
217 viewPopup = new KPopupMenu(this); 222 viewPopup = new KPopupMenu(this);
218 optionsPopup = new KPopupMenu(this); 223 optionsPopup = new KPopupMenu(this);
219 224
220// "file" popup menu 225// "file" popup menu
221 filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), 226 filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
222 i18n("&New"), this, 227 i18n("&New"), this,
223 SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); 228 SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW);
224 filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), 229 filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)),
225 i18n("&Open"), this, 230 i18n("&Open"), this,
226 SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); 231 SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN);
227 filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), 232 filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)),
228 i18n("&Close"), this, 233 i18n("&Close"), this,
229 SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); 234 SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE);
230 filePopup->insertSeparator(); 235 filePopup->insertSeparator();
231 filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), 236 filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)),
232 i18n("&Save"), this, 237 i18n("&Save"), this,
233 SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); 238 SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE);
234 filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), 239 filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)),
235 i18n("Save &as..."), 240 i18n("Save &as..."),
236 this, SLOT(saveAs_slot()), 0, 241 this, SLOT(saveAs_slot()), 0,
237 BUTTON_POPUP_FILE_SAVEAS); 242 BUTTON_POPUP_FILE_SAVEAS);
238 filePopup->insertSeparator(); 243 filePopup->insertSeparator();
239 // "file/export" popup menu 244 // "file/export" popup menu
240 exportPopup->insertItem(i18n("&Text-file..."), this, 245 exportPopup->insertItem(i18n("&Text-file..."), this,
241 SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); 246 SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT);
242 exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, 247 exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
243 SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); 248 SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN);
249 exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this,
250 SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV);
244#ifdef CONFIG_KWALLETIF 251#ifdef CONFIG_KWALLETIF
245 exportPopup->insertItem(i18n("&KWallet..."), this, 252 exportPopup->insertItem(i18n("&KWallet..."), this,
246 SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); 253 SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET);
247#endif 254#endif
248 filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), 255 filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)),
249 i18n("E&xport"), exportPopup, 256 i18n("E&xport"), exportPopup,
250 BUTTON_POPUP_FILE_EXPORT); 257 BUTTON_POPUP_FILE_EXPORT);
251 // "file/import" popup menu 258 // "file/import" popup menu
252 importPopup->insertItem(i18n("&Text-file..."), this, 259 importPopup->insertItem(i18n("&Text-file..."), this,
253 SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); 260 SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT);
254 importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, 261 importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
255 SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); 262 SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN);
263 importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this,
264 SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV);
256#ifdef CONFIG_KWALLETIF 265#ifdef CONFIG_KWALLETIF
257 importPopup->insertItem(i18n("&KWallet..."), this, 266 importPopup->insertItem(i18n("&KWallet..."), this,
258 SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); 267 SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET);
259#endif 268#endif
260 filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), 269 filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)),
261 i18n("I&mport"), importPopup, 270 i18n("I&mport"), importPopup,
262 BUTTON_POPUP_FILE_IMPORT); 271 BUTTON_POPUP_FILE_IMPORT);
263 filePopup->insertSeparator(); 272 filePopup->insertSeparator();
264 filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), 273 filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)),
265 i18n("&Print..."), this, 274 i18n("&Print..."), this,
266 SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); 275 SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT);
267 filePopup->insertSeparator(); 276 filePopup->insertSeparator();
268 filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), 277 filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)),
269 i18n("&Quit"), this, 278 i18n("&Quit"), this,
270 SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); 279 SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT);
271 menuBar()->insertItem(i18n("&File"), filePopup); 280 menuBar()->insertItem(i18n("&File"), filePopup);
272// "manage" popup menu 281// "manage" popup menu
273 managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), 282 managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)),
274 i18n("&Add password"), this, 283 i18n("&Add password"), this,
275 SLOT(addPwd_slot()), 0, 284 SLOT(addPwd_slot()), 0,
276 BUTTON_POPUP_MANAGE_ADD); 285 BUTTON_POPUP_MANAGE_ADD);
277 managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), 286 managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)),
278 i18n("&Edit"), this, SLOT(editPwd_slot()), 0, 287 i18n("&Edit"), this, SLOT(editPwd_slot()), 0,
279 BUTTON_POPUP_MANAGE_EDIT); 288 BUTTON_POPUP_MANAGE_EDIT);
280 managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), 289 managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
281 i18n("&Delete"), this, SLOT(deletePwd_slot()), 290 i18n("&Delete"), this, SLOT(deletePwd_slot()),
282 0, BUTTON_POPUP_MANAGE_DEL); 291 0, BUTTON_POPUP_MANAGE_DEL);
283 managePopup->insertSeparator(); 292 managePopup->insertSeparator();
284 managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), 293 managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)),
285 i18n("Change &Master Password"), this, 294 i18n("Change &Master Password"), this,
286 SLOT(changeMasterPwd_slot()), 0, 295 SLOT(changeMasterPwd_slot()), 0,
287 BUTTON_POPUP_MANAGE_CHANGEMP); 296 BUTTON_POPUP_MANAGE_CHANGEMP);
288 menuBar()->insertItem(i18n("&Manage"), managePopup); 297 menuBar()->insertItem(i18n("&Manage"), managePopup);
289// "chipcard" popup menu 298// "chipcard" popup menu
290#ifdef CONFIG_KEYCARD 299#ifdef CONFIG_KEYCARD
291 chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), 300 chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
292 i18n("&Generate new key-card"), this, 301 i18n("&Generate new key-card"), this,
293 SLOT(genNewCard_slot()), 0, 302 SLOT(genNewCard_slot()), 0,
294 BUTTON_POPUP_CHIPCARD_GENNEW); 303 BUTTON_POPUP_CHIPCARD_GENNEW);
295 chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), 304 chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
296 i18n("&Erase key-card"), this, 305 i18n("&Erase key-card"), this,
297 SLOT(eraseCard_slot()), 0, 306 SLOT(eraseCard_slot()), 0,
298 BUTTON_POPUP_CHIPCARD_DEL); 307 BUTTON_POPUP_CHIPCARD_DEL);
299 chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), 308 chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)),
300 i18n("Read card-&ID"), this, 309 i18n("Read card-&ID"), this,
301 SLOT(readCardId_slot()), 0, 310 SLOT(readCardId_slot()), 0,
302 BUTTON_POPUP_CHIPCARD_READID); 311 BUTTON_POPUP_CHIPCARD_READID);
303 chipcardPopup->insertSeparator(); 312 chipcardPopup->insertSeparator();
304 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), 313 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)),
305 i18n("&Make card backup-image"), this, 314 i18n("&Make card backup-image"), this,
306 SLOT(makeCardBackup_slot()), 0, 315 SLOT(makeCardBackup_slot()), 0,
307 BUTTON_POPUP_CHIPCARD_SAVEBACKUP); 316 BUTTON_POPUP_CHIPCARD_SAVEBACKUP);
308 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), 317 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)),
309 i18n("&Replay card backup-image"), this, 318 i18n("&Replay card backup-image"), this,
310 SLOT(replayCardBackup_slot()), 0, 319 SLOT(replayCardBackup_slot()), 0,
311 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); 320 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP);
312 menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); 321 menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup);
313#endif // CONFIG_KEYCARD 322#endif // CONFIG_KEYCARD
314// "view" popup menu 323// "view" popup menu
315 viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), 324 viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)),
316 i18n("&Find"), this, 325 i18n("&Find"), this,
317 SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); 326 SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND);
318 viewPopup->insertSeparator(); 327 viewPopup->insertSeparator();
319 viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), 328 viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)),
320 i18n("&Lock all entries"), this, 329 i18n("&Lock all entries"), this,
321 SLOT(lockWnd_slot()), 0, 330 SLOT(lockWnd_slot()), 0,
322 BUTTON_POPUP_VIEW_LOCK); 331 BUTTON_POPUP_VIEW_LOCK);
323 viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), 332 viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)),
324 i18n("&Deep-lock all entries"), this, 333 i18n("&Deep-lock all entries"), this,
325 SLOT(deepLockWnd_slot()), 0, 334 SLOT(deepLockWnd_slot()), 0,
326 BUTTON_POPUP_VIEW_DEEPLOCK); 335 BUTTON_POPUP_VIEW_DEEPLOCK);
327 viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), 336 viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)),
328 i18n("&Unlock all entries"), this, 337 i18n("&Unlock all entries"), this,
329 SLOT(unlockWnd_slot()), 0, 338 SLOT(unlockWnd_slot()), 0,
330 BUTTON_POPUP_VIEW_UNLOCK); 339 BUTTON_POPUP_VIEW_UNLOCK);
331 menuBar()->insertItem(i18n("&View"), viewPopup); 340 menuBar()->insertItem(i18n("&View"), viewPopup);
332// "options" popup menu 341// "options" popup menu
333 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), 342 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
334 i18n("&Configure..."), this, 343 i18n("&Configure..."), this,
335 SLOT(config_slot()), 344 SLOT(config_slot()),
336 BUTTON_POPUP_OPTIONS_CONFIG); 345 BUTTON_POPUP_OPTIONS_CONFIG);
337 menuBar()->insertItem(i18n("&Options"), optionsPopup); 346 menuBar()->insertItem(i18n("&Options"), optionsPopup);
338// "help" popup menu 347// "help" popup menu
339#ifndef PWM_EMBEDDED 348#ifndef PWM_EMBEDDED
340 helpPopup = helpMenu(QString::null, false); 349 helpPopup = helpMenu(QString::null, false);
341#else 350#else
342 menuBar()->insertItem(i18n("&Sync"), syncPopup); 351 menuBar()->insertItem(i18n("&Sync"), syncPopup);
343 352
344 353
345 354
346 355
347 356
348 helpPopup = new KPopupMenu(this); 357 helpPopup = new KPopupMenu(this);
349 358
350 359
351 helpPopup->insertItem(i18n("&License"), this, 360 helpPopup->insertItem(i18n("&License"), this,
352 SLOT(showLicense_slot()), 0, 361 SLOT(showLicense_slot()), 0,
353 BUTTON_POPUP_HELP_LICENSE); 362 BUTTON_POPUP_HELP_LICENSE);
354 363
355 helpPopup->insertItem(i18n("&Faq"), this, 364 helpPopup->insertItem(i18n("&Faq"), this,
356 SLOT(faq_slot()), 0, 365 SLOT(faq_slot()), 0,
357 BUTTON_POPUP_HELP_FAQ); 366 BUTTON_POPUP_HELP_FAQ);
358 367
359 helpPopup->insertItem(i18n("&About PwManager"), this, 368 helpPopup->insertItem(i18n("&About PwManager"), this,
360 SLOT(createAboutData_slot()), 0, 369 SLOT(createAboutData_slot()), 0,
361 BUTTON_POPUP_HELP_ABOUT); 370 BUTTON_POPUP_HELP_ABOUT);
362 371
363 helpPopup->insertItem(i18n("&Sync HowTo"), this, 372 helpPopup->insertItem(i18n("&Sync HowTo"), this,
364 SLOT(syncHowTo_slot()), 0, 373 SLOT(syncHowTo_slot()), 0,
365 BUTTON_POPUP_HELP_SYNC); 374 BUTTON_POPUP_HELP_SYNC);
366 375
367 helpPopup->insertItem(i18n("&What's New"), this, 376 helpPopup->insertItem(i18n("&What's New"), this,
368 SLOT(whatsnew_slot()), 0, 377 SLOT(whatsnew_slot()), 0,
369 BUTTON_POPUP_HELP_WHATSNEW); 378 BUTTON_POPUP_HELP_WHATSNEW);
370 379
371#endif 380#endif
372 menuBar()->insertItem(i18n("&Help"), helpPopup); 381 menuBar()->insertItem(i18n("&Help"), helpPopup);
373 382
374} 383}
375 384
376void PwM::initToolbar() 385void PwM::initToolbar()
377{ 386{
378 KIconLoader* picons; 387 KIconLoader* picons;
379#ifndef PWM_EMBEDDED 388#ifndef PWM_EMBEDDED
380 KIconLoader icons; 389 KIconLoader icons;
381 picons = &icons; 390 picons = &icons;
382#else 391#else
383 picons = KGlobal::iconLoader(); 392 picons = KGlobal::iconLoader();
384#endif 393#endif
385 394
386#ifdef PWM_EMBEDDED 395#ifdef PWM_EMBEDDED
387 if ( QApplication::desktop()->width() > 320 ) 396 if ( QApplication::desktop()->width() > 320 )
388#endif 397#endif
389 { 398 {
390 toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar), 399 toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar),
391 BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this, 400 BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this,
392 SLOT(new_slot()), true, i18n("New")); 401 SLOT(new_slot()), true, i18n("New"));
393 toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar), 402 toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar),
394 BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this, 403 BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this,
395 SLOT(open_slot()), true, i18n("Open")); 404 SLOT(open_slot()), true, i18n("Open"));
396 toolBar()->insertSeparator(); 405 toolBar()->insertSeparator();
397 } 406 }
398 toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar), 407 toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar),
399 BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this, 408 BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this,
400 SLOT(save_slot()), true, i18n("Save")); 409 SLOT(save_slot()), true, i18n("Save"));
401 toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar), 410 toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar),
402 BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this, 411 BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this,
403 SLOT(saveAs_slot()), true, i18n("Save as")); 412 SLOT(saveAs_slot()), true, i18n("Save as"));
404 toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar), 413 toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar),
405 BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this, 414 BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this,
406 SLOT(print_slot()), true, i18n("Print...")); 415 SLOT(print_slot()), true, i18n("Print..."));
407 toolBar()->insertSeparator(); 416 toolBar()->insertSeparator();
408 toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar), 417 toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar),
409 BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this, 418 BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this,
410 SLOT(addPwd_slot()), true, 419 SLOT(addPwd_slot()), true,
411 i18n("Add password")); 420 i18n("Add password"));
412 toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar), 421 toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar),
413 BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this, 422 BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this,
414 SLOT(editPwd_slot()), true, 423 SLOT(editPwd_slot()), true,
415 i18n("Edit password")); 424 i18n("Edit password"));
416 toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar), 425 toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar),
417 BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this, 426 BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this,
418 SLOT(deletePwd_slot()), true, 427 SLOT(deletePwd_slot()), true,
419 i18n("Delete password")); 428 i18n("Delete password"));
420 toolBar()->insertSeparator(); 429 toolBar()->insertSeparator();
421 toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar), 430 toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar),
422 BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this, 431 BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this,
423 SLOT(find_slot()), true, i18n("Find entry")); 432 SLOT(find_slot()), true, i18n("Find entry"));
424 toolBar()->insertSeparator(); 433 toolBar()->insertSeparator();
425 toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar), 434 toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar),
426 BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this, 435 BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this,
427 SLOT(lockWnd_slot()), true, 436 SLOT(lockWnd_slot()), true,
428 i18n("Lock all entries")); 437 i18n("Lock all entries"));
429 toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar), 438 toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar),
430 BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this, 439 BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this,
431 SLOT(deepLockWnd_slot()), true, 440 SLOT(deepLockWnd_slot()), true,
432 i18n("Deep-Lock all entries")); 441 i18n("Deep-Lock all entries"));
433 toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar), 442 toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar),
434 BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this, 443 BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this,
435 SLOT(unlockWnd_slot()), true, 444 SLOT(unlockWnd_slot()), true,
436 i18n("Unlock all entries")); 445 i18n("Unlock all entries"));
437} 446}
438 447
439void PwM::initMetrics() 448void PwM::initMetrics()
440{ 449{
441 QSize s = conf()->confWndMainWndSize(); 450 QSize s = conf()->confWndMainWndSize();
442 if (s.isValid()) 451 if (s.isValid())
443 resize(s); 452 resize(s);
444 else 453 else
445 resize(DEFAULT_SIZE); 454 resize(DEFAULT_SIZE);
446} 455}
447 456
448void PwM::updateCaption() 457void PwM::updateCaption()
449{ 458{
450 setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER); 459 setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER);
451} 460}
452 461
453void PwM::hideEvent(QHideEvent *) 462void PwM::hideEvent(QHideEvent *)
454{ 463{
455 if (isMinimized()) { 464 if (isMinimized()) {
456 if (init->tray()) { 465 if (init->tray()) {
457 forceMinimizeToTray = true; 466 forceMinimizeToTray = true;
458 close(); 467 close();
459 } 468 }
460 int mmlock = conf()->confGlobMinimizeLock(); 469 int mmlock = conf()->confGlobMinimizeLock();
461 switch (mmlock) { 470 switch (mmlock) {
462 case 0: // don't lock anything 471 case 0: // don't lock anything
463 break; 472 break;
464 case 1: {// normal lock 473 case 1: {// normal lock
465 curDoc()->lockAll(true); 474 curDoc()->lockAll(true);
466 break; 475 break;
467 } case 2: {// deep-lock 476 } case 2: {// deep-lock
468 curDoc()->deepLock(); 477 curDoc()->deepLock();
469 break; 478 break;
470 } default: 479 } default:
471 WARN(); 480 WARN();
472 } 481 }
473 } 482 }
474} 483}
475 484
476void PwM::setVirgin(bool v) 485void PwM::setVirgin(bool v)
477{ 486{
478 if (virgin == v) 487 if (virgin == v)
479 return; 488 return;
480 virgin = v; 489 virgin = v;
481 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v); 490 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v);
482 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v); 491 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v);
483 filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v); 492 filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v);
484 filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v); 493 filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v);
485 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v); 494 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v);
486 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v); 495 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v);
487 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v); 496 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v);
488 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v); 497 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v);
489 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v); 498 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v);
490 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v); 499 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v);
491 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v); 500 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v);
492 toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v); 501 toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v);
493 toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v); 502 toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v);
494 toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v); 503 toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v);
495 toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v); 504 toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v);
496 toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v); 505 toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v);
497 toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v); 506 toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v);
498 toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v); 507 toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v);
499 toolBar()->setItemEnabled(BUTTON_TOOL_UNLOCK, !v); 508 toolBar()->setItemEnabled(BUTTON_TOOL_UNLOCK, !v);
500 toolBar()->setItemEnabled(BUTTON_TOOL_FIND, !v); 509 toolBar()->setItemEnabled(BUTTON_TOOL_FIND, !v);
501} 510}
502 511
503void PwM::new_slot() 512void PwM::new_slot()
504{ 513{
505 init->createMainWnd(); 514 init->createMainWnd();
506} 515}
507 516
508//US ENH 517//US ENH
509void PwM::open_slot() 518void PwM::open_slot()
510{ 519{
511 open_slot(""); 520 open_slot("");
512} 521}
513 522
514void PwM::open_slot(QString fn) 523void PwM::open_slot(QString fn)
515{ 524{
516 openDoc(fn); 525 openDoc(fn);
517} 526}
518 527
519PwMDoc * PwM::openDoc(QString filename, bool openDeepLocked) 528PwMDoc * PwM::openDoc(QString filename, bool openDeepLocked)
520{ 529{
521 if (!isVirgin()) { 530 if (!isVirgin()) {
522 // open the document in a new window. 531 // open the document in a new window.
523 PwM *newInstance = init->createMainWnd(); 532 PwM *newInstance = init->createMainWnd();
524 PwMDoc *newDoc = newInstance->openDoc(filename, openDeepLocked); 533 PwMDoc *newDoc = newInstance->openDoc(filename, openDeepLocked);
525 if (!newDoc) { 534 if (!newDoc) {
526 newInstance->setForceQuit(true); 535 newInstance->setForceQuit(true);
527 delete_and_null(newInstance); 536 delete_and_null(newInstance);
528 } 537 }
529 return newDoc; 538 return newDoc;
530 } 539 }
531 540
532 if (!curDoc()->openDocUi(curDoc(), filename, openDeepLocked)) 541 if (!curDoc()->openDocUi(curDoc(), filename, openDeepLocked))
533 return 0; 542 return 0;
534 showStatMsg(i18n("Successfully opened file.")); 543 showStatMsg(i18n("Successfully opened file."));
535 updateCaption(); 544 updateCaption();
536 setVirgin(false); 545 setVirgin(false);
537 return curDoc(); 546 return curDoc();
538} 547}
539 548
540PwMView * PwM::makeNewListView(PwMDoc *doc) 549PwMView * PwM::makeNewListView(PwMDoc *doc)
541{ 550{
542 PwMView *ret = new PwMView(this, this, doc); 551 PwMView *ret = new PwMView(this, this, doc);
543 ret->setFont(conf()->confGlobEntryFont()); 552 ret->setFont(conf()->confGlobEntryFont());
544 ret->show(); 553 ret->show();
545 return ret; 554 return ret;
546} 555}
547 556
548void PwM::close_slot() 557void PwM::close_slot()
549{ 558{
550 close(); 559 close();
551} 560}
552 561
553void PwM::quitButton_slot() 562void PwM::quitButton_slot()
554{ 563{
555 init->shutdownApp(0); 564 init->shutdownApp(0);
556} 565}
557 566
558void PwM::save_slot() 567void PwM::save_slot()
559{ 568{
560 save(); 569 save();
561} 570}
562 571
563bool PwM::save() 572bool PwM::save()
564{ 573{
565 if (!curDoc()->saveDocUi(curDoc())) 574 if (!curDoc()->saveDocUi(curDoc()))
566 return false; 575 return false;
567 showStatMsg(i18n("Successfully saved data.")); 576 showStatMsg(i18n("Successfully saved data."));
568 updateCaption(); 577 updateCaption();
569 return true; 578 return true;
570} 579}
571 580
572void PwM::saveAs_slot() 581void PwM::saveAs_slot()
573{ 582{
574 saveAs(); 583 saveAs();
575} 584}
576 585
577bool PwM::saveAs() 586bool PwM::saveAs()
578{ 587{
579 if (!curDoc()->saveAsDocUi(curDoc())) 588 if (!curDoc()->saveAsDocUi(curDoc()))
580 return false; 589 return false;
581 showStatMsg(i18n("Successfully saved data.")); 590 showStatMsg(i18n("Successfully saved data."));
582 updateCaption(); 591 updateCaption();
583 return true; 592 return true;
584} 593}
585 594
586//US ENH : changed code to run with older MOC 595//US ENH : changed code to run with older MOC
587void PwM::addPwd_slot() 596void PwM::addPwd_slot()
588{ 597{
589 addPwd_slot1(0, 0); 598 addPwd_slot1(0, 0);
590} 599}
591 600
592void PwM::addPwd_slot1(QString *pw, PwMDoc *_doc) 601void PwM::addPwd_slot1(QString *pw, PwMDoc *_doc)
593{ 602{
594 PwMDoc *doc; 603 PwMDoc *doc;
595 if (_doc) { 604 if (_doc) {
596 doc = _doc; 605 doc = _doc;
597 } else { 606 } else {
598 doc = curDoc(); 607 doc = curDoc();
599 } 608 }
600 PWM_ASSERT(doc); 609 PWM_ASSERT(doc);
601 doc->timer()->getLock(DocTimer::id_autoLockTimer); 610 doc->timer()->getLock(DocTimer::id_autoLockTimer);
602#ifndef PWM_EMBEDDED 611#ifndef PWM_EMBEDDED
603 AddEntryWndImpl w; 612 AddEntryWndImpl w;
604#else 613#else
605 AddEntryWndImpl w(this, "addentrywndimpl"); 614 AddEntryWndImpl w(this, "addentrywndimpl");
606#endif 615#endif
607 616
608 vector<string> catList; 617 vector<string> catList;
609 doc->getCategoryList(&catList); 618 doc->getCategoryList(&catList);
610 unsigned i, size = catList.size(); 619 unsigned i, size = catList.size();
611 for (i = 0; i < size; ++i) { 620 for (i = 0; i < size; ++i) {
612 w.addCategory(catList[i].c_str()); 621 w.addCategory(catList[i].c_str());
613 } 622 }
614 w.setCurrCategory(view->getCurrentCategory()); 623 w.setCurrCategory(view->getCurrentCategory());
615 if (pw) 624 if (pw)
616 w.pwLineEdit->setText(*pw); 625 w.pwLineEdit->setText(*pw);
617 626
618 tryAgain: 627 tryAgain:
619 if (w.exec() == 1) 628 if (w.exec() == 1)
620 { 629 {
621 PwMDataItem d; 630 PwMDataItem d;
622 631
623 //US BUG: to initialize all values of curEntr with meaningfulldata, 632 //US BUG: to initialize all values of curEntr with meaningfulldata,
624 // we call clear on it. Reason: Metadata will be uninitialized otherwise. 633 // we call clear on it. Reason: Metadata will be uninitialized otherwise.
625 // another option would be to create a constructor for PwMDataItem 634 // another option would be to create a constructor for PwMDataItem
626 d.clear(true); 635 d.clear(true);
627 636
628 d.desc = w.getDescription().latin1(); 637 d.desc = w.getDescription().latin1();
629 d.name = w.getUsername().latin1(); 638 d.name = w.getUsername().latin1();
630 d.pw = w.getPassword().latin1(); 639 d.pw = w.getPassword().latin1();
631 d.comment = w.getComment().latin1(); 640 d.comment = w.getComment().latin1();
632 d.url = w.getUrl().latin1(); 641 d.url = w.getUrl().latin1();
633 d.launcher = w.getLauncher().latin1(); 642 d.launcher = w.getLauncher().latin1();
634 PwMerror ret = doc->addEntry(w.getCategory(), &d); 643 PwMerror ret = doc->addEntry(w.getCategory(), &d);
635 if (ret == e_entryExists) { 644 if (ret == e_entryExists) {
636 KMessageBox::error(this, 645 KMessageBox::error(this,
637 i18n 646 i18n
638 ("An entry with this \"Description\",\n" 647 ("An entry with this \"Description\",\n"
639 "does already exist.\n" 648 "does already exist.\n"
640 "Please select another description."), 649 "Please select another description."),
641 i18n("entry already exists.")); 650 i18n("entry already exists."));
642 goto tryAgain; 651 goto tryAgain;
643 } else if (ret == e_maxAllowedEntr) { 652 } else if (ret == e_maxAllowedEntr) {
644 KMessageBox::error(this, i18n("The maximum possible number of\nentries" 653 KMessageBox::error(this, i18n("The maximum possible number of\nentries"
645 "has been reached.\nYou can't add more entries."), 654 "has been reached.\nYou can't add more entries."),
646 i18n("maximum number of entries")); 655 i18n("maximum number of entries"));
647 doc->timer()->putLock(DocTimer::id_autoLockTimer); 656 doc->timer()->putLock(DocTimer::id_autoLockTimer);
648 return; 657 return;
649 } 658 }
650 } 659 }
651 setVirgin(false); 660 setVirgin(false);
652 doc->timer()->putLock(DocTimer::id_autoLockTimer); 661 doc->timer()->putLock(DocTimer::id_autoLockTimer);
653} 662}
654 663
655//US ENH : changed code to run with older MOC 664//US ENH : changed code to run with older MOC
656void PwM::editPwd_slot() 665void PwM::editPwd_slot()
657{ 666{
658 editPwd_slot3(0,0,0); 667 editPwd_slot3(0,0,0);
659} 668}
660 669
661void PwM::editPwd_slot1(const QString *category) 670void PwM::editPwd_slot1(const QString *category)
662{ 671{
663 editPwd_slot3(category, 0, 0); 672 editPwd_slot3(category, 0, 0);
664} 673}
665 674
666void PwM::editPwd_slot3(const QString *category, const int *index, 675void PwM::editPwd_slot3(const QString *category, const int *index,
667 PwMDoc *_doc) 676 PwMDoc *_doc)
668{ 677{
669 PwMDoc *doc; 678 PwMDoc *doc;
670 if (_doc) { 679 if (_doc) {
671 doc = _doc; 680 doc = _doc;
672 } else { 681 } else {
673 doc = curDoc(); 682 doc = curDoc();
674 } 683 }
675 PWM_ASSERT(doc); 684 PWM_ASSERT(doc);
676 if (doc->isDocEmpty()) 685 if (doc->isDocEmpty())
677 return; 686 return;
678 if (doc->isDeepLocked()) 687 if (doc->isDeepLocked())
679 return; 688 return;
680 doc->timer()->getLock(DocTimer::id_autoLockTimer); 689 doc->timer()->getLock(DocTimer::id_autoLockTimer);
681 unsigned int curEntryIndex; 690 unsigned int curEntryIndex;
682 if (index) { 691 if (index) {
683 curEntryIndex = *index; 692 curEntryIndex = *index;
684 } else { 693 } else {
685 if (!(view->getCurEntryIndex(&curEntryIndex))) { 694 if (!(view->getCurEntryIndex(&curEntryIndex))) {
686 printDebug("couldn't get index. Maybe we have a binary entry here."); 695 printDebug("couldn't get index. Maybe we have a binary entry here.");
687 doc->timer()->putLock(DocTimer::id_autoLockTimer); 696 doc->timer()->putLock(DocTimer::id_autoLockTimer);
688 return; 697 return;
689 } 698 }
690 } 699 }
691 QString curCategory; 700 QString curCategory;
692 if (category) { 701 if (category) {
693 curCategory = *category; 702 curCategory = *category;
694 } else { 703 } else {
695 curCategory = view->getCurrentCategory(); 704 curCategory = view->getCurrentCategory();
696 } 705 }
697 PwMDataItem currItem; 706 PwMDataItem currItem;
698 if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) { 707 if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) {
699 doc->timer()->putLock(DocTimer::id_autoLockTimer); 708 doc->timer()->putLock(DocTimer::id_autoLockTimer);
700 return; 709 return;
701 } 710 }
702 BUG_ON(currItem.binary); 711 BUG_ON(currItem.binary);
703 712
704 AddEntryWndImpl w; 713 AddEntryWndImpl w;
705 vector<string> catList; 714 vector<string> catList;
706 doc->getCategoryList(&catList); 715 doc->getCategoryList(&catList);
707 unsigned i, size = catList.size(); 716 unsigned i, size = catList.size();
708 for (i = 0; i < size; ++i) { 717 for (i = 0; i < size; ++i) {
709 w.addCategory(catList[i].c_str()); 718 w.addCategory(catList[i].c_str());
710 } 719 }
711 w.setCurrCategory(curCategory); 720 w.setCurrCategory(curCategory);
712 w.setDescription(currItem.desc.c_str()); 721 w.setDescription(currItem.desc.c_str());
713 w.setUsername(currItem.name.c_str()); 722 w.setUsername(currItem.name.c_str());
714 w.setPassword(currItem.pw.c_str()); 723 w.setPassword(currItem.pw.c_str());
715 w.setUrl(currItem.url.c_str()); 724 w.setUrl(currItem.url.c_str());
716 w.setLauncher(currItem.launcher.c_str()); 725 w.setLauncher(currItem.launcher.c_str());
717 w.setComment(currItem.comment.c_str()); 726 w.setComment(currItem.comment.c_str());
718 if (w.exec() == 1) { 727 if (w.exec() == 1) {
719 currItem.desc = w.getDescription().latin1(); 728 currItem.desc = w.getDescription().latin1();
720 currItem.name = w.getUsername().latin1(); 729 currItem.name = w.getUsername().latin1();
721 currItem.pw = w.getPassword().latin1(); 730 currItem.pw = w.getPassword().latin1();
722 currItem.comment = w.getComment().latin1(); 731 currItem.comment = w.getComment().latin1();
723 currItem.url = w.getUrl().latin1(); 732 currItem.url = w.getUrl().latin1();
724 currItem.launcher = w.getLauncher().latin1(); 733 currItem.launcher = w.getLauncher().latin1();
725 if (!doc->editEntry(curCategory, w.getCategory(), 734 if (!doc->editEntry(curCategory, w.getCategory(),
726 curEntryIndex, &currItem)) { 735 curEntryIndex, &currItem)) {
727 KMessageBox::error(this, 736 KMessageBox::error(this,
728 i18n("Couldn't edit the entry.\n" 737 i18n("Couldn't edit the entry.\n"
729 "Maybe you changed the category and\n" 738 "Maybe you changed the category and\n"
730 "this entry is already present\nin the new " 739 "this entry is already present\nin the new "
731 "category?"), 740 "category?"),
732 i18n("couldn't edit entry.")); 741 i18n("couldn't edit entry."));
733 doc->timer()->putLock(DocTimer::id_autoLockTimer); 742 doc->timer()->putLock(DocTimer::id_autoLockTimer);
734 return; 743 return;
735 } 744 }
736 } 745 }
737 doc->timer()->putLock(DocTimer::id_autoLockTimer); 746 doc->timer()->putLock(DocTimer::id_autoLockTimer);
738} 747}
739 748
740void PwM::deletePwd_slot() 749void PwM::deletePwd_slot()
741{ 750{
742 PWM_ASSERT(curDoc()); 751 PWM_ASSERT(curDoc());
743 if (curDoc()->isDocEmpty()) 752 if (curDoc()->isDocEmpty())
744 return; 753 return;
745 if (curDoc()->isDeepLocked()) 754 if (curDoc()->isDeepLocked())
746 return; 755 return;
747 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 756 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
748 unsigned int curEntryIndex = 0; 757 unsigned int curEntryIndex = 0;
749 if (!(view->getCurEntryIndex(&curEntryIndex))) { 758 if (!(view->getCurEntryIndex(&curEntryIndex))) {
750 printDebug("couldn't get index"); 759 printDebug("couldn't get index");
751 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 760 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
752 return; 761 return;
753 } 762 }
754 763
755 PwMDataItem currItem; 764 PwMDataItem currItem;
756 QString curCategory = view->getCurrentCategory(); 765 QString curCategory = view->getCurrentCategory();
757 if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) { 766 if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) {
758 printDebug("couldn't get entry"); 767 printDebug("couldn't get entry");
759 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 768 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
760 return; 769 return;
761 } 770 }
762 if (KMessageBox:: 771 if (KMessageBox::
763 questionYesNo(this, 772 questionYesNo(this,
764 i18n 773 i18n
765 ("Do you really want to delete\nthe selected entry") + 774 ("Do you really want to delete\nthe selected entry") +
766 " \n\"" + QString(currItem.desc.c_str()) 775 " \n\"" + QString(currItem.desc.c_str())
767 + "\" ?", i18n("delete?")) 776 + "\" ?", i18n("delete?"))
768 == KMessageBox::Yes) { 777 == KMessageBox::Yes) {
769 778
770 curDoc()->delEntry(curCategory, curEntryIndex); 779 curDoc()->delEntry(curCategory, curEntryIndex);
771 } 780 }
772 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 781 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
773} 782}
774 783
775void PwM::changeMasterPwd_slot() 784void PwM::changeMasterPwd_slot()
776{ 785{
777 PWM_ASSERT(curDoc()); 786 PWM_ASSERT(curDoc());
778 curDoc()->changeCurrentPw(); 787 curDoc()->changeCurrentPw();
779} 788}
780 789
781void PwM::lockWnd_slot() 790void PwM::lockWnd_slot()
782{ 791{
783 PWM_ASSERT(curDoc()); 792 PWM_ASSERT(curDoc());
784 curDoc()->lockAll(true); 793 curDoc()->lockAll(true);
785} 794}
786 795
787void PwM::deepLockWnd_slot() 796void PwM::deepLockWnd_slot()
788{ 797{
789 PWM_ASSERT(curDoc()); 798 PWM_ASSERT(curDoc());
790 curDoc()->deepLock(); 799 curDoc()->deepLock();
791} 800}
792 801
793void PwM::unlockWnd_slot() 802void PwM::unlockWnd_slot()
794{ 803{
795 PWM_ASSERT(curDoc()); 804 PWM_ASSERT(curDoc());
796 curDoc()->lockAll(false); 805 curDoc()->lockAll(false);
797} 806}
798 807
799void PwM::config_slot() 808void PwM::config_slot()
800{ 809{
801 int oldStyle = conf()->confWndMainViewStyle(); 810 int oldStyle = conf()->confWndMainViewStyle();
802#ifdef PWM_EMBEDDED 811#ifdef PWM_EMBEDDED
803 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"pwmconfigdialog", true ); 812 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"pwmconfigdialog", true );
804 813
805 KCMPwmConfig* pwmcfg = new KCMPwmConfig( ConfigureDialog->getNewVBoxPage(i18n( "PwManager")) , "KCMPwmConfig" ); 814 KCMPwmConfig* pwmcfg = new KCMPwmConfig( ConfigureDialog->getNewVBoxPage(i18n( "PwManager")) , "KCMPwmConfig" );
806 ConfigureDialog->addModule(pwmcfg ); 815 ConfigureDialog->addModule(pwmcfg );
807 816
808 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 817 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
809 ConfigureDialog->addModule(kdelibcfg ); 818 ConfigureDialog->addModule(kdelibcfg );
810 819
811#ifndef DESKTOP_VERSION 820#ifndef DESKTOP_VERSION
812 ConfigureDialog->showMaximized(); 821 ConfigureDialog->showMaximized();
813#endif 822#endif
814 if ( ConfigureDialog->exec() ) 823 if ( ConfigureDialog->exec() )
815 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 824 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
816 delete ConfigureDialog; 825 delete ConfigureDialog;
817 826
818#else //PWM_EMBEDDED 827#else //PWM_EMBEDDED
819 // display the configuration window (modal mode) 828 // display the configuration window (modal mode)
820 if (!conf()->showConfWnd(this)) 829 if (!conf()->showConfWnd(this))
821 return; 830 return;
822#endif 831#endif
823 832
824 int newStyle = conf()->confWndMainViewStyle(); 833 int newStyle = conf()->confWndMainViewStyle();
825 // reinitialize tray 834 // reinitialize tray
826 init->initTray(); 835 init->initTray();
827 // reinitialize KWallet emulation 836 // reinitialize KWallet emulation
828 init->initKWalletEmu(); 837 init->initKWalletEmu();
829 838
830 PwMDocList *_dl = PwMDoc::getOpenDocList(); 839 PwMDocList *_dl = PwMDoc::getOpenDocList();
831 const vector<PwMDocList::listItem> *dl = _dl->getList(); 840 const vector<PwMDocList::listItem> *dl = _dl->getList();
832 vector<PwMDocList::listItem>::const_iterator i = dl->begin(), 841 vector<PwMDocList::listItem>::const_iterator i = dl->begin(),
833 end = dl->end(); 842 end = dl->end();
834 PwMDoc *doc; 843 PwMDoc *doc;
835 while (i != end) { 844 while (i != end) {
836 doc = (*i).doc; 845 doc = (*i).doc;
837 // unlock-without-mpw timeout 846 // unlock-without-mpw timeout
838 doc->timer()->start(DocTimer::id_mpwTimer); 847 doc->timer()->start(DocTimer::id_mpwTimer);
839 // auto-lock timeout 848 // auto-lock timeout
840 doc->timer()->start(DocTimer::id_autoLockTimer); 849 doc->timer()->start(DocTimer::id_autoLockTimer);
841 ++i; 850 ++i;
842 } 851 }
843 852
844 const QValueList<PwM *> *ml = init->mainWndList(); 853 const QValueList<PwM *> *ml = init->mainWndList();
845#ifndef PWM_EMBEDDED 854#ifndef PWM_EMBEDDED
846 QValueList<PwM *>::const_iterator i2 = ml->begin(), 855 QValueList<PwM *>::const_iterator i2 = ml->begin(),
847 end2 = ml->end(); 856 end2 = ml->end();
848#else 857#else
849 QValueList<PwM *>::ConstIterator i2 = ml->begin(), 858 QValueList<PwM *>::ConstIterator i2 = ml->begin(),
850 end2 = ml->end(); 859 end2 = ml->end();
851#endif 860#endif
852 PwM *pwm; 861 PwM *pwm;
853 while (i2 != end2) { 862 while (i2 != end2) {
854 pwm = *i2; 863 pwm = *i2;
855 // reinitialize the window style. 864 // reinitialize the window style.
856 if (oldStyle != newStyle) 865 if (oldStyle != newStyle)
857 pwm->curView()->initStyle(newStyle); 866 pwm->curView()->initStyle(newStyle);
858 // set the new font 867 // set the new font
859 pwm->curView()->setFont(conf()->confGlobEntryFont()); 868 pwm->curView()->setFont(conf()->confGlobEntryFont());
860 ++i2; 869 ++i2;
861 } 870 }
862} 871}
863 872
864void PwM::activateMpButton(bool activate) 873void PwM::activateMpButton(bool activate)
865{ 874{
866 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate); 875 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate);
867} 876}
868 877
869void PwM::closeEvent(QCloseEvent *e) 878void PwM::closeEvent(QCloseEvent *e)
870{ 879{
871 e->accept(); 880 e->accept();
872} 881}
873 882
874void PwM::docClosed(PwMDoc *doc) 883void PwM::docClosed(PwMDoc *doc)
875{ 884{
876 PARAM_UNUSED(doc); 885 PARAM_UNUSED(doc);
877 PWM_ASSERT(doc == curDoc()); 886 PWM_ASSERT(doc == curDoc());
878 close(); 887 close();
879} 888}
880 889
881void PwM::find_slot() 890void PwM::find_slot()
882{ 891{
883 PWM_ASSERT(curDoc()); 892 PWM_ASSERT(curDoc());
884 if (curDoc()->isDocEmpty()) 893 if (curDoc()->isDocEmpty())
885 return; 894 return;
886 if (curDoc()->isDeepLocked()) 895 if (curDoc()->isDeepLocked())
887 return; 896 return;
888 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 897 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
889 FindWndImpl findWnd(view); 898 FindWndImpl findWnd(view);
890 findWnd.exec(); 899 findWnd.exec();
891 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 900 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
892} 901}
893 902
894void PwM::exportToText() 903void PwM::exportToText()
895{ 904{
896 PWM_ASSERT(curDoc()); 905 PWM_ASSERT(curDoc());
897 if (curDoc()->isDocEmpty()) { 906 if (curDoc()->isDocEmpty()) {
898 KMessageBox::information(this, 907 KMessageBox::information(this,
899 i18n 908 i18n
900 ("Sorry, there's nothing to export.\n" 909 ("Sorry, there's nothing to export.\n"
901 "Please first add some passwords."), 910 "Please first add some passwords."),
902 i18n("nothing to do")); 911 i18n("nothing to do"));
903 return; 912 return;
904 } 913 }
905 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 914 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
906 QString fn(KFileDialog::getSaveFileName(QString::null, 915 QString fn(KFileDialog::getSaveFileName(QString::null,
907 i18n("*|plain-text file"), 916 i18n("*|plain-text file"),
908 this)); 917 this));
909 if (fn == "") { 918 if (fn == "") {
910 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 919 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
911 return; 920 return;
912 } 921 }
913 922
914 PwMerror ret = curDoc()->exportToText(&fn); 923 PwMerror ret = curDoc()->exportToText(&fn);
915 if (ret != e_success) { 924 if (ret != e_success) {
916 KMessageBox::error(this, 925 KMessageBox::error(this,
917 i18n("Error: Couldn't write to file.\n" 926 i18n("Error: Couldn't write to file.\n"
918 "Please check if you have permission to write\n" 927 "Please check if you have permission to write\n"
919 "to the file in that directory."), 928 "to the file in that directory."),
920 i18n("error while writing")); 929 i18n("error while writing"));
921 } else 930 } else
922 showStatMsg(i18n("Successfully exported data.")); 931 showStatMsg(i18n("Successfully exported data."));
923 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 932 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
924} 933}
925 934
926bool PwM::importFromText() 935bool PwM::importFromText()
927{ 936{
928 if (!isVirgin()) { 937 if (!isVirgin()) {
929 if (KMessageBox::questionYesNo(this, 938 if (KMessageBox::questionYesNo(this,
930 i18n("Do you want to import the data\n" 939 i18n("Do you want to import the data\n"
931 "into the current document? (If you\n" 940 "into the current document? (If you\n"
932 "select \"no\", a new document will be\n" 941 "select \"no\", a new document will be\n"
933 "opened.)"), 942 "opened.)"),
934 i18n("import into this document?")) 943 i18n("import into this document?"))
935 == KMessageBox::No) { 944 == KMessageBox::No) {
936 // import the data to a new window. 945 // import the data to a new window.
937 PwM *newInstance = init->createMainWnd(); 946 PwM *newInstance = init->createMainWnd();
938 bool ok = newInstance->importFromText(); 947 bool ok = newInstance->importFromText();
939 if (!ok) { 948 if (!ok) {
940 newInstance->setForceQuit(true); 949 newInstance->setForceQuit(true);
941 delete_and_null(newInstance); 950 delete_and_null(newInstance);
942 } 951 }
943 return ok; 952 return ok;
944 } 953 }
945 } 954 }
946 955
947 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 956 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
948 PwMerror ret; 957 PwMerror ret;
949 QString path(KFileDialog::getOpenFileName(QString::null, 958 QString path(KFileDialog::getOpenFileName(QString::null,
950 i18n("*|PWM-exported text file"), 959 i18n("*|PWM-exported text file"),
951 this)); 960 this));
952 if (path == "") 961 if (path == "")
953 goto cancelImport; 962 goto cancelImport;
954 963
955 ret = curDoc()->importFromText(&path, 0); 964 ret = curDoc()->importFromText(&path, 0);
956 if (ret == e_fileFormat) { 965 if (ret == e_fileFormat) {
957 KMessageBox::error(this, 966 KMessageBox::error(this,
958 i18n("Could not read file-format.\n" 967 i18n("Could not read file-format.\n"
959 "This seems to be _not_ a valid file\n" 968 "This seems to be _not_ a valid file\n"
960 "exported by PwM."), 969 "exported by PwM."),
961 i18n("invalid file-format")); 970 i18n("invalid file-format"));
962 goto cancelImport; 971 goto cancelImport;
963 } else if (ret == e_invalidArg) { 972 } else if (ret == e_invalidArg) {
964 BUG(); 973 BUG();
965 goto cancelImport; 974 goto cancelImport;
966 } else if (ret != e_success) { 975 } else if (ret != e_success) {
967 KMessageBox::error(this, 976 KMessageBox::error(this,
968 i18n("Could not import file!\n" 977 i18n("Could not import file!\n"
969 "Do you have permission to read this file?\n" 978 "Do you have permission to read this file?\n"
970 "Do you have enough free memory?"), 979 "Do you have enough free memory?"),
971 i18n("import failed")); 980 i18n("import failed"));
972 goto cancelImport; 981 goto cancelImport;
973 } 982 }
974 setVirgin(false); 983 setVirgin(false);
975 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 984 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
976 return true; 985 return true;
977 986
978cancelImport: 987cancelImport:
979 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 988 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
980 return false; 989 return false;
981} 990}
982 991
983void PwM::exportToGpasman() 992void PwM::exportToGpasman()
984{ 993{
985 PWM_ASSERT(curDoc()); 994 PWM_ASSERT(curDoc());
986 if (curDoc()->isDocEmpty()) { 995 if (curDoc()->isDocEmpty()) {
987 KMessageBox::information(this, 996 KMessageBox::information(this,
988 i18n 997 i18n
989 ("Sorry, there's nothing to export.\n" 998 ("Sorry, there's nothing to export.\n"
990 "Please first add some passwords."), 999 "Please first add some passwords."),
991 i18n("nothing to do")); 1000 i18n("nothing to do"));
992 return; 1001 return;
993 } 1002 }
994 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1003 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
995 QString fn(KFileDialog::getSaveFileName(QString::null, 1004 QString fn(KFileDialog::getSaveFileName(QString::null,
996 i18n("*|Gpasman or Kpasman file"), 1005 i18n("*|Gpasman or Kpasman file"),
997 this)); 1006 this));
998 if (fn == "") { 1007 if (fn == "") {
999 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1008 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1000 return; 1009 return;
1001 } 1010 }
1002 1011
1003 PwMerror ret = curDoc()->exportToGpasman(&fn); 1012 PwMerror ret = curDoc()->exportToGpasman(&fn);
1004 if (ret != e_success) { 1013 if (ret != e_success) {
1005 if (ret == e_noPw) { 1014 if (ret == e_noPw) {
1006 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1015 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1007 return; 1016 return;
1008 } 1017 }
1009 KMessageBox::error(this, 1018 KMessageBox::error(this,
1010 i18n("Error: Couldn't write to file.\n" 1019 i18n("Error: Couldn't write to file.\n"
1011 "Please check if you have permission to write " 1020 "Please check if you have permission to write "
1012 "to the file in that directory."), 1021 "to the file in that directory."),
1013 i18n("error while writing")); 1022 i18n("error while writing"));
1014 } else 1023 } else
1015 showStatMsg(i18n("Successfully exported data.")); 1024 showStatMsg(i18n("Successfully exported data."));
1016 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1025 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1017} 1026}
1018 1027
1028
1029
1030void PwM::exportToCsv()
1031{
1032 PWM_ASSERT(curDoc());
1033 if (curDoc()->isDocEmpty()) {
1034 KMessageBox::information(this,
1035 i18n
1036 ("Sorry, there is nothing to export;\n"
1037 "please add some passwords first."),
1038 i18n("Nothing to Do"));
1039 return;
1040 }
1041
1042 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1043 QString fn(KFileDialog::getSaveFileName("*.csv", i18n("*|CSV Text File"), this));
1044 if (fn.isEmpty()) {
1045 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1046 return;
1047 }
1048
1049 Csv csv(this);
1050 if (!csv.exportData(fn, curDoc())) {
1051 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1052 showStatMsg(i18n("CSV file export failed."));
1053 return;
1054 }
1055 showStatMsg(i18n("Successfully exported data."));
1056 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1057}
1058
1059bool PwM::importCsv()
1060{
1061 Csv csv(this);
1062 if (!isVirgin()) {
1063 if (KMessageBox::questionYesNo(this,
1064 i18n("Do you want to import the data\n"
1065 "into the current document? (If you\n"
1066 "select \"no\", a new document will be\n"
1067 "opened.)"),
1068 i18n("Import into This Document?"))
1069 == KMessageBox::No) {
1070 // import the data to a new window.
1071 PwM *newInstance = init->createMainWnd();
1072 bool ok = newInstance->importCsv();
1073 if (!ok) {
1074 newInstance->setForceQuit(true);
1075 delete_and_null(newInstance);
1076 }
1077 return ok;
1078 }
1079 }
1080
1081 QString filename = KFileDialog::getOpenFileName("*.csv", i18n("*|CSV Text File"), this);
1082 if (filename.isEmpty())
1083 return false;
1084 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1085 if (!csv.importData(filename, curDoc())) {
1086 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1087 showStatMsg(i18n("CSV file import failed."));
1088 return false;
1089 }
1090 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1091 KMessageBox::information(this,
1092 i18n("Successfully imported the CSV data\n"
1093 "into the current document."), i18n("Successfully Imported"));
1094 showStatMsg(i18n("Successfully imported"));
1095 setVirgin(false);
1096 return true;
1097}
1098
1099
1019void PwM::exportToKWallet() 1100void PwM::exportToKWallet()
1020{ 1101{
1021#ifdef CONFIG_KWALLETIF 1102#ifdef CONFIG_KWALLETIF
1022 if (!checkAndAskForKWalletEmu()) 1103 if (!checkAndAskForKWalletEmu())
1023 return; 1104 return;
1024 PWM_ASSERT(curDoc()); 1105 PWM_ASSERT(curDoc());
1025 if (curDoc()->isDocEmpty()) { 1106 if (curDoc()->isDocEmpty()) {
1026 KMessageBox::information(this, 1107 KMessageBox::information(this,
1027 i18n 1108 i18n
1028 ("Sorry, there's nothing to export.\n" 1109 ("Sorry, there's nothing to export.\n"
1029 "Please first add some passwords."), 1110 "Please first add some passwords."),
1030 i18n("nothing to do")); 1111 i18n("nothing to do"));
1031 init->initKWalletEmu(); 1112 init->initKWalletEmu();
1032 return; 1113 return;
1033 } 1114 }
1034 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1115 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1035 KWalletIf walletIf(this); 1116 KWalletIf walletIf(this);
1036 if (walletIf.kwalletExport(curDoc())) { 1117 if (walletIf.kwalletExport(curDoc())) {
1037 KMessageBox::information(this, 1118 KMessageBox::information(this,
1038 i18n("Successfully exported the data of the current " 1119 i18n("Successfully exported the data of the current "
1039 "document to KWallet."), 1120 "document to KWallet."),
1040 i18n("Successfully exported data.")); 1121 i18n("Successfully exported data."));
1041 showStatMsg(i18n("Successfully exported data.")); 1122 showStatMsg(i18n("Successfully exported data."));
1042 } 1123 }
1043 init->initKWalletEmu(); 1124 init->initKWalletEmu();
1044 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1125 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1045#endif // CONFIG_KWALLETIF 1126#endif // CONFIG_KWALLETIF
1046} 1127}
1047 1128
1048bool PwM::importFromGpasman() 1129bool PwM::importFromGpasman()
1049{ 1130{
1050 if (!isVirgin()) { 1131 if (!isVirgin()) {
1051 if (KMessageBox::questionYesNo(this, 1132 if (KMessageBox::questionYesNo(this,
1052 i18n("Do you want to import the data\n" 1133 i18n("Do you want to import the data\n"
1053 "into the current document? (If you\n" 1134 "into the current document? (If you\n"
1054 "select \"no\", a new document will be\n" 1135 "select \"no\", a new document will be\n"
1055 "opened.)"), 1136 "opened.)"),
1056 i18n("import into this document?")) 1137 i18n("import into this document?"))
1057 == KMessageBox::No) { 1138 == KMessageBox::No) {
1058 // import the data to a new window. 1139 // import the data to a new window.
1059 PwM *newInstance = init->createMainWnd(); 1140 PwM *newInstance = init->createMainWnd();
1060 bool ok = newInstance->importFromGpasman(); 1141 bool ok = newInstance->importFromGpasman();
1061 if (!ok) { 1142 if (!ok) {
1062 newInstance->setForceQuit(true); 1143 newInstance->setForceQuit(true);
1063 delete_and_null(newInstance); 1144 delete_and_null(newInstance);
1064 } 1145 }
1065 return ok; 1146 return ok;
1066 } 1147 }
1067 } 1148 }
1068 1149
1069 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1150 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1070 PwMerror ret; 1151 PwMerror ret;
1071 QString path(KFileDialog::getOpenFileName(QString::null, 1152 QString path(KFileDialog::getOpenFileName(QString::null,
1072 i18n("*|Gpasman or Kpasman file"), this)); 1153 i18n("*|Gpasman or Kpasman file"), this));
1073 if (path == "") 1154 if (path == "")
1074 goto cancelImport; 1155 goto cancelImport;
1075 ret = curDoc()->importFromGpasman(&path); 1156 ret = curDoc()->importFromGpasman(&path);
1076 if (ret == e_wrongPw) { 1157 if (ret == e_wrongPw) {
1077 if (KMessageBox::questionYesNo(this, 1158 if (KMessageBox::questionYesNo(this,
1078 i18n 1159 i18n
1079 ("This is probably the wrong master-password\n" 1160 ("This is probably the wrong master-password\n"
1080 "you have typed in.\n" 1161 "you have typed in.\n"
1081 "There is no real way to determine the\n" 1162 "There is no real way to determine the\n"
1082 "correctness of the password in the Gpasman\n" 1163 "correctness of the password in the Gpasman\n"
1083 "file-format. But I think this\n" 1164 "file-format. But I think this\n"
1084 "password ist wrong.\n" 1165 "password ist wrong.\n"
1085 "Do you want to continue nevertheless?"), 1166 "Do you want to continue nevertheless?"),
1086 i18n("password error")) 1167 i18n("password error"))
1087 == KMessageBox::No) { 1168 == KMessageBox::No) {
1088 goto cancelImport; 1169 goto cancelImport;
1089 } 1170 }
1090 } else if (ret != e_success) { 1171 } else if (ret != e_success) {
1091 KMessageBox::error(this, 1172 KMessageBox::error(this,
1092 i18n("Could not import file!\n" 1173 i18n("Could not import file!\n"
1093 "Do you have permission to read this file?"), 1174 "Do you have permission to read this file?"),
1094 i18n("import failed")); 1175 i18n("import failed"));
1095 goto cancelImport; 1176 goto cancelImport;
1096 } 1177 }
1097 setVirgin(false); 1178 setVirgin(false);
1098 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1179 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1099 return true; 1180 return true;
1100 1181
1101cancelImport: 1182cancelImport:
1102 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1183 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1103 return false; 1184 return false;
1104} 1185}
1105 1186
1106#ifdef CONFIG_KWALLETIF 1187#ifdef CONFIG_KWALLETIF
1107bool PwM::checkAndAskForKWalletEmu() 1188bool PwM::checkAndAskForKWalletEmu()
1108{ 1189{
1109 if (init->kwalletEmu()) { 1190 if (init->kwalletEmu()) {
1110 /* KWallet emulation is enabled. We can't import/export 1191 /* KWallet emulation is enabled. We can't import/export
1111 * data from/to it, while emulation is active. 1192 * data from/to it, while emulation is active.
1112 */ 1193 */
1113 if (KMessageBox::questionYesNo(this, 1194 if (KMessageBox::questionYesNo(this,
1114 i18n("KWallet emulation is enabled.\n" 1195 i18n("KWallet emulation is enabled.\n"
1115 "You can't import or export data from/to " 1196 "You can't import or export data from/to "
1116 "the original KWallet, while the emulation " 1197 "the original KWallet, while the emulation "
1117 "is active.\n" 1198 "is active.\n"
1118 "Do you want to tempoarly disable the KWallet emulation?"), 1199 "Do you want to tempoarly disable the KWallet emulation?"),
1119 i18n("Tempoarly disable KWallet emulation?")) 1200 i18n("Tempoarly disable KWallet emulation?"))
1120 == KMessageBox::Yes) { 1201 == KMessageBox::Yes) {
1121 init->initKWalletEmu(true); 1202 init->initKWalletEmu(true);
1122 PWM_ASSERT(!init->kwalletEmu()); 1203 PWM_ASSERT(!init->kwalletEmu());
1123 return true; 1204 return true;
1124 } 1205 }
1125 return false; 1206 return false;
1126 } 1207 }
1127 return true; 1208 return true;
1128} 1209}
1129#endif // CONFIG_KWALLETIF 1210#endif // CONFIG_KWALLETIF
1130 1211
1131bool PwM::importKWallet() 1212bool PwM::importKWallet()
1132{ 1213{
1133#ifdef CONFIG_KWALLETIF 1214#ifdef CONFIG_KWALLETIF
1134 if (!checkAndAskForKWalletEmu()) 1215 if (!checkAndAskForKWalletEmu())
1135 return false; 1216 return false;
1136 KWalletIf walletIf(this); 1217 KWalletIf walletIf(this);
1137 if (!isVirgin()) { 1218 if (!isVirgin()) {
1138 if (KMessageBox::questionYesNo(this, 1219 if (KMessageBox::questionYesNo(this,
1139 i18n("Do you want to import the data " 1220 i18n("Do you want to import the data "
1140 "into the current document? (If you " 1221 "into the current document? (If you "
1141 "select \"no\", a new document will be " 1222 "select \"no\", a new document will be "
1142 "opened.)"), 1223 "opened.)"),
1143 i18n("import into this document?")) 1224 i18n("import into this document?"))
1144 == KMessageBox::No) { 1225 == KMessageBox::No) {
1145 // import the data to a new window. 1226 // import the data to a new window.
1146 PwM *newInstance = init->createMainWnd(); 1227 PwM *newInstance = init->createMainWnd();
1147 bool ok = newInstance->importKWallet(); 1228 bool ok = newInstance->importKWallet();
1148 if (!ok) { 1229 if (!ok) {
1149 newInstance->setForceQuit(true); 1230 newInstance->setForceQuit(true);
1150 delete_and_null(newInstance); 1231 delete_and_null(newInstance);
1151 goto exit_fail; 1232 goto exit_fail;
1152 } else { 1233 } else {
1153 goto exit_ok; 1234 goto exit_ok;
1154 } 1235 }
1155 } 1236 }
1156 } 1237 }
1157 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1238 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1158 if (!walletIf.kwalletImport(curDoc())) { 1239 if (!walletIf.kwalletImport(curDoc())) {
1159 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1240 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1160 showStatMsg(i18n("KWallet import failed")); 1241 showStatMsg(i18n("KWallet import failed"));
1161 goto exit_fail; 1242 goto exit_fail;
1162 } 1243 }
1163 KMessageBox::information(this, 1244 KMessageBox::information(this,
1164 i18n("Successfully imported the KWallet data " 1245 i18n("Successfully imported the KWallet data "
1165 "into the current document."), 1246 "into the current document."),
1166 i18n("successfully imported")); 1247 i18n("successfully imported"));
1167 showStatMsg(i18n("successfully imported")); 1248 showStatMsg(i18n("successfully imported"));
1168 setVirgin(false); 1249 setVirgin(false);
1169 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1250 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1170 1251
1171exit_ok: 1252exit_ok:
1172 init->initKWalletEmu(); 1253 init->initKWalletEmu();
1173 return true; 1254 return true;
1174 1255
1175exit_fail: 1256exit_fail:
1176 init->initKWalletEmu(); 1257 init->initKWalletEmu();
1177#endif // CONFIG_KWALLETIF 1258#endif // CONFIG_KWALLETIF
1178 return false; 1259 return false;
1179} 1260}
1180 1261
1181void PwM::print_slot() 1262void PwM::print_slot()
1182{ 1263{
1183 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1264 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1184#ifndef PWM_EMBEDDED 1265#ifndef PWM_EMBEDDED
1185 PwMPrint p(curDoc(), this); 1266 PwMPrint p(curDoc(), this);
1186 p.printNow(); 1267 p.printNow();
1187#else 1268#else
1188 qDebug("PwM::print_slot , PRINTING IS NOT IMPLEMENTED"); 1269 qDebug("PwM::print_slot , PRINTING IS NOT IMPLEMENTED");
1189#endif 1270#endif
1190 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1271 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1191} 1272}
1192 1273
1193void PwM::genNewCard_slot() 1274void PwM::genNewCard_slot()
1194{ 1275{
1195#ifdef CONFIG_KEYCARD 1276#ifdef CONFIG_KEYCARD
1196 init->keycard()->genNewCard(); 1277 init->keycard()->genNewCard();
1197#endif 1278#endif
1198} 1279}
1199 1280
1200void PwM::eraseCard_slot() 1281void PwM::eraseCard_slot()
1201{ 1282{
1202#ifdef CONFIG_KEYCARD 1283#ifdef CONFIG_KEYCARD
1203 init->keycard()->eraseCard(); 1284 init->keycard()->eraseCard();
1204#endif 1285#endif
1205} 1286}
1206 1287
1207void PwM::readCardId_slot() 1288void PwM::readCardId_slot()
1208{ 1289{
1209#ifdef CONFIG_KEYCARD 1290#ifdef CONFIG_KEYCARD
1210 init->keycard()->displayKey(); 1291 init->keycard()->displayKey();
1211#endif 1292#endif
1212} 1293}
1213 1294
1214void PwM::makeCardBackup_slot() 1295void PwM::makeCardBackup_slot()
1215{ 1296{
1216#ifdef CONFIG_KEYCARD 1297#ifdef CONFIG_KEYCARD
1217 init->keycard()->makeBackupImage(); 1298 init->keycard()->makeBackupImage();
1218#endif 1299#endif
1219} 1300}
1220 1301
1221void PwM::replayCardBackup_slot() 1302void PwM::replayCardBackup_slot()
1222{ 1303{
1223#ifdef CONFIG_KEYCARD 1304#ifdef CONFIG_KEYCARD
1224 init->keycard()->replayBackupImage(); 1305 init->keycard()->replayBackupImage();
1225#endif 1306#endif
1226} 1307}
1227 1308
1228void PwM::execLauncher_slot() 1309void PwM::execLauncher_slot()
1229{ 1310{
1230 PWM_ASSERT(curDoc()); 1311 PWM_ASSERT(curDoc());
1231 if (curDoc()->isDeepLocked()) 1312 if (curDoc()->isDeepLocked())
1232 return; 1313 return;
1233 unsigned int curEntryIndex; 1314 unsigned int curEntryIndex;
1234 if (!view->getCurEntryIndex(&curEntryIndex)) 1315 if (!view->getCurEntryIndex(&curEntryIndex))
1235 return; 1316 return;
1236 bool ret = curDoc()->execLauncher(view->getCurrentCategory(), 1317 bool ret = curDoc()->execLauncher(view->getCurrentCategory(),
1237 curEntryIndex); 1318 curEntryIndex);
1238 if (ret) 1319 if (ret)
1239 showStatMsg(i18n("Executed the \"Launcher\".")); 1320 showStatMsg(i18n("Executed the \"Launcher\"."));
1240 else 1321 else
1241 showStatMsg(i18n("ERROR: Couldn't execute the \"Launcher\"!")); 1322 showStatMsg(i18n("ERROR: Couldn't execute the \"Launcher\"!"));
1242} 1323}
1243 1324
1244void PwM::goToURL_slot() 1325void PwM::goToURL_slot()
1245{ 1326{
1246 PWM_ASSERT(curDoc()); 1327 PWM_ASSERT(curDoc());
1247 if (curDoc()->isDeepLocked()) 1328 if (curDoc()->isDeepLocked())
1248 return; 1329 return;
1249 unsigned int curEntryIndex; 1330 unsigned int curEntryIndex;
1250 if (!view->getCurEntryIndex(&curEntryIndex)) 1331 if (!view->getCurEntryIndex(&curEntryIndex))
1251 return; 1332 return;
1252 bool ret = curDoc()->goToURL(view->getCurrentCategory(), 1333 bool ret = curDoc()->goToURL(view->getCurrentCategory(),
1253 curEntryIndex); 1334 curEntryIndex);
1254 if (ret) 1335 if (ret)
1255 showStatMsg(i18n("started browser with current URL.")); 1336 showStatMsg(i18n("started browser with current URL."));
1256 else 1337 else
1257 showStatMsg(i18n("ERROR: Couldn't start browser! Maybe invalid URL?")); 1338 showStatMsg(i18n("ERROR: Couldn't start browser! Maybe invalid URL?"));
1258} 1339}
1259 1340
1260void PwM::copyToClipboard(const QString &s) 1341void PwM::copyToClipboard(const QString &s)
1261{ 1342{
1262 QClipboard *cb = QApplication::clipboard(); 1343 QClipboard *cb = QApplication::clipboard();
1263#ifndef PWM_EMBEDDED 1344#ifndef PWM_EMBEDDED
1264 if (cb->supportsSelection()) 1345 if (cb->supportsSelection())
1265 cb->setText(s, QClipboard::Selection); 1346 cb->setText(s, QClipboard::Selection);
1266 cb->setText(s, QClipboard::Clipboard); 1347 cb->setText(s, QClipboard::Clipboard);
1267#else 1348#else
1268 cb->setText(s); 1349 cb->setText(s);
1269 1350
1270#endif 1351#endif
1271 1352
1272} 1353}
1273 1354
1274void PwM::showStatMsg(const QString &msg) 1355void PwM::showStatMsg(const QString &msg)
1275{ 1356{
1276#ifndef PWM_EMBEDDED 1357#ifndef PWM_EMBEDDED
1277 KStatusBar *statBar = statusBar(); 1358 KStatusBar *statBar = statusBar();
1278 statBar->message(msg, STATUSBAR_MSG_TIMEOUT * 1000); 1359 statBar->message(msg, STATUSBAR_MSG_TIMEOUT * 1000);
1279#else 1360#else
1280 qDebug("Statusbar : %s",msg.latin1()); 1361 qDebug("Statusbar : %s",msg.latin1());
1281#endif 1362#endif
1282} 1363}
1283 1364
1284void PwM::focusInEvent(QFocusEvent *e) 1365void PwM::focusInEvent(QFocusEvent *e)
1285{ 1366{
1286 if (e->gotFocus()) { 1367 if (e->gotFocus()) {
1287 emit gotFocus(this); 1368 emit gotFocus(this);
1288 } else if (e->lostFocus()) { 1369 } else if (e->lostFocus()) {
1289 emit lostFocus(this); 1370 emit lostFocus(this);
1290 } 1371 }
1291} 1372}
1292 1373
1293 1374
1294#ifdef PWM_EMBEDDED 1375#ifdef PWM_EMBEDDED
1295 1376
1296void PwM::whatsnew_slot() 1377void PwM::whatsnew_slot()
1297{ 1378{
1298 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1379 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1299} 1380}
1300 1381
1301void PwM::showLicense_slot() 1382void PwM::showLicense_slot()
1302{ 1383{
1303 KApplication::showLicence(); 1384 KApplication::showLicence();
1304} 1385}
1305 1386
1306void PwM::faq_slot() 1387void PwM::faq_slot()
1307{ 1388{
1308 KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" ); 1389 KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" );
1309} 1390}
1310 1391
1311void PwM::syncHowTo_slot() 1392void PwM::syncHowTo_slot()
1312{ 1393{
1313 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1394 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1314} 1395}
1315 1396
1316 1397
1317void PwM::createAboutData_slot() 1398void PwM::createAboutData_slot()
1318{ 1399{
1319 QString version; 1400 QString version;
1320#include <../version> 1401#include <../version>
1321 QMessageBox::about( this, "About PwManager/Pi", 1402 QMessageBox::about( this, "About PwManager/Pi",
1322 "PwManager/Platform-independent\n" 1403 "PwManager/Platform-independent\n"
1323 "(PWM/Pi) " +version + " - " + 1404 "(PWM/Pi) " +version + " - " +
1324#ifdef DESKTOP_VERSION 1405#ifdef DESKTOP_VERSION
1325 "Desktop Edition\n" 1406 "Desktop Edition\n"
1326#else 1407#else
1327 "PDA-Edition\n" 1408 "PDA-Edition\n"
1328 "for: Zaurus 5500 / 7x0 / 8x0\n" 1409 "for: Zaurus 5500 / 7x0 / 8x0\n"
1329#endif 1410#endif
1330 1411
1331 "(c) 2004 Ulf Schenk\n" 1412 "(c) 2004 Ulf Schenk\n"
1332 "(c) 2004 Lutz Rogowski\n" 1413 "(c) 2004 Lutz Rogowski\n"
1333 "(c) 1997-2004, The KDE PIM Team\n" 1414 "(c) 1997-2004, The KDE PIM Team\n"
1334 1415
1335 "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n" 1416 "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n"
1336 "Matt Scifo - mscifo@o1.com\n" 1417 "Matt Scifo - mscifo@o1.com\n"
1337 "Elias Probst - elias.probst@gmx.de\n" 1418 "Elias Probst - elias.probst@gmx.de\n"
1338 "George Staikos - staikos@kde.org\n" 1419 "George Staikos - staikos@kde.org\n"
1339 "Matthew Palmer - mjp16@uow.edu.au\n" 1420 "Matthew Palmer - mjp16@uow.edu.au\n"
1340 "Olivier Sessink - gpasman@nl.linux.org\n" 1421 "Olivier Sessink - gpasman@nl.linux.org\n"
1341 "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" 1422 "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n"
1342 "Troy Engel - tengel@sonic.net\n" 1423 "Troy Engel - tengel@sonic.net\n"
1343 "Wickey - wickey@gmx.at\n" 1424 "Wickey - wickey@gmx.at\n"
1344 "Ian MacGregor - original documentation author.\n" 1425 "Ian MacGregor - original documentation author.\n"
1345 ); 1426 );
1346} 1427}
1347 1428
1348 1429
1349//this are the overwritten callbackmethods from the syncinterface 1430//this are the overwritten callbackmethods from the syncinterface
1350bool PwM::sync(KSyncManager* manager, QString filename, int mode) 1431bool PwM::sync(KSyncManager* manager, QString filename, int mode)
1351{ 1432{
1352 PWM_ASSERT(curDoc()); 1433 PWM_ASSERT(curDoc());
1353 1434
1354 bool ret = curDoc()->sync(manager, filename, mode); 1435 bool ret = curDoc()->sync(manager, filename, mode);
1355 1436
1356 qDebug("PwM::sync save now: ret=%i", ret); 1437 qDebug("PwM::sync save now: ret=%i", ret);
1357 1438
1358 if (ret == true) { 1439 if (ret == true) {
1359 //US BUG: what can we call here to update the view of the current doc? 1440 //US BUG: what can we call here to update the view of the current doc?
1360 //mViewManager->refreshView(); 1441 //mViewManager->refreshView();
1361 1442
1362 //US curDoc()->sync sets the dirtyFlag in case the sync was successfull. 1443 //US curDoc()->sync sets the dirtyFlag in case the sync was successfull.
1363 save(); 1444 save();
1364 } 1445 }
1365 1446
1366 return ret; 1447 return ret;
1367} 1448}
1368#endif 1449#endif
1369 1450
1370 1451
1371#ifndef PWM_EMBEDDED 1452#ifndef PWM_EMBEDDED
1372#include "pwm.moc" 1453#include "pwm.moc"
1373#endif 1454#endif
diff --git a/pwmanager/pwmanager/pwm.h b/pwmanager/pwmanager/pwm.h
index 6ab9d6b..5822d59 100644
--- a/pwmanager/pwmanager/pwm.h
+++ b/pwmanager/pwmanager/pwm.h
@@ -1,293 +1,297 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2003, 2004 by Michael Buesch * 3 * copyright (C) 2003, 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#ifndef __PWM_H 20#ifndef __PWM_H
21#define __PWM_H 21#define __PWM_H
22 22
23 23
24#include <kpopupmenu.h> 24#include <kpopupmenu.h>
25#include <klistview.h> 25#include <klistview.h>
26#include <kmainwindow.h> 26#include <kmainwindow.h>
27 27
28#ifndef PWM_EMBEDDED 28#ifndef PWM_EMBEDDED
29#include <kwin.h> 29#include <kwin.h>
30#include <kapp.h> 30#include <kapp.h>
31#include <kdeversion.h> 31#include <kdeversion.h>
32#else 32#else
33#include <ksyncmanager.h> 33#include <ksyncmanager.h>
34#endif 34#endif
35 35
36#include <kaction.h> 36#include <kaction.h>
37 37
38#include <qglobal.h> 38#include <qglobal.h>
39 39
40#include "pwmview.h" 40#include "pwmview.h"
41#include "pwmexception.h" 41#include "pwmexception.h"
42 42
43 43
44/** timeout for displaying a message on the status-bar (in seconds) */ 44/** timeout for displaying a message on the status-bar (in seconds) */
45 #define STATUSBAR_MSG_TIMEOUT5 45 #define STATUSBAR_MSG_TIMEOUT5
46 46
47 47
48class PwMInit; 48class PwMInit;
49class KSyncManager; 49class KSyncManager;
50 50
51/** PwM is the base class of the project */ 51/** PwM is the base class of the project */
52#ifndef PWM_EMBEDDED 52#ifndef PWM_EMBEDDED
53//MOC_SKIP_BEGIN 53//MOC_SKIP_BEGIN
54class PwM : public KMainWindow 54class PwM : public KMainWindow
55//MOC_SKIP_END 55//MOC_SKIP_END
56#else 56#else
57class PwM : public KMainWindow, public KSyncInterface 57class PwM : public KMainWindow, public KSyncInterface
58#endif 58#endif
59{ 59{
60 Q_OBJECT 60 Q_OBJECT
61public: 61public:
62 friend class PwMView; 62 friend class PwMView;
63 /** construtor */ 63 /** construtor */
64 PwM(PwMInit *_init, PwMDoc *doc, 64 PwM(PwMInit *_init, PwMDoc *doc,
65 bool virginity = true, 65 bool virginity = true,
66 QWidget* parent = 0, const char *name = 0); 66 QWidget* parent = 0, const char *name = 0);
67 /** destructor */ 67 /** destructor */
68 ~PwM(); 68 ~PwM();
69 69
70 /** copy some text to the global clipboard */ 70 /** copy some text to the global clipboard */
71 static void copyToClipboard(const QString &s); 71 static void copyToClipboard(const QString &s);
72 72
73 /** returns pointer to the view */ 73 /** returns pointer to the view */
74 PwMView * curView() 74 PwMView * curView()
75 { return view; } 75 { return view; }
76 /** returns pointer to the currently using document. */ 76 /** returns pointer to the currently using document. */
77 PwMDoc * curDoc() 77 PwMDoc * curDoc()
78 { return curView()->document(); } 78 { return curView()->document(); }
79 /** open a new doc with the given filename */ 79 /** open a new doc with the given filename */
80 PwMDoc * openDoc(QString filename, bool openDeepLocked = false); 80 PwMDoc * openDoc(QString filename, bool openDeepLocked = false);
81 /** show a message on the global status bar. 81 /** show a message on the global status bar.
82 * The message times out after some seconds. 82 * The message times out after some seconds.
83 */ 83 */
84 void showStatMsg(const QString &msg); 84 void showStatMsg(const QString &msg);
85 /** ask the user where to save the doc (if it has not been saved, yet) 85 /** ask the user where to save the doc (if it has not been saved, yet)
86 * and write the data to disk. 86 * and write the data to disk.
87 */ 87 */
88 bool save(); 88 bool save();
89 /** ask the user where to save the doc 89 /** ask the user where to save the doc
90 * and write the data to disk. 90 * and write the data to disk.
91 */ 91 */
92 bool saveAs(); 92 bool saveAs();
93 /** force quit. Quit this window, always! Don't minimize it */ 93 /** force quit. Quit this window, always! Don't minimize it */
94 bool isForceQuit() 94 bool isForceQuit()
95 { return forceQuit; } 95 { return forceQuit; }
96 /** set forceQuit */ 96 /** set forceQuit */
97 void setForceQuit(bool force) 97 void setForceQuit(bool force)
98 { forceQuit = force; } 98 { forceQuit = force; }
99 /** force minimize this window */ 99 /** force minimize this window */
100 bool isForceMinimizeToTray() 100 bool isForceMinimizeToTray()
101 { return forceMinimizeToTray; } 101 { return forceMinimizeToTray; }
102 /** set forceMinimizeToTray */ 102 /** set forceMinimizeToTray */
103 void setForceMinimizeToTray(bool force) 103 void setForceMinimizeToTray(bool force)
104 { forceMinimizeToTray = force; } 104 { forceMinimizeToTray = force; }
105 105
106public slots: 106public slots:
107 /** file/new triggered */ 107 /** file/new triggered */
108 void new_slot(); 108 void new_slot();
109 /** file/open triggered */ 109 /** file/open triggered */
110//US ENH 110//US ENH
111 void open_slot(); 111 void open_slot();
112 void open_slot(QString fn); 112 void open_slot(QString fn);
113 /** file/close triggered */ 113 /** file/close triggered */
114 void close_slot(); 114 void close_slot();
115 /** file/quit triggered */ 115 /** file/quit triggered */
116 void quitButton_slot(); 116 void quitButton_slot();
117 /** file/save triggered */ 117 /** file/save triggered */
118 void save_slot(); 118 void save_slot();
119 /** file/saveAs triggered */ 119 /** file/saveAs triggered */
120 void saveAs_slot(); 120 void saveAs_slot();
121 /** file/export/text triggered */ 121 /** file/export/text triggered */
122 void exportToText(); 122 void exportToText();
123 /** file/export/gpasman triggered */ 123 /** file/export/gpasman triggered */
124 void exportToGpasman(); 124 void exportToGpasman();
125 /** file/export/kwallet triggered */ 125 /** file/export/kwallet triggered */
126 void exportToKWallet(); 126 void exportToKWallet();
127 /** file/export/csv triggered */
128 void exportToCsv();
127 /** file/import/text triggered */ 129 /** file/import/text triggered */
128 bool importFromText(); 130 bool importFromText();
129 /** file/import/gpasman triggered */ 131 /** file/import/gpasman triggered */
130 bool importFromGpasman(); 132 bool importFromGpasman();
131 /** file/import/kwallet triggered */ 133 /** file/import/kwallet triggered */
132 bool importKWallet(); 134 bool importKWallet();
135 /** file/import/csv triggered */
136 bool importCsv();
133 /** file/print triggered */ 137 /** file/print triggered */
134 void print_slot(); 138 void print_slot();
135 /** manage/add triggered */ 139 /** manage/add triggered */
136 //US ENH : changed code to run with older MOC 140 //US ENH : changed code to run with older MOC
137 141
138 void addPwd_slot(); 142 void addPwd_slot();
139 void addPwd_slot1(QString *pw, PwMDoc *_doc); 143 void addPwd_slot1(QString *pw, PwMDoc *_doc);
140 /** manage/edit triggered */ 144 /** manage/edit triggered */
141 //US ENH : changed code to run with older MOC 145 //US ENH : changed code to run with older MOC
142 void editPwd_slot(); 146 void editPwd_slot();
143 void editPwd_slot1(const QString *category); 147 void editPwd_slot1(const QString *category);
144 void editPwd_slot3(const QString *category, const int *index ,PwMDoc *_doc ); 148 void editPwd_slot3(const QString *category, const int *index ,PwMDoc *_doc );
145 149
146 /** manage/delete triggered */ 150 /** manage/delete triggered */
147 void deletePwd_slot(); 151 void deletePwd_slot();
148 /** execute the "Launcher" entry */ 152 /** execute the "Launcher" entry */
149 void execLauncher_slot(); 153 void execLauncher_slot();
150 /** open browser with URL entry */ 154 /** open browser with URL entry */
151 void goToURL_slot(); 155 void goToURL_slot();
152 /** manage/changeMasterPwd triggered */ 156 /** manage/changeMasterPwd triggered */
153 void changeMasterPwd_slot(); 157 void changeMasterPwd_slot();
154 /** lock current document */ 158 /** lock current document */
155 void lockWnd_slot(); 159 void lockWnd_slot();
156 /** deeplock current document */ 160 /** deeplock current document */
157 void deepLockWnd_slot(); 161 void deepLockWnd_slot();
158 /** window/unlock triggered */ 162 /** window/unlock triggered */
159 void unlockWnd_slot(); 163 void unlockWnd_slot();
160 /** find item */ 164 /** find item */
161 void find_slot(); 165 void find_slot();
162 /** configure clicked */ 166 /** configure clicked */
163 void config_slot(); 167 void config_slot();
164 /** (de)activate the "change master pw" button in the menu-bar */ 168 /** (de)activate the "change master pw" button in the menu-bar */
165 void activateMpButton(bool activate = true); 169 void activateMpButton(bool activate = true);
166 /** generate a new chipcard */ 170 /** generate a new chipcard */
167 void genNewCard_slot(); 171 void genNewCard_slot();
168 /** completely erase the current card */ 172 /** completely erase the current card */
169 void eraseCard_slot(); 173 void eraseCard_slot();
170 /** returns the ID number of the current card */ 174 /** returns the ID number of the current card */
171 void readCardId_slot(); 175 void readCardId_slot();
172 /** make backup image of the current card */ 176 /** make backup image of the current card */
173 void makeCardBackup_slot(); 177 void makeCardBackup_slot();
174 /** write backup image to current card */ 178 /** write backup image to current card */
175 void replayCardBackup_slot(); 179 void replayCardBackup_slot();
176 180
177#ifdef PWM_EMBEDDED 181#ifdef PWM_EMBEDDED
178 void whatsnew_slot(); 182 void whatsnew_slot();
179 void showLicense_slot(); 183 void showLicense_slot();
180 void faq_slot(); 184 void faq_slot();
181 void createAboutData_slot(); 185 void createAboutData_slot();
182 void syncHowTo_slot(); 186 void syncHowTo_slot();
183#endif 187#endif
184 188
185protected: 189protected:
186 /** is this window virgin? */ 190 /** is this window virgin? */
187 bool isVirgin() 191 bool isVirgin()
188 { return virgin; } 192 { return virgin; }
189 /** add/remove virginity */ 193 /** add/remove virginity */
190 void setVirgin(bool v); 194 void setVirgin(bool v);
191 /** initialize the menubar */ 195 /** initialize the menubar */
192 void initMenubar(); 196 void initMenubar();
193 /** initialize the toolbar */ 197 /** initialize the toolbar */
194 void initToolbar(); 198 void initToolbar();
195 /** initialize the window-metrics */ 199 /** initialize the window-metrics */
196 void initMetrics(); 200 void initMetrics();
197 /** close-event */ 201 /** close-event */
198 void closeEvent(QCloseEvent *e); 202 void closeEvent(QCloseEvent *e);
199 /** creates a new PwM-ListView and returns it */ 203 /** creates a new PwM-ListView and returns it */
200 PwMView * makeNewListView(PwMDoc *doc); 204 PwMView * makeNewListView(PwMDoc *doc);
201 /** Window hide-event */ 205 /** Window hide-event */
202 void hideEvent(QHideEvent *); 206 void hideEvent(QHideEvent *);
203 /** is this window minimized? */ 207 /** is this window minimized? */
204 bool isMinimized() 208 bool isMinimized()
205 { 209 {
206#ifndef PWM_EMBEDDED 210#ifndef PWM_EMBEDDED
207 #if KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) 211 #if KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0)
208 return KWin::windowInfo(winId()).isMinimized(); 212 return KWin::windowInfo(winId()).isMinimized();
209 #else // KDE_VERSION 213 #else // KDE_VERSION
210 return KWin::info(winId()).isIconified(); 214 return KWin::info(winId()).isIconified();
211 #endif // KDE_VERSION 215 #endif // KDE_VERSION
212#else 216#else
213 return false; 217 return false;
214#endif 218#endif
215 } 219 }
216 /** window got the focus */ 220 /** window got the focus */
217 void focusInEvent(QFocusEvent *e); 221 void focusInEvent(QFocusEvent *e);
218 /** update the caption string */ 222 /** update the caption string */
219 void updateCaption(); 223 void updateCaption();
220#ifdef CONFIG_KWALLETIF 224#ifdef CONFIG_KWALLETIF
221 /** check if kwalletemu is enabled and ask the user what to do */ 225 /** check if kwalletemu is enabled and ask the user what to do */
222 bool checkAndAskForKWalletEmu(); 226 bool checkAndAskForKWalletEmu();
223#endif // CONFIG_KWALLETIF 227#endif // CONFIG_KWALLETIF
224 228
225protected slots: 229protected slots:
226 /** doc got closed */ 230 /** doc got closed */
227 void docClosed(PwMDoc *doc); 231 void docClosed(PwMDoc *doc);
228 232
229signals: 233signals:
230 /** window got closed (by user or someone else) */ 234 /** window got closed (by user or someone else) */
231 void closed(PwM *wnd); 235 void closed(PwM *wnd);
232 /** window got the focus (was brought to foreground) */ 236 /** window got the focus (was brought to foreground) */
233 void gotFocus(PwM *wnd); 237 void gotFocus(PwM *wnd);
234 /** window lost the focus */ 238 /** window lost the focus */
235 void lostFocus(PwM *wnd); 239 void lostFocus(PwM *wnd);
236 240
237protected: 241protected:
238 /** pointer to the view active in this KMainWindow */ 242 /** pointer to the view active in this KMainWindow */
239 PwMView *view; 243 PwMView *view;
240 /** pointer to the init class */ 244 /** pointer to the init class */
241 PwMInit *init; 245 PwMInit *init;
242 /** has this window already lost its virginity? 246 /** has this window already lost its virginity?
243 * Means is there an open working document 247 * Means is there an open working document
244 */ 248 */
245 bool virgin; 249 bool virgin;
246 /** "file" popup-menu */ 250 /** "file" popup-menu */
247 KPopupMenu *filePopup; 251 KPopupMenu *filePopup;
248 252
249 /** "manage" popup-menu */ 253 /** "manage" popup-menu */
250 KPopupMenu *managePopup; 254 KPopupMenu *managePopup;
251#ifdef CONFIG_KEYCARD 255#ifdef CONFIG_KEYCARD
252 /** "chipcard" popup-menu */ 256 /** "chipcard" popup-menu */
253 KPopupMenu *chipcardPopup; 257 KPopupMenu *chipcardPopup;
254#endif // CONFIG_KEYCARD 258#endif // CONFIG_KEYCARD
255 /** "view" popup-menu */ 259 /** "view" popup-menu */
256 KPopupMenu *viewPopup; 260 KPopupMenu *viewPopup;
257 /** "options" popup-menu */ 261 /** "options" popup-menu */
258 KPopupMenu *optionsPopup; 262 KPopupMenu *optionsPopup;
259 /** "help" popup-menu */ 263 /** "help" popup-menu */
260 KPopupMenu *helpPopup; 264 KPopupMenu *helpPopup;
261 /** "export" popup-menu */ 265 /** "export" popup-menu */
262 KPopupMenu *exportPopup; 266 KPopupMenu *exportPopup;
263 /** "import" popup-menu */ 267 /** "import" popup-menu */
264 KPopupMenu *importPopup; 268 KPopupMenu *importPopup;
265 /** force quit this window? */ 269 /** force quit this window? */
266 bool forceQuit; 270 bool forceQuit;
267 /** force minimize this window to the tray */ 271 /** force minimize this window to the tray */
268 bool forceMinimizeToTray; 272 bool forceMinimizeToTray;
269 273
270 274
271 275
272 276
273 private: 277 private:
274#ifdef PWM_EMBEDDED 278#ifdef PWM_EMBEDDED
275 //this are the overwritten callbackmethods from the syncinterface 279 //this are the overwritten callbackmethods from the syncinterface
276 virtual bool sync(KSyncManager* manager, QString filename, int mode); 280 virtual bool sync(KSyncManager* manager, QString filename, int mode);
277 281
278 // LR ******************************* 282 // LR *******************************
279 // sync stuff! 283 // sync stuff!
280 QPopupMenu *syncPopup; 284 QPopupMenu *syncPopup;
281 KSyncManager* syncManager; 285 KSyncManager* syncManager;
282#endif 286#endif
283 287
284 288
285 289
286 290
287 291
288 292
289 293
290 294
291}; 295};
292 296
293#endif 297#endif
diff --git a/pwmanager/pwmanager/pwmanagerE.pro b/pwmanager/pwmanager/pwmanagerE.pro
index 1445bcf..c46e937 100644
--- a/pwmanager/pwmanager/pwmanagerE.pro
+++ b/pwmanager/pwmanager/pwmanagerE.pro
@@ -1,169 +1,171 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3 3
4 4
5 TARGET = pwmpi 5 TARGET = pwmpi
6OBJECTS_DIR = obj/$(PLATFORM) 6OBJECTS_DIR = obj/$(PLATFORM)
7MOC_DIR = moc/$(PLATFORM) 7MOC_DIR = moc/$(PLATFORM)
8DESTDIR=$(QPEDIR)/bin 8DESTDIR=$(QPEDIR)/bin
9 9
10INCLUDEPATH += . ../../ ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils ../libcrypt/crypt ../libcrypt/error $(QPEDIR)/include 10INCLUDEPATH += . ../../ ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils ../libcrypt/crypt ../libcrypt/error $(QPEDIR)/include
11DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY 11DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY
12 12
13#enable this setting if you want debugoutput for pwmanager 13#enable this setting if you want debugoutput for pwmanager
14#DEFINES += CONFIG_DEBUG 14#DEFINES += CONFIG_DEBUG
15 15
16LIBS += -L../libcrypt/$(PLATFORM) 16LIBS += -L../libcrypt/$(PLATFORM)
17LIBS += -lmicrokde 17LIBS += -lmicrokde
18LIBS += -lmicroqtcompat 18LIBS += -lmicroqtcompat
19LIBS += -lmicrokdepim 19LIBS += -lmicrokdepim
20LIBS += -L$(QPEDIR)/lib 20LIBS += -L$(QPEDIR)/lib
21LIBS += -lqpe 21LIBS += -lqpe
22LIBS += -lzlib 22LIBS += -lzlib
23#LIBS += -lbz2 23#LIBS += -lbz2
24#LIBS += -lkpmicrogcrypt 24#LIBS += -lkpmicrogcrypt
25LIBS += -ljpeg 25LIBS += -ljpeg
26LIBS += $(QTOPIALIB) 26LIBS += $(QTOPIALIB)
27LIBS += -lkpmicrocipher 27LIBS += -lkpmicrocipher
28LIBS += -lkpmicroerror 28LIBS += -lkpmicroerror
29LIBS += -lkpmicrompi 29LIBS += -lkpmicrompi
30LIBS += -lstdc++ 30LIBS += -lstdc++
31 31
32#INTERFACES = \ 32#INTERFACES = \
33#addentrywnd.ui \ 33#addentrywnd.ui \
34#configwnd.ui \ 34#configwnd.ui \
35#findwnd.ui \ 35#findwnd.ui \
36#getmasterpwwnd.ui \ 36#getmasterpwwnd.ui \
37#pwgenwnd.ui \ 37#pwgenwnd.ui \
38#setmasterpwwnd.ui \ 38#setmasterpwwnd.ui \
39#subtbledit.ui 39#subtbledit.ui
40 40
41#INTERFACES = \ 41#INTERFACES = \
42#subtbledit.ui \ 42#subtbledit.ui \
43 43
44 44
45 45
46#HEADERS = \ 46#HEADERS = \
47#configuration_31compat.h \ 47#configuration_31compat.h \
48#configuration.h \ 48#configuration.h \
49#configwnd.h \ 49#configwnd.h \
50#configwndimpl.h \ 50#configwndimpl.h \
51#selftest.h 51#selftest.h
52#subtbledit.h \ 52#subtbledit.h \
53#subtbleditimpl.h \ 53#subtbleditimpl.h \
54#compressbzip2.h \ 54#compressbzip2.h \
55 55
56HEADERS = \ 56HEADERS = \
57addentrywnd_emb.h \ 57addentrywnd_emb.h \
58addentrywndimpl.h \ 58addentrywndimpl.h \
59base64.h \ 59base64.h \
60binentrygen.h \ 60binentrygen.h \
61blowfish.h \ 61blowfish.h \
62commentbox.h \ 62commentbox.h \
63compiler.h \ 63compiler.h \
64compressgzip.h \ 64compressgzip.h \
65csv.h \
65findwnd_emb.h \ 66findwnd_emb.h \
66findwndimpl.h \ 67findwndimpl.h \
67genpasswd.h \ 68genpasswd.h \
68getkeycardwnd.h \ 69getkeycardwnd.h \
69getmasterpwwnd_emb.h \ 70getmasterpwwnd_emb.h \
70getmasterpwwndimpl.h \ 71getmasterpwwndimpl.h \
71globalstuff.h \ 72globalstuff.h \
72gpasmanfile.h \ 73gpasmanfile.h \
73htmlgen.h \ 74htmlgen.h \
74htmlparse.h \ 75htmlparse.h \
75ipc.h \ 76ipc.h \
76libgcryptif.h \ 77libgcryptif.h \
77listobjselectwnd.h \ 78listobjselectwnd.h \
78listviewpwm.h \ 79listviewpwm.h \
79printtext.h \ 80printtext.h \
80pwgenwnd_emb.h \ 81pwgenwnd_emb.h \
81pwgenwndimpl.h \ 82pwgenwndimpl.h \
82pwmdoc.h \ 83pwmdoc.h \
83pwmdocui.h \ 84pwmdocui.h \
84pwmexception.h \ 85pwmexception.h \
85pwm.h \ 86pwm.h \
86pwminit.h \ 87pwminit.h \
87pwmprefs.h \ 88pwmprefs.h \
88pwmprint.h \ 89pwmprint.h \
89pwmtray.h \ 90pwmtray.h \
90pwmview.h \ 91pwmview.h \
91pwmviewstyle_0.h \ 92pwmviewstyle_0.h \
92pwmviewstyle_1.h \ 93pwmviewstyle_1.h \
93pwmviewstyle.h \ 94pwmviewstyle.h \
94randomizer.h \ 95randomizer.h \
95rc2.h \ 96rc2.h \
96rencatwnd.h \ 97rencatwnd.h \
97serializer.h \ 98serializer.h \
98setmasterpwwnd_emb.h \ 99setmasterpwwnd_emb.h \
99setmasterpwwndimpl.h \ 100setmasterpwwndimpl.h \
100sha1.h \ 101sha1.h \
101waitwnd.h \ 102waitwnd.h \
102kcmconfigs/kcmpwmconfig.h \ 103kcmconfigs/kcmpwmconfig.h \
103kcmconfigs/pwmconfigwidget.h 104kcmconfigs/pwmconfigwidget.h
104 105
105#sources that need not be build 106#sources that need not be build
106#SOURCES = \ 107#SOURCES = \
107#advcommeditimpl.cpp \ 108#advcommeditimpl.cpp \
108#configuration.cpp \ 109#configuration.cpp \
109#configwnd.cpp \ 110#configwnd.cpp \
110#configwndimpl.cpp \ 111#configwndimpl.cpp \
111#configuration_31compat.cpp \ 112#configuration_31compat.cpp \
112#htmlparse.cpp \ 113#htmlparse.cpp \
113#printtext.cpp \ 114#printtext.cpp \
114#selftest.cpp \ 115#selftest.cpp \
115#pwmprint.cpp \ 116#pwmprint.cpp \
116#spinforsignal.cpp 117#spinforsignal.cpp
117#subtbledit.cpp \ 118#subtbledit.cpp \
118#subtbleditimpl.cpp \ 119#subtbleditimpl.cpp \
119#compressbzip2.cpp 120#compressbzip2.cpp
120 121
121 122
122SOURCES = \ 123SOURCES = \
123addentrywnd_emb.cpp \ 124addentrywnd_emb.cpp \
124addentrywndimpl.cpp \ 125addentrywndimpl.cpp \
125base64.cpp \ 126base64.cpp \
126binentrygen.cpp \ 127binentrygen.cpp \
127blowfish.cpp \ 128blowfish.cpp \
128commentbox.cpp \ 129commentbox.cpp \
129compressgzip.cpp \ 130compressgzip.cpp \
131csv.cpp \
130findwnd_emb.cpp \ 132findwnd_emb.cpp \
131findwndimpl.cpp \ 133findwndimpl.cpp \
132genpasswd.cpp \ 134genpasswd.cpp \
133getkeycardwnd.cpp \ 135getkeycardwnd.cpp \
134getmasterpwwnd_emb.cpp \ 136getmasterpwwnd_emb.cpp \
135getmasterpwwndimpl.cpp \ 137getmasterpwwndimpl.cpp \
136globalstuff.cpp \ 138globalstuff.cpp \
137gpasmanfile.cpp \ 139gpasmanfile.cpp \
138htmlgen.cpp \ 140htmlgen.cpp \
139ipc.cpp \ 141ipc.cpp \
140libgcryptif.cpp \ 142libgcryptif.cpp \
141listobjselectwnd.cpp \ 143listobjselectwnd.cpp \
142listviewpwm.cpp \ 144listviewpwm.cpp \
143main.cpp \ 145main.cpp \
144pwgenwnd_emb.cpp \ 146pwgenwnd_emb.cpp \
145pwgenwndimpl.cpp \ 147pwgenwndimpl.cpp \
146pwm.cpp \ 148pwm.cpp \
147pwmdoc.cpp \ 149pwmdoc.cpp \
148pwmdocui.cpp \ 150pwmdocui.cpp \
149pwmexception.cpp \ 151pwmexception.cpp \
150pwminit.cpp \ 152pwminit.cpp \
151pwmprefs.cpp \ 153pwmprefs.cpp \
152pwmtray.cpp \ 154pwmtray.cpp \
153pwmview.cpp \ 155pwmview.cpp \
154pwmviewstyle_0.cpp \ 156pwmviewstyle_0.cpp \
155pwmviewstyle_1.cpp \ 157pwmviewstyle_1.cpp \
156pwmviewstyle.cpp \ 158pwmviewstyle.cpp \
157randomizer.cpp \ 159randomizer.cpp \
158rc2.cpp \ 160rc2.cpp \
159rencatwnd.cpp \ 161rencatwnd.cpp \
160serializer.cpp \ 162serializer.cpp \
161setmasterpwwnd_emb.cpp \ 163setmasterpwwnd_emb.cpp \
162setmasterpwwndimpl.cpp \ 164setmasterpwwndimpl.cpp \
163sha1.cpp \ 165sha1.cpp \
164waitwnd.cpp \ 166waitwnd.cpp \
165kcmconfigs/kcmpwmconfig.cpp \ 167kcmconfigs/kcmpwmconfig.cpp \
166kcmconfigs/pwmconfigwidget.cpp 168kcmconfigs/pwmconfigwidget.cpp
167 169
168 170
169 171