feat: Add Backspace as alternative to Delete

* Add backspace as alternative to delete in app/desktop
* Add the same support to WebUI
* Add support for closing delte modal with Escape in WebUI
This commit is contained in:
Stiliyan Tonev (Bark) 2025-06-18 16:02:30 +03:00
parent 794310dca9
commit e5becd2fd0
2 changed files with 20 additions and 0 deletions

View file

@ -231,6 +231,9 @@ TransferListWidget::TransferListWidget(IGUIApplication *app, QWidget *parent)
connect(editHotkey, &QShortcut::activated, this, &TransferListWidget::renameSelectedTorrent);
const auto *deleteHotkey = new QShortcut(Utils::KeySequence::deleteItem(), this, nullptr, nullptr, Qt::WidgetShortcut);
connect(deleteHotkey, &QShortcut::activated, this, &TransferListWidget::softDeleteSelectedTorrents);
// Declare Backspace as alternative for compact keyboards
const auto *deleteHotkeyAlt = new QShortcut(Qt::Key_Backspace, this, nullptr, nullptr, Qt::WidgetShortcut);
connect(deleteHotkeyAlt, &QShortcut::activated, this, &TransferListWidget::softDeleteSelectedTorrents);
const auto *permDeleteHotkey = new QShortcut((Qt::SHIFT | Qt::Key_Delete), this, nullptr, nullptr, Qt::WidgetShortcut);
connect(permDeleteHotkey, &QShortcut::activated, this, &TransferListWidget::permDeleteSelectedTorrents);
const auto *doubleClickHotkeyReturn = new QShortcut(Qt::Key_Return, this, nullptr, nullptr, Qt::WidgetShortcut);

View file

@ -1773,6 +1773,23 @@ window.addEventListener("DOMContentLoaded", (event) => {
event.preventDefault();
deleteSelectedTorrentsFN(event.shiftKey);
break;
case "Backspace":
if ((event.target.nodeName === "INPUT") || (event.target.nodeName === "TEXTAREA"))
return;
if (event.target.isContentEditable)
return;
event.preventDefault();
deleteSelectedTorrentsFN(event.shiftKey);
break;
case "Escape":
if (event.target.isContentEditable)
return;
event.preventDefault();
if (typeof MochaUI.Windows.instances["confirmDeletionPage"] !== "undefined")
MochaUI.Windows.instances["confirmDeletionPage"].close();
break;
}
});