summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/installdlg.cpp61
-rw-r--r--noncore/settings/packagemanager/installdlg.h14
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp2
3 files changed, 63 insertions, 14 deletions
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp
index 945dfed..781f8f5 100644
--- a/noncore/settings/packagemanager/installdlg.cpp
+++ b/noncore/settings/packagemanager/installdlg.cpp
@@ -25,16 +25,17 @@ _;:, .> :=|. This file is free software; you can
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "installdlg.h"
#include <opie2/ofiledialog.h>
+#include <opie2/oprocess.h>
#include <qpe/fileselector.h>
#include <qpe/resource.h>
#include <qpe/storage.h>
#include <qapplication.h>
#include <qcombobox.h>
#include <qfileinfo.h>
@@ -52,16 +53,17 @@ _;:, .> :=|. This file is free software; you can
InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, bool showDestInfo,
OPackage::Command command1, const QStringList &packages1,
OPackage::Command command2, const QStringList &packages2,
OPackage::Command command3, const QStringList &packages3 )
: QWidget( 0x0 )
, m_packman( pm )
, m_numCommands( 0 )
, m_currCommand( 0 )
+ , m_destItem( 0x0 )
{
// Save command/package list information
if ( command1 != OPackage::NotDefined )
{
m_command[ m_numCommands ] = command1;
m_packages[ m_numCommands ] = packages1;
++m_numCommands;
}
@@ -158,36 +160,33 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap
}
}
m_output->append( tr( "Press the start button to begin.\n" ) );
m_output->setCursorPosition( m_output->numLines(), 0 );
}
-InstallDlg::~InstallDlg()
-{
-}
-
void InstallDlg::slotDisplayAvailSpace( const QString &destination )
{
// If available space is not displayed, exit
if ( !m_availSpace )
return;
QString space = tr( "Unknown" );
// Get destination
- OConfItem *dest = m_packman->findConfItem( OConfItem::Destination, destination );
+ if ( !destination.isNull() )
+ m_destItem = m_packman->findConfItem( OConfItem::Destination, destination );
- if ( dest )
+ if ( m_destItem )
{
// Calculate available space
struct statfs fs;
- if ( !statfs( dest->value(), &fs ) )
+ if ( !statfs( m_destItem->value(), &fs ) )
{
long mult = fs.f_bsize / 1024;
long div = 1024 / fs.f_bsize;
if ( !mult ) mult = 1;
if ( !div ) div = 1;
long avail = fs.f_bavail * mult / div;
@@ -215,37 +214,74 @@ void InstallDlg::slotBtnStart()
else if ( btnText == tr( "Close" ) )
{
// TODO - force reload of package data
emit closeInstallDlg();
return;
}
// Start was clicked, start executing
+ QString dest;
+ if ( m_destination )
+ {
+ dest = m_destination->currentText();
+ m_destination->setEnabled( false );
+ }
+
m_btnOptions->setEnabled( false );
if ( m_numCommands > 1 )
{
m_btnStart->setText( tr( "Abort" ) );
m_btnStart->setIconSet( Resource::loadPixmap( "close" ) );
}
else
{
m_btnStart->setEnabled( false );
}
- QString dest;
- if ( m_destination )
- dest = m_destination->currentText();
-
for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ )
{
// Execute next command
m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest,
this, SLOT(slotOutput(char*)), true );
}
+ slotProcessDone(0l);
+
+ // Get destination
+/*
+ if ( dest == "root" )
+ {
+ slotProcessDone(0l);
+ return;
+ }
+
+ m_destItem = m_packman->findConfItem( OConfItem::Destination, dest );
+ if ( m_destItem )
+ {
+ QString path = m_destItem->value();
+ Opie::Core::OProcess *process = new Opie::Core::OProcess( this, "ipkg-link process" );
+ connect( process, SIGNAL(processExited(Opie::Core::OProcess*)),
+ this, SLOT(slotProcessDone(Opie::Core::OProcess*)) );
+
+ *process << "ipkg-link" << "mount" << path;
+ if ( !process->start( Opie::Core::OProcess::NotifyOnExit,
+ Opie::Core::OProcess::NoCommunication ) )
+ slotProcessDone( 0l );
+ m_output->append( tr( "Starting ipkg-link to link installed applications." ) );
+ m_output->setCursorPosition( m_output->numLines(), 0 );
+ }
+*/
+}
+
+void InstallDlg::slotProcessDone( Opie::Core::OProcess *proc )
+{
+ delete proc;
+
+ m_output->append( tr( "The package linking is done." ) );
+ m_output->setCursorPosition( m_output->numLines(), 0 );
// All commands executed, allow user to close dialog
m_btnStart->setEnabled( true );
m_btnStart->setText( tr( "Close" ) );
m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) );
m_btnOptions->setEnabled( true );
m_btnOptions->setText( tr( "Save output" ) );
@@ -289,9 +325,12 @@ void InstallDlg::slotOutput( char *msg )
// Allow processing of other events
qApp->processEvents();
QString lineStr = msg;
if ( lineStr[lineStr.length()-1] == '\n' )
lineStr.truncate( lineStr.length() - 1 );
m_output->append( lineStr );
m_output->setCursorPosition( m_output->numLines(), 0 );
+
+ // Update available space
+ slotDisplayAvailSpace( QString::null );
}
diff --git a/noncore/settings/packagemanager/installdlg.h b/noncore/settings/packagemanager/installdlg.h
index cddc911..f45c17c 100644
--- a/noncore/settings/packagemanager/installdlg.h
+++ b/noncore/settings/packagemanager/installdlg.h
@@ -34,55 +34,65 @@ _;:, .> :=|. This file is free software; you can
#include "opackage.h"
class QComboBox;
class QLabel;
class QMultiLineEdit;
class QPushButton;
+class OConfItem;
class OPackageManager;
+namespace Opie
+{
+ namespace Core
+ {
+ class OProcess;
+ }
+}
+
class InstallDlg : public QWidget
{
Q_OBJECT
public:
InstallDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &caption = QString::null,
bool showDestInfo = true,
OPackage::Command command1 = OPackage::NotDefined,
const QStringList &packages1 = QStringList(),
OPackage::Command command2 = OPackage::NotDefined,
const QStringList &packages2 = QStringList(),
OPackage::Command command3 = OPackage::NotDefined,
const QStringList &packages3 = QStringList() );
- ~InstallDlg();
private:
OPackageManager *m_packman; // Pointer to application instance of package manager
// UI controls
QComboBox *m_destination; // Destination selection list
QLabel *m_availSpace; // Text label to display available space on selected destination
QMultiLineEdit *m_output; // Multi-line edit to display status
QPushButton *m_btnStart; // Start/abort/close button
QPushButton *m_btnOptions; // Installation options button
// Commands and packages to execute
int m_numCommands; // Number of commands to be executed
int m_currCommand; // Number of currently executing command
OPackage::Command m_command[3]; // List of commands to be executed
QStringList m_packages[3]; // Lists of package names associated to commands (m_command[])
+ OConfItem *m_destItem; // Pointer to destination for package installation
private slots:
// UI control slots
void slotDisplayAvailSpace( const QString &destination );
void slotBtnStart();
void slotBtnOptions();
-
+ void slotProcessDone( Opie::Core::OProcess *proc );
+
// Execution slots
void slotOutput( char *msg );
signals:
void closeInstallDlg();
};
#endif
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 5e15874..459a75b 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -526,17 +526,17 @@ void MainWindow::slotApply()
OPackage::Command installCmd = OPackage::NotDefined;
if ( !installList.isEmpty() )
installCmd = OPackage::Install;
OPackage::Command upgradeCmd = OPackage::NotDefined;
if ( !upgradeList.isEmpty() )
upgradeCmd = OPackage::Upgrade;
// Create package manager output widget
- InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true,
+ InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), !installList.isEmpty(),
removeCmd, removeList,
installCmd, installList,
upgradeCmd, upgradeList );
connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
// Display widget
m_widgetStack.addWidget( dlg, 3 );
m_widgetStack.raiseWidget( dlg );