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

List:       kde-commits
Subject:    branches/work/kgpg2
From:       Rolf Eike Beer <kde () opensource ! sf-tec ! de>
Date:       2008-01-16 19:11:30
Message-ID: 1200510690.613554.24580.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 762292 by dakon:

Port "Edit key in terminal" to model/view

As a bonus not only disable this item internally when one terminal is 
currently open but also disable the menu entry.


 M  +15 -11    keysmanager.cpp  
 M  +1 -0      keysmanager.h  


--- branches/work/kgpg2/keysmanager.cpp #762291:762292
@@ -193,7 +193,7 @@
     connect(infoKey, SIGNAL(triggered(bool)), SLOT(keyproperties()));
     infoKey->setShortcut(QKeySequence(Qt::Key_Return));
 
-    QAction *editKey = actionCollection()->addAction("key_edit");
+    editKey = actionCollection()->addAction("key_edit");
     editKey->setIcon(KIcon("kgpg-term-kgpg"));
     editKey->setText(i18n("Edit Key in &Terminal"));
     connect(editKey, SIGNAL(triggered(bool)), SLOT(slotedit()));
@@ -1109,8 +1109,11 @@
     {
         if (exportList.at(0)->getType() == ITYPE_GROUP)
             stateChanged("group_selected");
-        else
+        else {
             stateChanged("single_selected");
+            if (!terminalkey.isEmpty())
+                 editKey->setEnabled(false);
+        }
 
     }
 
@@ -1981,20 +1984,20 @@
 
 void KeysManager::slotedit()
 {
-    KeyListViewItem *item = keysList2->currentItem();
+	KGpgNode *nd = iview->selectedNode();
+	Q_ASSERT(nd != NULL);
 
-    if (item == NULL)
-        return;
-    if (!(item->itemType() & KeyListViewItem::Pair))
-        return;
-    if (!terminalkey.isEmpty())
-        return;
+	if (!(nd->getType() & ITYPE_PAIR))
+		return;
+	if (!terminalkey.isEmpty())
+		return;
 
     KProcess *kp = new KProcess(this);
     KConfigGroup config(KGlobal::config(), "General");
     *kp << config.readPathEntry("TerminalApplication","konsole");
-    *kp << "-e" << KGpgSettings::gpgBinaryPath() <<"--no-secmem-warning" \
                <<"--edit-key" << keysList2->currentItem()->keyId() << "help";
-    terminalkey = keysList2->currentItem()->keyId();
+    *kp << "-e" << KGpgSettings::gpgBinaryPath() <<"--no-secmem-warning" \
<<"--edit-key" << nd->getId() << "help"; +    terminalkey = nd->getId();
+    editKey->setEnabled(false);
 
     connect(kp, SIGNAL(finished(int)), SLOT(slotEditDone(int)));
     kp->start();
@@ -2006,6 +2009,7 @@
         imodel->refreshKey(terminalkey);
 
     terminalkey.clear();
+    editKey->setEnabled(true);
 }
 
 void KeysManager::doFilePrint(const QString &url)
--- branches/work/kgpg2/keysmanager.h #762291:762292
@@ -218,6 +218,7 @@
     QAction *importAllSignKeys;
     QAction *signKey;
     QAction *refreshKey;
+    QAction *editKey;
     QAction *setPrimUid;
     QAction *delSignKey;
     QAction *deleteKey;


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

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