summaryrefslogtreecommitdiff
path: root/noncore/settings/packagemanager/installdlg.cpp
Unidiff
Diffstat (limited to 'noncore/settings/packagemanager/installdlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/installdlg.cpp81
1 files changed, 2 insertions, 79 deletions
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp
index 985e2bd..7dea591 100644
--- a/noncore/settings/packagemanager/installdlg.cpp
+++ b/noncore/settings/packagemanager/installdlg.cpp
@@ -31,5 +31,4 @@ _;:, .> :=|. This file is free software; you can
31 31
32#include <opie2/ofiledialog.h> 32#include <opie2/ofiledialog.h>
33#include <opie2/oprocess.h>
34 33
35#include <qpe/fileselector.h> 34#include <qpe/fileselector.h>
@@ -248,85 +247,9 @@ void InstallDlg::slotBtnStart()
248 } 247 }
249 248
250 Opie::Core::OProcess process( this );
251 for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) 249 for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ )
252 { 250 {
253 // Execute next command 251 // Execute next command
254 m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, 252 m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest,
255 this, SLOT(slotOutput(char*)), true ); 253 this, SLOT(slotOutput(const QString &)), true );
256
257 if ( m_command[ m_currCommand ] == OPackage::Remove )
258 {
259 // Unlink application if the package was removed
260
261 // Loop through all package names in the command group
262 for ( QStringList::Iterator it = m_packages[ m_currCommand ].begin();
263 it != m_packages[ m_currCommand ].end();
264 ++it )
265 {
266 OPackage *currPackage = m_packman->findPackage( (*it) );
267
268 // Skip package if it is not found or being removed from 'root'
269 if ( !currPackage || ( m_command[ m_currCommand ] == OPackage::Remove &&
270 currPackage->destination() == "root" ) )
271 continue;
272
273 // Display feedback to user
274 m_output->append( tr( QString( "Running ipkg-link to remove links for package '%1'." )
275 .arg( currPackage->name() ) ) );
276 m_output->setCursorPosition( m_output->numLines(), 0 );
277
278 // Execute ipkg-link
279 process.clearArguments();
280 process << "ipkg-link"
281 << ( ( m_command[ m_currCommand ] == OPackage::Install ) ? "add" : "remove" )
282 << currPackage->name();
283 if ( !process.start( Opie::Core::OProcess::Block,
284 Opie::Core::OProcess::NoCommunication ) )
285 {
286 slotProcessDone( 0l );
287 m_output->append( tr( "Unable to run ipkg-link." ) );
288 m_output->setCursorPosition( m_output->numLines(), 0 );
289 return;
290 }
291 }
292 }
293 else if ( m_command[ m_currCommand ] == OPackage::Install && dest != "root" )
294 {
295 // Link applications in the destination directory
296
297 m_output->append( tr( "Running ipkg-link to link packages in '%1'." ).arg( dest ) );
298 m_output->setCursorPosition( m_output->numLines(), 0 );
299
300 QString destPath;
301 OConfItem *destItem = m_packman->findConfItem( OConfItem::Destination, dest );
302
303 // Execute ipkg-link
304 process.clearArguments();
305 process << "ipkg-link"
306 << "mount"
307 << destItem->value();
308 if ( !process.start( Opie::Core::OProcess::Block,
309 Opie::Core::OProcess::NoCommunication ) )
310 {
311 slotProcessDone( 0l );
312 m_output->append( tr( "Unable to run ipkg-link." ) );
313 m_output->setCursorPosition( m_output->numLines(), 0 );
314 return;
315 }
316 }
317 }
318
319 slotProcessDone( 0l );
320}
321
322void InstallDlg::slotProcessDone( Opie::Core::OProcess *proc )
323{
324 if ( proc )
325 {
326 // Display message pnly if linking was done
327 m_output->append( tr( "The package linking is done." ) );
328 m_output->setCursorPosition( m_output->numLines(), 0 );
329
330 delete proc;
331 } 254 }
332 255
@@ -373,5 +296,5 @@ void InstallDlg::slotBtnOptions()
373} 296}
374 297
375void InstallDlg::slotOutput( char *msg ) 298void InstallDlg::slotOutput( const QString &msg )
376{ 299{
377 // Allow processing of other events 300 // Allow processing of other events