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

Method editStyle

kdevplatform/shell/sourceformatterselectionedit.cpp:1104–1130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1102}
1103
1104void SourceFormatterSelectionEdit::editStyle()
1105{
1106 Q_D(SourceFormatterSelectionEdit);
1107
1108 auto& currentStyle = d->validCurrentStyle();
1109
1110 Q_ASSERT_X(d->currentFormatter().formatter().hasEditStyleWidget(), Q_FUNC_INFO,
1111 "The Edit... button must be disabled if the current style is not editable.");
1112 KDevelop::ScopedDialog<EditStyleDialog> dlg(d->currentFormatter().formatter(),
1113 d->currentLanguage().defaultMimeType(), currentStyle, this);
1114 if (dlg->exec() == QDialog::Rejected) {
1115 return; // nothing changed
1116 }
1117
1118 QString updatedContent = dlg->content();
1119 const bool updatedUsePreview = dlg->usePreview();
1120 if (updatedUsePreview == currentStyle.usePreview() && updatedContent == currentStyle.content()) {
1121 return; // nothing changed
1122 }
1123
1124 currentStyle.setContent(std::move(updatedContent));
1125 currentStyle.setUsePreview(updatedUsePreview);
1126
1127 // Don't call updateStyleButtons(), because editing a style doesn't affect the buttons.
1128 d->updatePreview();
1129 emit changed();
1130}
1131
1132void SourceFormatterSelectionEdit::newStyle()
1133{

Callers

nothing calls this directly

Calls 7

execMethod · 0.80
setUsePreviewMethod · 0.80
updatePreviewMethod · 0.80
hasEditStyleWidgetMethod · 0.45
contentMethod · 0.45
usePreviewMethod · 0.45
setContentMethod · 0.45

Tested by

no test coverage detected