summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/zsafe.cpp132
-rw-r--r--noncore/apps/zsafe/zsafe.h8
2 files changed, 122 insertions, 18 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index 189453e..5cad7cb 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -33,48 +33,49 @@
33using namespace Opie::Core; 33using namespace Opie::Core;
34using namespace Opie::Ui; 34using 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 WIN32
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#ifndef WIN32 58#ifndef WIN32
58#include <qsettings.h> 59#include <qsettings.h>
59#else 60#else
60#include "qsettings.h" 61#include "qsettings.h"
61#endif 62#endif
62#include <qapplication.h> 63#include <qapplication.h>
63#else 64#else
64#include <qfile.h> 65#include <qfile.h>
65#include <qpe/fileselector.h> 66#include <qpe/fileselector.h>
66#include <qpe/global.h> 67#include <qpe/global.h>
67#include <qpe/qpeapplication.h> 68#include <qpe/qpeapplication.h>
68#include <qpe/resource.h> 69#include <qpe/resource.h>
69#include <qpe/config.h> 70#include <qpe/config.h>
70#endif 71#endif
71 72
72#include <qtimer.h> 73#include <qtimer.h>
73#include <qlayout.h> 74#include <qlayout.h>
74#include <qmessagebox.h> 75#include <qmessagebox.h>
75#include <qfile.h> 76#include <qfile.h>
76#include <qtextstream.h> 77#include <qtextstream.h>
77#include <qheader.h> 78#include <qheader.h>
78#include <qlistview.h> 79#include <qlistview.h>
79#include <qtoolbutton.h> 80#include <qtoolbutton.h>
80#include <qvariant.h> 81#include <qvariant.h>
@@ -372,48 +373,49 @@ static const char* const general_data[] = {
372 conf->insertSearchPath (QSettings::Unix, cfgFile); 373 conf->insertSearchPath (QSettings::Unix, cfgFile);
373#endif 374#endif
374#else 375#else
375 conf = new Config (cfgFile, Config::File); 376 conf = new Config (cfgFile, Config::File);
376 conf->setGroup ("zsafe"); 377 conf->setGroup ("zsafe");
377#endif 378#endif
378 } 379 }
379 } 380 }
380 381
381 382
382/* 383/*
383 * Constructs a ZSafe which is a child of 'parent', with the 384 * Constructs a ZSafe which is a child of 'parent', with the
384 * name 'name' and widget flags set to 'f' 385 * name 'name' and widget flags set to 'f'
385 * 386 *
386 * 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
387 * TRUE to construct a modal dialog. 388 * TRUE to construct a modal dialog.
388 */ 389 */
389ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) 390ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
390 : QDialog( parent, name, modal, fl ), 391 : QDialog( parent, name, modal, fl ),
391 Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l) 392 Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l)
392{ 393{
393 IsCut = false; 394 IsCut = false;
394 IsCopy = false; 395 IsCopy = false;
395 modified = false; 396 modified = false;
397 showpwd = false;
396 398
397 // set the config file 399 // set the config file
398 cfgFile=QDir::homeDirPath(); 400 cfgFile=QDir::homeDirPath();
399 cfgFile += "/.zsafe.cfg"; 401 cfgFile += "/.zsafe.cfg";
400 // set the icon path 402 // set the icon path
401#ifdef NO_OPIE 403#ifdef NO_OPIE
402 QString qpedir ((const char *)getenv("QPEDIR")); 404 QString qpedir ((const char *)getenv("QPEDIR"));
403#else 405#else
404 QString qpedir ((const char *)getenv("OPIEDIR")); 406 QString qpedir ((const char *)getenv("OPIEDIR"));
405#endif 407#endif
406 408
407#ifdef DESKTOP 409#ifdef DESKTOP
408 iconPath = QDir::homeDirPath() + "/pics/"; 410 iconPath = QDir::homeDirPath() + "/pics/";
409#else 411#else
410 if (qpedir.isEmpty()) 412 if (qpedir.isEmpty())
411 iconPath = "/home/QtPalmtop/pics/"; 413 iconPath = "/home/QtPalmtop/pics/";
412 else 414 else
413 iconPath = qpedir + "/pics/"; 415 iconPath = qpedir + "/pics/";
414#endif 416#endif
415 417
416 // create a zsafe configuration object 418 // create a zsafe configuration object
417#ifdef DESKTOP 419#ifdef DESKTOP
418#ifndef WIN32 420#ifndef WIN32
419 conf = new QSettings (); 421 conf = new QSettings ();
@@ -436,122 +438,161 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
436#ifndef DESKTOP 438#ifndef DESKTOP
437 conf->setGroup ("zsafe"); 439 conf->setGroup ("zsafe");
438#endif 440#endif
439 441
440 QPixmap copy_img((const char**) copy_xpm); 442 QPixmap copy_img((const char**) copy_xpm);
441 QPixmap cut_img((const char**) cut_xpm); 443 QPixmap cut_img((const char**) cut_xpm);
442 QPixmap edit_img((const char**) edit_xpm); 444 QPixmap edit_img((const char**) edit_xpm);
443 QPixmap editdelete_img((const char**) editdelete_xpm); 445 QPixmap editdelete_img((const char**) editdelete_xpm);
444 QPixmap find_img((const char**) find_xpm); 446 QPixmap find_img((const char**) find_xpm);
445 QPixmap folder_open_img((const char**) folder_open_xpm); 447 QPixmap folder_open_img((const char**) folder_open_xpm);
446 QPixmap help_icon_img((const char**) help_icon_xpm); 448 QPixmap help_icon_img((const char**) help_icon_xpm);
447 QPixmap new_img((const char**) new_xpm); 449 QPixmap new_img((const char**) new_xpm);
448 QPixmap paste_img((const char**) paste_xpm); 450 QPixmap paste_img((const char**) paste_xpm);
449 QPixmap quit_icon_img((const char**) quit_icon_xpm); 451 QPixmap quit_icon_img((const char**) quit_icon_xpm);
450 QPixmap save_img((const char**) save_xpm); 452 QPixmap save_img((const char**) save_xpm);
451 QPixmap trash_img((const char**) trash_xpm); 453 QPixmap trash_img((const char**) trash_xpm);
452 QPixmap expand_img((const char**) expand_xpm); 454 QPixmap expand_img((const char**) expand_xpm);
453 QPixmap export_img((const char**) export_xpm); 455 QPixmap export_img((const char**) export_xpm);
454 QPixmap import_img((const char**) import_xpm); 456 QPixmap import_img((const char**) import_xpm);
455 457
456 QPixmap bank_cards( ( const char** ) bank_cards_data ); 458 QPixmap bank_cards( ( const char** ) bank_cards_data );
457 QPixmap passwords( ( const char** ) passwords_data ); 459 QPixmap passwords( ( const char** ) passwords_data );
458 QPixmap software( ( const char** ) software_data ); 460 QPixmap software( ( const char** ) software_data );
459 QPixmap general( ( const char** ) general_data ); 461 QPixmap general( ( const char** ) general_data );
460 if ( !name ) 462 QPixmap image0( ( const char** ) zsafe_xpm );
463 if ( !name )
461 setName( "ZSafe" ); 464 setName( "ZSafe" );
462 465
463#ifdef DESKTOP 466#ifdef DESKTOP
464#ifdef WIN32 467#ifdef WIN32
465 setGeometry(100, 150, DeskW, DeskH-30 ); 468 setGeometry(100, 150, DeskW, DeskH-30 );
466#else 469#else
467 resize( DeskW, DeskH-30 ); 470 resize( DeskW, DeskH-30 );
468#endif 471#endif
469 472
470#else 473#else
471 474
472#ifdef JPATCH_HDE 475#ifdef JPATCH_HDE
473 int DeskS; 476 int DeskS;
474 if(DeskW > DeskH) 477 if(DeskW > DeskH)
475 { 478 {
476 DeskS = DeskW; 479 DeskS = DeskW;
477 } 480 }
478 else 481 else
479 { 482 {
480 DeskS = DeskH; 483 DeskS = DeskH;
481 } 484 }
482 resize( DeskW, DeskH ); 485 resize( DeskW, DeskH );
483 setMinimumSize( QSize( DeskS, DeskS ) ); 486 setMinimumSize( QSize( DeskS, DeskS ) );
484 setMaximumSize( QSize( DeskS, DeskS ) ); 487 setMaximumSize( QSize( DeskS, DeskS ) );
485#else 488#else
486 resize( DeskW, DeskH-30 ); 489 resize( DeskW, DeskH-30 );
487#endif 490#endif
488 491
489#endif 492#endif
490 setCaption( tr( "ZSafe" ) ); 493 setCaption( tr( "ZSafe" ) );
491 QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe"; 494 QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe";
492 QString filename = conf->readEntry(APP_KEY+"document"); 495 QString filename = conf->readEntry(APP_KEY+"document");
493 if (filename.isEmpty() || filename.isNull()) 496 if (filename.isEmpty() || filename.isNull())
494 { 497 {
495 if ( !QDir( zsafeAppDirPath ).exists() ) 498
499 // check if the directory application exists, if not
500 // create it
501// #ifndef WIN32
502 // QString d1("Documents/application");
503// #else
504 QString d1(QDir::homeDirPath() + "/Documents/application");
505// #endif
506 QDir pd1(d1);
507 if (!pd1.exists())
508 {
509
510 QDir pd2(QDir::homeDirPath() + "/Documents");
511 if (!pd2.exists()) {
512 QDir pd3(QDir::homeDirPath());
513 if (!pd3.mkdir("Documents", FALSE)) {
514 }
515 }
516
517 if (!pd2.mkdir("application", FALSE))
496 { 518 {
497 //FIXME: Pending someone to look into why QDir.mkdir does not work as expected 519 QMessageBox::critical( 0, tr("ZSafe"),
498 QString cmdline = QString().sprintf( "mkdir -p %s", (const char*) zsafeAppDirPath ); 520#ifdef JPATCH_HDE
499 ::system( cmdline ); 521 tr("<P>Can't create directory ..."+d1+"</P><P>ZSafe will now exit.</P>"));
522#else
523 tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d1));
524#endif
525 exitZs (1);
500 } 526 }
501 if ( !QDir( zsafeAppDirPath ).exists() ) 527 }
528// #ifndef WIN32
529 // QString d2("Documents/application/zsafe");
530// #else
531 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
532// #endif
533 QDir pd2(d2);
534 if (!pd2.exists())
535 {
536 if (!pd1.mkdir("zsafe", FALSE))
502 { 537 {
503 QMessageBox::critical( 0, "ZSafe", tr("Can't create application data directory.\nZSafe will now exit.")); 538 QMessageBox::critical( 0, tr("ZSafe"),
504 exitZs (1); 539#ifdef JPATCH_HDE
540 tr("<P>Can't create directory ...//Documents/application/zsafe</P><P>ZSafe will now exit.</P"));
541#else
542 tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d2));
543#endif
544 exitZs (1);
505 } 545 }
506 } 546 }
507 547
508 // set the default filename 548 // set the default filename
509 filename = zsafeAppDirPath + "/passwords.zsf"; 549 filename = zsafeAppDirPath + "/passwords.zsf";
510 550
511 // save the current filename to the config file 551 // save the current filename to the config file
512 conf->writeEntry(APP_KEY+"document", filename); 552 conf->writeEntry(APP_KEY+"document", filename);
513 saveConf(); 553 saveConf();
514 554 }
515 //if (filename == "INVALIDPWD") 555 //if (filename == "INVALIDPWD")
516 //filename = ""; 556 //filename = "";
517 557
518 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 558 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
519#ifdef WIN32 559#ifdef WIN32
520 this->setCaption("Qt ZSafe: " + ti); 560 this->setCaption("Qt ZSafe: " + ti);
521#else 561#else
522 this->setCaption("ZSafe: " + ti); 562 this->setCaption("ZSafe: " + ti);
523#endif 563#endif
524 564
525 selectedItem = NULL; 565 selectedItem = NULL;
526 lastSearchedCategory = NULL; 566 lastSearchedCategory = NULL;
527 lastSearchedItem = NULL; 567 lastSearchedItem = NULL;
528 lastSearchedName = ""; 568 lastSearchedName = "";
529 lastSearchedUsername = ""; 569 lastSearchedUsername = "";
530 lastSearchedComment = ""; 570 lastSearchedComment = "";
531 571
532 infoForm = new InfoForm(); 572 infoForm = new InfoForm();
533 categoryDialog = NULL; 573 categoryDialog = NULL;
574 infoForm->setIcon( image0);
534 575
535 // add a menu bar 576 // add a menu bar
536 QMenuBar *menu = new QMenuBar( this ); 577 QMenuBar *menu = new QMenuBar( this );
537 578
538 // add file menu 579 // add file menu
539 // QPopupMenu *file = new QPopupMenu( this ); 580 // QPopupMenu *file = new QPopupMenu( this );
540 file = new QPopupMenu( this ); 581 file = new QPopupMenu( this );
541 582
542// #ifdef DESKTOP 583// #ifdef DESKTOP
543 file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) ); 584 file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) );
544 file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) ); 585 file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) );
545 file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) ); 586 file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) );
546 file->insertSeparator(); 587 file->insertSeparator();
547// #endif 588// #endif
548 589
549 file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) ); 590 file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) );
550 file->insertItem( save_img, tr("S&ave document with new Password"), this, 591 file->insertItem( save_img, tr("S&ave document with new Password"), this,
551 SLOT(saveDocumentWithPwd()) ); 592 SLOT(saveDocumentWithPwd()) );
552 file->insertSeparator(); 593 file->insertSeparator();
553 file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) ); 594 file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) );
554 file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) ); 595 file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) );
555 file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) ); 596 file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) );
556 file->insertSeparator(); 597 file->insertSeparator();
557 file->insertItem( expand_img, tr("&Open entries expanded"), this, 598 file->insertItem( expand_img, tr("&Open entries expanded"), this,
@@ -645,48 +686,55 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
645#ifndef DESKTOP 686#ifndef DESKTOP
646 // start a timer (100 ms) to load the default document 687 // start a timer (100 ms) to load the default document
647 docuTimer.start( 100, true ); 688 docuTimer.start( 100, true );
648 connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) ); 689 connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) );
649 raiseFlag = true; 690 raiseFlag = true;
650 connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) ); 691 connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) );
651#else 692#else
652 // open the default document 693 // open the default document
653 openDocument(filename); 694 openDocument(filename);
654#endif 695#endif
655 696
656 // signals and slots connections for QTollButton 697 // signals and slots connections for QTollButton
657 connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) ); 698 connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) );
658 connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) ); 699 connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) );
659 connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) ); 700 connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) );
660 connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) ); 701 connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) );
661 // signals and slots connections for QListView 702 // signals and slots connections for QListView
662 connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), 703 connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ),
663 this, SLOT( listViewSelected(QListViewItem*) ) ); 704 this, SLOT( listViewSelected(QListViewItem*) ) );
664 connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), 705 connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ),
665 this, SLOT( showInfo(QListViewItem*) ) ); 706 this, SLOT( showInfo(QListViewItem*) ) );
666 connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), 707 connect( ListView, SIGNAL( returnPressed(QListViewItem*) ),
667 this, SLOT( showInfo(QListViewItem*) ) ); 708 this, SLOT( showInfo(QListViewItem*) ) );
668 709
710 #ifndef DESKTOP
711 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold);
712#endif
713 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
714 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
715
716 this->setIcon( image0);
669} 717}
670 718
671const QColor *ZSafe::evenRowColor = &Qt::white; 719const QColor *ZSafe::evenRowColor = &Qt::white;
672// const QColor *ZSafe::oddRowColor = &Qt::lightGray; 720// const QColor *ZSafe::oddRowColor = &Qt::lightGray;
673const QColor *ZSafe::oddRowColor = new QColor(216,240,255); 721const QColor *ZSafe::oddRowColor = new QColor(216,240,255);
674 722
675/* 723/*
676 * Destroys the object and frees any allocated resources 724 * Destroys the object and frees any allocated resources
677 */ 725 */
678ZSafe::~ZSafe() 726ZSafe::~ZSafe()
679{ 727{
680 // no need to delete child widgets, Qt does it all for us 728 // no need to delete child widgets, Qt does it all for us
681 quitMe(); 729 quitMe();
682} 730}
683 731
684// load the default document 732// load the default document
685void ZSafe::slotLoadDocu() 733void ZSafe::slotLoadDocu()
686{ 734{
687 openDocument (filename); 735 openDocument (filename);
688} 736}
689 737
690void ZSafe::deletePwd() 738void ZSafe::deletePwd()
691{ 739{
692 740
@@ -1495,49 +1543,49 @@ void ZSafe::readAllEntries()
1495 item->setText( 0, tr( name ) ); 1543 item->setText( 0, tr( name ) );
1496 item->setText( 1, tr( user ) ); 1544 item->setText( 1, tr( user ) );
1497 item->setText( 2, tr( password ) ); 1545 item->setText( 2, tr( password ) );
1498 item->setText( 3, tr( comment ) ); 1546 item->setText( 3, tr( comment ) );
1499 item->setText( 4, tr( field5 ) ); 1547 item->setText( 4, tr( field5 ) );
1500 item->setText( 5, tr( field6 ) ); 1548 item->setText( 5, tr( field6 ) );
1501 1549
1502 catI->setOpen( TRUE ); 1550 catI->setOpen( TRUE );
1503 1551
1504 Category *c1 = new Category(); 1552 Category *c1 = new Category();
1505 c1->setCategoryName(category); 1553 c1->setCategoryName(category);
1506 1554
1507 QString icon; 1555 QString icon;
1508 QString fullIconPath; 1556 QString fullIconPath;
1509 QPixmap *pix; 1557 QPixmap *pix;
1510// #ifndef WIN32 1558// #ifndef WIN32
1511 icon = conf->readEntry(APP_KEY+category); 1559 icon = conf->readEntry(APP_KEY+category);
1512// #endif 1560// #endif
1513 bool isIconAv = false; 1561 bool isIconAv = false;
1514 if (!icon.isEmpty() && !icon.isNull()) 1562 if (!icon.isEmpty() && !icon.isNull())
1515 { 1563 {
1516 // build the full path 1564 // build the full path
1517 fullIconPath = iconPath + icon; 1565 fullIconPath = iconPath + icon;
1518 pix = new QPixmap (fullIconPath); 1566 pix = new QPixmap (fullIconPath);
1519 if (pix) 1567 if (!pix->isNull())
1520 { 1568 {
1521 QImage img = pix->convertToImage(); 1569 QImage img = pix->convertToImage();
1522 pix->convertFromImage(img.smoothScale(14,14)); 1570 pix->convertFromImage(img.smoothScale(14,14));
1523 c1->setIconName (icon); 1571 c1->setIconName (icon);
1524 c1->setIcon (*pix); 1572 c1->setIcon (*pix);
1525 isIconAv = true; 1573 isIconAv = true;
1526 } 1574 }
1527 } 1575 }
1528 if (!isIconAv) 1576 if (!isIconAv)
1529 { 1577 {
1530 c1->setIcon (*getPredefinedIcon(category)); 1578 c1->setIcon (*getPredefinedIcon(category));
1531 } 1579 }
1532 c1->setListItem (catI); 1580 c1->setListItem (catI);
1533 c1->initListItem(); 1581 c1->initListItem();
1534 categories.insert (c1->getCategoryName(), c1); 1582 categories.insert (c1->getCategoryName(), c1);
1535 } 1583 }
1536 1584
1537 } 1585 }
1538 f.close(); 1586 f.close();
1539 1587
1540 } 1588 }
1541 else 1589 else
1542 { 1590 {
1543 } 1591 }
@@ -1710,103 +1758,106 @@ void ZSafe::readAllEntries()
1710 // create and insert a new item 1758 // create and insert a new item
1711 QListViewItem * item = new ShadedListItem( 0, catI ); 1759 QListViewItem * item = new ShadedListItem( 0, catI );
1712 item->setText( 0, tr( name ) ); 1760 item->setText( 0, tr( name ) );
1713 item->setText( 1, tr( user ) ); 1761 item->setText( 1, tr( user ) );
1714 item->setText( 2, tr( password ) ); 1762 item->setText( 2, tr( password ) );
1715 item->setText( 3, tr( comment ) ); 1763 item->setText( 3, tr( comment ) );
1716 1764
1717 catI->setOpen( TRUE ); 1765 catI->setOpen( TRUE );
1718 1766
1719 Category *c1 = new Category(); 1767 Category *c1 = new Category();
1720 c1->setCategoryName(category); 1768 c1->setCategoryName(category);
1721 1769
1722 QString icon; 1770 QString icon;
1723 QString fullIconPath; 1771 QString fullIconPath;
1724 QPixmap *pix; 1772 QPixmap *pix;
1725// #ifndef WIN32 1773// #ifndef WIN32
1726 icon = conf->readEntry(APP_KEY+category); 1774 icon = conf->readEntry(APP_KEY+category);
1727// #endif 1775// #endif
1728 bool isIconAv = false; 1776 bool isIconAv = false;
1729 if (!icon.isEmpty() && !icon.isNull()) 1777 if (!icon.isEmpty() && !icon.isNull())
1730 { 1778 {
1731 // build the full path 1779 // build the full path
1732 fullIconPath = iconPath + icon; 1780 fullIconPath = iconPath + icon;
1733 pix = new QPixmap (fullIconPath); 1781 pix = new QPixmap (fullIconPath);
1734 if (pix) 1782 if (!pix->isNull())
1735 { 1783 {
1736 QImage img = pix->convertToImage(); 1784 QImage img = pix->convertToImage();
1737 pix->convertFromImage(img.smoothScale(14,14)); 1785 pix->convertFromImage(img.smoothScale(14,14));
1738 c1->setIconName (icon); 1786 c1->setIconName (icon);
1739 c1->setIcon (*pix); 1787 c1->setIcon (*pix);
1740 isIconAv = true; 1788 isIconAv = true;
1741 } 1789 }
1742 } 1790 }
1743 if (!isIconAv) 1791 if (!isIconAv)
1744 { 1792 {
1745 c1->setIcon (*getPredefinedIcon(category)); 1793 c1->setIcon (*getPredefinedIcon(category));
1746 } 1794 }
1747 c1->setListItem (catI); 1795 c1->setListItem (catI);
1748 c1->initListItem(); 1796 c1->initListItem();
1749 categories.insert (c1->getCategoryName(), c1); 1797 categories.insert (c1->getCategoryName(), c1);
1750 } 1798 }
1751 1799
1752 } 1800 }
1753 f.close(); 1801 f.close();
1754 1802
1755} 1803}
1756#endif // UNUSED 1804#endif // UNUSED
1757 1805
1758void ZSafe::resume(int) 1806void ZSafe::resume(int)
1759{ 1807{
1760 owarn << "Resume" << oendl; 1808 owarn << "Resume" << oendl;
1761 // hide the main window 1809 // hide the main window
1762 1810
1811 if ( !showpwd )
1812 {
1763 infoForm->hide(); 1813 infoForm->hide();
1764 // open zsafe again 1814 // open zsafe again
1765 m_password = ""; 1815 m_password = "";
1766 selectedItem = NULL; 1816 selectedItem = NULL;
1767 1817
1768 // clear the password list 1818 // clear the password list
1769 QListViewItem *i; 1819 QListViewItem *i;
1770 // step through all categories 1820 // step through all categories
1771 for (i = ListView->firstChild(); 1821 for (i = ListView->firstChild();
1772 i != NULL; 1822 i != NULL;
1773 i = i->nextSibling()) 1823 i = i->nextSibling())
1774 { 1824 {
1775 // step through all subitems 1825 // step through all subitems
1776 QListViewItem *si; 1826 QListViewItem *si;
1777 for (si = i->firstChild(); 1827 for (si = i->firstChild();
1778 si != NULL; ) 1828 si != NULL; )
1779 { 1829 {
1780 QListViewItem *_si = si; 1830 QListViewItem *_si = si;
1781 si = si->nextSibling(); 1831 si = si->nextSibling();
1782 i->takeItem(_si); // remove from view list 1832 i->takeItem(_si); // remove from view list
1783 if (_si) delete _si; 1833 if (_si) delete _si;
1784 } 1834 }
1785 } 1835 }
1786 1836
1787 // ask for password and read again 1837 // ask for password and read again
1788 openDocument(filename); 1838 openDocument(filename);
1839 }
1789} 1840}
1790 1841
1791//--------------------------------------------- 1842//---------------------------------------------
1792 1843
1793 1844
1794bool ZSafe::openDocument(const char* _filename, const char* ) 1845bool ZSafe::openDocument(const char* _filename, const char* )
1795{ 1846{
1796 int retval; 1847 int retval;
1797 char* entry[FIELD_SIZE]; 1848 char* entry[FIELD_SIZE];
1798// #ifndef WIN32 1849// #ifndef WIN32
1799 int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1); 1850 int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1);
1800// #else 1851// #else
1801 // int validationFlag = 1; 1852 // int validationFlag = 1;
1802// #endif 1853// #endif
1803 1854
1804 int pwdOk = 0; 1855 int pwdOk = 0;
1805 int numberOfTries = 3; 1856 int numberOfTries = 3;
1806 for (int i=0; i < numberOfTries; i++) 1857 for (int i=0; i < numberOfTries; i++)
1807 { 1858 {
1808 QFile f(_filename); 1859 QFile f(_filename);
1809 if (f.exists()) 1860 if (f.exists())
1810 { 1861 {
1811 // ask with a dialog for the password 1862 // ask with a dialog for the password
1812 if (m_password.isEmpty()) 1863 if (m_password.isEmpty())
@@ -1933,49 +1984,49 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1933 item->setText( 1, tr( user ) ); 1984 item->setText( 1, tr( user ) );
1934 item->setText( 2, tr( password ) ); 1985 item->setText( 2, tr( password ) );
1935 item->setText( 3, tr( comment ) ); 1986 item->setText( 3, tr( comment ) );
1936 item->setText( 4, tr( field5 ) ); 1987 item->setText( 4, tr( field5 ) );
1937 item->setText( 5, tr( field6 ) ); 1988 item->setText( 5, tr( field6 ) );
1938 1989
1939 if (expandTree) 1990 if (expandTree)
1940 catI->setOpen( TRUE ); 1991 catI->setOpen( TRUE );
1941 1992
1942 Category *c1 = new Category(); 1993 Category *c1 = new Category();
1943 c1->setCategoryName(category); 1994 c1->setCategoryName(category);
1944 1995
1945 QString icon; 1996 QString icon;
1946 QString fullIconPath; 1997 QString fullIconPath;
1947 QPixmap *pix; 1998 QPixmap *pix;
1948// #ifndef WIN32 1999// #ifndef WIN32
1949 icon = conf->readEntry(APP_KEY+category); 2000 icon = conf->readEntry(APP_KEY+category);
1950// #endif 2001// #endif
1951 bool isIconAv = false; 2002 bool isIconAv = false;
1952 if (!icon.isEmpty() && !icon.isNull()) 2003 if (!icon.isEmpty() && !icon.isNull())
1953 { 2004 {
1954 // build the full path 2005 // build the full path
1955 fullIconPath = iconPath + icon; 2006 fullIconPath = iconPath + icon;
1956 pix = new QPixmap (fullIconPath); 2007 pix = new QPixmap (fullIconPath);
1957 if (pix) 2008 if (!pix->isNull())
1958 { 2009 {
1959 QImage img = pix->convertToImage(); 2010 QImage img = pix->convertToImage();
1960 pix->convertFromImage(img.smoothScale(14,14)); 2011 pix->convertFromImage(img.smoothScale(14,14));
1961 c1->setIconName (icon); 2012 c1->setIconName (icon);
1962 c1->setIcon (*pix); 2013 c1->setIcon (*pix);
1963 isIconAv = true; 2014 isIconAv = true;
1964 } 2015 }
1965 } 2016 }
1966 if (!isIconAv) 2017 if (!isIconAv)
1967 { 2018 {
1968 c1->setIcon (*getPredefinedIcon(category)); 2019 c1->setIcon (*getPredefinedIcon(category));
1969 } 2020 }
1970 2021
1971 c1->setListItem (catI); 2022 c1->setListItem (catI);
1972 c1->initListItem(); 2023 c1->initListItem();
1973 categories.insert (c1->getCategoryName(), c1); 2024 categories.insert (c1->getCategoryName(), c1);
1974 numberOfEntries++; 2025 numberOfEntries++;
1975 } 2026 }
1976 2027
1977 for (int count = 0; count < FIELD_SIZE; count++) { 2028 for (int count = 0; count < FIELD_SIZE; count++) {
1978 free(entry[count]); 2029 free(entry[count]);
1979 } 2030 }
1980 retval = loadEntry(entry); 2031 retval = loadEntry(entry);
1981 if (retval == 2) { 2032 if (retval == 2) {
@@ -2281,48 +2332,51 @@ bool ZSafe::saveDocument(const char* _filename,
2281#ifndef DESKTOP 2332#ifndef DESKTOP
2282 Global::statusMessage (tr("Password file saved.")); 2333 Global::statusMessage (tr("Password file saved."));
2283#endif 2334#endif
2284 modified = false; 2335 modified = false;
2285 return true; 2336 return true;
2286 } 2337 }
2287} 2338}
2288 2339
2289PasswordForm *newPwdDialog; 2340PasswordForm *newPwdDialog;
2290bool newPwdDialogResult = false; 2341bool newPwdDialogResult = false;
2291void ZSafe::setPasswordDialogDone() 2342void ZSafe::setPasswordDialogDone()
2292{ 2343{
2293 newPwdDialogResult = true; 2344 newPwdDialogResult = true;
2294 newPwdDialog->close(); 2345 newPwdDialog->close();
2295} 2346}
2296 2347
2297void ZSafe::getDocPassword(QString title) 2348void ZSafe::getDocPassword(QString title)
2298{ 2349{
2299 owarn << "getDocPassword" << oendl; 2350 owarn << "getDocPassword" << oendl;
2300 // open the 'Password' dialog 2351 // open the 'Password' dialog
2301 PasswordForm *dialog = new PasswordForm(this, title, TRUE); 2352 PasswordForm *dialog = new PasswordForm(this, title, TRUE);
2302 newPwdDialog = dialog; 2353 newPwdDialog = dialog;
2303 newPwdDialogResult = false; 2354 newPwdDialogResult = false;
2304 2355
2356 QPixmap image0( ( const char** ) zsafe_xpm );
2357 dialog->setIcon( image0);
2358
2305 connect( dialog->PasswordField, SIGNAL( returnPressed() ), 2359 connect( dialog->PasswordField, SIGNAL( returnPressed() ),
2306 this, SLOT( setPasswordDialogDone() ) ); 2360 this, SLOT( setPasswordDialogDone() ) );
2307 2361
2308 // CS: !!! 2362 // CS: !!!
2309 // int pos = filename.findRev ('/'); 2363 // int pos = filename.findRev ('/');
2310 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 2364 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
2311#ifdef WIN32 2365#ifdef WIN32
2312 dialog->setCaption("Qt " + ti); 2366 dialog->setCaption("Qt " + ti);
2313#else 2367#else
2314 dialog->setCaption(ti); 2368 dialog->setCaption(ti);
2315#endif 2369#endif
2316 // dialog->setCaption(title); 2370 // dialog->setCaption(title);
2317 2371
2318 dialog->PasswordField->setFocus(); 2372 dialog->PasswordField->setFocus();
2319 DialogCode result = (DialogCode) dialog->exec(); 2373 DialogCode result = (DialogCode) dialog->exec();
2320#ifdef DESKTOP 2374#ifdef DESKTOP
2321 result = Accepted; 2375 result = Accepted;
2322#endif 2376#endif
2323 2377
2324 QString password; 2378 QString password;
2325 if (result == Accepted || newPwdDialogResult) 2379 if (result == Accepted || newPwdDialogResult)
2326 { 2380 {
2327 m_password = dialog->PasswordField->text(); 2381 m_password = dialog->PasswordField->text();
2328 } 2382 }
@@ -2671,49 +2725,49 @@ void ZSafe::addCategory()
2671 2725
2672 QString category; 2726 QString category;
2673 QString icon; 2727 QString icon;
2674 QString fullIconPath; 2728 QString fullIconPath;
2675 QPixmap *pix; 2729 QPixmap *pix;
2676 if (result == Accepted) 2730 if (result == Accepted)
2677 { 2731 {
2678 modified = true; 2732 modified = true;
2679 category = dialog->CategoryField->currentText(); 2733 category = dialog->CategoryField->currentText();
2680 icon = dialog->IconField->currentText()+".png"; 2734 icon = dialog->IconField->currentText()+".png";
2681 2735
2682 owarn << category << oendl; 2736 owarn << category << oendl;
2683 2737
2684 QListViewItem *li = new ShadedListItem( 1, ListView ); 2738 QListViewItem *li = new ShadedListItem( 1, ListView );
2685 Category *c1 = new Category(); 2739 Category *c1 = new Category();
2686 c1->setCategoryName(category); 2740 c1->setCategoryName(category);
2687 2741
2688 // if (!icon.isEmpty() && !icon.isNull()) 2742 // if (!icon.isEmpty() && !icon.isNull())
2689 if (icon != "predefined.png") 2743 if (icon != "predefined.png")
2690 { 2744 {
2691 // build the full path 2745 // build the full path
2692 fullIconPath = iconPath + icon; 2746 fullIconPath = iconPath + icon;
2693 pix = new QPixmap (fullIconPath); 2747 pix = new QPixmap (fullIconPath);
2694 // pix->resize(14, 14); 2748 // pix->resize(14, 14);
2695 if (pix) 2749 if (!pix->isNull())
2696 { 2750 {
2697 // save the full pixmap name into the config file 2751 // save the full pixmap name into the config file
2698// #ifndef WIN32 2752// #ifndef WIN32
2699 conf->writeEntry(APP_KEY+category, icon); 2753 conf->writeEntry(APP_KEY+category, icon);
2700// #endif 2754// #endif
2701 saveConf(); 2755 saveConf();
2702 QImage img = pix->convertToImage(); 2756 QImage img = pix->convertToImage();
2703 pix->convertFromImage(img.smoothScale(14,14)); 2757 pix->convertFromImage(img.smoothScale(14,14));
2704 c1->setIcon (*pix); 2758 c1->setIcon (*pix);
2705 c1->setIconName(icon); 2759 c1->setIconName(icon);
2706 } 2760 }
2707 else 2761 else
2708 { 2762 {
2709 QPixmap folder( ( const char** ) general_data ); 2763 QPixmap folder( ( const char** ) general_data );
2710 c1->setIcon (folder); 2764 c1->setIcon (folder);
2711 } 2765 }
2712 } 2766 }
2713 else 2767 else
2714 { 2768 {
2715 c1->setIcon (*getPredefinedIcon(category)); 2769 c1->setIcon (*getPredefinedIcon(category));
2716 } 2770 }
2717 2771
2718 c1->setListItem (li); 2772 c1->setListItem (li);
2719 c1->initListItem(); 2773 c1->initListItem();
@@ -3140,49 +3194,49 @@ void ZSafe::editCategory()
3140 { 3194 {
3141 modified = true; 3195 modified = true;
3142 if (category != dialog->CategoryField->currentText()) 3196 if (category != dialog->CategoryField->currentText())
3143 { 3197 {
3144 categories.remove (category); 3198 categories.remove (category);
3145// #ifndef WIN32 3199// #ifndef WIN32
3146 conf->removeEntry(category); 3200 conf->removeEntry(category);
3147// #endif 3201// #endif
3148 saveConf(); 3202 saveConf();
3149 } 3203 }
3150 3204
3151 category = dialog->CategoryField->currentText(); 3205 category = dialog->CategoryField->currentText();
3152 icon = dialog->IconField->currentText()+".png"; 3206 icon = dialog->IconField->currentText()+".png";
3153 3207
3154 if (cat) 3208 if (cat)
3155 { 3209 {
3156 owarn << "Category found" << oendl; 3210 owarn << "Category found" << oendl;
3157 3211
3158 // if (!icon.isEmpty() && !icon.isNull()) 3212 // if (!icon.isEmpty() && !icon.isNull())
3159 if (icon != "predefined.png") 3213 if (icon != "predefined.png")
3160 { 3214 {
3161 // build the full path 3215 // build the full path
3162 fullIconPath = iconPath + icon; 3216 fullIconPath = iconPath + icon;
3163 pix = new QPixmap (fullIconPath); 3217 pix = new QPixmap (fullIconPath);
3164 if (pix) 3218 if (!pix->isNull())
3165 { 3219 {
3166 // save the full pixmap name into the config file 3220 // save the full pixmap name into the config file
3167// #ifndef WIN32 3221// #ifndef WIN32
3168 conf->writeEntry(APP_KEY+category, icon); 3222 conf->writeEntry(APP_KEY+category, icon);
3169// #endif 3223// #endif
3170 saveConf(); 3224 saveConf();
3171 QImage img = pix->convertToImage(); 3225 QImage img = pix->convertToImage();
3172 pix->convertFromImage(img.smoothScale(14,14)); 3226 pix->convertFromImage(img.smoothScale(14,14));
3173 cat->setIconName (icon); 3227 cat->setIconName (icon);
3174 cat->setIcon (*pix); 3228 cat->setIcon (*pix);
3175 } 3229 }
3176 } 3230 }
3177 else 3231 else
3178 { 3232 {
3179// #ifndef WIN32 3233// #ifndef WIN32
3180 conf->removeEntry (category); 3234 conf->removeEntry (category);
3181// #endif 3235// #endif
3182 saveConf(); 3236 saveConf();
3183 cat->setIcon (*getPredefinedIcon(category)); 3237 cat->setIcon (*getPredefinedIcon(category));
3184 } 3238 }
3185 3239
3186 // change the category name of the selected category 3240 // change the category name of the selected category
3187 QListViewItem *catItem = cat->getListItem(); 3241 QListViewItem *catItem = cat->getListItem();
3188 if (catItem) 3242 if (catItem)
@@ -3671,25 +3725,71 @@ void ZSafe::setDocument(const QString& fileref)
3671 3725
3672 c = i; 3726 c = i;
3673 // step through all subitems 3727 // step through all subitems
3674 QListViewItem *si; 3728 QListViewItem *si;
3675 for (si = i->firstChild(); 3729 for (si = i->firstChild();
3676 si != NULL; ) 3730 si != NULL; )
3677 { 3731 {
3678 QListViewItem *_si = si; 3732 QListViewItem *_si = si;
3679 si = si->nextSibling(); 3733 si = si->nextSibling();
3680 i->takeItem(_si); // remove from view list 3734 i->takeItem(_si); // remove from view list
3681 if (_si) delete _si; 3735 if (_si) delete _si;
3682 } 3736 }
3683 } 3737 }
3684 if (c) delete c; // delete the previous category 3738 if (c) delete c; // delete the previous category
3685 categories.clear(); 3739 categories.clear();
3686 3740
3687 m_password = ""; 3741 m_password = "";
3688 selectedItem = NULL; 3742 selectedItem = NULL;
3689 3743
3690 openDocument(filename); 3744 openDocument(filename);
3691#endif 3745#endif
3692} 3746}
3693 3747
3694 3748
3749void ZSafe::ListPressed(int mouse, QListViewItem *item, const QPoint&, int column) {
3750 if(item ==0) return;
3751 switch (mouse) {
3752 case 1:
3753 {
3754#ifdef DESKTOP
3755 QDragObject *d = new QTextDrag( item->text(column) , this );
3756 d->dragCopy();
3757#endif
3758 }
3759 break;
3760 case 2:
3761 {
3762 QClipboard *cb = QApplication::clipboard();
3763
3764 QIconSet copy_img((const char**) copy_xpm);
3765 QIconSet edit_img((const char**) edit_xpm);
3766 QPixmap folder_open_img((const char**) folder_open_xpm);
3767 QPixmap editdelete_img((const char**) editdelete_xpm);
3768
3769 QPopupMenu *m = new QPopupMenu(this);
3770 int copyItem = m->insertItem( copy_img, tr( "Copy to Clipboard" ));
3771 int editItem = m->insertItem(edit_img, tr( "Edit" ));
3772 int showItem = m->insertItem(folder_open_img, tr( "Show Info" ));
3773 int cancelItem = m->insertItem( editdelete_img, tr( "Cancel" ));
3774 m->setFocus();
3775 int me=m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y() ) ) ;
3776 if(me == copyItem) {
3777 copyClip( item->text(column) ) ;
3778 } else if (me == cancelItem) {
3779 cb->clear();
3780 } else if (me == editItem) {
3781 editPwd();
3782 } else if (me == showItem) {
3783 showInfo(item);
3784 }
3785 }
3786 break;
3787 };
3788}
3789
3790void ZSafe::copyClip( const QString &text) {
3791 QClipboard *cb = QApplication::clipboard();
3792 cb->setText( text);
3793}
3794
3695 3795
diff --git a/noncore/apps/zsafe/zsafe.h b/noncore/apps/zsafe/zsafe.h
index eef5cdc..ca041ff 100644
--- a/noncore/apps/zsafe/zsafe.h
+++ b/noncore/apps/zsafe/zsafe.h
@@ -40,68 +40,69 @@ class QSettings;
40#else 40#else
41class Config; 41class Config;
42#endif 42#endif
43class CategoryDialog; 43class CategoryDialog;
44class QPixmap; 44class QPixmap;
45 45
46// number of fields for one entry 46// number of fields for one entry
47#define FIELD_SIZE 7 47#define FIELD_SIZE 7
48 48
49class ZSafe : public QDialog 49class ZSafe : public QDialog
50{ 50{
51 Q_OBJECT 51 Q_OBJECT
52 52
53protected: 53protected:
54 void paintEvent( QPaintEvent * e ); 54 void paintEvent( QPaintEvent * e );
55 void resizeEvent ( QResizeEvent * ); 55 void resizeEvent ( QResizeEvent * );
56 56
57 bool raiseFlag; 57 bool raiseFlag;
58 QTimer raiseTimer; 58 QTimer raiseTimer;
59 59
60public: 60public:
61 ZSafe( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = WDestructiveClose ); 61 ZSafe( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = WDestructiveClose );
62 ~ZSafe(); 62 ~ZSafe();
63 63
64 static const QColor *evenRowColor; 64 static const QColor *evenRowColor;
65 static const QColor *oddRowColor; 65 static const QColor *oddRowColor;
66 66
67 QToolButton* Edit; 67 QToolButton* Edit;
68 QToolButton* Delete; 68 QToolButton* Delete;
69 QToolButton* Find; 69 QToolButton* Find;
70 QToolButton* New; 70 QToolButton* New;
71 ZListView* ListView; 71 ZListView* ListView;
72 72
73 QString cfgFile; 73 QString cfgFile;
74 QString iconPath; 74 QString iconPath;
75 75
76 InfoForm *infoForm; 76 InfoForm *infoForm;
77 CategoryDialog *categoryDialog; 77 CategoryDialog *categoryDialog;
78 78
79 QListViewItem *selectedItem; // current selected item 79 QListViewItem *selectedItem; // current selected item
80 QListViewItem *copiedItem; // copied item 80 QListViewItem *copiedItem; // copied item
81 bool IsCopy; 81 bool IsCopy;
82 bool IsCut; 82 bool IsCut;
83 bool modified; // true if database is modified 83 bool modified; // true if database is modified
84 bool showpwd; // show PWD Dialog
84 85
85 QListViewItem *lastSearchedCategory; 86 QListViewItem *lastSearchedCategory;
86 QListViewItem *lastSearchedItem; 87 QListViewItem *lastSearchedItem;
87 QString lastSearchedName; 88 QString lastSearchedName;
88 QString lastSearchedUsername; 89 QString lastSearchedUsername;
89 QString lastSearchedComment; 90 QString lastSearchedComment;
90 91
91 92
92 CategoryList categories; // list of categories 93 CategoryList categories; // list of categories
93 94
94 bool isCategory(QListViewItem *_item); 95 bool isCategory(QListViewItem *_item);
95 void getDocPassword(QString title); 96 void getDocPassword(QString title);
96 QString filename; 97 QString filename;
97 98
98 enum { 99 enum {
99 PWERR_GOOD, // success 100 PWERR_GOOD, // success
100 PWERR_OPEN, // can't open filedescriptor / can't create file 101 PWERR_OPEN, // can't open filedescriptor / can't create file
101 PWERR_PERM, // permissions are bad 102 PWERR_PERM, // permissions are bad
102 PWERR_SYML, // is a symlink 103 PWERR_SYML, // is a symlink
103 PWERR_STAT, // can't get file status 104 PWERR_STAT, // can't get file status
104 PWERR_DATA // can't read correct data 105 PWERR_DATA // can't read correct data
105 }; 106 };
106 107
107 long load_buffer_length; 108 long load_buffer_length;
@@ -162,32 +163,35 @@ public slots:
162 virtual void listViewSelected( QListViewItem *_item); 163 virtual void listViewSelected( QListViewItem *_item);
163 virtual void showInfo( QListViewItem *_item); 164 virtual void showInfo( QListViewItem *_item);
164 virtual void writeAllEntries(); 165 virtual void writeAllEntries();
165 virtual void readAllEntries(); 166 virtual void readAllEntries();
166 virtual void removeAsciiFile(); 167 virtual void removeAsciiFile();
167 virtual void setPasswordDialogDone(); 168 virtual void setPasswordDialogDone();
168 169
169 virtual void addCategory(); 170 virtual void addCategory();
170 virtual void delCategory(); 171 virtual void delCategory();
171 virtual void editCategory(); 172 virtual void editCategory();
172 virtual void cutItem(); 173 virtual void cutItem();
173 virtual void copyItem(); 174 virtual void copyItem();
174 virtual void pasteItem(); 175 virtual void pasteItem();
175 176
176 virtual void newDocument(); 177 virtual void newDocument();
177 virtual void loadDocument(); 178 virtual void loadDocument();
178 virtual void saveDocumentAs(); 179 virtual void saveDocumentAs();
179 virtual void saveDocumentWithoutPwd(); 180 virtual void saveDocumentWithoutPwd();
180 virtual void saveDocumentWithPwd(); 181 virtual void saveDocumentWithPwd();
181 virtual void about(); 182 virtual void about();
182 virtual void setExpandFlag(); 183 virtual void setExpandFlag();
183 184
184 virtual void categoryFieldActivated( const QString& str); 185 virtual void categoryFieldActivated( const QString& str);
185 186
187 virtual void ListPressed(int, QListViewItem *, const QPoint&, int);
188 virtual void copyClip( const QString &text);
189
186private slots: 190private slots:
187 void setDocument(const QString& fileref); 191 void setDocument(const QString& fileref);
188 void slotLoadDocu(); 192 void slotLoadDocu();
189 void slotRaiseTimer(); 193 void slotRaiseTimer();
190 194
191}; 195};
192 196
193#endif // ZSAFE_H 197#endif // ZSAFE_H