summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/networkpkgmgr.cpp
Side-by-side diff
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
@@ -201,12 +201,30 @@ void NetworkPackageManager :: serverSelected( int )
// If a different version of package is available, postfix it with an *
if ( it->getVersion() != it->getInstalledVersion() )
text += "*";
}
QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox );
+
+ if ( it->isInstalled() )
+ {
+ QString destName = "";
+ if ( it->getLocalPackage() )
+ {
+ if ( it->getLocalPackage()->getInstalledTo() )
+ destName = it->getLocalPackage()->getInstalledTo()->getDestinationName();
+ }
+ else
+ {
+ if ( it->getInstalledTo() )
+ destName = it->getInstalledTo()->getDestinationName();
+ }
+ if ( destName != "" )
+ new QCheckListItem( item, QString( "Installed To - " ) + destName );
+ }
+
if ( !it->isPackageStoredLocally() )
new QCheckListItem( item, QString( "Description - " ) + it->getDescription() );
else
new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() );
new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() );
@@ -252,26 +270,19 @@ void NetworkPackageManager :: updateServer()
// Disable buttons to stop silly people clicking lots on them :)
// First, write out ipkg_conf file so that ipkg can use it
dataMgr->writeOutIpkgConf();
-// if ( serverName == LOCAL_SERVER )
-// ;
-// else if ( serverName == LOCAL_IPKGS )
-// ;
-// else
- {
- QString option = "update";
- QString dummy = "";
- Ipkg ipkg;
- connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
- ipkg.setOption( option );
-
- ipkg.runIpkg( );
- }
+ QString option = "update";
+ QString dummy = "";
+ Ipkg ipkg;
+ connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
+ ipkg.setOption( option );
+
+ ipkg.runIpkg( );
// Reload data
dataMgr->reloadServerData( serversList->currentText() );
serverSelected(-1);
delete dlg;
}
@@ -391,29 +402,29 @@ void NetworkPackageManager :: downloadPackage()
serverSelected( -1 );
}
void NetworkPackageManager :: applyChanges()
{
- // Disable buttons to stop silly people clicking lots on them :)
+ stickyOption = "";
// First, write out ipkg_conf file so that ipkg can use it
dataMgr->writeOutIpkgConf();
// Now for each selected item
// deal with it
- vector<QString> workingPackages;
+ vector<InstallData> workingPackages;
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
item != 0 ;
item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
{
- QString p = dealWithItem( item );
- workingPackages.push_back( p );
+ InstallData data = dealWithItem( item );
+ workingPackages.push_back( data );
}
}
// do the stuff
InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true );
dlg.showDlg();
@@ -434,13 +445,13 @@ void NetworkPackageManager :: applyChanges()
// decide what to do - either remove, upgrade or install
// Current rules:
// If not installed - install
// If installed and different version available - upgrade
// If installed and version up to date - remove
-QString NetworkPackageManager :: dealWithItem( QCheckListItem *item )
+InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
{
QString name = item->text();
int pos = name.find( "*" );
name.truncate( pos );
// if (there is a (installed), remove it
@@ -455,35 +466,58 @@ QString NetworkPackageManager :: dealWithItem( QCheckListItem *item )
// If the package has a filename then it is a local file
if ( p->isPackageStoredLocally() )
name = p->getFilename();
QString option;
QString dest = "root";
if ( !p->isInstalled() )
- return QString( "I" ) + name;
+ {
+ InstallData item;
+ item.option = "I";
+ item.packageName = name;
+ return item;
+ }
else
{
- if ( p->getVersion() == p->getInstalledVersion() )
+ InstallData item;
+ item.option = "D";
+ item.packageName = name;
+ if ( p->getInstalledTo() )
+ item.destination = p->getInstalledTo();
+ else
+ item.destination = p->getLocalPackage()->getInstalledTo();
+
+ // Sticky option not implemented yet, but will eventually allow
+ // the user to say something like 'remove all'
+ if ( stickyOption == "" )
{
QString msgtext;
msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name );
switch( QMessageBox::information( this, "Remove or ReInstall",
msgtext, "Remove", "ReInstall" ) )
{
case 0: // Try again or Enter
- return QString( "D" ) + name;
+ item.option = "D";
break;
case 1: // Quit or Escape
- return QString( "U" ) + name;
+ item.option = "U";
break;
}
-
- // User hit cancel (on dlg - assume remove)
- return QString( "D" ) + name;
}
else
- return QString( "U" ) + name;
+ {
+// item.option = stickyOption;
+ }
+
+ // Check if we are reinstalling the same version
+ if ( p->getVersion() != p->getInstalledVersion() )
+ item.recreateLinks = true;
+ else
+ item.recreateLinks = false;
+
+ // User hit cancel (on dlg - assume remove)
+ return item;
}
}
void NetworkPackageManager :: displayText( const QString &t )
{
cout << t << endl;