summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/aqpkg.pro17
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp2
2 files changed, 18 insertions, 1 deletions
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro
index 98c358c..d8eee6a 100644
--- a/noncore/settings/aqpkg/aqpkg.pro
+++ b/noncore/settings/aqpkg/aqpkg.pro
@@ -1,47 +1,64 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on release 2 CONFIG = qt warn_on release
3 HEADERS = global.h \ 3 HEADERS = global.h \
4 mainwin.h \ 4 mainwin.h \
5 datamgr.h \ 5 datamgr.h \
6 settingsimpl.h \ 6 settingsimpl.h \
7 ipkg.h \ 7 ipkg.h \
8 package.h \ 8 package.h \
9 installdlgimpl.h \ 9 installdlgimpl.h \
10 instoptionsimpl.h \ 10 instoptionsimpl.h \
11 destination.h \ 11 destination.h \
12 utils.h \ 12 utils.h \
13 server.h \ 13 server.h \
14 helpwindow.h \ 14 helpwindow.h \
15 letterpushbutton.h \ 15 letterpushbutton.h \
16 inputdlg.h \ 16 inputdlg.h \
17 categoryfilterimpl.h 17 categoryfilterimpl.h
18 SOURCES = mainwin.cpp \ 18 SOURCES = mainwin.cpp \
19 datamgr.cpp \ 19 datamgr.cpp \
20 mem.cpp \ 20 mem.cpp \
21 settingsimpl.cpp \ 21 settingsimpl.cpp \
22 ipkg.cpp \ 22 ipkg.cpp \
23 main.cpp \ 23 main.cpp \
24 package.cpp \ 24 package.cpp \
25 installdlgimpl.cpp \ 25 installdlgimpl.cpp \
26 instoptionsimpl.cpp \ 26 instoptionsimpl.cpp \
27 destination.cpp \ 27 destination.cpp \
28 utils.cpp \ 28 utils.cpp \
29 server.cpp \ 29 server.cpp \
30 helpwindow.cpp \ 30 helpwindow.cpp \
31 letterpushbutton.cpp \ 31 letterpushbutton.cpp \
32 inputdlg.cpp \ 32 inputdlg.cpp \
33 version.cpp \ 33 version.cpp \
34 categoryfilterimpl.cpp 34 categoryfilterimpl.cpp
35 INTERFACES= settings.ui \ 35 INTERFACES= settings.ui \
36 install.ui \ 36 install.ui \
37 instoptions.ui \ 37 instoptions.ui \
38 categoryfilter.ui 38 categoryfilter.ui
39 TARGET = aqpkg 39 TARGET = aqpkg
40INCLUDEPATH += $(OPIEDIR)/include 40INCLUDEPATH += $(OPIEDIR)/include
41DEPENDPATH += $(OPIEDIR)/include 41DEPENDPATH += $(OPIEDIR)/include
42LIBS += -lqpe -lopie -lstdc++ 42LIBS += -lqpe -lopie -lstdc++
43DESTDIR = $(OPIEDIR)/bin 43DESTDIR = $(OPIEDIR)/bin
44 44
45TRANSLATIONS = ../../../i18n/de/aqpkg.ts \
46 ../../../i18n/xx/aqpkg.ts \
47 ../../../i18n/en/aqpkg.ts \
48 ../../../i18n/es/aqpkg.ts \
49 ../../../i18n/fr/aqpkg.ts \
50 ../../../i18n/hu/aqpkg.ts \
51 ../../../i18n/ja/aqpkg.ts \
52 ../../../i18n/ko/aqpkg.ts \
53 ../../../i18n/no/aqpkg.ts \
54 ../../../i18n/pl/aqpkg.ts \
55 ../../../i18n/pt/aqpkg.ts \
56 ../../../i18n/pt_BR/aqpkg.ts \
57 ../../../i18n/sl/aqpkg.ts \
58 ../../../i18n/zh_CN/aqpkg.ts \
59 ../../../i18n/zh_TW/aqpkg.ts \
60 ../../../i18n/it/aqpkg.ts \
61 ../../../i18n/da/aqpkg.ts
45 62
46 63
47include ( $(OPIEDIR)/include.pro ) 64include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index bf2c482..75ce1a1 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -1,291 +1,291 @@
1/*************************************************************************** 1/***************************************************************************
2 installdlgimpl.cpp - description 2 installdlgimpl.cpp - description
3 ------------------- 3 -------------------
4 begin : Mon Aug 26 2002 4 begin : Mon Aug 26 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#ifdef QWS 18#ifdef QWS
19#include <qpe/config.h> 19#include <qpe/config.h>
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/storage.h> 21#include <qpe/storage.h>
22#endif 22#endif
23 23
24#include <qmultilineedit.h> 24#include <qmultilineedit.h>
25#include <qdialog.h> 25#include <qdialog.h>
26#include <qcombobox.h> 26#include <qcombobox.h>
27#include <qcheckbox.h> 27#include <qcheckbox.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qlabel.h> 29#include <qlabel.h>
30 30
31 31
32#include "datamgr.h" 32#include "datamgr.h"
33#include "instoptionsimpl.h" 33#include "instoptionsimpl.h"
34#include "destination.h" 34#include "destination.h"
35#include "installdlgimpl.h" 35#include "installdlgimpl.h"
36#include "utils.h" 36#include "utils.h"
37#include "global.h" 37#include "global.h"
38 38
39InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) 39InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
40 : InstallDlg( parent, name, modal, fl ) 40 : InstallDlg( parent, name, modal, fl )
41{ 41{
42 pIpkg = 0; 42 pIpkg = 0;
43 upgradePackages = false; 43 upgradePackages = false;
44 dataMgr = dataManager; 44 dataMgr = dataManager;
45 vector<Destination>::iterator dit; 45 vector<Destination>::iterator dit;
46 46
47 QString defaultDest = "root"; 47 QString defaultDest = "root";
48#ifdef QWS 48#ifdef QWS
49 Config cfg( "aqpkg" ); 49 Config cfg( "aqpkg" );
50 cfg.setGroup( "settings" ); 50 cfg.setGroup( "settings" );
51 defaultDest = cfg.readEntry( "dest", "root" ); 51 defaultDest = cfg.readEntry( "dest", "root" );
52 52
53 // Grab flags - Turn MAKE_LINKS on by default (if no flags found) 53 // Grab flags - Turn MAKE_LINKS on by default (if no flags found)
54 flags = cfg.readNumEntry( "installFlags", 0 ); 54 flags = cfg.readNumEntry( "installFlags", 0 );
55#else 55#else
56 flags = 0; 56 flags = 0;
57#endif 57#endif
58 58
59 // Output text is read only 59 // Output text is read only
60 output->setReadOnly( true ); 60 output->setReadOnly( true );
61 QFont f( "helvetica" ); 61 QFont f( "helvetica" );
62 f.setPointSize( 10 ); 62 f.setPointSize( 10 );
63 output->setFont( f ); 63 output->setFont( f );
64 64
65 65
66 // setup destination data 66 // setup destination data
67 int defIndex = 0; 67 int defIndex = 0;
68 int i; 68 int i;
69 for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i ) 69 for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i )
70 { 70 {
71 destination->insertItem( dit->getDestinationName() ); 71 destination->insertItem( dit->getDestinationName() );
72 if ( dit->getDestinationName() == defaultDest ) 72 if ( dit->getDestinationName() == defaultDest )
73 defIndex = i; 73 defIndex = i;
74 } 74 }
75 75
76 destination->setCurrentItem( defIndex ); 76 destination->setCurrentItem( defIndex );
77 77
78 vector<InstallData>::iterator it; 78 vector<InstallData>::iterator it;
79 // setup package data 79 // setup package data
80 QString remove = "Remove\n"; 80 QString remove = "Remove\n";
81 QString install = "\nInstall\n"; 81 QString install = "\nInstall\n";
82 QString upgrade = "\nUpgrade\n"; 82 QString upgrade = "\nUpgrade\n";
83 for ( it = packageList.begin() ; it != packageList.end() ; ++it ) 83 for ( it = packageList.begin() ; it != packageList.end() ; ++it )
84 { 84 {
85 InstallData item = *it; 85 InstallData item = *it;
86 if ( item.option == "I" ) 86 if ( item.option == "I" )
87 { 87 {
88 installList.push_back( item ); 88 installList.push_back( item );
89 install += " " + item.packageName + "\n"; 89 install += " " + item.packageName + "\n";
90 } 90 }
91 else if ( item.option == "D" ) 91 else if ( item.option == "D" )
92 { 92 {
93 removeList.push_back( item ); 93 removeList.push_back( item );
94 remove += " " + item.packageName + "\n"; 94 remove += " " + item.packageName + "\n";
95 } 95 }
96 else if ( item.option == "U" || item.option == "R" ) 96 else if ( item.option == "U" || item.option == "R" )
97 { 97 {
98 updateList.push_back( item ); 98 updateList.push_back( item );
99 QString type = " (Upgrade)"; 99 QString type = " (Upgrade)";
100 if ( item.option == "R" ) 100 if ( item.option == "R" )
101 type = " (ReInstall)"; 101 type = " (ReInstall)";
102 upgrade += " " + item.packageName + type + "\n"; 102 upgrade += " " + item.packageName + type + "\n";
103 } 103 }
104 } 104 }
105 105
106 output->setText( remove + install + upgrade ); 106 output->setText( remove + install + upgrade );
107 107
108 displayAvailableSpace( destination->currentText() ); 108 displayAvailableSpace( destination->currentText() );
109} 109}
110 110
111InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl ) 111InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl )
112 : InstallDlg( parent, name, modal, fl ) 112 : InstallDlg( parent, name, modal, fl )
113{ 113{
114 pIpkg = ipkg; 114 pIpkg = ipkg;
115 output->setText( initialText ); 115 output->setText( initialText );
116} 116}
117 117
118 118
119InstallDlgImpl::~InstallDlgImpl() 119InstallDlgImpl::~InstallDlgImpl()
120{ 120{
121} 121}
122 122
123bool InstallDlgImpl :: showDlg() 123bool InstallDlgImpl :: showDlg()
124{ 124{
125 showMaximized(); 125 showMaximized();
126 bool ret = exec(); 126 bool ret = exec();
127 127
128 return ret; 128 return ret;
129} 129}
130 130
131void InstallDlgImpl :: optionsSelected() 131void InstallDlgImpl :: optionsSelected()
132{ 132{
133 InstallOptionsDlgImpl opt( flags, this, "Option", true ); 133 InstallOptionsDlgImpl opt( flags, this, "Option", true );
134 opt.exec(); 134 opt.exec();
135 135
136 // set options selected from dialog 136 // set options selected from dialog
137 flags = opt.getFlags(); 137 flags = opt.getFlags();
138 138
139#ifdef QWS 139#ifdef QWS
140 Config cfg( "aqpkg" ); 140 Config cfg( "aqpkg" );
141 cfg.setGroup( "settings" ); 141 cfg.setGroup( "settings" );
142 cfg.writeEntry( "installFlags", flags ); 142 cfg.writeEntry( "installFlags", flags );
143#endif 143#endif
144} 144}
145 145
146void InstallDlgImpl :: installSelected() 146void InstallDlgImpl :: installSelected()
147{ 147{
148 if ( btnInstall->text() == "Abort" ) 148 if ( btnInstall->text() == "Abort" )
149 { 149 {
150 if ( pIpkg ) 150 if ( pIpkg )
151 { 151 {
152 displayText( "\n**** User Clicked ABORT ***" ); 152 displayText( "\n**** User Clicked ABORT ***" );
153 pIpkg->abort(); 153 pIpkg->abort();
154 displayText( "**** Process Aborted ****" ); 154 displayText( "**** Process Aborted ****" );
155 } 155 }
156 156
157 btnInstall->setText( tr( "Close" ) ); 157 btnInstall->setText( tr( "Close" ) );
158 return; 158 return;
159 } 159 }
160 else if ( btnInstall->text() == "Close" ) 160 else if ( btnInstall->text() == tr( "Close" ) )
161 { 161 {
162 done( 1 ); 162 done( 1 );
163 return; 163 return;
164 } 164 }
165 165
166 // Disable buttons 166 // Disable buttons
167 btnOptions->setEnabled( false ); 167 btnOptions->setEnabled( false );
168// btnInstall->setEnabled( false ); 168// btnInstall->setEnabled( false );
169 169
170 btnInstall->setText( "Abort" ); 170 btnInstall->setText( "Abort" );
171 171
172 if ( pIpkg ) 172 if ( pIpkg )
173 { 173 {
174 output->setText( "" ); 174 output->setText( "" );
175 175
176 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 176 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
177 pIpkg->runIpkg(); 177 pIpkg->runIpkg();
178 } 178 }
179 else 179 else
180 { 180 {
181 output->setText( "" ); 181 output->setText( "" );
182 vector<Destination>::iterator d = dataMgr->getDestination( destination->currentText() ); 182 vector<Destination>::iterator d = dataMgr->getDestination( destination->currentText() );
183 QString dest = d->getDestinationName(); 183 QString dest = d->getDestinationName();
184 QString destDir = d->getDestinationPath(); 184 QString destDir = d->getDestinationPath();
185 int instFlags = flags; 185 int instFlags = flags;
186 if ( d->linkToRoot() ) 186 if ( d->linkToRoot() )
187 instFlags |= MAKE_LINKS; 187 instFlags |= MAKE_LINKS;
188 188
189#ifdef QWS 189#ifdef QWS
190 // Save settings 190 // Save settings
191 Config cfg( "aqpkg" ); 191 Config cfg( "aqpkg" );
192 cfg.setGroup( "settings" ); 192 cfg.setGroup( "settings" );
193 cfg.writeEntry( "dest", dest ); 193 cfg.writeEntry( "dest", dest );
194#endif 194#endif
195 195
196 pIpkg = new Ipkg; 196 pIpkg = new Ipkg;
197 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 197 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
198 198
199 // First run through the remove list, then the install list then the upgrade list 199 // First run through the remove list, then the install list then the upgrade list
200 vector<InstallData>::iterator it; 200 vector<InstallData>::iterator it;
201 pIpkg->setOption( "remove" ); 201 pIpkg->setOption( "remove" );
202 for ( it = removeList.begin() ; it != removeList.end() ; ++it ) 202 for ( it = removeList.begin() ; it != removeList.end() ; ++it )
203 { 203 {
204 pIpkg->setDestination( it->destination->getDestinationName() ); 204 pIpkg->setDestination( it->destination->getDestinationName() );
205 pIpkg->setDestinationDir( it->destination->getDestinationPath() ); 205 pIpkg->setDestinationDir( it->destination->getDestinationPath() );
206 pIpkg->setPackage( it->packageName ); 206 pIpkg->setPackage( it->packageName );
207 207
208 int tmpFlags = flags; 208 int tmpFlags = flags;
209 if ( it->destination->linkToRoot() ) 209 if ( it->destination->linkToRoot() )
210 tmpFlags |= MAKE_LINKS; 210 tmpFlags |= MAKE_LINKS;
211 211
212 pIpkg->setFlags( tmpFlags ); 212 pIpkg->setFlags( tmpFlags );
213 pIpkg->runIpkg(); 213 pIpkg->runIpkg();
214 } 214 }
215 215
216 pIpkg->setOption( "install" ); 216 pIpkg->setOption( "install" );
217 pIpkg->setDestination( dest ); 217 pIpkg->setDestination( dest );
218 pIpkg->setDestinationDir( destDir ); 218 pIpkg->setDestinationDir( destDir );
219 pIpkg->setFlags( instFlags ); 219 pIpkg->setFlags( instFlags );
220 for ( it = installList.begin() ; it != installList.end() ; ++it ) 220 for ( it = installList.begin() ; it != installList.end() ; ++it )
221 { 221 {
222 pIpkg->setPackage( it->packageName ); 222 pIpkg->setPackage( it->packageName );
223 pIpkg->runIpkg(); 223 pIpkg->runIpkg();
224 } 224 }
225 225
226 flags |= FORCE_REINSTALL; 226 flags |= FORCE_REINSTALL;
227 for ( it = updateList.begin() ; it != updateList.end() ; ++it ) 227 for ( it = updateList.begin() ; it != updateList.end() ; ++it )
228 { 228 {
229 if ( it->option == "R" ) 229 if ( it->option == "R" )
230 pIpkg->setOption( "reinstall" ); 230 pIpkg->setOption( "reinstall" );
231 else 231 else
232 pIpkg->setOption( "upgrade" ); 232 pIpkg->setOption( "upgrade" );
233 pIpkg->setDestination( it->destination->getDestinationName() ); 233 pIpkg->setDestination( it->destination->getDestinationName() );
234 pIpkg->setDestinationDir( it->destination->getDestinationPath() ); 234 pIpkg->setDestinationDir( it->destination->getDestinationPath() );
235 pIpkg->setPackage( it->packageName ); 235 pIpkg->setPackage( it->packageName );
236 236
237 int tmpFlags = flags; 237 int tmpFlags = flags;
238 if ( it->destination->linkToRoot() && it->recreateLinks ) 238 if ( it->destination->linkToRoot() && it->recreateLinks )
239 tmpFlags |= MAKE_LINKS; 239 tmpFlags |= MAKE_LINKS;
240 pIpkg->setFlags( tmpFlags ); 240 pIpkg->setFlags( tmpFlags );
241 pIpkg->runIpkg(); 241 pIpkg->runIpkg();
242 } 242 }
243 243
244 delete pIpkg; 244 delete pIpkg;
245 } 245 }
246 246
247 btnOptions->setEnabled( true ); 247 btnOptions->setEnabled( true );
248// btnInstall->setEnabled( true ); 248// btnInstall->setEnabled( true );
249 btnInstall->setText( tr( "Close" ) ); 249 btnInstall->setText( tr( "Close" ) );
250 250
251 if ( destination->currentText() != 0 && destination->currentText() != "" ) 251 if ( destination->currentText() != 0 && destination->currentText() != "" )
252 displayAvailableSpace( destination->currentText() ); 252 displayAvailableSpace( destination->currentText() );
253} 253}
254 254
255 255
256void InstallDlgImpl :: displayText(const QString &text ) 256void InstallDlgImpl :: displayText(const QString &text )
257{ 257{
258 QString t = output->text() + "\n" + text; 258 QString t = output->text() + "\n" + text;
259 output->setText( t ); 259 output->setText( t );
260 output->setCursorPosition( output->numLines(), 0 ); 260 output->setCursorPosition( output->numLines(), 0 );
261} 261}
262 262
263 263
264void InstallDlgImpl :: displayAvailableSpace( const QString &text ) 264void InstallDlgImpl :: displayAvailableSpace( const QString &text )
265{ 265{
266 vector<Destination>::iterator d = dataMgr->getDestination( text ); 266 vector<Destination>::iterator d = dataMgr->getDestination( text );
267 QString destDir = d->getDestinationPath(); 267 QString destDir = d->getDestinationPath();
268 268
269 long blockSize = 0; 269 long blockSize = 0;
270 long totalBlocks = 0; 270 long totalBlocks = 0;
271 long availBlocks = 0; 271 long availBlocks = 0;
272 QString space; 272 QString space;
273 if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) 273 if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) )
274 { 274 {
275 long mult = blockSize / 1024; 275 long mult = blockSize / 1024;
276 long div = 1024 / blockSize; 276 long div = 1024 / blockSize;
277 277
278 if ( !mult ) mult = 1; 278 if ( !mult ) mult = 1;
279 if ( !div ) div = 1; 279 if ( !div ) div = 1;
280// long total = totalBlocks * mult / div; 280// long total = totalBlocks * mult / div;
281 long avail = availBlocks * mult / div; 281 long avail = availBlocks * mult / div;
282// long used = total - avail; 282// long used = total - avail;
283 283
284 space.sprintf( "%ld Kb", avail ); 284 space.sprintf( "%ld Kb", avail );
285 } 285 }
286 else 286 else
287 space = "Unknown"; 287 space = "Unknown";
288 288
289 txtAvailableSpace->setText( space ); 289 txtAvailableSpace->setText( space );
290} 290}
291 291