diff --git a/plugins/scratchpad/scratchpadview.cpp b/plugins/scratchpad/scratchpadview.cpp --- a/plugins/scratchpad/scratchpadview.cpp +++ b/plugins/scratchpad/scratchpadview.cpp @@ -38,6 +38,7 @@ #include #include #include +#include // Use a delegate because the dataChanged signal doesn't tell us the previous name class FileRenameDelegate @@ -135,6 +136,8 @@ } }); + connect(scratchView, &QAbstractItemView::pressed, this, &ScratchpadView::validateItemActions); + validateItemActions(); } @@ -185,6 +188,7 @@ if (!enable) { commandWidget->clear(); } + commandWidget->setText(currentIndex().data(Scratchpad::RunCommandRole).toString()); } void ScratchpadView::runSelectedScratch() @@ -202,7 +206,6 @@ { validateItemActions(); m_scratchpad->openScratch(proxyModel()->mapToSource(index)); - commandWidget->setText(index.data(Scratchpad::RunCommandRole).toString()); } void ScratchpadView::createScratch()