Add Delete and Backspace shortcuts to group files

This commit is contained in:
evgeny committed 2026-10-10 00:40:25 +02:00
1 parent 6d8c28f228
commit 043257cabf
2 files changed
+55

No files matched your search

@@ -30,6 +30,7 @@
#include <QClipboard>
#include <QGuiApplication>
#include <QAction>
#include <QShortcut>
#include <QDir>
#include <QTemporaryDir>
#include <QStandardPaths>
@@ -142,6 +143,18 @@ MemberFileBrowser::MemberFileBrowser(DbManager* db, QWidget* parent) : QDialog(p
connect(m_mkdir, &QPushButton::clicked, this, [this]() { mutate(MF_MKDIR); });
connect(m_rename, &QPushButton::clicked, this, [this]() { mutate(MF_RENAME); });
connect(m_remove, &QPushButton::clicked, this, [this]() { mutate(MF_REMOVE_PATH); });
auto* removeShortcut = new QShortcut(QKeySequence(Qt::Key_Delete), m_entries);
removeShortcut->setContext(Qt::WidgetWithChildrenShortcut); removeShortcut->setAutoRepeat(false);
connect(removeShortcut, &QShortcut::activated, this, [this] {
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "file browser: Delete key path=%s enabled=%d", qPrintable(selectedPath()), m_remove->isEnabled());
m_remove->click();
});
auto* upShortcut = new QShortcut(QKeySequence(Qt::Key_Backspace), m_entries);
upShortcut->setContext(Qt::WidgetWithChildrenShortcut); upShortcut->setAutoRepeat(false);
connect(upShortcut, &QShortcut::activated, this, [this, up] {
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "file browser: Backspace key path=%s enabled=%d", qPrintable(m_path), up->isEnabled());
up->click();
});
connect(m_cancel, &QPushButton::clicked, this, &MemberFileBrowser::cancel);
m_entries->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_entries, &QWidget::customContextMenuRequested, this, [this](const QPoint& point) {