Bug 142069 - search for a key/text does not show any result
Summary: search for a key/text does not show any result
Status: RESOLVED FIXED
Alias: None
Product: kgpg
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Rolf Eike Beer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-22 18:42 UTC by Toralf Förster
Modified: 2007-08-20 09:27 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster 2007-02-22 18:42:27 UTC
Version:           1.2.2 (using KDE 3.5.5, Gentoo)
Compiler:          gcc version 3.4.6 (Gentoo 3.4.6-r2, ssp-3.4.6-1.0, pie-8.7.10)
OS:                Linux (i686) release 2.6.19-gentoo-r5

With wireshark I could see that the response from the keyserver was received by my computer but no results were shown within kgpg search result window.
Comment 1 Rolf Eike Beer 2007-08-09 09:43:47 UTC
What have you searched for? Which keyserver?
Comment 2 Toralf Förster 2007-08-09 11:09:45 UTC
It happens at home using DSL searching for "toralf.foerster" at wwwkeys.eu.pgp.net, within the LAN I had today no problems, here are the sniffed streams : http://bugzilla.kernel.org/show_bug.cgi?id=8793.
Comment 3 Rolf Eike Beer 2007-08-20 09:27:26 UTC
SVN commit 702193 by dakon:

Fix and improve searching on keyserver

BUGS:142069,118387


 M  +35 -23    keyservers.cpp  
 M  +2 -1      keyservers.h  


--- trunk/KDE/kdeutils/kgpg/keyservers.cpp #702192:702193
@@ -406,13 +406,13 @@
     connect(m_listpop, SIGNAL(destroyed()), this, SLOT(slotAbortSearch()));
 
     m_count = 0;
-    m_cycle = false;
+    m_keyid = QString();
     m_readmessage.clear();
 
     QString keyserv = page->kCBimportks->currentText();
     QStringList *args = new QStringList();
 
-    *args << "--command-fd=0" << "--search-keys" << page->kLEimportid->text().simplified().toLocal8Bit();
+    *args << "--command-fd=0" << "--with-colons"<< "--search-keys"  << page->kLEimportid->text().simplified().toLocal8Bit();
 
     m_searchproc = createGPGProc(args);
 
@@ -459,25 +459,21 @@
         {
             m_count++;
             required.clear();
-        }
+        } else if (required.startsWith("pub")) {
+            if (m_keyid.length() > 0)
+              CreateUidEntry();
+            m_keyid = required;
+            m_kitem = NULL;
+        } else if (required.startsWith("uid")) {
+            QString kid = required.section(':', 1, 1);
 
-        if ((m_cycle) && (!required.isEmpty()))
-        {
-            QString kid = required.simplified();
-            (void) new Q3ListViewItem(m_kitem, kid);
-            kid = kid.section("key", 1, 1);
-            kid = kid.simplified();
-            kid = kid.left(8);
-            required.clear();
-        }
-
-        m_cycle = false;
-
-        if (required.contains('(') && !required.isEmpty())
-        {
-            m_cycle = true;
-            m_kitem = new Q3ListViewItem(m_listpop->kLVsearch, required.remove(0, required.indexOf(')') + 1).simplified());
-            m_keynumbers++;
+            if (m_kitem != NULL) {
+              Q3ListViewItem *k = new Q3ListViewItem(m_kitem, kid);
+              k->setSelectable(false);
+            } else {
+              m_kitem = new Q3ListViewItem(m_listpop->kLVsearch, kid);
+              m_keynumbers++;
+            }
             m_count = 0;
             required.clear();
         }
@@ -486,6 +482,10 @@
 
 void KeyServer::slotSearchResult(K3Process *)
 {
+    // add last key id
+    if (m_kitem != NULL)
+      CreateUidEntry();
+
     QString nb;
     m_dialogserver->enableButtonOk(true);
     QApplication::restoreOverrideCursor();
@@ -548,13 +548,13 @@
             else
                 kid = searchList.at(i)->text(0).simplified();
 
-            kid = kid.section("key", 1, 1);
+            kid = kid.section(i18n("Key") + ' ', 1, 1);
             kid = kid.simplified().section(",", 0, 0);
             keysToSearch << kid.right(16);
         }
     }
 
-    kDebug(2100) << keysToSearch;
+//     kDebug(2100) << keysToSearch;
     m_listpop->kLEID->setText(keysToSearch.join(" "));
 }
 
@@ -566,7 +566,6 @@
         KMessageBox::sorry(this, i18n("You must choose a key."));
         return;
     }
-
     page->kLEimportid->setText(m_listpop->kLEID->text());
     m_dialogserver->close();
     slotImport();
@@ -645,4 +644,17 @@
 	page->kCBimportks->setCurrentIndex(page->kCBimportks->findText(server));
 }
 
+void KeyServer::CreateUidEntry(void)
+{
+	Q_ASSERT(m_keyid.section(':', 1, 1).length() > 0);
+	QString id = m_keyid.section(':', 1, 1);
+
+	Q3ListViewItem *k = new Q3ListViewItem(m_kitem, i18n("Key") + ' ' + id);
+	k->setSelectable(false);
+// TODO: add more information (Key type, key size, creation date)
+	if (m_keyid.section(':', 6, 6) == "r") {
+		m_kitem->setText(0, m_kitem->text(0) + ' ' + i18n("revoked"));
+	}
+}
+
 #include "keyservers.moc"
--- trunk/KDE/kdeutils/kgpg/keyservers.h #702192:702193
@@ -108,10 +108,11 @@
 
     int m_count;
     uint m_keynumbers;
-    bool m_cycle;
     bool m_autoclosewindow;
+    QString m_keyid;
     QString expattr;
 
+    void CreateUidEntry(void);
     K3ProcIO *createGPGProc(QStringList *keys);
 };