author | drw <drw> | 2003-01-19 21:10:00 (UTC) |
---|---|---|
committer | drw <drw> | 2003-01-19 21:10:00 (UTC) |
commit | 49786b34a40d0e2ba6dd5c77acddf1c38758b89c (patch) (side-by-side diff) | |
tree | 3cb1c1c1593d17256910fb57111b19a87898ae74 /noncore/settings/aqpkg/networkpkgmgr.cpp | |
parent | ae272396cec6ca6bcfbee0d59b7948b7fe908238 (diff) | |
download | opie-49786b34a40d0e2ba6dd5c77acddf1c38758b89c.zip opie-49786b34a40d0e2ba6dd5c77acddf1c38758b89c.tar.gz opie-49786b34a40d0e2ba6dd5c77acddf1c38758b89c.tar.bz2 |
Updates to main package list, icons for installed/updated packages, QWhatsThis and a couple other tweaks
Diffstat (limited to 'noncore/settings/aqpkg/networkpkgmgr.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 85 |
1 files changed, 38 insertions, 47 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index c209589..b4b6475 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp @@ -17,9 +17,3 @@ -#include <fstream> -#include <iostream> -using namespace std; - #include <unistd.h> -#include <stdlib.h> -#include <linux/limits.h> @@ -29,2 +23,3 @@ using namespace std; #include <qpe/config.h> +#include <qpe/resource.h> #else @@ -35,2 +30,3 @@ using namespace std; #include <qmessagebox.h> +#include <qwhatsthis.h> @@ -99,3 +95,3 @@ void NetworkPackageManager :: updateData() { - cout << serverName << " is not active" << endl; +// cout << serverName << " is not active" << endl; i--; @@ -147,4 +143,10 @@ void NetworkPackageManager :: initGui() connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); + QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); + + installedIcon = Resource::loadPixmap( "aqpkg/installed" ); + updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); packagesList = new QListView( this ); + packagesList->addColumn( tr( "Packages" ), 225 ); + QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); @@ -176,4 +178,3 @@ void NetworkPackageManager :: initGui() vbox->addWidget( packagesList ); - packagesList->addColumn( tr( "Packages" ) ); - + downloadEnabled = TRUE; @@ -188,2 +189,5 @@ void NetworkPackageManager :: serverSelected( int, bool raiseProgress ) { + QPixmap nullIcon( installedIcon.size() ); + nullIcon.fill( colorGroup().base() ); + // display packages @@ -262,20 +266,19 @@ void NetworkPackageManager :: serverSelected( int, bool raiseProgress ) - text.append( it->getPackageName() ); + QCheckListItem *item = new QCheckListItem( packagesList, it->getPackageName(), QCheckListItem::CheckBox ); + if ( it->isInstalled() ) { - text.append( " (installed)" ); - - // If a different version of package is available, postfix it with an * - if ( it->getVersion() != it->getInstalledVersion() ) + // If a different version of package is available, show update available icon + // Otherwise, show installed icon + if ( it->getVersion() != it->getInstalledVersion() && + compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1) { - if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 ) - text.append( "*" ); + item->setPixmap( 0, updatedIcon ); } - } - - QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); - - if ( it->isInstalled() ) - { + else + { + item->setPixmap( 0, installedIcon ); + } + QString destName = ""; @@ -294,2 +297,6 @@ void NetworkPackageManager :: serverSelected( int, bool raiseProgress ) } + else + { + item->setPixmap( 0, nullIcon ); + } @@ -300,3 +307,3 @@ void NetworkPackageManager :: serverSelected( int, bool raiseProgress ) new QCheckListItem( item, QString( tr( "Section - %1" ).arg( it->getSection() ) ) ); - } + } else @@ -510,12 +517,3 @@ void NetworkPackageManager :: downloadSelectedPackages() { - QString name = item->text(); - int pos = name.find( "*" ); - name.truncate( pos ); - - // if (there is a (installed), remove it - pos = name.find( "(installed)" ); - if ( pos > 0 ) - name.truncate( pos - 1 ); - - ipkg.setPackage( name ); + ipkg.setPackage( item->text() ); ipkg.runIpkg( ); @@ -616,9 +614,2 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) QString name = item->text(); - int pos = name.find( "*" ); - name.truncate( pos ); - - // if (there is a (installed), remove it - pos = name.find( "(installed)" ); - if ( pos > 0 ) - name.truncate( pos - 1 ); @@ -653,4 +644,4 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) item.destination = p->getInstalledTo(); - cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; - cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; +// cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; +// cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; } @@ -736,5 +727,5 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) -void NetworkPackageManager :: displayText( const QString &t ) +void NetworkPackageManager :: displayText( const QString &/*t*/ ) { - cout << t << endl; +// cout << t << endl; } @@ -780,3 +771,3 @@ void NetworkPackageManager :: searchForPackage( const QString &text ) { - cout << "searching for " << text << endl; +// cout << "searching for " << text << endl; // look through package list for text startng at current position @@ -793,6 +784,6 @@ void NetworkPackageManager :: searchForPackage( const QString &text ) { - cout << "checking " << item->text().lower() << endl; +// cout << "checking " << item->text().lower() << endl; if ( item->text().lower().find( text ) != -1 ) { - cout << "matched " << item->text() << endl; +// cout << "matched " << item->text() << endl; packagesList->ensureItemVisible( item ); |