mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-18 17:24:01 -04:00
clipboard: skip the clear confirmation when there is nothing to clear (#3730)
This commit is contained in:
@@ -54,6 +54,7 @@ Item {
|
||||
DActionButton {
|
||||
Keys.forwardTo: [actions.modal.modalFocusScope]
|
||||
iconName: "delete_sweep"
|
||||
enabled: actions.modal.canClear
|
||||
iconColor: Theme.onSecondaryContainer
|
||||
backgroundColor: Theme.secondaryContainer
|
||||
tooltipText: actions.modal.clearsFilteredOnly ? I18n.tr("Clear Filtered", "clipboard modal: clear button tooltip while a search filter is active") : I18n.tr("Clear All")
|
||||
|
||||
@@ -31,6 +31,7 @@ FocusScope {
|
||||
readonly property int selectedIndex: ClipboardService.selectedIndex
|
||||
readonly property bool keyboardNavigationActive: ClipboardService.keyboardNavigationActive
|
||||
readonly property bool clearsFilteredOnly: activeTab === "recents" && ClipboardService.filterActive
|
||||
readonly property bool canClear: clearsFilteredOnly ? unpinnedEntries.length > 0 : ClipboardService.internalEntries.length > pinnedCount
|
||||
readonly property var currentEntry: selectedEntry()
|
||||
|
||||
readonly property var modalFocusScope: root
|
||||
@@ -187,6 +188,8 @@ FocusScope {
|
||||
}, function () {});
|
||||
return;
|
||||
}
|
||||
if (!canClear)
|
||||
return;
|
||||
const hasPinned = pinnedCount > 0;
|
||||
const message = hasPinned ? I18n.tr("This will delete all unpinned entries. %1 pinned entries will be kept.", "clear clipboard history confirmation, %1 is a count").arg(pinnedCount) : I18n.tr("This will permanently delete all clipboard history.");
|
||||
clearConfirmDialog.show(I18n.tr("Clear History?"), message, function () {
|
||||
|
||||
Reference in New Issue
Block a user