From 5d28c61d84da1814d356540b557bbfe026da98aa Mon Sep 17 00:00:00 2001
From: andyq <andyq>
Date: Wed, 16 Oct 2002 23:43:27 +0000
Subject: Fixed bug in jump to package

---
(limited to 'noncore/settings/aqpkg')

diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 3ce7960..6f528a1 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -492,17 +492,33 @@ void NetworkPackageManager :: displayText( const QString &t )
 
 void NetworkPackageManager :: letterPushed( QString t )
 {
-    QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
+    QCheckListItem *top = (QCheckListItem *)packagesList->firstChild();
+    QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
+    if ( packagesList->firstChild() == 0 )
+        return;
+
+    QCheckListItem *item;
+    if ( start == 0 )
+    {
+        item = (QCheckListItem *)packagesList->firstChild();
+        start = top;
+    }
+    else
+        item = (QCheckListItem *)start->nextSibling();
+
+    if ( item == 0 )
+        item = (QCheckListItem *)packagesList->firstChild();
     do
     {
         if ( item->text().lower().startsWith( t.lower() ) )
         {
-            cout << "Found - item->text()" << endl;
             packagesList->setSelected( item, true );
             packagesList->ensureItemVisible( item );
             break;
 		}
 
         item = (QCheckListItem *)item->nextSibling();
-    } while ( item );
+        if ( !item )
+            item = (QCheckListItem *)packagesList->firstChild();        
+    } while ( item != start);
 }
--
cgit v0.9.0.2