summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/networkpkgmgr.cpp
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg/networkpkgmgr.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp88
1 files changed, 61 insertions, 27 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 6f528a1..ed5bf75 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -206,2 +206,20 @@ void NetworkPackageManager :: serverSelected( int )
206 QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); 206 QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox );
207
208 if ( it->isInstalled() )
209 {
210 QString destName = "";
211 if ( it->getLocalPackage() )
212 {
213 if ( it->getLocalPackage()->getInstalledTo() )
214 destName = it->getLocalPackage()->getInstalledTo()->getDestinationName();
215 }
216 else
217 {
218 if ( it->getInstalledTo() )
219 destName = it->getInstalledTo()->getDestinationName();
220 }
221 if ( destName != "" )
222 new QCheckListItem( item, QString( "Installed To - " ) + destName );
223 }
224
207 if ( !it->isPackageStoredLocally() ) 225 if ( !it->isPackageStoredLocally() )
@@ -257,16 +275,9 @@ void NetworkPackageManager :: updateServer()
257 275
258// if ( serverName == LOCAL_SERVER ) 276 QString option = "update";
259// ; 277 QString dummy = "";
260// else if ( serverName == LOCAL_IPKGS ) 278 Ipkg ipkg;
261// ; 279 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
262// else 280 ipkg.setOption( option );
263 { 281
264 QString option = "update"; 282 ipkg.runIpkg( );
265 QString dummy = "";
266 Ipkg ipkg;
267 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
268 ipkg.setOption( option );
269
270 ipkg.runIpkg( );
271 }
272 283
@@ -396,3 +407,3 @@ void NetworkPackageManager :: applyChanges()
396{ 407{
397 // Disable buttons to stop silly people clicking lots on them :) 408 stickyOption = "";
398 409
@@ -404,3 +415,3 @@ void NetworkPackageManager :: applyChanges()
404 415
405 vector<QString> workingPackages; 416 vector<InstallData> workingPackages;
406 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 417 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
@@ -411,4 +422,4 @@ void NetworkPackageManager :: applyChanges()
411 { 422 {
412 QString p = dealWithItem( item ); 423 InstallData data = dealWithItem( item );
413 workingPackages.push_back( p ); 424 workingPackages.push_back( data );
414 } 425 }
@@ -439,3 +450,3 @@ void NetworkPackageManager :: applyChanges()
439// If installed and version up to date - remove 450// If installed and version up to date - remove
440QString NetworkPackageManager :: dealWithItem( QCheckListItem *item ) 451InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
441{ 452{
@@ -460,6 +471,21 @@ QString NetworkPackageManager :: dealWithItem( QCheckListItem *item )
460 if ( !p->isInstalled() ) 471 if ( !p->isInstalled() )
461 return QString( "I" ) + name; 472 {
473 InstallData item;
474 item.option = "I";
475 item.packageName = name;
476 return item;
477 }
462 else 478 else
463 { 479 {
464 if ( p->getVersion() == p->getInstalledVersion() ) 480 InstallData item;
481 item.option = "D";
482 item.packageName = name;
483 if ( p->getInstalledTo() )
484 item.destination = p->getInstalledTo();
485 else
486 item.destination = p->getLocalPackage()->getInstalledTo();
487
488 // Sticky option not implemented yet, but will eventually allow
489 // the user to say something like 'remove all'
490 if ( stickyOption == "" )
465 { 491 {
@@ -471,14 +497,22 @@ QString NetworkPackageManager :: dealWithItem( QCheckListItem *item )
471 case 0: // Try again or Enter 497 case 0: // Try again or Enter
472 return QString( "D" ) + name; 498 item.option = "D";
473 break; 499 break;
474 case 1: // Quit or Escape 500 case 1: // Quit or Escape
475 return QString( "U" ) + name; 501 item.option = "U";
476 break; 502 break;
477 } 503 }
478
479 // User hit cancel (on dlg - assume remove)
480 return QString( "D" ) + name;
481 } 504 }
482 else 505 else
483 return QString( "U" ) + name; 506 {
507// item.option = stickyOption;
508 }
509
510 // Check if we are reinstalling the same version
511 if ( p->getVersion() != p->getInstalledVersion() )
512 item.recreateLinks = true;
513 else
514 item.recreateLinks = false;
515
516 // User hit cancel (on dlg - assume remove)
517 return item;
484 } 518 }