author | andyq <andyq> | 2002-10-16 21:25:25 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-10-16 21:25:25 (UTC) |
commit | bf58f7bc221ba10f6681d9a1a5193bd208d9920e (patch) (side-by-side diff) | |
tree | ba87cbc5c490b60e6c447eadded833408d829438 /noncore | |
parent | 6c5cf5e778ce7cce306b5e02c1ce66a536d3a11c (diff) | |
download | opie-bf58f7bc221ba10f6681d9a1a5193bd208d9920e.zip opie-bf58f7bc221ba10f6681d9a1a5193bd208d9920e.tar.gz opie-bf58f7bc221ba10f6681d9a1a5193bd208d9920e.tar.bz2 |
Now allows for multiple servers active
Added basic search facility (lots of buttons)
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 97 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.h | 2 |
2 files changed, 75 insertions, 24 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index 0bc01df..318b26d 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp @@ -41,2 +41,3 @@ using namespace std; #include "inputdlg.h" +#include "letterpushbutton.h" @@ -49,2 +50,10 @@ NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget +#ifdef QWS + // read download directory from config file + Config cfg( "aqpkg" ); + cfg.setGroup( "settings" ); + currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); +#endif + + initGui(); @@ -82,3 +91,3 @@ void NetworkPackageManager :: updateData() serversList->insertItem( it->getServerName() ); - if ( it->getServerName() == dataMgr->getActiveServer() ) + if ( it->getServerName() == currentlySelectedServer ) activeItem = i; @@ -108,2 +117,18 @@ void NetworkPackageManager :: initGui() + QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" ); + QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" ); + + char text[2]; + text[1] = '\0'; + for ( int i = 0 ; i < 26 ; ++i ) + { + text[0] = 'A' + i; + LetterPushButton *b = new LetterPushButton( text, this ); + connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); + if ( i < 16 ) + hbox3->addWidget( b ); + else + hbox4->addWidget( b ); + } + vbox->addWidget( packagesList ); @@ -142,4 +167,13 @@ void NetworkPackageManager :: serverSelected( int ) QString serverName = serversList->currentText(); + currentlySelectedServer = serverName; + +#ifdef QWS + // read download directory from config file + Config cfg( "aqpkg" ); + cfg.setGroup( "settings" ); + cfg.writeEntry( "selectedServer", currentlySelectedServer ); +#endif + Server *s = dataMgr->getServer( serverName ); - dataMgr->setActiveServer( serverName ); +// dataMgr->setActiveServer( serverName ); @@ -208,4 +242,3 @@ void NetworkPackageManager :: updateServer() ProgressDlg *dlg = new ProgressDlg( this ); - QString status = "Updating package list for "; - status += serverName; + QString status = "Updating package lists..."; dlg->show(); @@ -218,7 +251,7 @@ void NetworkPackageManager :: updateServer() - if ( serverName == LOCAL_SERVER ) - ; - else if ( serverName == LOCAL_IPKGS ) - ; - else +// if ( serverName == LOCAL_SERVER ) +// ; +// else if ( serverName == LOCAL_IPKGS ) +// ; +// else { @@ -304,6 +337,7 @@ void NetworkPackageManager :: downloadPackage() - QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); ipkg.setOption( "download" ); ipkg.setRuntimeDirectory( dir ); - do + for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); + item != 0 ; + item = (QCheckListItem *)item->nextSibling() ) { @@ -323,5 +357,3 @@ void NetworkPackageManager :: downloadPackage() } - - item = (QCheckListItem *)item->nextSibling(); - } while ( item ); + } } @@ -329,4 +361,5 @@ void NetworkPackageManager :: downloadPackage() { - QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - do + for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); + item != 0 ; + item = (QCheckListItem *)item->nextSibling() ) { @@ -347,4 +380,3 @@ void NetworkPackageManager :: downloadPackage() } - item = (QCheckListItem *)item->nextSibling(); - } while ( item ); + } } @@ -359,3 +391,3 @@ void NetworkPackageManager :: applyChanges() // Disable buttons to stop silly people clicking lots on them :) - + // First, write out ipkg_conf file so that ipkg can use it @@ -367,4 +399,5 @@ void NetworkPackageManager :: applyChanges() vector<QString> workingPackages; - QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - do + for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); + item != 0 ; + item = (QCheckListItem *)item->nextSibling() ) { @@ -375,5 +408,3 @@ void NetworkPackageManager :: applyChanges() } - - item = (QCheckListItem *)item->nextSibling(); - } while ( item ); + } @@ -453 +484,19 @@ void NetworkPackageManager :: displayText( const QString &t ) } + + +void NetworkPackageManager :: letterPushed( QString t ) +{ + QCheckListItem *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 ); +} diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h index 8a88b35..0ae64a6 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.h +++ b/noncore/settings/aqpkg/networkpkgmgr.h @@ -52,2 +52,3 @@ private: ProgressDlg *progressDlg; + QString currentlySelectedServer; @@ -69,2 +70,3 @@ public slots: void displayText( const QString &t ); + void letterPushed( QString t ); }; |