1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

feat: Save Pinned Clipboard entries

This commit is contained in:
purian23
2026-01-17 00:52:47 -05:00
parent 7036362b9b
commit 35cbfeb008
8 changed files with 518 additions and 30 deletions

View File

@@ -125,6 +125,33 @@ Item {
}
]
readonly property var maxPinnedOptions: [
{
text: "5",
value: 5
},
{
text: "10",
value: 10
},
{
text: "15",
value: 15
},
{
text: "25",
value: 25
},
{
text: "50",
value: 50
},
{
text: "100",
value: 100
}
]
function getMaxHistoryText(value) {
if (value <= 0)
return "∞";
@@ -152,6 +179,14 @@ Item {
return value + " " + I18n.tr("days");
}
function getMaxPinnedText(value) {
for (let opt of maxPinnedOptions) {
if (opt.value === value)
return opt.text;
}
return value.toString();
}
function loadConfig() {
configLoaded = false;
configError = false;
@@ -295,6 +330,24 @@ Item {
}
}
}
SettingsDropdownRow {
tab: "clipboard"
tags: ["clipboard", "pinned", "max", "limit"]
settingKey: "maxPinned"
text: I18n.tr("Maximum Pinned Entries")
description: I18n.tr("Maximum number of entries that can be saved")
currentValue: root.getMaxPinnedText(root.config.maxPinned ?? 25)
options: root.maxPinnedOptions.map(opt => opt.text)
onValueChanged: value => {
for (let opt of root.maxPinnedOptions) {
if (opt.text === value) {
root.saveConfig("maxPinned", opt.value);
return;
}
}
}
}
}
SettingsCard {