diff options
author | Johann Latocha | 2011-03-01 01:52:37 +0100 |
---|---|---|
committer | Johann Latocha | 2011-03-01 01:52:37 +0100 |
commit | ab473de90a2d884c517f48f5921b9a82b1270aad (patch) | |
tree | 80b65795681928ad985365a49a8c5176e7a05479 /src | |
parent | Fix for issue #781 (diff) | |
download | vmchooser-ab473de90a2d884c517f48f5921b9a82b1270aad.tar.gz vmchooser-ab473de90a2d884c517f48f5921b9a82b1270aad.tar.xz vmchooser-ab473de90a2d884c517f48f5921b9a82b1270aad.zip |
[Fix] Startup problems with xsession (Quick&Dirty)
Diffstat (limited to 'src')
-rw-r--r-- | src/dialog.cpp | 2 | ||||
-rw-r--r-- | src/vsession.cpp | 9 | ||||
-rw-r--r-- | src/vsession.h | 2 | ||||
-rw-r--r-- | src/xsession.cpp | 12 | ||||
-rw-r--r-- | src/xsession.h | 2 |
5 files changed, 21 insertions, 6 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp index 6820e49..0e888cb 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -63,7 +63,7 @@ void Dialog::on_treeView_activated(QModelIndex index) { writePVSSettings(); } writeSessionName(s->shortDescription()); - close(); + setVisible(false); } else { QMessageBox::warning( this, trUtf8("vmchooser"), diff --git a/src/vsession.cpp b/src/vsession.cpp index 31602ed..16a8a97 100644 --- a/src/vsession.cpp +++ b/src/vsession.cpp @@ -16,6 +16,7 @@ bool VSession::init(const QString& xml, const QString& baseDirPath) { this->baseDirPath_ = baseDirPath; + _process = new QProcess(); return this->doc_.setContent(xml); } @@ -275,8 +276,12 @@ bool VSession::run() const { tmpfile.close(); tmpfile.setAutoRemove(false); - return QProcess::startDetached(runVmScript, - QStringList(tmpfile.fileName())); + _process->start(runVmScript, QStringList(tmpfile.fileName())); + QObject::connect(_process, SIGNAL(finished(int, QProcess::ExitStatus)), QApplication::instance(), SLOT(quit())); + if (_process->state() == QProcess::Starting || QProcess::Running) + return true; + else + return false; } QList<Session*> VSession::readXmlFile(const QString& filepath) { diff --git a/src/vsession.h b/src/vsession.h index 344b552..99e8e20 100644 --- a/src/vsession.h +++ b/src/vsession.h @@ -61,6 +61,8 @@ class VSession : public Session { private: QDomDocument doc_; QString baseDirPath_; + + QProcess *_process; }; #endif /*VMCHOOSER_VSESSION_H_*/ diff --git a/src/xsession.cpp b/src/xsession.cpp index a888e91..37fad17 100644 --- a/src/xsession.cpp +++ b/src/xsession.cpp @@ -65,6 +65,8 @@ bool XSession::init(const QString& filename) { this->comment_ = comment; this->icon_ = icon; + _process = new QProcess(); + return true; } @@ -99,16 +101,20 @@ QString XSession::icon() const { } bool XSession::run() const { - return QProcess::startDetached(this->exec_); + _process->start(this->exec_); + QObject::connect(_process, SIGNAL(finished(int, QProcess::ExitStatus)), QApplication::instance(), SLOT(quit())); + if (_process->state() == QProcess::Starting || QProcess::Running) + return true; + else + return false; } QList<Session*> XSession::readSessions(const QString& path) { QList<Session*> retval; foreach (QFileInfo fi, QDir(path).entryInfoList(QStringList("*.desktop"))) { - if (fi.baseName().compare("default.desktop") == 0) { + if (fi.baseName().compare("default") == 0) { continue; } - XSession* session = new XSession; if (session->init(fi.absoluteFilePath())) { retval.append(session); diff --git a/src/xsession.h b/src/xsession.h index a3aa31b..dbdacf1 100644 --- a/src/xsession.h +++ b/src/xsession.h @@ -38,6 +38,8 @@ class XSession : public Session { QString exec_; QString comment_; QString icon_; + + QProcess *_process; }; #endif /*VMCHOOSER_XSESSION_H_*/ |