-rw-r--r-- | noncore/settings/aqpkg/main.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 216 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 18 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 46 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.h | 9 |
5 files changed, 194 insertions, 97 deletions
diff --git a/noncore/settings/aqpkg/main.cpp b/noncore/settings/aqpkg/main.cpp index 1f8cf42..53c392e 100644 --- a/noncore/settings/aqpkg/main.cpp +++ b/noncore/settings/aqpkg/main.cpp | |||
@@ -49,9 +49,9 @@ int main(int argc, char *argv[]) | |||
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | MainWindow *win = new MainWindow(); | 51 | MainWindow *win = new MainWindow(); |
52 | a.setMainWidget(win); | 52 | a.setMainWidget(win); |
53 | win->show(); | 53 | win->showMaximized(); |
54 | 54 | ||
55 | a.exec(); | 55 | a.exec(); |
56 | 56 | ||
57 | #ifdef QWS | 57 | #ifdef QWS |
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index e577285..4aa83b5 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -17,12 +17,18 @@ | |||
17 | 17 | ||
18 | #include <iostream> | 18 | #include <iostream> |
19 | using namespace std; | 19 | using namespace std; |
20 | 20 | ||
21 | #include <qpe/qpemenubar.h> | ||
22 | #include <qpe/qpetoolbar.h> | ||
23 | #include <qpe/resource.h> | ||
24 | |||
25 | #include <qaction.h> | ||
21 | #include <qmenubar.h> | 26 | #include <qmenubar.h> |
22 | #include <qmessagebox.h> | 27 | #include <qmessagebox.h> |
23 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
24 | #include <qtimer.h> | 29 | #include <qtimer.h> |
30 | #include <qwidgetstack.h> | ||
25 | 31 | ||
26 | #include "mainwin.h" | 32 | #include "mainwin.h" |
27 | #include "progresswidget.h" | 33 | #include "progresswidget.h" |
28 | #include "datamgr.h" | 34 | #include "datamgr.h" |
@@ -31,65 +37,135 @@ using namespace std; | |||
31 | #include "helpwindow.h" | 37 | #include "helpwindow.h" |
32 | #include "utils.h" | 38 | #include "utils.h" |
33 | #include "global.h" | 39 | #include "global.h" |
34 | 40 | ||
35 | MainWindow :: MainWindow( QWidget *p, char *name ) | 41 | MainWindow :: MainWindow() |
36 | :QMainWindow( p, name ) | 42 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) |
37 | { | 43 | { |
38 | #ifdef QWS | ||
39 | showMaximized(); | ||
40 | #endif | ||
41 | |||
42 | setCaption( tr( "AQPkg - Package Manager" ) ); | 44 | setCaption( tr( "AQPkg - Package Manager" ) ); |
43 | 45 | ||
44 | // Create our menu | 46 | // Create UI widgets |
45 | help = new QPopupMenu( this ); | 47 | progressWindow = new ProgressWidget( this ); |
46 | help->insertItem( tr( "General" ), this, SLOT(displayHelp()) ); | 48 | networkPkgWindow = new NetworkPackageManager( this ); |
47 | help->insertItem( tr( "About" ), this, SLOT(displayAbout()) ); | 49 | |
48 | 50 | // Build menu and tool bars | |
49 | settings = new QPopupMenu( this ); | 51 | setToolBarsMovable( FALSE ); |
50 | settings->insertItem( tr( "Settings" ), this, SLOT(displaySettings()) ); | 52 | |
51 | 53 | QPEToolBar *bar = new QPEToolBar( this ); | |
52 | edit = new QPopupMenu( this ); | 54 | bar->setHorizontalStretchable( TRUE ); |
53 | edit->insertItem( tr( "Find" ), this, SLOT(searchForPackage()) ); | 55 | QPEMenuBar *mb = new QPEMenuBar( bar ); |
54 | edit->insertItem( tr( "Find Next" ), this, SLOT(repeatSearchForPackage()) ); | 56 | mb->setMargin( 0 ); |
55 | 57 | bar = new QPEToolBar( this ); | |
56 | filter = new QPopupMenu( this ); | 58 | |
57 | mnuShowUninstalledPkgsId = filter->insertItem( tr( "Show Non-Installed Packages" ), this, SLOT(filterUninstalledPackages()) ); | 59 | // Packages menu |
58 | mnuShowInstalledPkgsId = filter->insertItem( tr( "Show Installed Packages" ), this, SLOT(filterInstalledPackages()) ); | 60 | QPopupMenu *popup = new QPopupMenu( this ); |
59 | mnuShowUpgradedPkgsId = filter->insertItem( tr( "Show Updated Packages" ), this, SLOT(filterUpgradedPackages()) ); | 61 | |
60 | filter->insertSeparator(); | 62 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); |
61 | mnuFilterByCategory = filter->insertItem( tr( "Filter By Category" ), this, SLOT(filterCategory()) ); | 63 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); |
62 | mnuSetFilterCategory = filter->insertItem( tr( "Set Filter Category" ), this, SLOT(setFilterCategory()) ); | 64 | connect( a, SIGNAL( activated() ), networkPkgWindow, SLOT( updateServer() ) ); |
63 | 65 | a->addTo( popup ); | |
64 | // Create the main menu | 66 | a->addTo( bar ); |
65 | menu = menuBar(); //new QMenuBar( this ); | 67 | |
66 | menu->insertItem( tr( "Settings" ), settings ); | 68 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); |
67 | menu->insertItem( tr( "Edit" ), edit ); | 69 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); |
68 | menu->insertItem( tr( "Filter" ), filter ); | 70 | connect( actionUpgrade, SIGNAL( activated() ), networkPkgWindow, SLOT( upgradePackages() ) ); |
69 | menu->insertItem( tr( "Help" ), help ); | 71 | actionUpgrade->addTo( popup ); |
70 | 72 | actionUpgrade->addTo( bar ); | |
71 | // Create UI widgets | 73 | |
72 | stack = new QWidgetStack( this ); | 74 | iconDownload = Resource::loadPixmap( "aqpkg/download" ); |
73 | 75 | iconRemove = Resource::loadPixmap( "aqpkg/remove" ); | |
74 | progressWindow = new ProgressWidget( stack ); | 76 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
75 | stack->addWidget( progressWindow, 2 ); | 77 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); |
76 | 78 | connect( actionDownload, SIGNAL( activated() ), networkPkgWindow, SLOT( downloadPackage() ) ); | |
77 | networkPkgWindow = new NetworkPackageManager( stack ); | 79 | actionDownload->addTo( popup ); |
78 | connect( networkPkgWindow, SIGNAL( appRaiseMainWidget() ), this, SLOT( raiseMainWidget() ) ); | 80 | actionDownload->addTo( bar ); |
79 | connect( networkPkgWindow, SIGNAL( appRaiseProgressWidget() ), this, SLOT( raiseProgressWidget() ) ); | 81 | |
80 | connect( networkPkgWindow, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); | 82 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); |
81 | connect( networkPkgWindow, SIGNAL( progressSetMessage( const QString & ) ), | 83 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); |
82 | progressWindow, SLOT( setMessage( const QString & ) ) ); | 84 | connect( a, SIGNAL( activated() ), networkPkgWindow, SLOT( applyChanges() ) ); |
83 | connect( networkPkgWindow, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); | 85 | a->addTo( popup ); |
84 | stack->addWidget( networkPkgWindow, 1 ); | 86 | a->addTo( bar ); |
85 | 87 | ||
86 | setCentralWidget( stack ); | 88 | mb->insertItem( tr( "Packages" ), popup ); |
87 | stack->raiseWidget( progressWindow ); | 89 | |
88 | 90 | // Search menu | |
89 | // Delayed call to finish initialization | 91 | popup = new QPopupMenu( this ); |
90 | QTimer::singleShot( 100, this, SLOT( init() ) ); | 92 | |
91 | 93 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | |
94 | a->setWhatsThis( tr( "Click here to search for a specific package." ) ); | ||
95 | connect( a, SIGNAL( activated() ), this, SLOT( searchForPackage() ) ); | ||
96 | a->addTo( popup ); | ||
97 | |||
98 | a = new QAction( tr( "Find next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); | ||
99 | a->setWhatsThis( tr( "Click here to search for the next package." ) ); | ||
100 | connect( a, SIGNAL( activated() ), this, SLOT( repeatSearchForPackage() ) ); | ||
101 | a->addTo( popup ); | ||
102 | |||
103 | // Show 'quick jump' keypad? | ||
104 | |||
105 | popup->insertSeparator(); | ||
106 | |||
107 | a = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); | ||
108 | a->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); | ||
109 | connect( a, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); | ||
110 | a->addTo( popup ); | ||
111 | |||
112 | a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); | ||
113 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); | ||
114 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); | ||
115 | a->addTo( popup ); | ||
116 | |||
117 | mb->insertItem( tr( "Search" ), popup ); | ||
118 | |||
119 | |||
120 | // View menu | ||
121 | popup = new QPopupMenu( this ); | ||
122 | |||
123 | a = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); | ||
124 | a->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); | ||
125 | connect( a, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); | ||
126 | a->addTo( popup ); | ||
127 | |||
128 | a = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); | ||
129 | a->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); | ||
130 | connect( a, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); | ||
131 | a->addTo( popup ); | ||
132 | |||
133 | a = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); | ||
134 | a->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); | ||
135 | connect( a, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); | ||
136 | a->addTo( popup ); | ||
137 | |||
138 | popup->insertSeparator(); | ||
139 | |||
140 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 ); | ||
141 | a->setWhatsThis( tr( "Click here to configure this application." ) ); | ||
142 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); | ||
143 | a->addTo( popup ); | ||
144 | |||
145 | popup->insertSeparator(); | ||
146 | |||
147 | a = new QAction( tr( "Help" ), Resource::loadPixmap( "help_icon" ), QString::null, 0, this, 0 ); | ||
148 | a->setWhatsThis( tr( "Click here for help." ) ); | ||
149 | connect( a, SIGNAL( activated() ), this, SLOT( displayHelp() ) ); | ||
150 | a->addTo( popup ); | ||
151 | |||
152 | a = new QAction( tr( "About" ), Resource::loadPixmap( "UtilsIcon" ), QString::null, 0, this, 0 ); | ||
153 | a->setWhatsThis( tr( "Click here for software version information." ) ); | ||
154 | connect( a, SIGNAL( activated() ), this, SLOT( displayAbout() ) ); | ||
155 | a->addTo( popup ); | ||
156 | |||
157 | mb->insertItem( tr( "View" ), popup ); | ||
158 | |||
159 | // Create widget stack and add UI widgets | ||
160 | stack = new QWidgetStack( this ); | ||
161 | stack->addWidget( progressWindow, 2 ); | ||
162 | stack->addWidget( networkPkgWindow, 1 ); | ||
163 | setCentralWidget( stack ); | ||
164 | stack->raiseWidget( progressWindow ); | ||
165 | |||
166 | // Delayed call to finish initialization | ||
167 | QTimer::singleShot( 100, this, SLOT( init() ) ); | ||
92 | } | 168 | } |
93 | 169 | ||
94 | MainWindow :: ~MainWindow() | 170 | MainWindow :: ~MainWindow() |
95 | { | 171 | { |
@@ -98,16 +174,27 @@ MainWindow :: ~MainWindow() | |||
98 | 174 | ||
99 | void MainWindow :: init() | 175 | void MainWindow :: init() |
100 | { | 176 | { |
101 | stack->raiseWidget( progressWindow ); | 177 | stack->raiseWidget( progressWindow ); |
178 | |||
102 | mgr = new DataManager(); | 179 | mgr = new DataManager(); |
103 | connect( mgr, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); | 180 | connect( mgr, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); |
104 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), | 181 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), |
105 | progressWindow, SLOT( setMessage( const QString & ) ) ); | 182 | progressWindow, SLOT( setMessage( const QString & ) ) ); |
106 | connect( mgr, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); | 183 | connect( mgr, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); |
107 | mgr->loadServers(); | 184 | mgr->loadServers(); |
185 | |||
108 | networkPkgWindow->setDataManager( mgr ); | 186 | networkPkgWindow->setDataManager( mgr ); |
109 | networkPkgWindow->updateData(); | 187 | networkPkgWindow->updateData(); |
188 | connect( networkPkgWindow, SIGNAL( appRaiseMainWidget() ), this, SLOT( raiseMainWidget() ) ); | ||
189 | connect( networkPkgWindow, SIGNAL( appRaiseProgressWidget() ), this, SLOT( raiseProgressWidget() ) ); | ||
190 | connect( networkPkgWindow, SIGNAL( appEnableUpgrade( bool ) ), this, SLOT( enableUpgrade( bool ) ) ); | ||
191 | connect( networkPkgWindow, SIGNAL( appEnableDownload( bool ) ), this, SLOT( enableDownload( bool ) ) ); | ||
192 | connect( networkPkgWindow, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); | ||
193 | connect( networkPkgWindow, SIGNAL( progressSetMessage( const QString & ) ), | ||
194 | progressWindow, SLOT( setMessage( const QString & ) ) ); | ||
195 | connect( networkPkgWindow, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); | ||
196 | |||
110 | stack->raiseWidget( networkPkgWindow ); | 197 | stack->raiseWidget( networkPkgWindow ); |
111 | } | 198 | } |
112 | 199 | ||
113 | void MainWindow :: setDocument( const QString &doc ) | 200 | void MainWindow :: setDocument( const QString &doc ) |
@@ -244,4 +331,25 @@ void MainWindow :: raiseMainWidget() | |||
244 | void MainWindow :: raiseProgressWidget() | 331 | void MainWindow :: raiseProgressWidget() |
245 | { | 332 | { |
246 | stack->raiseWidget( progressWindow ); | 333 | stack->raiseWidget( progressWindow ); |
247 | } | 334 | } |
335 | |||
336 | void MainWindow :: enableUpgrade( bool enabled ) | ||
337 | { | ||
338 | actionUpgrade->setEnabled( enabled ); | ||
339 | } | ||
340 | |||
341 | void MainWindow :: enableDownload( bool enabled ) | ||
342 | { | ||
343 | if ( enabled ) | ||
344 | { | ||
345 | actionDownload->setIconSet( iconDownload ); | ||
346 | actionDownload->setText( tr( "Download" ) ); | ||
347 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | ||
348 | } | ||
349 | else | ||
350 | { | ||
351 | actionDownload->setIconSet( iconRemove ); | ||
352 | actionDownload->setText( tr( "Remove" ) ); | ||
353 | actionDownload->setWhatsThis( tr( "Click here to uninstall the currently selected package(s)." ) ); | ||
354 | } | ||
355 | } | ||
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index 39799f9..028ef5b 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h | |||
@@ -18,10 +18,14 @@ | |||
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 <qwidgetstack.h> | 22 | #include <qpixmap.h> |
23 | //#include <qwidgetstack.h> | ||
23 | 24 | ||
25 | class QWidgetStack; | ||
26 | class QPEToolBar; | ||
27 | class QAction; | ||
24 | class ProgressWidget; | 28 | class ProgressWidget; |
25 | class NetworkPackageManager; | 29 | class NetworkPackageManager; |
26 | class DataManager; | 30 | class DataManager; |
27 | 31 | ||
@@ -29,9 +33,9 @@ class MainWindow :public QMainWindow | |||
29 | { | 33 | { |
30 | Q_OBJECT | 34 | Q_OBJECT |
31 | public: | 35 | public: |
32 | 36 | ||
33 | MainWindow( QWidget *p = 0, char *name = 0 ); | 37 | MainWindow(); |
34 | ~MainWindow(); | 38 | ~MainWindow(); |
35 | 39 | ||
36 | private: | 40 | private: |
37 | DataManager *mgr; | 41 | DataManager *mgr; |
@@ -40,10 +44,14 @@ private: | |||
40 | QPopupMenu *help; | 44 | QPopupMenu *help; |
41 | QPopupMenu *settings; | 45 | QPopupMenu *settings; |
42 | QPopupMenu *edit; | 46 | QPopupMenu *edit; |
43 | QPopupMenu *filter; | 47 | QPopupMenu *filter; |
44 | QWidgetStack *stack; | 48 | QWidgetStack *stack; |
45 | 49 | QAction *actionUpgrade; | |
50 | QAction *actionDownload; | ||
51 | QPixmap iconDownload; | ||
52 | QPixmap iconRemove; | ||
53 | |||
46 | NetworkPackageManager *networkPkgWindow; | 54 | NetworkPackageManager *networkPkgWindow; |
47 | ProgressWidget *progressWindow; | 55 | ProgressWidget *progressWindow; |
48 | 56 | ||
49 | int mnuShowUninstalledPkgsId; | 57 | int mnuShowUninstalledPkgsId; |
@@ -65,8 +73,10 @@ public slots: | |||
65 | void filterCategory(); | 73 | void filterCategory(); |
66 | void setFilterCategory(); | 74 | void setFilterCategory(); |
67 | void raiseMainWidget(); | 75 | void raiseMainWidget(); |
68 | void raiseProgressWidget(); | 76 | void raiseProgressWidget(); |
77 | void enableUpgrade( bool ); | ||
78 | void enableDownload( bool ); | ||
69 | 79 | ||
70 | private slots: | 80 | private slots: |
71 | void init(); | 81 | void init(); |
72 | }; | 82 | }; |
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index ee37157..91afe02 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp | |||
@@ -64,11 +64,8 @@ NetworkPackageManager::NetworkPackageManager( QWidget *parent, const char *name | |||
64 | showUpgradedPkgs = false; | 64 | showUpgradedPkgs = false; |
65 | categoryFilterEnabled = false; | 65 | categoryFilterEnabled = false; |
66 | 66 | ||
67 | initGui(); | 67 | initGui(); |
68 | setupConnections(); | ||
69 | |||
70 | //updateData(); | ||
71 | } | 68 | } |
72 | 69 | ||
73 | NetworkPackageManager::~NetworkPackageManager() | 70 | NetworkPackageManager::~NetworkPackageManager() |
74 | { | 71 | { |
@@ -146,13 +143,11 @@ void NetworkPackageManager :: selectLocalPackage( const QString &pkg ) | |||
146 | void NetworkPackageManager :: initGui() | 143 | void NetworkPackageManager :: initGui() |
147 | { | 144 | { |
148 | QLabel *l = new QLabel( tr( "Servers" ), this ); | 145 | QLabel *l = new QLabel( tr( "Servers" ), this ); |
149 | serversList = new QComboBox( this ); | 146 | serversList = new QComboBox( this ); |
147 | connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); | ||
148 | |||
150 | packagesList = new QListView( this ); | 149 | packagesList = new QListView( this ); |
151 | update = new QPushButton( tr( "Refresh Lists" ), this ); | ||
152 | download = new QPushButton( tr( "Download" ), this ); | ||
153 | upgrade = new QPushButton( tr( "Upgrade" ), this ); | ||
154 | apply = new QPushButton( tr( "Apply" ), this ); | ||
155 | 150 | ||
156 | QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1 ); | 151 | QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1 ); |
157 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); | 152 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); |
158 | hbox1->addWidget( l ); | 153 | hbox1->addWidget( l ); |
@@ -179,23 +174,10 @@ void NetworkPackageManager :: initGui() | |||
179 | } | 174 | } |
180 | 175 | ||
181 | vbox->addWidget( packagesList ); | 176 | vbox->addWidget( packagesList ); |
182 | packagesList->addColumn( tr( "Packages" ) ); | 177 | packagesList->addColumn( tr( "Packages" ) ); |
183 | 178 | ||
184 | QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1 ); | 179 | downloadEnabled = TRUE; |
185 | hbox2->addWidget( update ); | ||
186 | hbox2->addWidget( download ); | ||
187 | hbox2->addWidget( upgrade ); | ||
188 | hbox2->addWidget( apply ); | ||
189 | } | ||
190 | |||
191 | void NetworkPackageManager :: setupConnections() | ||
192 | { | ||
193 | connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); | ||
194 | connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) ); | ||
195 | connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) ); | ||
196 | connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) ); | ||
197 | connect( update, SIGNAL(released()), this, SLOT(updateServer()) ); | ||
198 | } | 180 | } |
199 | 181 | ||
200 | void NetworkPackageManager :: serverSelected( int index ) | 182 | void NetworkPackageManager :: serverSelected( int index ) |
201 | { | 183 | { |
@@ -339,24 +321,22 @@ void NetworkPackageManager :: serverSelected( int, bool raiseProgress ) | |||
339 | 321 | ||
340 | // If the local server or the local ipkgs server disable the download button | 322 | // If the local server or the local ipkgs server disable the download button |
341 | if ( serverName == LOCAL_SERVER ) | 323 | if ( serverName == LOCAL_SERVER ) |
342 | { | 324 | { |
343 | upgrade->setEnabled( false ); | 325 | downloadEnabled = TRUE; |
344 | download->setText( tr( "Download" ) ); | 326 | emit appEnableUpgrade( FALSE ); |
345 | download->setEnabled( true ); | ||
346 | } | 327 | } |
347 | else if ( serverName == LOCAL_IPKGS ) | 328 | else if ( serverName == LOCAL_IPKGS ) |
348 | { | 329 | { |
349 | upgrade->setEnabled( false ); | 330 | downloadEnabled = FALSE; |
350 | download->setEnabled( true ); | 331 | emit appEnableUpgrade( FALSE ); |
351 | download->setText( tr( "Remove" ) ); | ||
352 | } | 332 | } |
353 | else | 333 | else |
354 | { | 334 | { |
355 | upgrade->setEnabled( true ); | 335 | downloadEnabled = TRUE; |
356 | download->setEnabled( true ); | 336 | emit appEnableUpgrade( TRUE ); |
357 | download->setText( tr( "Download" ) ); | ||
358 | } | 337 | } |
338 | emit appEnableDownload( downloadEnabled ); | ||
359 | 339 | ||
360 | // Display this widget once everything is done | 340 | // Display this widget once everything is done |
361 | if ( doProgress && raiseProgress ) | 341 | if ( doProgress && raiseProgress ) |
362 | { | 342 | { |
@@ -420,9 +400,9 @@ void NetworkPackageManager :: upgradePackages() | |||
420 | 400 | ||
421 | void NetworkPackageManager :: downloadPackage() | 401 | void NetworkPackageManager :: downloadPackage() |
422 | { | 402 | { |
423 | bool doUpdate = true; | 403 | bool doUpdate = true; |
424 | if ( download->text() == tr( "Download" ) ) | 404 | if ( downloadEnabled ) |
425 | { | 405 | { |
426 | // See if any packages are selected | 406 | // See if any packages are selected |
427 | bool found = false; | 407 | bool found = false; |
428 | if ( serversList->currentText() != LOCAL_SERVER ) | 408 | if ( serversList->currentText() != LOCAL_SERVER ) |
@@ -444,9 +424,9 @@ void NetworkPackageManager :: downloadPackage() | |||
444 | else | 424 | else |
445 | downloadRemotePackage(); | 425 | downloadRemotePackage(); |
446 | 426 | ||
447 | } | 427 | } |
448 | else if ( download->text() == tr( "Remove" ) ) | 428 | else |
449 | { | 429 | { |
450 | doUpdate = false; | 430 | doUpdate = false; |
451 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 431 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
452 | item != 0 ; | 432 | item != 0 ; |
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h index 6b552ee..efef898 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.h +++ b/noncore/settings/aqpkg/networkpkgmgr.h | |||
@@ -52,12 +52,8 @@ private: | |||
52 | DataManager *dataMgr; | 52 | DataManager *dataMgr; |
53 | 53 | ||
54 | QComboBox *serversList; | 54 | QComboBox *serversList; |
55 | QListView *packagesList; | 55 | QListView *packagesList; |
56 | QPushButton *update; | ||
57 | QPushButton *upgrade; | ||
58 | QPushButton *download; | ||
59 | QPushButton *apply; | ||
60 | 56 | ||
61 | QString currentlySelectedServer; | 57 | QString currentlySelectedServer; |
62 | QString lastSearchText; | 58 | QString lastSearchText; |
63 | QString categoryFilter; | 59 | QString categoryFilter; |
@@ -67,10 +63,11 @@ private: | |||
67 | bool showUninstalledPkgs; | 63 | bool showUninstalledPkgs; |
68 | bool showInstalledPkgs; | 64 | bool showInstalledPkgs; |
69 | bool showUpgradedPkgs; | 65 | bool showUpgradedPkgs; |
70 | 66 | ||
67 | bool downloadEnabled; | ||
68 | |||
71 | void initGui(); | 69 | void initGui(); |
72 | void setupConnections(); | ||
73 | void showProgressDialog( char *initialText ); | 70 | void showProgressDialog( char *initialText ); |
74 | void downloadSelectedPackages(); | 71 | void downloadSelectedPackages(); |
75 | void downloadRemotePackage(); | 72 | void downloadRemotePackage(); |
76 | void serverSelected( int index, bool showProgress ); | 73 | void serverSelected( int index, bool showProgress ); |
@@ -80,8 +77,10 @@ private: | |||
80 | 77 | ||
81 | signals: | 78 | signals: |
82 | void appRaiseMainWidget(); | 79 | void appRaiseMainWidget(); |
83 | void appRaiseProgressWidget(); | 80 | void appRaiseProgressWidget(); |
81 | void appEnableUpgrade( bool ); | ||
82 | void appEnableDownload( bool ); | ||
84 | void progressSetSteps( int ); | 83 | void progressSetSteps( int ); |
85 | void progressSetMessage( const QString & ); | 84 | void progressSetMessage( const QString & ); |
86 | void progressUpdate( int ); | 85 | void progressUpdate( int ); |
87 | 86 | ||