From bb74d156c9b9f74837b2d715b8cb1bd1f27cfb98 Mon Sep 17 00:00:00 2001 From: Albert S Date: Thu, 8 Oct 2020 22:50:25 +0200 Subject: [PATCH 1/3] Introduce new button type 'DYNAMIC' for PATH suggestions Fixes #23 --- entryprovider.h | 3 ++- entrypushbutton.cpp | 2 +- window.cpp | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/entryprovider.h b/entryprovider.h index 3a86181..ab98bdc 100644 --- a/entryprovider.h +++ b/entryprovider.h @@ -19,7 +19,8 @@ enum EntryType { USER, INHERIT, - SYSTEM + SYSTEM, + DYNAMIC }; class EntryConfig diff --git a/entrypushbutton.cpp b/entrypushbutton.cpp index c2d29bf..e7fabb1 100644 --- a/entrypushbutton.cpp +++ b/entrypushbutton.cpp @@ -106,7 +106,7 @@ void EntryPushButton::mousePressEvent(QMouseEvent *event) { this->userEntryMenu.exec(QCursor::pos()); } - else + else if(this->config.type == EntryType::SYSTEM) { this->systemEntryMenu.exec(QCursor::pos()); } diff --git a/window.cpp b/window.cpp index bfd07d4..22e685a 100644 --- a/window.cpp +++ b/window.cpp @@ -266,6 +266,7 @@ void Window::addPATHSuggestion(const QString &text) e.row = 0; e.command = suggestions[0]; e.iconPath = suggestions[0]; + e.type = EntryType::DYNAMIC; EntryPushButton *button = createEntryButton(e); clearGrid(); grid->addWidget(button, 0, 0); @@ -343,6 +344,7 @@ void Window::lineEditTextChanged(QString text) } e.command = arguments[0]; e.iconPath = "utilities-terminal"; + e.type = EntryType::DYNAMIC; EntryPushButton *button = createEntryButton(e); clearGrid(); -- 2.46.2 From b13815a92441389d91c846f7d8486304efc73c06 Mon Sep 17 00:00:00 2001 From: Albert S Date: Sat, 10 Oct 2020 22:19:58 +0200 Subject: [PATCH 2/3] executeConfig: Open terminal if Shift pressed --- window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window.cpp b/window.cpp index 22e685a..5cef027 100644 --- a/window.cpp +++ b/window.cpp @@ -120,7 +120,7 @@ void Window::populateGrid(const QVector &list) void Window::executeConfig(const EntryConfig &config) { - if(config.isTerminalCommand) + if(config.isTerminalCommand || QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier)) { QString cmd = settingsProvider->getTerminalCommand(); cmd.replace("%c", config.command); -- 2.46.2 From 2df37212ddacb316dfb33a5efc98b128c48fb086 Mon Sep 17 00:00:00 2001 From: Albert S Date: Sun, 11 Oct 2020 15:38:12 +0200 Subject: [PATCH 3/3] EntryPushButton: Don't allow moving dynamic buttons --- entrypushbutton.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypushbutton.cpp b/entrypushbutton.cpp index e7fabb1..e3c0a32 100644 --- a/entrypushbutton.cpp +++ b/entrypushbutton.cpp @@ -116,7 +116,7 @@ void EntryPushButton::mousePressEvent(QMouseEvent *event) void EntryPushButton::mouseMoveEvent(QMouseEvent *event) { - if(this->config.type == EntryType::SYSTEM) + if(this->config.type == EntryType::SYSTEM || this->config.type == EntryType::DYNAMIC) { return; } -- 2.46.2