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

List:       kde-commits
Subject:    KDE/kdeutils/kgpg
From:       Rolf Eike Beer <kde () opensource ! sf-tec ! de>
Date:       2010-09-11 19:14:59
Message-ID: 20100911191459.A39D1AC888 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1174277 by dakon:

clean up adding subkey signatures

 M  +0 -10     core/KGpgKeyNode.cpp  
 M  +0 -13     core/kgpgkey.cpp  
 M  +0 -4      core/kgpgkey.h  
 M  +9 -28     kgpginterface.cpp  
 M  +0 -8      kgpginterface.h  


--- trunk/KDE/kdeutils/kgpg/core/KGpgKeyNode.cpp #1174276:1174277
@@ -156,17 +156,7 @@
 	foreach(KGpgNode *n, children)
 		if (n->getType() == ITYPE_SIGN)
 			m_signs++;
-
-	/********* insertion of sub keys ********/
-	for (int i = 0; i < key.subList()->size(); ++i) {
-		KgpgCore::KgpgKeySub sub = key.subList()->at(i);
-
-		KGpgSubkeyNode *n = new KGpgSubkeyNode(this, sub);
-
-		foreach (const QString &sign, sub.signList())
-			(void) new KGpgSignNode(n, sign.split(':'));
 	}
-}
 
 QString
 KGpgKeyNode::getSignCount() const
--- trunk/KDE/kdeutils/kgpg/core/kgpgkey.cpp #1174276:1174277
@@ -32,7 +32,6 @@
     if (gpgsubexpiration != other.gpgsubexpiration) return false;
     if (gpgsubcreation != other.gpgsubcreation) return false;
     if (gpgsubtrust != other.gpgsubtrust) return false;
-    if (gpgsignlist != other.gpgsignlist) return false;
     if (gpgsubtype != other.gpgsubtype) return false;
     return true;
 }
@@ -134,18 +133,6 @@
     return d->gpgsubtype;
 }
 
