Use StandardPaths to show the localized xdg folder label.

Requires Qt 5.8 (Plasma 5.12 depends on Qt 5.9). So next dependency must be plasma-5.12.
This commit is contained in:
Chris Holland committed 2018-04-30 12:23:24 -04:00
1 parent b9555888be
commit 88fe59eaae
2 files changed
+19 -2

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@ fi
plasmoidName=$(kreadconfig5 --file="$PWD/package/metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Name")
plasmoidName="${plasmoidName##*.}" # Strip namespace (Eg: "org.kde.plasma.")
plasmoidVersion=$(kreadconfig5 --file="$PWD/package/metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Version")
filenameTag="-plasma5.9"
filenameTag="-plasma5.12"
rm ${plasmoidName}-v*.plasmoid
cd package
filename=${plasmoidName}-v${plasmoidVersion}${filenameTag}.plasmoid
+18 -1
View File
@@ -1,4 +1,5 @@
import QtQuick 2.0
import Qt.labs.platform 1.0 // Qt 5.8+
Repeater {
id: repeater
@@ -8,7 +9,7 @@ Repeater {
delegate: SidebarItem {
icon: symbolicIconName || model.iconName || model.decoration
text: model.name || model.display
text: xdgDisplayName || model.name || model.display
sidebarMenu: repeater.parent.parent // SidebarContextMenu { Column { Repeater{} } }
onClicked: {
repeater.parent.parent.open = false // SidebarContextMenu { Column { Repeater{} } }
@@ -53,6 +54,22 @@ Repeater {
function endsWith(s, sub) {
return s.indexOf(sub) === s.length - sub.length
}
property string xdgDisplayName: {
var xdgFolder = isLocalizedFolder()
if (xdgFolder === 'DOCUMENTS') {
return StandardPaths.displayName(StandardPaths.DocumentsLocation)
} else if (xdgFolder === 'DOWNLOAD') {
return StandardPaths.displayName(StandardPaths.DownloadLocation)
} else if (xdgFolder === 'MUSIC') {
return StandardPaths.displayName(StandardPaths.MusicLocation)
} else if (xdgFolder === 'PICTURES') {
return StandardPaths.displayName(StandardPaths.PicturesLocation)
} else if (xdgFolder === 'VIDEOS') {
return StandardPaths.displayName(StandardPaths.MoviesLocation)
} else {
return ''
}
}
property string symbolicIconName: {
if (model.url) {
var s = model.url.toString()