From 872c33fe5592eb84a2f6c01a2e47b72602b6139e Mon Sep 17 00:00:00 2001 From: Al12rs Date: Tue, 17 Jul 2018 00:49:41 +0200 Subject: Added new "Hide Uninstalled" and "Delete Uninstalled" options to downloads tab. --- src/downloadlistwidgetcompact.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/downloadlistwidgetcompact.cpp') diff --git a/src/downloadlistwidgetcompact.cpp b/src/downloadlistwidgetcompact.cpp index ad9e0994..34e31006 100644 --- a/src/downloadlistwidgetcompact.cpp +++ b/src/downloadlistwidgetcompact.cpp @@ -292,6 +292,15 @@ void DownloadListWidgetCompactDelegate::issueDeleteCompleted() } } +void DownloadListWidgetCompactDelegate::issueDeleteUninstalled() +{ + if (QMessageBox::question(nullptr, tr("Are you sure?"), + tr("This will remove all uninstalled downloads from this list and from disk."), + QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { + emit removeDownload(-3, true); + } +} + void DownloadListWidgetCompactDelegate::issueRemoveFromViewAll() { if (QMessageBox::question(nullptr, tr("Are you sure?"), @@ -310,6 +319,15 @@ void DownloadListWidgetCompactDelegate::issueRemoveFromViewCompleted() } } +void DownloadListWidgetCompactDelegate::issueRemoveFromViewUninstalled() +{ + if (QMessageBox::question(nullptr, tr("Are you sure?"), + tr("This will permanently remove all uninstalled downloads from this list (but NOT from disk)."), + QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { + emit removeDownload(-3, false); + } +} + bool DownloadListWidgetCompactDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) @@ -359,10 +377,12 @@ bool DownloadListWidgetCompactDelegate::editorEvent(QEvent *event, QAbstractItem menu.addSeparator(); } menu.addAction(tr("Delete Installed..."), this, SLOT(issueDeleteCompleted())); + menu.addAction(tr("Delete Uninstalled..."), this, SLOT(issueDeleteUninstalled())); menu.addAction(tr("Delete All..."), this, SLOT(issueDeleteAll())); if (!hidden) { menu.addSeparator(); menu.addAction(tr("Hide Installed..."), this, SLOT(issueRemoveFromViewCompleted())); + menu.addAction(tr("Hide Uninstalled..."), this, SLOT(issueRemoveFromViewUninstalled())); menu.addAction(tr("Hide All..."), this, SLOT(issueRemoveFromViewAll())); } if (hidden) { -- cgit v1.3.1