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

Method saveSettings

kdevplatform/shell/sourceformatterselectionedit.cpp:960–992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

958}
959
960void SourceFormatterSelectionEdit::saveSettings(KConfigGroup& config) const
961{
962 Q_D(const SourceFormatterSelectionEdit);
963
964 // Store possibly modified user-defined styles. Store globally to allow reusing styles across sessions.
965 KConfigGroup globalConfig = Core::self()->sourceFormatterControllerInternal()->globalConfig();
966 for (const auto& formatter : d->formatters) {
967 KConfigGroup fmtgrp = globalConfig.group(formatter->name());
968
969 // Delete all user-defined styles so we don't leave behind styles deleted in the UI.
970 const auto oldStyleGroups = fmtgrp.groupList();
971 for (const QString& subgrp : oldStyleGroups) {
972 if (subgrp.startsWith(userStyleNamePrefix)) {
973 fmtgrp.deleteGroup( subgrp );
974 }
975 }
976
977 formatter->forEachUserDefinedStyle([&fmtgrp](const SourceFormatterStyle& style) {
978 KConfigGroup styleGroup = fmtgrp.group(style.name());
979 styleGroup.writeEntry(SourceFormatterController::styleCaptionKey(), style.caption());
980 styleGroup.writeEntry(SourceFormatterController::styleShowPreviewKey(), style.usePreview());
981 styleGroup.writeEntry(SourceFormatterController::styleContentKey(), style.content());
982 styleGroup.writeEntry(SourceFormatterController::styleMimeTypesKey(), style.mimeTypesVariant());
983 styleGroup.writeEntry(SourceFormatterController::styleSampleKey(), style.overrideSample());
984 });
985 }
986 globalConfig.sync();
987
988 // Store formatter and style selection for each language.
989 for (const auto& lang : d->languages) {
990 lang.saveSettings(config);
991 }
992}
993
994void SourceFormatterSelectionEdit::selectLanguage(int index)
995{

Callers

nothing calls this directly

Calls 10

globalConfigMethod · 0.80
writeEntryMethod · 0.80
mimeTypesVariantMethod · 0.80
overrideSampleMethod · 0.80
nameMethod · 0.45
captionMethod · 0.45
usePreviewMethod · 0.45
contentMethod · 0.45

Tested by

no test coverage detected