summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index dee834e..ccce401 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -317,178 +317,191 @@ void NetworkPackageManager :: updateServer()
// First, write out ipkg_conf file so that ipkg can use it
dataMgr->writeOutIpkgConf();
Ipkg ipkg;
ipkg.setOption( "update" );
InstallDlgImpl dlg( &ipkg, "Refreshing server package lists", this, "Upgrade", true );
dlg.showDlg();
// Reload data
dataMgr->reloadServerData();
serverSelected(-1);
// delete progDlg;
}
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";
QMessageBox warn("Warning", text, QMessageBox::Warning,
QMessageBox::Yes,
QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
0, this );
warn.adjustSize();
if ( warn.exec() == QMessageBox::Yes )
{
// First, write out ipkg_conf file so that ipkg can use it
dataMgr->writeOutIpkgConf();
// Now run upgrade
Ipkg ipkg;
ipkg.setOption( "upgrade" );
InstallDlgImpl dlg( &ipkg, "Upgrading installed packages", this, "Upgrade", true );
dlg.showDlg();
// Reload data
dataMgr->reloadServerData();
serverSelected(-1);
}
}
void NetworkPackageManager :: downloadPackage()
{
+ bool doUpdate = true;
if ( download->text() == "Download" )
{
// First, write out ipkg_conf file so that ipkg can use it
dataMgr->writeOutIpkgConf();
// Display dialog to user asking where to download the files to
bool ok = FALSE;
QString dir = "";
#ifdef QWS
// read download directory from config file
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" );
#endif
QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this );
if ( ok && !text.isEmpty() )
dir = text; // user entered something and pressed ok
else
return; // user entered nothing or pressed cancel
#ifdef QWS
// Store download directory in config file
cfg.writeEntry( "downloadDir", dir );
#endif
// Get starting directory
char initDir[PATH_MAX];
getcwd( initDir, PATH_MAX );
// Download each package
Ipkg ipkg;
connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
ipkg.setOption( "download" );
ipkg.setRuntimeDirectory( dir );
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
item != 0 ;
item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
{
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 );
ipkg.setPackage( name );
ipkg.runIpkg( );
}
}
}
else if ( download->text() == "Remove" )
{
+ doUpdate = false;
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
item != 0 ;
item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
{
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 );
Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name );
- QFile f( p->getFilename() );
- f.remove();
+
+ QString msgtext;
+ msgtext.sprintf( "Are you sure you wish to delete\n%s?", (const char *)p->getPackageName() );
+ if ( QMessageBox::information( this, "Are you sure?",
+ msgtext, "No", "Yes" ) == 1 )
+ {
+ doUpdate = true;
+ QFile f( p->getFilename() );
+ f.remove();
+ }
}
}
}
- dataMgr->reloadServerData();
- serverSelected( -1 );
+ if ( doUpdate )
+ {
+ dataMgr->reloadServerData();
+ serverSelected( -1 );
+ }
}
void NetworkPackageManager :: applyChanges()
{
stickyOption = "";
// First, write out ipkg_conf file so that ipkg can use it
dataMgr->writeOutIpkgConf();
// Now for each selected item
// deal with it
vector<InstallData> workingPackages;
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
item != 0 ;
item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
{
InstallData data = dealWithItem( item );
workingPackages.push_back( data );
}
}
if ( workingPackages.size() == 0 )
{
// Nothing to do
QMessageBox::information( this, "Nothing to do",
"No packages selected", "OK" );
return;
}
// do the stuff
InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true );
dlg.showDlg();
// Reload data
dataMgr->reloadServerData();
serverSelected(-1);
#ifdef QWS
// Finally let the main system update itself
QCopEnvelope e("QPE/System", "linkChanged(QString)");
QString lf = QString::null;
e << lf;
#endif