MCPcopy Create free account
hub / github.com/KDE/kdevelop / wantAutoEnable

Function wantAutoEnable

plugins/craft/craftplugin.cpp:25–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24namespace {
25bool 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
48CraftPlugin::CraftPlugin(QObject* parent, const KPluginMetaData& metaData, const QVariantList& /*args*/)

Callers 1

CraftPluginMethod · 0.85

Calls 8

uiControllerMethod · 0.80
writeEntryMethod · 0.80
readEntryMethod · 0.80
QStringClass · 0.50
projectConfigurationMethod · 0.45
containsMethod · 0.45
nameMethod · 0.45
activeMainWindowMethod · 0.45

Tested by

no test coverage detected