summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/aqpkg.pro2
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp30
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp90
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h2
-rw-r--r--noncore/settings/aqpkg/progressdlg.cpp65
-rw-r--r--noncore/settings/aqpkg/progressdlg.h37
6 files changed, 60 insertions, 166 deletions
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro
index ad0dfc5..a5d49e7 100644
--- a/noncore/settings/aqpkg/aqpkg.pro
+++ b/noncore/settings/aqpkg/aqpkg.pro
@@ -1,49 +1,47 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on debug 2 CONFIG = qt warn_on debug
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 networkpkgmgr.h \ 8 networkpkgmgr.h \
9 package.h \ 9 package.h \
10 progressdlg.h \
11 progresswidget.h \ 10 progresswidget.h \
12 installdlgimpl.h \ 11 installdlgimpl.h \
13 instoptionsimpl.h \ 12 instoptionsimpl.h \
14 destination.h \ 13 destination.h \
15 utils.h \ 14 utils.h \
16 server.h \ 15 server.h \
17 helpwindow.h \ 16 helpwindow.h \
18 letterpushbutton.h \ 17 letterpushbutton.h \
19 inputdlg.h \ 18 inputdlg.h \
20 categoryfilterimpl.h 19 categoryfilterimpl.h
21 SOURCES = mainwin.cpp \ 20 SOURCES = mainwin.cpp \
22 datamgr.cpp \ 21 datamgr.cpp \
23 mem.cpp \ 22 mem.cpp \
24 settingsimpl.cpp \ 23 settingsimpl.cpp \
25 ipkg.cpp \ 24 ipkg.cpp \
26 networkpkgmgr.cpp \ 25 networkpkgmgr.cpp \
27 main.cpp \ 26 main.cpp \
28 package.cpp \ 27 package.cpp \
29 progressdlg.cpp \
30 progresswidget.cpp \ 28 progresswidget.cpp \
31 installdlgimpl.cpp \ 29 installdlgimpl.cpp \
32 instoptionsimpl.cpp \ 30 instoptionsimpl.cpp \
33 destination.cpp \ 31 destination.cpp \
34 utils.cpp \ 32 utils.cpp \
35 server.cpp \ 33 server.cpp \
36 helpwindow.cpp \ 34 helpwindow.cpp \
37 letterpushbutton.cpp \ 35 letterpushbutton.cpp \
38 inputdlg.cpp \ 36 inputdlg.cpp \
39 version.cpp \ 37 version.cpp \
40 categoryfilterimpl.cpp 38 categoryfilterimpl.cpp
41 INTERFACES= settings.ui \ 39 INTERFACES= settings.ui \
42 install.ui \ 40 install.ui \
43 instoptions.ui \ 41 instoptions.ui \
44 categoryfilter.ui 42 categoryfilter.ui
45 TARGET = aqpkg 43 TARGET = aqpkg
46INCLUDEPATH += $(OPIEDIR)/include 44INCLUDEPATH += $(OPIEDIR)/include
47DEPENDPATH += $(OPIEDIR)/include 45DEPENDPATH += $(OPIEDIR)/include
48LIBS += -lqpe -lopie -lstdc++ 46LIBS += -lqpe -lopie -lstdc++
49DESTDIR = $(OPIEDIR)/bin 47DESTDIR = $(OPIEDIR)/bin
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 5e03f11..e577285 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -1,244 +1,244 @@
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 <iostream> 18#include <iostream>
19using namespace std; 19using namespace std;
20 20
21#include <qmenubar.h> 21#include <qmenubar.h>
22#include <qmessagebox.h> 22#include <qmessagebox.h>
23#include <qpopupmenu.h> 23#include <qpopupmenu.h>
24#include <qtimer.h> 24#include <qtimer.h>
25 25
26#include "mainwin.h" 26#include "mainwin.h"
27#include "progresswidget.h" 27#include "progresswidget.h"
28#include "datamgr.h" 28#include "datamgr.h"
29#include "networkpkgmgr.h" 29#include "networkpkgmgr.h"
30#include "settingsimpl.h" 30#include "settingsimpl.h"
31#include "helpwindow.h" 31#include "helpwindow.h"
32#include "utils.h" 32#include "utils.h"
33#include "global.h" 33#include "global.h"
34 34
35MainWindow :: MainWindow( QWidget *p, char *name ) 35MainWindow :: MainWindow( QWidget *p, char *name )
36 :QMainWindow( p, name ) 36 :QMainWindow( p, name )
37{ 37{
38#ifdef QWS 38#ifdef QWS
39 showMaximized(); 39 showMaximized();
40#endif 40#endif
41 41
42 setCaption( tr( "AQPkg - Package Manager" ) ); 42 setCaption( tr( "AQPkg - Package Manager" ) );
43 43
44 // Create our menu 44 // Create our menu
45 help = new QPopupMenu( this ); 45 help = new QPopupMenu( this );
46 help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_G ); 46 help->insertItem( tr( "General" ), this, SLOT(displayHelp()) );
47 help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); 47 help->insertItem( tr( "About" ), this, SLOT(displayAbout()) );
48 48
49 settings = new QPopupMenu( this ); 49 settings = new QPopupMenu( this );
50 settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); 50 settings->insertItem( tr( "Settings" ), this, SLOT(displaySettings()) );
51 51
52 edit = new QPopupMenu( this ); 52 edit = new QPopupMenu( this );
53 edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_I ); 53 edit->insertItem( tr( "Find" ), this, SLOT(searchForPackage()) );
54 edit->insertItem( "Find &Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_N ); 54 edit->insertItem( tr( "Find Next" ), this, SLOT(repeatSearchForPackage()) );
55 55
56 filter = new QPopupMenu( this ); 56 filter = new QPopupMenu( this );
57 mnuShowUninstalledPkgsId = filter->insertItem( "Show &Non-Installed Packages", this, SLOT(filterUninstalledPackages()), Qt::CTRL+Qt::Key_U ); 57 mnuShowUninstalledPkgsId = filter->insertItem( tr( "Show Non-Installed Packages" ), this, SLOT(filterUninstalledPackages()) );
58 mnuShowInstalledPkgsId = filter->insertItem( "Show In&stalled Packages", this, SLOT(filterInstalledPackages()), Qt::CTRL+Qt::Key_S ); 58 mnuShowInstalledPkgsId = filter->insertItem( tr( "Show Installed Packages" ), this, SLOT(filterInstalledPackages()) );
59 mnuShowUpgradedPkgsId = filter->insertItem( "Show U&pdated Packages", this, SLOT(filterUpgradedPackages()), Qt::CTRL+Qt::Key_P ); 59 mnuShowUpgradedPkgsId = filter->insertItem( tr( "Show Updated Packages" ), this, SLOT(filterUpgradedPackages()) );
60 filter->insertSeparator(); 60 filter->insertSeparator();
61 mnuFilterByCategory = filter->insertItem( "Filter By &Category", this, SLOT(filterCategory()), Qt::CTRL+Qt::Key_C ); 61 mnuFilterByCategory = filter->insertItem( tr( "Filter By Category" ), this, SLOT(filterCategory()) );
62 mnuSetFilterCategory = filter->insertItem( "Set Filter C&ategory", this, SLOT(setFilterCategory()), Qt::CTRL+Qt::Key_A ); 62 mnuSetFilterCategory = filter->insertItem( tr( "Set Filter Category" ), this, SLOT(setFilterCategory()) );
63 63
64 // Create the main menu 64 // Create the main menu
65 menu = menuBar(); //new QMenuBar( this ); 65 menu = menuBar(); //new QMenuBar( this );
66 menu->insertItem( tr( "&Settings" ), settings ); 66 menu->insertItem( tr( "Settings" ), settings );
67 menu->insertItem( tr( "&Edit" ), edit ); 67 menu->insertItem( tr( "Edit" ), edit );
68 menu->insertItem( tr( "&Filter" ), filter ); 68 menu->insertItem( tr( "Filter" ), filter );
69 menu->insertItem( tr( "&Help" ), help ); 69 menu->insertItem( tr( "Help" ), help );
70 70
71 // Create UI widgets 71 // Create UI widgets
72 stack = new QWidgetStack( this ); 72 stack = new QWidgetStack( this );
73 73
74 progressWindow = new ProgressWidget( stack ); 74 progressWindow = new ProgressWidget( stack );
75 stack->addWidget( progressWindow, 2 ); 75 stack->addWidget( progressWindow, 2 );
76 76
77 networkPkgWindow = new NetworkPackageManager( stack ); 77 networkPkgWindow = new NetworkPackageManager( stack );
78 connect( networkPkgWindow, SIGNAL( appRaiseMainWidget() ), this, SLOT( raiseMainWidget() ) ); 78 connect( networkPkgWindow, SIGNAL( appRaiseMainWidget() ), this, SLOT( raiseMainWidget() ) );
79 connect( networkPkgWindow, SIGNAL( appRaiseProgressWidget() ), this, SLOT( raiseProgressWidget() ) ); 79 connect( networkPkgWindow, SIGNAL( appRaiseProgressWidget() ), this, SLOT( raiseProgressWidget() ) );
80 connect( networkPkgWindow, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); 80 connect( networkPkgWindow, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) );
81 connect( networkPkgWindow, SIGNAL( progressSetMessage( const QString & ) ), 81 connect( networkPkgWindow, SIGNAL( progressSetMessage( const QString & ) ),
82 progressWindow, SLOT( setMessage( const QString & ) ) ); 82 progressWindow, SLOT( setMessage( const QString & ) ) );
83 connect( networkPkgWindow, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); 83 connect( networkPkgWindow, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) );
84 stack->addWidget( networkPkgWindow, 1 ); 84 stack->addWidget( networkPkgWindow, 1 );
85 85
86 setCentralWidget( stack ); 86 setCentralWidget( stack );
87 stack->raiseWidget( progressWindow ); 87 stack->raiseWidget( progressWindow );
88 88
89 // Delayed call to finish initialization 89 // Delayed call to finish initialization
90 QTimer::singleShot( 100, this, SLOT( init() ) ); 90 QTimer::singleShot( 100, this, SLOT( init() ) );
91 91
92} 92}
93 93
94MainWindow :: ~MainWindow() 94MainWindow :: ~MainWindow()
95{ 95{
96 delete mgr; 96 delete mgr;
97} 97}
98 98
99void MainWindow :: init() 99void MainWindow :: init()
100{ 100{
101 stack->raiseWidget( progressWindow ); 101 stack->raiseWidget( progressWindow );
102 mgr = new DataManager(); 102 mgr = new DataManager();
103 connect( mgr, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); 103 connect( mgr, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) );
104 connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), 104 connect( mgr, SIGNAL( progressSetMessage( const QString & ) ),
105 progressWindow, SLOT( setMessage( const QString & ) ) ); 105 progressWindow, SLOT( setMessage( const QString & ) ) );
106 connect( mgr, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); 106 connect( mgr, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) );
107 mgr->loadServers(); 107 mgr->loadServers();
108 networkPkgWindow->setDataManager( mgr ); 108 networkPkgWindow->setDataManager( mgr );
109 networkPkgWindow->updateData(); 109 networkPkgWindow->updateData();
110 stack->raiseWidget( networkPkgWindow ); 110 stack->raiseWidget( networkPkgWindow );
111} 111}
112 112
113void MainWindow :: setDocument( const QString &doc ) 113void MainWindow :: setDocument( const QString &doc )
114{ 114{
115 // Remove path from package 115 // Remove path from package
116 QString package = Utils::getPackageNameFromIpkFilename( doc ); 116 QString package = Utils::getPackageNameFromIpkFilename( doc );
117 std::cout << "Selecting package " << package << std::endl; 117 std::cout << "Selecting package " << package << std::endl;
118 networkPkgWindow->selectLocalPackage( package ); 118 networkPkgWindow->selectLocalPackage( package );
119} 119}
120 120
121void MainWindow :: displaySettings() 121void MainWindow :: displaySettings()
122{ 122{
123 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); 123 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true );
124 if ( dlg->showDlg( 0 ) ) 124 if ( dlg->showDlg( 0 ) )
125 networkPkgWindow->updateData(); 125 networkPkgWindow->updateData();
126 delete dlg; 126 delete dlg;
127} 127}
128 128
129void MainWindow :: displayHelp() 129void MainWindow :: displayHelp()
130{ 130{
131 HelpWindow *dlg = new HelpWindow( this ); 131 HelpWindow *dlg = new HelpWindow( this );
132 dlg->exec(); 132 dlg->exec();
133 delete dlg; 133 delete dlg;
134} 134}
135 135
136void MainWindow :: searchForPackage() 136void MainWindow :: searchForPackage()
137{ 137{
138 networkPkgWindow->searchForPackage( false ); 138 networkPkgWindow->searchForPackage( false );
139} 139}
140 140
141void MainWindow :: repeatSearchForPackage() 141void MainWindow :: repeatSearchForPackage()
142{ 142{
143 networkPkgWindow->searchForPackage( true ); 143 networkPkgWindow->searchForPackage( true );
144} 144}
145 145
146void MainWindow :: displayAbout() 146void MainWindow :: displayAbout()
147{ 147{
148 QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); 148 QMessageBox::about( this, tr( "About AQPkg" ), tr( VERSION_TEXT ) );
149} 149}
150 150
151 151
152void MainWindow :: filterUninstalledPackages() 152void MainWindow :: filterUninstalledPackages()
153{ 153{
154 bool val; 154 bool val;
155 if ( filter->isItemChecked( mnuShowUninstalledPkgsId ) ) 155 if ( filter->isItemChecked( mnuShowUninstalledPkgsId ) )
156 { 156 {
157 val = false; 157 val = false;
158 filter->setItemChecked( mnuShowUninstalledPkgsId, false ); 158 filter->setItemChecked( mnuShowUninstalledPkgsId, false );
159 } 159 }
160 else 160 else
161 { 161 {
162 val = true; 162 val = true;
163 filter->setItemChecked( mnuShowUninstalledPkgsId, true ); 163 filter->setItemChecked( mnuShowUninstalledPkgsId, true );
164 } 164 }
165 165
166 filter->setItemChecked( mnuShowInstalledPkgsId, false ); 166 filter->setItemChecked( mnuShowInstalledPkgsId, false );
167 networkPkgWindow->showOnlyInstalledPackages( false ); 167 networkPkgWindow->showOnlyInstalledPackages( false );
168 filter->setItemChecked( mnuShowUpgradedPkgsId, false ); 168 filter->setItemChecked( mnuShowUpgradedPkgsId, false );
169 networkPkgWindow->showUpgradedPackages( false ); 169 networkPkgWindow->showUpgradedPackages( false );
170 170
171 networkPkgWindow->showOnlyUninstalledPackages( val ); 171 networkPkgWindow->showOnlyUninstalledPackages( val );
172 172
173} 173}
174 174
175void MainWindow :: filterInstalledPackages() 175void MainWindow :: filterInstalledPackages()
176{ 176{
177 bool val; 177 bool val;
178 if ( filter->isItemChecked( mnuShowInstalledPkgsId ) ) 178 if ( filter->isItemChecked( mnuShowInstalledPkgsId ) )
179 { 179 {
180 val = false; 180 val = false;
181 filter->setItemChecked( mnuShowInstalledPkgsId, false ); 181 filter->setItemChecked( mnuShowInstalledPkgsId, false );
182 } 182 }
183 else 183 else
184 { 184 {
185 val = true; 185 val = true;
186 filter->setItemChecked( mnuShowInstalledPkgsId, true ); 186 filter->setItemChecked( mnuShowInstalledPkgsId, true );
187 } 187 }
188 188
189 filter->setItemChecked( mnuShowUninstalledPkgsId, false ); 189 filter->setItemChecked( mnuShowUninstalledPkgsId, false );
190 networkPkgWindow->showOnlyUninstalledPackages( false ); 190 networkPkgWindow->showOnlyUninstalledPackages( false );
191 filter->setItemChecked( mnuShowUpgradedPkgsId, false ); 191 filter->setItemChecked( mnuShowUpgradedPkgsId, false );
192 networkPkgWindow->showUpgradedPackages( false ); 192 networkPkgWindow->showUpgradedPackages( false );
193 193
194 networkPkgWindow->showOnlyInstalledPackages( val ); 194 networkPkgWindow->showOnlyInstalledPackages( val );
195} 195}
196 196
197void MainWindow :: filterUpgradedPackages() 197void MainWindow :: filterUpgradedPackages()
198{ 198{
199 bool val; 199 bool val;
200 if ( filter->isItemChecked( mnuShowUpgradedPkgsId ) ) 200 if ( filter->isItemChecked( mnuShowUpgradedPkgsId ) )
201 { 201 {
202 val = false; 202 val = false;
203 filter->setItemChecked( mnuShowUpgradedPkgsId, false ); 203 filter->setItemChecked( mnuShowUpgradedPkgsId, false );
204 } 204 }
205 else 205 else
206 { 206 {
207 val = true; 207 val = true;
208 filter->setItemChecked( mnuShowUpgradedPkgsId, true ); 208 filter->setItemChecked( mnuShowUpgradedPkgsId, true );
209 } 209 }
210 210
211 filter->setItemChecked( mnuShowUninstalledPkgsId, false ); 211 filter->setItemChecked( mnuShowUninstalledPkgsId, false );
212 networkPkgWindow->showOnlyUninstalledPackages( false ); 212 networkPkgWindow->showOnlyUninstalledPackages( false );
213 filter->setItemChecked( mnuShowInstalledPkgsId, false ); 213 filter->setItemChecked( mnuShowInstalledPkgsId, false );
214 networkPkgWindow->showOnlyInstalledPackages( false ); 214 networkPkgWindow->showOnlyInstalledPackages( false );
215 215
216 networkPkgWindow->showUpgradedPackages( val ); 216 networkPkgWindow->showUpgradedPackages( val );
217} 217}
218 218
219void MainWindow :: setFilterCategory() 219void MainWindow :: setFilterCategory()
220{ 220{
221 if ( networkPkgWindow->setFilterCategory( ) ) 221 if ( networkPkgWindow->setFilterCategory( ) )
222 filter->setItemChecked( mnuFilterByCategory, true ); 222 filter->setItemChecked( mnuFilterByCategory, true );
223} 223}
224 224
225void MainWindow :: filterCategory() 225void MainWindow :: filterCategory()
226{ 226{
227 if ( filter->isItemChecked( mnuFilterByCategory ) ) 227 if ( filter->isItemChecked( mnuFilterByCategory ) )
228 { 228 {
229 networkPkgWindow->filterByCategory( false ); 229 networkPkgWindow->filterByCategory( false );
230 filter->setItemChecked( mnuFilterByCategory, false ); 230 filter->setItemChecked( mnuFilterByCategory, false );
231 } 231 }
232 else 232 else
233 { 233 {
234 if ( networkPkgWindow->filterByCategory( true ) ) 234 if ( networkPkgWindow->filterByCategory( true ) )
235 filter->setItemChecked( mnuFilterByCategory, true ); 235 filter->setItemChecked( mnuFilterByCategory, true );
236 } 236 }
237} 237}
238 238
239void MainWindow :: raiseMainWidget() 239void MainWindow :: raiseMainWidget()
240{ 240{
241 stack->raiseWidget( networkPkgWindow ); 241 stack->raiseWidget( networkPkgWindow );
242} 242}
243 243
244void MainWindow :: raiseProgressWidget() 244void MainWindow :: raiseProgressWidget()
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index cae0d8f..ee37157 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -52,838 +52,838 @@ NetworkPackageManager::NetworkPackageManager( QWidget *parent, const char *name
52 52
53#ifdef QWS 53#ifdef QWS
54 // read download directory from config file 54 // read download directory from config file
55 Config cfg( "aqpkg" ); 55 Config cfg( "aqpkg" );
56 cfg.setGroup( "settings" ); 56 cfg.setGroup( "settings" );
57 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); 57 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
58 showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); 58 showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
59 59
60#endif 60#endif
61 61
62 showUninstalledPkgs = false; 62 showUninstalledPkgs = false;
63 showInstalledPkgs = false; 63 showInstalledPkgs = false;
64 showUpgradedPkgs = false; 64 showUpgradedPkgs = false;
65 categoryFilterEnabled = false; 65 categoryFilterEnabled = false;
66 66
67 initGui(); 67 initGui();
68 setupConnections(); 68 setupConnections();
69 69
70 //updateData(); 70 //updateData();
71} 71}
72 72
73NetworkPackageManager::~NetworkPackageManager() 73NetworkPackageManager::~NetworkPackageManager()
74{ 74{
75} 75}
76 76
77void NetworkPackageManager :: setDataManager( DataManager *dm ) 77void NetworkPackageManager :: setDataManager( DataManager *dm )
78{ 78{
79 dataMgr = dm; 79 dataMgr = dm;
80} 80}
81 81
82void NetworkPackageManager :: updateData() 82void NetworkPackageManager :: updateData()
83{ 83{
84 emit progressSetSteps( dataMgr->getServerList().size() ); 84 emit progressSetSteps( dataMgr->getServerList().size() );
85 85
86 serversList->clear(); 86 serversList->clear();
87 packagesList->clear(); 87 packagesList->clear();
88 88
89 vector<Server>::iterator it; 89 vector<Server>::iterator it;
90 int activeItem = -1; 90 int activeItem = -1;
91 int i; 91 int i;
92 QString serverName; 92 QString serverName;
93 for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) 93 for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i )
94 { 94 {
95 serverName = it->getServerName(); 95 serverName = it->getServerName();
96 emit progressSetMessage( tr( "Building server list:\n\t%1" ).arg( serverName ) ); 96 emit progressSetMessage( tr( "Building server list:\n\t%1" ).arg( serverName ) );
97 emit progressUpdate( i ); 97 emit progressUpdate( i );
98 qApp->processEvents(); 98 qApp->processEvents();
99 99
100// cout << "Adding " << it->getServerName() << " to combobox" << endl; 100// cout << "Adding " << it->getServerName() << " to combobox" << endl;
101 if ( !it->isServerActive() ) 101 if ( !it->isServerActive() )
102 { 102 {
103 cout << serverName << " is not active" << endl; 103 cout << serverName << " is not active" << endl;
104 i--; 104 i--;
105 continue; 105 continue;
106 } 106 }
107 107
108 serversList->insertItem( serverName ); 108 serversList->insertItem( serverName );
109 if ( serverName == currentlySelectedServer ) 109 if ( serverName == currentlySelectedServer )
110 activeItem = i; 110 activeItem = i;
111 } 111 }
112 112
113 // set selected server to be active server 113 // set selected server to be active server
114 if ( activeItem != -1 ) 114 if ( activeItem != -1 )
115 serversList->setCurrentItem( activeItem ); 115 serversList->setCurrentItem( activeItem );
116 serverSelected( 0, FALSE ); 116 serverSelected( 0, FALSE );
117} 117}
118 118
119void NetworkPackageManager :: selectLocalPackage( const QString &pkg ) 119void NetworkPackageManager :: selectLocalPackage( const QString &pkg )
120{ 120{
121 // First select local server 121 // First select local server
122 for ( int i = 0 ; i < serversList->count() ; ++i ) 122 for ( int i = 0 ; i < serversList->count() ; ++i )
123 { 123 {
124 if ( serversList->text( i ) == LOCAL_IPKGS ) 124 if ( serversList->text( i ) == LOCAL_IPKGS )
125 { 125 {
126 serversList->setCurrentItem( i ); 126 serversList->setCurrentItem( i );
127 break; 127 break;
128 } 128 }
129 } 129 }
130 serverSelected( 0 ); 130 serverSelected( 0 );
131 131
132 // Now set the check box of the selected package 132 // Now set the check box of the selected package
133 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 133 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
134 item != 0 ; 134 item != 0 ;
135 item = (QCheckListItem *)item->nextSibling() ) 135 item = (QCheckListItem *)item->nextSibling() )
136 { 136 {
137 if ( item->text().startsWith( pkg ) ) 137 if ( item->text().startsWith( pkg ) )
138 { 138 {
139 item->setOn( true ); 139 item->setOn( true );
140 break; 140 break;
141 } 141 }
142 } 142 }
143} 143}
144 144
145 145
146void NetworkPackageManager :: initGui() 146void NetworkPackageManager :: initGui()
147{ 147{
148 QLabel *l = new QLabel( "Servers", this ); 148 QLabel *l = new QLabel( tr( "Servers" ), this );
149 serversList = new QComboBox( this ); 149 serversList = new QComboBox( this );
150 packagesList = new QListView( this ); 150 packagesList = new QListView( this );
151 update = new QPushButton( "Refresh Lists", this ); 151 update = new QPushButton( tr( "Refresh Lists" ), this );
152 download = new QPushButton( "Download", this ); 152 download = new QPushButton( tr( "Download" ), this );
153 upgrade = new QPushButton( "Upgrade", this ); 153 upgrade = new QPushButton( tr( "Upgrade" ), this );
154 apply = new QPushButton( "Apply", this ); 154 apply = new QPushButton( tr( "Apply" ), this );
155 155
156 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" ); 156 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1 );
157 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" ); 157 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 );
158 hbox1->addWidget( l ); 158 hbox1->addWidget( l );
159 hbox1->addWidget( serversList ); 159 hbox1->addWidget( serversList );
160 160
161 QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" ); 161 QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 );
162 QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" ); 162 QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 );
163 163
164 164
165 if ( showJumpTo ) 165 if ( showJumpTo )
166 { 166 {
167 char text[2]; 167 char text[2];
168 text[1] = '\0'; 168 text[1] = '\0';
169 for ( int i = 0 ; i < 26 ; ++i ) 169 for ( int i = 0 ; i < 26 ; ++i )
170 { 170 {
171 text[0] = 'A' + i; 171 text[0] = 'A' + i;
172 LetterPushButton *b = new LetterPushButton( text, this ); 172 LetterPushButton *b = new LetterPushButton( text, this );
173 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); 173 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
174 if ( i < 13 ) 174 if ( i < 13 )
175 hbox3->addWidget( b ); 175 hbox3->addWidget( b );
176 else 176 else
177 hbox4->addWidget( b ); 177 hbox4->addWidget( b );
178 } 178 }
179 } 179 }
180 180
181 vbox->addWidget( packagesList ); 181 vbox->addWidget( packagesList );
182 packagesList->addColumn( "Packages" ); 182 packagesList->addColumn( tr( "Packages" ) );
183 183
184 QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" ); 184 QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1 );
185 hbox2->addWidget( update ); 185 hbox2->addWidget( update );
186 hbox2->addWidget( download ); 186 hbox2->addWidget( download );
187 hbox2->addWidget( upgrade ); 187 hbox2->addWidget( upgrade );
188 hbox2->addWidget( apply ); 188 hbox2->addWidget( apply );
189} 189}
190 190
191void NetworkPackageManager :: setupConnections() 191void NetworkPackageManager :: setupConnections()
192{ 192{
193 connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); 193 connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int )));
194 connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) ); 194 connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) );
195 connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) ); 195 connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) );
196 connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) ); 196 connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) );
197 connect( update, SIGNAL(released()), this, SLOT(updateServer()) ); 197 connect( update, SIGNAL(released()), this, SLOT(updateServer()) );
198} 198}
199 199
200void NetworkPackageManager :: serverSelected( int index ) 200void NetworkPackageManager :: serverSelected( int index )
201{ 201{
202 serverSelected( index, TRUE ); 202 serverSelected( index, TRUE );
203} 203}
204 204
205void NetworkPackageManager :: serverSelected( int, bool raiseProgress ) 205void NetworkPackageManager :: serverSelected( int, bool raiseProgress )
206{ 206{
207 // display packages 207 // display packages
208 QString serverName = serversList->currentText(); 208 QString serverName = serversList->currentText();
209 currentlySelectedServer = serverName; 209 currentlySelectedServer = serverName;
210 210
211 vector<Server>::iterator s = dataMgr->getServer( serverName ); 211 vector<Server>::iterator s = dataMgr->getServer( serverName );
212 212
213 vector<Package> &list = s->getPackageList(); 213 vector<Package> &list = s->getPackageList();
214 vector<Package>::iterator it; 214 vector<Package>::iterator it;
215 215
216 // Display progress widget while loading list 216 // Display progress widget while loading list
217 bool doProgress = ( list.size() > 200 ); 217 bool doProgress = ( list.size() > 200 );
218 if ( doProgress ) 218 if ( doProgress )
219 { 219 {
220 if ( raiseProgress ) 220 if ( raiseProgress )
221 { 221 {
222 emit appRaiseProgressWidget(); 222 emit appRaiseProgressWidget();
223 } 223 }
224 emit progressSetSteps( list.size() ); 224 emit progressSetSteps( list.size() );
225 emit progressSetMessage( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); 225 emit progressSetMessage( tr( "Building package list for:\n\t%1" ).arg( serverName ) );
226 } 226 }
227 227
228 packagesList->clear(); 228 packagesList->clear();
229 229
230#ifdef QWS 230#ifdef QWS
231 // read download directory from config file 231 // read download directory from config file
232 Config cfg( "aqpkg" ); 232 Config cfg( "aqpkg" );
233 cfg.setGroup( "settings" ); 233 cfg.setGroup( "settings" );
234 cfg.writeEntry( "selectedServer", currentlySelectedServer ); 234 cfg.writeEntry( "selectedServer", currentlySelectedServer );
235#endif 235#endif
236 236
237 int i = 0; 237 int i = 0;
238 for ( it = list.begin() ; it != list.end() ; ++it ) 238 for ( it = list.begin() ; it != list.end() ; ++it )
239 { 239 {
240 // Update progress after every 100th package (arbitrary value, seems to give good balance) 240 // Update progress after every 100th package (arbitrary value, seems to give good balance)
241 i++; 241 i++;
242 if ( ( i % 100 ) == 0 ) 242 if ( ( i % 100 ) == 0 )
243 { 243 {
244 if ( doProgress ) 244 if ( doProgress )
245 { 245 {
246 emit progressUpdate( i ); 246 emit progressUpdate( i );
247 } 247 }
248 qApp->processEvents(); 248 qApp->processEvents();
249 } 249 }
250 250
251 QString text = ""; 251 QString text = "";
252 252
253 // Apply show only uninstalled packages filter 253 // Apply show only uninstalled packages filter
254 if ( showUninstalledPkgs && it->isInstalled() ) 254 if ( showUninstalledPkgs && it->isInstalled() )
255 continue; 255 continue;
256 256
257 // Apply show only installed packages filter 257 // Apply show only installed packages filter
258 if ( showInstalledPkgs && !it->isInstalled() ) 258 if ( showInstalledPkgs && !it->isInstalled() )
259 continue; 259 continue;
260 260
261 // Apply show only new installed packages filter 261 // Apply show only new installed packages filter
262 if ( showUpgradedPkgs ) 262 if ( showUpgradedPkgs )
263 { 263 {
264 if ( !it->isInstalled() || 264 if ( !it->isInstalled() ||
265 compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 ) 265 compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 )
266 continue; 266 continue;
267 } 267 }
268 268
269 // Apply the section filter 269 // Apply the section filter
270 if ( categoryFilterEnabled && categoryFilter != "" ) 270 if ( categoryFilterEnabled && categoryFilter != "" )
271 { 271 {
272 if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 ) 272 if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 )
273 continue; 273 continue;
274 } 274 }
275 275
276 // If the local server, only display installed packages 276 // If the local server, only display installed packages
277 if ( serverName == LOCAL_SERVER && !it->isInstalled() ) 277 if ( serverName == LOCAL_SERVER && !it->isInstalled() )
278 continue; 278 continue;
279 279
280 280
281 text += it->getPackageName(); 281 text += it->getPackageName();
282 if ( it->isInstalled() ) 282 if ( it->isInstalled() )
283 { 283 {
284 text += " (installed)"; 284 text += " (installed)";
285 285
286 // If a different version of package is available, postfix it with an * 286 // If a different version of package is available, postfix it with an *
287 if ( it->getVersion() != it->getInstalledVersion() ) 287 if ( it->getVersion() != it->getInstalledVersion() )
288 { 288 {
289 289
290 if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 ) 290 if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 )
291 text += "*"; 291 text += "*";
292 } 292 }
293 } 293 }
294 294
295 QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); 295 QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox );
296 296
297 if ( it->isInstalled() ) 297 if ( it->isInstalled() )
298 { 298 {
299 QString destName = ""; 299 QString destName = "";
300 if ( it->getLocalPackage() ) 300 if ( it->getLocalPackage() )
301 { 301 {
302 if ( it->getLocalPackage()->getInstalledTo() ) 302 if ( it->getLocalPackage()->getInstalledTo() )
303 destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); 303 destName = it->getLocalPackage()->getInstalledTo()->getDestinationName();
304 } 304 }
305 else 305 else
306 { 306 {
307 if ( it->getInstalledTo() ) 307 if ( it->getInstalledTo() )
308 destName = it->getInstalledTo()->getDestinationName(); 308 destName = it->getInstalledTo()->getDestinationName();
309 } 309 }
310 if ( destName != "" ) 310 if ( destName != "" )
311 new QCheckListItem( item, QString( "Installed To - " ) + destName ); 311 new QCheckListItem( item, QString( tr( "Installed To - " ) ) + destName );
312 } 312 }
313 313
314 if ( !it->isPackageStoredLocally() ) 314 if ( !it->isPackageStoredLocally() )
315 { 315 {
316 new QCheckListItem( item, QString( "Description - " ) + it->getDescription() ); 316 new QCheckListItem( item, QString( tr( "Description - " ) ) + it->getDescription() );
317 new QCheckListItem( item, QString( "Size - " ) + it->getPackageSize() ); 317 new QCheckListItem( item, QString( tr( "Size - " ) ) + it->getPackageSize() );
318 new QCheckListItem( item, QString( "Section - " ) + it->getSection() ); 318 new QCheckListItem( item, QString( tr( "Section - " ) ) + it->getSection() );
319 } 319 }
320 else 320 else
321 new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() ); 321 new QCheckListItem( item, QString( tr( "Filename - " ) ) + it->getFilename() );
322 322
323 if ( serverName == LOCAL_SERVER ) 323 if ( serverName == LOCAL_SERVER )
324 { 324 {
325 new QCheckListItem( item, QString( "V. Installed - " ) + it->getVersion() ); 325 new QCheckListItem( item, QString( tr( "V. Installed - " ) ) + it->getVersion() );
326 } 326 }
327 else 327 else
328 { 328 {
329 new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() ); 329 new QCheckListItem( item, QString( tr( "V. Available - " ) ) + it->getVersion() );
330 if ( it->getLocalPackage() ) 330 if ( it->getLocalPackage() )
331 { 331 {
332 if ( it->isInstalled() ) 332 if ( it->isInstalled() )
333 new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() ); 333 new QCheckListItem( item, QString( tr( "V. Installed - " ) ) + it->getInstalledVersion() );
334 } 334 }
335 } 335 }
336 336
337 packagesList->insertItem( item ); 337 packagesList->insertItem( item );
338 } 338 }
339 339
340 // If the local server or the local ipkgs server disable the download button 340 // If the local server or the local ipkgs server disable the download button
341 if ( serverName == LOCAL_SERVER ) 341 if ( serverName == LOCAL_SERVER )
342 { 342 {
343 upgrade->setEnabled( false ); 343 upgrade->setEnabled( false );
344 download->setText( "Download" ); 344 download->setText( tr( "Download" ) );
345 download->setEnabled( true ); 345 download->setEnabled( true );
346 } 346 }
347 else if ( serverName == LOCAL_IPKGS ) 347 else if ( serverName == LOCAL_IPKGS )
348 { 348 {
349 upgrade->setEnabled( false ); 349 upgrade->setEnabled( false );
350 download->setEnabled( true ); 350 download->setEnabled( true );
351 download->setText( "Remove" ); 351 download->setText( tr( "Remove" ) );
352 } 352 }
353 else 353 else
354 { 354 {
355 upgrade->setEnabled( true ); 355 upgrade->setEnabled( true );
356 download->setEnabled( true ); 356 download->setEnabled( true );
357 download->setText( "Download" ); 357 download->setText( tr( "Download" ) );
358 } 358 }
359 359
360 // Display this widget once everything is done 360 // Display this widget once everything is done
361 if ( doProgress && raiseProgress ) 361 if ( doProgress && raiseProgress )
362 { 362 {
363 emit appRaiseMainWidget(); 363 emit appRaiseMainWidget();
364 } 364 }
365} 365}
366 366
367void NetworkPackageManager :: updateServer() 367void NetworkPackageManager :: updateServer()
368{ 368{
369 QString serverName = serversList->currentText(); 369 QString serverName = serversList->currentText();
370 370
371 // Update the current server 371 // Update the current server
372 // Display dialog 372 // Display dialog
373 373
374 // Disable buttons to stop silly people clicking lots on them :) 374 // Disable buttons to stop silly people clicking lots on them :)
375 375
376 // First, write out ipkg_conf file so that ipkg can use it 376 // First, write out ipkg_conf file so that ipkg can use it
377 dataMgr->writeOutIpkgConf(); 377 dataMgr->writeOutIpkgConf();
378 378
379 Ipkg ipkg; 379 Ipkg ipkg;
380 ipkg.setOption( "update" ); 380 ipkg.setOption( "update" );
381 381
382 InstallDlgImpl dlg( &ipkg, "Refreshing server package lists", this, "Upgrade", true ); 382 InstallDlgImpl dlg( &ipkg, tr( "Refreshing server package lists" ), this, tr( "Upgrade" ), true );
383 dlg.showDlg(); 383 dlg.showDlg();
384 384
385 // Reload data 385 // Reload data
386 dataMgr->reloadServerData(); 386 dataMgr->reloadServerData();
387 serverSelected(-1); 387 serverSelected(-1);
388// delete progDlg; 388// delete progDlg;
389} 389}
390 390
391void NetworkPackageManager :: upgradePackages() 391void NetworkPackageManager :: upgradePackages()
392{ 392{
393 // We're gonna do an upgrade of all packages 393 // We're gonna do an upgrade of all packages
394 // First warn user that this isn't recommended 394 // First warn user that this isn't recommended
395 QString text = "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n"; 395 QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" );
396 QMessageBox warn("Warning", text, QMessageBox::Warning, 396 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning,
397 QMessageBox::Yes, 397 QMessageBox::Yes,
398 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , 398 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
399 0, this ); 399 0, this );
400 warn.adjustSize(); 400 warn.adjustSize();
401 401
402 if ( warn.exec() == QMessageBox::Yes ) 402 if ( warn.exec() == QMessageBox::Yes )
403 { 403 {
404 // First, write out ipkg_conf file so that ipkg can use it 404 // First, write out ipkg_conf file so that ipkg can use it
405 dataMgr->writeOutIpkgConf(); 405 dataMgr->writeOutIpkgConf();
406 406
407 // Now run upgrade 407 // Now run upgrade
408 Ipkg ipkg; 408 Ipkg ipkg;
409 ipkg.setOption( "upgrade" ); 409 ipkg.setOption( "upgrade" );
410 410
411 InstallDlgImpl dlg( &ipkg, "Upgrading installed packages", this, "Upgrade", true ); 411 InstallDlgImpl dlg( &ipkg, tr( "Upgrading installed packages" ), this, tr( "Upgrade" ), true );
412 dlg.showDlg(); 412 dlg.showDlg();
413 413
414 // Reload data 414 // Reload data
415 dataMgr->reloadServerData(); 415 dataMgr->reloadServerData();
416 serverSelected(-1); 416 serverSelected(-1);
417 } 417 }
418} 418}
419 419
420 420
421void NetworkPackageManager :: downloadPackage() 421void NetworkPackageManager :: downloadPackage()
422{ 422{
423 bool doUpdate = true; 423 bool doUpdate = true;
424 if ( download->text() == "Download" ) 424 if ( download->text() == tr( "Download" ) )
425 { 425 {
426 // See if any packages are selected 426 // See if any packages are selected
427 bool found = false; 427 bool found = false;
428 if ( serversList->currentText() != LOCAL_SERVER ) 428 if ( serversList->currentText() != LOCAL_SERVER )
429 { 429 {
430 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 430 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
431 item != 0 && !found; 431 item != 0 && !found;
432 item = (QCheckListItem *)item->nextSibling() ) 432 item = (QCheckListItem *)item->nextSibling() )
433 { 433 {
434 if ( item->isOn() ) 434 if ( item->isOn() )
435 found = true; 435 found = true;
436 } 436 }
437 } 437 }
438 438
439 // If user selected some packages then download the and store the locally 439 // If user selected some packages then download the and store the locally
440 // otherwise, display dialog asking user what package to download from an http server 440 // otherwise, display dialog asking user what package to download from an http server
441 // and whether to install it 441 // and whether to install it
442 if ( found ) 442 if ( found )
443 downloadSelectedPackages(); 443 downloadSelectedPackages();
444 else 444 else
445 downloadRemotePackage(); 445 downloadRemotePackage();
446 446
447 } 447 }
448 else if ( download->text() == "Remove" ) 448 else if ( download->text() == tr( "Remove" ) )
449 { 449 {
450 doUpdate = false; 450 doUpdate = false;
451 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 451 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
452 item != 0 ; 452 item != 0 ;
453 item = (QCheckListItem *)item->nextSibling() ) 453 item = (QCheckListItem *)item->nextSibling() )
454 { 454 {
455 if ( item->isOn() ) 455 if ( item->isOn() )
456 { 456 {
457 QString name = item->text(); 457 QString name = item->text();
458 int pos = name.find( "*" ); 458 int pos = name.find( "*" );
459 name.truncate( pos ); 459 name.truncate( pos );
460 460
461 // if (there is a (installed), remove it 461 // if (there is a (installed), remove it
462 pos = name.find( "(installed)" ); 462 pos = name.find( "(installed)" );
463 if ( pos > 0 ) 463 if ( pos > 0 )
464 name.truncate( pos - 1 ); 464 name.truncate( pos - 1 );
465 465
466 Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name ); 466 Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name );
467 467
468 QString msgtext; 468 QString msgtext;
469 msgtext.sprintf( "Are you sure you wish to delete\n%s?", (const char *)p->getPackageName() ); 469 msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() );
470 if ( QMessageBox::information( this, "Are you sure?", 470 if ( QMessageBox::information( this, tr( "Are you sure?" ),
471 msgtext, "No", "Yes" ) == 1 ) 471 msgtext, tr( "No" ), tr( "Yes" ) ) == 1 )
472 { 472 {
473 doUpdate = true; 473 doUpdate = true;
474 QFile f( p->getFilename() ); 474 QFile f( p->getFilename() );
475 f.remove(); 475 f.remove();
476 } 476 }
477 } 477 }
478 } 478 }
479 } 479 }
480 480
481 if ( doUpdate ) 481 if ( doUpdate )
482 { 482 {
483 dataMgr->reloadServerData(); 483 dataMgr->reloadServerData();
484 serverSelected( -1 ); 484 serverSelected( -1 );
485 } 485 }
486} 486}
487 487
488void NetworkPackageManager :: downloadSelectedPackages() 488void NetworkPackageManager :: downloadSelectedPackages()
489{ 489{
490 // First, write out ipkg_conf file so that ipkg can use it 490 // First, write out ipkg_conf file so that ipkg can use it
491 dataMgr->writeOutIpkgConf(); 491 dataMgr->writeOutIpkgConf();
492 492
493 // Display dialog to user asking where to download the files to 493 // Display dialog to user asking where to download the files to
494 bool ok = FALSE; 494 bool ok = FALSE;
495 QString dir = ""; 495 QString dir = "";
496#ifdef QWS 496#ifdef QWS
497 // read download directory from config file 497 // read download directory from config file
498 Config cfg( "aqpkg" ); 498 Config cfg( "aqpkg" );
499 cfg.setGroup( "settings" ); 499 cfg.setGroup( "settings" );
500 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); 500 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" );
501#endif 501#endif
502 502
503 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); 503 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this );
504 if ( ok && !text.isEmpty() ) 504 if ( ok && !text.isEmpty() )
505 dir = text; // user entered something and pressed ok 505 dir = text; // user entered something and pressed ok
506 else 506 else
507 return; // user entered nothing or pressed cancel 507 return; // user entered nothing or pressed cancel
508 508
509#ifdef QWS 509#ifdef QWS
510 // Store download directory in config file 510 // Store download directory in config file
511 cfg.writeEntry( "downloadDir", dir ); 511 cfg.writeEntry( "downloadDir", dir );
512#endif 512#endif
513 513
514 // Get starting directory 514 // Get starting directory
515 char initDir[PATH_MAX]; 515 char initDir[PATH_MAX];
516 getcwd( initDir, PATH_MAX ); 516 getcwd( initDir, PATH_MAX );
517 517
518 // Download each package 518 // Download each package
519 Ipkg ipkg; 519 Ipkg ipkg;
520 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 520 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
521 521
522 ipkg.setOption( "download" ); 522 ipkg.setOption( "download" );
523 ipkg.setRuntimeDirectory( dir ); 523 ipkg.setRuntimeDirectory( dir );
524 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 524 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
525 item != 0 ; 525 item != 0 ;
526 item = (QCheckListItem *)item->nextSibling() ) 526 item = (QCheckListItem *)item->nextSibling() )
527 { 527 {
528 if ( item->isOn() ) 528 if ( item->isOn() )
529 { 529 {
530 QString name = item->text(); 530 QString name = item->text();
531 int pos = name.find( "*" ); 531 int pos = name.find( "*" );
532 name.truncate( pos ); 532 name.truncate( pos );
533 533
534 // if (there is a (installed), remove it 534 // if (there is a (installed), remove it
535 pos = name.find( "(installed)" ); 535 pos = name.find( "(installed)" );
536 if ( pos > 0 ) 536 if ( pos > 0 )
537 name.truncate( pos - 1 ); 537 name.truncate( pos - 1 );
538 538
539 ipkg.setPackage( name ); 539 ipkg.setPackage( name );
540 ipkg.runIpkg( ); 540 ipkg.runIpkg( );
541 } 541 }
542 } 542 }
543} 543}
544 544
545void NetworkPackageManager :: downloadRemotePackage() 545void NetworkPackageManager :: downloadRemotePackage()
546{ 546{
547 // Display dialog 547 // Display dialog
548 bool ok; 548 bool ok;
549 QString package = InputDialog::getText( "Install Remote Package", tr( "Enter package location" ), "http://", &ok, this ); 549 QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this );
550 if ( !ok || package.isEmpty() ) 550 if ( !ok || package.isEmpty() )
551 return; 551 return;
552// DownloadRemoteDlgImpl dlg( this, "Install", true ); 552// DownloadRemoteDlgImpl dlg( this, "Install", true );
553// if ( dlg.exec() == QDialog::Rejected ) 553// if ( dlg.exec() == QDialog::Rejected )
554// return; 554// return;
555 555
556 // grab details from dialog 556 // grab details from dialog
557// QString package = dlg.getPackageLocation(); 557// QString package = dlg.getPackageLocation();
558 558
559 InstallData item; 559 InstallData item;
560 item.option = "I"; 560 item.option = "I";
561 item.packageName = package; 561 item.packageName = package;
562 vector<InstallData> workingPackages; 562 vector<InstallData> workingPackages;
563 workingPackages.push_back( item ); 563 workingPackages.push_back( item );
564 564
565 InstallDlgImpl dlg2( workingPackages, dataMgr, this, "Install", true ); 565 InstallDlgImpl dlg2( workingPackages, dataMgr, this, "Install", true );
566 dlg2.showDlg(); 566 dlg2.showDlg();
567 567
568 // Reload data 568 // Reload data
569 dataMgr->reloadServerData(); 569 dataMgr->reloadServerData();
570 serverSelected(-1); 570 serverSelected(-1);
571 571
572#ifdef QWS 572#ifdef QWS
573 // Finally let the main system update itself 573 // Finally let the main system update itself
574 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 574 QCopEnvelope e("QPE/System", "linkChanged(QString)");
575 QString lf = QString::null; 575 QString lf = QString::null;
576 e << lf; 576 e << lf;
577#endif 577#endif
578} 578}
579 579
580 580
581void NetworkPackageManager :: applyChanges() 581void NetworkPackageManager :: applyChanges()
582{ 582{
583 stickyOption = ""; 583 stickyOption = "";
584 584
585 // First, write out ipkg_conf file so that ipkg can use it 585 // First, write out ipkg_conf file so that ipkg can use it
586 dataMgr->writeOutIpkgConf(); 586 dataMgr->writeOutIpkgConf();
587 587
588 // Now for each selected item 588 // Now for each selected item
589 // deal with it 589 // deal with it
590 590
591 vector<InstallData> workingPackages; 591 vector<InstallData> workingPackages;
592 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 592 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
593 item != 0 ; 593 item != 0 ;
594 item = (QCheckListItem *)item->nextSibling() ) 594 item = (QCheckListItem *)item->nextSibling() )
595 { 595 {
596 if ( item->isOn() ) 596 if ( item->isOn() )
597 { 597 {
598 InstallData data = dealWithItem( item ); 598 InstallData data = dealWithItem( item );
599 workingPackages.push_back( data ); 599 workingPackages.push_back( data );
600 } 600 }
601 } 601 }
602 602
603 if ( workingPackages.size() == 0 ) 603 if ( workingPackages.size() == 0 )
604 { 604 {
605 // Nothing to do 605 // Nothing to do
606 QMessageBox::information( this, "Nothing to do", 606 QMessageBox::information( this, tr( "Nothing to do" ),
607 "No packages selected", "OK" ); 607 tr( "No packages selected" ), tr( "OK" ) );
608 608
609 return; 609 return;
610 } 610 }
611 611
612 // do the stuff 612 // do the stuff
613 InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true ); 613 InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true );
614 dlg.showDlg(); 614 dlg.showDlg();
615 615
616 // Reload data 616 // Reload data
617 dataMgr->reloadServerData(); 617 dataMgr->reloadServerData();
618 serverSelected(-1); 618 serverSelected(-1);
619 619
620#ifdef QWS 620#ifdef QWS
621 // Finally let the main system update itself 621 // Finally let the main system update itself
622 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 622 QCopEnvelope e("QPE/System", "linkChanged(QString)");
623 QString lf = QString::null; 623 QString lf = QString::null;
624 e << lf; 624 e << lf;
625#endif 625#endif
626} 626}
627 627
628// decide what to do - either remove, upgrade or install 628// decide what to do - either remove, upgrade or install
629// Current rules: 629// Current rules:
630// If not installed - install 630// If not installed - install
631// If installed and different version available - upgrade 631// If installed and different version available - upgrade
632// If installed and version up to date - remove 632// If installed and version up to date - remove
633InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) 633InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
634{ 634{
635 QString name = item->text(); 635 QString name = item->text();
636 int pos = name.find( "*" ); 636 int pos = name.find( "*" );
637 name.truncate( pos ); 637 name.truncate( pos );
638 638
639 // if (there is a (installed), remove it 639 // if (there is a (installed), remove it
640 pos = name.find( "(installed)" ); 640 pos = name.find( "(installed)" );
641 if ( pos > 0 ) 641 if ( pos > 0 )
642 name.truncate( pos - 1 ); 642 name.truncate( pos - 1 );
643 643
644 // Get package 644 // Get package
645 vector<Server>::iterator s = dataMgr->getServer( serversList->currentText() ); 645 vector<Server>::iterator s = dataMgr->getServer( serversList->currentText() );
646 Package *p = s->getPackage( name ); 646 Package *p = s->getPackage( name );
647 647
648 // If the package has a filename then it is a local file 648 // If the package has a filename then it is a local file
649 if ( p->isPackageStoredLocally() ) 649 if ( p->isPackageStoredLocally() )
650 name = p->getFilename(); 650 name = p->getFilename();
651 651
652 QString option; 652 QString option;
653 QString dest = "root"; 653 QString dest = "root";
654 if ( !p->isInstalled() ) 654 if ( !p->isInstalled() )
655 { 655 {
656 InstallData item; 656 InstallData item;
657 item.option = "I"; 657 item.option = "I";
658 item.packageName = name; 658 item.packageName = name;
659 return item; 659 return item;
660 } 660 }
661 else 661 else
662 { 662 {
663 InstallData item; 663 InstallData item;
664 item.option = "D"; 664 item.option = "D";
665 if ( !p->isPackageStoredLocally() ) 665 if ( !p->isPackageStoredLocally() )
666 item.packageName = p->getInstalledPackageName(); 666 item.packageName = p->getInstalledPackageName();
667 else 667 else
668 item.packageName = name; 668 item.packageName = name;
669 669
670 if ( p->getInstalledTo() ) 670 if ( p->getInstalledTo() )
671 { 671 {
672 item.destination = p->getInstalledTo(); 672 item.destination = p->getInstalledTo();
673 cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; 673 cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl;
674 cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; 674 cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl;
675 } 675 }
676 else 676 else
677 { 677 {
678 item.destination = p->getLocalPackage()->getInstalledTo(); 678 item.destination = p->getLocalPackage()->getInstalledTo();
679 } 679 }
680 680
681 // Now see if version is newer or not 681 // Now see if version is newer or not
682 int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); 682 int val = compareVersions( p->getInstalledVersion(), p->getVersion() );
683 683
684 // If the version requested is older and user selected a local ipk file, then reinstall the file 684 // If the version requested is older and user selected a local ipk file, then reinstall the file
685 if ( p->isPackageStoredLocally() && val == -1 ) 685 if ( p->isPackageStoredLocally() && val == -1 )
686 val = 0; 686 val = 0;
687 687
688 if ( val == -2 ) 688 if ( val == -2 )
689 { 689 {
690 // Error - should handle 690 // Error - should handle
691 } 691 }
692 else if ( val == -1 ) 692 else if ( val == -1 )
693 { 693 {
694 // Version available is older - remove only 694 // Version available is older - remove only
695 item.option = "D"; 695 item.option = "D";
696 } 696 }
697 else 697 else
698 { 698 {
699 QString caption; 699 QString caption;
700 QString text; 700 QString text;
701 QString secondButton; 701 QString secondButton;
702 QString secondOption; 702 QString secondOption;
703 if ( val == 0 ) 703 if ( val == 0 )
704 { 704 {
705 // Version available is the same - option to remove or reinstall 705 // Version available is the same - option to remove or reinstall
706 caption = "Do you wish to remove or reinstall\n%s?"; 706 caption = tr( "Do you wish to remove or reinstall\n%1?" );
707 text = "Remove or ReInstall"; 707 text = tr( "Remove or ReInstall" );
708 secondButton = "ReInstall"; 708 secondButton = tr( "ReInstall" );
709 secondOption = "R"; 709 secondOption = tr( "R" );
710 } 710 }
711 else if ( val == 1 ) 711 else if ( val == 1 )
712 { 712 {
713 // Version available is newer - option to remove or upgrade 713 // Version available is newer - option to remove or upgrade
714 caption = "Do you wish to remove or upgrade\n%s?"; 714 caption = tr( "Do you wish to remove or upgrade\n%1?" );
715 text = "Remove or Upgrade"; 715 text = tr( "Remove or Upgrade" );
716 secondButton = "Upgrade"; 716 secondButton = tr( "Upgrade" );
717 secondOption = "U"; 717 secondOption = tr( "U" );
718 } 718 }
719 719
720 // Sticky option not implemented yet, but will eventually allow 720 // Sticky option not implemented yet, but will eventually allow
721 // the user to say something like 'remove all' 721 // the user to say something like 'remove all'
722 if ( stickyOption == "" ) 722 if ( stickyOption == "" )
723 { 723 {
724 QString msgtext; 724 QString msgtext;
725 msgtext.sprintf( caption, (const char *)name ); 725 msgtext = caption.arg( ( const char * )name );
726 switch( QMessageBox::information( this, text, 726 switch( QMessageBox::information( this, text,
727 msgtext, "Remove", secondButton ) ) 727 msgtext, tr( "Remove" ), secondButton ) )
728 { 728 {
729 case 0: // Try again or Enter 729 case 0: // Try again or Enter
730 // option 0 = Remove 730 // option 0 = Remove
731 item.option = "D"; 731 item.option = "D";
732 break; 732 break;
733 case 1: // Quit or Escape 733 case 1: // Quit or Escape
734 item.option = secondOption; 734 item.option = secondOption;
735 break; 735 break;
736 } 736 }
737 } 737 }
738 else 738 else
739 { 739 {
740// item.option = stickyOption; 740// item.option = stickyOption;
741 } 741 }
742 } 742 }
743 743
744 744
745 // Check if we are reinstalling the same version 745 // Check if we are reinstalling the same version
746 if ( item.option != "R" ) 746 if ( item.option != "R" )
747 item.recreateLinks = true; 747 item.recreateLinks = true;
748 else 748 else
749 item.recreateLinks = false; 749 item.recreateLinks = false;
750 750
751 // User hit cancel (on dlg - assume remove) 751 // User hit cancel (on dlg - assume remove)
752 return item; 752 return item;
753 } 753 }
754} 754}
755 755
756void NetworkPackageManager :: displayText( const QString &t ) 756void NetworkPackageManager :: displayText( const QString &t )
757{ 757{
758 cout << t << endl; 758 cout << t << endl;
759} 759}
760 760
761 761
762void NetworkPackageManager :: letterPushed( QString t ) 762void NetworkPackageManager :: letterPushed( QString t )
763{ 763{
764 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); 764 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild();
765 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 765 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
766 if ( packagesList->firstChild() == 0 ) 766 if ( packagesList->firstChild() == 0 )
767 return; 767 return;
768 768
769 QCheckListItem *item; 769 QCheckListItem *item;
770 if ( start == 0 ) 770 if ( start == 0 )
771 { 771 {
772 item = (QCheckListItem *)packagesList->firstChild(); 772 item = (QCheckListItem *)packagesList->firstChild();
773 start = top; 773 start = top;
774 } 774 }
775 else 775 else
776 item = (QCheckListItem *)start->nextSibling(); 776 item = (QCheckListItem *)start->nextSibling();
777 777
778 if ( item == 0 ) 778 if ( item == 0 )
779 item = (QCheckListItem *)packagesList->firstChild(); 779 item = (QCheckListItem *)packagesList->firstChild();
780 do 780 do
781 { 781 {
782 if ( item->text().lower().startsWith( t.lower() ) ) 782 if ( item->text().lower().startsWith( t.lower() ) )
783 { 783 {
784 packagesList->setSelected( item, true ); 784 packagesList->setSelected( item, true );
785 packagesList->ensureItemVisible( item ); 785 packagesList->ensureItemVisible( item );
786 break; 786 break;
787 } 787 }
788 788
789 item = (QCheckListItem *)item->nextSibling(); 789 item = (QCheckListItem *)item->nextSibling();
790 if ( !item ) 790 if ( !item )
791 item = (QCheckListItem *)packagesList->firstChild(); 791 item = (QCheckListItem *)packagesList->firstChild();
792 } while ( item != start); 792 } while ( item != start);
793} 793}
794 794
795 795
796void NetworkPackageManager :: searchForPackage( bool findNext ) 796void NetworkPackageManager :: searchForPackage( bool findNext )
797{ 797{
798 bool ok = false; 798 bool ok = false;
799 if ( !findNext || lastSearchText.isEmpty() ) 799 if ( !findNext || lastSearchText.isEmpty() )
800 lastSearchText = InputDialog::getText( "Search for package", "Enter package to search for", lastSearchText, &ok, this ).lower(); 800 lastSearchText = InputDialog::getText( tr( "Search for package" ), tr( "Enter package to search for" ), lastSearchText, &ok, this ).lower();
801 else 801 else
802 ok = true; 802 ok = true;
803 803
804 if ( ok && !lastSearchText.isEmpty() ) 804 if ( ok && !lastSearchText.isEmpty() )
805 { 805 {
806 cout << "searching for " << lastSearchText << endl; 806 cout << "searching for " << lastSearchText << endl;
807 // look through package list for text startng at current position 807 // look through package list for text startng at current position
808 vector<InstallData> workingPackages; 808 vector<InstallData> workingPackages;
809 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 809 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
810 if ( start != 0 ) 810 if ( start != 0 )
811 start = (QCheckListItem *)start->nextSibling(); 811 start = (QCheckListItem *)start->nextSibling();
812 812
813 if ( start == 0 ) 813 if ( start == 0 )
814 start = (QCheckListItem *)packagesList->firstChild(); 814 start = (QCheckListItem *)packagesList->firstChild();
815 815
816 for ( QCheckListItem *item = start; item != 0 ; 816 for ( QCheckListItem *item = start; item != 0 ;
817 item = (QCheckListItem *)item->nextSibling() ) 817 item = (QCheckListItem *)item->nextSibling() )
818 { 818 {
819 cout << "checking " << item->text().lower() << endl; 819 cout << "checking " << item->text().lower() << endl;
820 if ( item->text().lower().find( lastSearchText ) != -1 ) 820 if ( item->text().lower().find( lastSearchText ) != -1 )
821 { 821 {
822 cout << "matched " << item->text() << endl; 822 cout << "matched " << item->text() << endl;
823 packagesList->ensureItemVisible( item ); 823 packagesList->ensureItemVisible( item );
824 packagesList->setCurrentItem( item ); 824 packagesList->setCurrentItem( item );
825 break; 825 break;
826 } 826 }
827 } 827 }
828 } 828 }
829} 829}
830 830
831void NetworkPackageManager :: showOnlyUninstalledPackages( bool val ) 831void NetworkPackageManager :: showOnlyUninstalledPackages( bool val )
832{ 832{
833 showUninstalledPkgs = val; 833 showUninstalledPkgs = val;
834 serverSelected( -1 ); 834 serverSelected( -1 );
835} 835}
836 836
837void NetworkPackageManager :: showOnlyInstalledPackages( bool val ) 837void NetworkPackageManager :: showOnlyInstalledPackages( bool val )
838{ 838{
839 showInstalledPkgs = val; 839 showInstalledPkgs = val;
840 serverSelected( -1 ); 840 serverSelected( -1 );
841} 841}
842 842
843void NetworkPackageManager :: showUpgradedPackages( bool val ) 843void NetworkPackageManager :: showUpgradedPackages( bool val )
844{ 844{
845 showUpgradedPkgs = val; 845 showUpgradedPkgs = val;
846 serverSelected( -1 ); 846 serverSelected( -1 );
847} 847}
848 848
849bool NetworkPackageManager :: filterByCategory( bool val ) 849bool NetworkPackageManager :: filterByCategory( bool val )
850{ 850{
851 if ( val ) 851 if ( val )
852 { 852 {
853 if ( categoryFilter == "" ) 853 if ( categoryFilter == "" )
854 { 854 {
855 if ( !setFilterCategory() ) 855 if ( !setFilterCategory() )
856 return false; 856 return false;
857 } 857 }
858 858
859 categoryFilterEnabled = true; 859 categoryFilterEnabled = true;
860 serverSelected( -1 ); 860 serverSelected( -1 );
861 return true; 861 return true;
862 } 862 }
863 else 863 else
864 { 864 {
865 // Turn off filter 865 // Turn off filter
866 categoryFilterEnabled = false; 866 categoryFilterEnabled = false;
867 serverSelected( -1 ); 867 serverSelected( -1 );
868 return false; 868 return false;
869 } 869 }
870} 870}
871 871
872bool NetworkPackageManager :: setFilterCategory( ) 872bool NetworkPackageManager :: setFilterCategory( )
873{ 873{
874 // Get categories; 874 // Get categories;
875 CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this ); 875 CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this );
876 if ( dlg.exec() == QDialog::Accepted ) 876 if ( dlg.exec() == QDialog::Accepted )
877 { 877 {
878 categoryFilter = dlg.getSelectedFilter(); 878 categoryFilter = dlg.getSelectedFilter();
879 879
880 if ( categoryFilter == "" ) 880 if ( categoryFilter == "" )
881 return false; 881 return false;
882 882
883 categoryFilterEnabled = true; 883 categoryFilterEnabled = true;
884 serverSelected( -1 ); 884 serverSelected( -1 );
885 return true; 885 return true;
886 } 886 }
887 887
888 return false; 888 return false;
889} 889}
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h
index 2206c81..6b552ee 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.h
+++ b/noncore/settings/aqpkg/networkpkgmgr.h
@@ -1,100 +1,98 @@
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"
29 28
30class InstallData; 29class InstallData;
31 30
32/** NetworkPackageManager is the base class of the project */ 31/** NetworkPackageManager is the base class of the project */
33class NetworkPackageManager : public QWidget 32class NetworkPackageManager : public QWidget
34{ 33{
35 Q_OBJECT 34 Q_OBJECT
36public: 35public:
37 /** construtor */ 36 /** construtor */
38 NetworkPackageManager( QWidget* parent=0, const char *name=0 ); 37 NetworkPackageManager( QWidget* parent=0, const char *name=0 );
39 /** destructor */ 38 /** destructor */
40 ~NetworkPackageManager(); 39 ~NetworkPackageManager();
41 40
42 void setDataManager( DataManager *dm ); 41 void setDataManager( DataManager *dm );
43 void selectLocalPackage( const QString &pkg ); 42 void selectLocalPackage( const QString &pkg );
44 void updateData(); 43 void updateData();
45 void searchForPackage( bool findNext ); 44 void searchForPackage( bool findNext );
46 void showOnlyUninstalledPackages( bool val ); 45 void showOnlyUninstalledPackages( bool val );
47 void showOnlyInstalledPackages( bool val ); 46 void showOnlyInstalledPackages( bool val );
48 void showUpgradedPackages( bool val ); 47 void showUpgradedPackages( bool val );
49 bool filterByCategory( bool val ); 48 bool filterByCategory( bool val );
50 bool setFilterCategory(); 49 bool setFilterCategory();
51 50
52private: 51private:
53 DataManager *dataMgr; 52 DataManager *dataMgr;
54 53
55 QComboBox *serversList; 54 QComboBox *serversList;
56 QListView *packagesList; 55 QListView *packagesList;
57 QPushButton *update; 56 QPushButton *update;
58 QPushButton *upgrade; 57 QPushButton *upgrade;
59 QPushButton *download; 58 QPushButton *download;
60 QPushButton *apply; 59 QPushButton *apply;
61 60
62 ProgressDlg *progressDlg;
63 QString currentlySelectedServer; 61 QString currentlySelectedServer;
64 QString lastSearchText; 62 QString lastSearchText;
65 QString categoryFilter; 63 QString categoryFilter;
66 64
67 bool categoryFilterEnabled; 65 bool categoryFilterEnabled;
68 bool showJumpTo; 66 bool showJumpTo;
69 bool showUninstalledPkgs; 67 bool showUninstalledPkgs;
70 bool showInstalledPkgs; 68 bool showInstalledPkgs;
71 bool showUpgradedPkgs; 69 bool showUpgradedPkgs;
72 70
73 void initGui(); 71 void initGui();
74 void setupConnections(); 72 void setupConnections();
75 void showProgressDialog( char *initialText ); 73 void showProgressDialog( char *initialText );
76 void downloadSelectedPackages(); 74 void downloadSelectedPackages();
77 void downloadRemotePackage(); 75 void downloadRemotePackage();
78 void serverSelected( int index, bool showProgress ); 76 void serverSelected( int index, bool showProgress );
79 77
80 InstallData dealWithItem( QCheckListItem *item ); 78 InstallData dealWithItem( QCheckListItem *item );
81 QString stickyOption; 79 QString stickyOption;
82 80
83signals: 81signals:
84 void appRaiseMainWidget(); 82 void appRaiseMainWidget();
85 void appRaiseProgressWidget(); 83 void appRaiseProgressWidget();
86 void progressSetSteps( int ); 84 void progressSetSteps( int );
87 void progressSetMessage( const QString & ); 85 void progressSetMessage( const QString & );
88 void progressUpdate( int ); 86 void progressUpdate( int );
89 87
90public slots: 88public slots:
91 void applyChanges(); 89 void applyChanges();
92 void upgradePackages(); 90 void upgradePackages();
93 void downloadPackage(); 91 void downloadPackage();
94 void updateServer(); 92 void updateServer();
95 void displayText( const QString &t ); 93 void displayText( const QString &t );
96 void letterPushed( QString t ); 94 void letterPushed( QString t );
97 void serverSelected( int index ); 95 void serverSelected( int index );
98}; 96};
99 97
100#endif 98#endif
diff --git a/noncore/settings/aqpkg/progressdlg.cpp b/noncore/settings/aqpkg/progressdlg.cpp
deleted file mode 100644
index 3fa4367..0000000
--- a/noncore/settings/aqpkg/progressdlg.cpp
+++ b/dev/null
@@ -1,65 +0,0 @@
1/***************************************************************************
2 progressdlg.h - description
3 -------------------
4 begin : Mon Aug 26 2002
5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
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 *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "progressdlg.h"
19
20#include <qlabel.h>
21#include <qlayout.h>
22#include <qvariant.h>
23#include <qtooltip.h>
24#include <qwhatsthis.h>
25
26#include "global.h"
27/*
28 * Constructs a ProgressDlg which is a child of 'parent', with the
29 * name 'name' and widget flags set to 'f'
30 *
31 * The dialog will by default be modeless, unless you set 'modal' to
32 * TRUE to construct a modal dialog.
33 */
34ProgressDlg::ProgressDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
35 : QDialog( parent, name, modal, fl )
36{
37 if ( !name )
38 setName( "ProgressDlg" );
39 resize( 240, 73 );
40 setCaption( tr( "Progress" ) );
41
42 TextLabel2 = new QLabel( this, "TextLabel2" );
43 TextLabel2->setGeometry( QRect( 10, 10, 240, 50 ) );
44 TextLabel2->setFrameShape( QLabel::Box );
45 TextLabel2->setText( tr( "Text" ) );
46 TextLabel2->setAlignment( QLabel::WordBreak | QLabel::AlignHCenter | QLabel::AlignVCenter );
47}
48
49/*
50 * Destroys the object and frees any allocated resources
51 */
52ProgressDlg::~ProgressDlg()
53{
54 // no need to delete child widgets, Qt does it all for us
55}
56
57void ProgressDlg :: setText( QString &text )
58{
59 TextLabel2->setText( text );
60}
61
62void ProgressDlg :: setText( const char *text )
63{
64 TextLabel2->setText( text );
65}
diff --git a/noncore/settings/aqpkg/progressdlg.h b/noncore/settings/aqpkg/progressdlg.h
deleted file mode 100644
index 3e83455..0000000
--- a/noncore/settings/aqpkg/progressdlg.h
+++ b/dev/null
@@ -1,37 +0,0 @@
1/***************************************************************************
2 progressdlg.h - description
3 -------------------
4 begin : Mon Aug 26 2002
5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
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 *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/#ifndef PROGRESSDLG_H
17#define PROGRESSDLG_H
18
19#include <qdialog.h>
20
21class QLabel;
22
23class ProgressDlg : public QDialog
24{
25 Q_OBJECT
26
27public:
28 ProgressDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
29 ~ProgressDlg();
30
31 QLabel* TextLabel2;
32
33 void setText( QString &text );
34 void setText( const char *text );
35};
36
37#endif // PROGRESSDLG_H