Diffstat (limited to 'noncore/settings/aqpkg/mainwin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 50 |
1 files changed, 12 insertions, 38 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index fb40d52..1aec6a8 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -39,24 +39,25 @@ | |||
39 | #include <qtimer.h> | 39 | #include <qtimer.h> |
40 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
41 | #include <qwidgetstack.h> | 41 | #include <qwidgetstack.h> |
42 | 42 | ||
43 | #include "categoryfilterimpl.h" | 43 | #include "categoryfilterimpl.h" |
44 | #include "datamgr.h" | 44 | #include "datamgr.h" |
45 | #include "global.h" | 45 | #include "global.h" |
46 | #include "inputdlg.h" | 46 | #include "inputdlg.h" |
47 | #include "ipkg.h" | 47 | #include "ipkg.h" |
48 | #include "installdlgimpl.h" | 48 | #include "installdlgimpl.h" |
49 | #include "letterpushbutton.h" | 49 | #include "letterpushbutton.h" |
50 | #include "mainwin.h" | 50 | #include "mainwin.h" |
51 | #include "packagewin.h" | ||
51 | #include "settingsimpl.h" | 52 | #include "settingsimpl.h" |
52 | #include "utils.h" | 53 | #include "utils.h" |
53 | 54 | ||
54 | extern int compareVersions( const char *v1, const char *v2 ); | 55 | extern int compareVersions( const char *v1, const char *v2 ); |
55 | 56 | ||
56 | MainWindow :: MainWindow() | 57 | MainWindow :: MainWindow() |
57 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) | 58 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) |
58 | { | 59 | { |
59 | setCaption( tr( "AQPkg - Package Manager" ) ); | 60 | setCaption( tr( "AQPkg - Package Manager" ) ); |
60 | 61 | ||
61 | // Create UI widgets | 62 | // Create UI widgets |
62 | initMainWidget(); | 63 | initMainWidget(); |
@@ -221,33 +222,36 @@ MainWindow :: MainWindow() | |||
221 | MainWindow :: ~MainWindow() | 222 | MainWindow :: ~MainWindow() |
222 | { | 223 | { |
223 | delete mgr; | 224 | delete mgr; |
224 | } | 225 | } |
225 | 226 | ||
226 | void MainWindow :: initMainWidget() | 227 | void MainWindow :: initMainWidget() |
227 | { | 228 | { |
228 | networkPkgWindow = new QWidget( this ); | 229 | networkPkgWindow = new QWidget( this ); |
229 | 230 | ||
230 | QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); | 231 | QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); |
231 | 232 | ||
232 | serversList = new QComboBox( networkPkgWindow ); | 233 | serversList = new QComboBox( networkPkgWindow ); |
233 | connect( serversList, SIGNAL( activated( int ) ), this, SLOT( serverSelected( int ) ) ); | 234 | connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) ); |
234 | QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); | 235 | QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); |
235 | 236 | ||
236 | installedIcon = Resource::loadPixmap( "installed" ); | 237 | installedIcon = Resource::loadPixmap( "installed" ); |
237 | updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); | 238 | updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); |
238 | 239 | ||
239 | packagesList = new QListView( networkPkgWindow ); | 240 | packagesList = new QListView( networkPkgWindow ); |
240 | packagesList->addColumn( tr( "Packages" ), 225 ); | 241 | packagesList->addColumn( tr( "Packages" ), 225 ); |
241 | 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." ) ); | 242 | 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." ) ); |
243 | QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold ); | ||
244 | connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), | ||
245 | this, SLOT(slotDisplayPackage(QListViewItem *)) ); | ||
242 | 246 | ||
243 | QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); | 247 | QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); |
244 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); | 248 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); |
245 | hbox1->addWidget( l ); | 249 | hbox1->addWidget( l ); |
246 | hbox1->addWidget( serversList ); | 250 | hbox1->addWidget( serversList ); |
247 | 251 | ||
248 | vbox->addWidget( packagesList ); | 252 | vbox->addWidget( packagesList ); |
249 | 253 | ||
250 | downloadEnabled = TRUE; | 254 | downloadEnabled = TRUE; |
251 | } | 255 | } |
252 | 256 | ||
253 | void MainWindow :: initProgressWidget() | 257 | void MainWindow :: initProgressWidget() |
@@ -662,67 +666,30 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) | |||
662 | { | 666 | { |
663 | // If a different version of package is available, show update available icon | 667 | // If a different version of package is available, show update available icon |
664 | // Otherwise, show installed icon | 668 | // Otherwise, show installed icon |
665 | if ( package->getNewVersionAvailable()) | 669 | if ( package->getNewVersionAvailable()) |
666 | { | 670 | { |
667 | 671 | ||
668 | item->setPixmap( 0, updatedIcon ); | 672 | item->setPixmap( 0, updatedIcon ); |
669 | } | 673 | } |
670 | else | 674 | else |
671 | { | 675 | { |
672 | item->setPixmap( 0, installedIcon ); | 676 | item->setPixmap( 0, installedIcon ); |
673 | } | 677 | } |
674 | |||
675 | QString destName = ""; | ||
676 | if ( package->getLocalPackage() ) | ||
677 | { | ||
678 | if ( package->getLocalPackage()->getInstalledTo() ) | ||
679 | destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); | ||
680 | } | ||
681 | else | ||
682 | { | ||
683 | if ( package->getInstalledTo() ) | ||
684 | destName = package->getInstalledTo()->getDestinationName(); | ||
685 | } | ||
686 | if ( destName != "" ) | ||
687 | new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) ); | ||
688 | } | 678 | } |
689 | else | 679 | else |
690 | { | 680 | { |
691 | item->setPixmap( 0, nullIcon ); | 681 | item->setPixmap( 0, nullIcon ); |
692 | } | 682 | } |
693 | 683 | ||
694 | if ( !package->isPackageStoredLocally() ) | ||
695 | { | ||
696 | new QCheckListItem( item, QString( tr( "Description - %1" ).arg( package->getDescription() ) ) ); | ||
697 | new QCheckListItem( item, QString( tr( "Size - %1" ).arg( package->getPackageSize() ) ) ); | ||
698 | new QCheckListItem( item, QString( tr( "Section - %1" ).arg( package->getSection() ) ) ); | ||
699 | } | ||
700 | else | ||
701 | new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( package->getFilename() ) ) ); | ||
702 | |||
703 | if ( serverName == LOCAL_SERVER ) | ||
704 | { | ||
705 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getVersion() ) ) ); | ||
706 | } | ||
707 | else | ||
708 | { | ||
709 | new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( package->getVersion() ) ) ); | ||
710 | if ( package->getLocalPackage() ) | ||
711 | { | ||
712 | if ( package->isInstalled() ) | ||
713 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getInstalledVersion() ) ) ); | ||
714 | } | ||
715 | } | ||
716 | |||
717 | packagesList->insertItem( item ); | 684 | packagesList->insertItem( item ); |
718 | } | 685 | } |
719 | 686 | ||
720 | // If the local server or the local ipkgs server disable the download button | 687 | // If the local server or the local ipkgs server disable the download button |
721 | if ( serverName == LOCAL_SERVER ) | 688 | if ( serverName == LOCAL_SERVER ) |
722 | { | 689 | { |
723 | downloadEnabled = TRUE; | 690 | downloadEnabled = TRUE; |
724 | actionUpgrade->setEnabled( FALSE ); | 691 | actionUpgrade->setEnabled( FALSE ); |
725 | } | 692 | } |
726 | else if ( serverName == LOCAL_IPKGS ) | 693 | else if ( serverName == LOCAL_IPKGS ) |
727 | { | 694 | { |
728 | downloadEnabled = FALSE; | 695 | downloadEnabled = FALSE; |
@@ -1173,12 +1140,19 @@ void MainWindow :: letterPushed( QString t ) | |||
1173 | if ( item->text().lower().startsWith( t.lower() ) ) | 1140 | if ( item->text().lower().startsWith( t.lower() ) ) |
1174 | { | 1141 | { |
1175 | packagesList->setSelected( item, true ); | 1142 | packagesList->setSelected( item, true ); |
1176 | packagesList->ensureItemVisible( item ); | 1143 | packagesList->ensureItemVisible( item ); |
1177 | break; | 1144 | break; |
1178 | } | 1145 | } |
1179 | 1146 | ||
1180 | item = (QCheckListItem *)item->nextSibling(); | 1147 | item = (QCheckListItem *)item->nextSibling(); |
1181 | if ( !item ) | 1148 | if ( !item ) |
1182 | item = (QCheckListItem *)packagesList->firstChild(); | 1149 | item = (QCheckListItem *)packagesList->firstChild(); |
1183 | } while ( item != start); | 1150 | } while ( item != start); |
1184 | } | 1151 | } |
1152 | |||
1153 | void MainWindow :: slotDisplayPackage( QListViewItem *item ) | ||
1154 | { | ||
1155 | QString itemstr( ((QCheckListItem*)item)->text() ); | ||
1156 | PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) ); | ||
1157 | p->showMaximized(); | ||
1158 | } | ||