Diffstat (limited to 'noncore/settings/packagemanager/installdlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 104 |
1 files changed, 70 insertions, 34 deletions
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 781f8f5..494603b 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp | |||
@@ -52,3 +52,3 @@ _;:, .> :=|. This file is free software; you can | |||
52 | 52 | ||
53 | InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, bool showDestInfo, | 53 | InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, |
54 | OPackage::Command command1, const QStringList &packages1, | 54 | OPackage::Command command1, const QStringList &packages1, |
@@ -58,2 +58,3 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap | |||
58 | , m_packman( pm ) | 58 | , m_packman( pm ) |
59 | , m_installFound( false ) | ||
59 | , m_numCommands( 0 ) | 60 | , m_numCommands( 0 ) |
@@ -68,2 +69,5 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap | |||
68 | ++m_numCommands; | 69 | ++m_numCommands; |
70 | |||
71 | if ( command1 == OPackage::Install ) | ||
72 | m_installFound = true; | ||
69 | } | 73 | } |
@@ -74,2 +78,5 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap | |||
74 | ++m_numCommands; | 78 | ++m_numCommands; |
79 | |||
80 | if ( command2 == OPackage::Install ) | ||
81 | m_installFound = true; | ||
75 | } | 82 | } |
@@ -80,2 +87,5 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap | |||
80 | ++m_numCommands; | 87 | ++m_numCommands; |
88 | |||
89 | if ( command3 == OPackage::Install ) | ||
90 | m_installFound = true; | ||
81 | } | 91 | } |
@@ -88,3 +98,3 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap | |||
88 | 98 | ||
89 | if ( showDestInfo ) | 99 | if ( m_installFound ) |
90 | { | 100 | { |
@@ -222,3 +232,3 @@ void InstallDlg::slotBtnStart() | |||
222 | QString dest; | 232 | QString dest; |
223 | if ( m_destination ) | 233 | if ( m_installFound ) |
224 | { | 234 | { |
@@ -239,2 +249,3 @@ void InstallDlg::slotBtnStart() | |||
239 | 249 | ||
250 | Opie::Core::OProcess process( this ); | ||
240 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) | 251 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) |
@@ -244,29 +255,50 @@ void InstallDlg::slotBtnStart() | |||
244 | this, SLOT(slotOutput(char*)), true ); | 255 | this, SLOT(slotOutput(char*)), true ); |
256 | |||
257 | // Link/Unlink application if the package was removed from or installed to a destination | ||
258 | // other than root | ||
259 | if ( ( m_command[ m_currCommand ] == OPackage::Install && dest != "root" ) || | ||
260 | ( m_command[ m_currCommand ] == OPackage::Remove ) ) | ||
261 | { | ||
262 | //m_packman->findPackage( m_packages[ m_currCommand ]->destination() != "root"*/ ) | ||
263 | |||
264 | // Loop through all package names in the command group | ||
265 | for ( QStringList::Iterator it = m_packages[ m_currCommand ].begin(); | ||
266 | it != m_packages[ m_currCommand ].end(); | ||
267 | ++it ) | ||
268 | { | ||
269 | OPackage *currPackage = m_packman->findPackage( (*it) ); | ||
270 | |||
271 | // Skip package if it is not found or being removed from 'root' | ||
272 | if ( !currPackage || ( m_command[ m_currCommand ] == OPackage::Remove && | ||
273 | currPackage->destination() == "root" ) ) | ||
274 | continue; | ||
275 | |||
276 | // Display feedback to user | ||
277 | if ( m_command[ m_currCommand ] == OPackage::Install ) | ||
278 | m_output->append( tr( QString( "Running ipkg-link to link package '%1'." ) | ||
279 | .arg( currPackage->name() ) ) ); | ||
280 | else | ||
281 | m_output->append( tr( QString( "Running ipkg-link to remove links for package '%1'." ) | ||
282 | .arg( currPackage->name() ) ) ); | ||
283 | m_output->setCursorPosition( m_output->numLines(), 0 ); | ||
284 | |||
285 | // Execute ipkg-link | ||
286 | process.clearArguments(); | ||
287 | process << "ipkg-link" | ||
288 | << ( ( m_command[ m_currCommand ] == OPackage::Install ) ? "add" : "remove" ) | ||
289 | << currPackage->name(); | ||
290 | if ( !process.start( Opie::Core::OProcess::Block, | ||
291 | Opie::Core::OProcess::NoCommunication ) ) | ||
292 | { | ||
293 | slotProcessDone( 0x0 ); | ||
294 | m_output->append( tr( "Unable to run ipkg-link." ) ); | ||
295 | m_output->setCursorPosition( m_output->numLines(), 0 ); | ||
296 | return; | ||
297 | } | ||
298 | } | ||
299 | |||
300 | } | ||
245 | } | 301 | } |
246 | slotProcessDone(0l); | 302 | |
247 | 303 | slotProcessDone( 0x0 ); | |
248 | // Get destination | ||
249 | /* | ||
250 | if ( dest == "root" ) | ||
251 | { | ||
252 | slotProcessDone(0l); | ||
253 | return; | ||
254 | } | ||
255 | |||
256 | m_destItem = m_packman->findConfItem( OConfItem::Destination, dest ); | ||
257 | if ( m_destItem ) | ||
258 | { | ||
259 | QString path = m_destItem->value(); | ||
260 | Opie::Core::OProcess *process = new Opie::Core::OProcess( this, "ipkg-link process" ); | ||
261 | connect( process, SIGNAL(processExited(Opie::Core::OProcess*)), | ||
262 | this, SLOT(slotProcessDone(Opie::Core::OProcess*)) ); | ||
263 | |||
264 | *process << "ipkg-link" << "mount" << path; | ||
265 | if ( !process->start( Opie::Core::OProcess::NotifyOnExit, | ||
266 | Opie::Core::OProcess::NoCommunication ) ) | ||
267 | slotProcessDone( 0l ); | ||
268 | m_output->append( tr( "Starting ipkg-link to link installed applications." ) ); | ||
269 | m_output->setCursorPosition( m_output->numLines(), 0 ); | ||
270 | } | ||
271 | */ | ||
272 | } | 304 | } |
@@ -275,7 +307,11 @@ void InstallDlg::slotProcessDone( Opie::Core::OProcess *proc ) | |||
275 | { | 307 | { |
276 | delete proc; | 308 | if ( proc ) |
277 | 309 | { | |
278 | m_output->append( tr( "The package linking is done." ) ); | 310 | // Display message pnly if linking was done |
279 | m_output->setCursorPosition( m_output->numLines(), 0 ); | 311 | m_output->append( tr( "The package linking is done." ) ); |
280 | 312 | m_output->setCursorPosition( m_output->numLines(), 0 ); | |
313 | |||
314 | delete proc; | ||
315 | } | ||
316 | |||
281 | // All commands executed, allow user to close dialog | 317 | // All commands executed, allow user to close dialog |