[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeutils/kwallet
From:       George Staikos <staikos () kde ! org>
Date:       2005-02-21 6:24:17
Message-ID: 20050221062417.240301B8F1 () office ! kde ! org
[Download RAW message or body]

CVS commit by staikos: 

a) allow the copying of passwords too, not just maps
b) don't force the user to display a password on the screen in order to copy it
BUG: 98768


  M +20 -3     kwalleteditor.cpp   1.57
  M +3 -0      kwalleteditor.h   1.22


--- kdeutils/kwallet/kwalleteditor.cpp  #1.56:1.57
@@ -46,4 +46,5 @@
 #include <qcheckbox.h>
 #include <qcombobox.h>
+#include <qclipboard.h>
 #include <qlabel.h>
 #include <qlayout.h>
@@ -62,4 +63,5 @@ KWalletEditor::KWalletEditor(const QStri
         _newWallet = false;
         _ww = new WalletWidget(this, "Wallet Widget");
+        _copyPassAction = KStdAction::copy(this, SLOT(copyPassword()), \
actionCollection());  QVBoxLayout *box = new QVBoxLayout(_ww->_folderDetails);
         _details = new QLabel(_ww->_folderDetails, "Folder Details");
@@ -531,4 +533,8 @@ void KWalletEditor::listContextMenuReque
                 m->insertItem(i18n( "&Rename" ), this, SLOT(renameEntry()), Key_F2);
                 m->insertItem(i18n( "&Delete" ), this, SLOT(deleteEntry()), \
Key_Delete); +                if (item->parent() == _passItems) {
+                        m->insertSeparator();
+                        _copyPassAction->plug(m);
+                }
                 m->popup(pos);
         } else {
@@ -539,4 +545,15 @@ void KWalletEditor::listContextMenuReque
 
 
+void KWalletEditor::copyPassword() {
+        QListViewItem *item = _entryList->selectedItem();
+        if (_w && item) {
+                QString pass;
+                if (_w->readPassword(item->text(0), pass) == 0) {
+                        QApplication::clipboard()->setText(pass);
+                }
+        }
+}
+
+
 void KWalletEditor::newEntry() {
         QListViewItem *item = _entryList->selectedItem();
@@ -588,5 +605,5 @@ void KWalletEditor::newEntry() {
 
 void KWalletEditor::renameEntry() {
-QListViewItem *item = _entryList->selectedItem();
+        QListViewItem *item = _entryList->selectedItem();
         if (_w && item) {
                 item->startRename(0);
@@ -626,5 +643,5 @@ void KWalletEditor::listItemRenamed(QLis
 
 void KWalletEditor::deleteEntry() {
-QListViewItem *item = _entryList->selectedItem();
+        QListViewItem *item = _entryList->selectedItem();
         if (_w && item) {
                 int rc = KMessageBox::warningContinueCancel(this, i18n("Are you sure \
you wish to delete the item '%1'?").arg(item->text(0)),"",KStdGuiItem::del()); @@ \
-639,5 +656,5 @@ QListViewItem *item = _entryList->select  
 void KWalletEditor::updateEntries(const QString& folder) {
-QIconViewItem *ivi = _folderView->currentItem();
+        QIconViewItem *ivi = _folderView->currentItem();
 
         if (ivi && ivi->text() == folder) {

--- kdeutils/kwallet/kwalleteditor.h  #1.21:1.22
@@ -80,4 +80,6 @@ class KWalletEditor : public KMainWindow
                 void importWallet();
 
+                void copyPassword();
+
         signals:
                 void enableFolderActions(bool enable);
@@ -97,4 +99,5 @@ class KWalletEditor : public KMainWindow
                 KAction *_newFolderAction, *_deleteFolderAction;
                 KAction *_passwordAction, *_exportAction, *_mergeAction, \
*_importAction; +                KAction *_copyPassAction;
                 QLabel*_details;
                 QStringList _entries;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic