Commit 27c3298b authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Use QStringList for config instead of Qstring + split

parent 04905df8
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
K_PLUGIN_FACTORY_WITH_JSON(KateKonsolePluginFactory, "katekonsoleplugin.json", registerPlugin<KateKonsolePlugin>();) K_PLUGIN_FACTORY_WITH_JSON(KateKonsolePluginFactory, "katekonsoleplugin.json", registerPlugin<KateKonsolePlugin>();)
static const QStringList s_escapeExceptions{QStringLiteral("vi"), QStringLiteral("vim"), QStringLiteral("nvim")};
KateKonsolePlugin::KateKonsolePlugin(QObject *parent, const QList<QVariant> &) KateKonsolePlugin::KateKonsolePlugin(QObject *parent, const QList<QVariant> &)
: KTextEditor::Plugin(parent) : KTextEditor::Plugin(parent)
{ {
...@@ -474,12 +476,7 @@ void KateConsole::handleEsc(QEvent *e) ...@@ -474,12 +476,7 @@ void KateConsole::handleEsc(QEvent *e)
return; return;
} }
QString exceptString = KConfigGroup(KSharedConfig::openConfig(), "Konsole").readEntry("KonsoleEscKeyExceptions", QStringLiteral("vi,vim,nvim")); QStringList exceptList = KConfigGroup(KSharedConfig::openConfig(), "Konsole").readEntry("KonsoleEscKeyExceptions", s_escapeExceptions);
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
const auto exceptList = exceptString.split(QLatin1Char(','), Qt::SkipEmptyParts);
#else
const auto exceptList = exceptString.split(QLatin1Char(','), QString::SkipEmptyParts);
#endif
if (!m_mw || !m_part || !m_toolView || !e) { if (!m_mw || !m_part || !m_toolView || !e) {
return; return;
...@@ -589,7 +586,7 @@ void KateKonsoleConfigPage::apply() ...@@ -589,7 +586,7 @@ void KateKonsoleConfigPage::apply()
config.writeEntry("RunPrefix", lePrefix->text()); config.writeEntry("RunPrefix", lePrefix->text());
config.writeEntry("SetEditor", cbSetEditor->isChecked()); config.writeEntry("SetEditor", cbSetEditor->isChecked());
config.writeEntry("KonsoleEscKeyBehaviour", cbSetEscHideKonsole->isChecked()); config.writeEntry("KonsoleEscKeyBehaviour", cbSetEscHideKonsole->isChecked());
config.writeEntry("KonsoleEscKeyExceptions", leEscExceptions->text()); config.writeEntry("KonsoleEscKeyExceptions", leEscExceptions->text().split(QLatin1Char(',')));
config.sync(); config.sync();
mPlugin->readConfig(); mPlugin->readConfig();
} }
...@@ -602,7 +599,7 @@ void KateKonsoleConfigPage::reset() ...@@ -602,7 +599,7 @@ void KateKonsoleConfigPage::reset()
lePrefix->setText(config.readEntry("RunPrefix", "")); lePrefix->setText(config.readEntry("RunPrefix", ""));
cbSetEditor->setChecked(config.readEntry("SetEditor", false)); cbSetEditor->setChecked(config.readEntry("SetEditor", false));
cbSetEscHideKonsole->setChecked(config.readEntry("KonsoleEscKeyBehaviour", true)); cbSetEscHideKonsole->setChecked(config.readEntry("KonsoleEscKeyBehaviour", true));
leEscExceptions->setText(config.readEntry("KonsoleEscKeyExceptions", "vi,vim,nvim")); leEscExceptions->setText(config.readEntry("KonsoleEscKeyExceptions", s_escapeExceptions).join(QLatin1Char(',')));
} }
#include "kateconsole.moc" #include "kateconsole.moc"
......
Markdown is supported
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