MCPcopy Create free account
hub / github.com/KDE/kate / FormatPluginView

Method FormatPluginView

addons/format/FormatPlugin.cpp:108–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108FormatPluginView::FormatPluginView(FormatPlugin *plugin, KTextEditor::MainWindow *mainWin)
109 : QObject(plugin)
110 , m_plugin(plugin)
111 , m_mainWindow(mainWin)
112{
113 KXMLGUIClient::setComponentName(QStringLiteral("formatplugin"), i18n("Formatting"));
114
115 connect(m_plugin, &FormatPlugin::configChanged, this, &FormatPluginView::onConfigChanged);
116
117 auto ac = actionCollection();
118 auto a = ac->addAction(QStringLiteral("format_document"), this, &FormatPluginView::format);
119 a->setText(i18n("Format Document"));
120 connect(mainWin, &KTextEditor::MainWindow::viewChanged, this, &FormatPluginView::onActiveViewChanged);
121
122 setXMLFile(QStringLiteral("ui.rc"));
123
124 a = actionCollection()->addAction(QStringLiteral("format_on_save"), this, [this](bool b) {
125 m_plugin->formatOnSave = b;
126 onActiveViewChanged(nullptr);
127 onActiveViewChanged(m_mainWindow->activeView());
128 });
129 a->setText(i18n("Format on Save"));
130 a->setCheckable(true);
131 a->setChecked(formatOnSave());
132 a->setToolTip(i18n("Disable formatting on save without persisting it in settings"));
133
134 m_mainWindow->guiFactory()->addClient(this);
135}
136
137FormatPluginView::~FormatPluginView()
138{

Callers

nothing calls this directly

Calls 2

setTextMethod · 0.80
activeViewMethod · 0.45

Tested by

no test coverage detected