From f16bf63fc655c1e85fed6ce96c464553b260f796 Mon Sep 17 00:00:00 2001
From: llornkcor Can't create directory ..."+d1+" ZSafe will now exit. Can't create directory %1 ZSafe will now exit. Can't create directory ...//Documents/application/zsafe ZSafe will now exit.
ZSafe will now exit.
").arg(d2)); +#endif + exitZs (1); } - } - + } + // set the default filename filename = zsafeAppDirPath + "/passwords.zsf"; // save the current filename to the config file conf->writeEntry(APP_KEY+"document", filename); saveConf(); - + } //if (filename == "INVALIDPWD") //filename = ""; @@ -531,6 +571,7 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) infoForm = new InfoForm(); categoryDialog = NULL; + infoForm->setIcon( image0); // add a menu bar QMenuBar *menu = new QMenuBar( this ); @@ -666,6 +707,13 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( showInfo(QListViewItem*) ) ); +#ifndef DESKTOP + QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); +#endif + connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), + this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); + + this->setIcon( image0); } const QColor *ZSafe::evenRowColor = &Qt::white; @@ -1516,7 +1564,7 @@ void ZSafe::readAllEntries() // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); - if (pix) + if (!pix->isNull()) { QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); @@ -1731,7 +1779,7 @@ void ZSafe::readAllEntries() // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); - if (pix) + if (!pix->isNull()) { QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); @@ -1760,6 +1808,8 @@ void ZSafe::resume(int) owarn << "Resume" << oendl; // hide the main window + if ( !showpwd ) + { infoForm->hide(); // open zsafe again m_password = ""; @@ -1786,6 +1836,7 @@ void ZSafe::resume(int) // ask for password and read again openDocument(filename); + } } //--------------------------------------------- @@ -1954,7 +2005,7 @@ bool ZSafe::openDocument(const char* _filename, const char* ) // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); - if (pix) + if (!pix->isNull()) { QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); @@ -2302,6 +2353,9 @@ void ZSafe::getDocPassword(QString title) newPwdDialog = dialog; newPwdDialogResult = false; + QPixmap image0( ( const char** ) zsafe_xpm ); + dialog->setIcon( image0); + connect( dialog->PasswordField, SIGNAL( returnPressed() ), this, SLOT( setPasswordDialogDone() ) ); @@ -2692,7 +2746,7 @@ void ZSafe::addCategory() fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); // pix->resize(14, 14); - if (pix) + if (!pix->isNull()) { // save the full pixmap name into the config file // #ifndef WIN32 @@ -3161,7 +3215,7 @@ void ZSafe::editCategory() // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); - if (pix) + if (!pix->isNull()) { // save the full pixmap name into the config file // #ifndef WIN32 @@ -3692,4 +3746,50 @@ void ZSafe::setDocument(const QString& fileref) } +void ZSafe::ListPressed(int mouse, QListViewItem *item, const QPoint&, int column) { + if(item ==0) return; + switch (mouse) { + case 1: + { +#ifdef DESKTOP + QDragObject *d = new QTextDrag( item->text(column) , this ); + d->dragCopy(); +#endif + } + break; + case 2: + { + QClipboard *cb = QApplication::clipboard(); + + QIconSet copy_img((const char**) copy_xpm); + QIconSet edit_img((const char**) edit_xpm); + QPixmap folder_open_img((const char**) folder_open_xpm); + QPixmap editdelete_img((const char**) editdelete_xpm); + + QPopupMenu *m = new QPopupMenu(this); + int copyItem = m->insertItem( copy_img, tr( "Copy to Clipboard" )); + int editItem = m->insertItem(edit_img, tr( "Edit" )); + int showItem = m->insertItem(folder_open_img, tr( "Show Info" )); + int cancelItem = m->insertItem( editdelete_img, tr( "Cancel" )); + m->setFocus(); + int me=m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y() ) ) ; + if(me == copyItem) { + copyClip( item->text(column) ) ; + } else if (me == cancelItem) { + cb->clear(); + } else if (me == editItem) { + editPwd(); + } else if (me == showItem) { + showInfo(item); + } + } + break; + }; +} + +void ZSafe::copyClip( const QString &text) { + QClipboard *cb = QApplication::clipboard(); + cb->setText( text); +} + 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 @@ -61,8 +61,8 @@ public: ZSafe( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = WDestructiveClose ); ~ZSafe(); - static const QColor *evenRowColor; - static const QColor *oddRowColor; + static const QColor *evenRowColor; + static const QColor *oddRowColor; QToolButton* Edit; QToolButton* Delete; @@ -81,6 +81,7 @@ public: bool IsCopy; bool IsCut; bool modified; // true if database is modified + bool showpwd; // show PWD Dialog QListViewItem *lastSearchedCategory; QListViewItem *lastSearchedItem; @@ -183,6 +184,9 @@ public slots: virtual void categoryFieldActivated( const QString& str); + virtual void ListPressed(int, QListViewItem *, const QPoint&, int); + virtual void copyClip( const QString &text); + private slots: void setDocument(const QString& fileref); void slotLoadDocu(); -- cgit v0.9.0.2