summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp58
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.h4
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp5
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp23
4 files changed, 46 insertions, 44 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index e122064..a924daf 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -52,185 +52,185 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
flags = 0;
#endif
// Output text is read only
output->setReadOnly( true );
QFont f( "helvetica" );
f.setPointSize( 10 );
output->setFont( f );
// setup destination data
int defIndex = 0;
int i;
for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i )
{
destination->insertItem( dit->getDestinationName() );
if ( dit->getDestinationName() == defaultDest )
defIndex = i;
}
destination->setCurrentItem( defIndex );
vector<InstallData>::iterator it;
// setup package data
QString remove = "Remove\n";
QString install = "\nInstall\n";
QString upgrade = "\nUpgrade\n";
for ( it = packageList.begin() ; it != packageList.end() ; ++it )
{
InstallData item = *it;
if ( item.option == "I" )
{
installList.push_back( item );
install += " " + item.packageName + "\n";
}
else if ( item.option == "D" )
{
removeList.push_back( item );
remove += " " + item.packageName + "\n";
}
else if ( item.option == "U" )
{
updateList.push_back( item );
upgrade += " " + item.packageName + "\n";
}
}
output->setText( remove + install + upgrade );
-
- connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
}
-InstallDlgImpl::InstallDlgImpl( QWidget *parent, const char *name, bool modal, WFlags fl )
+InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl )
: InstallDlg( parent, name, modal, fl )
{
- upgradePackages = true;
- output->setText( "Upgrading installed packages" );
- connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
+ pIpkg = ipkg;
+ output->setText( initialText );
}
InstallDlgImpl::~InstallDlgImpl()
{
}
bool InstallDlgImpl :: showDlg()
{
showMaximized();
bool ret = exec();
return ret;
}
void InstallDlgImpl :: optionsSelected()
{
InstallOptionsDlgImpl opt( flags, this, "Option", true );
opt.exec();
// set options selected from dialog
flags = 0;
if ( opt.forceDepends->isChecked() )
flags |= FORCE_DEPENDS;
if ( opt.forceReinstall->isChecked() )
flags |= FORCE_REINSTALL;
if ( opt.forceRemove->isChecked() )
flags |= FORCE_REMOVE;
if ( opt.forceOverwrite->isChecked() )
flags |= FORCE_OVERWRITE;
#ifdef QWS
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
cfg.writeEntry( "installFlags", flags );
#endif
}
void InstallDlgImpl :: installSelected()
{
if ( btnInstall->text() == "Close" )
{
done( 1 );
return;
}
btnInstall->setEnabled( false );
- if ( upgradePackages )
+ if ( pIpkg )
{
output->setText( "" );
- Ipkg ipkg;
- connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
- ipkg.setOption( "upgrade" );
- ipkg.runIpkg();
+ connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
+ pIpkg->runIpkg();
}
else
{
output->setText( "" );
Destination *d = dataMgr->getDestination( destination->currentText() );
QString dest = d->getDestinationName();
QString destDir = d->getDestinationPath();
int instFlags = flags;
if ( d->linkToRoot() )
instFlags |= MAKE_LINKS;
#ifdef QWS
// Save settings
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
cfg.writeEntry( "dest", dest );
#endif
+ pIpkg = new Ipkg;
+ connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
+
// First run through the remove list, then the install list then the upgrade list
vector<InstallData>::iterator it;
- ipkg.setOption( "remove" );
+ pIpkg->setOption( "remove" );
for ( it = removeList.begin() ; it != removeList.end() ; ++it )
{
- ipkg.setDestination( it->destination->getDestinationName() );
- ipkg.setDestinationDir( it->destination->getDestinationPath() );
- ipkg.setPackage( it->packageName );
+ pIpkg->setDestination( it->destination->getDestinationName() );
+ pIpkg->setDestinationDir( it->destination->getDestinationPath() );
+ pIpkg->setPackage( it->packageName );
int tmpFlags = flags;
if ( it->destination->linkToRoot() )
tmpFlags |= MAKE_LINKS;
- ipkg.setFlags( tmpFlags );
- ipkg.runIpkg();
+ pIpkg->setFlags( tmpFlags );
+ pIpkg->runIpkg();
}
- ipkg.setOption( "install" );
- ipkg.setDestination( dest );
- ipkg.setDestinationDir( destDir );
- ipkg.setFlags( instFlags );
+ pIpkg->setOption( "install" );
+ pIpkg->setDestination( dest );
+ pIpkg->setDestinationDir( destDir );
+ pIpkg->setFlags( instFlags );
for ( it = installList.begin() ; it != installList.end() ; ++it )
{
- ipkg.setPackage( it->packageName );
- ipkg.runIpkg();
+ pIpkg->setPackage( it->packageName );
+ pIpkg->runIpkg();
}
flags |= FORCE_REINSTALL;
- ipkg.setOption( "reinstall" );
+ pIpkg->setOption( "reinstall" );
for ( it = updateList.begin() ; it != updateList.end() ; ++it )
{
- ipkg.setDestination( it->destination->getDestinationName() );
- ipkg.setDestinationDir( it->destination->getDestinationPath() );
- ipkg.setPackage( it->packageName );
+ pIpkg->setDestination( it->destination->getDestinationName() );
+ pIpkg->setDestinationDir( it->destination->getDestinationPath() );
+ pIpkg->setPackage( it->packageName );
int tmpFlags = flags;
if ( it->destination->linkToRoot() && it->recreateLinks )
tmpFlags |= MAKE_LINKS;
- ipkg.setFlags( tmpFlags );
- ipkg.runIpkg();
+ pIpkg->setFlags( tmpFlags );
+ pIpkg->runIpkg();
}
+
+ delete pIpkg;
}
btnInstall->setEnabled( true );
btnInstall->setText( tr( "Close" ) );
}
void InstallDlgImpl :: displayText(const QString &text )
{
QString t = output->text() + "\n" + text;
output->setText( t );
output->setCursorPosition( output->numLines(), 0 );
}
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h
index 3a5d8b8..6716ced 100644
--- a/noncore/settings/aqpkg/installdlgimpl.h
+++ b/noncore/settings/aqpkg/installdlgimpl.h
@@ -1,65 +1,65 @@
/***************************************************************************
installdlgimpl.h - description
-------------------
begin : Mon Aug 26 2002
copyright : (C) 2002 by Andy Qua
email : andy.qua@blueyonder.co.uk
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef INSTALLDLGIMPL_H
#define INSTALLDLGIMPL_H
#include <vector>
using namespace std;
#include <qstring.h>
#include "ipkg.h"
#include "install.h"
class InstallData
{
public:
QString option; // I - install, D - delete, U - upgrade
QString packageName;
Destination *destination;
bool recreateLinks;
};
class InstallDlgImpl : public InstallDlg
{
public:
InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
- InstallDlgImpl( QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
+ InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
~InstallDlgImpl();
bool showDlg();
bool upgradeServer( QString &server );
protected:
private:
DataManager *dataMgr;
vector<InstallData> installList;
vector<InstallData> removeList;
vector<InstallData> updateList;
int flags;
- Ipkg ipkg;
+ Ipkg *pIpkg;
bool upgradePackages;
bool runIpkg( QString &option, const QString& package, const QString& dest, int flags );
void optionsSelected();
void installSelected();
void displayText(const QString &text );
};
#endif
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index 02d4258..eacef76 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -60,98 +60,99 @@ bool Ipkg :: runIpkg( )
if ( runtimeDir != "" )
{
cmd += "cd ";
cmd += runtimeDir;
cmd += " ; ";
}
cmd += "ipkg";
if ( option != "update" && option != "download" && option != "upgrade" )
{
cmd += " -dest "+ destination;
cmd += " -force-defaults";
if ( flags & FORCE_DEPENDS )
cmd += " -force-depends";
if ( flags & FORCE_REINSTALL )
cmd += " -force-reinstall";
if ( flags & FORCE_REMOVE )
cmd += " -force-removal-of-essential-packages";
if ( flags & FORCE_OVERWRITE )
cmd += " -force-overwrite";
// Handle make links
// Rules - If make links is switched on, create links to root
// if destDir is NOT /
if ( flags & MAKE_LINKS )
{
// If destDir == / turn off make links as package is being insalled
// to root already.
if ( destDir == "/" )
flags ^= MAKE_LINKS;
}
}
#ifdef X86
cmd += " -f ";
cmd += IPKG_CONF;
#endif
if ( option == "reinstall" )
cmd += " install";
else
cmd += " " + option;
if ( option != "upgrade" )
cmd += " " + package;
cmd += " 2>&1";
-
- emit outputText( QString( "Dealing with package " ) + package );
+
+ if ( package != "" )
+ emit outputText( QString( "Dealing with package " ) + package );
qApp->processEvents();
// If we are removing packages and make links option is selected
// create the links
if ( option == "remove" || option == "reinstall" )
{
createLinks = false;
if ( flags & MAKE_LINKS )
{
emit outputText( QString( "Removing symbolic links...\n" ) );
linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
emit outputText( QString( " " ) );
}
}
emit outputText( cmd );
// Execute command
dependantPackages = new QList<QString>;
dependantPackages->setAutoDelete( true );
ret = executeIpkgCommand( cmd, option );
if ( option == "install" || option == "reinstall" )
{
// If we are not removing packages and make links option is selected
// create the links
createLinks = true;
if ( flags & MAKE_LINKS )
{
emit outputText( " " );
emit outputText( QString( "Creating symbolic links for " )+ package );
linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
// link dependant packages that were installed with this release
QString *pkg;
for ( pkg = dependantPackages->first(); pkg != 0; pkg = dependantPackages->next() )
{
if ( *pkg == package )
continue;
emit outputText( " " );
emit outputText( QString( "Creating symbolic links for " )+ (*pkg) );
linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir );
}
}
}
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 52d95a8..6874ded 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -223,138 +223,139 @@ void NetworkPackageManager :: serverSelected( int )
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 );
}
// If the local server or the local ipkgs server disable the download button
if ( serverName == LOCAL_SERVER )
{
upgrade->setEnabled( false );
download->setText( "Download" );
download->setEnabled( false );
}
else if ( serverName == LOCAL_IPKGS )
{
upgrade->setEnabled( false );
download->setEnabled( true );
download->setText( "Remove" );
}
else
{
upgrade->setEnabled( true );
download->setEnabled( true );
download->setText( "Download" );
}
}
void NetworkPackageManager :: updateServer()
{
QString serverName = serversList->currentText();
// Update the current server
// Display dialog
- ProgressDlg *dlg = new ProgressDlg( this );
- QString status = "Updating package lists...";
- dlg->show();
- dlg->setText( status );
+// ProgressDlg *progDlg = new ProgressDlg( this );
+// QString status = "Updating package lists...";
+// progDlg->show();
+// progDlg->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();
- QString option = "update";
- QString dummy = "";
Ipkg ipkg;
- connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
- ipkg.setOption( option );
+ ipkg.setOption( "update" );
- ipkg.runIpkg( );
+ InstallDlgImpl dlg( &ipkg, "Refreshing server package lists", this, "Upgrade", true );
+ dlg.showDlg();
// Reload data
dataMgr->reloadServerData( serversList->currentText() );
serverSelected(-1);
- delete dlg;
+// 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
- InstallDlgImpl dlg( this, "Upgrade", true );
+ Ipkg ipkg;
+ ipkg.setOption( "upgrade" );
+
+ InstallDlgImpl dlg( &ipkg, "Upgrading installed packages", this, "Upgrade", true );
dlg.showDlg();
// Reload data
dataMgr->reloadServerData( LOCAL_SERVER );
dataMgr->reloadServerData( serversList->currentText() );
serverSelected(-1);
}
}
void NetworkPackageManager :: downloadPackage()
{
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" );