summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp97
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h2
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
@@ -40,4 +40,5 @@ using namespace std;
#include "ipkg.h"
#include "inputdlg.h"
+#include "letterpushbutton.h"
#include "global.h"
@@ -48,4 +49,12 @@ NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget
dataMgr = dataManager;
+#ifdef QWS
+ // read download directory from config file
+ Config cfg( "aqpkg" );
+ cfg.setGroup( "settings" );
+ currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
+#endif
+
+
initGui();
setupConnections();
@@ -81,5 +90,5 @@ void NetworkPackageManager :: updateData()
{
serversList->insertItem( it->getServerName() );
- if ( it->getServerName() == dataMgr->getActiveServer() )
+ if ( it->getServerName() == currentlySelectedServer )
activeItem = i;
}
@@ -107,4 +116,20 @@ void NetworkPackageManager :: initGui()
hbox1->addWidget( serversList );
+ 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 );
packagesList->addColumn( "Packages" );
@@ -141,6 +166,15 @@ void NetworkPackageManager :: serverSelected( int )
// display packages
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 );
vector<Package> &list = s->getPackageList();
@@ -207,6 +241,5 @@ void NetworkPackageManager :: updateServer()
// Display dialog
ProgressDlg *dlg = new ProgressDlg( this );
- QString status = "Updating package list for ";
- status += serverName;
+ QString status = "Updating package lists...";
dlg->show();
dlg->setText( status );
@@ -217,9 +250,9 @@ void NetworkPackageManager :: updateServer()
dataMgr->writeOutIpkgConf();
- if ( serverName == LOCAL_SERVER )
- ;
- else if ( serverName == LOCAL_IPKGS )
- ;
- else
+// if ( serverName == LOCAL_SERVER )
+// ;
+// else if ( serverName == LOCAL_IPKGS )
+// ;
+// else
{
QString option = "update";
@@ -303,8 +336,9 @@ void NetworkPackageManager :: downloadPackage()
connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
- QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
ipkg.setOption( "download" );
ipkg.setRuntimeDirectory( dir );
- do
+ for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
+ item != 0 ;
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
@@ -322,12 +356,11 @@ void NetworkPackageManager :: downloadPackage()
ipkg.runIpkg( );
}
-
- item = (QCheckListItem *)item->nextSibling();
- } while ( item );
+ }
}
else if ( download->text() == "Remove" )
{
- QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
- do
+ for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
+ item != 0 ;
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
@@ -346,6 +379,5 @@ void NetworkPackageManager :: downloadPackage()
f.remove();
}
- item = (QCheckListItem *)item->nextSibling();
- } while ( item );
+ }
}
@@ -358,5 +390,5 @@ 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
dataMgr->writeOutIpkgConf();
@@ -366,6 +398,7 @@ void NetworkPackageManager :: applyChanges()
vector<QString> workingPackages;
- QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
- do
+ for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
+ item != 0 ;
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
@@ -374,7 +407,5 @@ void NetworkPackageManager :: applyChanges()
workingPackages.push_back( p );
}
-
- item = (QCheckListItem *)item->nextSibling();
- } while ( item );
+ }
// do the stuff
@@ -452,2 +483,20 @@ void NetworkPackageManager :: displayText( const QString &t )
cout << t << endl;
}
+
+
+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
@@ -51,4 +51,5 @@ private:
ProgressDlg *progressDlg;
+ QString currentlySelectedServer;
int timerId;
@@ -68,4 +69,5 @@ public slots:
void updateServer();
void displayText( const QString &t );
+ void letterPushed( QString t );
};