diff --git a/kdevplatform/documentation/documentationview.cpp b/kdevplatform/documentation/documentationview.cpp --- a/kdevplatform/documentation/documentationview.cpp +++ b/kdevplatform/documentation/documentationview.cpp @@ -44,11 +44,6 @@ DocumentationView::DocumentationView(QWidget* parent, ProvidersModel* model) : QWidget(parent), mProvidersModel(model) { - if (ICore::self()->shuttingDown()) { - qCWarning(DOCUMENTATION) << "DocumentationView created during shutdown; ignoring"; - return; - } - setWindowIcon(QIcon::fromTheme(QStringLiteral("documentation"), windowIcon())); setWindowTitle(i18n("Documentation")); @@ -285,9 +280,7 @@ if (mCurrent != mHistory.end()) { w = (*mCurrent)->documentationWidget(mFindDoc, this); Q_ASSERT(w); - if (mIdentifiers->window() == w->window()) { - QWidget::setTabOrder(mIdentifiers, w); - } + QWidget::setTabOrder(mIdentifiers, w); } else { // placeholder widget at location of doc view w = new QWidget(this); diff --git a/plugins/execute/nativeappjob.cpp b/plugins/execute/nativeappjob.cpp --- a/plugins/execute/nativeappjob.cpp +++ b/plugins/execute/nativeappjob.cpp @@ -19,8 +19,10 @@ #include "nativeappjob.h" +#include #include #include +#include #include #include @@ -133,19 +135,35 @@ void NativeAppJob::start() { - // we kill any execution of the configuration - auto currentJobs = ICore::self()->runController()->currentJobs(); - for (auto it = currentJobs.begin(); it != currentJobs.end();) { - NativeAppJob* job = findNativeJob(*it); - if (job && job != this && job->m_name == m_name) { - QMessageBox::StandardButton button = QMessageBox::question(nullptr, i18n("Job already running"), i18n("'%1' is already being executed. Should we kill the previous instance?", m_name)); - if (button != QMessageBox::No && ICore::self()->runController()->currentJobs().contains(*it)) { - (*it)->kill(); - } - currentJobs = ICore::self()->runController()->currentJobs(); - it = currentJobs.begin(); - } else { - ++it; + QVector > currentJobs; + // collect running instances of the same type + for (auto j : ICore::self()->runController()->currentJobs()) { + NativeAppJob* njob = findNativeJob(j); + if (njob && njob != this && njob->m_name == m_name) + currentJobs << njob; + } + + if (!currentJobs.isEmpty()) { + QMessageBox msgBox(QMessageBox::Question, + i18n("Job already running"), + i18n("'%1' is already being executed.", m_name), + QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); + msgBox.button(QMessageBox::No)->setText(i18n("Kill All Instances")); + msgBox.button(QMessageBox::Yes)->setText(i18n("Start Another")); + msgBox.setDefaultButton(QMessageBox::Cancel); + + switch (msgBox.exec()) { + case QMessageBox::Yes: // simply start another job + break; + case QMessageBox::No: // kill the running instance + for (auto & job : currentJobs) { + if (job) + job->kill(); + } + break; + default: // cancel starting a new job + kill(); + return; } }