author | drw <drw> | 2003-04-22 02:08:38 (UTC) |
---|---|---|
committer | drw <drw> | 2003-04-22 02:08:38 (UTC) |
commit | f37fda5887250b25033120021aed2f1e48f48b1b (patch) (unidiff) | |
tree | fa97b82d00209bc72d120d15792d107cfb03736b | |
parent | 2d4cf8a85edc83b72855854b0bd337d2993df95b (diff) | |
download | opie-f37fda5887250b25033120021aed2f1e48f48b1b.zip opie-f37fda5887250b25033120021aed2f1e48f48b1b.tar.gz opie-f37fda5887250b25033120021aed2f1e48f48b1b.tar.bz2 |
Now display package information in separate window...easier for those long descriptions. Also use click and hold to display info, not double-click.
-rw-r--r-- | noncore/settings/aqpkg/aqpkg.pro | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 50 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/packagewin.cpp | 119 | ||||
-rw-r--r-- | noncore/settings/aqpkg/packagewin.h | 45 |
5 files changed, 180 insertions, 38 deletions
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro index 5b5d506..d241d1b 100644 --- a/noncore/settings/aqpkg/aqpkg.pro +++ b/noncore/settings/aqpkg/aqpkg.pro | |||
@@ -1,60 +1,62 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | HEADERS = global.h \ | 3 | HEADERS = global.h \ |
4 | mainwin.h \ | 4 | mainwin.h \ |
5 | datamgr.h \ | 5 | datamgr.h \ |
6 | settingsimpl.h \ | 6 | settingsimpl.h \ |
7 | ipkg.h \ | 7 | ipkg.h \ |
8 | packagewin.h \ | ||
8 | package.h \ | 9 | package.h \ |
9 | installdlgimpl.h \ | 10 | installdlgimpl.h \ |
10 | instoptionsimpl.h \ | 11 | instoptionsimpl.h \ |
11 | destination.h \ | 12 | destination.h \ |
12 | utils.h \ | 13 | utils.h \ |
13 | server.h \ | 14 | server.h \ |
14 | letterpushbutton.h \ | 15 | letterpushbutton.h \ |
15 | inputdlg.h \ | 16 | inputdlg.h \ |
16 | categoryfilterimpl.h | 17 | categoryfilterimpl.h |
17 | SOURCES = mainwin.cpp \ | 18 | SOURCES = mainwin.cpp \ |
18 | datamgr.cpp \ | 19 | datamgr.cpp \ |
19 | mem.cpp \ | 20 | mem.cpp \ |
20 | settingsimpl.cpp \ | 21 | settingsimpl.cpp \ |
21 | ipkg.cpp \ | 22 | ipkg.cpp \ |
22 | main.cpp \ | 23 | main.cpp \ |
24 | packagewin.cpp \ | ||
23 | package.cpp \ | 25 | package.cpp \ |
24 | installdlgimpl.cpp \ | 26 | installdlgimpl.cpp \ |
25 | instoptionsimpl.cpp \ | 27 | instoptionsimpl.cpp \ |
26 | destination.cpp \ | 28 | destination.cpp \ |
27 | utils.cpp \ | 29 | utils.cpp \ |
28 | server.cpp \ | 30 | server.cpp \ |
29 | letterpushbutton.cpp \ | 31 | letterpushbutton.cpp \ |
30 | inputdlg.cpp \ | 32 | inputdlg.cpp \ |
31 | version.cpp \ | 33 | version.cpp \ |
32 | categoryfilterimpl.cpp | 34 | categoryfilterimpl.cpp |
33 | INTERFACES= | 35 | INTERFACES= |
34 | TARGET = aqpkg | 36 | TARGET = aqpkg |
35 | INCLUDEPATH += $(OPIEDIR)/include | 37 | INCLUDEPATH += $(OPIEDIR)/include |
36 | DEPENDPATH += $(OPIEDIR)/include | 38 | DEPENDPATH += $(OPIEDIR)/include |
37 | LIBS += -lqpe -lopie -lstdc++ | 39 | LIBS += -lqpe -lopie -lstdc++ |
38 | DESTDIR = $(OPIEDIR)/bin | 40 | DESTDIR = $(OPIEDIR)/bin |
39 | 41 | ||
40 | TRANSLATIONS = ../../../i18n/de/aqpkg.ts \ | 42 | TRANSLATIONS = ../../../i18n/de/aqpkg.ts \ |
41 | ../../../i18n/nl/aqpkg.ts \ | 43 | ../../../i18n/nl/aqpkg.ts \ |
42 | ../../../i18n/xx/aqpkg.ts \ | 44 | ../../../i18n/xx/aqpkg.ts \ |
43 | ../../../i18n/en/aqpkg.ts \ | 45 | ../../../i18n/en/aqpkg.ts \ |
44 | ../../../i18n/es/aqpkg.ts \ | 46 | ../../../i18n/es/aqpkg.ts \ |
45 | ../../../i18n/fr/aqpkg.ts \ | 47 | ../../../i18n/fr/aqpkg.ts \ |
46 | ../../../i18n/hu/aqpkg.ts \ | 48 | ../../../i18n/hu/aqpkg.ts \ |
47 | ../../../i18n/ja/aqpkg.ts \ | 49 | ../../../i18n/ja/aqpkg.ts \ |
48 | ../../../i18n/ko/aqpkg.ts \ | 50 | ../../../i18n/ko/aqpkg.ts \ |
49 | ../../../i18n/no/aqpkg.ts \ | 51 | ../../../i18n/no/aqpkg.ts \ |
50 | ../../../i18n/pl/aqpkg.ts \ | 52 | ../../../i18n/pl/aqpkg.ts \ |
51 | ../../../i18n/pt/aqpkg.ts \ | 53 | ../../../i18n/pt/aqpkg.ts \ |
52 | ../../../i18n/pt_BR/aqpkg.ts \ | 54 | ../../../i18n/pt_BR/aqpkg.ts \ |
53 | ../../../i18n/sl/aqpkg.ts \ | 55 | ../../../i18n/sl/aqpkg.ts \ |
54 | ../../../i18n/zh_CN/aqpkg.ts \ | 56 | ../../../i18n/zh_CN/aqpkg.ts \ |
55 | ../../../i18n/zh_TW/aqpkg.ts \ | 57 | ../../../i18n/zh_TW/aqpkg.ts \ |
56 | ../../../i18n/it/aqpkg.ts \ | 58 | ../../../i18n/it/aqpkg.ts \ |
57 | ../../../i18n/da/aqpkg.ts | 59 | ../../../i18n/da/aqpkg.ts |
58 | 60 | ||
59 | 61 | ||
60 | include ( $(OPIEDIR)/include.pro ) | 62 | include ( $(OPIEDIR)/include.pro ) |
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 | |||
@@ -1,369 +1,373 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | mainwin.cpp - description | 2 | mainwin.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Aug 26 13:32:30 BST 2002 | 4 | begin : Mon Aug 26 13:32:30 BST 2002 |
5 | copyright : (C) 2002 by Andy Qua | 5 | copyright : (C) 2002 by Andy Qua |
6 | email : andy.qua@blueyonder.co.uk | 6 | email : andy.qua@blueyonder.co.uk |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include <linux/limits.h> | 18 | #include <linux/limits.h> |
19 | #include <unistd.h> | 19 | #include <unistd.h> |
20 | 20 | ||
21 | #include <qpe/qcopenvelope_qws.h> | 21 | #include <qpe/qcopenvelope_qws.h> |
22 | #include <qmenubar.h> | 22 | #include <qmenubar.h> |
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qtoolbar.h> | 24 | #include <qtoolbar.h> |
25 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | 27 | ||
28 | #include <qaction.h> | 28 | #include <qaction.h> |
29 | #include <qcombobox.h> | 29 | #include <qcombobox.h> |
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qlabel.h> | 31 | #include <qlabel.h> |
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
34 | #include <qlistview.h> | 34 | #include <qlistview.h> |
35 | #include <qmenubar.h> | 35 | #include <qmenubar.h> |
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
38 | #include <qprogressbar.h> | 38 | #include <qprogressbar.h> |
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(); |
63 | initProgressWidget(); | 64 | initProgressWidget(); |
64 | 65 | ||
65 | // Build menu and tool bars | 66 | // Build menu and tool bars |
66 | setToolBarsMovable( FALSE ); | 67 | setToolBarsMovable( FALSE ); |
67 | 68 | ||
68 | QToolBar *bar = new QToolBar( this ); | 69 | QToolBar *bar = new QToolBar( this ); |
69 | bar->setHorizontalStretchable( TRUE ); | 70 | bar->setHorizontalStretchable( TRUE ); |
70 | QMenuBar *mb = new QMenuBar( bar ); | 71 | QMenuBar *mb = new QMenuBar( bar ); |
71 | mb->setMargin( 0 ); | 72 | mb->setMargin( 0 ); |
72 | bar = new QToolBar( this ); | 73 | bar = new QToolBar( this ); |
73 | 74 | ||
74 | // Find toolbar | 75 | // Find toolbar |
75 | findBar = new QToolBar( this ); | 76 | findBar = new QToolBar( this ); |
76 | addToolBar( findBar, QMainWindow::Top, true ); | 77 | addToolBar( findBar, QMainWindow::Top, true ); |
77 | findBar->setHorizontalStretchable( true ); | 78 | findBar->setHorizontalStretchable( true ); |
78 | findEdit = new QLineEdit( findBar ); | 79 | findEdit = new QLineEdit( findBar ); |
79 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); | 80 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); |
80 | findBar->setStretchableWidget( findEdit ); | 81 | findBar->setStretchableWidget( findEdit ); |
81 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); | 82 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); |
82 | 83 | ||
83 | // Quick jump toolbar | 84 | // Quick jump toolbar |
84 | jumpBar = new QToolBar( this ); | 85 | jumpBar = new QToolBar( this ); |
85 | addToolBar( jumpBar, QMainWindow::Top, true ); | 86 | addToolBar( jumpBar, QMainWindow::Top, true ); |
86 | jumpBar->setHorizontalStretchable( true ); | 87 | jumpBar->setHorizontalStretchable( true ); |
87 | QWidget *w = new QWidget( jumpBar ); | 88 | QWidget *w = new QWidget( jumpBar ); |
88 | jumpBar->setStretchableWidget( w ); | 89 | jumpBar->setStretchableWidget( w ); |
89 | 90 | ||
90 | QGridLayout *layout = new QGridLayout( w ); | 91 | QGridLayout *layout = new QGridLayout( w ); |
91 | 92 | ||
92 | char text[2]; | 93 | char text[2]; |
93 | text[1] = '\0'; | 94 | text[1] = '\0'; |
94 | for ( int i = 0 ; i < 26 ; ++i ) | 95 | for ( int i = 0 ; i < 26 ; ++i ) |
95 | { | 96 | { |
96 | text[0] = 'A' + i; | 97 | text[0] = 'A' + i; |
97 | LetterPushButton *b = new LetterPushButton( text, w ); | 98 | LetterPushButton *b = new LetterPushButton( text, w ); |
98 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); | 99 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); |
99 | layout->addWidget( b, i / 13, i % 13); | 100 | layout->addWidget( b, i / 13, i % 13); |
100 | } | 101 | } |
101 | 102 | ||
102 | QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); | 103 | QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); |
103 | a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); | 104 | a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); |
104 | connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); | 105 | connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); |
105 | a->addTo( jumpBar ); | 106 | a->addTo( jumpBar ); |
106 | jumpBar->hide(); | 107 | jumpBar->hide(); |
107 | 108 | ||
108 | // Packages menu | 109 | // Packages menu |
109 | QPopupMenu *popup = new QPopupMenu( this ); | 110 | QPopupMenu *popup = new QPopupMenu( this ); |
110 | 111 | ||
111 | a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); | 112 | a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); |
112 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); | 113 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); |
113 | connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); | 114 | connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); |
114 | a->addTo( popup ); | 115 | a->addTo( popup ); |
115 | a->addTo( bar ); | 116 | a->addTo( bar ); |
116 | 117 | ||
117 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); | 118 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); |
118 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); | 119 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); |
119 | connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); | 120 | connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); |
120 | actionUpgrade->addTo( popup ); | 121 | actionUpgrade->addTo( popup ); |
121 | actionUpgrade->addTo( bar ); | 122 | actionUpgrade->addTo( bar ); |
122 | 123 | ||
123 | iconDownload = Resource::loadPixmap( "aqpkg/download" ); | 124 | iconDownload = Resource::loadPixmap( "aqpkg/download" ); |
124 | iconRemove = Resource::loadPixmap( "aqpkg/remove" ); | 125 | iconRemove = Resource::loadPixmap( "aqpkg/remove" ); |
125 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); | 126 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
126 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | 127 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); |
127 | connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); | 128 | connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); |
128 | actionDownload->addTo( popup ); | 129 | actionDownload->addTo( popup ); |
129 | actionDownload->addTo( bar ); | 130 | actionDownload->addTo( bar ); |
130 | 131 | ||
131 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); | 132 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); |
132 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); | 133 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); |
133 | connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); | 134 | connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); |
134 | a->addTo( popup ); | 135 | a->addTo( popup ); |
135 | a->addTo( bar ); | 136 | a->addTo( bar ); |
136 | 137 | ||
137 | popup->insertSeparator(); | 138 | popup->insertSeparator(); |
138 | 139 | ||
139 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); | 140 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); |
140 | a->setWhatsThis( tr( "Click here to configure this application." ) ); | 141 | a->setWhatsThis( tr( "Click here to configure this application." ) ); |
141 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); | 142 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); |
142 | a->addTo( popup ); | 143 | a->addTo( popup ); |
143 | mb->insertItem( tr( "Actions" ), popup ); | 144 | mb->insertItem( tr( "Actions" ), popup ); |
144 | 145 | ||
145 | // View menu | 146 | // View menu |
146 | popup = new QPopupMenu( this ); | 147 | popup = new QPopupMenu( this ); |
147 | 148 | ||
148 | actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); | 149 | actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); |
149 | actionUninstalled->setToggleAction( TRUE ); | 150 | actionUninstalled->setToggleAction( TRUE ); |
150 | actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); | 151 | actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); |
151 | connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); | 152 | connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); |
152 | actionUninstalled->addTo( popup ); | 153 | actionUninstalled->addTo( popup ); |
153 | 154 | ||
154 | actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); | 155 | actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); |
155 | actionInstalled->setToggleAction( TRUE ); | 156 | actionInstalled->setToggleAction( TRUE ); |
156 | actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); | 157 | actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); |
157 | connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); | 158 | connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); |
158 | actionInstalled->addTo( popup ); | 159 | actionInstalled->addTo( popup ); |
159 | 160 | ||
160 | actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); | 161 | actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); |
161 | actionUpdated->setToggleAction( TRUE ); | 162 | actionUpdated->setToggleAction( TRUE ); |
162 | actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); | 163 | actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); |
163 | connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); | 164 | connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); |
164 | actionUpdated->addTo( popup ); | 165 | actionUpdated->addTo( popup ); |
165 | 166 | ||
166 | popup->insertSeparator(); | 167 | popup->insertSeparator(); |
167 | 168 | ||
168 | actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); | 169 | actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); |
169 | actionFilter->setToggleAction( TRUE ); | 170 | actionFilter->setToggleAction( TRUE ); |
170 | actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); | 171 | actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); |
171 | connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); | 172 | connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); |
172 | actionFilter->addTo( popup ); | 173 | actionFilter->addTo( popup ); |
173 | 174 | ||
174 | a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); | 175 | a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); |
175 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); | 176 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); |
176 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); | 177 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); |
177 | a->addTo( popup ); | 178 | a->addTo( popup ); |
178 | 179 | ||
179 | popup->insertSeparator(); | 180 | popup->insertSeparator(); |
180 | 181 | ||
181 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 182 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
182 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); | 183 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); |
183 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); | 184 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); |
184 | a->addTo( popup ); | 185 | a->addTo( popup ); |
185 | 186 | ||
186 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); | 187 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); |
187 | actionFindNext->setEnabled( FALSE ); | 188 | actionFindNext->setEnabled( FALSE ); |
188 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); | 189 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); |
189 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); | 190 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); |
190 | actionFindNext->addTo( popup ); | 191 | actionFindNext->addTo( popup ); |
191 | actionFindNext->addTo( findBar ); | 192 | actionFindNext->addTo( findBar ); |
192 | 193 | ||
193 | 194 | ||
194 | popup->insertSeparator(); | 195 | popup->insertSeparator(); |
195 | 196 | ||
196 | a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); | 197 | a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); |
197 | a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); | 198 | a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); |
198 | connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); | 199 | connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); |
199 | a->addTo( popup ); | 200 | a->addTo( popup ); |
200 | 201 | ||
201 | mb->insertItem( tr( "View" ), popup ); | 202 | mb->insertItem( tr( "View" ), popup ); |
202 | 203 | ||
203 | // Finish find toolbar creation | 204 | // Finish find toolbar creation |
204 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 205 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
205 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); | 206 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); |
206 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); | 207 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); |
207 | a->addTo( findBar ); | 208 | a->addTo( findBar ); |
208 | findBar->hide(); | 209 | findBar->hide(); |
209 | 210 | ||
210 | // Create widget stack and add UI widgets | 211 | // Create widget stack and add UI widgets |
211 | stack = new QWidgetStack( this ); | 212 | stack = new QWidgetStack( this ); |
212 | stack->addWidget( progressWindow, 2 ); | 213 | stack->addWidget( progressWindow, 2 ); |
213 | stack->addWidget( networkPkgWindow, 1 ); | 214 | stack->addWidget( networkPkgWindow, 1 ); |
214 | setCentralWidget( stack ); | 215 | setCentralWidget( stack ); |
215 | stack->raiseWidget( progressWindow ); | 216 | stack->raiseWidget( progressWindow ); |
216 | 217 | ||
217 | // Delayed call to finish initialization | 218 | // Delayed call to finish initialization |
218 | QTimer::singleShot( 100, this, SLOT( init() ) ); | 219 | QTimer::singleShot( 100, this, SLOT( init() ) ); |
219 | } | 220 | } |
220 | 221 | ||
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() |
254 | { | 258 | { |
255 | progressWindow = new QWidget( this ); | 259 | progressWindow = new QWidget( this ); |
256 | 260 | ||
257 | QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); | 261 | QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); |
258 | 262 | ||
259 | m_status = new QLabel( progressWindow ); | 263 | m_status = new QLabel( progressWindow ); |
260 | m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | 264 | m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); |
261 | layout->addWidget( m_status ); | 265 | layout->addWidget( m_status ); |
262 | 266 | ||
263 | m_progress = new QProgressBar( progressWindow ); | 267 | m_progress = new QProgressBar( progressWindow ); |
264 | layout->addWidget( m_progress ); | 268 | layout->addWidget( m_progress ); |
265 | } | 269 | } |
266 | 270 | ||
267 | void MainWindow :: init() | 271 | void MainWindow :: init() |
268 | { | 272 | { |
269 | #ifdef QWS | 273 | #ifdef QWS |
270 | // read download directory from config file | 274 | // read download directory from config file |
271 | Config cfg( "aqpkg" ); | 275 | Config cfg( "aqpkg" ); |
272 | cfg.setGroup( "settings" ); | 276 | cfg.setGroup( "settings" ); |
273 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); | 277 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); |
274 | // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); | 278 | // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); |
275 | 279 | ||
276 | #endif | 280 | #endif |
277 | 281 | ||
278 | stack->raiseWidget( progressWindow ); | 282 | stack->raiseWidget( progressWindow ); |
279 | 283 | ||
280 | mgr = new DataManager(); | 284 | mgr = new DataManager(); |
281 | connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); | 285 | connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); |
282 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), | 286 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), |
283 | this, SLOT( setProgressMessage( const QString & ) ) ); | 287 | this, SLOT( setProgressMessage( const QString & ) ) ); |
284 | connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); | 288 | connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); |
285 | mgr->loadServers(); | 289 | mgr->loadServers(); |
286 | 290 | ||
287 | showUninstalledPkgs = false; | 291 | showUninstalledPkgs = false; |
288 | showInstalledPkgs = false; | 292 | showInstalledPkgs = false; |
289 | showUpgradedPkgs = false; | 293 | showUpgradedPkgs = false; |
290 | categoryFilterEnabled = false; | 294 | categoryFilterEnabled = false; |
291 | 295 | ||
292 | updateData(); | 296 | updateData(); |
293 | 297 | ||
294 | stack->raiseWidget( networkPkgWindow ); | 298 | stack->raiseWidget( networkPkgWindow ); |
295 | } | 299 | } |
296 | /* | 300 | /* |
297 | void MainWindow :: setDocument( const QString &doc ) | 301 | void MainWindow :: setDocument( const QString &doc ) |
298 | { | 302 | { |
299 | // Remove path from package | 303 | // Remove path from package |
300 | QString package = Utils::getPackageNameFromIpkFilename( doc ); | 304 | QString package = Utils::getPackageNameFromIpkFilename( doc ); |
301 | // std::cout << "Selecting package " << package << std::endl; | 305 | // std::cout << "Selecting package " << package << std::endl; |
302 | 306 | ||
303 | // First select local server | 307 | // First select local server |
304 | for ( int i = 0 ; i < serversList->count() ; ++i ) | 308 | for ( int i = 0 ; i < serversList->count() ; ++i ) |
305 | { | 309 | { |
306 | if ( serversList->text( i ) == LOCAL_IPKGS ) | 310 | if ( serversList->text( i ) == LOCAL_IPKGS ) |
307 | { | 311 | { |
308 | serversList->setCurrentItem( i ); | 312 | serversList->setCurrentItem( i ); |
309 | break; | 313 | break; |
310 | } | 314 | } |
311 | } | 315 | } |
312 | serverSelected( 0 ); | 316 | serverSelected( 0 ); |
313 | 317 | ||
314 | // Now set the check box of the selected package | 318 | // Now set the check box of the selected package |
315 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 319 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
316 | item != 0 ; | 320 | item != 0 ; |
317 | item = (QCheckListItem *)item->nextSibling() ) | 321 | item = (QCheckListItem *)item->nextSibling() ) |
318 | { | 322 | { |
319 | if ( item->text().startsWith( package ) ) | 323 | if ( item->text().startsWith( package ) ) |
320 | { | 324 | { |
321 | item->setOn( true ); | 325 | item->setOn( true ); |
322 | break; | 326 | break; |
323 | } | 327 | } |
324 | } | 328 | } |
325 | } | 329 | } |
326 | */ | 330 | */ |
327 | void MainWindow :: displaySettings() | 331 | void MainWindow :: displaySettings() |
328 | { | 332 | { |
329 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); | 333 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); |
330 | if ( dlg->showDlg() ) | 334 | if ( dlg->showDlg() ) |
331 | { | 335 | { |
332 | stack->raiseWidget( progressWindow ); | 336 | stack->raiseWidget( progressWindow ); |
333 | updateData(); | 337 | updateData(); |
334 | stack->raiseWidget( networkPkgWindow ); | 338 | stack->raiseWidget( networkPkgWindow ); |
335 | } | 339 | } |
336 | delete dlg; | 340 | delete dlg; |
337 | } | 341 | } |
338 | 342 | ||
339 | void MainWindow :: closeEvent( QCloseEvent *e ) | 343 | void MainWindow :: closeEvent( QCloseEvent *e ) |
340 | { | 344 | { |
341 | // If install dialog is visible, return to main view, otherwise close app | 345 | // If install dialog is visible, return to main view, otherwise close app |
342 | QWidget *widget = stack->visibleWidget(); | 346 | QWidget *widget = stack->visibleWidget(); |
343 | 347 | ||
344 | if ( widget != networkPkgWindow && widget != progressWindow ) | 348 | if ( widget != networkPkgWindow && widget != progressWindow ) |
345 | { | 349 | { |
346 | if ( widget ) delete widget; | 350 | if ( widget ) delete widget; |
347 | stack->raiseWidget( networkPkgWindow ); | 351 | stack->raiseWidget( networkPkgWindow ); |
348 | e->ignore(); | 352 | e->ignore(); |
349 | } | 353 | } |
350 | else | 354 | else |
351 | { | 355 | { |
352 | e->accept(); | 356 | e->accept(); |
353 | } | 357 | } |
354 | } | 358 | } |
355 | 359 | ||
356 | void MainWindow :: displayFindBar() | 360 | void MainWindow :: displayFindBar() |
357 | { | 361 | { |
358 | findBar->show(); | 362 | findBar->show(); |
359 | findEdit->setFocus(); | 363 | findEdit->setFocus(); |
360 | } | 364 | } |
361 | 365 | ||
362 | void MainWindow :: displayJumpBar() | 366 | void MainWindow :: displayJumpBar() |
363 | { | 367 | { |
364 | jumpBar->show(); | 368 | jumpBar->show(); |
365 | } | 369 | } |
366 | 370 | ||
367 | void MainWindow :: repeatFind() | 371 | void MainWindow :: repeatFind() |
368 | { | 372 | { |
369 | searchForPackage( findEdit->text() ); | 373 | searchForPackage( findEdit->text() ); |
@@ -546,299 +550,262 @@ void MainWindow :: updateData() | |||
546 | { | 550 | { |
547 | server = it.current(); | 551 | server = it.current(); |
548 | serverName = server->getServerName(); | 552 | serverName = server->getServerName(); |
549 | m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) ); | 553 | m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) ); |
550 | m_progress->setProgress( i ); | 554 | m_progress->setProgress( i ); |
551 | qApp->processEvents(); | 555 | qApp->processEvents(); |
552 | 556 | ||
553 | // cout << "Adding " << it->getServerName() << " to combobox" << endl; | 557 | // cout << "Adding " << it->getServerName() << " to combobox" << endl; |
554 | if ( !server->isServerActive() ) | 558 | if ( !server->isServerActive() ) |
555 | { | 559 | { |
556 | // cout << serverName << " is not active" << endl; | 560 | // cout << serverName << " is not active" << endl; |
557 | i--; | 561 | i--; |
558 | continue; | 562 | continue; |
559 | } | 563 | } |
560 | 564 | ||
561 | serversList->insertItem( serverName ); | 565 | serversList->insertItem( serverName ); |
562 | if ( serverName == currentlySelectedServer ) | 566 | if ( serverName == currentlySelectedServer ) |
563 | activeItem = i; | 567 | activeItem = i; |
564 | } | 568 | } |
565 | 569 | ||
566 | // set selected server to be active server | 570 | // set selected server to be active server |
567 | if ( activeItem != -1 ) | 571 | if ( activeItem != -1 ) |
568 | serversList->setCurrentItem( activeItem ); | 572 | serversList->setCurrentItem( activeItem ); |
569 | serverSelected( 0, FALSE ); | 573 | serverSelected( 0, FALSE ); |
570 | } | 574 | } |
571 | 575 | ||
572 | void MainWindow :: serverSelected( int index ) | 576 | void MainWindow :: serverSelected( int index ) |
573 | { | 577 | { |
574 | serverSelected( index, TRUE ); | 578 | serverSelected( index, TRUE ); |
575 | } | 579 | } |
576 | 580 | ||
577 | void MainWindow :: serverSelected( int, bool raiseProgress ) | 581 | void MainWindow :: serverSelected( int, bool raiseProgress ) |
578 | { | 582 | { |
579 | QPixmap nullIcon( installedIcon.size() ); | 583 | QPixmap nullIcon( installedIcon.size() ); |
580 | nullIcon.fill( colorGroup().base() ); | 584 | nullIcon.fill( colorGroup().base() ); |
581 | 585 | ||
582 | // display packages | 586 | // display packages |
583 | QString serverName = serversList->currentText(); | 587 | QString serverName = serversList->currentText(); |
584 | currentlySelectedServer = serverName; | 588 | currentlySelectedServer = serverName; |
585 | 589 | ||
586 | Server *s = mgr->getServer( serverName ); | 590 | Server *s = mgr->getServer( serverName ); |
587 | 591 | ||
588 | QList<Package> &list = s->getPackageList(); | 592 | QList<Package> &list = s->getPackageList(); |
589 | QListIterator<Package> it( list ); | 593 | QListIterator<Package> it( list ); |
590 | 594 | ||
591 | // Display progress widget while loading list | 595 | // Display progress widget while loading list |
592 | bool doProgress = ( list.count() > 200 ); | 596 | bool doProgress = ( list.count() > 200 ); |
593 | if ( doProgress ) | 597 | if ( doProgress ) |
594 | { | 598 | { |
595 | if ( raiseProgress ) | 599 | if ( raiseProgress ) |
596 | { | 600 | { |
597 | stack->raiseWidget( progressWindow ); | 601 | stack->raiseWidget( progressWindow ); |
598 | } | 602 | } |
599 | m_progress->setTotalSteps( list.count() ); | 603 | m_progress->setTotalSteps( list.count() ); |
600 | m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); | 604 | m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); |
601 | } | 605 | } |
602 | 606 | ||
603 | packagesList->clear(); | 607 | packagesList->clear(); |
604 | 608 | ||
605 | #ifdef QWS | 609 | #ifdef QWS |
606 | // read download directory from config file | 610 | // read download directory from config file |
607 | Config cfg( "aqpkg" ); | 611 | Config cfg( "aqpkg" ); |
608 | cfg.setGroup( "settings" ); | 612 | cfg.setGroup( "settings" ); |
609 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); | 613 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); |
610 | #endif | 614 | #endif |
611 | 615 | ||
612 | int i = 0; | 616 | int i = 0; |
613 | Package *package; | 617 | Package *package; |
614 | for ( ; it.current(); ++it ) | 618 | for ( ; it.current(); ++it ) |
615 | { | 619 | { |
616 | // Update progress after every 100th package (arbitrary value, seems to give good balance) | 620 | // Update progress after every 100th package (arbitrary value, seems to give good balance) |
617 | i++; | 621 | i++; |
618 | if ( ( i % 100 ) == 0 ) | 622 | if ( ( i % 100 ) == 0 ) |
619 | { | 623 | { |
620 | if ( doProgress ) | 624 | if ( doProgress ) |
621 | { | 625 | { |
622 | m_progress->setProgress( i ); | 626 | m_progress->setProgress( i ); |
623 | } | 627 | } |
624 | qApp->processEvents(); | 628 | qApp->processEvents(); |
625 | } | 629 | } |
626 | 630 | ||
627 | QString text = ""; | 631 | QString text = ""; |
628 | 632 | ||
629 | package = it.current(); | 633 | package = it.current(); |
630 | 634 | ||
631 | // Apply show only uninstalled packages filter | 635 | // Apply show only uninstalled packages filter |
632 | if ( showUninstalledPkgs && package->isInstalled() ) | 636 | if ( showUninstalledPkgs && package->isInstalled() ) |
633 | continue; | 637 | continue; |
634 | 638 | ||
635 | // Apply show only installed packages filter | 639 | // Apply show only installed packages filter |
636 | if ( showInstalledPkgs && !package->isInstalled() ) | 640 | if ( showInstalledPkgs && !package->isInstalled() ) |
637 | continue; | 641 | continue; |
638 | 642 | ||
639 | // Apply show only new installed packages filter | 643 | // Apply show only new installed packages filter |
640 | if ( showUpgradedPkgs ) | 644 | if ( showUpgradedPkgs ) |
641 | { | 645 | { |
642 | if ( !package->isInstalled() || !package->getNewVersionAvailable() ) | 646 | if ( !package->isInstalled() || !package->getNewVersionAvailable() ) |
643 | continue; | 647 | continue; |
644 | } | 648 | } |
645 | 649 | ||
646 | // Apply the section filter | 650 | // Apply the section filter |
647 | if ( categoryFilterEnabled && categoryFilter != "" ) | 651 | if ( categoryFilterEnabled && categoryFilter != "" ) |
648 | { | 652 | { |
649 | if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 ) | 653 | if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 ) |
650 | continue; | 654 | continue; |
651 | } | 655 | } |
652 | 656 | ||
653 | // If the local server, only display installed packages | 657 | // If the local server, only display installed packages |
654 | if ( serverName == LOCAL_SERVER && !package->isInstalled() ) | 658 | if ( serverName == LOCAL_SERVER && !package->isInstalled() ) |
655 | continue; | 659 | continue; |
656 | 660 | ||
657 | 661 | ||
658 | QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), | 662 | QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), |
659 | QCheckListItem::CheckBox ); | 663 | QCheckListItem::CheckBox ); |
660 | 664 | ||
661 | if ( package->isInstalled() ) | 665 | if ( package->isInstalled() ) |
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; |
729 | actionUpgrade->setEnabled( FALSE ); | 696 | actionUpgrade->setEnabled( FALSE ); |
730 | } | 697 | } |
731 | else | 698 | else |
732 | { | 699 | { |
733 | downloadEnabled = TRUE; | 700 | downloadEnabled = TRUE; |
734 | actionUpgrade->setEnabled( TRUE ); | 701 | actionUpgrade->setEnabled( TRUE ); |
735 | } | 702 | } |
736 | enableDownload( downloadEnabled ); | 703 | enableDownload( downloadEnabled ); |
737 | 704 | ||
738 | // Display this widget once everything is done | 705 | // Display this widget once everything is done |
739 | if ( doProgress && raiseProgress ) | 706 | if ( doProgress && raiseProgress ) |
740 | { | 707 | { |
741 | stack->raiseWidget( networkPkgWindow ); | 708 | stack->raiseWidget( networkPkgWindow ); |
742 | } | 709 | } |
743 | } | 710 | } |
744 | 711 | ||
745 | void MainWindow :: searchForPackage( const QString &text ) | 712 | void MainWindow :: searchForPackage( const QString &text ) |
746 | { | 713 | { |
747 | if ( !text.isEmpty() ) | 714 | if ( !text.isEmpty() ) |
748 | { | 715 | { |
749 | // cout << "searching for " << text << endl; | 716 | // cout << "searching for " << text << endl; |
750 | // look through package list for text startng at current position | 717 | // look through package list for text startng at current position |
751 | // vector<InstallData> workingPackages; | 718 | // vector<InstallData> workingPackages; |
752 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 719 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
753 | // if ( start != 0 ) | 720 | // if ( start != 0 ) |
754 | // start = (QCheckListItem *)start->nextSibling(); | 721 | // start = (QCheckListItem *)start->nextSibling(); |
755 | 722 | ||
756 | if ( start == 0 ) | 723 | if ( start == 0 ) |
757 | start = (QCheckListItem *)packagesList->firstChild(); | 724 | start = (QCheckListItem *)packagesList->firstChild(); |
758 | 725 | ||
759 | for ( QCheckListItem *item = start; item != 0 ; | 726 | for ( QCheckListItem *item = start; item != 0 ; |
760 | item = (QCheckListItem *)item->nextSibling() ) | 727 | item = (QCheckListItem *)item->nextSibling() ) |
761 | { | 728 | { |
762 | // cout << "checking " << item->text().lower() << endl; | 729 | // cout << "checking " << item->text().lower() << endl; |
763 | if ( item->text().lower().find( text ) != -1 ) | 730 | if ( item->text().lower().find( text ) != -1 ) |
764 | { | 731 | { |
765 | // cout << "matched " << item->text() << endl; | 732 | // cout << "matched " << item->text() << endl; |
766 | packagesList->ensureItemVisible( item ); | 733 | packagesList->ensureItemVisible( item ); |
767 | packagesList->setCurrentItem( item ); | 734 | packagesList->setCurrentItem( item ); |
768 | break; | 735 | break; |
769 | } | 736 | } |
770 | } | 737 | } |
771 | } | 738 | } |
772 | } | 739 | } |
773 | 740 | ||
774 | void MainWindow :: updateServer() | 741 | void MainWindow :: updateServer() |
775 | { | 742 | { |
776 | QString serverName = serversList->currentText(); | 743 | QString serverName = serversList->currentText(); |
777 | 744 | ||
778 | // Update the current server | 745 | // Update the current server |
779 | // Display dialog | 746 | // Display dialog |
780 | 747 | ||
781 | // Disable buttons to stop silly people clicking lots on them :) | 748 | // Disable buttons to stop silly people clicking lots on them :) |
782 | 749 | ||
783 | // First, write out ipkg_conf file so that ipkg can use it | 750 | // First, write out ipkg_conf file so that ipkg can use it |
784 | mgr->writeOutIpkgConf(); | 751 | mgr->writeOutIpkgConf(); |
785 | 752 | ||
786 | Ipkg *ipkg = new Ipkg; | 753 | Ipkg *ipkg = new Ipkg; |
787 | ipkg->setOption( "update" ); | 754 | ipkg->setOption( "update" ); |
788 | 755 | ||
789 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), | 756 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), |
790 | tr( "Update lists" ) ); | 757 | tr( "Update lists" ) ); |
791 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | 758 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
792 | stack->addWidget( dlg, 3 ); | 759 | stack->addWidget( dlg, 3 ); |
793 | stack->raiseWidget( dlg ); | 760 | stack->raiseWidget( dlg ); |
794 | 761 | ||
795 | // delete progDlg; | 762 | // delete progDlg; |
796 | } | 763 | } |
797 | 764 | ||
798 | void MainWindow :: upgradePackages() | 765 | void MainWindow :: upgradePackages() |
799 | { | 766 | { |
800 | // We're gonna do an upgrade of all packages | 767 | // We're gonna do an upgrade of all packages |
801 | // First warn user that this isn't recommended | 768 | // First warn user that this isn't recommended |
802 | // TODO - ODevice???? | 769 | // TODO - ODevice???? |
803 | QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); | 770 | QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); |
804 | QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, | 771 | QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, |
805 | QMessageBox::Yes, | 772 | QMessageBox::Yes, |
806 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , | 773 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , |
807 | 0, this ); | 774 | 0, this ); |
808 | warn.adjustSize(); | 775 | warn.adjustSize(); |
809 | 776 | ||
810 | if ( warn.exec() == QMessageBox::Yes ) | 777 | if ( warn.exec() == QMessageBox::Yes ) |
811 | { | 778 | { |
812 | // First, write out ipkg_conf file so that ipkg can use it | 779 | // First, write out ipkg_conf file so that ipkg can use it |
813 | mgr->writeOutIpkgConf(); | 780 | mgr->writeOutIpkgConf(); |
814 | 781 | ||
815 | // Now run upgrade | 782 | // Now run upgrade |
816 | Ipkg *ipkg = new Ipkg; | 783 | Ipkg *ipkg = new Ipkg; |
817 | ipkg->setOption( "upgrade" ); | 784 | ipkg->setOption( "upgrade" ); |
818 | 785 | ||
819 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), | 786 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), |
820 | tr ( "Upgrade" ) ); | 787 | tr ( "Upgrade" ) ); |
821 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | 788 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
822 | stack->addWidget( dlg, 3 ); | 789 | stack->addWidget( dlg, 3 ); |
823 | stack->raiseWidget( dlg ); | 790 | stack->raiseWidget( dlg ); |
824 | } | 791 | } |
825 | } | 792 | } |
826 | 793 | ||
827 | void MainWindow :: downloadPackage() | 794 | void MainWindow :: downloadPackage() |
828 | { | 795 | { |
829 | bool doUpdate = true; | 796 | bool doUpdate = true; |
830 | if ( downloadEnabled ) | 797 | if ( downloadEnabled ) |
831 | { | 798 | { |
832 | // See if any packages are selected | 799 | // See if any packages are selected |
833 | bool found = false; | 800 | bool found = false; |
834 | if ( serversList->currentText() != LOCAL_SERVER ) | 801 | if ( serversList->currentText() != LOCAL_SERVER ) |
835 | { | 802 | { |
836 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 803 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
837 | item != 0 && !found; | 804 | item != 0 && !found; |
838 | item = (QCheckListItem *)item->nextSibling() ) | 805 | item = (QCheckListItem *)item->nextSibling() ) |
839 | { | 806 | { |
840 | if ( item->isOn() ) | 807 | if ( item->isOn() ) |
841 | found = true; | 808 | found = true; |
842 | } | 809 | } |
843 | } | 810 | } |
844 | 811 | ||
@@ -1057,128 +1024,135 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1057 | if ( p->isPackageStoredLocally() && val == -1 ) | 1024 | if ( p->isPackageStoredLocally() && val == -1 ) |
1058 | val = 0; | 1025 | val = 0; |
1059 | 1026 | ||
1060 | if ( val == -2 ) | 1027 | if ( val == -2 ) |
1061 | { | 1028 | { |
1062 | // Error - should handle | 1029 | // Error - should handle |
1063 | } | 1030 | } |
1064 | else if ( val == -1 ) | 1031 | else if ( val == -1 ) |
1065 | { | 1032 | { |
1066 | // Version available is older - remove only | 1033 | // Version available is older - remove only |
1067 | newitem->option = "D"; | 1034 | newitem->option = "D"; |
1068 | } | 1035 | } |
1069 | else | 1036 | else |
1070 | { | 1037 | { |
1071 | QString caption; | 1038 | QString caption; |
1072 | QString text; | 1039 | QString text; |
1073 | QString secondButton; | 1040 | QString secondButton; |
1074 | QString secondOption; | 1041 | QString secondOption; |
1075 | if ( val == 0 ) | 1042 | if ( val == 0 ) |
1076 | { | 1043 | { |
1077 | // Version available is the same - option to remove or reinstall | 1044 | // Version available is the same - option to remove or reinstall |
1078 | caption = tr( "Do you wish to remove or reinstall\n%1?" ); | 1045 | caption = tr( "Do you wish to remove or reinstall\n%1?" ); |
1079 | text = tr( "Remove or ReInstall" ); | 1046 | text = tr( "Remove or ReInstall" ); |
1080 | secondButton = tr( "ReInstall" ); | 1047 | secondButton = tr( "ReInstall" ); |
1081 | secondOption = tr( "R" ); | 1048 | secondOption = tr( "R" ); |
1082 | } | 1049 | } |
1083 | else if ( val == 1 ) | 1050 | else if ( val == 1 ) |
1084 | { | 1051 | { |
1085 | // Version available is newer - option to remove or upgrade | 1052 | // Version available is newer - option to remove or upgrade |
1086 | caption = tr( "Do you wish to remove or upgrade\n%1?" ); | 1053 | caption = tr( "Do you wish to remove or upgrade\n%1?" ); |
1087 | text = tr( "Remove or Upgrade" ); | 1054 | text = tr( "Remove or Upgrade" ); |
1088 | secondButton = tr( "Upgrade" ); | 1055 | secondButton = tr( "Upgrade" ); |
1089 | secondOption = tr( "U" ); | 1056 | secondOption = tr( "U" ); |
1090 | } | 1057 | } |
1091 | 1058 | ||
1092 | // Sticky option not implemented yet, but will eventually allow | 1059 | // Sticky option not implemented yet, but will eventually allow |
1093 | // the user to say something like 'remove all' | 1060 | // the user to say something like 'remove all' |
1094 | if ( stickyOption == "" ) | 1061 | if ( stickyOption == "" ) |
1095 | { | 1062 | { |
1096 | QString msgtext; | 1063 | QString msgtext; |
1097 | msgtext = caption.arg( ( const char * )name ); | 1064 | msgtext = caption.arg( ( const char * )name ); |
1098 | switch( QMessageBox::information( this, text, | 1065 | switch( QMessageBox::information( this, text, |
1099 | msgtext, tr( "Remove" ), secondButton ) ) | 1066 | msgtext, tr( "Remove" ), secondButton ) ) |
1100 | { | 1067 | { |
1101 | case 0: // Try again or Enter | 1068 | case 0: // Try again or Enter |
1102 | // option 0 = Remove | 1069 | // option 0 = Remove |
1103 | newitem->option = "D"; | 1070 | newitem->option = "D"; |
1104 | break; | 1071 | break; |
1105 | case 1: // Quit or Escape | 1072 | case 1: // Quit or Escape |
1106 | newitem->option = secondOption; | 1073 | newitem->option = secondOption; |
1107 | break; | 1074 | break; |
1108 | } | 1075 | } |
1109 | } | 1076 | } |
1110 | else | 1077 | else |
1111 | { | 1078 | { |
1112 | // newitem->option = stickyOption; | 1079 | // newitem->option = stickyOption; |
1113 | } | 1080 | } |
1114 | } | 1081 | } |
1115 | 1082 | ||
1116 | 1083 | ||
1117 | // Check if we are reinstalling the same version | 1084 | // Check if we are reinstalling the same version |
1118 | if ( newitem->option != "R" ) | 1085 | if ( newitem->option != "R" ) |
1119 | newitem->recreateLinks = true; | 1086 | newitem->recreateLinks = true; |
1120 | else | 1087 | else |
1121 | newitem->recreateLinks = false; | 1088 | newitem->recreateLinks = false; |
1122 | 1089 | ||
1123 | // User hit cancel (on dlg - assume remove) | 1090 | // User hit cancel (on dlg - assume remove) |
1124 | return newitem; | 1091 | return newitem; |
1125 | } | 1092 | } |
1126 | } | 1093 | } |
1127 | 1094 | ||
1128 | void MainWindow :: reloadData( InstallDlgImpl *dlg ) | 1095 | void MainWindow :: reloadData( InstallDlgImpl *dlg ) |
1129 | { | 1096 | { |
1130 | stack->raiseWidget( progressWindow ); | 1097 | stack->raiseWidget( progressWindow ); |
1131 | 1098 | ||
1132 | if ( dlg ) | 1099 | if ( dlg ) |
1133 | { | 1100 | { |
1134 | dlg->close(); | 1101 | dlg->close(); |
1135 | delete dlg; | 1102 | delete dlg; |
1136 | } | 1103 | } |
1137 | 1104 | ||
1138 | mgr->reloadServerData(); | 1105 | mgr->reloadServerData(); |
1139 | serverSelected( -1, FALSE ); | 1106 | serverSelected( -1, FALSE ); |
1140 | 1107 | ||
1141 | #ifdef QWS | 1108 | #ifdef QWS |
1142 | m_status->setText( tr( "Updating Launcher..." ) ); | 1109 | m_status->setText( tr( "Updating Launcher..." ) ); |
1143 | 1110 | ||
1144 | // Finally let the main system update itself | 1111 | // Finally let the main system update itself |
1145 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 1112 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
1146 | QString lf = QString::null; | 1113 | QString lf = QString::null; |
1147 | e << lf; | 1114 | e << lf; |
1148 | #endif | 1115 | #endif |
1149 | 1116 | ||
1150 | stack->raiseWidget( networkPkgWindow ); | 1117 | stack->raiseWidget( networkPkgWindow ); |
1151 | } | 1118 | } |
1152 | 1119 | ||
1153 | void MainWindow :: letterPushed( QString t ) | 1120 | void MainWindow :: letterPushed( QString t ) |
1154 | { | 1121 | { |
1155 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); | 1122 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); |
1156 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 1123 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
1157 | if ( packagesList->firstChild() == 0 ) | 1124 | if ( packagesList->firstChild() == 0 ) |
1158 | return; | 1125 | return; |
1159 | 1126 | ||
1160 | QCheckListItem *item; | 1127 | QCheckListItem *item; |
1161 | if ( start == 0 ) | 1128 | if ( start == 0 ) |
1162 | { | 1129 | { |
1163 | item = (QCheckListItem *)packagesList->firstChild(); | 1130 | item = (QCheckListItem *)packagesList->firstChild(); |
1164 | start = top; | 1131 | start = top; |
1165 | } | 1132 | } |
1166 | else | 1133 | else |
1167 | item = (QCheckListItem *)start->nextSibling(); | 1134 | item = (QCheckListItem *)start->nextSibling(); |
1168 | 1135 | ||
1169 | if ( item == 0 ) | 1136 | if ( item == 0 ) |
1170 | item = (QCheckListItem *)packagesList->firstChild(); | 1137 | item = (QCheckListItem *)packagesList->firstChild(); |
1171 | do | 1138 | do |
1172 | { | 1139 | { |
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 | } | ||
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index 4b044de..0295519 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h | |||
@@ -1,139 +1,141 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | mainwin.h - description | 2 | mainwin.h - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Aug 26 13:32:30 BST 2002 | 4 | begin : Mon Aug 26 13:32:30 BST 2002 |
5 | copyright : (C) 2002 by Andy Qua | 5 | copyright : (C) 2002 by Andy Qua |
6 | email : andy.qua@blueyonder.co.uk | 6 | email : andy.qua@blueyonder.co.uk |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #ifndef MAINWIN_H | 18 | #ifndef MAINWIN_H |
19 | #define MAINWIN_H | 19 | #define MAINWIN_H |
20 | 20 | ||
21 | #include <qmainwindow.h> | 21 | #include <qmainwindow.h> |
22 | #include <qpixmap.h> | 22 | #include <qpixmap.h> |
23 | 23 | ||
24 | class DataManager; | 24 | class DataManager; |
25 | class InstallData; | 25 | class InstallData; |
26 | class InstallDlgImpl; | 26 | class InstallDlgImpl; |
27 | 27 | ||
28 | class QAction; | 28 | class QAction; |
29 | class QCheckListItem; | 29 | class QCheckListItem; |
30 | class QComboBox; | 30 | class QComboBox; |
31 | class QLabel; | 31 | class QLabel; |
32 | class QLineEdit; | 32 | class QLineEdit; |
33 | class QListView; | 33 | class QListView; |
34 | class QListViewItem; | ||
34 | class QToolBar; | 35 | class QToolBar; |
35 | class QProgressBar; | 36 | class QProgressBar; |
36 | class QWidgetStack; | 37 | class QWidgetStack; |
37 | 38 | ||
38 | class MainWindow :public QMainWindow | 39 | class MainWindow :public QMainWindow |
39 | { | 40 | { |
40 | Q_OBJECT | 41 | Q_OBJECT |
41 | public: | 42 | public: |
42 | 43 | ||
43 | MainWindow(); | 44 | MainWindow(); |
44 | ~MainWindow(); | 45 | ~MainWindow(); |
45 | 46 | ||
46 | protected: | 47 | protected: |
47 | void closeEvent( QCloseEvent* e ); | 48 | void closeEvent( QCloseEvent* e ); |
48 | 49 | ||
49 | private: | 50 | private: |
50 | DataManager *mgr; | 51 | DataManager *mgr; |
51 | 52 | ||
52 | QWidgetStack *stack; | 53 | QWidgetStack *stack; |
53 | 54 | ||
54 | QToolBar *findBar; | 55 | QToolBar *findBar; |
55 | QToolBar *jumpBar; | 56 | QToolBar *jumpBar; |
56 | QLineEdit *findEdit; | 57 | QLineEdit *findEdit; |
57 | QAction *actionFindNext; | 58 | QAction *actionFindNext; |
58 | QAction *actionFilter; | 59 | QAction *actionFilter; |
59 | QAction *actionUpgrade; | 60 | QAction *actionUpgrade; |
60 | QAction *actionDownload; | 61 | QAction *actionDownload; |
61 | QAction *actionUninstalled; | 62 | QAction *actionUninstalled; |
62 | QAction *actionInstalled; | 63 | QAction *actionInstalled; |
63 | QAction *actionUpdated; | 64 | QAction *actionUpdated; |
64 | 65 | ||
65 | QPixmap iconDownload; | 66 | QPixmap iconDownload; |
66 | QPixmap iconRemove; | 67 | QPixmap iconRemove; |
67 | 68 | ||
68 | int mnuShowUninstalledPkgsId; | 69 | int mnuShowUninstalledPkgsId; |
69 | int mnuShowInstalledPkgsId; | 70 | int mnuShowInstalledPkgsId; |
70 | int mnuShowUpgradedPkgsId; | 71 | int mnuShowUpgradedPkgsId; |
71 | int mnuFilterByCategory; | 72 | int mnuFilterByCategory; |
72 | int mnuSetFilterCategory; | 73 | int mnuSetFilterCategory; |
73 | 74 | ||
74 | // Main package list widget | 75 | // Main package list widget |
75 | QWidget *networkPkgWindow; | 76 | QWidget *networkPkgWindow; |
76 | QComboBox *serversList; | 77 | QComboBox *serversList; |
77 | QListView *packagesList; | 78 | QListView *packagesList; |
78 | QPixmap installedIcon; | 79 | QPixmap installedIcon; |
79 | QPixmap updatedIcon; | 80 | QPixmap updatedIcon; |
80 | QString currentlySelectedServer; | 81 | QString currentlySelectedServer; |
81 | QString categoryFilter; | 82 | QString categoryFilter; |
82 | QString stickyOption; | 83 | QString stickyOption; |
83 | 84 | ||
84 | bool categoryFilterEnabled; | 85 | bool categoryFilterEnabled; |
85 | bool showJumpTo; | 86 | bool showJumpTo; |
86 | bool showUninstalledPkgs; | 87 | bool showUninstalledPkgs; |
87 | bool showInstalledPkgs; | 88 | bool showInstalledPkgs; |
88 | bool showUpgradedPkgs; | 89 | bool showUpgradedPkgs; |
89 | bool downloadEnabled; | 90 | bool downloadEnabled; |
90 | 91 | ||
91 | void initMainWidget(); | 92 | void initMainWidget(); |
92 | void updateData(); | 93 | void updateData(); |
93 | void serverSelected( int index, bool showProgress ); | 94 | void serverSelected( int index, bool showProgress ); |
94 | void searchForPackage( const QString & ); | 95 | void searchForPackage( const QString & ); |
95 | bool filterByCategory( bool val ); | 96 | bool filterByCategory( bool val ); |
96 | void downloadSelectedPackages(); | 97 | void downloadSelectedPackages(); |
97 | void downloadRemotePackage(); | 98 | void downloadRemotePackage(); |
98 | InstallData *dealWithItem( QCheckListItem *item ); | 99 | InstallData *dealWithItem( QCheckListItem *item ); |
99 | 100 | ||
100 | // Progress widget | 101 | // Progress widget |
101 | QWidget *progressWindow; | 102 | QWidget *progressWindow; |
102 | QLabel *m_status; | 103 | QLabel *m_status; |
103 | QProgressBar *m_progress; | 104 | QProgressBar *m_progress; |
104 | 105 | ||
105 | void initProgressWidget(); | 106 | void initProgressWidget(); |
106 | 107 | ||
107 | public slots: | 108 | public slots: |
108 | // void setDocument( const QString &doc ); | 109 | // void setDocument( const QString &doc ); |
109 | void displayFindBar(); | 110 | void displayFindBar(); |
110 | void displayJumpBar(); | 111 | void displayJumpBar(); |
111 | void repeatFind(); | 112 | void repeatFind(); |
112 | void findPackage( const QString & ); | 113 | void findPackage( const QString & ); |
113 | void hideFindBar(); | 114 | void hideFindBar(); |
114 | void hideJumpBar(); | 115 | void hideJumpBar(); |
115 | void displaySettings(); | 116 | void displaySettings(); |
116 | void filterUninstalledPackages(); | 117 | void filterUninstalledPackages(); |
117 | void filterInstalledPackages(); | 118 | void filterInstalledPackages(); |
118 | void filterUpgradedPackages(); | 119 | void filterUpgradedPackages(); |
119 | void filterCategory(); | 120 | void filterCategory(); |
120 | bool setFilterCategory(); | 121 | bool setFilterCategory(); |
121 | void raiseMainWidget(); | 122 | void raiseMainWidget(); |
122 | void raiseProgressWidget(); | 123 | void raiseProgressWidget(); |
123 | void enableUpgrade( bool ); | 124 | void enableUpgrade( bool ); |
124 | void enableDownload( bool ); | 125 | void enableDownload( bool ); |
125 | void reloadData( InstallDlgImpl * ); | 126 | void reloadData( InstallDlgImpl * ); |
126 | 127 | ||
127 | private slots: | 128 | private slots: |
128 | void init(); | 129 | void init(); |
129 | void setProgressSteps( int ); | 130 | void setProgressSteps( int ); |
130 | void setProgressMessage( const QString & ); | 131 | void setProgressMessage( const QString & ); |
131 | void updateProgress( int ); | 132 | void updateProgress( int ); |
132 | void serverSelected( int index ); | 133 | void serverSelected( int index ); |
133 | void updateServer(); | 134 | void updateServer(); |
134 | void upgradePackages(); | 135 | void upgradePackages(); |
135 | void downloadPackage(); | 136 | void downloadPackage(); |
136 | void applyChanges(); | 137 | void applyChanges(); |
137 | void letterPushed( QString t ); | 138 | void letterPushed( QString t ); |
139 | void slotDisplayPackage( QListViewItem * ); | ||
138 | }; | 140 | }; |
139 | #endif | 141 | #endif |
diff --git a/noncore/settings/aqpkg/packagewin.cpp b/noncore/settings/aqpkg/packagewin.cpp new file mode 100644 index 0000000..f00453e --- a/dev/null +++ b/noncore/settings/aqpkg/packagewin.cpp | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. | ||
4 | .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #include "packagewin.h" | ||
30 | #include "package.h" | ||
31 | #include "datamgr.h" | ||
32 | |||
33 | #include <qpe/resource.h> | ||
34 | |||
35 | #include <qlabel.h> | ||
36 | #include <qlayout.h> | ||
37 | #include <qpushbutton.h> | ||
38 | #include <qstring.h> | ||
39 | |||
40 | PackageWindow::PackageWindow( Package *package, const QString &server ) | ||
41 | : QWidget( 0, 0, 0 ) | ||
42 | { | ||
43 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 4 ); | ||
44 | QString str; | ||
45 | if ( package ) | ||
46 | { | ||
47 | setCaption( package->getPackageName() ); | ||
48 | QString destName; | ||
49 | if ( package->getLocalPackage() ) | ||
50 | { | ||
51 | if ( package->getLocalPackage()->getInstalledTo() ) | ||
52 | destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); | ||
53 | } | ||
54 | else | ||
55 | { | ||
56 | if ( package->getInstalledTo() ) | ||
57 | destName = package->getInstalledTo()->getDestinationName(); | ||
58 | } | ||
59 | |||
60 | if ( !package->isPackageStoredLocally() ) | ||
61 | { | ||
62 | str.append( tr( "<b>Description</b> - " ) ); | ||
63 | str.append( package->getDescription() ); | ||
64 | if ( !destName.isNull() ) | ||
65 | { | ||
66 | str.append( tr( "<p><b>Installed To</b> - " ) ); | ||
67 | str.append( destName ); | ||
68 | } | ||
69 | str.append( tr( "<p><b>Size</b> - " ) ); | ||
70 | str.append( package->getPackageSize() ); | ||
71 | str.append( tr( "<p><b>Section</b> - " ) ); | ||
72 | str.append( package->getSection() ); | ||
73 | } | ||
74 | else | ||
75 | { | ||
76 | str.append( tr( "<p><b>Filename</b> - " ) ); | ||
77 | str.append( package->getFilename() ); | ||
78 | } | ||
79 | |||
80 | if ( server == LOCAL_SERVER ) | ||
81 | { | ||
82 | str.append( tr( "<p><b>Version Installed</b> - " ) ); | ||
83 | str.append( package->getVersion() ); | ||
84 | } | ||
85 | else | ||
86 | { | ||
87 | str.append( tr( "<p><b>Version Available</b> - " ) ); | ||
88 | str.append( package->getVersion() ); | ||
89 | if ( package->getLocalPackage() ) | ||
90 | { | ||
91 | if ( package->isInstalled() ) | ||
92 | { | ||
93 | str.append( tr( "<p><b>Version Installed</b> - " ) ); | ||
94 | str.append( package->getInstalledVersion() ); | ||
95 | } | ||
96 | } | ||
97 | } | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | setCaption( tr( "Package Information" ) ); | ||
102 | str = tr( "Package information is unavailable" ); | ||
103 | } | ||
104 | |||
105 | QLabel *l = new QLabel( str, this ); | ||
106 | l->setTextFormat( Qt::RichText ); | ||
107 | l->setAlignment( Qt::AlignLeft | Qt::AlignVCenter | Qt::WordBreak ); | ||
108 | layout->addWidget( l ); | ||
109 | |||
110 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "enter" ), tr( "Close" ), this ); | ||
111 | layout->addWidget( btn ); | ||
112 | connect( btn, SIGNAL( clicked() ), this, SLOT( close() ) ); | ||
113 | |||
114 | } | ||
115 | |||
116 | PackageWindow::~PackageWindow() | ||
117 | { | ||
118 | } | ||
119 | |||
diff --git a/noncore/settings/aqpkg/packagewin.h b/noncore/settings/aqpkg/packagewin.h new file mode 100644 index 0000000..c1943b5 --- a/dev/null +++ b/noncore/settings/aqpkg/packagewin.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. | ||
4 | .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #ifndef PACKAGEWIN_H | ||
30 | #define PACKAGEWIN_H | ||
31 | |||
32 | #include <qwidget.h> | ||
33 | |||
34 | class Package; | ||
35 | |||
36 | class PackageWindow :public QWidget | ||
37 | { | ||
38 | Q_OBJECT | ||
39 | public: | ||
40 | |||
41 | PackageWindow( Package * = 0x0, const QString & = QString::null ); | ||
42 | ~PackageWindow(); | ||
43 | }; | ||
44 | |||
45 | #endif \ No newline at end of file | ||