-rw-r--r-- | noncore/settings/aqpkg/aqpkg.pro | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/main.cpp | 9 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 5 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 85 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.h | 4 |
5 files changed, 47 insertions, 58 deletions
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro index 5fc323a..b69bae4 100644 --- a/noncore/settings/aqpkg/aqpkg.pro +++ b/noncore/settings/aqpkg/aqpkg.pro @@ -1,3 +1,3 @@ TEMPLATE = app -CONFIG = qt warn_on debug +CONFIG = qt warn_on release HEADERS = global.h \ diff --git a/noncore/settings/aqpkg/main.cpp b/noncore/settings/aqpkg/main.cpp index 53c392e..15ef9d6 100644 --- a/noncore/settings/aqpkg/main.cpp +++ b/noncore/settings/aqpkg/main.cpp @@ -17,5 +17,2 @@ -#include <iostream> -using namespace std; - #ifdef QWS @@ -37,3 +34,3 @@ int main(int argc, char *argv[]) { - cout << "Root dir = " << ROOT << endl; +// cout << "Root dir = " << ROOT << endl; #ifdef QWS @@ -46,3 +43,3 @@ int main(int argc, char *argv[]) // Disable suspend mode - cout << "Disabling suspend mode" << endl; +// cout << "Disabling suspend mode" << endl; QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; @@ -58,3 +55,3 @@ int main(int argc, char *argv[]) // Reenable suspend mode - cout << "Enabling suspend mode" << endl; +// cout << "Enabling suspend mode" << endl; QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 1a2ac37..d79673f 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp @@ -17,5 +17,2 @@ -#include <iostream> -using namespace std; - #include <qpe/qpemenubar.h> @@ -226,3 +223,3 @@ void MainWindow :: setDocument( const QString &doc ) QString package = Utils::getPackageNameFromIpkFilename( doc ); - std::cout << "Selecting package " << package << std::endl; +// std::cout << "Selecting package " << package << std::endl; networkPkgWindow->selectLocalPackage( package ); 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 ); diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h index bd005e2..99eff2e 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.h +++ b/noncore/settings/aqpkg/networkpkgmgr.h @@ -21,2 +21,3 @@ #include <qlayout.h> +#include <qpixmap.h> #include <qpushbutton.h> @@ -55,2 +56,5 @@ private: QListView *packagesList; + + QPixmap installedIcon; + QPixmap updatedIcon; |