author | llornkcor <llornkcor> | 2004-07-13 10:35:23 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-07-13 10:35:23 (UTC) |
commit | 37e0e077b51841971c3d4c25b287f4d39e750e2d (patch) (unidiff) | |
tree | c1b499dd6e544207c6ff7047acd8170d6ea63f94 | |
parent | 5d2ec2e9b1dce49e914c260fe16a82ddccbaa92d (diff) | |
download | opie-37e0e077b51841971c3d4c25b287f4d39e750e2d.zip opie-37e0e077b51841971c3d4c25b287f4d39e750e2d.tar.gz opie-37e0e077b51841971c3d4c25b287f4d39e750e2d.tar.bz2 |
fix ups, and move qsettings files away
-rw-r--r--[-rwxr-xr-x] | noncore/apps/zsafe/extra/qsettings.cpp (renamed from noncore/apps/zsafe/qsettings.cpp) | 308 | ||||
-rw-r--r--[-rwxr-xr-x] | noncore/apps/zsafe/extra/qsettings.h (renamed from noncore/apps/zsafe/qsettings.h) | 0 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 147 |
3 files changed, 243 insertions, 212 deletions
diff --git a/noncore/apps/zsafe/qsettings.cpp b/noncore/apps/zsafe/extra/qsettings.cpp index ee55339..def2e2d 100755..100644 --- a/noncore/apps/zsafe/qsettings.cpp +++ b/noncore/apps/zsafe/extra/qsettings.cpp | |||
@@ -1,152 +1,156 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id$ | 2 | ** $Id$ |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include "qsettings.h" | 5 | #include "qsettings.h" |
6 | #include <stdio.h> | 6 | #include <stdio.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qtextstream.h> | 8 | #include <qtextstream.h> |
9 | 9 | ||
10 | 10 | ||
11 | QSettings::QSettings(const QString &_fn) | 11 | QSettings::QSettings(const QString &_fn) |
12 | { | 12 | { |
13 | // read the prefs from the file | 13 | qWarning("Settings "+_fn); |
14 | fn = _fn; | 14 | // read the prefs from the file |
15 | 15 | fn = _fn; | |
16 | QFile f(_fn); | 16 | |
17 | if ( f.open(IO_ReadOnly) ) { // file opened successfully | 17 | QFile f(_fn); |
18 | QTextStream t( &f ); // use a text stream | 18 | if ( f.open(IO_ReadOnly) ) { // file opened successfully |
19 | QString s; | 19 | QTextStream t( &f ); // use a text stream |
20 | while ( !t.eof() ) { // until end of file... | 20 | QString s; |
21 | s = t.readLine(); // line of text excluding '\n' | 21 | while ( !t.eof() ) { // until end of file... |
22 | char buf[256]; | 22 | s = t.readLine(); // line of text excluding '\n' |
23 | sprintf (buf, "%s", (const char *) s); | 23 | char buf[256]; |
24 | int pos = s.find (" = "); | 24 | sprintf (buf, "%s", (const char *) s); |
25 | QString key = s.left (pos); | 25 | int pos = s.find (" = "); |
26 | QString val = s.right (s.length() - pos - 3); | 26 | QString key = s.left (pos); |
27 | writeEntry (key, val); | 27 | QString val = s.right (s.length() - pos - 3); |
28 | 28 | writeEntry (key, val); | |
29 | sprintf (buf, "%s|%s", (const char *)key, (const char *)val); | 29 | |
30 | } | 30 | sprintf (buf, "%s|%s", (const char *)key, (const char *)val); |
31 | f.close(); | 31 | } |
32 | } | 32 | f.close(); |
33 | 33 | } | |
34 | 34 | ||
35 | } | 35 | |
36 | 36 | } | |
37 | QSettings::~QSettings() | 37 | |
38 | { | 38 | QSettings::~QSettings() |
39 | // write out the prefs to the file | 39 | { |
40 | QAsciiDictIterator <QString> it( prefs ); // iterator for dict | 40 | // write out the prefs to the file |
41 | QFile f(fn); | 41 | QAsciiDictIterator <QString> it( prefs ); // iterator for dict |
42 | f.open(IO_WriteOnly); | 42 | QFile f(fn); |
43 | QTextStream ts( &f ); | 43 | f.open(IO_WriteOnly); |
44 | 44 | QTextStream ts( &f ); | |
45 | while ( it.current() ) | 45 | |
46 | { | 46 | while ( it.current() ) |
47 | QString *key = new QString(it.currentKey()); | 47 | { |
48 | char buf[256]; | 48 | QString *key = new QString(it.currentKey()); |
49 | sprintf (buf, "%s", (const char *) *( it.current())); | 49 | char buf[256]; |
50 | QString *val = new QString(buf); | 50 | sprintf (buf, "%s", (const char *) *( it.current())); |
51 | sprintf (buf, "%s %s", (const char *)*key, (const char *)*val); | 51 | QString *val = new QString(buf); |
52 | ts << *key << " = " << *val << endl; | 52 | sprintf (buf, "%s %s", (const char *)*key, (const char *)*val); |
53 | ++it; | 53 | ts << *key << " = " << *val << endl; |
54 | } | 54 | ++it; |
55 | 55 | } | |
56 | f.close(); | 56 | |
57 | prefs.clear(); | 57 | f.close(); |
58 | } | 58 | prefs.clear(); |
59 | 59 | } | |
60 | void QSettings::insertSearchPath (System sys, const QString &str) | 60 | |
61 | { | 61 | void QSettings::insertSearchPath (System sys, const QString &str) |
62 | fn = str; | 62 | { |
63 | } | 63 | fn = str; |
64 | 64 | } | |
65 | QString QSettings::readEntry (const QString &key, const QString &def) | 65 | |
66 | { | 66 | QString QSettings::readEntry (const QString &key, const QString &def) |
67 | 67 | { | |
68 | QString *s = prefs.find((const char *)key); | 68 | |
69 | if (!s) | 69 | QString *s = prefs.find((const char *)key); |
70 | return def; | 70 | if (!s) |
71 | else | 71 | return def; |
72 | return *s; | 72 | else |
73 | 73 | return *s; | |
74 | } | 74 | |
75 | 75 | } | |
76 | int QSettings::readNumEntry (const QString &key, int def) | 76 | |
77 | { | 77 | int QSettings::readNumEntry (const QString &key, int def) |
78 | QString *s = prefs[key]; | 78 | { |
79 | if (!s) return def; | 79 | QString *s = prefs[key]; |
80 | return s->toInt(); | 80 | if (!s) return def; |
81 | } | 81 | return s->toInt(); |
82 | 82 | } | |
83 | bool QSettings::readBoolEntry (const QString &key, bool def) | 83 | |
84 | { | 84 | bool QSettings::readBoolEntry (const QString &key, bool def) |
85 | QString *s = prefs[key]; | 85 | { |
86 | if (!s) return def; | 86 | QString *s = prefs[key]; |
87 | if (*s == "1") | 87 | if (!s) return def; |
88 | return true; | 88 | if (*s == "1") |
89 | else | 89 | return true; |
90 | return false; | 90 | else |
91 | } | 91 | return false; |
92 | 92 | } | |
93 | bool QSettings::writeEntry (const QString &key, int val) | 93 | |
94 | { | 94 | bool QSettings::writeEntry (const QString &key, int val) |
95 | char buf[64]; | 95 | { |
96 | sprintf (buf, "%d", val); | 96 | char buf[64]; |
97 | QString *v = new QString(buf); | 97 | sprintf (buf, "%d", val); |
98 | prefs.replace ((const char *)key, v); | 98 | QString *v = new QString(buf); |
99 | return true; | 99 | prefs.replace ((const char *)key, v); |
100 | } | 100 | return true; |
101 | 101 | } | |
102 | bool QSettings::writeEntry (const QString &key, bool val) | 102 | |
103 | { | 103 | bool QSettings::writeEntry (const QString &key, bool val) |
104 | QString *v; | 104 | { |
105 | if (val) | 105 | QString *v; |
106 | v = new QString("1"); | 106 | if (val) |
107 | else | 107 | v = new QString("1"); |
108 | v = new QString("0"); | 108 | else |
109 | prefs.replace ((const char *)key, v); | 109 | v = new QString("0"); |
110 | return true; | 110 | prefs.replace ((const char *)key, v); |
111 | } | 111 | return true; |
112 | 112 | } | |
113 | bool QSettings::writeEntry (const QString &key, const QString &val) | 113 | |
114 | { | 114 | bool QSettings::writeEntry (const QString &key, const QString &val) |
115 | QString *v = new QString (val); | 115 | { |
116 | prefs.replace ((const char *)key, v); | 116 | QString *v = new QString (val); |
117 | return true; | 117 | prefs.replace ((const char *)key, v); |
118 | } | 118 | return true; |
119 | 119 | } | |
120 | bool QSettings::writeEntry (const QString &key, const char *val) | 120 | |
121 | { | 121 | bool QSettings::writeEntry (const QString &key, const char *val) |
122 | QString *v = new QString (val); | 122 | { |
123 | prefs.replace ((const char *)key, v); | 123 | QString *v = new QString (val); |
124 | return true; | 124 | prefs.replace ((const char *)key, v); |
125 | } | 125 | return true; |
126 | 126 | } | |
127 | bool QSettings::removeEntry (const QString &key) | 127 | |
128 | { | 128 | bool QSettings::removeEntry (const QString &key) |
129 | prefs.remove (key); | 129 | { |
130 | return true; | 130 | prefs.remove (key); |
131 | } | 131 | return true; |
132 | 132 | } | |
133 | QStringList QSettings::entryList (const QString &key) const | 133 | |
134 | { | 134 | QStringList QSettings::entryList (const QString &key) const |
135 | QAsciiDictIterator <QString> it( prefs ); // iterator for dict | 135 | { |
136 | QStringList list; | 136 | qDebug("entryList: "+key); |
137 | 137 | QStringList list; | |
138 | while ( it.current() ) | 138 | if(!prefs.isEmpty()) { |
139 | { | 139 | QAsciiDictIterator <QString> it( prefs ); // iterator for dict |
140 | char buf[512]; | 140 | qDebug("ready"); |
141 | sprintf (buf, "%s", (const char *) *( it.current())); | 141 | while ( it.current() ) |
142 | QString *val = new QString(buf); | 142 | { |
143 | sprintf(buf, "%s -> %s\n", it.currentKey(), (const char *)*val ); | 143 | char buf[512]; |
144 | QString *cat = new QString(it.currentKey()); | 144 | sprintf(buf, "%s", (const char *) *( it.current())); |
145 | if (cat->contains("-field", FALSE)) | 145 | QString *val = new QString(buf); |
146 | list.append (it.currentKey()); | 146 | sprintf(buf, "%s -> %s\n", it.currentKey(), (const char *)*val ); |
147 | ++it; | 147 | QString *cat = new QString(it.currentKey()); |
148 | 148 | if (cat->contains("-field", FALSE)) | |
149 | } | 149 | list.append (it.currentKey()); |
150 | return list; | 150 | ++it; |
151 | } | 151 | } |
152 | 152 | } | |
153 | qWarning("Return here"); | ||
154 | return list; | ||
155 | } | ||
156 | |||
diff --git a/noncore/apps/zsafe/qsettings.h b/noncore/apps/zsafe/extra/qsettings.h index 95e87b5..95e87b5 100755..100644 --- a/noncore/apps/zsafe/qsettings.h +++ b/noncore/apps/zsafe/extra/qsettings.h | |||
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 0864293..f3d57f8 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp | |||
@@ -2,27 +2,27 @@ | |||
2 | ** | 2 | ** |
3 | ** Created: Sat Apr 6 17:57:45 2002 | 3 | ** Created: Sat Apr 6 17:57:45 2002 |
4 | ** | 4 | ** |
5 | ** Author: Carsten Schneider <CarstenSchneider@t-online.de> | 5 | ** Author: Carsten Schneider <CarstenSchneider@t-online.de> |
6 | ** | 6 | ** |
7 | ** $Id$ | 7 | ** $Id$ |
8 | ** | 8 | ** |
9 | ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html | 9 | ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html |
10 | ** | 10 | ** |
11 | ** Compile Flags: | 11 | ** Compile Flags: |
12 | ** Zaurus arm : -DNO_OPIE | 12 | ** Zaurus arm : -DNO_OPIE |
13 | ** Zaurus Opie arm: none | 13 | ** Zaurus Opie arm: none |
14 | ** Linux Desktop : -DDESKTOP | 14 | ** Linux Desktop : -DDESKTOP -DNO_OPIE |
15 | ** Windows Desktop: -DDESKTOP -DWIN32 | 15 | ** Windows Desktop: -DDESKTOP -DNO_OPIE |
16 | ** | 16 | ** use qmake |
17 | ** for japanese version additional use: -DJPATCH_HDE | 17 | ** for japanese version additional use: -DJPATCH_HDE |
18 | ** | 18 | ** |
19 | ****************************************************************************/ | 19 | ****************************************************************************/ |
20 | #include "zsafe.h" | 20 | #include "zsafe.h" |
21 | #include "newdialog.h" | 21 | #include "newdialog.h" |
22 | #include "searchdialog.h" | 22 | #include "searchdialog.h" |
23 | #include "categorydialog.h" | 23 | #include "categorydialog.h" |
24 | #include "passworddialog.h" | 24 | #include "passworddialog.h" |
25 | #include "infoform.h" | 25 | #include "infoform.h" |
26 | #include "zlistview.h" | 26 | #include "zlistview.h" |
27 | #include "shadedlistitem.h" | 27 | #include "shadedlistitem.h" |
28 | 28 | ||
@@ -34,37 +34,37 @@ using namespace Opie::Core; | |||
34 | using namespace Opie::Ui; | 34 | using namespace Opie::Ui; |
35 | #else | 35 | #else |
36 | #include "scqtfileedit.h" | 36 | #include "scqtfileedit.h" |
37 | #endif | 37 | #endif |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #include <qclipboard.h> | 40 | #include <qclipboard.h> |
41 | 41 | ||
42 | #include <sys/types.h> | 42 | #include <sys/types.h> |
43 | #include <sys/stat.h> | 43 | #include <sys/stat.h> |
44 | #include <fcntl.h> | 44 | #include <fcntl.h> |
45 | #include <stdlib.h> | 45 | #include <stdlib.h> |
46 | #ifndef WIN32 | 46 | #ifndef Q_WS_WIN |
47 | #include <unistd.h> | 47 | #include <unistd.h> |
48 | #endif | 48 | #endif |
49 | #include <string.h> | 49 | #include <string.h> |
50 | #include <errno.h> | 50 | #include <errno.h> |
51 | 51 | ||
52 | #include <qmenubar.h> | 52 | #include <qmenubar.h> |
53 | #include <qpopupmenu.h> | 53 | #include <qpopupmenu.h> |
54 | 54 | ||
55 | #ifdef DESKTOP | 55 | #ifdef DESKTOP |
56 | #include <qfiledialog.h> | 56 | #include <qfiledialog.h> |
57 | #include <qdragobject.h> | 57 | #include <qdragobject.h> |
58 | #ifndef WIN32 | 58 | #ifndef Q_WS_WIN |
59 | #include <qsettings.h> | 59 | #include <qsettings.h> |
60 | #else | 60 | #else |
61 | #include "qsettings.h" | 61 | #include "qsettings.h" |
62 | #endif | 62 | #endif |
63 | #include <qapplication.h> | 63 | #include <qapplication.h> |
64 | #else | 64 | #else |
65 | #include <qfile.h> | 65 | #include <qfile.h> |
66 | #include <qpe/fileselector.h> | 66 | #include <qpe/fileselector.h> |
67 | #include <qpe/global.h> | 67 | #include <qpe/global.h> |
68 | #include <qpe/qpeapplication.h> | 68 | #include <qpe/qpeapplication.h> |
69 | #include <qpe/resource.h> | 69 | #include <qpe/resource.h> |
70 | #include <qpe/config.h> | 70 | #include <qpe/config.h> |
@@ -88,36 +88,36 @@ using namespace Opie::Ui; | |||
88 | #include <qregexp.h> | 88 | #include <qregexp.h> |
89 | #include <qdir.h> | 89 | #include <qdir.h> |
90 | #include <qtextbrowser.h> | 90 | #include <qtextbrowser.h> |
91 | #include <qlabel.h> | 91 | #include <qlabel.h> |
92 | #include <qcombobox.h> | 92 | #include <qcombobox.h> |
93 | 93 | ||
94 | #include "krc2.h" | 94 | #include "krc2.h" |
95 | 95 | ||
96 | #include "wait.h" | 96 | #include "wait.h" |
97 | 97 | ||
98 | extern int DeskW, DeskH; | 98 | extern int DeskW, DeskH; |
99 | #ifdef DESKTOP | 99 | #ifdef DESKTOP |
100 | extern QApplication *appl; | 100 | extern QApplication *appl; |
101 | #else | 101 | #else |
102 | extern QPEApplication *appl; | 102 | extern QPEApplication *appl; |
103 | #endif | 103 | #endif |
104 | 104 | ||
105 | #ifdef JPATCH_HDE | 105 | #ifdef JPATCH_HDE |
106 | #define tr(arg) arg | 106 | #define tr(arg) arg |
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | 109 | ||
110 | #ifdef DESKTOP | 110 | #ifdef DESKTOP |
111 | #ifndef WIN32 | 111 | #ifndef Q_WS_WIN |
112 | const QString APP_KEY="/.zsafe/"; | 112 | const QString APP_KEY="/.zsafe/"; |
113 | #else | 113 | #else |
114 | const QString APP_KEY=""; | 114 | const QString APP_KEY=""; |
115 | #endif | 115 | #endif |
116 | #else | 116 | #else |
117 | const QString APP_KEY=""; | 117 | const QString APP_KEY=""; |
118 | #endif | 118 | #endif |
119 | 119 | ||
120 | // include xmp images | 120 | // include xmp images |
121 | #include "pics/zsafe/copy.xpm" | 121 | #include "pics/zsafe/copy.xpm" |
122 | #include "pics/zsafe/cut.xpm" | 122 | #include "pics/zsafe/cut.xpm" |
123 | #include "pics/zsafe/edit.xpm" | 123 | #include "pics/zsafe/edit.xpm" |
@@ -356,25 +356,25 @@ static const char* const general_data[] = { | |||
356 | exit (ec); | 356 | exit (ec); |
357 | } | 357 | } |
358 | 358 | ||
359 | 359 | ||
360 | // save the configuration into the file | 360 | // save the configuration into the file |
361 | void ZSafe::saveConf () | 361 | void ZSafe::saveConf () |
362 | { | 362 | { |
363 | if (conf) | 363 | if (conf) |
364 | { | 364 | { |
365 | delete conf; | 365 | delete conf; |
366 | 366 | ||
367 | #ifdef DESKTOP | 367 | #ifdef DESKTOP |
368 | #ifndef WIN32 | 368 | #ifndef Q_WS_WIN |
369 | conf = new QSettings (); | 369 | conf = new QSettings (); |
370 | conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); | 370 | conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); |
371 | #else | 371 | #else |
372 | conf = new QSettings (cfgFile); | 372 | conf = new QSettings (cfgFile); |
373 | conf->insertSearchPath (QSettings::Unix, cfgFile); | 373 | conf->insertSearchPath (QSettings::Unix, cfgFile); |
374 | #endif | 374 | #endif |
375 | #else | 375 | #else |
376 | conf = new Config (cfgFile, Config::File); | 376 | conf = new Config (cfgFile, Config::File); |
377 | conf->setGroup ("zsafe"); | 377 | conf->setGroup ("zsafe"); |
378 | #endif | 378 | #endif |
379 | } | 379 | } |
380 | } | 380 | } |
@@ -408,37 +408,37 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) | |||
408 | 408 | ||
409 | #ifdef DESKTOP | 409 | #ifdef DESKTOP |
410 | iconPath = QDir::homeDirPath() + "/pics/"; | 410 | iconPath = QDir::homeDirPath() + "/pics/"; |
411 | #else | 411 | #else |
412 | if (qpedir.isEmpty()) | 412 | if (qpedir.isEmpty()) |
413 | iconPath = "/home/QtPalmtop/pics/"; | 413 | iconPath = "/home/QtPalmtop/pics/"; |
414 | else | 414 | else |
415 | iconPath = qpedir + "/pics/"; | 415 | iconPath = qpedir + "/pics/"; |
416 | #endif | 416 | #endif |
417 | 417 | ||
418 | // create a zsafe configuration object | 418 | // create a zsafe configuration object |
419 | #ifdef DESKTOP | 419 | #ifdef DESKTOP |
420 | #ifndef WIN32 | 420 | #ifndef Q_WS_WIN |
421 | conf = new QSettings (); | 421 | conf = new QSettings (); |
422 | conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); | 422 | conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); |
423 | #else | 423 | #else |
424 | conf = new QSettings (cfgFile); | 424 | conf = new QSettings (cfgFile); |
425 | conf->insertSearchPath (QSettings::Unix, cfgFile); | 425 | conf->insertSearchPath (QSettings::Unix, cfgFile); |
426 | #endif | 426 | #endif |
427 | #else | 427 | #else |
428 | conf = new Config (cfgFile, Config::File); | 428 | conf = new Config (cfgFile, Config::File); |
429 | conf->setGroup ("zsafePrefs"); | 429 | conf->setGroup ("zsafePrefs"); |
430 | #endif | 430 | #endif |
431 | #ifdef DESKTOP | 431 | #ifdef DESKTOP |
432 | // #ifndef WIN32 | 432 | // #ifndef Q_WS_WIN |
433 | expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false); | 433 | expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false); |
434 | // #endif | 434 | // #endif |
435 | #else | 435 | #else |
436 | expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0); | 436 | expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0); |
437 | #endif | 437 | #endif |
438 | #ifndef DESKTOP | 438 | #ifndef DESKTOP |
439 | conf->setGroup ("zsafe"); | 439 | conf->setGroup ("zsafe"); |
440 | #endif | 440 | #endif |
441 | 441 | ||
442 | QPixmap copy_img((const char**) copy_xpm); | 442 | QPixmap copy_img((const char**) copy_xpm); |
443 | QPixmap cut_img((const char**) cut_xpm); | 443 | QPixmap cut_img((const char**) cut_xpm); |
444 | QPixmap edit_img((const char**) edit_xpm); | 444 | QPixmap edit_img((const char**) edit_xpm); |
@@ -455,25 +455,25 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) | |||
455 | QPixmap export_img((const char**) export_xpm); | 455 | QPixmap export_img((const char**) export_xpm); |
456 | QPixmap import_img((const char**) import_xpm); | 456 | QPixmap import_img((const char**) import_xpm); |
457 | 457 | ||
458 | QPixmap bank_cards( ( const char** ) bank_cards_data ); | 458 | QPixmap bank_cards( ( const char** ) bank_cards_data ); |
459 | QPixmap passwords( ( const char** ) passwords_data ); | 459 | QPixmap passwords( ( const char** ) passwords_data ); |
460 | QPixmap software( ( const char** ) software_data ); | 460 | QPixmap software( ( const char** ) software_data ); |
461 | QPixmap general( ( const char** ) general_data ); | 461 | QPixmap general( ( const char** ) general_data ); |
462 | QPixmap image0( ( const char** ) zsafe_xpm ); | 462 | QPixmap image0( ( const char** ) zsafe_xpm ); |
463 | if ( !name ) | 463 | if ( !name ) |
464 | setName( "ZSafe" ); | 464 | setName( "ZSafe" ); |
465 | 465 | ||
466 | #ifdef DESKTOP | 466 | #ifdef DESKTOP |
467 | #ifdef WIN32 | 467 | #ifdef Q_WS_WIN |
468 | setGeometry(100, 150, DeskW, DeskH-30 ); | 468 | setGeometry(100, 150, DeskW, DeskH-30 ); |
469 | #else | 469 | #else |
470 | resize( DeskW, DeskH-30 ); | 470 | resize( DeskW, DeskH-30 ); |
471 | #endif | 471 | #endif |
472 | 472 | ||
473 | #else | 473 | #else |
474 | 474 | ||
475 | #ifdef JPATCH_HDE | 475 | #ifdef JPATCH_HDE |
476 | int DeskS; | 476 | int DeskS; |
477 | if(DeskW > DeskH) | 477 | if(DeskW > DeskH) |
478 | { | 478 | { |
479 | DeskS = DeskW; | 479 | DeskS = DeskW; |
@@ -489,25 +489,25 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) | |||
489 | resize( DeskW, DeskH-30 ); | 489 | resize( DeskW, DeskH-30 ); |
490 | #endif | 490 | #endif |
491 | 491 | ||
492 | #endif | 492 | #endif |
493 | setCaption( tr( "ZSafe" ) ); | 493 | setCaption( tr( "ZSafe" ) ); |
494 | QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe"; | 494 | QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe"; |
495 | QString filename = conf->readEntry(APP_KEY+"document"); | 495 | QString filename = conf->readEntry(APP_KEY+"document"); |
496 | if (filename.isEmpty() || filename.isNull()) | 496 | if (filename.isEmpty() || filename.isNull()) |
497 | { | 497 | { |
498 | 498 | ||
499 | // check if the directory application exists, if not | 499 | // check if the directory application exists, if not |
500 | // create it | 500 | // create it |
501 | // #ifndef WIN32 | 501 | // #ifndef Q_WS_WIN |
502 | // QString d1("Documents/application"); | 502 | // QString d1("Documents/application"); |
503 | // #else | 503 | // #else |
504 | QString d1(QDir::homeDirPath() + "/Documents/application"); | 504 | QString d1(QDir::homeDirPath() + "/Documents/application"); |
505 | // #endif | 505 | // #endif |
506 | QDir pd1(d1); | 506 | QDir pd1(d1); |
507 | if (!pd1.exists()) | 507 | if (!pd1.exists()) |
508 | { | 508 | { |
509 | 509 | ||
510 | QDir pd2(QDir::homeDirPath() + "/Documents"); | 510 | QDir pd2(QDir::homeDirPath() + "/Documents"); |
511 | if (!pd2.exists()) { | 511 | if (!pd2.exists()) { |
512 | QDir pd3(QDir::homeDirPath()); | 512 | QDir pd3(QDir::homeDirPath()); |
513 | if (!pd3.mkdir("Documents", FALSE)) { | 513 | if (!pd3.mkdir("Documents", FALSE)) { |
@@ -516,25 +516,25 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) | |||
516 | 516 | ||
517 | if (!pd2.mkdir("application", FALSE)) | 517 | if (!pd2.mkdir("application", FALSE)) |
518 | { | 518 | { |
519 | QMessageBox::critical( 0, tr("ZSafe"), | 519 | QMessageBox::critical( 0, tr("ZSafe"), |
520 | #ifdef JPATCH_HDE | 520 | #ifdef JPATCH_HDE |
521 | tr("<P>Can't create directory ..."+d1+"</P><P>ZSafe will now exit.</P>")); | 521 | tr("<P>Can't create directory ..."+d1+"</P><P>ZSafe will now exit.</P>")); |
522 | #else | 522 | #else |
523 | tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d1)); | 523 | tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d1)); |
524 | #endif | 524 | #endif |
525 | exitZs (1); | 525 | exitZs (1); |
526 | } | 526 | } |
527 | } | 527 | } |
528 | // #ifndef WIN32 | 528 | // #ifndef Q_WS_WIN |
529 | // QString d2("Documents/application/zsafe"); | 529 | // QString d2("Documents/application/zsafe"); |
530 | // #else | 530 | // #else |
531 | QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); | 531 | QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); |
532 | // #endif | 532 | // #endif |
533 | QDir pd2(d2); | 533 | QDir pd2(d2); |
534 | if (!pd2.exists()) | 534 | if (!pd2.exists()) |
535 | { | 535 | { |
536 | if (!pd1.mkdir("zsafe", FALSE)) | 536 | if (!pd1.mkdir("zsafe", FALSE)) |
537 | { | 537 | { |
538 | QMessageBox::critical( 0, tr("ZSafe"), | 538 | QMessageBox::critical( 0, tr("ZSafe"), |
539 | #ifdef JPATCH_HDE | 539 | #ifdef JPATCH_HDE |
540 | tr("<P>Can't create directory ...//Documents/application/zsafe</P><P>ZSafe will now exit.</P")); | 540 | tr("<P>Can't create directory ...//Documents/application/zsafe</P><P>ZSafe will now exit.</P")); |
@@ -547,38 +547,38 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) | |||
547 | 547 | ||
548 | // set the default filename | 548 | // set the default filename |
549 | filename = zsafeAppDirPath + "/passwords.zsf"; | 549 | filename = zsafeAppDirPath + "/passwords.zsf"; |
550 | 550 | ||
551 | // save the current filename to the config file | 551 | // save the current filename to the config file |
552 | conf->writeEntry(APP_KEY+"document", filename); | 552 | conf->writeEntry(APP_KEY+"document", filename); |
553 | saveConf(); | 553 | saveConf(); |
554 | } | 554 | } |
555 | //if (filename == "INVALIDPWD") | 555 | //if (filename == "INVALIDPWD") |
556 | //filename = ""; | 556 | //filename = ""; |
557 | 557 | ||
558 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); | 558 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); |
559 | #ifdef WIN32 | 559 | #ifdef Q_WS_WIN |
560 | this->setCaption("Qt ZSafe: " + ti); | 560 | this->setCaption("Qt ZSafe: " + ti); |
561 | #else | 561 | #else |
562 | this->setCaption("ZSafe: " + ti); | 562 | this->setCaption("ZSafe: " + ti); |
563 | #endif | 563 | #endif |
564 | 564 | ||
565 | selectedItem = NULL; | 565 | selectedItem = NULL; |
566 | lastSearchedCategory = NULL; | 566 | lastSearchedCategory = NULL; |
567 | lastSearchedItem = NULL; | 567 | lastSearchedItem = NULL; |
568 | lastSearchedName = ""; | 568 | lastSearchedName = ""; |
569 | lastSearchedUsername = ""; | 569 | lastSearchedUsername = ""; |
570 | lastSearchedComment = ""; | 570 | lastSearchedComment = ""; |
571 | 571 | ||
572 | infoForm = new InfoForm(); | 572 | infoForm = new InfoForm(this, "show_info", TRUE); |
573 | categoryDialog = NULL; | 573 | categoryDialog = NULL; |
574 | infoForm->setIcon( image0); | 574 | infoForm->setIcon( image0); |
575 | 575 | ||
576 | // add a menu bar | 576 | // add a menu bar |
577 | QMenuBar *menu = new QMenuBar( this ); | 577 | QMenuBar *menu = new QMenuBar( this ); |
578 | 578 | ||
579 | // add file menu | 579 | // add file menu |
580 | // QPopupMenu *file = new QPopupMenu( this ); | 580 | // QPopupMenu *file = new QPopupMenu( this ); |
581 | file = new QPopupMenu( this ); | 581 | file = new QPopupMenu( this ); |
582 | 582 | ||
583 | // #ifdef DESKTOP | 583 | // #ifdef DESKTOP |
584 | file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) ); | 584 | file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) ); |
@@ -761,53 +761,63 @@ void ZSafe::deletePwd() | |||
761 | { | 761 | { |
762 | delCategory(); | 762 | delCategory(); |
763 | } | 763 | } |
764 | } | 764 | } |
765 | 765 | ||
766 | void ZSafe::editPwd() | 766 | void ZSafe::editPwd() |
767 | { | 767 | { |
768 | if (!selectedItem) | 768 | if (!selectedItem) |
769 | return; | 769 | return; |
770 | if (!isCategory(selectedItem)) | 770 | if (!isCategory(selectedItem)) |
771 | { | 771 | { |
772 | // open the 'New Entry' dialog | 772 | // open the 'New Entry' dialog |
773 | NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE); | 773 | NewDialog *dialog = new NewDialog(this, "edit_entry", TRUE); |
774 | #ifdef WIN32 | 774 | #ifdef Q_WS_WIN |
775 | dialog->setCaption ("Qt " + tr("Edit Entry")); | 775 | dialog->setCaption ("Qt " + tr("Edit Entry")); |
776 | dialog->setGeometry(200, 250, 220, 310 ); | 776 | dialog->setGeometry(200, 250, 220, 310 ); |
777 | #endif | 777 | #endif |
778 | 778 | ||
779 | // set the labels | 779 | // set the labels |
780 | dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); | 780 | dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); |
781 | dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); | 781 | dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); |
782 | dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); | 782 | dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); |
783 | dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); | 783 | dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); |
784 | dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); | 784 | dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); |
785 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); | 785 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); |
786 | 786 | ||
787 | // set the fields | 787 | // set the fields |
788 | dialog->NameField->setText(selectedItem->text (0)); | 788 | dialog->NameField->setText(selectedItem->text (0)); |
789 | dialog->UsernameField->setText(selectedItem->text (1)); | 789 | dialog->UsernameField->setText(selectedItem->text (1)); |
790 | dialog->PasswordField->setText(selectedItem->text (2)); | 790 | dialog->PasswordField->setText(selectedItem->text (2)); |
791 | QString comment = selectedItem->text (3); | 791 | QString comment = selectedItem->text (3); |
792 | comment.replace (QRegExp("<br>"), "\n"); | 792 | comment.replace (QRegExp("<br>"), "\n"); |
793 | dialog->Field5->setText(selectedItem->text (4)); | 793 | dialog->Field5->setText(selectedItem->text (4)); |
794 | dialog->Field6->setText(selectedItem->text (5)); | 794 | dialog->Field6->setText(selectedItem->text (5)); |
795 | dialog->CommentField->insertLine(comment); | 795 | dialog->CommentField->insertLine(comment); |
796 | dialog->CommentField->setCursorPosition(0,0); | 796 | dialog->CommentField->setCursorPosition(0,0); |
797 | 797 | ||
798 | #ifdef Q_WS_QWS | ||
798 | DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); | 799 | DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); |
799 | 800 | #endif | |
801 | |||
800 | #ifdef DESKTOP | 802 | #ifdef DESKTOP |
801 | result = Accepted; | 803 | #ifndef Q_QW_QWIN |
804 | dialog->show(); | ||
805 | #endif | ||
806 | #else | ||
807 | dialog->showMaximized(); | ||
808 | #endif | ||
809 | int result = dialog->exec(); | ||
810 | #ifdef DESKTOP | ||
811 | // result = QDialog::Accepted; | ||
802 | #endif | 812 | #endif |
803 | if (result == Accepted) | 813 | if (result == Accepted) |
804 | { | 814 | { |
805 | modified = true; | 815 | modified = true; |
806 | // edit the selected item | 816 | // edit the selected item |
807 | QString name = dialog->NameField->text(); | 817 | QString name = dialog->NameField->text(); |
808 | selectedItem->setText (0, tr (name)); | 818 | selectedItem->setText (0, tr (name)); |
809 | QString user = dialog->UsernameField->text(); | 819 | QString user = dialog->UsernameField->text(); |
810 | selectedItem->setText (1, tr (user)); | 820 | selectedItem->setText (1, tr (user)); |
811 | QString pwd = dialog->PasswordField->text(); | 821 | QString pwd = dialog->PasswordField->text(); |
812 | selectedItem->setText (2, tr (pwd)); | 822 | selectedItem->setText (2, tr (pwd)); |
813 | QString comment = dialog->CommentField->text(); | 823 | QString comment = dialog->CommentField->text(); |
@@ -831,41 +841,52 @@ void ZSafe::newPwd() | |||
831 | { | 841 | { |
832 | if (!selectedItem) | 842 | if (!selectedItem) |
833 | return; | 843 | return; |
834 | 844 | ||
835 | if (!isCategory(selectedItem)) | 845 | if (!isCategory(selectedItem)) |
836 | selectedItem = selectedItem->parent(); | 846 | selectedItem = selectedItem->parent(); |
837 | 847 | ||
838 | if (isCategory(selectedItem)) | 848 | if (isCategory(selectedItem)) |
839 | { | 849 | { |
840 | QString cat = selectedItem->text(0); | 850 | QString cat = selectedItem->text(0); |
841 | 851 | ||
842 | // open the 'New Entry' dialog | 852 | // open the 'New Entry' dialog |
843 | NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE); | 853 | NewDialog *dialog = new NewDialog(this, "new_entry", TRUE); |
844 | #ifdef WIN32 | 854 | #ifdef Q_WS_WIN |
845 | dialog->setCaption ("Qt " + tr("New Entry")); | 855 | dialog->setCaption ("Qt " + tr("New Entry")); |
846 | dialog->setGeometry(200, 250, 220, 310 ); | 856 | dialog->setGeometry(200, 250, 220, 310 ); |
847 | #endif | 857 | #endif |
848 | // set the labels | 858 | // set the labels |
849 | dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); | 859 | dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); |
850 | dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); | 860 | dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); |
851 | dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); | 861 | dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); |
852 | dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); | 862 | dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); |
853 | dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); | 863 | dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); |
854 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); | 864 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); |
855 | retype: | 865 | retype: |
856 | 866 | ||
867 | #ifdef Q_WS_QWS | ||
857 | DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); | 868 | DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); |
869 | #endif | ||
870 | |||
858 | #ifdef DESKTOP | 871 | #ifdef DESKTOP |
859 | result = Accepted; | 872 | #ifndef Q_QW_QWIN |
873 | dialog->show(); | ||
874 | #endif | ||
875 | #else | ||
876 | dialog->showMaximized(); | ||
877 | #endif | ||
878 | #ifdef DESKTOP | ||
879 | int result = dialog->exec(); | ||
880 | // result = QDialog::Accepted; | ||
860 | #endif | 881 | #endif |
861 | 882 | ||
862 | if (result == Accepted) | 883 | if (result == Accepted) |
863 | { | 884 | { |
864 | 885 | ||
865 | QString name = dialog->NameField->text(); | 886 | QString name = dialog->NameField->text(); |
866 | if (cat == name) | 887 | if (cat == name) |
867 | { | 888 | { |
868 | QMessageBox::critical( 0, tr("ZSafe"), | 889 | QMessageBox::critical( 0, tr("ZSafe"), |
869 | tr("Entry name must be different\nfrom the category name.") ); | 890 | tr("Entry name must be different\nfrom the category name.") ); |
870 | goto retype; // it's not a good programming style :-) | 891 | goto retype; // it's not a good programming style :-) |
871 | } | 892 | } |
@@ -889,25 +910,25 @@ retype: | |||
889 | i->setText (5, tr (f6)); | 910 | i->setText (5, tr (f6)); |
890 | } | 911 | } |
891 | 912 | ||
892 | delete dialog; | 913 | delete dialog; |
893 | } | 914 | } |
894 | } | 915 | } |
895 | 916 | ||
896 | void ZSafe::findPwd() | 917 | void ZSafe::findPwd() |
897 | { | 918 | { |
898 | 919 | ||
899 | // open the 'Search' dialog | 920 | // open the 'Search' dialog |
900 | SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); | 921 | SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); |
901 | #ifdef WIN32 | 922 | #ifdef Q_WS_WIN |
902 | dialog->setCaption ("Qt " + tr("Search")); | 923 | dialog->setCaption ("Qt " + tr("Search")); |
903 | #endif | 924 | #endif |
904 | 925 | ||
905 | #ifdef DESKTOP | 926 | #ifdef DESKTOP |
906 | #endif | 927 | #endif |
907 | if (lastSearchedName) | 928 | if (lastSearchedName) |
908 | dialog->NameField->setText(lastSearchedName); | 929 | dialog->NameField->setText(lastSearchedName); |
909 | else | 930 | else |
910 | dialog->NameField->setText(""); | 931 | dialog->NameField->setText(""); |
911 | if (lastSearchedUsername) | 932 | if (lastSearchedUsername) |
912 | dialog->UsernameField->setText(lastSearchedUsername); | 933 | dialog->UsernameField->setText(lastSearchedUsername); |
913 | else | 934 | else |
@@ -1069,55 +1090,55 @@ QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def) | |||
1069 | { | 1090 | { |
1070 | QListViewItem *cat = _item->parent(); | 1091 | QListViewItem *cat = _item->parent(); |
1071 | category = cat->text(0); | 1092 | category = cat->text(0); |
1072 | } | 1093 | } |
1073 | } | 1094 | } |
1074 | else | 1095 | else |
1075 | { | 1096 | { |
1076 | return def; | 1097 | return def; |
1077 | } | 1098 | } |
1078 | 1099 | ||
1079 | QString app_key = APP_KEY; | 1100 | QString app_key = APP_KEY; |
1080 | #ifndef DESKTOP | 1101 | #ifndef DESKTOP |
1081 | #ifndef WIN32 | 1102 | #ifndef Q_WS_WIN |
1082 | conf->setGroup ("fieldDefs"); | 1103 | conf->setGroup ("fieldDefs"); |
1083 | #endif | 1104 | #endif |
1084 | #else | 1105 | #else |
1085 | #ifndef WIN32 | 1106 | #ifndef Q_WS_WIN |
1086 | app_key += "/fieldDefs/"; | 1107 | app_key += "/fieldDefs/"; |
1087 | #endif | 1108 | #endif |
1088 | #endif | 1109 | #endif |
1089 | // #ifndef WIN32 | 1110 | // #ifndef Q_WS_WIN |
1090 | QString label = conf->readEntry(app_key+category+"-field"+field,def); | 1111 | QString label = conf->readEntry(app_key+category+"-field"+field,def); |
1091 | // #else | 1112 | // #else |
1092 | // QString label(def); | 1113 | // QString label(def); |
1093 | // #endif | 1114 | // #endif |
1094 | 1115 | ||
1095 | #ifndef DESKTOP | 1116 | #ifndef DESKTOP |
1096 | conf->setGroup ("zsafe"); | 1117 | conf->setGroup ("zsafe"); |
1097 | #endif | 1118 | #endif |
1098 | return label; | 1119 | return label; |
1099 | } | 1120 | } |
1100 | 1121 | ||
1101 | QString ZSafe::getFieldLabel (QString category, QString field, QString def) | 1122 | QString ZSafe::getFieldLabel (QString category, QString field, QString def) |
1102 | { | 1123 | { |
1103 | QString app_key = APP_KEY; | 1124 | QString app_key = APP_KEY; |
1104 | #ifndef DESKTOP | 1125 | #ifndef DESKTOP |
1105 | conf->setGroup ("fieldDefs"); | 1126 | conf->setGroup ("fieldDefs"); |
1106 | #else | 1127 | #else |
1107 | #ifndef WIN32 | 1128 | #ifndef Q_WS_WIN |
1108 | app_key += "/fieldDefs/"; | 1129 | app_key += "/fieldDefs/"; |
1109 | #endif | 1130 | #endif |
1110 | #endif | 1131 | #endif |
1111 | // #ifndef WIN32 | 1132 | // #ifndef Q_WS_WIN |
1112 | QString label = conf->readEntry(app_key+category+"-field"+field, | 1133 | QString label = conf->readEntry(app_key+category+"-field"+field, |
1113 | def); | 1134 | def); |
1114 | // #else | 1135 | // #else |
1115 | // QString label(def); | 1136 | // QString label(def); |
1116 | // #endif | 1137 | // #endif |
1117 | #ifndef DESKTOP | 1138 | #ifndef DESKTOP |
1118 | conf->setGroup ("zsafe"); | 1139 | conf->setGroup ("zsafe"); |
1119 | #endif | 1140 | #endif |
1120 | return label; | 1141 | return label; |
1121 | } | 1142 | } |
1122 | 1143 | ||
1123 | void ZSafe::showInfo( QListViewItem *_item) | 1144 | void ZSafe::showInfo( QListViewItem *_item) |
@@ -1199,48 +1220,54 @@ void ZSafe::showInfo( QListViewItem *_item) | |||
1199 | text += "<u><b>"; | 1220 | text += "<u><b>"; |
1200 | text += getFieldLabel (selectedItem, "4", tr("Comment")); | 1221 | text += getFieldLabel (selectedItem, "4", tr("Comment")); |
1201 | text += ":<br> </b></u>"; | 1222 | text += ":<br> </b></u>"; |
1202 | QString comment = selectedItem->text(3); | 1223 | QString comment = selectedItem->text(3); |
1203 | comment.replace (QRegExp("\n"), "<br>"); | 1224 | comment.replace (QRegExp("\n"), "<br>"); |
1204 | text += comment; | 1225 | text += comment; |
1205 | // text += "<br>"; | 1226 | // text += "<br>"; |
1206 | } | 1227 | } |
1207 | 1228 | ||
1208 | text += "</body></html>"; | 1229 | text += "</body></html>"; |
1209 | 1230 | ||
1210 | infoForm->InfoText->setText(text); | 1231 | infoForm->InfoText->setText(text); |
1211 | infoForm->hide(); | 1232 | // infoForm->hide(); |
1233 | #ifdef Q_WS_QWS | ||
1212 | QPEApplication::showDialog( infoForm ); | 1234 | QPEApplication::showDialog( infoForm ); |
1235 | #endif | ||
1236 | |||
1237 | #ifdef DESKTOP | ||
1238 | infoForm->show(); | ||
1239 | #endif | ||
1213 | } | 1240 | } |
1214 | } | 1241 | } |
1215 | 1242 | ||
1216 | void ZSafe::listViewSelected( QListViewItem *_item) | 1243 | void ZSafe::listViewSelected( QListViewItem *_item) |
1217 | { | 1244 | { |
1218 | if (!_item) | 1245 | if (!_item) |
1219 | return; | 1246 | return; |
1220 | if (selectedItem != NULL) | 1247 | if (selectedItem != NULL) |
1221 | selectedItem->setSelected(FALSE); | 1248 | selectedItem->setSelected(FALSE); |
1222 | 1249 | ||
1223 | selectedItem = _item; | 1250 | selectedItem = _item; |
1224 | 1251 | ||
1225 | #ifndef DESKTOP | 1252 | #ifndef DESKTOP |
1226 | // set the column text dependent on the selected item | 1253 | // set the column text dependent on the selected item |
1227 | ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); | 1254 | ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); |
1228 | ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); | 1255 | ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); |
1229 | ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); | 1256 | ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); |
1230 | ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); | 1257 | ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); |
1231 | ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); | 1258 | ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); |
1232 | ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); | 1259 | ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); |
1233 | #endif | 1260 | #endif |
1234 | #ifdef WIN32 | 1261 | #ifdef Q_WS_WIN |
1235 | // set the column text dependent on the selected item | 1262 | // set the column text dependent on the selected item |
1236 | ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); | 1263 | ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); |
1237 | ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); | 1264 | ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); |
1238 | ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); | 1265 | ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); |
1239 | ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); | 1266 | ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); |
1240 | ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); | 1267 | ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); |
1241 | ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); | 1268 | ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); |
1242 | #endif | 1269 | #endif |
1243 | 1270 | ||
1244 | } | 1271 | } |
1245 | 1272 | ||
1246 | bool ZSafe::isCategory(QListViewItem *_item) | 1273 | bool ZSafe::isCategory(QListViewItem *_item) |
@@ -1477,25 +1504,25 @@ void ZSafe::readAllEntries() | |||
1477 | #ifndef NO_OPIE | 1504 | #ifndef NO_OPIE |
1478 | owarn << "ReadAllEntries(): " << oendl; | 1505 | owarn << "ReadAllEntries(): " << oendl; |
1479 | #else | 1506 | #else |
1480 | qWarning ("ReadAllEntries(): "); | 1507 | qWarning ("ReadAllEntries(): "); |
1481 | #endif | 1508 | #endif |
1482 | 1509 | ||
1483 | QTextStream t(&f); | 1510 | QTextStream t(&f); |
1484 | while ( !t.eof() ) | 1511 | while ( !t.eof() ) |
1485 | { | 1512 | { |
1486 | QString s = t.readLine(); | 1513 | QString s = t.readLine(); |
1487 | s.replace (QRegExp("\";\""), "\"|\""); | 1514 | s.replace (QRegExp("\";\""), "\"|\""); |
1488 | // char buffer[1024]; | 1515 | // char buffer[1024]; |
1489 | #ifndef WIN32 | 1516 | #ifndef Q_WS_WIN |
1490 | char buffer[s.length()+1]; | 1517 | char buffer[s.length()+1]; |
1491 | #else | 1518 | #else |
1492 | char buffer[4048]; | 1519 | char buffer[4048]; |
1493 | #endif | 1520 | #endif |
1494 | 1521 | ||
1495 | 1522 | ||
1496 | /* modify QString -> QCString::utf8 */ | 1523 | /* modify QString -> QCString::utf8 */ |
1497 | 1524 | ||
1498 | strcpy (buffer, s.utf8()); | 1525 | strcpy (buffer, s.utf8()); |
1499 | 1526 | ||
1500 | QString name; | 1527 | QString name; |
1501 | QString user; | 1528 | QString user; |
@@ -1576,25 +1603,25 @@ void ZSafe::readAllEntries() | |||
1576 | item->setText( 3, tr( comment ) ); | 1603 | item->setText( 3, tr( comment ) ); |
1577 | item->setText( 4, tr( field5 ) ); | 1604 | item->setText( 4, tr( field5 ) ); |
1578 | item->setText( 5, tr( field6 ) ); | 1605 | item->setText( 5, tr( field6 ) ); |
1579 | 1606 | ||
1580 | catI->setOpen( TRUE ); | 1607 | catI->setOpen( TRUE ); |
1581 | 1608 | ||
1582 | Category *c1 = new Category(); | 1609 | Category *c1 = new Category(); |
1583 | c1->setCategoryName(category); | 1610 | c1->setCategoryName(category); |
1584 | 1611 | ||
1585 | QString icon; | 1612 | QString icon; |
1586 | QString fullIconPath; | 1613 | QString fullIconPath; |
1587 | QPixmap *pix; | 1614 | QPixmap *pix; |
1588 | // #ifndef WIN32 | 1615 | // #ifndef Q_WS_WIN |
1589 | icon = conf->readEntry(APP_KEY+category); | 1616 | icon = conf->readEntry(APP_KEY+category); |
1590 | // #endif | 1617 | // #endif |
1591 | bool isIconAv = false; | 1618 | bool isIconAv = false; |
1592 | if (!icon.isEmpty() && !icon.isNull()) | 1619 | if (!icon.isEmpty() && !icon.isNull()) |
1593 | { | 1620 | { |
1594 | // build the full path | 1621 | // build the full path |
1595 | fullIconPath = iconPath + icon; | 1622 | fullIconPath = iconPath + icon; |
1596 | pix = new QPixmap (fullIconPath); | 1623 | pix = new QPixmap (fullIconPath); |
1597 | if (!pix->isNull()) | 1624 | if (!pix->isNull()) |
1598 | { | 1625 | { |
1599 | QImage img = pix->convertToImage(); | 1626 | QImage img = pix->convertToImage(); |
1600 | pix->convertFromImage(img.smoothScale(14,14)); | 1627 | pix->convertFromImage(img.smoothScale(14,14)); |
@@ -1729,25 +1756,25 @@ void ZSafe::readAllEntries() | |||
1729 | #ifndef NO_OPIE | 1756 | #ifndef NO_OPIE |
1730 | owarn << "ReadAllEntries(): " << oendl; | 1757 | owarn << "ReadAllEntries(): " << oendl; |
1731 | #else | 1758 | #else |
1732 | qWarning ("ReadAllEntries(): "); | 1759 | qWarning ("ReadAllEntries(): "); |
1733 | #endif | 1760 | #endif |
1734 | QTextStream t(&f); | 1761 | QTextStream t(&f); |
1735 | while ( !t.eof() ) | 1762 | while ( !t.eof() ) |
1736 | { | 1763 | { |
1737 | QString s = t.readLine(); | 1764 | QString s = t.readLine(); |
1738 | s.replace (QRegExp("\";\""), "\"|\""); | 1765 | s.replace (QRegExp("\";\""), "\"|\""); |
1739 | // char buffer[1024]; | 1766 | // char buffer[1024]; |
1740 | int len=s.length()+1; | 1767 | int len=s.length()+1; |
1741 | #ifdef WIN32 | 1768 | #ifdef Q_WS_WIN |
1742 | char buffer[512]; | 1769 | char buffer[512]; |
1743 | #else | 1770 | #else |
1744 | char buffer[len]; | 1771 | char buffer[len]; |
1745 | #endif | 1772 | #endif |
1746 | strcpy (buffer, s); | 1773 | strcpy (buffer, s); |
1747 | 1774 | ||
1748 | QString name; | 1775 | QString name; |
1749 | QString user; | 1776 | QString user; |
1750 | QString password; | 1777 | QString password; |
1751 | QString comment; | 1778 | QString comment; |
1752 | 1779 | ||
1753 | // separete the entries | 1780 | // separete the entries |
@@ -1809,25 +1836,25 @@ void ZSafe::readAllEntries() | |||
1809 | item->setText( 1, tr( user ) ); | 1836 | item->setText( 1, tr( user ) ); |
1810 | item->setText( 2, tr( password ) ); | 1837 | item->setText( 2, tr( password ) ); |
1811 | item->setText( 3, tr( comment ) ); | 1838 | item->setText( 3, tr( comment ) ); |
1812 | 1839 | ||
1813 | catI->setOpen( TRUE ); | 1840 | catI->setOpen( TRUE ); |
1814 | 1841 | ||
1815 | Category *c1 = new Category(); | 1842 | Category *c1 = new Category(); |
1816 | c1->setCategoryName(category); | 1843 | c1->setCategoryName(category); |
1817 | 1844 | ||
1818 | QString icon; | 1845 | QString icon; |
1819 | QString fullIconPath; | 1846 | QString fullIconPath; |
1820 | QPixmap *pix; | 1847 | QPixmap *pix; |
1821 | // #ifndef WIN32 | 1848 | // #ifndef Q_WS_WIN |
1822 | icon = conf->readEntry(APP_KEY+category); | 1849 | icon = conf->readEntry(APP_KEY+category); |
1823 | // #endif | 1850 | // #endif |
1824 | bool isIconAv = false; | 1851 | bool isIconAv = false; |
1825 | if (!icon.isEmpty() && !icon.isNull()) | 1852 | if (!icon.isEmpty() && !icon.isNull()) |
1826 | { | 1853 | { |
1827 | // build the full path | 1854 | // build the full path |
1828 | fullIconPath = iconPath + icon; | 1855 | fullIconPath = iconPath + icon; |
1829 | pix = new QPixmap (fullIconPath); | 1856 | pix = new QPixmap (fullIconPath); |
1830 | if (!pix->isNull()) | 1857 | if (!pix->isNull()) |
1831 | { | 1858 | { |
1832 | QImage img = pix->convertToImage(); | 1859 | QImage img = pix->convertToImage(); |
1833 | pix->convertFromImage(img.smoothScale(14,14)); | 1860 | pix->convertFromImage(img.smoothScale(14,14)); |
@@ -1887,25 +1914,25 @@ void ZSafe::resume(int) | |||
1887 | // ask for password and read again | 1914 | // ask for password and read again |
1888 | openDocument(filename); | 1915 | openDocument(filename); |
1889 | } | 1916 | } |
1890 | } | 1917 | } |
1891 | 1918 | ||
1892 | //--------------------------------------------- | 1919 | //--------------------------------------------- |
1893 | 1920 | ||
1894 | 1921 | ||
1895 | bool ZSafe::openDocument(const char* _filename, const char* ) | 1922 | bool ZSafe::openDocument(const char* _filename, const char* ) |
1896 | { | 1923 | { |
1897 | int retval; | 1924 | int retval; |
1898 | char* entry[FIELD_SIZE]; | 1925 | char* entry[FIELD_SIZE]; |
1899 | // #ifndef WIN32 | 1926 | // #ifndef Q_WS_WIN |
1900 | int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1); | 1927 | int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1); |
1901 | // #else | 1928 | // #else |
1902 | // int validationFlag = 1; | 1929 | // int validationFlag = 1; |
1903 | // #endif | 1930 | // #endif |
1904 | 1931 | ||
1905 | int pwdOk = 0; | 1932 | int pwdOk = 0; |
1906 | int numberOfTries = 3; | 1933 | int numberOfTries = 3; |
1907 | for (int i=0; i < numberOfTries; i++) | 1934 | for (int i=0; i < numberOfTries; i++) |
1908 | { | 1935 | { |
1909 | QFile f(_filename); | 1936 | QFile f(_filename); |
1910 | if (f.exists()) | 1937 | if (f.exists()) |
1911 | { | 1938 | { |
@@ -1928,25 +1955,25 @@ bool ZSafe::openDocument(const char* _filename, const char* ) | |||
1928 | if (retval != PWERR_GOOD) | 1955 | if (retval != PWERR_GOOD) |
1929 | { | 1956 | { |
1930 | #ifndef NO_OPIE | 1957 | #ifndef NO_OPIE |
1931 | owarn << "Error loading Document" << oendl; | 1958 | owarn << "Error loading Document" << oendl; |
1932 | #else | 1959 | #else |
1933 | qWarning ("Error loading Document"); | 1960 | qWarning ("Error loading Document"); |
1934 | #endif | 1961 | #endif |
1935 | return false; | 1962 | return false; |
1936 | } | 1963 | } |
1937 | } | 1964 | } |
1938 | else | 1965 | else |
1939 | { | 1966 | { |
1940 | #ifdef WIN32 | 1967 | #ifdef Q_WS_WIN |
1941 | this->setCaption("Qt ZSafe"); | 1968 | this->setCaption("Qt ZSafe"); |
1942 | #else | 1969 | #else |
1943 | this->setCaption("ZSafe"); | 1970 | this->setCaption("ZSafe"); |
1944 | #endif | 1971 | #endif |
1945 | filename = ""; | 1972 | filename = ""; |
1946 | return false; | 1973 | return false; |
1947 | } | 1974 | } |
1948 | 1975 | ||
1949 | 1976 | ||
1950 | // load the validation entry | 1977 | // load the validation entry |
1951 | if (validationFlag == 0) | 1978 | if (validationFlag == 0) |
1952 | { | 1979 | { |
@@ -2045,25 +2072,25 @@ bool ZSafe::openDocument(const char* _filename, const char* ) | |||
2045 | item->setText( 4, tr( field5 ) ); | 2072 | item->setText( 4, tr( field5 ) ); |
2046 | item->setText( 5, tr( field6 ) ); | 2073 | item->setText( 5, tr( field6 ) ); |
2047 | 2074 | ||
2048 | if (expandTree) | 2075 | if (expandTree) |
2049 | catI->setOpen( TRUE ); | 2076 | catI->setOpen( TRUE ); |
2050 | 2077 | ||
2051 | Category *c1 = new Category(); | 2078 | Category *c1 = new Category(); |
2052 | c1->setCategoryName(category); | 2079 | c1->setCategoryName(category); |
2053 | 2080 | ||
2054 | QString icon; | 2081 | QString icon; |
2055 | QString fullIconPath; | 2082 | QString fullIconPath; |
2056 | QPixmap *pix; | 2083 | QPixmap *pix; |
2057 | // #ifndef WIN32 | 2084 | // #ifndef Q_WS_WIN |
2058 | icon = conf->readEntry(APP_KEY+category); | 2085 | icon = conf->readEntry(APP_KEY+category); |
2059 | // #endif | 2086 | // #endif |
2060 | bool isIconAv = false; | 2087 | bool isIconAv = false; |
2061 | if (!icon.isEmpty() && !icon.isNull()) | 2088 | if (!icon.isEmpty() && !icon.isNull()) |
2062 | { | 2089 | { |
2063 | // build the full path | 2090 | // build the full path |
2064 | fullIconPath = iconPath + icon; | 2091 | fullIconPath = iconPath + icon; |
2065 | pix = new QPixmap (fullIconPath); | 2092 | pix = new QPixmap (fullIconPath); |
2066 | if (!pix->isNull()) | 2093 | if (!pix->isNull()) |
2067 | { | 2094 | { |
2068 | QImage img = pix->convertToImage(); | 2095 | QImage img = pix->convertToImage(); |
2069 | pix->convertFromImage(img.smoothScale(14,14)); | 2096 | pix->convertFromImage(img.smoothScale(14,14)); |
@@ -2131,42 +2158,42 @@ int ZSafe::loadInit(const char* _filename, const char *password) | |||
2131 | load_buffer_length = ((load_buffer_length / 1024)+1) * 1024 * 2; | 2158 | load_buffer_length = ((load_buffer_length / 1024)+1) * 1024 * 2; |
2132 | 2159 | ||
2133 | if (fd == NULL) | 2160 | if (fd == NULL) |
2134 | return PWERR_OPEN; | 2161 | return PWERR_OPEN; |
2135 | 2162 | ||
2136 | buffer = (char *)malloc(load_buffer_length); | 2163 | buffer = (char *)malloc(load_buffer_length); |
2137 | for (j = 0; password[j] != '\0'; j++) { | 2164 | for (j = 0; password[j] != '\0'; j++) { |
2138 | key[j] = password[j]; | 2165 | key[j] = password[j]; |
2139 | } | 2166 | } |
2140 | keylength = j; | 2167 | keylength = j; |
2141 | krc2->rc2_expandkey (key, keylength, 128); | 2168 | krc2->rc2_expandkey (key, keylength, 128); |
2142 | 2169 | ||
2143 | #ifndef WIN32 | 2170 | #ifndef Q_WS_WIN |
2144 | size = read(fileno (fd), (unsigned char *) (charbuf + count), 8); | 2171 | size = read(fileno (fd), (unsigned char *) (charbuf + count), 8); |
2145 | #else | 2172 | #else |
2146 | size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); | 2173 | size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); |
2147 | #endif | 2174 | #endif |
2148 | 2175 | ||
2149 | if (size < 8) | 2176 | if (size < 8) |
2150 | return PWERR_DATA; | 2177 | return PWERR_DATA; |
2151 | 2178 | ||
2152 | for (count = 0; count < 4; count++) { | 2179 | for (count = 0; count < 4; count++) { |
2153 | count2 = count << 1; | 2180 | count2 = count << 1; |
2154 | iv[count] = charbuf[count2] << 8; | 2181 | iv[count] = charbuf[count2] << 8; |
2155 | iv[count] += charbuf[count2 + 1]; | 2182 | iv[count] += charbuf[count2 + 1]; |
2156 | } | 2183 | } |
2157 | 2184 | ||
2158 | size = 0; | 2185 | size = 0; |
2159 | bufferIndex = 0; | 2186 | bufferIndex = 0; |
2160 | #ifndef WIN32 | 2187 | #ifndef Q_WS_WIN |
2161 | while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) { | 2188 | while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) { |
2162 | while (count < 8) { | 2189 | while (count < 8) { |
2163 | count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8); | 2190 | count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8); |
2164 | #else | 2191 | #else |
2165 | while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) { | 2192 | while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) { |
2166 | while (count < 8) { | 2193 | while (count < 8) { |
2167 | count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); | 2194 | count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); |
2168 | #endif | 2195 | #endif |
2169 | if (count2 == 0) { | 2196 | if (count2 == 0) { |
2170 | return PWERR_DATA; | 2197 | return PWERR_DATA; |
2171 | } | 2198 | } |
2172 | count += count2; | 2199 | count += count2; |
@@ -2330,25 +2357,25 @@ bool ZSafe::saveDocument(const char* _filename, | |||
2330 | 2357 | ||
2331 | retval = saveEntry(entry); | 2358 | retval = saveEntry(entry); |
2332 | for (int z=0; z<i; z++) free(entry[z]); | 2359 | for (int z=0; z<i; z++) free(entry[z]); |
2333 | if (retval == PWERR_DATA) { | 2360 | if (retval == PWERR_DATA) { |
2334 | #ifndef NO_OPIE | 2361 | #ifndef NO_OPIE |
2335 | owarn << "1: Error writing file, contents not saved" << oendl; | 2362 | owarn << "1: Error writing file, contents not saved" << oendl; |
2336 | #else | 2363 | #else |
2337 | qWarning("1: Error writing file, contents not saved"); | 2364 | qWarning("1: Error writing file, contents not saved"); |
2338 | #endif | 2365 | #endif |
2339 | saveFinalize(); | 2366 | saveFinalize(); |
2340 | return false; | 2367 | return false; |
2341 | } | 2368 | } |
2342 | // #ifndef WIN32 | 2369 | // #ifndef Q_WS_WIN |
2343 | conf->writeEntry(APP_KEY+"valzsafe", 1); | 2370 | conf->writeEntry(APP_KEY+"valzsafe", 1); |
2344 | // #endif | 2371 | // #endif |
2345 | saveConf(); | 2372 | saveConf(); |
2346 | } | 2373 | } |
2347 | 2374 | ||
2348 | QListViewItem *i; | 2375 | QListViewItem *i; |
2349 | // step through all categories | 2376 | // step through all categories |
2350 | for (i = ListView->firstChild(); | 2377 | for (i = ListView->firstChild(); |
2351 | i != NULL; | 2378 | i != NULL; |
2352 | i = i->nextSibling()) | 2379 | i = i->nextSibling()) |
2353 | { | 2380 | { |
2354 | // step through all subitems | 2381 | // step through all subitems |
@@ -2425,25 +2452,25 @@ void ZSafe::getDocPassword(QString title) | |||
2425 | newPwdDialog = dialog; | 2452 | newPwdDialog = dialog; |
2426 | newPwdDialogResult = false; | 2453 | newPwdDialogResult = false; |
2427 | 2454 | ||
2428 | QPixmap image0( ( const char** ) zsafe_xpm ); | 2455 | QPixmap image0( ( const char** ) zsafe_xpm ); |
2429 | dialog->setIcon( image0); | 2456 | dialog->setIcon( image0); |
2430 | 2457 | ||
2431 | connect( dialog->PasswordField, SIGNAL( returnPressed() ), | 2458 | connect( dialog->PasswordField, SIGNAL( returnPressed() ), |
2432 | this, SLOT( setPasswordDialogDone() ) ); | 2459 | this, SLOT( setPasswordDialogDone() ) ); |
2433 | 2460 | ||
2434 | // CS: !!! | 2461 | // CS: !!! |
2435 | // int pos = filename.findRev ('/'); | 2462 | // int pos = filename.findRev ('/'); |
2436 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); | 2463 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); |
2437 | #ifdef WIN32 | 2464 | #ifdef Q_WS_WIN |
2438 | dialog->setCaption("Qt " + ti); | 2465 | dialog->setCaption("Qt " + ti); |
2439 | #else | 2466 | #else |
2440 | dialog->setCaption(ti); | 2467 | dialog->setCaption(ti); |
2441 | #endif | 2468 | #endif |
2442 | // dialog->setCaption(title); | 2469 | // dialog->setCaption(title); |
2443 | 2470 | ||
2444 | dialog->PasswordField->setFocus(); | 2471 | dialog->PasswordField->setFocus(); |
2445 | DialogCode result = (DialogCode) dialog->exec(); | 2472 | DialogCode result = (DialogCode) dialog->exec(); |
2446 | #ifdef DESKTOP | 2473 | #ifdef DESKTOP |
2447 | result = Accepted; | 2474 | result = Accepted; |
2448 | #endif | 2475 | #endif |
2449 | 2476 | ||
@@ -2655,36 +2682,36 @@ void ZSafe::addCategory() | |||
2655 | { | 2682 | { |
2656 | // open the 'Category' dialog | 2683 | // open the 'Category' dialog |
2657 | bool initIcons = false; | 2684 | bool initIcons = false; |
2658 | // open the 'Category' dialog | 2685 | // open the 'Category' dialog |
2659 | CategoryDialog *dialog; | 2686 | CategoryDialog *dialog; |
2660 | if (categoryDialog) | 2687 | if (categoryDialog) |
2661 | { | 2688 | { |
2662 | dialog = categoryDialog; | 2689 | dialog = categoryDialog; |
2663 | } | 2690 | } |
2664 | else | 2691 | else |
2665 | { | 2692 | { |
2666 | categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); | 2693 | categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); |
2667 | #ifdef WIN32 | 2694 | #ifdef Q_WS_WIN |
2668 | categoryDialog->setCaption ("Qt " + tr("Category")); | 2695 | categoryDialog->setCaption ("Qt " + tr("Category")); |
2669 | #endif | 2696 | #endif |
2670 | dialog = categoryDialog; | 2697 | dialog = categoryDialog; |
2671 | connect( dialog->CategoryField, | 2698 | connect( dialog->CategoryField, |
2672 | SIGNAL( activated(const QString&)), | 2699 | SIGNAL( activated(const QString&)), |
2673 | this, SLOT( categoryFieldActivated(const QString&) ) ); | 2700 | this, SLOT( categoryFieldActivated(const QString&) ) ); |
2674 | initIcons = true; | 2701 | initIcons = true; |
2675 | } | 2702 | } |
2676 | 2703 | ||
2677 | #ifdef DESKTOP | 2704 | #ifdef DESKTOP |
2678 | #ifndef WIN32 | 2705 | #ifndef Q_WS_WIN |
2679 | QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); | 2706 | QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); |
2680 | #else | 2707 | #else |
2681 | // read all categories from the config file and store | 2708 | // read all categories from the config file and store |
2682 | // into a list | 2709 | // into a list |
2683 | QFile f (cfgFile); | 2710 | QFile f (cfgFile); |
2684 | QStringList list; | 2711 | QStringList list; |
2685 | if ( f.open(IO_ReadOnly) ) { // file opened successfully | 2712 | if ( f.open(IO_ReadOnly) ) { // file opened successfully |
2686 | QTextStream t( &f ); // use a text stream | 2713 | QTextStream t( &f ); // use a text stream |
2687 | QString s; | 2714 | QString s; |
2688 | int n = 1; | 2715 | int n = 1; |
2689 | while ( !t.eof() ) { // until end of file... | 2716 | while ( !t.eof() ) { // until end of file... |
2690 | s = t.readLine(); // line of text excluding '\n' | 2717 | s = t.readLine(); // line of text excluding '\n' |
@@ -2709,25 +2736,25 @@ void ZSafe::addCategory() | |||
2709 | } | 2736 | } |
2710 | #endif | 2737 | #endif |
2711 | QStringList::Iterator it = list.begin(); | 2738 | QStringList::Iterator it = list.begin(); |
2712 | QString categ; | 2739 | QString categ; |
2713 | QString firstCategory; | 2740 | QString firstCategory; |
2714 | dialog->CategoryField->clear(); // remove all items | 2741 | dialog->CategoryField->clear(); // remove all items |
2715 | while( it != list.end() ) | 2742 | while( it != list.end() ) |
2716 | { | 2743 | { |
2717 | QString *cat = new QString (*it); | 2744 | QString *cat = new QString (*it); |
2718 | if (cat->contains("-field1", FALSE)) | 2745 | if (cat->contains("-field1", FALSE)) |
2719 | { | 2746 | { |
2720 | #ifdef DESKTOP | 2747 | #ifdef DESKTOP |
2721 | #ifndef WIN32 | 2748 | #ifndef Q_WS_WIN |
2722 | categ = cat->section ("-field1", 0, 0); | 2749 | categ = cat->section ("-field1", 0, 0); |
2723 | #else | 2750 | #else |
2724 | int pos = cat->find ("-field1"); | 2751 | int pos = cat->find ("-field1"); |
2725 | categ = cat->left (pos); | 2752 | categ = cat->left (pos); |
2726 | #endif | 2753 | #endif |
2727 | #else | 2754 | #else |
2728 | int pos = cat->find ("-field1"); | 2755 | int pos = cat->find ("-field1"); |
2729 | cat->truncate(pos); | 2756 | cat->truncate(pos); |
2730 | categ = *cat; | 2757 | categ = *cat; |
2731 | #endif | 2758 | #endif |
2732 | if (!categ.isEmpty()) | 2759 | if (!categ.isEmpty()) |
2733 | { | 2760 | { |
@@ -2777,25 +2804,25 @@ void ZSafe::addCategory() | |||
2777 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); | 2804 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); |
2778 | #endif | 2805 | #endif |
2779 | QImage foo = imageOfFile.convertToImage(); | 2806 | QImage foo = imageOfFile.convertToImage(); |
2780 | foo = foo.smoothScale(16,16); | 2807 | foo = foo.smoothScale(16,16); |
2781 | imageOfFile.convertFromImage(foo); | 2808 | imageOfFile.convertFromImage(foo); |
2782 | dialog->IconField->insertItem(imageOfFile,fileName); | 2809 | dialog->IconField->insertItem(imageOfFile,fileName); |
2783 | } | 2810 | } |
2784 | ++it; | 2811 | ++it; |
2785 | } | 2812 | } |
2786 | waitDialog.hide(); | 2813 | waitDialog.hide(); |
2787 | } | 2814 | } |
2788 | 2815 | ||
2789 | #ifndef WIN32 | 2816 | #ifndef Q_WS_WIN |
2790 | dialog->show(); | 2817 | dialog->show(); |
2791 | #endif | 2818 | #endif |
2792 | #ifndef DESKTOP | 2819 | #ifndef DESKTOP |
2793 | // dialog->move (20, 100); | 2820 | // dialog->move (20, 100); |
2794 | #endif | 2821 | #endif |
2795 | DialogCode result = (DialogCode) dialog->exec(); | 2822 | DialogCode result = (DialogCode) dialog->exec(); |
2796 | #ifdef DESKTOP | 2823 | #ifdef DESKTOP |
2797 | result = Accepted; | 2824 | result = Accepted; |
2798 | #endif | 2825 | #endif |
2799 | 2826 | ||
2800 | QString category; | 2827 | QString category; |
2801 | QString icon; | 2828 | QString icon; |
@@ -2816,25 +2843,25 @@ void ZSafe::addCategory() | |||
2816 | c1->setCategoryName(category); | 2843 | c1->setCategoryName(category); |
2817 | 2844 | ||
2818 | // if (!icon.isEmpty() && !icon.isNull()) | 2845 | // if (!icon.isEmpty() && !icon.isNull()) |
2819 | if (icon != "predefined.png") | 2846 | if (icon != "predefined.png") |
2820 | { | 2847 | { |
2821 | // build the full path | 2848 | // build the full path |
2822 | fullIconPath = iconPath + icon; | 2849 | fullIconPath = iconPath + icon; |
2823 | pix = new QPixmap (fullIconPath); | 2850 | pix = new QPixmap (fullIconPath); |
2824 | // pix->resize(14, 14); | 2851 | // pix->resize(14, 14); |
2825 | if (!pix->isNull()) | 2852 | if (!pix->isNull()) |
2826 | { | 2853 | { |
2827 | // save the full pixmap name into the config file | 2854 | // save the full pixmap name into the config file |
2828 | // #ifndef WIN32 | 2855 | // #ifndef Q_WS_WIN |
2829 | conf->writeEntry(APP_KEY+category, icon); | 2856 | conf->writeEntry(APP_KEY+category, icon); |
2830 | // #endif | 2857 | // #endif |
2831 | saveConf(); | 2858 | saveConf(); |
2832 | QImage img = pix->convertToImage(); | 2859 | QImage img = pix->convertToImage(); |
2833 | pix->convertFromImage(img.smoothScale(14,14)); | 2860 | pix->convertFromImage(img.smoothScale(14,14)); |
2834 | c1->setIcon (*pix); | 2861 | c1->setIcon (*pix); |
2835 | c1->setIconName(icon); | 2862 | c1->setIconName(icon); |
2836 | } | 2863 | } |
2837 | else | 2864 | else |
2838 | { | 2865 | { |
2839 | QPixmap folder( ( const char** ) general_data ); | 2866 | QPixmap folder( ( const char** ) general_data ); |
2840 | c1->setIcon (folder); | 2867 | c1->setIcon (folder); |
@@ -2868,25 +2895,25 @@ void ZSafe::delCategory() | |||
2868 | return; | 2895 | return; |
2869 | if (isCategory(selectedItem)) | 2896 | if (isCategory(selectedItem)) |
2870 | { | 2897 | { |
2871 | switch( QMessageBox::information( this, tr("ZSafe"), | 2898 | switch( QMessageBox::information( this, tr("ZSafe"), |
2872 | tr("Do you want to delete?"), | 2899 | tr("Do you want to delete?"), |
2873 | tr("&Delete"), tr("D&on't Delete"), | 2900 | tr("&Delete"), tr("D&on't Delete"), |
2874 | 0 // Enter == button 0 | 2901 | 0 // Enter == button 0 |
2875 | ) ) { // Escape == button 2 | 2902 | ) ) { // Escape == button 2 |
2876 | case 0: // Delete clicked, Alt-S or Enter pressed. | 2903 | case 0: // Delete clicked, Alt-S or Enter pressed. |
2877 | // Delete from the category list | 2904 | // Delete from the category list |
2878 | modified = true; | 2905 | modified = true; |
2879 | categories.remove (selectedItem->text(0)); | 2906 | categories.remove (selectedItem->text(0)); |
2880 | // #ifndef WIN32 | 2907 | // #ifndef Q_WS_WIN |
2881 | conf->removeEntry (selectedItem->text(0)); | 2908 | conf->removeEntry (selectedItem->text(0)); |
2882 | // #endif | 2909 | // #endif |
2883 | saveConf(); | 2910 | saveConf(); |
2884 | 2911 | ||
2885 | // Delete the selected item and all subitems | 2912 | // Delete the selected item and all subitems |
2886 | // step through all subitems | 2913 | // step through all subitems |
2887 | QListViewItem *si; | 2914 | QListViewItem *si; |
2888 | for (si = selectedItem->firstChild(); | 2915 | for (si = selectedItem->firstChild(); |
2889 | si != NULL; ) | 2916 | si != NULL; ) |
2890 | { | 2917 | { |
2891 | QListViewItem *_si = si; | 2918 | QListViewItem *_si = si; |
2892 | si = si->nextSibling(); | 2919 | si = si->nextSibling(); |
@@ -3028,30 +3055,30 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category) | |||
3028 | } | 3055 | } |
3029 | ++it; | 3056 | ++it; |
3030 | } | 3057 | } |
3031 | } | 3058 | } |
3032 | } | 3059 | } |
3033 | 3060 | ||
3034 | void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) | 3061 | void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) |
3035 | { | 3062 | { |
3036 | QString app_key = APP_KEY; | 3063 | QString app_key = APP_KEY; |
3037 | #ifndef DESKTOP | 3064 | #ifndef DESKTOP |
3038 | conf->setGroup ("fieldDefs"); | 3065 | conf->setGroup ("fieldDefs"); |
3039 | #else | 3066 | #else |
3040 | #ifndef WIN32 | 3067 | #ifndef Q_WS_WIN |
3041 | app_key += "/fieldDefs/"; | 3068 | app_key += "/fieldDefs/"; |
3042 | #endif | 3069 | #endif |
3043 | #endif | 3070 | #endif |
3044 | QString category = dialog->CategoryField->currentText(); | 3071 | QString category = dialog->CategoryField->currentText(); |
3045 | // #ifndef WIN32 | 3072 | // #ifndef Q_WS_WIN |
3046 | conf->writeEntry(app_key+category+"-field1", dialog->Field1->text()); | 3073 | conf->writeEntry(app_key+category+"-field1", dialog->Field1->text()); |
3047 | conf->writeEntry(app_key+category+"-field2", dialog->Field2->text()); | 3074 | conf->writeEntry(app_key+category+"-field2", dialog->Field2->text()); |
3048 | conf->writeEntry(app_key+category+"-field3", dialog->Field3->text()); | 3075 | conf->writeEntry(app_key+category+"-field3", dialog->Field3->text()); |
3049 | conf->writeEntry(app_key+category+"-field4", dialog->Field4->text()); | 3076 | conf->writeEntry(app_key+category+"-field4", dialog->Field4->text()); |
3050 | conf->writeEntry(app_key+category+"-field5", dialog->Field5->text()); | 3077 | conf->writeEntry(app_key+category+"-field5", dialog->Field5->text()); |
3051 | conf->writeEntry(app_key+category+"-field6", dialog->Field6->text()); | 3078 | conf->writeEntry(app_key+category+"-field6", dialog->Field6->text()); |
3052 | // #endif | 3079 | // #endif |
3053 | saveConf(); | 3080 | saveConf(); |
3054 | #ifndef DESKTOP | 3081 | #ifndef DESKTOP |
3055 | conf->setGroup ("zsafe"); | 3082 | conf->setGroup ("zsafe"); |
3056 | #endif | 3083 | #endif |
3057 | } | 3084 | } |
@@ -3064,37 +3091,37 @@ void ZSafe::editCategory() | |||
3064 | { | 3091 | { |
3065 | QString category = selectedItem->text(0); | 3092 | QString category = selectedItem->text(0); |
3066 | bool initIcons = false; | 3093 | bool initIcons = false; |
3067 | // open the 'Category' dialog | 3094 | // open the 'Category' dialog |
3068 | CategoryDialog *dialog; | 3095 | CategoryDialog *dialog; |
3069 | if (categoryDialog) | 3096 | if (categoryDialog) |
3070 | { | 3097 | { |
3071 | dialog = categoryDialog; | 3098 | dialog = categoryDialog; |
3072 | } | 3099 | } |
3073 | else | 3100 | else |
3074 | { | 3101 | { |
3075 | categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); | 3102 | categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); |
3076 | #ifdef WIN32 | 3103 | #ifdef Q_WS_WIN |
3077 | categoryDialog->setCaption ("Qt " + tr("Category")); | 3104 | categoryDialog->setCaption ("Qt " + tr("Category")); |
3078 | #endif | 3105 | #endif |
3079 | dialog = categoryDialog; | 3106 | dialog = categoryDialog; |
3080 | connect( dialog->CategoryField, | 3107 | connect( dialog->CategoryField, |
3081 | SIGNAL( activated(const QString&)), | 3108 | SIGNAL( activated(const QString&)), |
3082 | this, SLOT( categoryFieldActivated(const QString&) ) ); | 3109 | this, SLOT( categoryFieldActivated(const QString&) ) ); |
3083 | initIcons = true; | 3110 | initIcons = true; |
3084 | } | 3111 | } |
3085 | setCategoryDialogFields(dialog); | 3112 | setCategoryDialogFields(dialog); |
3086 | 3113 | ||
3087 | #ifdef DESKTOP | 3114 | #ifdef DESKTOP |
3088 | #ifndef WIN32 | 3115 | #ifndef Q_WS_WIN |
3089 | QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); | 3116 | QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); |
3090 | #else | 3117 | #else |
3091 | // read all categories from the config file and store | 3118 | // read all categories from the config file and store |
3092 | // into a list | 3119 | // into a list |
3093 | QFile f (cfgFile); | 3120 | QFile f (cfgFile); |
3094 | QStringList list; | 3121 | QStringList list; |
3095 | if ( f.open(IO_ReadOnly) ) { // file opened successfully | 3122 | if ( f.open(IO_ReadOnly) ) { // file opened successfully |
3096 | QTextStream t( &f ); // use a text stream | 3123 | QTextStream t( &f ); // use a text stream |
3097 | QString s; | 3124 | QString s; |
3098 | int n = 1; | 3125 | int n = 1; |
3099 | while ( !t.eof() ) { // until end of file... | 3126 | while ( !t.eof() ) { // until end of file... |
3100 | s = t.readLine(); // line of text excluding '\n' | 3127 | s = t.readLine(); // line of text excluding '\n' |
@@ -3120,25 +3147,25 @@ void ZSafe::editCategory() | |||
3120 | #endif | 3147 | #endif |
3121 | QStringList::Iterator it = list.begin(); | 3148 | QStringList::Iterator it = list.begin(); |
3122 | QString categ; | 3149 | QString categ; |
3123 | dialog->CategoryField->clear(); // remove all items | 3150 | dialog->CategoryField->clear(); // remove all items |
3124 | int i=0; | 3151 | int i=0; |
3125 | bool foundCategory = false; | 3152 | bool foundCategory = false; |
3126 | while( it != list.end() ) | 3153 | while( it != list.end() ) |
3127 | { | 3154 | { |
3128 | QString *cat = new QString (*it); | 3155 | QString *cat = new QString (*it); |
3129 | if (cat->contains("-field1", FALSE)) | 3156 | if (cat->contains("-field1", FALSE)) |
3130 | { | 3157 | { |
3131 | #ifdef DESKTOP | 3158 | #ifdef DESKTOP |
3132 | #ifndef WIN32 | 3159 | #ifndef Q_WS_WIN |
3133 | categ = cat->section ("-field1", 0, 0); | 3160 | categ = cat->section ("-field1", 0, 0); |
3134 | #else | 3161 | #else |
3135 | int pos = cat->find ("-field1"); | 3162 | int pos = cat->find ("-field1"); |
3136 | categ = cat->left (pos); | 3163 | categ = cat->left (pos); |
3137 | #endif | 3164 | #endif |
3138 | #else | 3165 | #else |
3139 | int pos = cat->find ("-field1"); | 3166 | int pos = cat->find ("-field1"); |
3140 | cat->truncate(pos); | 3167 | cat->truncate(pos); |
3141 | categ = *cat; | 3168 | categ = *cat; |
3142 | #endif | 3169 | #endif |
3143 | if (!categ.isEmpty()) | 3170 | if (!categ.isEmpty()) |
3144 | { | 3171 | { |
@@ -3263,25 +3290,25 @@ void ZSafe::editCategory() | |||
3263 | #ifdef DESKTOP | 3290 | #ifdef DESKTOP |
3264 | result = Accepted; | 3291 | result = Accepted; |
3265 | #endif | 3292 | #endif |
3266 | 3293 | ||
3267 | QString fullIconPath; | 3294 | QString fullIconPath; |
3268 | QPixmap *pix; | 3295 | QPixmap *pix; |
3269 | if (result == Accepted) | 3296 | if (result == Accepted) |
3270 | { | 3297 | { |
3271 | modified = true; | 3298 | modified = true; |
3272 | if (category != dialog->CategoryField->currentText()) | 3299 | if (category != dialog->CategoryField->currentText()) |
3273 | { | 3300 | { |
3274 | categories.remove (category); | 3301 | categories.remove (category); |
3275 | // #ifndef WIN32 | 3302 | // #ifndef Q_WS_WIN |
3276 | conf->removeEntry(category); | 3303 | conf->removeEntry(category); |
3277 | // #endif | 3304 | // #endif |
3278 | saveConf(); | 3305 | saveConf(); |
3279 | } | 3306 | } |
3280 | 3307 | ||
3281 | category = dialog->CategoryField->currentText(); | 3308 | category = dialog->CategoryField->currentText(); |
3282 | icon = dialog->IconField->currentText()+".png"; | 3309 | icon = dialog->IconField->currentText()+".png"; |
3283 | 3310 | ||
3284 | if (cat) | 3311 | if (cat) |
3285 | { | 3312 | { |
3286 | #ifndef NO_OPIE | 3313 | #ifndef NO_OPIE |
3287 | owarn << "Category found" << oendl; | 3314 | owarn << "Category found" << oendl; |
@@ -3289,37 +3316,37 @@ void ZSafe::editCategory() | |||
3289 | qWarning("Category found"); | 3316 | qWarning("Category found"); |
3290 | #endif | 3317 | #endif |
3291 | 3318 | ||
3292 | // if (!icon.isEmpty() && !icon.isNull()) | 3319 | // if (!icon.isEmpty() && !icon.isNull()) |
3293 | if (icon != "predefined.png") | 3320 | if (icon != "predefined.png") |
3294 | { | 3321 | { |
3295 | // build the full path | 3322 | // build the full path |
3296 | fullIconPath = iconPath + icon; | 3323 | fullIconPath = iconPath + icon; |
3297 | pix = new QPixmap (fullIconPath); | 3324 | pix = new QPixmap (fullIconPath); |
3298 | if (!pix->isNull()) | 3325 | if (!pix->isNull()) |
3299 | { | 3326 | { |
3300 | // save the full pixmap name into the config file | 3327 | // save the full pixmap name into the config file |
3301 | // #ifndef WIN32 | 3328 | // #ifndef Q_WS_WIN |
3302 | conf->writeEntry(APP_KEY+category, icon); | 3329 | conf->writeEntry(APP_KEY+category, icon); |
3303 | // #endif | 3330 | // #endif |
3304 | saveConf(); | 3331 | saveConf(); |
3305 | QImage img = pix->convertToImage(); | 3332 | QImage img = pix->convertToImage(); |
3306 | pix->convertFromImage(img.smoothScale(14,14)); | 3333 | pix->convertFromImage(img.smoothScale(14,14)); |
3307 | cat->setIconName (icon); | 3334 | cat->setIconName (icon); |
3308 | cat->setIcon (*pix); | 3335 | cat->setIcon (*pix); |
3309 | } | 3336 | } |
3310 | } | 3337 | } |
3311 | else | 3338 | else |
3312 | { | 3339 | { |
3313 | // #ifndef WIN32 | 3340 | // #ifndef Q_WS_WIN |
3314 | conf->removeEntry (category); | 3341 | conf->removeEntry (category); |
3315 | // #endif | 3342 | // #endif |
3316 | saveConf(); | 3343 | saveConf(); |
3317 | cat->setIcon (*getPredefinedIcon(category)); | 3344 | cat->setIcon (*getPredefinedIcon(category)); |
3318 | } | 3345 | } |
3319 | 3346 | ||
3320 | // change the category name of the selected category | 3347 | // change the category name of the selected category |
3321 | QListViewItem *catItem = cat->getListItem(); | 3348 | QListViewItem *catItem = cat->getListItem(); |
3322 | if (catItem) | 3349 | if (catItem) |
3323 | { | 3350 | { |
3324 | #ifndef NO_OPIE | 3351 | #ifndef NO_OPIE |
3325 | owarn << category << oendl; | 3352 | owarn << category << oendl; |
@@ -3480,25 +3507,25 @@ void ZSafe::newDocument() | |||
3480 | if (c) delete c; // delete the previous category | 3507 | if (c) delete c; // delete the previous category |
3481 | categories.clear(); | 3508 | categories.clear(); |
3482 | 3509 | ||
3483 | // m_password = ""; | 3510 | // m_password = ""; |
3484 | selectedItem = NULL; | 3511 | selectedItem = NULL; |
3485 | 3512 | ||
3486 | filename = newFile; | 3513 | filename = newFile; |
3487 | 3514 | ||
3488 | // save the current filename to the config file | 3515 | // save the current filename to the config file |
3489 | conf->writeEntry(APP_KEY+"document", filename); | 3516 | conf->writeEntry(APP_KEY+"document", filename); |
3490 | saveConf(); | 3517 | saveConf(); |
3491 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); | 3518 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); |
3492 | #ifdef WIN32 | 3519 | #ifdef Q_WS_WIN |
3493 | this->setCaption("Qt ZSafe: " + ti); | 3520 | this->setCaption("Qt ZSafe: " + ti); |
3494 | #else | 3521 | #else |
3495 | this->setCaption("ZSafe: " + ti); | 3522 | this->setCaption("ZSafe: " + ti); |
3496 | #endif | 3523 | #endif |
3497 | 3524 | ||
3498 | // openDocument(filename); | 3525 | // openDocument(filename); |
3499 | 3526 | ||
3500 | QMessageBox::information( this, tr("ZSafe"), | 3527 | QMessageBox::information( this, tr("ZSafe"), |
3501 | tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); | 3528 | tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); |
3502 | 3529 | ||
3503 | saveDocumentWithPwd(); | 3530 | saveDocumentWithPwd(); |
3504 | } | 3531 | } |
@@ -3564,25 +3591,25 @@ void ZSafe::loadDocument() | |||
3564 | } | 3591 | } |
3565 | } | 3592 | } |
3566 | if (c) delete c; // delete the previous category | 3593 | if (c) delete c; // delete the previous category |
3567 | categories.clear(); | 3594 | categories.clear(); |
3568 | m_password = ""; | 3595 | m_password = ""; |
3569 | selectedItem = NULL; | 3596 | selectedItem = NULL; |
3570 | filename = newFile; | 3597 | filename = newFile; |
3571 | 3598 | ||
3572 | // save the current filename to the config file | 3599 | // save the current filename to the config file |
3573 | conf->writeEntry(APP_KEY+"document", filename); | 3600 | conf->writeEntry(APP_KEY+"document", filename); |
3574 | saveConf(); | 3601 | saveConf(); |
3575 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); | 3602 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); |
3576 | #ifdef WIN32 | 3603 | #ifdef Q_WS_WIN |
3577 | this->setCaption("Qt ZSafe: " + ti); | 3604 | this->setCaption("Qt ZSafe: " + ti); |
3578 | #else | 3605 | #else |
3579 | this->setCaption("ZSafe: " + ti); | 3606 | this->setCaption("ZSafe: " + ti); |
3580 | #endif | 3607 | #endif |
3581 | 3608 | ||
3582 | openDocument(filename); | 3609 | openDocument(filename); |
3583 | } | 3610 | } |
3584 | } | 3611 | } |
3585 | 3612 | ||
3586 | void ZSafe::saveDocumentAs() | 3613 | void ZSafe::saveDocumentAs() |
3587 | { | 3614 | { |
3588 | 3615 | ||
@@ -3618,25 +3645,25 @@ void ZSafe::saveDocumentAs() | |||
3618 | { | 3645 | { |
3619 | // save the previous opened document | 3646 | // save the previous opened document |
3620 | if (!filename.isEmpty()) | 3647 | if (!filename.isEmpty()) |
3621 | saveDocument(filename, FALSE); | 3648 | saveDocument(filename, FALSE); |
3622 | 3649 | ||
3623 | selectedItem = NULL; | 3650 | selectedItem = NULL; |
3624 | filename = newFile; | 3651 | filename = newFile; |
3625 | 3652 | ||
3626 | // save the current filename to the config file | 3653 | // save the current filename to the config file |
3627 | conf->writeEntry(APP_KEY+"document", filename); | 3654 | conf->writeEntry(APP_KEY+"document", filename); |
3628 | saveConf(); | 3655 | saveConf(); |
3629 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); | 3656 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); |
3630 | #ifdef WIN32 | 3657 | #ifdef Q_WS_WIN |
3631 | this->setCaption("Qt ZSafe: " + ti); | 3658 | this->setCaption("Qt ZSafe: " + ti); |
3632 | #else | 3659 | #else |
3633 | this->setCaption("ZSafe: " + ti); | 3660 | this->setCaption("ZSafe: " + ti); |
3634 | #endif | 3661 | #endif |
3635 | 3662 | ||
3636 | QMessageBox::information( this, tr("ZSafe"), | 3663 | QMessageBox::information( this, tr("ZSafe"), |
3637 | tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); | 3664 | tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); |
3638 | 3665 | ||
3639 | saveDocumentWithPwd(); | 3666 | saveDocumentWithPwd(); |
3640 | } | 3667 | } |
3641 | } | 3668 | } |
3642 | 3669 | ||
@@ -3697,25 +3724,25 @@ void ZSafe::about() | |||
3697 | QPixmap zsafe_img((const char**) zsafe_xpm); | 3724 | QPixmap zsafe_img((const char**) zsafe_xpm); |
3698 | mb.setIconPixmap (zsafe_img); | 3725 | mb.setIconPixmap (zsafe_img); |
3699 | mb.exec(); | 3726 | mb.exec(); |
3700 | } | 3727 | } |
3701 | 3728 | ||
3702 | void ZSafe::setExpandFlag() | 3729 | void ZSafe::setExpandFlag() |
3703 | { | 3730 | { |
3704 | expandTree = !expandTree; | 3731 | expandTree = !expandTree; |
3705 | file->setItemChecked('o', expandTree); | 3732 | file->setItemChecked('o', expandTree); |
3706 | #ifndef DESKTOP | 3733 | #ifndef DESKTOP |
3707 | conf->setGroup ("zsafePrefs"); | 3734 | conf->setGroup ("zsafePrefs"); |
3708 | #endif | 3735 | #endif |
3709 | // #ifndef WIN32 | 3736 | // #ifndef Q_WS_WIN |
3710 | conf->writeEntry (APP_KEY+"expandTree", expandTree); | 3737 | conf->writeEntry (APP_KEY+"expandTree", expandTree); |
3711 | // #endif | 3738 | // #endif |
3712 | saveConf(); | 3739 | saveConf(); |
3713 | 3740 | ||
3714 | } | 3741 | } |
3715 | 3742 | ||
3716 | void ZSafe::paintEvent( QPaintEvent * ) | 3743 | void ZSafe::paintEvent( QPaintEvent * ) |
3717 | { | 3744 | { |
3718 | if (raiseFlag) | 3745 | if (raiseFlag) |
3719 | { | 3746 | { |
3720 | raiseFlag = false; | 3747 | raiseFlag = false; |
3721 | raiseTimer.start (1, true); | 3748 | raiseTimer.start (1, true); |
@@ -3782,25 +3809,25 @@ void ZSafe::setDocument(const QString& fileref) | |||
3782 | filename = link.file(); | 3809 | filename = link.file(); |
3783 | } | 3810 | } |
3784 | else | 3811 | else |
3785 | { | 3812 | { |
3786 | // if (filename != fileref) | 3813 | // if (filename != fileref) |
3787 | // saveDocument(filename, FALSE); | 3814 | // saveDocument(filename, FALSE); |
3788 | filename = fileref; | 3815 | filename = fileref; |
3789 | } | 3816 | } |
3790 | // save the current filename to the config file | 3817 | // save the current filename to the config file |
3791 | conf->writeEntry(APP_KEY+"document", filename); | 3818 | conf->writeEntry(APP_KEY+"document", filename); |
3792 | saveConf(); | 3819 | saveConf(); |
3793 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); | 3820 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); |
3794 | #ifdef WIN32 | 3821 | #ifdef Q_WS_WIN |
3795 | this->setCaption("Qt ZSafe: " + ti); | 3822 | this->setCaption("Qt ZSafe: " + ti); |
3796 | #else | 3823 | #else |
3797 | this->setCaption("ZSafe: " + ti); | 3824 | this->setCaption("ZSafe: " + ti); |
3798 | #endif | 3825 | #endif |
3799 | 3826 | ||
3800 | // clear the password list | 3827 | // clear the password list |
3801 | QListViewItem *i; | 3828 | QListViewItem *i; |
3802 | QListViewItem *c = NULL; | 3829 | QListViewItem *c = NULL; |
3803 | // step through all categories | 3830 | // step through all categories |
3804 | for (i = ListView->firstChild(); | 3831 | for (i = ListView->firstChild(); |
3805 | i != NULL; | 3832 | i != NULL; |
3806 | i = i->nextSibling()) | 3833 | i = i->nextSibling()) |