Commit d01808c3 authored by Pablo Rauzy's avatar Pablo Rauzy Committed by Christoph Cullmann
Browse files

avoid moving a macro around if it's just for its description

parent cbf31332
......@@ -358,7 +358,7 @@ bool KeyboardMacrosPlugin::save(const QString &name)
// update GUI:
clearPluginViews();
for (auto &pluginView : m_pluginViews) {
pluginView->addNamedMacro(name, m_macro);
pluginView->addNamedMacro(name, m_macro.toString());
}
// display feedback
displayMessage(i18n("Saved '%1'", name), KTextEditor::Message::Positive);
......@@ -498,7 +498,7 @@ KeyboardMacrosPluginView::KeyboardMacrosPluginView(KeyboardMacrosPlugin *plugin,
// add named macros to our menus
for (const auto &[name, macro] : plugin->m_namedMacros.toStdMap()) {
addNamedMacro(name, macro);
addNamedMacro(name, macro.toString());
}
// update current state if necessary
......@@ -550,10 +550,10 @@ void KeyboardMacrosPluginView::macroLoaded(bool enable)
m_saveAction->setEnabled(enable);
}
void KeyboardMacrosPluginView::addNamedMacro(const QString &name, const Macro &macro)
void KeyboardMacrosPluginView::addNamedMacro(const QString &name, const QString &description)
{
QAction *action;
QString label = KStringHandler::rsqueeze(name + QStringLiteral(": ") + macro.toString(), 50)
QString label = KStringHandler::rsqueeze(name + QStringLiteral(": ") + description, 50)
// avoid unwanted accelerators
.replace(QRegularExpression(QStringLiteral("&(?!&)")), QStringLiteral("&&"));
......
......@@ -122,7 +122,7 @@ public:
void recordingOn();
void recordingOff();
void macroLoaded(bool enable);
void addNamedMacro(const QString &name, const Macro &macro);
void addNamedMacro(const QString &name, const QString &description);
void removeNamedMacro(const QString &name);
// Action slots
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment