| 23 | |
| 24 | namespace { |
| 25 | bool wantAutoEnable(KDevelop::IProject* project, const QString& craftRoot) |
| 26 | { |
| 27 | auto projectConfigGroup = project->projectConfiguration()->group(QStringLiteral("Project")); |
| 28 | const bool haveConfigEntry = projectConfigGroup.entryMap().contains(QLatin1String("AutoEnableCraftRuntime")); |
| 29 | |
| 30 | if (!haveConfigEntry) { |
| 31 | const QString msgboxText = i18n( |
| 32 | "The project being loaded (%1) is detected to reside\n" |
| 33 | "under a Craft root [%2] .\nDo you want to automatically switch to the Craft runtime?", |
| 34 | project->name(), craftRoot); |
| 35 | |
| 36 | auto answer = KMessageBox::questionTwoActions( |
| 37 | ICore::self()->uiController()->activeMainWindow(), msgboxText, QString(), |
| 38 | KGuiItem(i18nc("@action:button", "Switch to Craft Runtime"), QStringLiteral("dialog-ok")), |
| 39 | KGuiItem(i18nc("@action:button", "Do not switch automatically"), QStringLiteral("dialog-cancel"))); |
| 40 | projectConfigGroup.writeEntry("AutoEnableCraftRuntime", answer == KMessageBox::PrimaryAction); |
| 41 | return answer == KMessageBox::PrimaryAction; |
| 42 | } else { |
| 43 | return projectConfigGroup.readEntry("AutoEnableCraftRuntime", false); |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | CraftPlugin::CraftPlugin(QObject* parent, const KPluginMetaData& metaData, const QVariantList& /*args*/) |
no test coverage detected