summaryrefslogtreecommitdiff
path: root/noncore
authordrw <drw>2004-11-18 15:49:02 (UTC)
committer drw <drw>2004-11-18 15:49:02 (UTC)
commit7ac32658ba09d8456cc75e5cf80707caa616848b (patch) (side-by-side diff)
tree56bae9b9c75eae7a9096013830fe98d28a4de0ed /noncore
parent718a7a8ba68e10faa1a22fcc6bdc26e1723b2a40 (diff)
downloadopie-7ac32658ba09d8456cc75e5cf80707caa616848b.zip
opie-7ac32658ba09d8456cc75e5cf80707caa616848b.tar.gz
opie-7ac32658ba09d8456cc75e5cf80707caa616848b.tar.bz2
UI tweaks for Installation dialog - 1. Show destination selection only when installing apps, 2. Update available disk space after each package is processed, 3. Disable destination selection once start button has been clicked
Diffstat (limited to 'noncore') (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
@@ -30,6 +30,7 @@ _;:, .> :=|. This file is free software; you can
#include "installdlg.h"
#include <opie2/ofiledialog.h>
+#include <opie2/oprocess.h>
#include <qpe/fileselector.h>
#include <qpe/resource.h>
@@ -57,6 +58,7 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap
, m_packman( pm )
, m_numCommands( 0 )
, m_currCommand( 0 )
+ , m_destItem( 0x0 )
{
// Save command/package list information
if ( command1 != OPackage::NotDefined )
@@ -163,10 +165,6 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap
}
-InstallDlg::~InstallDlg()
-{
-}
-
void InstallDlg::slotDisplayAvailSpace( const QString &destination )
{
// If available space is not displayed, exit
@@ -176,13 +174,14 @@ void InstallDlg::slotDisplayAvailSpace( const QString &destination )
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;
@@ -220,6 +219,13 @@ void InstallDlg::slotBtnStart()
}
// 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 )
{
@@ -231,16 +237,46 @@ void InstallDlg::slotBtnStart()
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 );
@@ -294,4 +330,7 @@ void InstallDlg::slotOutput( char *msg )
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
@@ -39,8 +39,17 @@ class QLabel;
class QMultiLineEdit;
class QPushButton;
+class OConfItem;
class OPackageManager;
+namespace Opie
+{
+ namespace Core
+ {
+ class OProcess;
+ }
+}
+
class InstallDlg : public QWidget
{
Q_OBJECT
@@ -54,7 +63,6 @@ public:
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
@@ -71,13 +79,15 @@ private:
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 );
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
@@ -531,7 +531,7 @@ void MainWindow::slotApply()
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 );