summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/zsafe.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index 43565ee..ee1da77 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -262,387 +262,389 @@ static const char* const general_data[] = {
262".O c #5a4c4a", 262".O c #5a4c4a",
263".9 c #5a595a", 263".9 c #5a595a",
264".A c #5a5d52", 264".A c #5a5d52",
265".B c #624c52", 265".B c #624c52",
266".0 c #625552", 266".0 c #625552",
267"#o c #626562", 267"#o c #626562",
268".R c #626962", 268".R c #626962",
269"#. c #626d5a", 269"#. c #626d5a",
270"#p c #626d62", 270"#p c #626d62",
271".2 c #627162", 271".2 c #627162",
272"#h c #6a6d62", 272"#h c #6a6d62",
273"#z c #6a7562", 273"#z c #6a7562",
274"#w c #6a756a", 274"#w c #6a756a",
275".C c #73656a", 275".C c #73656a",
276".P c #73696a", 276".P c #73696a",
277"#a c #737d6a", 277"#a c #737d6a",
278".U c #738573", 278".U c #738573",
279".E c #7b817b", 279".E c #7b817b",
280"#B c #7b857b", 280"#B c #7b857b",
281"#s c #7b897b", 281"#s c #7b897b",
282"#n c #7b917b", 282"#n c #7b917b",
283".b c #838d83", 283".b c #838d83",
284".7 c #839583", 284".7 c #839583",
285".n c #8b7d7b", 285".n c #8b7d7b",
286"#g c #8b8583", 286"#g c #8b8583",
287".g c #8b858b", 287".g c #8b858b",
288".r c #8b898b", 288".r c #8b898b",
289".s c #8b8d8b", 289".s c #8b8d8b",
290".i c #8b9183", 290".i c #8b9183",
291".8 c #8b918b", 291".8 c #8b918b",
292"#A c #8b9d8b", 292"#A c #8b9d8b",
293".S c #8ba183", 293".S c #8ba183",
294".Z c #94918b", 294".Z c #94918b",
295".N c #949994", 295".N c #949994",
296".F c #949d94", 296".F c #949d94",
297".x c #94a18b", 297".x c #94a18b",
298".v c #94a194", 298".v c #94a194",
299".Y c #94aa94", 299".Y c #94aa94",
300".h c #9c999c", 300".h c #9c999c",
301".Q c #9ca19c", 301".Q c #9ca19c",
302"#u c #9ca59c", 302"#u c #9ca59c",
303".H c #9caa9c", 303".H c #9caa9c",
304"#e c #9cb29c", 304"#e c #9cb29c",
305"#m c #a4b29c", 305"#m c #a4b29c",
306"#t c #a4b2a4", 306"#t c #a4b2a4",
307".M c #a4b69c", 307".M c #a4b69c",
308"#l c #a4b6a4", 308"#l c #a4b6a4",
309".z c #a4baa4", 309".z c #a4baa4",
310".f c #aca5ac", 310".f c #aca5ac",
311".q c #acaaac", 311".q c #acaaac",
312"#d c #acbeac", 312"#d c #acbeac",
313".6 c #acc2ac", 313".6 c #acc2ac",
314".o c #b4b2b4", 314".o c #b4b2b4",
315".t c #b4beb4", 315".t c #b4beb4",
316"#k c #b4c2ac", 316"#k c #b4c2ac",
317".5 c #b4cab4", 317".5 c #b4cab4",
318".D c #bdb6bd", 318".D c #bdb6bd",
319".G c #bdc6b4", 319".G c #bdc6b4",
320"#c c #bdceb4", 320"#c c #bdceb4",
321".X c #bdd2bd", 321".X c #bdd2bd",
322".4 c #bdd6bd", 322".4 c #bdd6bd",
323".1 c #c5bec5", 323".1 c #c5bec5",
324".e c #c5c2c5", 324".e c #c5c2c5",
325".u c #c5cac5", 325".u c #c5cac5",
326"#b c #c5d6c5", 326"#b c #c5d6c5",
327".J c #c5dec5", 327".J c #c5dec5",
328".p c #cdcacd", 328".p c #cdcacd",
329".W c #cddecd", 329".W c #cddecd",
330".L c #cde2cd", 330".L c #cde2cd",
331".K c #d5eacd", 331".K c #d5eacd",
332".V c #d5ead5", 332".V c #d5ead5",
333".y c #d5eed5", 333".y c #d5eed5",
334"QtQtQtQtQtQtQtQtQtQtQtQtQtQt", 334"QtQtQtQtQtQtQtQtQtQtQtQtQtQt",
335"QtQtQt.#.a.b.cQtQtQtQtQtQtQt", 335"QtQtQt.#.a.b.cQtQtQtQtQtQtQt",
336"QtQt.d.e.f.g.h.i.c.j.dQt.kQt", 336"QtQt.d.e.f.g.h.i.c.j.dQt.kQt",
337".a.l.m.n.o.p.q.r.s.t.u.v.wQt", 337".a.l.m.n.o.p.q.r.s.t.u.v.wQt",
338".x.y.z.A.B.C.D.p.q.E.F.G.H.I", 338".x.y.z.A.B.C.D.p.q.E.F.G.H.I",
339".I.J.K.L.M.N.O.P.o.p.Q.R.S.T", 339".I.J.K.L.M.N.O.P.o.p.Q.R.S.T",
340"Qt.U.V.L.W.X.Y.Z.0.P.1.s.2.3", 340"Qt.U.V.L.W.X.Y.Z.0.P.1.s.2.3",
341"Qt.3.X.W.4.X.5.6.7.8.9.s#.##", 341"Qt.3.X.W.4.X.5.6.7.8.9.s#.##",
342"QtQt#a.X#b#c.5.6#d#e#f#g#h#i", 342"QtQt#a.X#b#c.5.6#d#e#f#g#h#i",
343"QtQtQt#j.7#k.6#d#l#m#n#o#p#q", 343"QtQtQt#j.7#k.6#d#l#m#n#o#p#q",
344"QtQtQtQt.k#r#s#m#t.H#u#v#w#x", 344"QtQtQtQt.k#r#s#m#t.H#u#v#w#x",
345"QtQtQtQtQtQt.k#y#z.v#A#B#C#x", 345"QtQtQtQtQtQt.k#y#z.v#A#B#C#x",
346"QtQtQtQtQtQtQtQt.k#D.w#s#E.k", 346"QtQtQtQtQtQtQtQt.k#D.w#s#E.k",
347"QtQtQtQtQtQtQtQtQtQtQt#x#FQt"}; 347"QtQtQtQtQtQtQtQtQtQtQt#x#FQt"};
348 348
349// exit ZSafe and clear the clipboard for security reasons 349// exit ZSafe and clear the clipboard for security reasons
350 void ZSafe::exitZs (int ec) 350 void ZSafe::exitZs (int ec)
351 { 351 {
352 QClipboard *cb = QApplication::clipboard(); 352 QClipboard *cb = QApplication::clipboard();
353 cb->clear(); 353 cb->clear();
354 354
355 exit (ec); 355 exit (ec);
356 } 356 }
357 357
358 358
359// save the configuration into the file 359// save the configuration into the file
360 void ZSafe::saveConf () 360 void ZSafe::saveConf ()
361 { 361 {
362 if (conf) 362 if (conf)
363 { 363 {
364 delete conf; 364 delete conf;
365 365
366#ifdef DESKTOP 366#ifdef DESKTOP
367#ifndef WIN32 367#ifndef WIN32
368 conf = new QSettings (); 368 conf = new QSettings ();
369 conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); 369 conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath());
370#else 370#else
371 conf = new QSettings (cfgFile); 371 conf = new QSettings (cfgFile);
372 conf->insertSearchPath (QSettings::Unix, cfgFile); 372 conf->insertSearchPath (QSettings::Unix, cfgFile);
373#endif 373#endif
374#else 374#else
375 conf = new Config (cfgFile, Config::File); 375 conf = new Config (cfgFile, Config::File);
376 conf->setGroup ("zsafe"); 376 conf->setGroup ("zsafe");
377#endif 377#endif
378 } 378 }
379 } 379 }
380 380
381 381
382/* 382/*
383 * Constructs a ZSafe which is a child of 'parent', with the 383 * Constructs a ZSafe which is a child of 'parent', with the
384 * name 'name' and widget flags set to 'f' 384 * name 'name' and widget flags set to 'f'
385 * 385 *
386 * The dialog will by default be modeless, unless you set 'modal' to 386 * The dialog will by default be modeless, unless you set 'modal' to
387 * TRUE to construct a modal dialog. 387 * TRUE to construct a modal dialog.
388 */ 388 */
389ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) 389ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
390 : QDialog( parent, name, modal, fl ) 390 : QDialog( parent, name, modal, fl ),
391 Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l)
391{ 392{
392 IsCut = false; 393 IsCut = false;
393 IsCopy = false; 394 IsCopy = false;
394 modified = false; 395 modified = false;
395 396
396 // set the config file 397 // set the config file
397 cfgFile=QDir::homeDirPath(); 398 cfgFile=QDir::homeDirPath();
398 cfgFile += "/.zsafe.cfg"; 399 cfgFile += "/.zsafe.cfg";
399 // set the icon path 400 // set the icon path
401#ifdef NO_OPIE
400 QString qpedir ((const char *)getenv("QPEDIR")); 402 QString qpedir ((const char *)getenv("QPEDIR"));
403#else
404 QString qpedir ((const char *)getenv("OPIEDIR"));
405#endif
406
401#ifdef DESKTOP 407#ifdef DESKTOP
402 iconPath = QDir::homeDirPath() + "/pics/"; 408 iconPath = QDir::homeDirPath() + "/pics/";
403#else 409#else
404 if (qpedir.isEmpty()) 410 if (qpedir.isEmpty())
405 iconPath = "/home/QtPalmtop/pics/"; 411 iconPath = "/home/QtPalmtop/pics/";
406 else 412 else
407 iconPath = qpedir + "/pics/"; 413 iconPath = qpedir + "/pics/";
408#endif 414#endif
409 415
410 // create a zsafe configuration object 416 // create a zsafe configuration object
411#ifdef DESKTOP 417#ifdef DESKTOP
412#ifndef WIN32 418#ifndef WIN32
413 conf = new QSettings (); 419 conf = new QSettings ();
414 conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); 420 conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath());
415#else 421#else
416 conf = new QSettings (cfgFile); 422 conf = new QSettings (cfgFile);
417 conf->insertSearchPath (QSettings::Unix, cfgFile); 423 conf->insertSearchPath (QSettings::Unix, cfgFile);
418#endif 424#endif
419#else 425#else
420 conf = new Config (cfgFile, Config::File); 426 conf = new Config (cfgFile, Config::File);
421 conf->setGroup ("zsafePrefs"); 427 conf->setGroup ("zsafePrefs");
422#endif 428#endif
423#ifdef DESKTOP 429#ifdef DESKTOP
424// #ifndef WIN32 430// #ifndef WIN32
425 expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false); 431 expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false);
426// #endif 432// #endif
427#else 433#else
428 expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0); 434 expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0);
429#endif 435#endif
430#ifndef DESKTOP 436#ifndef DESKTOP
431 conf->setGroup ("zsafe"); 437 conf->setGroup ("zsafe");
432#endif 438#endif
433 439
434 QPixmap copy_img((const char**) copy_xpm); 440 QPixmap copy_img((const char**) copy_xpm);
435 QPixmap cut_img((const char**) cut_xpm); 441 QPixmap cut_img((const char**) cut_xpm);
436 QPixmap edit_img((const char**) edit_xpm); 442 QPixmap edit_img((const char**) edit_xpm);
437 QPixmap editdelete_img((const char**) editdelete_xpm); 443 QPixmap editdelete_img((const char**) editdelete_xpm);
438 QPixmap find_img((const char**) find_xpm); 444 QPixmap find_img((const char**) find_xpm);
439 QPixmap folder_open_img((const char**) folder_open_xpm); 445 QPixmap folder_open_img((const char**) folder_open_xpm);
440 QPixmap help_icon_img((const char**) help_icon_xpm); 446 QPixmap help_icon_img((const char**) help_icon_xpm);
441 QPixmap new_img((const char**) new_xpm); 447 QPixmap new_img((const char**) new_xpm);
442 QPixmap paste_img((const char**) paste_xpm); 448 QPixmap paste_img((const char**) paste_xpm);
443 QPixmap quit_icon_img((const char**) quit_icon_xpm); 449 QPixmap quit_icon_img((const char**) quit_icon_xpm);
444 QPixmap save_img((const char**) save_xpm); 450 QPixmap save_img((const char**) save_xpm);
445 QPixmap trash_img((const char**) trash_xpm); 451 QPixmap trash_img((const char**) trash_xpm);
446 QPixmap expand_img((const char**) expand_xpm); 452 QPixmap expand_img((const char**) expand_xpm);
447 QPixmap export_img((const char**) export_xpm); 453 QPixmap export_img((const char**) export_xpm);
448 QPixmap import_img((const char**) import_xpm); 454 QPixmap import_img((const char**) import_xpm);
449 455
450 QPixmap bank_cards( ( const char** ) bank_cards_data ); 456 QPixmap bank_cards( ( const char** ) bank_cards_data );
451 QPixmap passwords( ( const char** ) passwords_data ); 457 QPixmap passwords( ( const char** ) passwords_data );
452 QPixmap software( ( const char** ) software_data ); 458 QPixmap software( ( const char** ) software_data );
453 QPixmap general( ( const char** ) general_data ); 459 QPixmap general( ( const char** ) general_data );
454 if ( !name ) 460 if ( !name )
455 setName( "ZSafe" ); 461 setName( "ZSafe" );
456 462
457#ifdef DESKTOP 463#ifdef DESKTOP
458#ifdef WIN32 464#ifdef WIN32
459 setGeometry(100, 150, DeskW, DeskH-30 ); 465 setGeometry(100, 150, DeskW, DeskH-30 );
460#else 466#else
461 resize( DeskW, DeskH-30 ); 467 resize( DeskW, DeskH-30 );
462#endif 468#endif
463 469
464#else 470#else
465 471
466#ifdef JPATCH_HDE 472#ifdef JPATCH_HDE
467 int DeskS; 473 int DeskS;
468 if(DeskW > DeskH) 474 if(DeskW > DeskH)
469 { 475 {
470 DeskS = DeskW; 476 DeskS = DeskW;
471 } 477 }
472 else 478 else
473 { 479 {
474 DeskS = DeskH; 480 DeskS = DeskH;
475 } 481 }
476 resize( DeskW, DeskH ); 482 resize( DeskW, DeskH );
477 setMinimumSize( QSize( DeskS, DeskS ) ); 483 setMinimumSize( QSize( DeskS, DeskS ) );
478 setMaximumSize( QSize( DeskS, DeskS ) ); 484 setMaximumSize( QSize( DeskS, DeskS ) );
479#else 485#else
480 resize( DeskW, DeskH-30 ); 486 resize( DeskW, DeskH-30 );
481#endif 487#endif
482 488
483#endif 489#endif
484 // setCaption( tr( "ZSafe" ) ); 490 // setCaption( tr( "ZSafe" ) );
485 491
486 filename = conf->readEntry(APP_KEY+"document"); 492 filename = conf->readEntry(APP_KEY+"document");
487 if (filename.isEmpty() || filename.isNull()) 493 if (filename.isEmpty() || filename.isNull())
488 { 494 {
489 495
490 // check if the directory application exists, if not 496 // check if the directory application exists, if not
491 // create it 497 // create it
492// #ifndef WIN32 498// #ifndef WIN32
493 // QString d1("Documents/application"); 499 // QString d1("Documents/application");
494// #else 500// #else
495 QString d1(QDir::homeDirPath() + "/Documents/application"); 501 QString d1(QDir::homeDirPath() + "/Documents/application");
496// #endif 502// #endif
497 QDir pd1(d1); 503 QDir pd1(d1);
498 if (!pd1.exists()) 504 if (!pd1.exists())
499 { 505 {
500 QDir pd1("Documents"); 506 QDir pd1("Documents");
501 if (!pd1.mkdir("application", FALSE)) 507 if (!pd1.mkdir("application", FALSE))
502 { 508 {
503 QMessageBox::critical( 0, tr("ZSafe"), 509 QMessageBox::critical( 0, tr("ZSafe"),
504#ifdef JPATCH_HDE 510#ifdef JPATCH_HDE
505 tr("Can't create directory\n.../Documents/application\n\nZSafe will now exit.")); 511 tr("Can't create directory\n.../Documents/application\n\nZSafe will now exit."));
506#else 512#else
507 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d1)); 513 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d1));
508#endif 514#endif
509 exitZs (1); 515 exitZs (1);
510 } 516 }
511 } 517 }
512// #ifndef WIN32 518 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
513 // QString d2("Documents/application/zsafe");
514// #else
515 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
516// #endif
517 QDir pd2(d2); 519 QDir pd2(d2);
518 if (!pd2.exists()) 520 if (!pd2.exists())
519 { 521 {
520 QDir pd2("Documents/application"); 522 QDir pd2(QDir::homeDirPath() + "Documents/application");
521 if (!pd2.mkdir("zsafe", FALSE)) 523 if (!pd2.mkdir("zsafe", FALSE))
522 { 524 {
523 QMessageBox::critical( 0, tr("ZSafe"), 525 QMessageBox::critical( 0, tr("ZSafe"),
524#ifdef JPATCH_HDE 526#ifdef JPATCH_HDE
525 tr("Can't create directory\n...//Documents/application/zsafe\n\nZSafe will now exit.")); 527 tr("Can't create directory\n...//Documents/application/zsafe\n\nZSafe will now exit."));
526#else 528#else
527 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d2)); 529 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d2));
528#endif 530#endif
529 exitZs (1); 531 exitZs (1);
530 } 532 }
531 } 533 }
532 534
533 535
534 // set the default filename 536 // set the default filename
535 filename=d2 + "/passwords.zsf"; 537 filename=d2 + "/passwords.zsf";
536 538
537 // save the current filename to the config file 539 // save the current filename to the config file
538 conf->writeEntry(APP_KEY+"document", filename); 540 conf->writeEntry(APP_KEY+"document", filename);
539 saveConf(); 541 saveConf();
540 } 542 }
541 543
542 //if (filename == "INVALIDPWD") 544 //if (filename == "INVALIDPWD")
543 //filename = ""; 545 //filename = "";
544 546
545 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 547 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
546#ifdef WIN32 548#ifdef WIN32
547 this->setCaption("Qt ZSafe: " + ti); 549 this->setCaption("Qt ZSafe: " + ti);
548#else 550#else
549 this->setCaption("ZSafe: " + ti); 551 this->setCaption("ZSafe: " + ti);
550#endif 552#endif
551 553
552 selectedItem = NULL; 554 selectedItem = NULL;
553 lastSearchedCategory = NULL; 555 lastSearchedCategory = NULL;
554 lastSearchedItem = NULL; 556 lastSearchedItem = NULL;
555 lastSearchedName = ""; 557 lastSearchedName = "";
556 lastSearchedUsername = ""; 558 lastSearchedUsername = "";
557 lastSearchedComment = ""; 559 lastSearchedComment = "";
558 560
559 infoForm = new InfoForm(); 561 infoForm = new InfoForm();
560 categoryDialog = NULL; 562 categoryDialog = NULL;
561 563
562 // add a menu bar 564 // add a menu bar
563 QMenuBar *menu = new QMenuBar( this ); 565 QMenuBar *menu = new QMenuBar( this );
564 566
565 // add file menu 567 // add file menu
566 // QPopupMenu *file = new QPopupMenu( this ); 568 // QPopupMenu *file = new QPopupMenu( this );
567 file = new QPopupMenu( this ); 569 file = new QPopupMenu( this );
568 570
569// #ifdef DESKTOP 571// #ifdef DESKTOP
570 file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) ); 572 file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) );
571 file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) ); 573 file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) );
572 file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) ); 574 file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) );
573 file->insertSeparator(); 575 file->insertSeparator();
574// #endif 576// #endif
575 577
576 file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) ); 578 file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) );
577 file->insertItem( save_img, tr("S&ave document with new Password"), this, 579 file->insertItem( save_img, tr("S&ave document with new Password"), this,
578 SLOT(saveDocumentWithPwd()) ); 580 SLOT(saveDocumentWithPwd()) );
579 file->insertSeparator(); 581 file->insertSeparator();
580 file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) ); 582 file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) );
581 file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) ); 583 file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) );
582 file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) ); 584 file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) );
583 file->insertSeparator(); 585 file->insertSeparator();
584 file->insertItem( expand_img, tr("&Open entries expanded"), this, 586 file->insertItem( expand_img, tr("&Open entries expanded"), this,
585 SLOT(setExpandFlag()), 0, 'o'); 587 SLOT(setExpandFlag()), 0, 'o');
586 file->setItemChecked('o', expandTree); 588 file->setItemChecked('o', expandTree);
587 file->insertSeparator(); 589 file->insertSeparator();
588 file->insertItem( quit_icon_img, tr("E&xit"), this, SLOT(quitMe()) ); 590 file->insertItem( quit_icon_img, tr("E&xit"), this, SLOT(quitMe()) );
589 menu->insertItem( tr("&File"), file ); 591 menu->insertItem( tr("&File"), file );
590 592
591 QPopupMenu *cat = new QPopupMenu( this ); 593 QPopupMenu *cat = new QPopupMenu( this );
592 cat->insertItem( new_img, tr("&New"), this, SLOT(addCategory()) ); 594 cat->insertItem( new_img, tr("&New"), this, SLOT(addCategory()) );
593 cat->insertItem( edit_img, tr("&Edit"), this, SLOT(editCategory()) ); 595 cat->insertItem( edit_img, tr("&Edit"), this, SLOT(editCategory()) );
594 cat->insertItem( trash_img, tr("&Delete"), this, SLOT(delCategory()) ); 596 cat->insertItem( trash_img, tr("&Delete"), this, SLOT(delCategory()) );
595 menu->insertItem( tr("&Category"), cat ); 597 menu->insertItem( tr("&Category"), cat );
596 598
597 QPopupMenu *it = new QPopupMenu( this ); 599 QPopupMenu *it = new QPopupMenu( this );
598 it->insertItem( cut_img, tr("&Cut"), this, SLOT(cutItem()) ); 600 it->insertItem( cut_img, tr("&Cut"), this, SLOT(cutItem()) );
599 it->insertItem( copy_img, tr("C&opy"), this, SLOT(copyItem()) ); 601 it->insertItem( copy_img, tr("C&opy"), this, SLOT(copyItem()) );
600 it->insertItem( paste_img, tr("&Paste"), this, SLOT(pasteItem()) ); 602 it->insertItem( paste_img, tr("&Paste"), this, SLOT(pasteItem()) );
601 it->insertSeparator(); 603 it->insertSeparator();
602 it->insertItem( new_img, tr("&New"), this, SLOT(newPwd()) ); 604 it->insertItem( new_img, tr("&New"), this, SLOT(newPwd()) );
603 it->insertItem( edit_img, tr("&Edit"), this, SLOT(editPwd()) ); 605 it->insertItem( edit_img, tr("&Edit"), this, SLOT(editPwd()) );
604 it->insertItem( trash_img, tr("&Delete"), this, SLOT(deletePwd()) ); 606 it->insertItem( trash_img, tr("&Delete"), this, SLOT(deletePwd()) );
605 it->insertItem( find_img, tr("&Search"), this, SLOT(findPwd()) ); 607 it->insertItem( find_img, tr("&Search"), this, SLOT(findPwd()) );
606 menu->insertItem( tr("&Entry"), it ); 608 menu->insertItem( tr("&Entry"), it );
607 609
608 QPopupMenu *help = new QPopupMenu( this ); 610 QPopupMenu *help = new QPopupMenu( this );
609 help->insertItem( help_icon_img, tr("&About"), this, SLOT(about()) ); 611 help->insertItem( help_icon_img, tr("&About"), this, SLOT(about()) );
610 menu->insertItem( tr("&Help"), help ); 612 menu->insertItem( tr("&Help"), help );
611 613
612 // toolbar icons 614 // toolbar icons
613 615
614 New = new QToolButton( menu, "New" ); 616 New = new QToolButton( menu, "New" );
615 New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) ); 617 New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) );
616 New->setMouseTracking( TRUE ); 618 New->setMouseTracking( TRUE );
617 New->setText( tr( "" ) ); 619 New->setText( tr( "" ) );
618 New->setPixmap( new_img ); 620 New->setPixmap( new_img );
619 QToolTip::add( New, tr( "New entry" ) ); 621 QToolTip::add( New, tr( "New entry" ) );
620 622
621 Edit = new QToolButton( menu, "Edit" ); 623 Edit = new QToolButton( menu, "Edit" );
622 Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) ); 624 Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) );
623 Edit->setText( tr( "" ) ); 625 Edit->setText( tr( "" ) );
624 Edit->setPixmap( edit_img ); 626 Edit->setPixmap( edit_img );
625 QToolTip::add( Edit, tr( "Edit category or entry" ) ); 627 QToolTip::add( Edit, tr( "Edit category or entry" ) );
626 628
627 Delete = new QToolButton( menu, "Delete" ); 629 Delete = new QToolButton( menu, "Delete" );
628 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); 630 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
629 Delete->setText( tr( "" ) ); 631 Delete->setText( tr( "" ) );
630 Delete->setPixmap( trash_img ); 632 Delete->setPixmap( trash_img );
631 QToolTip::add( Delete, tr( "Delete category or entry" ) ); 633 QToolTip::add( Delete, tr( "Delete category or entry" ) );
632 634
633 Find = new QToolButton( menu, "Find" ); 635 Find = new QToolButton( menu, "Find" );
634 Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) ); 636 Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) );
635 Find->setText( tr( "" ) ); 637 Find->setText( tr( "" ) );
636 Find->setPixmap( find_img ); 638 Find->setPixmap( find_img );
637 QToolTip::add( Find, tr( "Find entry" ) ); 639 QToolTip::add( Find, tr( "Find entry" ) );
638 640
639/* 641/*
640 QBoxLayout * h = new QHBoxLayout( this ); 642 QBoxLayout * h = new QHBoxLayout( this );
641 h->addWidget (menu); 643 h->addWidget (menu);
642 h->addWidget (New); 644 h->addWidget (New);
643 h->addWidget (Edit); 645 h->addWidget (Edit);
644 h->addWidget (Delete); 646 h->addWidget (Delete);
645 h->addWidget (Find); 647 h->addWidget (Find);
646*/ 648*/
647 649
648 ListView = new ZListView( this, "ListView" ); 650 ListView = new ZListView( this, "ListView" );
@@ -3522,223 +3524,225 @@ void ZSafe::saveDocumentAs()
3522 QDir::homeDirPath() + "/Documents/application/zsafe", 3524 QDir::homeDirPath() + "/Documents/application/zsafe",
3523 "ZSafe (*.zsf)", 3525 "ZSafe (*.zsf)",
3524 this, 3526 this,
3525 "ZSafe File Dialog" 3527 "ZSafe File Dialog"
3526 "Choose a ZSafe file" ); 3528 "Choose a ZSafe file" );
3527#endif 3529#endif
3528 3530
3529 // open the new document 3531 // open the new document
3530 if (newFile && newFile.length() > 0 ) 3532 if (newFile && newFile.length() > 0 )
3531 { 3533 {
3532 // save the previous opened document 3534 // save the previous opened document
3533 if (!filename.isEmpty()) 3535 if (!filename.isEmpty())
3534 saveDocument(filename, FALSE); 3536 saveDocument(filename, FALSE);
3535 3537
3536 selectedItem = NULL; 3538 selectedItem = NULL;
3537 filename = newFile; 3539 filename = newFile;
3538 3540
3539 // save the current filename to the config file 3541 // save the current filename to the config file
3540 conf->writeEntry(APP_KEY+"document", filename); 3542 conf->writeEntry(APP_KEY+"document", filename);
3541 saveConf(); 3543 saveConf();
3542 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 3544 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3543#ifdef WIN32 3545#ifdef WIN32
3544 this->setCaption("Qt ZSafe: " + ti); 3546 this->setCaption("Qt ZSafe: " + ti);
3545#else 3547#else
3546 this->setCaption("ZSafe: " + ti); 3548 this->setCaption("ZSafe: " + ti);
3547#endif 3549#endif
3548 3550
3549 QMessageBox::information( this, tr("ZSafe"), 3551 QMessageBox::information( this, tr("ZSafe"),
3550 tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); 3552 tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0);
3551 3553
3552 saveDocumentWithPwd(); 3554 saveDocumentWithPwd();
3553 } 3555 }
3554} 3556}
3555 3557
3556void ZSafe::saveDocumentWithoutPwd() 3558void ZSafe::saveDocumentWithoutPwd()
3557{ 3559{
3558 saveDocument(filename, FALSE); 3560 saveDocument(filename, FALSE);
3559} 3561}
3560 3562
3561void ZSafe::saveDocumentWithPwd() 3563void ZSafe::saveDocumentWithPwd()
3562{ 3564{
3563 saveDocument(filename, TRUE); 3565 saveDocument(filename, TRUE);
3564} 3566}
3565 3567
3566void ZSafe::about() 3568void ZSafe::about()
3567{ 3569{
3568 QString info; 3570 QString info;
3569#ifdef JPATCH_HDE 3571#ifdef JPATCH_HDE
3570 info = "<html><body><div align=""center"">"; 3572 info = "<html><body><div align=""center"">";
3571 info += "<b>"; 3573 info += "<b>";
3572 info += tr("Zaurus Password Manager<br>"); 3574 info += tr("Zaurus Password Manager<br>");
3573 info += tr("ZSafe version 2.1.2-jv01b<br>"); 3575 info += tr("ZSafe version 2.1.2-jv01b<br>");
3574 info += "</b>"; 3576 info += "</b>";
3575 info += tr("by Carsten Schneider<br>"); 3577 info += tr("by Carsten Schneider<br>");
3576 info += "zcarsten@gmx.net<br>"; 3578 info += "zcarsten@gmx.net<br>";
3577 info += "http://z-soft.z-portal.info/zsafe"; 3579 info += "http://z-soft.z-portal.info/zsafe";
3578 info += "<br>"; 3580 info += "<br>";
3579 info += tr("Translations by Robert Ernst<br>"); 3581 info += tr("Translations by Robert Ernst<br>");
3580 info += "robert.ernst@linux-solutions.at<br>"; 3582 info += "robert.ernst@linux-solutions.at<br>";
3581 3583
3582 info += "<br><br>"; 3584 info += "<br><br>";
3583 info += QString::fromUtf8("æ~W¥æ~\\¬èª~^/VGA Zaurus対å¿~\\ã~C~Qã~C~Cã~C~Aä½~\\æ ~H~P<br>"); 3585 info += QString::fromUtf8("æ~W¥æ~\\¬èª~^/VGA Zaurus対å¿~\\ã~C~Qã~C~Cã~C~Aä½~\\æ ~H~P<br>");
3584 info += "HADECO R&D<br>"; 3586 info += "HADECO R&D<br>";
3585 info += "r&d@hadeco.co.jp<br>"; 3587 info += "r&d@hadeco.co.jp<br>";
3586 info += "http://www.hadeco.co.jp/r&d/<br>"; 3588 info += "http://www.hadeco.co.jp/r&d/<br>";
3587 info += "<br></div>"; 3589 info += "<br></div>";
3588 info += "</body></html>"; 3590 info += "</body></html>";
3589#else 3591#else
3590 info = "<html><body><div align=""center"">"; 3592 info = "<html><body><div align=""center"">";
3591 info += "<b>"; 3593 info += "<b>";
3592 info += tr("Zaurus Password Manager<br>"); 3594 info += tr("Zaurus Password Manager<br>");
3593 info += tr("ZSafe version 2.1.2<br>"); 3595 info += tr("ZSafe version 2.1.2<br>");
3594 info += "</b>"; 3596 info += "</b>";
3595 info += tr("by Carsten Schneider<br>"); 3597 info += tr("by Carsten Schneider<br>");
3596 info += "zcarsten@gmx.net<br>"; 3598 info += "zcarsten@gmx.net<br>";
3597 info += "http://z-soft.z-portal.info/zsafe"; 3599 info += "http://z-soft.z-portal.info/zsafe";
3598 info += "<br>"; 3600 info += "<br>";
3599 info += tr("Translations by Robert Ernst<br>"); 3601 info += tr("Translations by Robert Ernst<br>");
3600 info += "robert.ernst@linux-solutions.at<br>"; 3602 info += "robert.ernst@linux-solutions.at<br>";
3601 info += "<br></div>"; 3603 info += "<br></div>";
3602 info += "</body></html>"; 3604 info += "</body></html>";
3603#endif 3605#endif
3604 3606
3605 // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0); 3607 // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0);
3606 3608
3607 QMessageBox mb( this, tr("ZSafe")); 3609 QMessageBox mb( this, tr("ZSafe"));
3608 mb.setText (info); 3610 mb.setText (info);
3609 mb.setButtonText (QMessageBox::Ok, tr ("&OK")); 3611 mb.setButtonText (QMessageBox::Ok, tr ("&OK"));
3610 QPixmap zsafe_img((const char**) zsafe_xpm); 3612 QPixmap zsafe_img((const char**) zsafe_xpm);
3611 mb.setIconPixmap (zsafe_img); 3613 mb.setIconPixmap (zsafe_img);
3612 mb.exec(); 3614 mb.exec();
3613} 3615}
3614 3616
3615void ZSafe::setExpandFlag() 3617void ZSafe::setExpandFlag()
3616{ 3618{
3617 expandTree = !expandTree; 3619 expandTree = !expandTree;
3618 file->setItemChecked('o', expandTree); 3620 file->setItemChecked('o', expandTree);
3619#ifndef DESKTOP 3621#ifndef DESKTOP
3620 conf->setGroup ("zsafePrefs"); 3622 conf->setGroup ("zsafePrefs");
3621#endif 3623#endif
3622// #ifndef WIN32 3624// #ifndef WIN32
3623 conf->writeEntry (APP_KEY+"expandTree", expandTree); 3625 conf->writeEntry (APP_KEY+"expandTree", expandTree);
3624// #endif 3626// #endif
3625 saveConf(); 3627 saveConf();
3626 3628
3627} 3629}
3628 3630
3629void ZSafe::paintEvent( QPaintEvent * ) 3631void ZSafe::paintEvent( QPaintEvent * )
3630{ 3632{
3631 if (raiseFlag) 3633 if (raiseFlag)
3632 { 3634 {
3633 raiseFlag = false; 3635 raiseFlag = false;
3634 raiseTimer.start (1, true); 3636 raiseTimer.start (1, true);
3635 if (infoForm->isVisible()) 3637 if (infoForm->isVisible())
3636 infoForm->raise(); 3638 infoForm->raise();
3637 } 3639 }
3638} 3640}
3639 3641
3640void ZSafe::resizeEvent ( QResizeEvent * ) 3642void ZSafe::resizeEvent ( QResizeEvent * )
3641{ 3643{
3642 // qWarning ("resizeEvent"); 3644 // qWarning ("resizeEvent");
3643#ifndef DESKTOP 3645#ifndef DESKTOP
3644 DeskW = appl->desktop()->width(); 3646 DeskW = appl->desktop()->width();
3645 DeskH = appl->desktop()->height(); 3647 DeskH = appl->desktop()->height();
3646#else 3648#else
3647 DeskW = this->width(); 3649 DeskW = this->width();
3648 DeskH = this->height(); 3650 DeskH = this->height();
3649#endif 3651#endif
3650 qWarning( QString("Width : %1").arg(DeskW), 2000 );
3651 qWarning( QString("Height: %1").arg(DeskH), 2000 );
3652 3652
3653 New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) ); 3653 if (New)
3654 Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) ); 3654 New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) );
3655 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); 3655 if (Edit)
3656 Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) ); 3656 Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) );
3657 if (Delete)
3658 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
3659 if (Find)
3660 Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) );
3657} 3661}
3658 3662
3659void ZSafe::slotRaiseTimer() 3663void ZSafe::slotRaiseTimer()
3660{ 3664{
3661 if (infoForm->isVisible()) 3665 if (infoForm->isVisible())
3662 infoForm->raise(); 3666 infoForm->raise();
3663 raiseFlag = true; 3667 raiseFlag = true;
3664} 3668}
3665 3669
3666QPixmap * ZSafe::getPredefinedIcon(QString category) 3670QPixmap * ZSafe::getPredefinedIcon(QString category)
3667{ 3671{
3668 QPixmap *pm; 3672 QPixmap *pm;
3669 if (category == "Bank cards") 3673 if (category == "Bank cards")
3670 pm = new QPixmap((const char**)bank_cards_data); 3674 pm = new QPixmap((const char**)bank_cards_data);
3671 else if (category == "Passwords") 3675 else if (category == "Passwords")
3672 pm = new QPixmap((const char**)passwords_data); 3676 pm = new QPixmap((const char**)passwords_data);
3673 else if (category == "Software") 3677 else if (category == "Software")
3674 pm = new QPixmap((const char**)software_data); 3678 pm = new QPixmap((const char**)software_data);
3675 else if (category == "General") 3679 else if (category == "General")
3676 pm = new QPixmap((const char**)general_data); 3680 pm = new QPixmap((const char**)general_data);
3677 else 3681 else
3678 pm = new QPixmap((const char**)general_data); 3682 pm = new QPixmap((const char**)general_data);
3679 return pm; 3683 return pm;
3680} 3684}
3681 3685
3682void ZSafe::setDocument(const QString& fileref) 3686void ZSafe::setDocument(const QString& fileref)
3683{ 3687{
3684#ifndef DESKTOP 3688#ifndef DESKTOP
3685 // stop the timer to prevent loading of the default document 3689 // stop the timer to prevent loading of the default document
3686 docuTimer.stop(); 3690 docuTimer.stop();
3687 3691
3688 DocLnk link(fileref); 3692 DocLnk link(fileref);
3689 if ( link.isValid() ) 3693 if ( link.isValid() )
3690 { 3694 {
3691 // if (filename != link.file()) 3695 // if (filename != link.file())
3692 // saveDocument(filename, FALSE); 3696 // saveDocument(filename, FALSE);
3693 filename = link.file(); 3697 filename = link.file();
3694 } 3698 }
3695 else 3699 else
3696 { 3700 {
3697 // if (filename != fileref) 3701 // if (filename != fileref)
3698 // saveDocument(filename, FALSE); 3702 // saveDocument(filename, FALSE);
3699 filename = fileref; 3703 filename = fileref;
3700 } 3704 }
3701 // save the current filename to the config file 3705 // save the current filename to the config file
3702 conf->writeEntry(APP_KEY+"document", filename); 3706 conf->writeEntry(APP_KEY+"document", filename);
3703 saveConf(); 3707 saveConf();
3704 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 3708 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3705#ifdef WIN32 3709#ifdef WIN32
3706 this->setCaption("Qt ZSafe: " + ti); 3710 this->setCaption("Qt ZSafe: " + ti);
3707#else 3711#else
3708 this->setCaption("ZSafe: " + ti); 3712 this->setCaption("ZSafe: " + ti);
3709#endif 3713#endif
3710 3714
3711 // clear the password list 3715 // clear the password list
3712 QListViewItem *i; 3716 QListViewItem *i;
3713 QListViewItem *c = NULL; 3717 QListViewItem *c = NULL;
3714 // step through all categories 3718 // step through all categories
3715 for (i = ListView->firstChild(); 3719 for (i = ListView->firstChild();
3716 i != NULL; 3720 i != NULL;
3717 i = i->nextSibling()) 3721 i = i->nextSibling())
3718 { 3722 {
3719 if (c) delete c; // delete the previous category 3723 if (c) delete c; // delete the previous category
3720 3724
3721 c = i; 3725 c = i;
3722 // step through all subitems 3726 // step through all subitems
3723 QListViewItem *si; 3727 QListViewItem *si;
3724 for (si = i->firstChild(); 3728 for (si = i->firstChild();
3725 si != NULL; ) 3729 si != NULL; )
3726 { 3730 {
3727 QListViewItem *_si = si; 3731 QListViewItem *_si = si;
3728 si = si->nextSibling(); 3732 si = si->nextSibling();
3729 i->takeItem(_si); // remove from view list 3733 i->takeItem(_si); // remove from view list
3730 if (_si) delete _si; 3734 if (_si) delete _si;
3731 } 3735 }
3732 } 3736 }
3733 if (c) delete c; // delete the previous category 3737 if (c) delete c; // delete the previous category
3734 categories.clear(); 3738 categories.clear();
3735 3739
3736 m_password = ""; 3740 m_password = "";
3737 selectedItem = NULL; 3741 selectedItem = NULL;
3738 3742
3739 openDocument(filename); 3743 openDocument(filename);
3740#endif 3744#endif
3741} 3745}
3742 3746
3743 3747
3744 3748