diff --git a/debugjob.h b/debugjob.h --- a/debugjob.h +++ b/debugjob.h @@ -84,6 +84,7 @@ void sessionFinished(); private: + void processFailedToStart(); QUrl m_url; QString m_browser; DebugSession* m_session; diff --git a/debugjob.cpp b/debugjob.cpp --- a/debugjob.cpp +++ b/debugjob.cpp @@ -263,15 +263,19 @@ setError(-1); QString errmsg = i18n("Could not start program '%1'. Make sure that the " "path is specified correctly.", m_proc->property("executable").toString()); - KMessageBox::error(KDevelop::ICore::self()->uiController()->activeMainWindow(), errmsg, i18n("Could not start application")); setErrorText(errmsg); emitResult(); } qDebug() << "Process error"; if (m_session && m_session->connection()) { m_session->connection()->setState(DebugSession::EndedState); } + else if(m_session) + { + m_session->stateChanged(DebugSession::EndedState); + m_session->stopDebugger(); + } } void XDebugJob::appendLine(const QString& l) @@ -294,6 +298,8 @@ session->setLaunchConfiguration(cfg); + setObjectName(cfg->name()); + IExecuteBrowserPlugin* iface = KDevelop::ICore::self()->pluginController() ->pluginForExtension("org.kdevelop.IExecuteBrowserPlugin")->extension(); Q_ASSERT(iface); @@ -341,9 +347,33 @@ } } else { KProcess proc(this); + proc.setProgram(QStringList() << m_browser << url.url()); - proc.execute(); - emitResult(); + if( !proc.startDetached() ) + { + processFailedToStart(); + } + } +} + + +void XDebugBrowserJob::processFailedToStart() +{ + qWarning() << "Cannot start application" << m_browser; + setError(-1); + QString errmsg = i18n("Could not start program '%1'. Make sure that the " + "path is specified correctly.", m_browser); + setErrorText(errmsg); + emitResult(); + qDebug() << "Process error"; + + if (m_session && m_session->connection()) { + m_session->connection()->setState(DebugSession::EndedState); + } + else if(m_session) + { + m_session->stateChanged(DebugSession::EndedState); + m_session->stopDebugger(); } } @@ -361,4 +391,5 @@ { emitResult(); } + }