-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
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 @@ -447,62 +447,78 @@ QString NetworkPackageManager :: dealWithItem( QCheckListItem *item ) pos = name.find( "(installed)" ); if ( pos > 0 ) name.truncate( pos - 1 ); // Get package Server *s = dataMgr->getServer( serversList->currentText() ); Package *p = s->getPackage( name ); // If the package has a filename then it is a local file if ( p->isPackageStoredLocally() ) name = p->getFilename(); QString option; QString dest = "root"; if ( !p->isInstalled() ) return QString( "I" ) + name; else { if ( p->getVersion() == p->getInstalledVersion() ) { QString msgtext; msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name ); switch( QMessageBox::information( this, "Remove or ReInstall", msgtext, "Remove", "ReInstall" ) ) { case 0: // Try again or Enter return QString( "D" ) + name; break; case 1: // Quit or Escape return QString( "U" ) + name; break; } // User hit cancel (on dlg - assume remove) return QString( "D" ) + name; } else return QString( "U" ) + name; } } void NetworkPackageManager :: displayText( const QString &t ) { cout << t << endl; } 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); } |