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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user