-void KgpgKeySub::addSign(const QString &sign)
-{
-    d->gpgsignlist << sign;
-}
-
-QStringList KgpgKeySub::signList()
-{
-	QStringList ret = d->gpgsignlist;
-	d->gpgsignlist.clear();
-	return ret;
-}
-
 bool KgpgKeySub::operator==(const KgpgKeySub &other) const
 {
     if (d == other.d) return true;
--- trunk/KDE/kdeutils/kgpg/core/kgpgkey.h #1174276:1174277
@@ -135,7 +135,6 @@
     QDateTime       gpgsubcreation;
     KgpgKeyTrust    gpgsubtrust;
     KgpgKeyAlgo     gpgsubalgo;
-    QStringList     gpgsignlist;
     KgpgSubKeyType  gpgsubtype;
 
     bool operator==(const KgpgKeySubPrivate &other) const;
@@ -168,9 +167,6 @@
     bool valid() const;
     KgpgSubKeyType type() const;
 
-    void addSign(const QString &sign);
-    QStringList signList();
-
     bool operator==(const KgpgKeySub &other) const;
     inline bool operator!=(const KgpgKeySub &other) const
     { return !operator==(other); }
--- trunk/KDE/kdeutils/kgpg/kgpginterface.cpp #1174276:1174277
@@ -35,14 +35,14 @@
 #include "gpgproc.h"
 #include "core/KGpgKeyNode.h"
 #include "core/KGpgSignNode.h"
+#include "core/KGpgSubkeyNode.h"
 #include "core/KGpgUatNode.h"
 #include "core/KGpgUidNode.h"
 
 using namespace KgpgCore;
 
 KgpgInterface::KgpgInterface()
-	: m_cycle(CYCLE_NONE),
-	m_readNode(NULL),
+	: m_readNode(NULL),
 	m_currentSNode(NULL)
 {
 }
@@ -424,7 +424,6 @@
 	m_publiclistkeys.clear();
 	m_publickey = KgpgKey();
 	m_numberid = 0;
-	m_cycle = CYCLE_NONE;
 
 	GPGProc *process = new GPGProc(this);
 	*process << "--with-colons" << "--with-fingerprint" << "--fixed-list-mode" << "--list-keys";
@@ -453,7 +452,6 @@
 	m_publiclistkeys.clear();
 	m_publickey = KgpgKey();
 	m_numberid = 0;
-	m_cycle = CYCLE_NONE;
 
 	GPGProc *process = new GPGProc(this);
 	*process << "--with-colons" << "--with-fingerprint" << "--fixed-list-mode" << "--list-sigs";
@@ -478,10 +476,8 @@
 
 	while ((items = p->readln(lsp)) >= 0) {
 		if ((lsp.at(0) == "pub") && (items >= 10)) {
-			if (m_cycle != CYCLE_NONE) {
-				m_cycle = CYCLE_NONE;
+			if (!m_publickey.name().isEmpty())
 				m_publiclistkeys << m_publickey;
-			}
 
 			m_publickey = KgpgKey();
 
@@ -499,15 +495,12 @@
 
 			m_publickey.setValid((items <= 11) || !lsp.at(11).contains('D', Qt::CaseSensitive));  // disabled key
 
-			m_cycle = CYCLE_PUB;
-
 			m_numberid = 0;
 		} else if ((lsp.at(0) == "fpr") && (items >= 10)) {
 			const QString fingervalue(lsp.at(9));
 
 			m_publickey.setFingerprint(fingervalue);
 		} else if ((lsp.at(0) == "sub") && (items >= 7)) {
-			m_currentSNode = NULL;
 			KgpgKeySub sub;
 
 			sub.setId(lsp.at(4).right(8));
@@ -538,16 +531,16 @@
 				sub.setExpiration(QDateTime::fromTime_t(lsp.at(6).toUInt()));
 
 			m_publickey.subList()->append(sub);
-			m_cycle = CYCLE_SUB;
+			if (m_readNode == NULL)
+				m_currentSNode = NULL;
+			else
+				m_currentSNode = new KGpgSubkeyNode(m_readNode, sub);
 		} else if (lsp.at(0) == "uat") {
 			m_numberid++;
 			if (m_readNode != NULL) {
 				m_currentSNode = new KGpgUatNode(m_readNode, m_numberid, lsp);
 			}
-			m_cycle = CYCLE_UAT;
 		} else if ((lsp.at(0) == "uid") && (items >= 10)) {
-			m_currentSNode = NULL;
-
 			if (m_numberid == 0) {
 				QString fullname(lsp.at(9));
 				QString kmail;
@@ -586,25 +579,13 @@
 				if (m_readNode != NULL) {
 					m_currentSNode = new KGpgUidNode(m_readNode, m_numberid, lsp);
 				}
-
-				m_cycle = CYCLE_UID;
 			}
 		} else if (((lsp.at(0) == "sig") || (lsp.at(0) == "rev")) && (items >= 11)) {
 			// there are no strings here that could have a recoded ':' in them
 			const QString signature = lsp.join(QLatin1String(":"));
 
-			switch (m_cycle) {
-			case CYCLE_PUB:
-				Q_ASSERT(m_readNode != NULL);
-				(void) new KGpgSignNode(m_readNode, lsp);
-				break;
-			case CYCLE_SUB:
-				m_publickey.subList()->last().addSign(signature);
-				break;
-			default:
-				Q_ASSERT(m_currentSNode != NULL);
+			if (m_currentSNode != NULL)
 				(void) new KGpgSignNode(m_currentSNode, lsp);
-			}
 		} else {
 			log += lsp.join(QString(':')) + '\n';
 		}
@@ -617,7 +598,7 @@
 		p = qobject_cast<GPGProc *>(sender());
 
 	// insert the last key
-	if (m_cycle != CYCLE_NONE)
+	if (!m_publickey.name().isEmpty())
 		m_publiclistkeys << m_publickey;
 
 	if (p->exitCode() != 0) {
--- trunk/KDE/kdeutils/kgpg/kgpginterface.h #1174276:1174277
@@ -139,14 +139,6 @@
 
 private:
 	unsigned int m_numberid;
-	enum readCycle {
-		CYCLE_NONE,
-		CYCLE_PUB,
-		CYCLE_SUB,
-		CYCLE_UAT,
-		CYCLE_UID
-	};
-	readCycle m_cycle;
     KgpgCore::KgpgKey m_publickey;
     KgpgCore::KgpgKeyList m_publiclistkeys;
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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