-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; | |||
41 | #include "inputdlg.h" | 41 | #include "inputdlg.h" |
42 | #include "letterpushbutton.h" | ||
42 | 43 | ||
@@ -49,2 +50,10 @@ NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget | |||
49 | 50 | ||
51 | #ifdef QWS | ||
52 | // read download directory from config file | ||
53 | Config cfg( "aqpkg" ); | ||
54 | cfg.setGroup( "settings" ); | ||
55 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); | ||
56 | #endif | ||
57 | |||
58 | |||
50 | initGui(); | 59 | initGui(); |
@@ -82,3 +91,3 @@ void NetworkPackageManager :: updateData() | |||
82 | serversList->insertItem( it->getServerName() ); | 91 | serversList->insertItem( it->getServerName() ); |
83 | if ( it->getServerName() == dataMgr->getActiveServer() ) | 92 | if ( it->getServerName() == currentlySelectedServer ) |
84 | activeItem = i; | 93 | activeItem = i; |
@@ -108,2 +117,18 @@ void NetworkPackageManager :: initGui() | |||
108 | 117 | ||
118 | QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" ); | ||
119 | QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" ); | ||
120 | |||
121 | char text[2]; | ||
122 | text[1] = '\0'; | ||
123 | for ( int i = 0 ; i < 26 ; ++i ) | ||
124 | { | ||
125 | text[0] = 'A' + i; | ||
126 | LetterPushButton *b = new LetterPushButton( text, this ); | ||
127 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); | ||
128 | if ( i < 16 ) | ||
129 | hbox3->addWidget( b ); | ||
130 | else | ||
131 | hbox4->addWidget( b ); | ||
132 | } | ||
133 | |||
109 | vbox->addWidget( packagesList ); | 134 | vbox->addWidget( packagesList ); |
@@ -142,4 +167,13 @@ void NetworkPackageManager :: serverSelected( int ) | |||
142 | QString serverName = serversList->currentText(); | 167 | QString serverName = serversList->currentText(); |
168 | currentlySelectedServer = serverName; | ||
169 | |||
170 | #ifdef QWS | ||
171 | // read download directory from config file | ||
172 | Config cfg( "aqpkg" ); | ||
173 | cfg.setGroup( "settings" ); | ||
174 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); | ||
175 | #endif | ||
176 | |||
143 | Server *s = dataMgr->getServer( serverName ); | 177 | Server *s = dataMgr->getServer( serverName ); |
144 | dataMgr->setActiveServer( serverName ); | 178 | // dataMgr->setActiveServer( serverName ); |
145 | 179 | ||
@@ -208,4 +242,3 @@ void NetworkPackageManager :: updateServer() | |||
208 | ProgressDlg *dlg = new ProgressDlg( this ); | 242 | ProgressDlg *dlg = new ProgressDlg( this ); |
209 | QString status = "Updating package list for "; | 243 | QString status = "Updating package lists..."; |
210 | status += serverName; | ||
211 | dlg->show(); | 244 | dlg->show(); |
@@ -218,7 +251,7 @@ void NetworkPackageManager :: updateServer() | |||
218 | 251 | ||
219 | if ( serverName == LOCAL_SERVER ) | 252 | // if ( serverName == LOCAL_SERVER ) |
220 | ; | 253 | // ; |
221 | else if ( serverName == LOCAL_IPKGS ) | 254 | // else if ( serverName == LOCAL_IPKGS ) |
222 | ; | 255 | // ; |
223 | else | 256 | // else |
224 | { | 257 | { |
@@ -304,6 +337,7 @@ void NetworkPackageManager :: downloadPackage() | |||
304 | 337 | ||
305 | QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | ||
306 | ipkg.setOption( "download" ); | 338 | ipkg.setOption( "download" ); |
307 | ipkg.setRuntimeDirectory( dir ); | 339 | ipkg.setRuntimeDirectory( dir ); |
308 | do | 340 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
341 | item != 0 ; | ||
342 | item = (QCheckListItem *)item->nextSibling() ) | ||
309 | { | 343 | { |
@@ -323,5 +357,3 @@ void NetworkPackageManager :: downloadPackage() | |||
323 | } | 357 | } |
324 | 358 | } | |
325 | item = (QCheckListItem *)item->nextSibling(); | ||
326 | } while ( item ); | ||
327 | } | 359 | } |
@@ -329,4 +361,5 @@ void NetworkPackageManager :: downloadPackage() | |||
329 | { | 361 | { |
330 | QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 362 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
331 | do | 363 | item != 0 ; |
364 | item = (QCheckListItem *)item->nextSibling() ) | ||
332 | { | 365 | { |
@@ -347,4 +380,3 @@ void NetworkPackageManager :: downloadPackage() | |||
347 | } | 380 | } |
348 | item = (QCheckListItem *)item->nextSibling(); | 381 | } |
349 | } while ( item ); | ||
350 | } | 382 | } |
@@ -359,3 +391,3 @@ void NetworkPackageManager :: applyChanges() | |||
359 | // Disable buttons to stop silly people clicking lots on them :) | 391 | // Disable buttons to stop silly people clicking lots on them :) |
360 | 392 | ||
361 | // First, write out ipkg_conf file so that ipkg can use it | 393 | // First, write out ipkg_conf file so that ipkg can use it |
@@ -367,4 +399,5 @@ void NetworkPackageManager :: applyChanges() | |||
367 | vector<QString> workingPackages; | 399 | vector<QString> workingPackages; |
368 | QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 400 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
369 | do | 401 | item != 0 ; |
402 | item = (QCheckListItem *)item->nextSibling() ) | ||
370 | { | 403 | { |
@@ -375,5 +408,3 @@ void NetworkPackageManager :: applyChanges() | |||
375 | } | 408 | } |
376 | 409 | } | |
377 | item = (QCheckListItem *)item->nextSibling(); | ||
378 | } while ( item ); | ||
379 | 410 | ||
@@ -453 +484,19 @@ void NetworkPackageManager :: displayText( const QString &t ) | |||
453 | } | 484 | } |
485 | |||
486 | |||
487 | void NetworkPackageManager :: letterPushed( QString t ) | ||
488 | { | ||
489 | QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | ||
490 | do | ||
491 | { | ||
492 | if ( item->text().lower().startsWith( t.lower() ) ) | ||
493 | { | ||
494 | cout << "Found - item->text()" << endl; | ||
495 | packagesList->setSelected( item, true ); | ||
496 | packagesList->ensureItemVisible( item ); | ||
497 | break; | ||
498 | } | ||
499 | |||
500 | item = (QCheckListItem *)item->nextSibling(); | ||
501 | } while ( item ); | ||
502 | } | ||
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: | |||
52 | ProgressDlg *progressDlg; | 52 | ProgressDlg *progressDlg; |
53 | QString currentlySelectedServer; | ||
53 | 54 | ||
@@ -69,2 +70,3 @@ public slots: | |||
69 | void displayText( const QString &t ); | 70 | void displayText( const QString &t ); |
71 | void letterPushed( QString t ); | ||
70 | }; | 72 | }; |