Add option to disable KRunner history

BUG: 376666
FIXED-IN: 5.20
wilder-portage-prov
Alexander Lohnau 6 years ago
parent ddd005b1f5
commit 4a44b30bdf
  1. 12
      krunner/view.cpp
  2. 1
      krunner/view.h
  3. 2
      lookandfeel/contents/runcommand/RunCommand.qml

@ -159,7 +159,11 @@ void View::loadConfig()
{ {
setFreeFloating(m_config.readEntry("FreeFloating", false)); setFreeFloating(m_config.readEntry("FreeFloating", false));
const QStringList history = m_config.readEntry("history", QStringList()); m_historyEnabled = m_config.readEntry("HistoryEnabled", true);
QStringList history;
if (m_historyEnabled) {
history = m_config.readEntry("history", QStringList());
}
if (m_history != history) { if (m_history != history) {
m_history = history; m_history = history;
emit historyChanged(); emit historyChanged();
@ -377,6 +381,9 @@ QStringList View::history() const
void View::addToHistory(const QString &item) void View::addToHistory(const QString &item)
{ {
if (!m_historyEnabled) {
return;
}
if (item.isEmpty()) { if (item.isEmpty()) {
return; return;
} }
@ -425,6 +432,9 @@ void View::removeFromHistory(int index)
void View::writeHistory() void View::writeHistory()
{ {
if (!m_historyEnabled) {
return;
}
m_config.writeEntry("history", m_history); m_config.writeEntry("history", m_history);
} }

@ -106,6 +106,7 @@ private:
bool m_requestedVisible = false; bool m_requestedVisible = false;
QStringList m_history; QStringList m_history;
bool m_retainPriorSearch; bool m_retainPriorSearch;
bool m_historyEnabled;
}; };

@ -190,7 +190,7 @@ ColumnLayout {
colorGroup: PlasmaCore.Theme.ButtonColorGroup colorGroup: PlasmaCore.Theme.ButtonColorGroup
} }
elementId: "down-arrow" elementId: "down-arrow"
visible: queryField.length === 0 visible: queryField.length === 0 && runnerWindow.history.length > 0
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent

Loading…
Cancel
Save