author | andyq <andyq> | 2002-10-25 09:50:52 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-10-25 09:50:52 (UTC) |
commit | 2f2c23d398b6a47bd06aaf329a55bb455cf5ddd1 (patch) (unidiff) | |
tree | 4322eef1f6306763b3bc0332b6e57c05a24341d9 | |
parent | 4a2f6dd634aa277bca3818f090d691844e219f64 (diff) | |
download | opie-2f2c23d398b6a47bd06aaf329a55bb455cf5ddd1.zip opie-2f2c23d398b6a47bd06aaf329a55bb455cf5ddd1.tar.gz opie-2f2c23d398b6a47bd06aaf329a55bb455cf5ddd1.tar.bz2 |
Modified so that you can click on a package in the documents view and
the Local IPKGS view is shown and the selected package checked
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 9 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 1 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 31 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.h | 1 |
4 files changed, 40 insertions, 2 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 206d11c..9f19dfa 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -1,86 +1,95 @@ | |||
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 <qmenubar.h> | 18 | #include <qmenubar.h> |
19 | #include <qpopupmenu.h> | 19 | #include <qpopupmenu.h> |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | 21 | ||
22 | #include "mainwin.h" | 22 | #include "mainwin.h" |
23 | #include "datamgr.h" | 23 | #include "datamgr.h" |
24 | #include "networkpkgmgr.h" | 24 | #include "networkpkgmgr.h" |
25 | #include "settingsimpl.h" | 25 | #include "settingsimpl.h" |
26 | #include "helpwindow.h" | 26 | #include "helpwindow.h" |
27 | #include "utils.h" | ||
27 | #include "global.h" | 28 | #include "global.h" |
28 | 29 | ||
29 | MainWindow :: MainWindow( QWidget *p, char *name ) | 30 | MainWindow :: MainWindow( QWidget *p, char *name ) |
30 | :QMainWindow( p, name ) | 31 | :QMainWindow( p, name ) |
31 | { | 32 | { |
32 | #ifdef QWS | 33 | #ifdef QWS |
33 | showMaximized(); | 34 | showMaximized(); |
34 | #endif | 35 | #endif |
35 | 36 | ||
36 | setCaption( "AQPkg - Package Manager" ); | 37 | setCaption( "AQPkg - Package Manager" ); |
37 | 38 | ||
38 | // Create our menu | 39 | // Create our menu |
39 | QPopupMenu *help = new QPopupMenu( this ); | 40 | QPopupMenu *help = new QPopupMenu( this ); |
40 | help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_H ); | 41 | help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_H ); |
41 | help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); | 42 | help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); |
42 | 43 | ||
43 | QPopupMenu *settings = new QPopupMenu( this ); | 44 | QPopupMenu *settings = new QPopupMenu( this ); |
44 | settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); | 45 | settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); |
45 | 46 | ||
46 | // Create the main menu | 47 | // Create the main menu |
47 | QMenuBar *menu = menuBar(); //new QMenuBar( this ); | 48 | QMenuBar *menu = menuBar(); //new QMenuBar( this ); |
48 | menu->insertItem( "&Settings", settings ); | 49 | menu->insertItem( "&Settings", settings ); |
49 | menu->insertItem( "&Help", help ); | 50 | menu->insertItem( "&Help", help ); |
50 | 51 | ||
51 | mgr = new DataManager(); | 52 | mgr = new DataManager(); |
52 | mgr->loadServers(); | 53 | mgr->loadServers(); |
53 | 54 | ||
54 | stack = new QWidgetStack( this ); | 55 | stack = new QWidgetStack( this ); |
55 | 56 | ||
56 | networkPkgWindow = new NetworkPackageManager( mgr, stack ); | 57 | networkPkgWindow = new NetworkPackageManager( mgr, stack ); |
57 | stack->addWidget( networkPkgWindow, 1 ); | 58 | stack->addWidget( networkPkgWindow, 1 ); |
58 | 59 | ||
59 | setCentralWidget( stack ); | 60 | setCentralWidget( stack ); |
60 | stack->raiseWidget( networkPkgWindow ); | 61 | stack->raiseWidget( networkPkgWindow ); |
61 | } | 62 | } |
62 | 63 | ||
63 | MainWindow :: ~MainWindow() | 64 | MainWindow :: ~MainWindow() |
64 | { | 65 | { |
65 | delete networkPkgWindow; | 66 | delete networkPkgWindow; |
66 | } | 67 | } |
67 | 68 | ||
69 | void MainWindow :: setDocument( const QString &doc ) | ||
70 | { | ||
71 | // Remove path from package | ||
72 | QString package = Utils::getPackageNameFromIpkFilename( doc ); | ||
73 | cout << "Selecting package " << package << endl; | ||
74 | networkPkgWindow->selectLocalPackage( package ); | ||
75 | } | ||
76 | |||
68 | void MainWindow :: displaySettings() | 77 | void MainWindow :: displaySettings() |
69 | { | 78 | { |
70 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); | 79 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); |
71 | if ( dlg->showDlg( 0 ) ) | 80 | if ( dlg->showDlg( 0 ) ) |
72 | networkPkgWindow->updateData(); | 81 | networkPkgWindow->updateData(); |
73 | delete dlg; | 82 | delete dlg; |
74 | } | 83 | } |
75 | 84 | ||
76 | void MainWindow :: displayHelp() | 85 | void MainWindow :: displayHelp() |
77 | { | 86 | { |
78 | HelpWindow *dlg = new HelpWindow( this ); | 87 | HelpWindow *dlg = new HelpWindow( this ); |
79 | dlg->exec(); | 88 | dlg->exec(); |
80 | delete dlg; | 89 | delete dlg; |
81 | } | 90 | } |
82 | 91 | ||
83 | void MainWindow :: displayAbout() | 92 | void MainWindow :: displayAbout() |
84 | { | 93 | { |
85 | QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); | 94 | QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); |
86 | } | 95 | } |
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index 2a182fc..a9e290c 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h | |||
@@ -1,47 +1,48 @@ | |||
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 <qwidgetstack.h> | 22 | #include <qwidgetstack.h> |
23 | 23 | ||
24 | 24 | ||
25 | class NetworkPackageManager; | 25 | class NetworkPackageManager; |
26 | class DataManager; | 26 | class DataManager; |
27 | 27 | ||
28 | class MainWindow :public QMainWindow | 28 | class MainWindow :public QMainWindow |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | public: | 31 | public: |
32 | 32 | ||
33 | MainWindow( QWidget *p = 0, char *name = 0 ); | 33 | MainWindow( QWidget *p = 0, char *name = 0 ); |
34 | ~MainWindow(); | 34 | ~MainWindow(); |
35 | 35 | ||
36 | private: | 36 | private: |
37 | DataManager *mgr; | 37 | DataManager *mgr; |
38 | 38 | ||
39 | QWidgetStack *stack; | 39 | QWidgetStack *stack; |
40 | NetworkPackageManager *networkPkgWindow; | 40 | NetworkPackageManager *networkPkgWindow; |
41 | 41 | ||
42 | public slots: | 42 | public slots: |
43 | void setDocument( const QString &doc ); | ||
43 | void displayHelp(); | 44 | void displayHelp(); |
44 | void displayAbout(); | 45 | void displayAbout(); |
45 | void displaySettings(); | 46 | void displaySettings(); |
46 | }; | 47 | }; |
47 | #endif | 48 | #endif |
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index 6874ded..a374266 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp | |||
@@ -1,492 +1,519 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | networkpkgmgr.cpp - description | 2 | networkpkgmgr.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 <fstream> | 18 | #include <fstream> |
19 | #include <iostream> | 19 | #include <iostream> |
20 | using namespace std; | 20 | using namespace std; |
21 | 21 | ||
22 | #include <unistd.h> | 22 | #include <unistd.h> |
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include <linux/limits.h> | 24 | #include <linux/limits.h> |
25 | 25 | ||
26 | #ifdef QWS | 26 | #ifdef QWS |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/qcopenvelope_qws.h> | 28 | #include <qpe/qcopenvelope_qws.h> |
29 | #include <qpe/config.h> | 29 | #include <qpe/config.h> |
30 | #else | 30 | #else |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | #endif | 32 | #endif |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
36 | 36 | ||
37 | #include "datamgr.h" | 37 | #include "datamgr.h" |
38 | #include "networkpkgmgr.h" | 38 | #include "networkpkgmgr.h" |
39 | #include "installdlgimpl.h" | 39 | #include "installdlgimpl.h" |
40 | #include "ipkg.h" | 40 | #include "ipkg.h" |
41 | #include "inputdlg.h" | 41 | #include "inputdlg.h" |
42 | #include "letterpushbutton.h" | 42 | #include "letterpushbutton.h" |
43 | 43 | ||
44 | #include "global.h" | 44 | #include "global.h" |
45 | 45 | ||
46 | NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) | 46 | NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) |
47 | : QWidget(parent, name) | 47 | : QWidget(parent, name) |
48 | { | 48 | { |
49 | dataMgr = dataManager; | 49 | dataMgr = dataManager; |
50 | 50 | ||
51 | #ifdef QWS | 51 | #ifdef QWS |
52 | // read download directory from config file | 52 | // read download directory from config file |
53 | Config cfg( "aqpkg" ); | 53 | Config cfg( "aqpkg" ); |
54 | cfg.setGroup( "settings" ); | 54 | cfg.setGroup( "settings" ); |
55 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); | 55 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); |
56 | showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); | 56 | showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | 59 | ||
60 | initGui(); | 60 | initGui(); |
61 | setupConnections(); | 61 | setupConnections(); |
62 | 62 | ||
63 | progressDlg = 0; | 63 | updateData(); |
64 | timerId = startTimer( 100 ); | 64 | // progressDlg = 0; |
65 | // timerId = startTimer( 100 ); | ||
65 | } | 66 | } |
66 | 67 | ||
67 | NetworkPackageManager::~NetworkPackageManager() | 68 | NetworkPackageManager::~NetworkPackageManager() |
68 | { | 69 | { |
69 | } | 70 | } |
70 | 71 | ||
71 | void NetworkPackageManager :: timerEvent ( QTimerEvent * ) | 72 | void NetworkPackageManager :: timerEvent ( QTimerEvent * ) |
72 | { | 73 | { |
73 | killTimer( timerId ); | 74 | killTimer( timerId ); |
74 | 75 | ||
75 | // showProgressDialog(); | 76 | // showProgressDialog(); |
76 | // Add server names to listbox | 77 | // Add server names to listbox |
77 | updateData(); | 78 | updateData(); |
78 | 79 | ||
79 | // progressDlg->hide(); | 80 | // progressDlg->hide(); |
80 | } | 81 | } |
81 | 82 | ||
82 | void NetworkPackageManager :: updateData() | 83 | void NetworkPackageManager :: updateData() |
83 | { | 84 | { |
84 | serversList->clear(); | 85 | serversList->clear(); |
85 | packagesList->clear(); | 86 | packagesList->clear(); |
86 | 87 | ||
87 | 88 | ||
88 | vector<Server>::iterator it; | 89 | vector<Server>::iterator it; |
89 | int activeItem = -1; | 90 | int activeItem = -1; |
90 | int i; | 91 | int i; |
91 | for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) | 92 | for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) |
92 | { | 93 | { |
93 | if ( !it->isServerActive() ) | 94 | if ( !it->isServerActive() ) |
94 | { | 95 | { |
95 | i--; | 96 | i--; |
96 | continue; | 97 | continue; |
97 | } | 98 | } |
98 | serversList->insertItem( it->getServerName() ); | 99 | serversList->insertItem( it->getServerName() ); |
99 | if ( it->getServerName() == currentlySelectedServer ) | 100 | if ( it->getServerName() == currentlySelectedServer ) |
100 | activeItem = i; | 101 | activeItem = i; |
101 | } | 102 | } |
102 | 103 | ||
103 | // set selected server to be active server | 104 | // set selected server to be active server |
104 | if ( activeItem != -1 ) | 105 | if ( activeItem != -1 ) |
105 | serversList->setCurrentItem( activeItem ); | 106 | serversList->setCurrentItem( activeItem ); |
106 | serverSelected( 0 ); | 107 | serverSelected( 0 ); |
107 | } | 108 | } |
108 | 109 | ||
110 | void NetworkPackageManager :: selectLocalPackage( const QString &pkg ) | ||
111 | { | ||
112 | // First select local server | ||
113 | for ( int i = 0 ; i < serversList->count() ; ++i ) | ||
114 | { | ||
115 | if ( serversList->text( i ) == LOCAL_IPKGS ) | ||
116 | { | ||
117 | serversList->setCurrentItem( i ); | ||
118 | break; | ||
119 | } | ||
120 | } | ||
121 | serverSelected( 0 ); | ||
122 | |||
123 | // Now set the check box of the selected package | ||
124 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | ||
125 | item != 0 ; | ||
126 | item = (QCheckListItem *)item->nextSibling() ) | ||
127 | { | ||
128 | if ( item->text().startsWith( pkg ) ) | ||
129 | { | ||
130 | item->setOn( true ); | ||
131 | break; | ||
132 | } | ||
133 | } | ||
134 | } | ||
135 | |||
109 | 136 | ||
110 | void NetworkPackageManager :: initGui() | 137 | void NetworkPackageManager :: initGui() |
111 | { | 138 | { |
112 | QLabel *l = new QLabel( "Servers", this ); | 139 | QLabel *l = new QLabel( "Servers", this ); |
113 | serversList = new QComboBox( this ); | 140 | serversList = new QComboBox( this ); |
114 | packagesList = new QListView( this ); | 141 | packagesList = new QListView( this ); |
115 | update = new QPushButton( "Refresh List", this ); | 142 | update = new QPushButton( "Refresh List", this ); |
116 | download = new QPushButton( "Download", this ); | 143 | download = new QPushButton( "Download", this ); |
117 | upgrade = new QPushButton( "Upgrade", this ); | 144 | upgrade = new QPushButton( "Upgrade", this ); |
118 | apply = new QPushButton( "Apply", this ); | 145 | apply = new QPushButton( "Apply", this ); |
119 | 146 | ||
120 | QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" ); | 147 | QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" ); |
121 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" ); | 148 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" ); |
122 | hbox1->addWidget( l ); | 149 | hbox1->addWidget( l ); |
123 | hbox1->addWidget( serversList ); | 150 | hbox1->addWidget( serversList ); |
124 | 151 | ||
125 | QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" ); | 152 | QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" ); |
126 | QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" ); | 153 | QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" ); |
127 | 154 | ||
128 | 155 | ||
129 | if ( showJumpTo ) | 156 | if ( showJumpTo ) |
130 | { | 157 | { |
131 | char text[2]; | 158 | char text[2]; |
132 | text[1] = '\0'; | 159 | text[1] = '\0'; |
133 | for ( int i = 0 ; i < 26 ; ++i ) | 160 | for ( int i = 0 ; i < 26 ; ++i ) |
134 | { | 161 | { |
135 | text[0] = 'A' + i; | 162 | text[0] = 'A' + i; |
136 | LetterPushButton *b = new LetterPushButton( text, this ); | 163 | LetterPushButton *b = new LetterPushButton( text, this ); |
137 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); | 164 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); |
138 | if ( i < 13 ) | 165 | if ( i < 13 ) |
139 | hbox3->addWidget( b ); | 166 | hbox3->addWidget( b ); |
140 | else | 167 | else |
141 | hbox4->addWidget( b ); | 168 | hbox4->addWidget( b ); |
142 | } | 169 | } |
143 | } | 170 | } |
144 | 171 | ||
145 | vbox->addWidget( packagesList ); | 172 | vbox->addWidget( packagesList ); |
146 | packagesList->addColumn( "Packages" ); | 173 | packagesList->addColumn( "Packages" ); |
147 | 174 | ||
148 | QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" ); | 175 | QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" ); |
149 | hbox2->addWidget( update ); | 176 | hbox2->addWidget( update ); |
150 | hbox2->addWidget( download ); | 177 | hbox2->addWidget( download ); |
151 | hbox2->addWidget( upgrade ); | 178 | hbox2->addWidget( upgrade ); |
152 | hbox2->addWidget( apply ); | 179 | hbox2->addWidget( apply ); |
153 | } | 180 | } |
154 | 181 | ||
155 | void NetworkPackageManager :: setupConnections() | 182 | void NetworkPackageManager :: setupConnections() |
156 | { | 183 | { |
157 | connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); | 184 | connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); |
158 | connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) ); | 185 | connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) ); |
159 | connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) ); | 186 | connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) ); |
160 | connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) ); | 187 | connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) ); |
161 | connect( update, SIGNAL(released()), this, SLOT(updateServer()) ); | 188 | connect( update, SIGNAL(released()), this, SLOT(updateServer()) ); |
162 | } | 189 | } |
163 | 190 | ||
164 | void NetworkPackageManager :: showProgressDialog( char *initialText ) | 191 | void NetworkPackageManager :: showProgressDialog( char *initialText ) |
165 | { | 192 | { |
166 | if ( !progressDlg ) | 193 | if ( !progressDlg ) |
167 | progressDlg = new ProgressDlg( this, "Progress", false ); | 194 | progressDlg = new ProgressDlg( this, "Progress", false ); |
168 | progressDlg->setText( initialText ); | 195 | progressDlg->setText( initialText ); |
169 | progressDlg->show(); | 196 | progressDlg->show(); |
170 | } | 197 | } |
171 | 198 | ||
172 | 199 | ||
173 | void NetworkPackageManager :: serverSelected( int ) | 200 | void NetworkPackageManager :: serverSelected( int ) |
174 | { | 201 | { |
175 | packagesList->clear(); | 202 | packagesList->clear(); |
176 | 203 | ||
177 | // display packages | 204 | // display packages |
178 | QString serverName = serversList->currentText(); | 205 | QString serverName = serversList->currentText(); |
179 | currentlySelectedServer = serverName; | 206 | currentlySelectedServer = serverName; |
180 | 207 | ||
181 | #ifdef QWS | 208 | #ifdef QWS |
182 | // read download directory from config file | 209 | // read download directory from config file |
183 | Config cfg( "aqpkg" ); | 210 | Config cfg( "aqpkg" ); |
184 | cfg.setGroup( "settings" ); | 211 | cfg.setGroup( "settings" ); |
185 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); | 212 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); |
186 | #endif | 213 | #endif |
187 | 214 | ||
188 | Server *s = dataMgr->getServer( serverName ); | 215 | Server *s = dataMgr->getServer( serverName ); |
189 | // dataMgr->setActiveServer( serverName ); | 216 | // dataMgr->setActiveServer( serverName ); |
190 | 217 | ||
191 | vector<Package> &list = s->getPackageList(); | 218 | vector<Package> &list = s->getPackageList(); |
192 | vector<Package>::iterator it; | 219 | vector<Package>::iterator it; |
193 | for ( it = list.begin() ; it != list.end() ; ++it ) | 220 | for ( it = list.begin() ; it != list.end() ; ++it ) |
194 | { | 221 | { |
195 | QString text = ""; | 222 | QString text = ""; |
196 | 223 | ||
197 | // If the local server, only display installed packages | 224 | // If the local server, only display installed packages |
198 | if ( serverName == LOCAL_SERVER && !it->isInstalled() ) | 225 | if ( serverName == LOCAL_SERVER && !it->isInstalled() ) |
199 | continue; | 226 | continue; |
200 | 227 | ||
201 | text += it->getPackageName(); | 228 | text += it->getPackageName(); |
202 | if ( it->isInstalled() ) | 229 | if ( it->isInstalled() ) |
203 | { | 230 | { |
204 | text += " (installed)"; | 231 | text += " (installed)"; |
205 | 232 | ||
206 | // If a different version of package is available, postfix it with an * | 233 | // If a different version of package is available, postfix it with an * |
207 | if ( it->getVersion() != it->getInstalledVersion() ) | 234 | if ( it->getVersion() != it->getInstalledVersion() ) |
208 | text += "*"; | 235 | text += "*"; |
209 | } | 236 | } |
210 | 237 | ||
211 | QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); | 238 | QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); |
212 | 239 | ||
213 | if ( it->isInstalled() ) | 240 | if ( it->isInstalled() ) |
214 | { | 241 | { |
215 | QString destName = ""; | 242 | QString destName = ""; |
216 | if ( it->getLocalPackage() ) | 243 | if ( it->getLocalPackage() ) |
217 | { | 244 | { |
218 | if ( it->getLocalPackage()->getInstalledTo() ) | 245 | if ( it->getLocalPackage()->getInstalledTo() ) |
219 | destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); | 246 | destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); |
220 | } | 247 | } |
221 | else | 248 | else |
222 | { | 249 | { |
223 | if ( it->getInstalledTo() ) | 250 | if ( it->getInstalledTo() ) |
224 | destName = it->getInstalledTo()->getDestinationName(); | 251 | destName = it->getInstalledTo()->getDestinationName(); |
225 | } | 252 | } |
226 | if ( destName != "" ) | 253 | if ( destName != "" ) |
227 | new QCheckListItem( item, QString( "Installed To - " ) + destName ); | 254 | new QCheckListItem( item, QString( "Installed To - " ) + destName ); |
228 | } | 255 | } |
229 | 256 | ||
230 | if ( !it->isPackageStoredLocally() ) | 257 | if ( !it->isPackageStoredLocally() ) |
231 | new QCheckListItem( item, QString( "Description - " ) + it->getDescription() ); | 258 | new QCheckListItem( item, QString( "Description - " ) + it->getDescription() ); |
232 | else | 259 | else |
233 | new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() ); | 260 | new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() ); |
234 | 261 | ||
235 | new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() ); | 262 | new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() ); |
236 | if ( it->getLocalPackage() ) | 263 | if ( it->getLocalPackage() ) |
237 | { | 264 | { |
238 | if ( it->isInstalled() ) | 265 | if ( it->isInstalled() ) |
239 | new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() ); | 266 | new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() ); |
240 | } | 267 | } |
241 | packagesList->insertItem( item ); | 268 | packagesList->insertItem( item ); |
242 | } | 269 | } |
243 | 270 | ||
244 | // If the local server or the local ipkgs server disable the download button | 271 | // If the local server or the local ipkgs server disable the download button |
245 | if ( serverName == LOCAL_SERVER ) | 272 | if ( serverName == LOCAL_SERVER ) |
246 | { | 273 | { |
247 | upgrade->setEnabled( false ); | 274 | upgrade->setEnabled( false ); |
248 | download->setText( "Download" ); | 275 | download->setText( "Download" ); |
249 | download->setEnabled( false ); | 276 | download->setEnabled( false ); |
250 | } | 277 | } |
251 | else if ( serverName == LOCAL_IPKGS ) | 278 | else if ( serverName == LOCAL_IPKGS ) |
252 | { | 279 | { |
253 | upgrade->setEnabled( false ); | 280 | upgrade->setEnabled( false ); |
254 | download->setEnabled( true ); | 281 | download->setEnabled( true ); |
255 | download->setText( "Remove" ); | 282 | download->setText( "Remove" ); |
256 | } | 283 | } |
257 | else | 284 | else |
258 | { | 285 | { |
259 | upgrade->setEnabled( true ); | 286 | upgrade->setEnabled( true ); |
260 | download->setEnabled( true ); | 287 | download->setEnabled( true ); |
261 | download->setText( "Download" ); | 288 | download->setText( "Download" ); |
262 | } | 289 | } |
263 | } | 290 | } |
264 | 291 | ||
265 | void NetworkPackageManager :: updateServer() | 292 | void NetworkPackageManager :: updateServer() |
266 | { | 293 | { |
267 | QString serverName = serversList->currentText(); | 294 | QString serverName = serversList->currentText(); |
268 | 295 | ||
269 | // Update the current server | 296 | // Update the current server |
270 | // Display dialog | 297 | // Display dialog |
271 | // ProgressDlg *progDlg = new ProgressDlg( this ); | 298 | // ProgressDlg *progDlg = new ProgressDlg( this ); |
272 | // QString status = "Updating package lists..."; | 299 | // QString status = "Updating package lists..."; |
273 | // progDlg->show(); | 300 | // progDlg->show(); |
274 | // progDlg->setText( status ); | 301 | // progDlg->setText( status ); |
275 | 302 | ||
276 | // Disable buttons to stop silly people clicking lots on them :) | 303 | // Disable buttons to stop silly people clicking lots on them :) |
277 | 304 | ||
278 | // First, write out ipkg_conf file so that ipkg can use it | 305 | // First, write out ipkg_conf file so that ipkg can use it |
279 | dataMgr->writeOutIpkgConf(); | 306 | dataMgr->writeOutIpkgConf(); |
280 | 307 | ||
281 | Ipkg ipkg; | 308 | Ipkg ipkg; |
282 | ipkg.setOption( "update" ); | 309 | ipkg.setOption( "update" ); |
283 | 310 | ||
284 | InstallDlgImpl dlg( &ipkg, "Refreshing server package lists", this, "Upgrade", true ); | 311 | InstallDlgImpl dlg( &ipkg, "Refreshing server package lists", this, "Upgrade", true ); |
285 | dlg.showDlg(); | 312 | dlg.showDlg(); |
286 | 313 | ||
287 | // Reload data | 314 | // Reload data |
288 | dataMgr->reloadServerData( serversList->currentText() ); | 315 | dataMgr->reloadServerData( serversList->currentText() ); |
289 | serverSelected(-1); | 316 | serverSelected(-1); |
290 | // delete progDlg; | 317 | // delete progDlg; |
291 | } | 318 | } |
292 | 319 | ||
293 | void NetworkPackageManager :: upgradePackages() | 320 | void NetworkPackageManager :: upgradePackages() |
294 | { | 321 | { |
295 | // We're gonna do an upgrade of all packages | 322 | // We're gonna do an upgrade of all packages |
296 | // First warn user that this isn't recommended | 323 | // First warn user that this isn't recommended |
297 | QString text = "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n"; | 324 | QString text = "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n"; |
298 | QMessageBox warn("Warning", text, QMessageBox::Warning, | 325 | QMessageBox warn("Warning", text, QMessageBox::Warning, |
299 | QMessageBox::Yes, | 326 | QMessageBox::Yes, |
300 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , | 327 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , |
301 | 0, this ); | 328 | 0, this ); |
302 | warn.adjustSize(); | 329 | warn.adjustSize(); |
303 | 330 | ||
304 | if ( warn.exec() == QMessageBox::Yes ) | 331 | if ( warn.exec() == QMessageBox::Yes ) |
305 | { | 332 | { |
306 | // First, write out ipkg_conf file so that ipkg can use it | 333 | // First, write out ipkg_conf file so that ipkg can use it |
307 | dataMgr->writeOutIpkgConf(); | 334 | dataMgr->writeOutIpkgConf(); |
308 | 335 | ||
309 | // Now run upgrade | 336 | // Now run upgrade |
310 | Ipkg ipkg; | 337 | Ipkg ipkg; |
311 | ipkg.setOption( "upgrade" ); | 338 | ipkg.setOption( "upgrade" ); |
312 | 339 | ||
313 | InstallDlgImpl dlg( &ipkg, "Upgrading installed packages", this, "Upgrade", true ); | 340 | InstallDlgImpl dlg( &ipkg, "Upgrading installed packages", this, "Upgrade", true ); |
314 | dlg.showDlg(); | 341 | dlg.showDlg(); |
315 | 342 | ||
316 | // Reload data | 343 | // Reload data |
317 | dataMgr->reloadServerData( LOCAL_SERVER ); | 344 | dataMgr->reloadServerData( LOCAL_SERVER ); |
318 | 345 | ||
319 | dataMgr->reloadServerData( serversList->currentText() ); | 346 | dataMgr->reloadServerData( serversList->currentText() ); |
320 | serverSelected(-1); | 347 | serverSelected(-1); |
321 | } | 348 | } |
322 | } | 349 | } |
323 | 350 | ||
324 | 351 | ||
325 | void NetworkPackageManager :: downloadPackage() | 352 | void NetworkPackageManager :: downloadPackage() |
326 | { | 353 | { |
327 | if ( download->text() == "Download" ) | 354 | if ( download->text() == "Download" ) |
328 | { | 355 | { |
329 | // First, write out ipkg_conf file so that ipkg can use it | 356 | // First, write out ipkg_conf file so that ipkg can use it |
330 | dataMgr->writeOutIpkgConf(); | 357 | dataMgr->writeOutIpkgConf(); |
331 | 358 | ||
332 | // Display dialog to user asking where to download the files to | 359 | // Display dialog to user asking where to download the files to |
333 | bool ok = FALSE; | 360 | bool ok = FALSE; |
334 | QString dir = ""; | 361 | QString dir = ""; |
335 | #ifdef QWS | 362 | #ifdef QWS |
336 | // read download directory from config file | 363 | // read download directory from config file |
337 | Config cfg( "aqpkg" ); | 364 | Config cfg( "aqpkg" ); |
338 | cfg.setGroup( "settings" ); | 365 | cfg.setGroup( "settings" ); |
339 | dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); | 366 | dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); |
340 | #endif | 367 | #endif |
341 | 368 | ||
342 | QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); | 369 | QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); |
343 | if ( ok && !text.isEmpty() ) | 370 | if ( ok && !text.isEmpty() ) |
344 | dir = text; // user entered something and pressed ok | 371 | dir = text; // user entered something and pressed ok |
345 | else | 372 | else |
346 | return; // user entered nothing or pressed cancel | 373 | return; // user entered nothing or pressed cancel |
347 | 374 | ||
348 | #ifdef QWS | 375 | #ifdef QWS |
349 | // Store download directory in config file | 376 | // Store download directory in config file |
350 | cfg.writeEntry( "downloadDir", dir ); | 377 | cfg.writeEntry( "downloadDir", dir ); |
351 | #endif | 378 | #endif |
352 | 379 | ||
353 | // Get starting directory | 380 | // Get starting directory |
354 | char initDir[PATH_MAX]; | 381 | char initDir[PATH_MAX]; |
355 | getcwd( initDir, PATH_MAX ); | 382 | getcwd( initDir, PATH_MAX ); |
356 | 383 | ||
357 | // Download each package | 384 | // Download each package |
358 | Ipkg ipkg; | 385 | Ipkg ipkg; |
359 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | 386 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
360 | 387 | ||
361 | ipkg.setOption( "download" ); | 388 | ipkg.setOption( "download" ); |
362 | ipkg.setRuntimeDirectory( dir ); | 389 | ipkg.setRuntimeDirectory( dir ); |
363 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 390 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
364 | item != 0 ; | 391 | item != 0 ; |
365 | item = (QCheckListItem *)item->nextSibling() ) | 392 | item = (QCheckListItem *)item->nextSibling() ) |
366 | { | 393 | { |
367 | if ( item->isOn() ) | 394 | if ( item->isOn() ) |
368 | { | 395 | { |
369 | QString name = item->text(); | 396 | QString name = item->text(); |
370 | int pos = name.find( "*" ); | 397 | int pos = name.find( "*" ); |
371 | name.truncate( pos ); | 398 | name.truncate( pos ); |
372 | 399 | ||
373 | // if (there is a (installed), remove it | 400 | // if (there is a (installed), remove it |
374 | pos = name.find( "(installed)" ); | 401 | pos = name.find( "(installed)" ); |
375 | if ( pos > 0 ) | 402 | if ( pos > 0 ) |
376 | name.truncate( pos - 1 ); | 403 | name.truncate( pos - 1 ); |
377 | 404 | ||
378 | ipkg.setPackage( name ); | 405 | ipkg.setPackage( name ); |
379 | ipkg.runIpkg( ); | 406 | ipkg.runIpkg( ); |
380 | } | 407 | } |
381 | } | 408 | } |
382 | } | 409 | } |
383 | else if ( download->text() == "Remove" ) | 410 | else if ( download->text() == "Remove" ) |
384 | { | 411 | { |
385 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 412 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
386 | item != 0 ; | 413 | item != 0 ; |
387 | item = (QCheckListItem *)item->nextSibling() ) | 414 | item = (QCheckListItem *)item->nextSibling() ) |
388 | { | 415 | { |
389 | if ( item->isOn() ) | 416 | if ( item->isOn() ) |
390 | { | 417 | { |
391 | QString name = item->text(); | 418 | QString name = item->text(); |
392 | int pos = name.find( "*" ); | 419 | int pos = name.find( "*" ); |
393 | name.truncate( pos ); | 420 | name.truncate( pos ); |
394 | 421 | ||
395 | // if (there is a (installed), remove it | 422 | // if (there is a (installed), remove it |
396 | pos = name.find( "(installed)" ); | 423 | pos = name.find( "(installed)" ); |
397 | if ( pos > 0 ) | 424 | if ( pos > 0 ) |
398 | name.truncate( pos - 1 ); | 425 | name.truncate( pos - 1 ); |
399 | 426 | ||
400 | Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name ); | 427 | Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name ); |
401 | QFile f( p->getFilename() ); | 428 | QFile f( p->getFilename() ); |
402 | f.remove(); | 429 | f.remove(); |
403 | } | 430 | } |
404 | } | 431 | } |
405 | } | 432 | } |
406 | 433 | ||
407 | dataMgr->reloadServerData( LOCAL_IPKGS ); | 434 | dataMgr->reloadServerData( LOCAL_IPKGS ); |
408 | serverSelected( -1 ); | 435 | serverSelected( -1 ); |
409 | } | 436 | } |
410 | 437 | ||
411 | 438 | ||
412 | void NetworkPackageManager :: applyChanges() | 439 | void NetworkPackageManager :: applyChanges() |
413 | { | 440 | { |
414 | stickyOption = ""; | 441 | stickyOption = ""; |
415 | 442 | ||
416 | // First, write out ipkg_conf file so that ipkg can use it | 443 | // First, write out ipkg_conf file so that ipkg can use it |
417 | dataMgr->writeOutIpkgConf(); | 444 | dataMgr->writeOutIpkgConf(); |
418 | 445 | ||
419 | // Now for each selected item | 446 | // Now for each selected item |
420 | // deal with it | 447 | // deal with it |
421 | 448 | ||
422 | vector<InstallData> workingPackages; | 449 | vector<InstallData> workingPackages; |
423 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 450 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
424 | item != 0 ; | 451 | item != 0 ; |
425 | item = (QCheckListItem *)item->nextSibling() ) | 452 | item = (QCheckListItem *)item->nextSibling() ) |
426 | { | 453 | { |
427 | if ( item->isOn() ) | 454 | if ( item->isOn() ) |
428 | { | 455 | { |
429 | InstallData data = dealWithItem( item ); | 456 | InstallData data = dealWithItem( item ); |
430 | workingPackages.push_back( data ); | 457 | workingPackages.push_back( data ); |
431 | } | 458 | } |
432 | } | 459 | } |
433 | 460 | ||
434 | if ( workingPackages.size() == 0 ) | 461 | if ( workingPackages.size() == 0 ) |
435 | { | 462 | { |
436 | // Nothing to do | 463 | // Nothing to do |
437 | QMessageBox::information( this, "Nothing to do", | 464 | QMessageBox::information( this, "Nothing to do", |
438 | "No packages selected", "OK" ); | 465 | "No packages selected", "OK" ); |
439 | 466 | ||
440 | return; | 467 | return; |
441 | } | 468 | } |
442 | 469 | ||
443 | // do the stuff | 470 | // do the stuff |
444 | InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true ); | 471 | InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true ); |
445 | dlg.showDlg(); | 472 | dlg.showDlg(); |
446 | 473 | ||
447 | // Reload data | 474 | // Reload data |
448 | dataMgr->reloadServerData( LOCAL_SERVER ); | 475 | dataMgr->reloadServerData( LOCAL_SERVER ); |
449 | 476 | ||
450 | dataMgr->reloadServerData( serversList->currentText() ); | 477 | dataMgr->reloadServerData( serversList->currentText() ); |
451 | serverSelected(-1); | 478 | serverSelected(-1); |
452 | 479 | ||
453 | #ifdef QWS | 480 | #ifdef QWS |
454 | // Finally let the main system update itself | 481 | // Finally let the main system update itself |
455 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 482 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
456 | QString lf = QString::null; | 483 | QString lf = QString::null; |
457 | e << lf; | 484 | e << lf; |
458 | #endif | 485 | #endif |
459 | } | 486 | } |
460 | 487 | ||
461 | // decide what to do - either remove, upgrade or install | 488 | // decide what to do - either remove, upgrade or install |
462 | // Current rules: | 489 | // Current rules: |
463 | // If not installed - install | 490 | // If not installed - install |
464 | // If installed and different version available - upgrade | 491 | // If installed and different version available - upgrade |
465 | // If installed and version up to date - remove | 492 | // If installed and version up to date - remove |
466 | InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | 493 | InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) |
467 | { | 494 | { |
468 | QString name = item->text(); | 495 | QString name = item->text(); |
469 | int pos = name.find( "*" ); | 496 | int pos = name.find( "*" ); |
470 | name.truncate( pos ); | 497 | name.truncate( pos ); |
471 | 498 | ||
472 | // if (there is a (installed), remove it | 499 | // if (there is a (installed), remove it |
473 | pos = name.find( "(installed)" ); | 500 | pos = name.find( "(installed)" ); |
474 | if ( pos > 0 ) | 501 | if ( pos > 0 ) |
475 | name.truncate( pos - 1 ); | 502 | name.truncate( pos - 1 ); |
476 | 503 | ||
477 | // Get package | 504 | // Get package |
478 | Server *s = dataMgr->getServer( serversList->currentText() ); | 505 | Server *s = dataMgr->getServer( serversList->currentText() ); |
479 | Package *p = s->getPackage( name ); | 506 | Package *p = s->getPackage( name ); |
480 | 507 | ||
481 | // If the package has a filename then it is a local file | 508 | // If the package has a filename then it is a local file |
482 | if ( p->isPackageStoredLocally() ) | 509 | if ( p->isPackageStoredLocally() ) |
483 | name = p->getFilename(); | 510 | name = p->getFilename(); |
484 | QString option; | 511 | QString option; |
485 | QString dest = "root"; | 512 | QString dest = "root"; |
486 | if ( !p->isInstalled() ) | 513 | if ( !p->isInstalled() ) |
487 | { | 514 | { |
488 | InstallData item; | 515 | InstallData item; |
489 | item.option = "I"; | 516 | item.option = "I"; |
490 | item.packageName = name; | 517 | item.packageName = name; |
491 | return item; | 518 | return item; |
492 | } | 519 | } |
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h index fba8155..3c437b4 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.h +++ b/noncore/settings/aqpkg/networkpkgmgr.h | |||
@@ -1,77 +1,78 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | networkpkgmgr.h - description | 2 | networkpkgmgr.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 NETWORKPKGMGR_H | 18 | #ifndef NETWORKPKGMGR_H |
19 | #define NETWORKPKGMGR_H | 19 | #define NETWORKPKGMGR_H |
20 | 20 | ||
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qpushbutton.h> | 22 | #include <qpushbutton.h> |
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | 26 | ||
27 | #include "datamgr.h" | 27 | #include "datamgr.h" |
28 | #include "progressdlg.h" | 28 | #include "progressdlg.h" |
29 | class InstallData; | 29 | class InstallData; |
30 | 30 | ||
31 | /** NetworkPackageManager is the base class of the project */ | 31 | /** NetworkPackageManager is the base class of the project */ |
32 | class NetworkPackageManager : public QWidget | 32 | class NetworkPackageManager : public QWidget |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | /** construtor */ | 36 | /** construtor */ |
37 | NetworkPackageManager( DataManager *dataManager, QWidget* parent=0, const char *name=0); | 37 | NetworkPackageManager( DataManager *dataManager, QWidget* parent=0, const char *name=0); |
38 | /** destructor */ | 38 | /** destructor */ |
39 | ~NetworkPackageManager(); | 39 | ~NetworkPackageManager(); |
40 | 40 | ||
41 | void selectLocalPackage( const QString &pkg ); | ||
41 | void updateData(); | 42 | void updateData(); |
42 | 43 | ||
43 | private: | 44 | private: |
44 | DataManager *dataMgr; | 45 | DataManager *dataMgr; |
45 | 46 | ||
46 | QComboBox *serversList; | 47 | QComboBox *serversList; |
47 | QListView *packagesList; | 48 | QListView *packagesList; |
48 | QPushButton *update; | 49 | QPushButton *update; |
49 | QPushButton *upgrade; | 50 | QPushButton *upgrade; |
50 | QPushButton *download; | 51 | QPushButton *download; |
51 | QPushButton *apply; | 52 | QPushButton *apply; |
52 | 53 | ||
53 | ProgressDlg *progressDlg; | 54 | ProgressDlg *progressDlg; |
54 | QString currentlySelectedServer; | 55 | QString currentlySelectedServer; |
55 | 56 | ||
56 | bool showJumpTo; | 57 | bool showJumpTo; |
57 | int timerId; | 58 | int timerId; |
58 | 59 | ||
59 | void timerEvent ( QTimerEvent * ); | 60 | void timerEvent ( QTimerEvent * ); |
60 | 61 | ||
61 | void initGui(); | 62 | void initGui(); |
62 | void setupConnections(); | 63 | void setupConnections(); |
63 | void showProgressDialog( char *initialText ); | 64 | void showProgressDialog( char *initialText ); |
64 | InstallData dealWithItem( QCheckListItem *item ); | 65 | InstallData dealWithItem( QCheckListItem *item ); |
65 | QString stickyOption; | 66 | QString stickyOption; |
66 | 67 | ||
67 | public slots: | 68 | public slots: |
68 | void serverSelected( int index ); | 69 | void serverSelected( int index ); |
69 | void applyChanges(); | 70 | void applyChanges(); |
70 | void upgradePackages(); | 71 | void upgradePackages(); |
71 | void downloadPackage(); | 72 | void downloadPackage(); |
72 | void updateServer(); | 73 | void updateServer(); |
73 | void displayText( const QString &t ); | 74 | void displayText( const QString &t ); |
74 | void letterPushed( QString t ); | 75 | void letterPushed( QString t ); |
75 | }; | 76 | }; |
76 | 77 | ||
77 | #endif | 78 | #endif |