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

Method ConfigDialog

kdevplatform/shell/configdialog.cpp:27–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25//FIXME: unit test this code!
26
27ConfigDialog::ConfigDialog(QWidget* parent)
28 : KPageDialog(parent)
29{
30 setWindowTitle(i18nc("@title:window", "Configure"));
31 setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults);
32 button(QDialogButtonBox::Apply)->setEnabled(false);
33 setObjectName(QStringLiteral("configdialog"));
34
35 auto onApplyClicked = [this] {
36 auto page = qobject_cast<ConfigPage*>(currentPage()->widget());
37 Q_ASSERT(page);
38 applyChanges(page);
39 };
40
41 connect(button(QDialogButtonBox::Apply), &QPushButton::clicked, onApplyClicked);
42 connect(button(QDialogButtonBox::Ok), &QPushButton::clicked, [this, onApplyClicked] {
43 if (m_currentPageHasChanges) {
44 onApplyClicked();
45 }
46 });
47 connect(button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, [this]() {
48 auto page = qobject_cast<ConfigPage*>(currentPage()->widget());
49 Q_ASSERT(page);
50 page->defaults();
51 });
52
53 connect(this, &KPageDialog::currentPageChanged, this, &ConfigDialog::checkForUnsavedChanges);
54 // make sure we don't keep any entries for unloaded plugins
55 connect(ICore::self()->pluginController(), &IPluginController::unloadingPlugin,
56 this, &ConfigDialog::removePagesForPlugin);
57}
58
59
60KPageWidgetItem* ConfigDialog::itemForPage(ConfigPage* page) const

Callers

nothing calls this directly

Calls 5

buttonFunction · 0.85
pluginControllerMethod · 0.80
setEnabledMethod · 0.45
widgetMethod · 0.45
defaultsMethod · 0.45

Tested by

no test coverage detected