summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/main.cpp29
-rw-r--r--noncore/apps/zsafe/zsafe.cpp20
-rw-r--r--noncore/apps/zsafe/zsafe.pro14
-rw-r--r--noncore/apps/zsafe/zsafe_win32.pro2
-rw-r--r--noncore/apps/zsafe/zsafe_x86.pro21
5 files changed, 58 insertions, 28 deletions
diff --git a/noncore/apps/zsafe/main.cpp b/noncore/apps/zsafe/main.cpp
index c187520..2707730 100644
--- a/noncore/apps/zsafe/main.cpp
+++ b/noncore/apps/zsafe/main.cpp
@@ -1,118 +1,123 @@
1/* 1/*
2** Author: Carsten Schneider <CarstenSchneider@t-online.de> 2** Author: Carsten Schneider <CarstenSchneider@t-online.de>
3** 3**
4** $Id$ 4** $Id$
5** 5**
6** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html 6** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
7*/ 7*/
8 8
9 9
10#include "zsafe.h" 10#include "zsafe.h"
11 11
12#ifndef NO_OPIE 12#ifndef NO_OPIE
13/* OPIE */ 13/* OPIE */
14#include <opie2/odebug.h> 14#include <opie2/odebug.h>
15using namespace Opie::Core; 15using namespace Opie::Core;
16#endif 16#endif
17 17
18/* QT */ 18/* QT */
19#ifdef DESKTOP 19#ifdef DESKTOP
20#include <qapplication.h> 20#include <qapplication.h>
21#else 21#else
22#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
23#endif 23#endif
24 24
25/* STD */ 25/* STD */
26#include <stdio.h> 26#include <stdio.h>
27#include <signal.h> 27#include <signal.h>
28 28
29ZSafe *zs; 29ZSafe *zs;
30#ifdef DESKTOP 30#ifdef DESKTOP
31QApplication *appl; 31QApplication *appl;
32#else 32#else
33QPEApplication *appl; 33QPEApplication *appl;
34#endif 34#endif
35 35
36int DeskW; 36int DeskW;
37int DeskH; 37int DeskH;
38 38
39void suspend (int signum) 39void suspend (int signum)
40{ 40{
41 printf ("Suspend signal %d received\n", signum); 41 printf ("Suspend signal %d received\n", signum);
42} 42}
43 43
44void resume (int signum) 44void resume (int signum)
45{ 45{
46 printf ("Resume signal %d received\n", signum); 46 printf ("Resume signal %d received\n", signum);
47 zs->resume(signum); 47 zs->resume(signum);
48} 48}
49 49
50int main( int argc, char ** argv ) 50int main( int argc, char ** argv )
51{ 51{
52#ifndef WIN32 52#ifndef Q_WS_WIN
53 // install signal handler 53 // install signal handler
54 signal (SIGSTOP, suspend); 54// signal (SIGSTOP, suspend);
55#endif 55#endif
56 56
57#ifdef DESKTOP 57#ifdef DESKTOP
58 QApplication a( argc, argv ); 58 QApplication a( argc, argv );
59#else 59#else
60 QPEApplication a( argc, argv ); 60 QPEApplication a( argc, argv );
61#endif 61#endif
62 appl = &a; 62 appl = &a;
63 63
64#ifdef DESKTOP 64#ifdef DESKTOP
65 if (argc >= 3) 65 if (argc >= 3)
66 { 66 {
67#ifndef WIN32 67#ifndef Q_WS_WIN
68 DeskW = atoi(argv[1]); 68 DeskW = atoi(argv[1]);
69 DeskH = atoi(argv[2]); 69 DeskH = atoi(argv[2]);
70#else 70#else
71 int w, h; 71 int w, h;
72 sscanf (argv[1], "%d", &w); 72 sscanf (argv[1], "%d", &w);
73 sscanf (argv[2], "%d", &h); 73 sscanf (argv[2], "%d", &h);
74 DeskW = w; 74 DeskW = w;
75 DeskH = h; 75 DeskH = h;
76#endif 76#endif
77 } 77 }
78 else 78 else
79 { 79 {
80 DeskW = 600; 80 DeskW = 600;
81 DeskH = 400; 81 DeskH = 400;
82 } 82 }
83#else 83#else
84 DeskW = a.desktop()->width(); 84 DeskW = a.desktop()->width();
85 DeskH = a.desktop()->height(); 85 DeskH = a.desktop()->height();
86 86
87#ifndef NO_OPIE
87 owarn << "Width: " << DeskW << " Height: " << DeskH << oendl; 88 owarn << "Width: " << DeskW << " Height: " << DeskH << oendl;
88 89#endif
89#ifdef JPATCH_HDE 90#ifdef JPATCH_HDE
90 // nothings 91 // nothings
91#else 92#else
92 if (DeskW > 240) 93 if (DeskW > 240)
93 { 94 {
94 DeskW -= 20; 95 DeskW -= 20;
95 DeskH += 25; 96 DeskH += 25;
97#ifndef NO_OPIE
96 owarn << "Changed width: " << DeskW << " Height: " << DeskH << oendl; 98 owarn << "Changed width: " << DeskW << " Height: " << DeskH << oendl;
99#endif
97 } 100 }
98#endif 101#endif
99 102
100#endif 103#endif
101 104
102 ZSafe mw; 105 ZSafe *mw = new ZSafe( 0, 0, QWidget::WDestructiveClose );
103 zs = &mw; 106// ZSafe mw;
104 107// zs = &mw;
105#ifndef WIN32 108 zs = mw;
106 signal (SIGCONT, resume); 109
110#ifndef Q_WS_WIN
111// signal (SIGCONT, resume);
107#endif 112#endif
108#ifdef DESKTOP 113#ifdef DESKTOP
109 a.setMainWidget(&mw); 114 a.setMainWidget(mw);
110 mw.show(); 115 mw->show();
111#else 116#else
112 // a.showMainWidget( &mw ); 117 // a.showMainWidget( &mw );
113 a.showMainDocumentWidget( &mw ); 118 a.showMainDocumentWidget( mw );
114#endif 119#endif
115 int ret = a.exec(); 120 int ret = a.exec();
116 121
117 return ret; 122 return ret;
118} 123}
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index 1c15852..2dd94aa 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -313,247 +313,247 @@ static const char* const general_data[] = {
313"#d c #acbeac", 313"#d c #acbeac",
314".6 c #acc2ac", 314".6 c #acc2ac",
315".o c #b4b2b4", 315".o c #b4b2b4",
316".t c #b4beb4", 316".t c #b4beb4",
317"#k c #b4c2ac", 317"#k c #b4c2ac",
318".5 c #b4cab4", 318".5 c #b4cab4",
319".D c #bdb6bd", 319".D c #bdb6bd",
320".G c #bdc6b4", 320".G c #bdc6b4",
321"#c c #bdceb4", 321"#c c #bdceb4",
322".X c #bdd2bd", 322".X c #bdd2bd",
323".4 c #bdd6bd", 323".4 c #bdd6bd",
324".1 c #c5bec5", 324".1 c #c5bec5",
325".e c #c5c2c5", 325".e c #c5c2c5",
326".u c #c5cac5", 326".u c #c5cac5",
327"#b c #c5d6c5", 327"#b c #c5d6c5",
328".J c #c5dec5", 328".J c #c5dec5",
329".p c #cdcacd", 329".p c #cdcacd",
330".W c #cddecd", 330".W c #cddecd",
331".L c #cde2cd", 331".L c #cde2cd",
332".K c #d5eacd", 332".K c #d5eacd",
333".V c #d5ead5", 333".V c #d5ead5",
334".y c #d5eed5", 334".y c #d5eed5",
335"QtQtQtQtQtQtQtQtQtQtQtQtQtQt", 335"QtQtQtQtQtQtQtQtQtQtQtQtQtQt",
336"QtQtQt.#.a.b.cQtQtQtQtQtQtQt", 336"QtQtQt.#.a.b.cQtQtQtQtQtQtQt",
337"QtQt.d.e.f.g.h.i.c.j.dQt.kQt", 337"QtQt.d.e.f.g.h.i.c.j.dQt.kQt",
338".a.l.m.n.o.p.q.r.s.t.u.v.wQt", 338".a.l.m.n.o.p.q.r.s.t.u.v.wQt",
339".x.y.z.A.B.C.D.p.q.E.F.G.H.I", 339".x.y.z.A.B.C.D.p.q.E.F.G.H.I",
340".I.J.K.L.M.N.O.P.o.p.Q.R.S.T", 340".I.J.K.L.M.N.O.P.o.p.Q.R.S.T",
341"Qt.U.V.L.W.X.Y.Z.0.P.1.s.2.3", 341"Qt.U.V.L.W.X.Y.Z.0.P.1.s.2.3",
342"Qt.3.X.W.4.X.5.6.7.8.9.s#.##", 342"Qt.3.X.W.4.X.5.6.7.8.9.s#.##",
343"QtQt#a.X#b#c.5.6#d#e#f#g#h#i", 343"QtQt#a.X#b#c.5.6#d#e#f#g#h#i",
344"QtQtQt#j.7#k.6#d#l#m#n#o#p#q", 344"QtQtQt#j.7#k.6#d#l#m#n#o#p#q",
345"QtQtQtQt.k#r#s#m#t.H#u#v#w#x", 345"QtQtQtQt.k#r#s#m#t.H#u#v#w#x",
346"QtQtQtQtQtQt.k#y#z.v#A#B#C#x", 346"QtQtQtQtQtQt.k#y#z.v#A#B#C#x",
347"QtQtQtQtQtQtQtQt.k#D.w#s#E.k", 347"QtQtQtQtQtQtQtQt.k#D.w#s#E.k",
348"QtQtQtQtQtQtQtQtQtQtQt#x#FQt"}; 348"QtQtQtQtQtQtQtQtQtQtQt#x#FQt"};
349 349
350// exit ZSafe and clear the clipboard for security reasons 350// exit ZSafe and clear the clipboard for security reasons
351 void ZSafe::exitZs (int ec) 351 void ZSafe::exitZs (int ec)
352 { 352 {
353 QClipboard *cb = QApplication::clipboard(); 353 QClipboard *cb = QApplication::clipboard();
354 cb->clear(); 354 cb->clear();
355 355
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 Q_WS_WIN 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 ("zsafePrefs");
378#endif 378#endif
379 } 379 }
380 } 380 }
381 381
382 382
383/* 383/*
384 * Constructs a ZSafe which is a child of 'parent', with the 384 * Constructs a ZSafe which is a child of 'parent', with the
385 * name 'name' and widget flags set to 'f' 385 * name 'name' and widget flags set to 'f'
386 * 386 *
387 * The dialog will by default be modeless, unless you set 'modal' to 387 * The dialog will by default be modeless, unless you set 'modal' to
388 * TRUE to construct a modal dialog. 388 * TRUE to construct a modal dialog.
389 */ 389 */
390ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) 390ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
391 : QDialog( parent, name, modal, fl ), 391 : QDialog( parent, name, modal, fl ),
392 Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l) 392 Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l)
393{ 393{
394 IsCut = false; 394 IsCut = false;
395 IsCopy = false; 395 IsCopy = false;
396 modified = false; 396 modified = false;
397 showpwd = false; 397 showpwd = false;
398 398
399 // set the config file 399 // set the config file
400 cfgFile=QDir::homeDirPath(); 400 cfgFile=QDir::homeDirPath();
401 cfgFile += "/.zsafe.cfg"; 401 cfgFile += "/.zsafe.cfg";
402 // set the icon path 402 // set the icon path
403#ifdef NO_OPIE 403#ifdef NO_OPIE
404 QString qpedir ((const char *)getenv("QPEDIR")); 404 QString qpedir ((const char *)getenv("QPEDIR"));
405#else 405#else
406 QString qpedir ((const char *)getenv("OPIEDIR")); 406 QString qpedir ((const char *)getenv("OPIEDIR"));
407#endif 407#endif
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 Q_WS_WIN 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 Q_WS_WIN 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);
445 QPixmap editdelete_img((const char**) editdelete_xpm); 445 QPixmap editdelete_img((const char**) editdelete_xpm);
446 QPixmap find_img((const char**) find_xpm); 446 QPixmap find_img((const char**) find_xpm);
447 QPixmap folder_open_img((const char**) folder_open_xpm); 447 QPixmap folder_open_img((const char**) folder_open_xpm);
448 QPixmap help_icon_img((const char**) help_icon_xpm); 448 QPixmap help_icon_img((const char**) help_icon_xpm);
449 QPixmap new_img((const char**) new_xpm); 449 QPixmap new_img((const char**) new_xpm);
450 QPixmap paste_img((const char**) paste_xpm); 450 QPixmap paste_img((const char**) paste_xpm);
451 QPixmap quit_icon_img((const char**) quit_icon_xpm); 451 QPixmap quit_icon_img((const char**) quit_icon_xpm);
452 QPixmap save_img((const char**) save_xpm); 452 QPixmap save_img((const char**) save_xpm);
453 QPixmap trash_img((const char**) trash_xpm); 453 QPixmap trash_img((const char**) trash_xpm);
454 QPixmap expand_img((const char**) expand_xpm); 454 QPixmap expand_img((const char**) expand_xpm);
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 Q_WS_WIN 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;
480 } 480 }
481 else 481 else
482 { 482 {
483 DeskS = DeskH; 483 DeskS = DeskH;
484 } 484 }
485 resize( DeskW, DeskH ); 485 resize( DeskW, DeskH );
486 setMinimumSize( QSize( DeskS, DeskS ) ); 486 setMinimumSize( QSize( DeskS, DeskS ) );
487 setMaximumSize( QSize( DeskS, DeskS ) ); 487 setMaximumSize( QSize( DeskS, DeskS ) );
488#else 488#else
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 filename = conf->readEntry(APP_KEY+"document");
496 if ( !QFileInfo(filename).exists() || !QDir(zsafeAppDirPath).exists() ) 496 if ( !QFileInfo(filename).exists() || !QDir(zsafeAppDirPath).exists() )
497 { 497 {
498 // check if the directory application exists, if not 498 // check if the directory application exists, if not
499 // create it 499 // create it
500// #ifndef Q_WS_WIN 500// #ifndef Q_WS_WIN
501 // QString d1("Documents/application"); 501 // QString d1("Documents/application");
502// #else 502// #else
503 QString d1(QDir::homeDirPath() + "/Documents/application"); 503 QString d1(QDir::homeDirPath() + "/Documents/application");
504// #endif 504// #endif
505 QDir pd1(d1); 505 QDir pd1(d1);
506 if (!pd1.exists()) 506 if (!pd1.exists())
507 { 507 {
508 QDir pd2(QDir::homeDirPath() + "/Documents"); 508 QDir pd2(QDir::homeDirPath() + "/Documents");
509 if (!pd2.exists()) { 509 if (!pd2.exists()) {
510 QDir pd3(QDir::homeDirPath()); 510 QDir pd3(QDir::homeDirPath());
511 if (!pd3.mkdir("Documents", FALSE)) { 511 if (!pd3.mkdir("Documents", FALSE)) {
512 } 512 }
513 } 513 }
514 514
515 if (!pd2.mkdir("application", FALSE)) 515 if (!pd2.mkdir("application", FALSE))
516 { 516 {
517 QMessageBox::critical( 0, tr("ZSafe"), 517 QMessageBox::critical( 0, tr("ZSafe"),
518#ifdef JPATCH_HDE 518#ifdef JPATCH_HDE
519 tr("<P>Can't create directory ..."+d1+"</P><P>ZSafe will now exit.</P>")); 519 tr("<P>Can't create directory ..."+d1+"</P><P>ZSafe will now exit.</P>"));
520#else 520#else
521 tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d1)); 521 tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d1));
522#endif 522#endif
523 exitZs (1); 523 exitZs (1);
524 } 524 }
525 } 525 }
526// #ifndef Q_WS_WIN 526// #ifndef Q_WS_WIN
527 // QString d2("Documents/application/zsafe"); 527 // QString d2("Documents/application/zsafe");
528// #else 528// #else
529 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); 529 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
530// #endif 530// #endif
531 QDir pd2(d2); 531 QDir pd2(d2);
532 if (!pd2.exists()) 532 if (!pd2.exists())
533 { 533 {
534 if (!pd1.mkdir("zsafe", FALSE)) 534 if (!pd1.mkdir("zsafe", FALSE))
535 { 535 {
536 QMessageBox::critical( 0, tr("ZSafe"), 536 QMessageBox::critical( 0, tr("ZSafe"),
537#ifdef JPATCH_HDE 537#ifdef JPATCH_HDE
538 tr("<P>Can't create directory ...//Documents/application/zsafe</P><P>ZSafe will now exit.</P")); 538 tr("<P>Can't create directory ...//Documents/application/zsafe</P><P>ZSafe will now exit.</P"));
539#else 539#else
540 tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d2)); 540 tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d2));
541#endif 541#endif
542 exitZs (1); 542 exitZs (1);
543 } 543 }
544 } 544 }
545 545
546 filename = zsafeAppDirPath + "/passwords.zsf"; 546 filename = zsafeAppDirPath + "/passwords.zsf";
547 547
548 // save the current filename to the config file 548 // save the current filename to the config file
549 conf->writeEntry(APP_KEY+"document", filename); 549 conf->writeEntry(APP_KEY+"document", filename);
550 saveConf(); 550 saveConf();
551 } 551 }
552 //if (filename == "INVALIDPWD") 552 //if (filename == "INVALIDPWD")
553 //filename = ""; 553 //filename = "";
554 554
555 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 555 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
556#ifdef Q_WS_WIN 556#ifdef Q_WS_WIN
557 this->setCaption("Qt ZSafe: " + ti); 557 this->setCaption("Qt ZSafe: " + ti);
558#else 558#else
559 this->setCaption("ZSafe: " + ti); 559 this->setCaption("ZSafe: " + ti);
@@ -701,241 +701,241 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
701 this, SLOT( listViewSelected(QListViewItem*) ) ); 701 this, SLOT( listViewSelected(QListViewItem*) ) );
702 connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), 702 connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ),
703 this, SLOT( showInfo(QListViewItem*) ) ); 703 this, SLOT( showInfo(QListViewItem*) ) );
704 connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), 704 connect( ListView, SIGNAL( returnPressed(QListViewItem*) ),
705 this, SLOT( showInfo(QListViewItem*) ) ); 705 this, SLOT( showInfo(QListViewItem*) ) );
706 706
707 #ifndef DESKTOP 707 #ifndef DESKTOP
708 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); 708 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold);
709#endif 709#endif
710 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 710 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
711 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 711 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
712 712
713 this->setIcon( image0); 713 this->setIcon( image0);
714} 714}
715 715
716const QColor *ZSafe::evenRowColor = &Qt::white; 716const QColor *ZSafe::evenRowColor = &Qt::white;
717// const QColor *ZSafe::oddRowColor = &Qt::lightGray; 717// const QColor *ZSafe::oddRowColor = &Qt::lightGray;
718const QColor *ZSafe::oddRowColor = new QColor(216,240,255); 718const QColor *ZSafe::oddRowColor = new QColor(216,240,255);
719 719
720/* 720/*
721 * Destroys the object and frees any allocated resources 721 * Destroys the object and frees any allocated resources
722 */ 722 */
723ZSafe::~ZSafe() 723ZSafe::~ZSafe()
724{ 724{
725 // no need to delete child widgets, Qt does it all for us 725 // no need to delete child widgets, Qt does it all for us
726 quitMe(); 726 quitMe();
727} 727}
728 728
729// load the default document 729// load the default document
730void ZSafe::slotLoadDocu() 730void ZSafe::slotLoadDocu()
731{ 731{
732 openDocument (filename); 732 openDocument (filename);
733} 733}
734 734
735void ZSafe::deletePwd() 735void ZSafe::deletePwd()
736{ 736{
737 737
738 if (!selectedItem) 738 if (!selectedItem)
739 return; 739 return;
740 if (!isCategory(selectedItem)) 740 if (!isCategory(selectedItem))
741 { 741 {
742 switch( QMessageBox::information( this, tr("ZSafe"), 742 switch( QMessageBox::information( this, tr("ZSafe"),
743 tr("Do you want to delete?"), 743 tr("Do you want to delete?"),
744 tr("&Delete"), tr("D&on't Delete"), 744 tr("&Delete"), tr("D&on't Delete"),
745 0 // Enter == button 0 745 0 // Enter == button 0
746 ) ) { // Escape == button 2 746 ) ) { // Escape == button 2
747 case 0: // Delete clicked, Alt-S or Enter pressed. 747 case 0: // Delete clicked, Alt-S or Enter pressed.
748 // Delete 748 // Delete
749 modified = true; 749 modified = true;
750 selectedItem->parent()->takeItem(selectedItem); 750 selectedItem->parent()->takeItem(selectedItem);
751 selectedItem = NULL; 751 selectedItem = NULL;
752 break; 752 break;
753 case 1: // Don't delete 753 case 1: // Don't delete
754 break; 754 break;
755 } 755 }
756 } 756 }
757 else 757 else
758 { 758 {
759 delCategory(); 759 delCategory();
760 } 760 }
761} 761}
762 762
763void ZSafe::editPwd() 763void ZSafe::editPwd()
764{ 764{
765 if (!selectedItem) 765 if (!selectedItem)
766 return; 766 return;
767 if (!isCategory(selectedItem)) 767 if (!isCategory(selectedItem))
768 { 768 {
769 // open the 'New Entry' dialog 769 // open the 'New Entry' dialog
770 NewDialog *dialog = new NewDialog(this, "edit_entry", TRUE); 770 NewDialog *dialog = new NewDialog(this, "edit_entry", TRUE);
771#ifdef Q_WS_WIN 771#ifdef Q_WS_WIN
772 dialog->setCaption ("Qt " + tr("Edit Entry")); 772 dialog->setCaption ("Qt " + tr("Edit Entry"));
773 dialog->setGeometry(200, 250, 220, 310 ); 773 dialog->setGeometry(200, 250, 220, 310 );
774#endif 774#endif
775 775
776 // set the labels 776 // set the labels
777 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); 777 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name")));
778 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); 778 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username")));
779 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); 779 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password")));
780 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); 780 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
781 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); 781 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4")));
782 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); 782 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5")));
783 783
784 // set the fields 784 // set the fields
785 dialog->NameField->setText(selectedItem->text (0)); 785 dialog->NameField->setText(selectedItem->text (0));
786 dialog->UsernameField->setText(selectedItem->text (1)); 786 dialog->UsernameField->setText(selectedItem->text (1));
787 dialog->PasswordField->setText(selectedItem->text (2)); 787 dialog->PasswordField->setText(selectedItem->text (2));
788 QString comment = selectedItem->text (3); 788 QString comment = selectedItem->text (3);
789 comment.replace (QRegExp("<br>"), "\n"); 789 comment.replace (QRegExp("<br>"), "\n");
790 dialog->Field5->setText(selectedItem->text (4)); 790 dialog->Field5->setText(selectedItem->text (4));
791 dialog->Field6->setText(selectedItem->text (5)); 791 dialog->Field6->setText(selectedItem->text (5));
792 dialog->CommentField->insertLine(comment); 792 dialog->CommentField->insertLine(comment);
793 dialog->CommentField->setCursorPosition(0,0); 793 dialog->CommentField->setCursorPosition(0,0);
794 794
795#ifdef Q_WS_QWS 795#ifdef Q_WS_QWS
796 DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); 796 DialogCode result = (DialogCode) QPEApplication::execDialog( dialog );
797#endif 797#endif
798 798
799#ifdef DESKTOP 799#ifdef DESKTOP
800#ifndef Q_QW_QWIN 800#ifndef Q_QW_QWIN
801 dialog->show(); 801 dialog->show();
802#endif 802#endif
803#else 803#else
804 dialog->showMaximized(); 804 dialog->showMaximized();
805#endif 805#endif
806#ifdef DESKTOP 806#ifdef DESKTOP
807 int result = dialog->exec(); 807 int result = dialog->exec();
808// result = QDialog::Accepted; 808 result = QDialog::Accepted;
809#endif 809#endif
810 if (result == Accepted) 810 if (result == Accepted)
811 { 811 {
812 modified = true; 812 modified = true;
813 // edit the selected item 813 // edit the selected item
814 QString name = dialog->NameField->text(); 814 QString name = dialog->NameField->text();
815 selectedItem->setText (0, tr (name)); 815 selectedItem->setText (0, tr (name));
816 QString user = dialog->UsernameField->text(); 816 QString user = dialog->UsernameField->text();
817 selectedItem->setText (1, tr (user)); 817 selectedItem->setText (1, tr (user));
818 QString pwd = dialog->PasswordField->text(); 818 QString pwd = dialog->PasswordField->text();
819 selectedItem->setText (2, tr (pwd)); 819 selectedItem->setText (2, tr (pwd));
820 QString comment = dialog->CommentField->text(); 820 QString comment = dialog->CommentField->text();
821 comment.replace (QRegExp("\n"), "<br>"); 821 comment.replace (QRegExp("\n"), "<br>");
822 selectedItem->setText (3, tr (comment)); 822 selectedItem->setText (3, tr (comment));
823 QString f5 = dialog->Field5->text(); 823 QString f5 = dialog->Field5->text();
824 selectedItem->setText (4, tr (f5)); 824 selectedItem->setText (4, tr (f5));
825 QString f6 = dialog->Field6->text(); 825 QString f6 = dialog->Field6->text();
826 selectedItem->setText (5, tr (f6)); 826 selectedItem->setText (5, tr (f6));
827 } 827 }
828 828
829 delete dialog; 829 delete dialog;
830 } 830 }
831 else 831 else
832 { 832 {
833 editCategory(); 833 editCategory();
834 } 834 }
835} 835}
836 836
837void ZSafe::newPwd() 837void ZSafe::newPwd()
838{ 838{
839 if (!selectedItem) 839 if (!selectedItem)
840 return; 840 return;
841 841 qWarning("new item");
842 if (!isCategory(selectedItem)) 842 if (!isCategory(selectedItem))
843 selectedItem = selectedItem->parent(); 843 selectedItem = selectedItem->parent();
844 844
845 if (isCategory(selectedItem)) 845 if (isCategory(selectedItem))
846 { 846 {
847 QString cat = selectedItem->text(0); 847 QString cat = selectedItem->text(0);
848 848 qWarning(cat);
849 // open the 'New Entry' dialog 849 // open the 'New Entry' dialog
850 NewDialog *dialog = new NewDialog(this, "new_entry", TRUE); 850 NewDialog *dialog = new NewDialog(this, "new_entry", TRUE);
851#ifdef Q_WS_WIN 851#ifdef Q_WS_WIN
852 dialog->setCaption ("Qt " + tr("New Entry")); 852 dialog->setCaption ("Qt " + tr("New Entry"));
853 dialog->setGeometry(200, 250, 220, 310 ); 853 dialog->setGeometry(200, 250, 220, 310 );
854#endif 854#endif
855 // set the labels 855 // set the labels
856 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); 856 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name")));
857 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); 857 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username")));
858 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); 858 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password")));
859 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); 859 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
860 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); 860 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4")));
861 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); 861 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5")));
862retype: 862retype:
863 863
864#ifdef Q_WS_QWS 864#ifdef Q_WS_QWS
865 DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); 865 DialogCode result = (DialogCode) QPEApplication::execDialog( dialog );
866#endif 866#endif
867 867
868#ifdef DESKTOP 868#ifdef DESKTOP
869#ifndef Q_QW_QWIN 869#ifndef Q_QW_QWIN
870 dialog->show(); 870 dialog->show();
871#endif 871#endif
872#else 872#else
873 dialog->showMaximized(); 873 dialog->showMaximized();
874#endif 874#endif
875#ifdef DESKTOP 875#ifdef DESKTOP
876 int result = dialog->exec(); 876 int result = dialog->exec();
877// result = QDialog::Accepted; 877 result = QDialog::Accepted;
878#endif 878#endif
879 879
880 if (result == Accepted) 880 if (result == Accepted)
881 { 881 {
882 882
883 QString name = dialog->NameField->text(); 883 QString name = dialog->NameField->text();
884 if (cat == name) 884 if (cat == name)
885 { 885 {
886 QMessageBox::critical( 0, tr("ZSafe"), 886 QMessageBox::critical( 0, tr("ZSafe"),
887 tr("Entry name must be different\nfrom the category name.") ); 887 tr("Entry name must be different\nfrom the category name.") );
888 goto retype; // it's not a good programming style :-) 888 goto retype; // it's not a good programming style :-)
889 } 889 }
890 890
891 modified = true; 891 modified = true;
892 // add the new item 892 // add the new item
893 QListViewItem *i = new ShadedListItem (0, selectedItem); 893 QListViewItem *i = new ShadedListItem (0, selectedItem);
894 i->setOpen (TRUE); 894 i->setOpen (TRUE);
895 895
896 i->setText (0, tr (name)); 896 i->setText (0, tr (name));
897 QString user = dialog->UsernameField->text(); 897 QString user = dialog->UsernameField->text();
898 i->setText (1, tr (user)); 898 i->setText (1, tr (user));
899 QString pwd = dialog->PasswordField->text(); 899 QString pwd = dialog->PasswordField->text();
900 i->setText (2, tr (pwd)); 900 i->setText (2, tr (pwd));
901 QString comment = dialog->CommentField->text(); 901 QString comment = dialog->CommentField->text();
902 comment.replace (QRegExp("\n"), "<br>"); 902 comment.replace (QRegExp("\n"), "<br>");
903 i->setText (3, tr (comment)); 903 i->setText (3, tr (comment));
904 QString f5 = dialog->Field5->text(); 904 QString f5 = dialog->Field5->text();
905 i->setText (4, tr (f5)); 905 i->setText (4, tr (f5));
906 QString f6 = dialog->Field6->text(); 906 QString f6 = dialog->Field6->text();
907 i->setText (5, tr (f6)); 907 i->setText (5, tr (f6));
908 } 908 }
909 909
910 delete dialog; 910 delete dialog;
911 } 911 }
912} 912}
913 913
914void ZSafe::findPwd() 914void ZSafe::findPwd()
915{ 915{
916 916
917 // open the 'Search' dialog 917 // open the 'Search' dialog
918 SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); 918 SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE);
919#ifdef Q_WS_WIN 919#ifdef Q_WS_WIN
920 dialog->setCaption ("Qt " + tr("Search")); 920 dialog->setCaption ("Qt " + tr("Search"));
921#endif 921#endif
922 922
923#ifdef DESKTOP 923#ifdef DESKTOP
924#endif 924#endif
925 if (lastSearchedName) 925 if (lastSearchedName)
926 dialog->NameField->setText(lastSearchedName); 926 dialog->NameField->setText(lastSearchedName);
927 else 927 else
928 dialog->NameField->setText(""); 928 dialog->NameField->setText("");
929 if (lastSearchedUsername) 929 if (lastSearchedUsername)
930 dialog->UsernameField->setText(lastSearchedUsername); 930 dialog->UsernameField->setText(lastSearchedUsername);
931 else 931 else
932 dialog->UsernameField->setText(""); 932 dialog->UsernameField->setText("");
933 if (lastSearchedComment) 933 if (lastSearchedComment)
934 dialog->CommentField->setText(lastSearchedComment); 934 dialog->CommentField->setText(lastSearchedComment);
935 else 935 else
936 dialog->CommentField->setText(""); 936 dialog->CommentField->setText("");
937 DialogCode result = (DialogCode) dialog->exec(); 937 DialogCode result = (DialogCode) dialog->exec();
938#ifdef DESKTOP 938#ifdef DESKTOP
939 result = Accepted; 939 result = Accepted;
940#endif 940#endif
941 941
diff --git a/noncore/apps/zsafe/zsafe.pro b/noncore/apps/zsafe/zsafe.pro
index 3cae706..236d11e 100644
--- a/noncore/apps/zsafe/zsafe.pro
+++ b/noncore/apps/zsafe/zsafe.pro
@@ -1,17 +1,31 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on 2CONFIG = qt warn_on
3DESTDIR = $(OPIEDIR)/bin 3DESTDIR = $(OPIEDIR)/bin
4HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h \ 4HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h \
5 scqtfiledlg.h 5 scqtfiledlg.h
6SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \ 6SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \
7 categorylist.cpp zlistview.cpp shadedlistitem.cpp\ 7 categorylist.cpp zlistview.cpp shadedlistitem.cpp\
8 scqtfileedit.cpp scqtfileedit.moc.cpp \ 8 scqtfileedit.cpp scqtfileedit.moc.cpp \
9 scqtfiledlg.cpp 9 scqtfiledlg.cpp
10INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui infoform.ui wait.ui 10INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui infoform.ui wait.ui
11INCLUDEPATH += $(OPIEDIR)/include 11INCLUDEPATH += $(OPIEDIR)/include
12DEPENDPATH += $(OPIEDIR)/include 12DEPENDPATH += $(OPIEDIR)/include
13LIBS += -lqpe -lopiecore2 -lopieui2 13LIBS += -lqpe -lopiecore2 -lopieui2
14TARGET = zsafe 14TARGET = zsafe
15 15
16include ( $(OPIEDIR)/include.pro ) 16include ( $(OPIEDIR)/include.pro )
17 17
18QWS {
19message( "Configuring for multi-threaded Qt..." )
20
21}
22
23win32 {
24 TEMPLATE = app
25 DEFINES += DESKTOP QT_DLL QT_THREAD_SUPPORT
26 SOURCES += extra/qsettings.cpp
27 HEADERS += extra/qsettings.h
28 INCLUDEPATH+= extra
29 DEPENDPATH += extra
30 RC_FILE = zsafe.rc
31}
diff --git a/noncore/apps/zsafe/zsafe_win32.pro b/noncore/apps/zsafe/zsafe_win32.pro
index 5bc2c9e..3289fa0 100644
--- a/noncore/apps/zsafe/zsafe_win32.pro
+++ b/noncore/apps/zsafe/zsafe_win32.pro
@@ -1,18 +1,18 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 #CONFIG = qt warn_on thread debug 2 #CONFIG = qt warn_on thread debug
3 CONFIG = qt warn_on thread release 3 CONFIG = qt warn_on thread release
4 DEFINES = DESKTOP WIN32 4 DEFINES = DESKTOP
5DEFINES += QT_DLL QT_THREAD_SUPPORT 5DEFINES += QT_DLL QT_THREAD_SUPPORT
6HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h qsettings.h shadedlistitem.h 6HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h qsettings.h shadedlistitem.h
7SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \ 7SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \
8 categorylist.cpp zlistview.cpp qsettings.cpp shadedlistitem.cpp 8 categorylist.cpp zlistview.cpp qsettings.cpp shadedlistitem.cpp
9 #INCLUDEPATH+= $(QTDIR)/include 9 #INCLUDEPATH+= $(QTDIR)/include
10 #INCLUDEPATH+= . 10 #INCLUDEPATH+= .
11 #DEPENDPATH+= $(QTDIR)/include 11 #DEPENDPATH+= $(QTDIR)/include
12#LIBS += -lqt 12#LIBS += -lqt
13 INTERFACES= newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui 13 INTERFACES= newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui
14INTERFACES += infoform.ui wait.ui 14INTERFACES += infoform.ui wait.ui
15 TARGET = zsafe 15 TARGET = zsafe
16#DESTDIR = ../bin 16#DESTDIR = ../bin
17TRANSLATIONS = i18n/de/zsafe.ts 17TRANSLATIONS = i18n/de/zsafe.ts
18RC_FILE = zsafe.rc 18RC_FILE = zsafe.rc
diff --git a/noncore/apps/zsafe/zsafe_x86.pro b/noncore/apps/zsafe/zsafe_x86.pro
index 95eb63f..6bffd23 100644
--- a/noncore/apps/zsafe/zsafe_x86.pro
+++ b/noncore/apps/zsafe/zsafe_x86.pro
@@ -1,16 +1,27 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 #CONFIG = qt warn_on debug 2 # CONFIG = qt warn_on debug
3 CONFIG = qt warn_on release thread 3 CONFIG = qt warn_on release
4 DEFINES = DESKTOP QT_THREAD_SUPPORT 4 DEFINES = DESKTOP NO_OPIE
5HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h shadedlistitem.h 5HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h shadedlistitem.h
6SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp categorylist.cpp zlistview.cpp shadedlistitem.cpp 6SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp categorylist.cpp zlistview.cpp shadedlistitem.cpp
7 INCLUDEPATH+= $(QTDIR)/include 7 INCLUDEPATH+= $(QTDIR)/include
8 INCLUDEPATH+= . 8 INCLUDEPATH+= .
9 DEPENDPATH+= $(QTDIR)/include 9 DEPENDPATH+= $(QTDIR)/include
10#LIBS +=-L$(QPEDIR)/lib -lqt
11LIBS +=-Wl,-rpath,/usr/lib/qt3/lib -L/usr/lib/qt3/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
12 INTERFACES= newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui 10 INTERFACES= newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui
13INTERFACES += infoform.ui wait.ui 11INTERFACES += infoform.ui wait.ui
14 TARGET = zsafe 12 TARGET = zsafe
15#DESTDIR = ../bin 13#DESTDIR = ../bin
16TRANSLATIONS = i18n/de/zsafe.ts 14TRANSLATIONS = i18n/de/zsafe.ts
15MOC_DIR=.x11
16OBJECTS_DIR=.x11
17
18isEmpty(OPIEDIR) {
19 message( "Configuring for multi-threaded Qt..." )
20}
21
22win32 {
23HEADERS+=extra/qsettings.h
24SOURCES+=extra/qsettings.cpp
25 INCLUDEPATH+= extra
26 DEPENDPATH+= extra
27}