1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-19 01:25:21 -04:00

feat(clipboard): add type filters to clipboard history (#2640)

* feat(clipboard): add active filter state

* feat(clipboard): add clipboard filtering logic

* feat(clipboard): wire clipboard filter state to UI

* feat(clipboard): add filter dropdown

* feat(clipboard): move filter dropdown beside search

* refactor(clipboard): update filter defaults

---------

Co-authored-by: purian23 <purian23@gmail.com>
This commit is contained in:
dionjoshualobo
2026-06-18 02:57:45 +05:30
committed by GitHub
parent 29f19b07a9
commit d5ac0c9aa0
9 changed files with 167 additions and 43 deletions
+41 -18
View File
@@ -49,40 +49,59 @@ Item {
property bool alignPopupRight: false
property int dropdownWidth: 200
property bool compactMode: text === "" && description === ""
property bool showTrigger: true
property Item popupAnchorItem: null
property bool addHorizontalPadding: false
property string emptyText: ""
property bool usePopupTransparency: !checkParentDisablesTransparency()
signal valueChanged(string value)
property bool menuOpen: false
function closeDropdownMenu() {
if (!root.menuOpen && !dropdownMenu.opened && !dropdownMenu.visible)
return;
root.menuOpen = false;
dropdownMenu.close();
}
function openDropdownMenu() {
if (dropdownMenu.visible) {
dropdownMenu.close();
return;
}
if (root.options.length === 0)
return;
dropdownMenu.open();
function positionDropdownMenu() {
let currentIndex = root.options.indexOf(root.currentValue);
listView.positionViewAtIndex(currentIndex >= 0 ? currentIndex : 0, ListView.Beginning);
const pos = dropdown.mapToItem(Overlay.overlay, 0, 0);
const anchorItem = root.popupAnchorItem || dropdown;
const pos = anchorItem.mapToItem(Overlay.overlay, 0, 0);
const popupW = dropdownMenu.width;
const popupH = dropdownMenu.height;
const overlayH = Overlay.overlay.height;
const goUp = root.openUpwards || pos.y + dropdown.height + popupH + 4 > overlayH;
dropdownMenu.x = root.alignPopupRight ? pos.x + dropdown.width - popupW : pos.x - (root.popupWidthOffset / 2);
dropdownMenu.y = goUp ? pos.y - popupH - 4 : pos.y + dropdown.height + 4;
const goUp = root.openUpwards || pos.y + anchorItem.height + popupH + 4 > overlayH;
dropdownMenu.x = root.alignPopupRight ? pos.x + anchorItem.width - popupW : pos.x - (root.popupWidthOffset / 2);
dropdownMenu.y = goUp ? pos.y - popupH - 4 : pos.y + anchorItem.height + 4;
}
function showDropdownMenu() {
if (root.options.length === 0)
return;
if (root.menuOpen)
return;
root.menuOpen = true;
dropdownMenu.open();
positionDropdownMenu();
if (root.enableFuzzySearch)
searchField.forceActiveFocus();
}
function openDropdownMenu() {
if (root.menuOpen) {
closeDropdownMenu();
return;
}
showDropdownMenu();
}
function resetSearch() {
searchField.text = "";
dropdownMenu.fzfFinder = null;
@@ -90,11 +109,11 @@ Item {
dropdownMenu.selectedIndex = -1;
}
width: compactMode ? dropdownWidth : parent.width
implicitHeight: compactMode ? 40 : Math.max(60, labelColumn.implicitHeight + Theme.spacingM)
width: !showTrigger ? 0 : (compactMode ? dropdownWidth : parent.width)
implicitHeight: !showTrigger ? 0 : (compactMode ? 40 : Math.max(60, labelColumn.implicitHeight + Theme.spacingM))
Component.onDestruction: {
if (dropdownMenu.visible)
if (root.menuOpen || dropdownMenu.opened || dropdownMenu.visible)
dropdownMenu.close();
}
@@ -107,7 +126,7 @@ Item {
anchors.leftMargin: root.addHorizontalPadding ? Theme.spacingM : 0
anchors.rightMargin: Theme.spacingL
spacing: Theme.spacingXS
visible: !root.compactMode
visible: !root.compactMode && root.showTrigger
StyledText {
text: root.text
@@ -132,6 +151,7 @@ Item {
Rectangle {
id: dropdown
visible: root.showTrigger
width: root.compactMode ? parent.width : (root.popupWidth === -1 ? undefined : (root.popupWidth > 0 ? root.popupWidth : root.dropdownWidth))
height: 40
anchors.right: parent.right
@@ -259,6 +279,7 @@ Item {
}
onOpened: {
root.menuOpen = true;
selectedIndex = -1;
if (searchField.text.length > 0) {
initFinder();
@@ -269,6 +290,8 @@ Item {
}
}
onClosed: root.menuOpen = false
parent: Overlay.overlay
width: root.popupWidth === -1 ? undefined : (root.popupWidth > 0 ? root.popupWidth : (dropdown.width + root.popupWidthOffset))
height: {
+2 -1
View File
@@ -35,6 +35,7 @@ StyledRect {
property color leftIconFocusedColor: Theme.primary
property bool showClearButton: false
property bool showPasswordToggle: false
property real rightAccessoryWidth: 0
property bool passwordVisible: false
property bool usePopupTransparency: !checkParentDisablesTransparency()
property color backgroundColor: usePopupTransparency ? Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) : Theme.surfaceContainerHigh
@@ -46,7 +47,7 @@ StyledRect {
property real cornerRadius: Theme.cornerRadius
readonly property real leftPadding: Theme.spacingM + (leftIconName ? leftIconSize + Theme.spacingM : 0)
readonly property real rightPadding: {
let p = Theme.spacingS;
let p = Theme.spacingS + rightAccessoryWidth;
if (showPasswordToggle)
p += 20 + Theme.spacingXS;
if (showClearButton && text.length > 0)