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
@@ -195,24 +195,42 @@ void NetworkPackageManager :: serverSelected( int )
text += it->getPackageName();
if ( it->isInstalled() )
{
text += " (installed)";
// 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() );
if ( it->getLocalPackage() )
{
if ( it->isInstalled() )
new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() );
}
packagesList->insertItem( item );
@@ -246,38 +264,31 @@ void NetworkPackageManager :: updateServer()
// Update the current server
// Display dialog
ProgressDlg *dlg = new ProgressDlg( this );
QString status = "Updating package lists...";
dlg->show();
dlg->setText( status );
// 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;
}
void NetworkPackageManager :: upgradePackages()
{
// We're gonna do an upgrade of all packages
// First warn user that this isn't recommended
QString text = "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n";
@@ -385,41 +396,41 @@ void NetworkPackageManager :: downloadPackage()
f.remove();
}
}
}
dataMgr->reloadServerData( LOCAL_IPKGS );
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();
// Reload data
dataMgr->reloadServerData( LOCAL_SERVER );
dataMgr->reloadServerData( serversList->currentText() );
serverSelected(-1);
@@ -428,68 +439,91 @@ void NetworkPackageManager :: applyChanges()
// Finally let the main system update itself
QCopEnvelope e("QPE/System", "linkChanged(QString)");
QString lf = QString::null;
e << lf;
#endif
}
// 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
pos = name.find( "(installed)" );
if ( pos > 0 )
name.truncate( pos - 1 );
// Get package
Server *s = dataMgr->getServer( serversList->currentText() );
Package *p = s->getPackage( name );
// 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;
}
void NetworkPackageManager :: letterPushed( QString t )
{
QCheckListItem *top = (QCheckListItem *)packagesList->firstChild();