diff --git a/app/main.cpp b/app/main.cpp --- a/app/main.cpp +++ b/app/main.cpp @@ -27,7 +27,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include +#include "config-kdevelop.h" +#include "kdevelop_version.h" #include "urlinfo.h" @@ -358,7 +359,7 @@ KLocalizedString::setApplicationDomain("kdevelop"); static const char description[] = I18N_NOOP( "The KDevelop Integrated Development Environment" ); - KAboutData aboutData( QStringLiteral("kdevelop"), i18n( "KDevelop" ), QByteArray(VERSION), i18n(description), KAboutLicense::GPL, + KAboutData aboutData( QStringLiteral("kdevelop"), i18n( "KDevelop" ), QByteArray(KDEVELOP_VERSION_STRING), i18n(description), KAboutLicense::GPL, i18n("Copyright 1999-2017, The KDevelop developers"), QString(), QStringLiteral("https://www.kdevelop.org/")); aboutData.setDesktopFileName(QStringLiteral("org.kde.kdevelop")); aboutData.addAuthor( i18n("Kevin Funk"), i18n( "Co-maintainer, C++/Clang, QA, Windows Support" ), QStringLiteral("kfunk@kde.org") ); diff --git a/config-kdevelop.h.cmake b/config-kdevelop.h.cmake --- a/config-kdevelop.h.cmake +++ b/config-kdevelop.h.cmake @@ -1,15 +1,10 @@ -#ifndef KDEVELOP_CONFIG_H -#define KDEVELOP_CONFIG_H +#ifndef CONFIG_KDEVELOP_H +#define CONFIG_KDEVELOP_H /* config-kdevelop.h. Generated by cmake from config-kdevelop.h.cmake */ -#define VERSION "@KDevelop_VERSION_MAJOR@.@KDevelop_VERSION_MINOR@.@KDevelop_VERSION_PATCH@" -#define VERSION_MAJOR "@KDevelop_VERSION_MAJOR@" -#define VERSION_MINOR "@KDevelop_VERSION_MINOR@" -#define VERSION_PATCH "@KDevelop_VERSION_PATCH@" - #cmakedefine01 KDEVELOP_SINGLE_APP #cmakedefine01 KF5SysGuard_FOUND -#endif // KDEVELOP_CONFIG_H +#endif // CONFIG_KDEVELOP_H 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; } }