summaryrefslogtreecommitdiff
authorandyq <andyq>2002-10-10 11:37:53 (UTC)
committer andyq <andyq>2002-10-10 11:37:53 (UTC)
commitcb2b407e2f58a73447d706de7c374bf275a96992 (patch) (unidiff)
tree09947396489e780b50edc73a0047a075d3a7971f
parent0d81ca9a11acbe0fb4bb86c176293c119c92f0da (diff)
downloadopie-cb2b407e2f58a73447d706de7c374bf275a96992.zip
opie-cb2b407e2f58a73447d706de7c374bf275a96992.tar.gz
opie-cb2b407e2f58a73447d706de7c374bf275a96992.tar.bz2
Fixed bug with downloading package to selected location
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index ff8f182..06e2a03 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -219,97 +219,97 @@ void NetworkPackageManager :: updateServer()
219 ipkg.runIpkg( ); 219 ipkg.runIpkg( );
220 } 220 }
221 221
222 // Reload data 222 // Reload data
223 dataMgr->reloadServerData( serversList->currentText() ); 223 dataMgr->reloadServerData( serversList->currentText() );
224 serverSelected(-1); 224 serverSelected(-1);
225 delete dlg; 225 delete dlg;
226} 226}
227 227
228 228
229void NetworkPackageManager :: downloadPackage() 229void NetworkPackageManager :: downloadPackage()
230{ 230{
231 if ( download->text() == "Download" ) 231 if ( download->text() == "Download" )
232 { 232 {
233 // First, write out ipkg_conf file so that ipkg can use it 233 // First, write out ipkg_conf file so that ipkg can use it
234 dataMgr->writeOutIpkgConf(); 234 dataMgr->writeOutIpkgConf();
235 235
236 // Display dialog to user asking where to download the files to 236 // Display dialog to user asking where to download the files to
237 bool ok = FALSE; 237 bool ok = FALSE;
238 QString dir = ""; 238 QString dir = "";
239#ifdef QWS 239#ifdef QWS
240 // read download directory from config file 240 // read download directory from config file
241 Config cfg( "aqpkg" ); 241 Config cfg( "aqpkg" );
242 cfg.setGroup( "settings" ); 242 cfg.setGroup( "settings" );
243 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); 243 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" );
244#endif 244#endif
245 245
246 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); 246 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this );
247 if ( ok && !text.isEmpty() ) 247 if ( ok && !text.isEmpty() )
248 dir = text; // user entered something and pressed ok 248 dir = text; // user entered something and pressed ok
249 else 249 else
250 return; // user entered nothing or pressed cancel 250 return; // user entered nothing or pressed cancel
251 251
252#ifdef QWS 252#ifdef QWS
253 // Store download directory in config file 253 // Store download directory in config file
254 cfg.writeEntry( "downloadDir", dir ); 254 cfg.writeEntry( "downloadDir", dir );
255#endif 255#endif
256 256
257 // Get starting directory 257 // Get starting directory
258 char initDir[PATH_MAX]; 258 char initDir[PATH_MAX];
259 getcwd( initDir, PATH_MAX ); 259 getcwd( initDir, PATH_MAX );
260 260
261 // Download each package 261 // Download each package
262 Ipkg ipkg; 262 Ipkg ipkg;
263 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 263 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
264 264
265 QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 265 QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
266 ipkg.setOption( "download" ); 266 ipkg.setOption( "download" );
267 ipkg.setRuntimeDirectory( initDir ); 267 ipkg.setRuntimeDirectory( dir );
268 do 268 do
269 { 269 {
270 if ( item->isOn() ) 270 if ( item->isOn() )
271 { 271 {
272 QString name = item->text(); 272 QString name = item->text();
273 int pos = name.find( "*" ); 273 int pos = name.find( "*" );
274 name.truncate( pos ); 274 name.truncate( pos );
275 275
276 // if (there is a (installed), remove it 276 // if (there is a (installed), remove it
277 pos = name.find( "(installed)" ); 277 pos = name.find( "(installed)" );
278 if ( pos > 0 ) 278 if ( pos > 0 )
279 name.truncate( pos - 1 ); 279 name.truncate( pos - 1 );
280 280
281 ipkg.setPackage( name ); 281 ipkg.setPackage( name );
282 ipkg.runIpkg( ); 282 ipkg.runIpkg( );
283 } 283 }
284 284
285 item = (QCheckListItem *)item->nextSibling(); 285 item = (QCheckListItem *)item->nextSibling();
286 } while ( item ); 286 } while ( item );
287 } 287 }
288 else if ( download->text() == "Remove" ) 288 else if ( download->text() == "Remove" )
289 { 289 {
290 QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 290 QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
291 do 291 do
292 { 292 {
293 if ( item->isOn() ) 293 if ( item->isOn() )
294 { 294 {
295 QString name = item->text(); 295 QString name = item->text();
296 int pos = name.find( "*" ); 296 int pos = name.find( "*" );
297 name.truncate( pos ); 297 name.truncate( pos );
298 298
299 // if (there is a (installed), remove it 299 // if (there is a (installed), remove it
300 pos = name.find( "(installed)" ); 300 pos = name.find( "(installed)" );
301 if ( pos > 0 ) 301 if ( pos > 0 )
302 name.truncate( pos - 1 ); 302 name.truncate( pos - 1 );
303 303
304 Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name ); 304 Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name );
305 QFile f( p->getFilename() ); 305 QFile f( p->getFilename() );
306 f.remove(); 306 f.remove();
307 } 307 }
308 item = (QCheckListItem *)item->nextSibling(); 308 item = (QCheckListItem *)item->nextSibling();
309 } while ( item ); 309 } while ( item );
310 } 310 }
311 311
312 dataMgr->reloadServerData( LOCAL_IPKGS ); 312 dataMgr->reloadServerData( LOCAL_IPKGS );
313 serverSelected( -1 ); 313 serverSelected( -1 );
314} 314}
315 315