fixes #22 multiple entries in kgpg public key list

Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
pull/24/head
Emanoil Kotsev 4 years ago
parent e2ce3b772e
commit 1df6286ec0
No known key found for this signature in database
GPG Key ID: F1EEB8CD9FB16A50

@ -350,54 +350,18 @@ void popupPublic::refreshkeys()
void popupPublic::slotpreselect()
{
TQListViewItem *it=NULL;
if (!keysList->firstChild()) return;
if (fmode) it=keysList->findItem(KGpgSettings::defaultKey(),2);
if (!trusted)
sort();
if (fmode)
{
keysList->clearSelection();
keysList->setSelected(it,true);
keysList->setCurrentItem(it);
keysList->ensureItemVisible(it);
}
emit keyListFilled();
}
void popupPublic::slotSetVisible()
{
keysList->ensureItemVisible(keysList->currentItem());
}
void popupPublic::slotprocread(KProcIO *p)
{
// kdDebug(2100) << k_funcinfo << endl;
///////////////////////////////////////////////////////////////// extract encryption keys
TQString tst;
TQString defaultKey = KGpgSettings::defaultKey().right(8);
while (p->readln(tst)!=-1) {
// kdDebug(2100) << k_funcinfo << "Read one public key line: " << tst << endl;
if ( tst.startsWith("pub") ) {
currentKey = tst.section(':',4,4);
TQStringList lst; lst << tst;
hashMap.insert(currentKey,tst);
}
else {
hashMap.find(currentKey).data().append(tst);
}
}
// process the output to update dialog infos
TQMap<TQString,TQStringList>::Iterator ite;
for (ite = hashMap.begin(); ite != hashMap.end(); ite++) {
TQStringList::Iterator it;
TQString fullname,keyname,keymail,val,id;
bool dead;
for (it = ite.data().begin(); it != ite.data().end(); it++) {
TQString line = (*it);
kdDebug(2100) << k_funcinfo << line << endl;
if (line.startsWith("pub")) {
TQStringList keyString=TQStringList::split(":",line,true);
@ -408,41 +372,30 @@ void popupPublic::slotprocread(KProcIO *p)
if (val.isEmpty()) {
val=i18n("Unlimited");
}
TQString tr;
// unused TQString tr;
switch( trust[0] ) {
case 'o':
untrustedList<<id;
break;
case 'i':
dead=true;
break;
case 'd':
dead=true;
break;
case 'r':
dead=true;
case 'o': // unknown
untrustedList<<id; // untrustedList used in sort
break;
case 'e':
case 'i': // invalid
case 'd': // disabled
case 'r': // revoked
case 'e': // expired
dead=true;
break;
case 'q':
untrustedList<<id;
break;
case 'n':
untrustedList<<id;
break;
case 'm':
case 'q': // undefined
case 'n': // none
case 'm': // marginal
untrustedList<<id;
break;
case 'f':
break;
case 'u':
case 'f': // full
case 'u': // ultimate
break;
default:
untrustedList<<id;
break;
}
if (keyString[11].find('D')!=-1) {
if (keyString[11].find('D')!=-1) { // disabled
dead=true;
}
fullname=keyString[9];
@ -481,6 +434,43 @@ void popupPublic::slotprocread(KProcIO *p)
}
}
}
//
TQListViewItem *it=NULL;
if (!keysList->firstChild()) return;
if (fmode) it=keysList->findItem(KGpgSettings::defaultKey(),2);
if (!trusted)
sort();
if (fmode)
{
keysList->clearSelection();
keysList->setSelected(it,true);
keysList->setCurrentItem(it);
keysList->ensureItemVisible(it);
}
emit keyListFilled();
}
void popupPublic::slotSetVisible()
{
keysList->ensureItemVisible(keysList->currentItem());
}
void popupPublic::slotprocread(KProcIO *p)
{
// collect all data (output starts with pub line followed by related)
// kdDebug(2100) << k_funcinfo << endl;
TQString tst;
while (p->readln(tst)!=-1) {
if ( tst.startsWith("pub") ) {
currentKey = tst.section(':',4,4);
TQStringList lst; lst << tst;
hashMap.insert(currentKey,tst);
}
else {
hashMap.find(currentKey).data().append(tst);
}
}
}

Loading…
Cancel
Save