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

KStringHandler::rsqueeze rather than reimplementing it

parent b1335fe7
......@@ -34,6 +34,7 @@
#include <KActionMenu>
#include <KLocalizedString>
#include <KPluginFactory>
#include <KStringHandler>
#include <KXMLGUIFactory>
#include <KTextEditor/Application>
......@@ -539,7 +540,9 @@ KeyboardMacrosPluginView::~KeyboardMacrosPluginView()
void KeyboardMacrosPluginView::addNamedMacro(const QString &name, const Macro &macro)
{
QAction *action;
QString definition = name + QStringLiteral(": ") + macro.toString();
QString label = KStringHandler::rsqueeze(name + QStringLiteral(": ") + macro.toString(), 50)
// avoid unwanted accelerators
.replace(QRegularExpression(QStringLiteral("&(?!&)")), QStringLiteral("&&"));
// add load action
action = actionCollection()->addAction(QStringLiteral("keyboardmacros_named_load_") + name);
......
......@@ -10,6 +10,7 @@
#include <QJsonArray>
#include <QJsonValue>
#include <QList>
#include <QRegularExpression>
#include <QtGlobal>
#include "keycombination.h"
......@@ -50,12 +51,7 @@ public:
str += QStringLiteral(" ") + kc.toString() + QStringLiteral(" ");
}
}
int len = str.size();
str = str.trimmed().replace(QStringLiteral(" "), QStringLiteral(" ")).left(32);
if (len > str.size()) {
str += QStringLiteral("...");
}
return str;
return str.trimmed().replace(QRegularExpression(QStringLiteral("\\s+")), QStringLiteral(" "));
};
};
......
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