bool Kleo::SymCryptRunProcessBase::launch( const QByteArray & input, bool block ) { connect( this, SIGNAL(readyReadStandardOutput()), this, SLOT(slotReadyReadStandardOutput()) ); connect( this, SIGNAL(readyReadStandardError()), this, SLOT(slotReadyReadStandardError()) ); if ( block ) { KTemporaryFile tempfile; if ( tempfile.open() ) tempfile.write( input ); else return false; tempfile.flush(); *this << "--input" << tempfile.fileName(); addOptions(); if(KProcess::execute() == -2) return false; } else { addOptions(); KProcess::start(); const bool ok = waitForStarted(); if ( !ok ) return ok; mInput = input; write( mInput ); closeWriteChannel(); } return true; }
OwncloudSetupWizard::OwncloudSetupWizard( FolderMan *folderMan, QObject *parent ) : QObject( parent ), _ocInfo(0), _folderMan(folderMan) { _process = new QProcess( this ); QObject::connect(_process, SIGNAL(readyReadStandardOutput()), SLOT(slotReadyReadStandardOutput())); QObject::connect(_process, SIGNAL(readyReadStandardError()), SLOT(slotReadyReadStandardError())); QObject::connect(_process, SIGNAL(stateChanged(QProcess::ProcessState)), SLOT(slotStateChanged(QProcess::ProcessState))); QObject::connect(_process, SIGNAL(error(QProcess::ProcessError)), SLOT(slotError(QProcess::ProcessError))); QObject::connect(_process, SIGNAL(started()), SLOT(slotStarted())); QObject::connect(_process, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(slotProcessFinished(int, QProcess::ExitStatus))); _ocWizard = new OwncloudWizard(); connect( _ocWizard, SIGNAL(connectToOCUrl( const QString& ) ), this, SLOT(slotConnectToOCUrl( const QString& ))); connect( _ocWizard, SIGNAL(installOCServer()), this, SLOT(slotInstallOCServer())); connect( _ocWizard, SIGNAL(installOCLocalhost()), this, SLOT(slotCreateOCLocalhost())); // in case of cancel, terminate the owncloud-admin script. connect( _ocWizard, SIGNAL(rejected()), _process, SLOT(terminate())); }