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
@@ -56,2 +56,3 @@ using namespace Opie::Ui;
56#include <qfiledialog.h> 56#include <qfiledialog.h>
57#include <qdragobject.h>
57#ifndef WIN32 58#ifndef WIN32
@@ -395,2 +396,3 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
395 modified = false; 396 modified = false;
397 showpwd = false;
396 398
@@ -459,3 +461,4 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
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" );
@@ -494,15 +497,52 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
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
@@ -513,3 +553,3 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
513 saveConf(); 553 saveConf();
514 554 }
515 //if (filename == "INVALIDPWD") 555 //if (filename == "INVALIDPWD")
@@ -533,2 +573,3 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
533 categoryDialog = NULL; 573 categoryDialog = NULL;
574 infoForm->setIcon( image0);
534 575
@@ -668,2 +709,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
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}
@@ -1518,3 +1566,3 @@ void ZSafe::readAllEntries()
1518 pix = new QPixmap (fullIconPath); 1566 pix = new QPixmap (fullIconPath);
1519 if (pix) 1567 if (!pix->isNull())
1520 { 1568 {
@@ -1733,3 +1781,3 @@ void ZSafe::readAllEntries()
1733 pix = new QPixmap (fullIconPath); 1781 pix = new QPixmap (fullIconPath);
1734 if (pix) 1782 if (!pix->isNull())
1735 { 1783 {
@@ -1762,2 +1810,4 @@ void ZSafe::resume(int)
1762 1810
1811 if ( !showpwd )
1812 {
1763 infoForm->hide(); 1813 infoForm->hide();
@@ -1788,2 +1838,3 @@ void ZSafe::resume(int)
1788 openDocument(filename); 1838 openDocument(filename);
1839 }
1789} 1840}
@@ -1956,3 +2007,3 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1956 pix = new QPixmap (fullIconPath); 2007 pix = new QPixmap (fullIconPath);
1957 if (pix) 2008 if (!pix->isNull())
1958 { 2009 {
@@ -2304,2 +2355,5 @@ void ZSafe::getDocPassword(QString title)
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() ),
@@ -2694,3 +2748,3 @@ void ZSafe::addCategory()
2694 // pix->resize(14, 14); 2748 // pix->resize(14, 14);
2695 if (pix) 2749 if (!pix->isNull())
2696 { 2750 {
@@ -3163,3 +3217,3 @@ void ZSafe::editCategory()
3163 pix = new QPixmap (fullIconPath); 3217 pix = new QPixmap (fullIconPath);
3164 if (pix) 3218 if (!pix->isNull())
3165 { 3219 {
@@ -3694,2 +3748,48 @@ void ZSafe::setDocument(const QString& fileref)
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
@@ -63,4 +63,4 @@ public:
63 63
64 static const QColor *evenRowColor; 64 static const QColor *evenRowColor;
65 static const QColor *oddRowColor; 65 static const QColor *oddRowColor;
66 66
@@ -83,2 +83,3 @@ public:
83 bool modified; // true if database is modified 83 bool modified; // true if database is modified
84 bool showpwd; // show PWD Dialog
84 85
@@ -185,2 +186,5 @@ public slots:
185 186
187 virtual void ListPressed(int, QListViewItem *, const QPoint&, int);
188 virtual void copyClip( const QString &text);
189
186private slots: 190private slots: