diff --git a/contents/config/config.qml b/contents/config/config.qml new file mode 100644 index 0000000..965cfb1 --- /dev/null +++ b/contents/config/config.qml @@ -0,0 +1,36 @@ +/*************************************************************************** + * Copyright (C) 2013 by Eike Hein * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * + ***************************************************************************/ + +import QtQuick 2.0 + +import org.kde.plasma.configuration 2.0 + +ConfigModel { + ConfigCategory { + name: i18n("General") + icon: "preferences-system-windows" + source: "config/ConfigGeneral.qml" + } + ConfigCategory { + name: i18n("Advanced") + icon: "applications-development" + source: "lib/ConfigAdvanced.qml" + visible: false + } +} diff --git a/contents/config/config.qmlc b/contents/config/config.qmlc new file mode 100644 index 0000000..7fdfd14 Binary files /dev/null and b/contents/config/config.qmlc differ diff --git a/contents/config/main.xml b/contents/config/main.xml new file mode 100644 index 0000000..b21df04 --- /dev/null +++ b/contents/config/main.xml @@ -0,0 +1,113 @@ + + + + + + + + preferred://browser,kontact.desktop,systemsettings.desktop,org.kde.dolphin.desktop,ktp-contactlist.desktop,org.kde.kate.desktop,org.kde.discover + + + 0 + + + 0 + + + false + + + + start-here-kde + + + true + + + true + + + false + + + false + + + + true + + + + xdg:DOCUMENTS,xdg:PICTURES,org.kde.dolphin.desktop,systemsettings.desktop + + + + alphabetical + + + + + + + + + + + + + + 0.8 + + + 5 + + + false + + + + + + + + + + + + + + false + + + false + + + + left + + + + after + + + 36 + + + 50 + + + 350 + + + 6 + + + 620 + + + + + diff --git a/contents/locale/de/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo b/contents/locale/de/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo new file mode 100644 index 0000000..4128709 Binary files /dev/null and b/contents/locale/de/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo differ diff --git a/contents/locale/es/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo b/contents/locale/es/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo new file mode 100644 index 0000000..79356ec Binary files /dev/null and b/contents/locale/es/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo differ diff --git a/contents/locale/fr/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo b/contents/locale/fr/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo new file mode 100644 index 0000000..158049a Binary files /dev/null and b/contents/locale/fr/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo differ diff --git a/contents/locale/nl_NL/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo b/contents/locale/nl_NL/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo new file mode 100644 index 0000000..bd7b25c Binary files /dev/null and b/contents/locale/nl_NL/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo differ diff --git a/contents/locale/pl/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo b/contents/locale/pl/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo new file mode 100644 index 0000000..f15365c Binary files /dev/null and b/contents/locale/pl/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo differ diff --git a/contents/locale/zh_CN/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo b/contents/locale/zh_CN/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo new file mode 100644 index 0000000..441e5f3 Binary files /dev/null and b/contents/locale/zh_CN/LC_MESSAGES/plasma_applet_com.github.zren.tiledmenu.mo differ diff --git a/contents/ui/AppContextMenu.qml b/contents/ui/AppContextMenu.qml new file mode 100644 index 0000000..e1bd29b --- /dev/null +++ b/contents/ui/AppContextMenu.qml @@ -0,0 +1,148 @@ +// Based off kicker's ActionMenu +import QtQuick 2.0 +import org.kde.plasma.components 2.0 as PlasmaComponents + +Item { + id: root + + property QtObject menu + property Item visualParent + property bool opened: menu ? (menu.status != PlasmaComponents.DialogStatus.Closed) : false + property int tileIndex: -1 + + signal closed + signal populateMenu(var menu) + + onOpenedChanged: { + if (!opened) { + closed() + } + } + + onClosed: destroyMenu() + + function open(x, y) { + refreshMenu() + + if (menu.content.length === 0) { + return; + } + + if (x && y) { + menu.open(x, y); + } else { + menu.open(); + } + } + + function destroyMenu() { + if (menu) { + menu.destroy() + // menu = null // Don't null here. Binding loop: onOpended=false => closed() => destroyMenu() => menu=null => opened=false + logger.debug('AppContextMenu.destroyMenu', menu) + } + } + + function refreshMenu() { + destroyMenu() + menu = contextMenuComponent.createObject(root); + populateMenu(menu) + } + + Component { + id: contextMenuComponent + + PlasmaComponents.ContextMenu { + id: contextMenu + visualParent: root.visualParent + + function newSeperator() { + return Qt.createQmlObject("import org.kde.plasma.components 2.0 as PlasmaComponents; PlasmaComponents.MenuItem { separator: true }", contextMenu); + } + function newMenuItem() { + return Qt.createQmlObject("import org.kde.plasma.components 2.0 as PlasmaComponents; PlasmaComponents.MenuItem {}", contextMenu); + } + + function addPinToMenuAction(favoriteId) { + var menuItem = menu.newMenuItem(); + if (tileGrid.hasAppTile(favoriteId)) { + menuItem.text = i18n("Unpin from Menu") + menuItem.icon = "list-remove" + menuItem.clicked.connect(function() { + if (root.tileIndex >= 0) { + tileGrid.removeIndex(root.tileIndex) + } else { + tileGrid.removeApp(favoriteId) + } + }) + } else { + menuItem.text = i18n("Pin to Menu") + menuItem.icon = "bookmark-new" + menuItem.clicked.connect(function() { + tileGrid.addApp(favoriteId) + }) + } + menu.addMenuItem(menuItem) + } + + // // https://github.com/KDE/plasma-desktop/blob/master/applets/taskmanager/package/contents/ui/ContextMenu.qml#L75 + function addActionList(actionList, listModel, index) { + // .desktop file Exec actions + // ------ + // Pin to Taskbar / Desktop / Panel + // ------ + // Recent Documents + // ------ + // ... + // ------ + // Edit Application + actionList.forEach(function(actionItem) { + // console.log(index, actionItem.actionId, actionItem.actionArgument, actionItem.text) + var menuItem = menu.newMenuItem() + menuItem.text = actionItem.text ? actionItem.text : "" + menuItem.enabled = actionItem.type != "title" && ("enabled" in actionItem ? actionItem.enabled : true) + menuItem.separator = actionItem.type == "separator" + menuItem.section = actionItem.type == "title" + menuItem.icon = actionItem.icon ? actionItem.icon : null + menuItem.clicked.connect(function() { + listModel.triggerIndexAction(index, actionItem.actionId, actionItem.actionArgument) + }); + + //--- Overrides + if (actionItem.actionId == 'addToDesktop') { + // Remove (user should just drag it) + menu.removeMenuItem(menuItem) + } else if (actionItem.actionId == 'addToPanel') { + // Remove (user should just drag it) + // User usually means to add it to taskmanager anyways. + menu.removeMenuItem(menuItem) + } else if (actionItem.actionId == 'addToTaskManager') { + menuItem.text = i18n("Pin to Taskbar") + menuItem.icon = "bookmark-new" + } else if (actionItem.actionId == 'editApplication') { + // menuItem.text = i18n("Properties") + } + + }); + } + } + } + + Component { + id: contextMenuItemComponent + + PlasmaComponents.MenuItem { + property variant actionItem + + text: actionItem.text ? actionItem.text : "" + enabled: actionItem.type != "title" && ("enabled" in actionItem ? actionItem.enabled : true) + separator: actionItem.type == "separator" + section: actionItem.type == "title" + icon: actionItem.icon ? actionItem.icon : null + + onClicked: { + actionClicked(actionItem.actionId, actionItem.actionArgument); + } + } + } +} diff --git a/contents/ui/AppContextMenu.qmlc b/contents/ui/AppContextMenu.qmlc new file mode 100644 index 0000000..61b501c Binary files /dev/null and b/contents/ui/AppContextMenu.qmlc differ diff --git a/contents/ui/AppObject.qml b/contents/ui/AppObject.qml new file mode 100644 index 0000000..0116103 --- /dev/null +++ b/contents/ui/AppObject.qml @@ -0,0 +1,50 @@ +import QtQuick 2.0 + +QtObject { + property var tile: null + + readonly property bool isGroup: tile && tile.tileType == "group" + readonly property bool isLauncher: !isGroup + + readonly property color defaultBackgroundColor: isGroup ? "transparent" : config.defaultTileColor + readonly property bool defaultShowIcon: isGroup ? false : true + readonly property int defaultTileW: isGroup ? 6 : 2 + readonly property int defaultTileH: isGroup ? 1 : 2 + + readonly property string favoriteId: tile && tile.url || '' + readonly property var app: favoriteId ? appsModel.tileGridModel.getApp(favoriteId) : null + readonly property string appLabel: app ? app.display : "" + readonly property string appUrl: app ? app.url : "" + readonly property var appIcon: app ? app.decoration : null + readonly property string labelText: tile && tile.label || appLabel || appUrl || "" + readonly property var iconSource: tile && tile.icon || appIcon + readonly property bool iconFill: tile && typeof tile.iconFill !== "undefined" ? tile.iconFill : false + readonly property bool showIcon: tile && typeof tile.showIcon !== "undefined" ? tile.showIcon : defaultShowIcon + readonly property bool showLabel: tile && typeof tile.showLabel !== "undefined" ? tile.showLabel : true + readonly property color backgroundColor: tile && typeof tile.backgroundColor !== "undefined" ? tile.backgroundColor : defaultBackgroundColor + readonly property string backgroundImage: tile && typeof tile.backgroundImage !== "undefined" ? tile.backgroundImage : "" + + readonly property int tileX: tile && typeof tile.x !== "undefined" ? tile.x : 0 + readonly property int tileY: tile && typeof tile.y !== "undefined" ? tile.y : 0 + readonly property int tileW: tile && typeof tile.w !== "undefined" ? tile.w : defaultTileW + readonly property int tileH: tile && typeof tile.h !== "undefined" ? tile.h : defaultTileH + + + // onTileChanged: console.log('onTileChanged', JSON.stringify(tile)) + // onAppLabelChanged: console.log('onAppLabelChanged', appLabel) + + function hasActionList() { + return app ? appsModel.tileGridModel.indexHasActionList(app.indexInModel) : false + } + + function getActionList() { + return app ? appsModel.tileGridModel.getActionListAtIndex(app.indexInModel) : [] + } + + function addActionList(menu) { + if (hasActionList()) { + var actionList = getActionList() + menu.addActionList(actionList, appsModel.tileGridModel, appObj.app.indexInModel) + } + } +} diff --git a/contents/ui/AppObject.qmlc b/contents/ui/AppObject.qmlc new file mode 100644 index 0000000..31f44a8 Binary files /dev/null and b/contents/ui/AppObject.qmlc differ diff --git a/contents/ui/AppToolButton.qml b/contents/ui/AppToolButton.qml new file mode 100644 index 0000000..e98da48 --- /dev/null +++ b/contents/ui/AppToolButton.qml @@ -0,0 +1,84 @@ +import QtQuick 2.0 +import QtQuick.Layouts 1.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate + +MouseArea { + id: control + hoverEnabled: true + + property alias hovered: control.containsMouse + property string iconName: "" + property string text: "" + property string tooltip: "" + + + property font font: theme.defaultFont + property alias iconSource: control.iconName + property real minimumWidth: 0 + property real minimumHeight: 0 + property bool flat: true + + Loader { + id: styleLoader + anchors.fill: parent + asynchronous: true + // source: "AppToolButtonStyle.qml" + source: "HoverOutlineButtonStyle.qml" + property var control: control + + readonly property int paddingTop: item ? item.paddingTop : 0 + readonly property int paddingLeft: item ? item.paddingLeft : 0 + readonly property int paddingRight: item ? item.paddingRight : 0 + readonly property int paddingBottom: item ? item.paddingBottom : 0 + } + + Item { + // id: buttonArea + anchors.fill: parent + anchors.topMargin: styleLoader.paddingTop + anchors.leftMargin: styleLoader.paddingLeft + anchors.rightMargin: styleLoader.paddingRight + anchors.bottomMargin: styleLoader.paddingBottom + + RowLayout { + id: buttonContent + anchors.fill: parent + spacing: units.smallSpacing + + Layout.preferredHeight: Math.max(units.iconSizes.small, label.implicitHeight) + + PlasmaCore.IconItem { + id: icon + source: control.iconName || control.iconSource + + implicitHeight: label.implicitHeight + implicitWidth: implicitHeight + + Layout.minimumWidth: valid ? parent.height: 0 + Layout.maximumWidth: Layout.minimumWidth + visible: valid + Layout.minimumHeight: Layout.minimumWidth + Layout.maximumHeight: Layout.minimumWidth + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + active: control.containsMouse + colorGroup: control.containsMouse ? PlasmaCore.Theme.ButtonColorGroup : PlasmaCore.ColorScope.colorGroup + } + + PlasmaComponents.Label { + id: label + Layout.minimumWidth: implicitWidth + text: QtQuickControlsPrivate.StyleHelpers.stylizeMnemonics(control.text) + font: control.font || theme.defaultFont + visible: control.text != "" + Layout.fillWidth: true + height: parent.height + color: control.containsMouse ? theme.buttonTextColor : PlasmaCore.ColorScope.textColor + horizontalAlignment: icon.valid ? Text.AlignLeft : Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + } + } +} diff --git a/contents/ui/AppToolButton.qmlc b/contents/ui/AppToolButton.qmlc new file mode 100644 index 0000000..07ac187 Binary files /dev/null and b/contents/ui/AppToolButton.qmlc differ diff --git a/contents/ui/AppToolButtonStyle.qml b/contents/ui/AppToolButtonStyle.qml new file mode 100644 index 0000000..a60440e --- /dev/null +++ b/contents/ui/AppToolButtonStyle.qml @@ -0,0 +1,90 @@ +import QtQuick 2.0 +import org.kde.plasma.core 2.0 as PlasmaCore + +Item { + id: style + + property int paddingTop: surfaceNormal.margins.top + property int paddingLeft: surfaceNormal.margins.left + property int paddingRight: surfaceNormal.margins.right + property int paddingBottom: surfaceNormal.margins.bottom + + ButtonShadow { + id: shadow + visible: control.activeFocus + anchors.fill: parent + enabledBorders: surfaceNormal.enabledBorders + state: { + if (control.pressed) { + return "hidden" + } else if (control.containsMouse) { + return "hover" + } else if (control.activeFocus) { + return "focus" + } else { + return "shadow" + } + } + } + PlasmaCore.FrameSvgItem { + id: surfaceNormal + anchors.fill: parent + imagePath: "widgets/button" + prefix: "normal" + enabledBorders: "AllBorders" + } + PlasmaCore.FrameSvgItem { + id: surfacePressed + anchors.fill: parent + imagePath: "widgets/button" + prefix: "pressed" + enabledBorders: surfaceNormal.enabledBorders + opacity: 0 + } + + state: (control.pressed || control.checked ? "pressed" : (control.containsMouse ? "hover" : "normal")) + + states: [ + State { name: "normal" + PropertyChanges { + target: surfaceNormal + opacity: 0 + } + PropertyChanges { + target: surfacePressed + opacity: 0 + } + }, + State { name: "hover" + PropertyChanges { + target: surfaceNormal + opacity: 1 + } + PropertyChanges { + target: surfacePressed + opacity: 0 + } + }, + State { name: "pressed" + PropertyChanges { + target: surfaceNormal + opacity: 0 + } + PropertyChanges { + target: surfacePressed + opacity: 1 + } + } + ] + + transitions: [ + Transition { + //Cross fade from pressed to normal + ParallelAnimation { + NumberAnimation { target: surfaceNormal; property: "opacity"; duration: 100 } + NumberAnimation { target: surfacePressed; property: "opacity"; duration: 100 } + } + } + ] + +} diff --git a/contents/ui/AppletConfig.qml b/contents/ui/AppletConfig.qml new file mode 100644 index 0000000..dabbfa7 --- /dev/null +++ b/contents/ui/AppletConfig.qml @@ -0,0 +1,137 @@ +import QtQuick 2.0 +import QtQuick.Window 2.2 + +Item { + function setAlpha(c, a) { + var c2 = Qt.darker(c, 1) + c2.a = a + return c2 + } + + //--- Sizes + readonly property int panelIconSize: 24 * units.devicePixelRatio + readonly property int flatButtonSize: 60 * units.devicePixelRatio + readonly property int flatButtonIconSize: 30 * units.devicePixelRatio + readonly property int sidebarWidth: flatButtonSize + readonly property int sidebarOpenWidth: 200 * units.devicePixelRatio + readonly property int appListWidth: plasmoid.configuration.appListWidth * units.devicePixelRatio + readonly property int leftSectionWidth: sidebarWidth + appListWidth + + readonly property real tileScale: plasmoid.configuration.tileScale + readonly property int cellBoxUnits: 80 + readonly property int cellMarginUnits: plasmoid.configuration.tileMargin + readonly property int cellSizeUnits: cellBoxUnits - cellMarginUnits*2 + readonly property int cellSize: cellSizeUnits * tileScale * units.devicePixelRatio + readonly property real cellMargin: cellMarginUnits * tileScale * units.devicePixelRatio + readonly property real cellPushedMargin: cellMargin * 2 + readonly property int cellBoxSize: cellMargin + cellSize + cellMargin + readonly property int tileGridWidth: plasmoid.configuration.favGridCols * cellBoxSize + + readonly property int favCellWidth: 60 * units.devicePixelRatio + readonly property int favCellPushedMargin: 5 * units.devicePixelRatio + readonly property int favCellPadding: 3 * units.devicePixelRatio + readonly property int favColWidth: ((favCellWidth + favCellPadding * 2) * 2) // = 132 (Medium Size) + readonly property int favViewDefaultWidth: (favColWidth * 3) * units.devicePixelRatio + readonly property int favSmallIconSize: 32 * units.devicePixelRatio + readonly property int favMediumIconSize: 72 * units.devicePixelRatio + readonly property int favGridWidth: (plasmoid.configuration.favGridCols/2) * favColWidth + + readonly property int searchFieldHeight: plasmoid.configuration.searchFieldHeight * units.devicePixelRatio + + readonly property int popupWidth: { + if (plasmoid.configuration.fullscreen) { + return Screen.desktopAvailableWidth + } else { + return leftSectionWidth + tileGridWidth + } + } + readonly property int popupHeight: { + if (plasmoid.configuration.fullscreen) { + return Screen.desktopAvailableHeight + } else { + return plasmoid.configuration.popupHeight * units.devicePixelRatio + } + } + + readonly property int menuItemHeight: plasmoid.configuration.menuItemHeight * units.devicePixelRatio + + readonly property int searchFilterRowHeight: { + if (plasmoid.configuration.appListWidth >= 310) { + return flatButtonSize // 60px + } else if (plasmoid.configuration.appListWidth >= 250) { + return flatButtonSize*3/4 // 45px + } else { + return flatButtonSize/2 // 30px + } + } + + //--- Colors + readonly property color defaultTileColor: plasmoid.configuration.defaultTileColor || theme.buttonBackgroundColor + readonly property color sidebarBackgroundColor: plasmoid.configuration.sidebarBackgroundColor || theme.backgroundColor + readonly property color menuItemTextColor2: setAlpha(theme.textColor, 0.6) + readonly property color favHoverOutlineColor: setAlpha(theme.textColor, 0.8) + + //--- Style + // Tiles + readonly property int tileLabelAlignment: { + var val = plasmoid.configuration.tileLabelAlignment + if (val === 'center') { + return Text.AlignHCenter + } else if (val === 'right') { + return Text.AlignRight + } else { // left + return Text.AlignLeft + } + } + // App Description Enum (hidden, after, below) + readonly property bool appDescriptionVisible: plasmoid.configuration.appDescription !== 'hidden' + readonly property bool appDescriptionBelow: plasmoid.configuration.appDescription == 'below' + + //--- Settings + // Search + readonly property bool searchResultsMerged: plasmoid.configuration.searchResultsMerged + readonly property bool searchResultsCustomSort: plasmoid.configuration.searchResultsCustomSort + readonly property int searchResultsDirection: plasmoid.configuration.searchResultsReversed ? ListView.BottomToTop : ListView.TopToBottom + + //--- Tile Data + property var tileData: Base64JsonString { + configKey: 'tileData' + } + + property var tileModel: Base64JsonString { + configKey: 'tileModel' + defaultValue: [] + + onLoaded: { + // Only load on change at start. + // Otherwise .save() will create a new [] breaking the tile editor. + loadOnConfigChange = false + } + + // defaultValue: [ + // { + // "x": 0, + // "y": 0, + // "w": 2, + // "h": 2, + // "url": "org.kde.dolphin.desktop", + // "label": "Files", + // }, + // { + // "x": 2, + // "y": 1, + // "w": 1, + // "h": 1, + // "url": "virtualbox.desktop", + // "iconFill": true, + // }, + // { + // "x": 2, + // "y": 0, + // "w": 1, + // "h": 1, + // "url": "org.kde.ark.desktop", + // }, + // ] + } +} diff --git a/contents/ui/AppletConfig.qmlc b/contents/ui/AppletConfig.qmlc new file mode 100644 index 0000000..9226363 Binary files /dev/null and b/contents/ui/AppletConfig.qmlc differ diff --git a/contents/ui/AppsModel.qml b/contents/ui/AppsModel.qml new file mode 100644 index 0000000..bb79e45 --- /dev/null +++ b/contents/ui/AppsModel.qml @@ -0,0 +1,499 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +import org.kde.plasma.private.kicker 0.1 as Kicker + +Item { + id: appsModel + property alias rootModel: rootModel + property alias allAppsModel: allAppsModel + property alias powerActionsModel: powerActionsModel + property alias favoritesModel: favoritesModel + property alias tileGridModel: tileGridModel + property alias sidebarModel: sidebarModel + + property string order: plasmoid.configuration.defaultAppListOrder + onOrderChanged: allAppsModel.refresh() + + signal refreshing() + signal refreshed() + + Timer { + id: rootModelRefresh + interval: 400 + onTriggered: { + logger.debug('rootModel.refresh.star', Date.now()) + rootModel.refresh() + logger.debug('rootModel.refresh.done', Date.now()) + } + } + + Kicker.RootModel { + id: rootModel + appNameFormat: 0 // plasmoid.configuration.appNameFormat + flat: true // isDash ? true : plasmoid.configuration.limitDepth + showSeparators: false // !isDash + appletInterface: plasmoid + + // showAllSubtree: true //isDash (KDE 5.8 and below) + showAllApps: true //isDash (KDE 5.9+) + showRecentApps: true //plasmoid.configuration.showRecentApps + showRecentDocs: false //plasmoid.configuration.showRecentDocs + showRecentContacts: false //plasmoid.configuration.showRecentContacts + + autoPopulate: false // (KDE 5.9+) defaulted to true + // paginate: false // (KDE 5.9+) + + Component.onCompleted: { + if (!autoPopulate) { + rootModelRefresh.restart() + // console.log('rootModel.refresh.star', Date.now()) + // rootModel.refresh() + // console.log('rootModel.refresh.done', Date.now()) + } + } + + + function log() { + // logListModel('rootModel', rootModel); + var listModel = rootModel; + for (var i = 0; i < listModel.count; i++) { + var item = listModel.modelForRow(i); + // console.log(listModel, i, item); + logObj('rootModel[' + i + ']', item) + // logListModel('rootModel[' + i + ']', item); + } + } + + onCountChanged: { + // for (var i = 0; i < rootModel.count; i++) { + // var listModel = rootModel.modelForRow(i); + // if (listModel.description == 'KICKER_ALL_MODEL') { + // logObj('rootModel[' + i + ']', listModel) + // appsModel.allAppsList = listModel; + // appsModel.refreshed() + // } + // } + debouncedRefresh.restart() + } + + onRefreshed: { + //--- Power + var systemModel = rootModel.modelForRow(rootModel.count - 1) + var systemList = [] + if (systemModel) { + powerActionsModel.parseModel(systemList, systemModel) + } else { + console.log('systemModel is null') + } + powerActionsModel.list = systemList + sessionActionsModel.parseSourceModel(powerActionsModel) + + debouncedRefresh.restart() + } + + // KickerAppModel is a wrapper of Kicker.FavoritesModel + // Kicker.FavoritesModel must be a child object of RootModel. + // appEntry.actions() looks at the parent object for parent.appletInterface and will crash plasma if it can't find it. + // https://github.com/KDE/plasma-desktop/blob/master/applets/kicker/plugin/appentry.cpp#L151 + favoritesModel: KickerAppModel { + id: favoritesModel + + Component.onCompleted: { + // favorites = 'systemsettings.desktop,sublime-text.desktop,clementine.desktop,hexchat.desktop,virtualbox.desktop'.split(',') + favorites = plasmoid.configuration.favoriteApps + } + + onFavoritesChanged: { + plasmoid.configuration.favoriteApps = favorites + } + } + + property var tileGridModel: KickerAppModel { + id: tileGridModel + } + + property var sidebarModel: KickerAppModel { + id: sidebarModel + + Component.onCompleted: { + favorites = plasmoid.configuration.sidebarShortcuts + } + + onFavoritesChanged: { + plasmoid.configuration.sidebarShortcuts = favorites + } + + property Connections configConnection: Connections { + target: plasmoid.configuration + onSidebarShortcutsChanged: sidebarModel.favorites = plasmoid.configuration.sidebarShortcuts + } + } + + property var openModel: Kicker.FavoritesModel { + id: openModel + + onFavoritesChanged: { + if (count > 0) { + openModel.trigger(0, "", null) + } + } + } + } + + Connections { + target: plasmoid.configuration + + onFavoriteAppsChanged: { + if (favoritesModel.favorites != plasmoid.configuration.favoriteApps) { + favoritesModel.favorites = plasmoid.configuration.favoriteApps + } + } + } + + Item { + //--- Detect Changes + // Changes aren't bubbled up to the RootModel, so we need to detect changes somehow. + + // Recent Apps + Repeater { + model: rootModel.count >= 0 ? rootModel.modelForRow(0) : [] + + Item { + Component.onCompleted: { + // console.log('debouncedRefreshRecentApps', index) + if (plasmoid.configuration.showRecentApps) { + debouncedRefreshRecentApps.restart() + } + } + } + } + + // All Apps + Repeater { // A-Z + model: rootModel.count >= 2 ? rootModel.modelForRow(1) : [] + + Item { + property var parentModel: rootModel.modelForRow(1).modelForRow(index) + + Repeater { // Aaa ... Azz (Apps) + model: parentModel.hasChildren ? parentModel : [] + + Item { + Component.onCompleted: { + // console.log('depth2', index, display, model) + debouncedRefresh.restart() + } + } + } + + // Component.onCompleted: { + // console.log('depth1', index, display, model) + // } + } + } + + Timer { + id: debouncedRefresh + interval: 100 + onTriggered: allAppsModel.refresh() + } + + Timer { + id: debouncedRefreshRecentApps + interval: debouncedRefresh.interval + onTriggered: allAppsModel.refreshRecentApps() + } + + Connections { + target: plasmoid.configuration + onShowRecentAppsChanged: debouncedRefresh.restart() + } + } + + KickerListModel { + id: powerActionsModel + onItemTriggered: { + // console.log('powerActionsModel.onItemTriggered') + plasmoid.expanded = false + } + + function nameByIconName(iconName) { + var item = getByValue('iconName', iconName) + if (item) { + return item.name + } else { + return iconName + } + } + + function triggerByIconName(iconName) { + var item = getByValue('iconName', iconName) + item.parentModel.trigger(item.indexInParent, "", null) + } + } + + // powerActionsModel filtered to logout/lock/switch user + property alias sessionActionsModel: sessionActionsModel + KickerListModel { + id: sessionActionsModel + onItemTriggered: { + // console.log('sessionActionsModel.onItemTriggered') + plasmoid.expanded = false + } + + function parseSourceModel(powerActionsModel) { + // Filter by iconName + var sessionActionsList = [] + var sessionIconNames = ['system-lock-screen', 'system-log-out', 'system-save-session', 'system-switch-user'] + for (var i = 0; i < powerActionsModel.list.length; i++) { + var item = powerActionsModel.list[i]; + // console.log(item, item.iconName, sessionIconNames.indexOf(item.iconName) >= 0) + if (sessionIconNames.indexOf(item.iconName) >= 0) { + sessionActionsList.push(item) + } + } + sessionActionsModel.list = sessionActionsList + } + } + + KickerListModel { + id: allAppsModel + onItemTriggered: { + // console.log('allAppsModel.onItemTriggered') + plasmoid.expanded = false + } + + function getRecentApps() { + var recentAppList = []; + + //--- populate + var model = rootModel.modelForRow(0) + if (model) { + parseModel(recentAppList, model) + } else { + console.log('getRecentApps() recent apps model is null') + } + + //--- filter + recentAppList = recentAppList.filter(function(item){ + //--- filter kcmshell5 applications since they show up blank (undefined) + if (typeof item.name === 'undefined') { + return false; + } else { + return true; + } + }); + + //--- first 5 items + recentAppList = recentAppList.slice(0, 5); + + //--- section + for (var i = 0; i < recentAppList.length; i++) { + var item = recentAppList[i]; + item.sectionKey = i18n('Recent Apps'); + } + + return recentAppList; + } + + function refreshRecentApps() { + // console.log('refreshRecentApps') + if (debouncedRefresh.running) { + // We're about to do a full refresh so don't bother doing a partial update. + return + } + var recentAppList = getRecentApps(); + var recentAppCount = 5 + if (recentAppCount == recentAppList.length) { + // Do a partial update since we're only updating properties. + refreshing() + + // Overwrite the exisiting items. + for (var i = 0; i < recentAppList.length; i++) { + var item = recentAppList[i] + list[i] = item + set(i, item) + } + + refreshed() + } else { + // We'll be removing items, so just replace the entire list. + refresh() + } + } + + property int categoryStartIndex: 2 // Skip Recent Apps, All Apps + property int categoryEndIndex: rootModel.count - 1 // Skip Power + + function getCategory(rootIndex) { + var modelIndex = rootModel.index(rootIndex, 0) + var categoryLabel = rootModel.data(modelIndex, Qt.DisplayRole) + var categoryModel = rootModel.modelForRow(rootIndex) + var appList = [] + if (categoryModel) { + parseModel(appList, categoryModel) + } else { + console.log('allAppsModel.getCategory', rootIndex, categoryModel, 'is null') + } + + for (var i = 0; i < appList.length; i++) { + var item = appList[i]; + item.sectionKey = categoryLabel + } + return appList + } + function getAllCategories() { + var appList = []; + for (var i = categoryStartIndex; i < categoryEndIndex; i++) { // Skip Recent Apps, All Apps, ... and Power + // for (var i = 0; i < rootModel.count; i++) { + appList = appList.concat(getCategory(i)) + } + return appList + } + + function getAllApps() { + //--- populate list + var appList = []; + var model = rootModel.modelForRow(1) + if (model) { + parseModel(appList, model) + } else { + console.log('getAllApps() all apps model is null') + } + + //--- filter + // var powerActionsList = []; + // var sceneUrls = []; + // appList = appList.filter(function(item){ + // //--- filter multiples + // if (item.url) { + // if (sceneUrls.indexOf(item.url) >= 0) { + // return false; + // } else { + // sceneUrls.push(item.url); + // return true; + // } + // } else { + // return true; + // //--- filter + // // if (item.parentModel.toString().indexOf('SystemModel') >= 0) { + // // // console.log(item.description, 'removed'); + // // powerActionsList.push(item); + // // return false; + // // } else { + // // return true; + // // } + // } + // }); + // powerActionsModel.list = powerActionsList; + + //--- + for (var i = 0; i < appList.length; i++) { + var item = appList[i]; + if (item.name) { + var firstCharCode = item.name.charCodeAt(0); + if (48 <= firstCharCode && firstCharCode <= 57) { // isDigit + item.sectionKey = '0-9'; + } else { + item.sectionKey = item.name.charAt(0).toUpperCase(); + } + } else { + item.sectionKey = '?'; + } + // console.log(item.sectionKey, item.name) + } + + //--- sort + appList = appList.sort(function(a,b) { + if (a.name && b.name) { + return a.name.toLowerCase().localeCompare(b.name.toLowerCase()); + } else { + // console.log(a, b); + return 0; + } + }) + + + return appList + } + + function refresh() { + refreshing() + logger.debug("allAppsModel.refresh().star", Date.now()) + + //--- Apps + var appList = [] + if (appsModel.order == "categories") { + appList = getAllCategories() + } else { + appList = getAllApps() + } + + //--- Recent Apps + if (plasmoid.configuration.showRecentApps) { + var recentAppList = getRecentApps(); + appList = recentAppList.concat(appList); // prepend + } + + //--- Power + // var systemModel = rootModel.modelForRow(rootModel.count - 1) + // var systemList = [] + // parseModel(systemList, systemModel) + // powerActionsModel.list = systemList; + + //--- apply model + allAppsModel.list = appList; + // allAppsModel.log(); + + //--- listen for changes + // for (var i = 0; i < runnerModel.count; i++){ + // var runner = runnerModel.modelForRow(i); + // if (!runner.listenersBound) { + // runner.countChanged.connect(debouncedRefresh.logAndRestart) + // runner.dataChanged.connect(debouncedRefresh.logAndRestart) + // runner.listenersBound = true; + // } + // } + + logger.debug("allAppsModel.refresh().done", Date.now()) + refreshed() + } + } + + function endsWith(s, substr) { + return s.indexOf(substr) == s.length - substr.length + } + + function launch(launcherName) { + for (var i = 0; i < allAppsModel.count; i++) { + var item = allAppsModel.get(i); + if (item.url && endsWith(item.url, '/' + launcherName + '.desktop')) { + item.parentModel.trigger(item.indexInParent, "", null); + break; + } + } + } + + function open(filepath) { + if (filepath.indexOf('~/') == 0) { + if (kuser.loginName) { + filepath = '/home/' + kuser.loginName + filepath.substr(1) + } else { + console.log('kuser.loginName', kuser.loginName, 'is empty and can\'t be used to expand the ~ tilde to open a home path.') + // Can't open the right filepath + return + } + } + if (filepath.indexOf('file://') != 0) { + filepath = 'file://' + filepath + } + // console.log('open', filepath) + openModel.favorites = [filepath] + } +} \ No newline at end of file diff --git a/contents/ui/AppsModel.qmlc b/contents/ui/AppsModel.qmlc new file mode 100644 index 0000000..e05d961 Binary files /dev/null and b/contents/ui/AppsModel.qmlc differ diff --git a/contents/ui/AppsView.qml b/contents/ui/AppsView.qml new file mode 100644 index 0000000..42da5cf --- /dev/null +++ b/contents/ui/AppsView.qml @@ -0,0 +1,33 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +ScrollView { + id: appsView + property alias listView: appsListView + + KickerListView { + id: appsListView + + section.property: 'sectionKey' + // section.criteria: ViewSection.FirstCharacter + + model: appsModel.allAppsModel // Should be populated by the time this is created + + delegate: MenuListItem { + secondRowVisible: config.appDescriptionBelow + description: config.appDescriptionVisible ? modelDescription : '' + } + + iconSize: config.menuItemHeight + showItemUrl: false + } + + function scrollToTop() { + appsListView.positionViewAtBeginning() + } +} diff --git a/contents/ui/AppsView.qmlc b/contents/ui/AppsView.qmlc new file mode 100644 index 0000000..01d5a13 Binary files /dev/null and b/contents/ui/AppsView.qmlc differ diff --git a/contents/ui/Base64JsonString.qml b/contents/ui/Base64JsonString.qml new file mode 100644 index 0000000..08514ed --- /dev/null +++ b/contents/ui/Base64JsonString.qml @@ -0,0 +1,75 @@ +import QtQuick 2.0 + +QtObject { + property string configKey + property string configValue: plasmoid.configuration[configKey] + property variant value: { return {} } + property variant defaultValue: { return {} } + property bool writing: false + property bool loadOnConfigChange: true + signal loaded() + + Component.onCompleted: { + load() + } + + onConfigValueChanged: { + if (loadOnConfigChange) { + load() + } + } + + function getBase64Json(key, defaultValue) { + var val = plasmoid.configuration[key] + if (val === '') { + return defaultValue + } + val = Qt.atob(val) // decode base64 + val = JSON.parse(val) + return val + } + + function setBase64Json(key, data) { + var val = JSON.stringify(data) + val = Qt.btoa(val) + plasmoid.configuration[key] = val + } + + function set(obj) { + writing = true + setBase64Json(configKey, obj) + writing = false + } + + function setItemProperty(key1, key2, val) { + var item = value[key1] || {} + item[key2] = val + value[key1] = item + set(value) + valueChanged() + } + + function getItemProperty(key1, key2, def) { + var item = value[key1] || {} + return typeof item[key2] !== "undefined" ? item[key2] : def + } + + function load() { + // console.log('load') + // console.log('configKey', configKey) + // console.log('plasmoid.configuration[key]', plasmoid.configuration[configKey]) + value = getBase64Json(configKey, defaultValue) + loaded() + } + + function save() { + // console.log('save') + // console.log('configKey', configKey) + // console.log('plasmoid.configuration[key]', plasmoid.configuration[configKey]) + setBase64Json(configKey, value || defaultValue) + } + + onValueChanged: { + // console.log('onValueChanged', configKey, value) + } +} diff --git a/contents/ui/Base64JsonString.qmlc b/contents/ui/Base64JsonString.qmlc new file mode 100644 index 0000000..89b2676 Binary files /dev/null and b/contents/ui/Base64JsonString.qmlc differ diff --git a/contents/ui/ButtonShadow.qml b/contents/ui/ButtonShadow.qml new file mode 100644 index 0000000..19c9937 --- /dev/null +++ b/contents/ui/ButtonShadow.qml @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2011 by Daker Fernandes Pinheiro + * Copyright (C) 2011 by Marco Martin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. + */ + +/**Documented API +Inherits: + Item + +Imports: + QtQuick 2.1 + org.kde.plasma.core + +Description: +TODO i need more info here + + +Properties: +**/ + +import QtQuick 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore + +Item { + id: main + state: parent.state + //used to tell apart this implementation with the touch components one + property bool hasOverState: true + property alias enabledBorders: shadow.enabledBorders + + PlasmaCore.FrameSvgItem { + id: hover + + anchors { + fill: parent + leftMargin: -margins.left + topMargin: -margins.top + rightMargin: -margins.right + bottomMargin: -margins.bottom + } + opacity: 0 + imagePath: "widgets/button" + prefix: "hover" + } + + PlasmaCore.FrameSvgItem { + id: shadow + + anchors { + fill: parent + leftMargin: -margins.left + topMargin: -margins.top + rightMargin: -margins.right + bottomMargin: -margins.bottom + } + imagePath: "widgets/button" + prefix: "shadow" + } + + states: [ + State { + name: "shadow" + PropertyChanges { + target: shadow + opacity: 1 + } + PropertyChanges { + target: hover + opacity: 0 + prefix: "hover" + } + }, + State { + name: "hover" + PropertyChanges { + target: shadow + opacity: 0 + } + PropertyChanges { + target: hover + opacity: 1 + prefix: "hover" + } + }, + State { + name: "focus" + PropertyChanges { + target: shadow + opacity: 0 + } + PropertyChanges { + target: hover + opacity: 1 + prefix: "focus" + } + }, + State { + name: "hidden" + PropertyChanges { + target: shadow + opacity: 0 + } + PropertyChanges { + target: hover + opacity: 0 + prefix: "hover" + } + } + ] + + transitions: [ + Transition { + PropertyAnimation { + properties: "opacity" + duration: units.longDuration + easing.type: Easing.OutQuad + } + } + ] +} diff --git a/contents/ui/FlatButton.qml b/contents/ui/FlatButton.qml new file mode 100644 index 0000000..c9b47d1 --- /dev/null +++ b/contents/ui/FlatButton.qml @@ -0,0 +1,153 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate +import QtQuick.Controls.Styles.Plasma 2.0 as PlasmaStyles + +PlasmaComponents.ToolButton { + id: flatButton + width: parent.width + height: config.flatButtonSize + property var icon: null + iconName: "" + property bool expanded: true + text: "" + property string label: expanded ? text : "" + property bool labelVisible: text != "" + property color backgroundColor: Qt.rgba(theme.buttonBackgroundColor.r, theme.buttonBackgroundColor.g, theme.buttonBackgroundColor.b, 0) + property bool zoomOnPush: true + + // http://doc.qt.io/qt-5/qt.html#Edge-enum + property int checkedEdge: 0 // 0 = all edges + property int checkedEdgeWidth: 2 * units.devicePixelRatio + + style: PlasmaStyles.ToolButtonStyle { + label: RowLayout { + spacing: units.smallSpacing + scale: control.zoomOnPush && control.pressed ? (height-5) / height : 1 + Behavior on scale { NumberAnimation { duration: 200 } } + + Item { + Layout.fillHeight: true + Layout.preferredWidth: height + visible: !!icon.source + + PlasmaCore.IconItem { + id: icon + source: control.iconName || control.iconSource || control.icon + width: config.flatButtonIconSize + height: config.flatButtonIconSize + anchors.centerIn: parent + // colorGroup: PlasmaCore.Theme.ButtonColorGroup + } + } + + PlasmaComponents.Label { + id: label + text: QtQuickControlsPrivate.StyleHelpers.stylizeMnemonics(control.text) + font: control.font || theme.defaultFont + visible: control.labelVisible + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + Layout.fillWidth: true + } + } + + background: Item { + Rectangle { + id: background + anchors.fill: parent + color: flatButton.backgroundColor + } + + Rectangle { + id: checkedOutline + color: theme.highlightColor + visible: control.checked + anchors.left: parent.left + anchors.top: parent.top + anchors.right: parent.right + anchors.bottom: parent.bottom + + states: [ + State { + when: control.checkedEdge === 0 + PropertyChanges { + target: checkedOutline + anchors.fill: checkedOutline.parent + color: "transparent" + border.color: theme.highlightColor + } + }, + State { + when: control.checkedEdge == Qt.TopEdge + PropertyChanges { + target: checkedOutline + anchors.bottom: undefined + height: control.checkedEdgeWidth + } + }, + State { + when: control.checkedEdge == Qt.LeftEdge + PropertyChanges { + target: checkedOutline + anchors.right: undefined + width: control.checkedEdgeWidth + } + }, + State { + when: control.checkedEdge == Qt.RightEdge + PropertyChanges { + target: checkedOutline + anchors.left: undefined + width: control.checkedEdgeWidth + } + }, + State { + when: control.checkedEdge == Qt.BottomEdge + PropertyChanges { + target: checkedOutline + anchors.top: undefined + height: control.checkedEdgeWidth + } + } + ] + } + + states: [ + State { + name: "hovering" + when: !control.pressed && control.hovered + PropertyChanges { + target: background + color: theme.buttonBackgroundColor + } + }, + State { + name: "pressed" + when: control.pressed + PropertyChanges { + target: background + color: theme.highlightColor + } + } + ] + + transitions: [ + Transition { + to: "hovering" + ColorAnimation { duration: 200 } + }, + Transition { + to: "pressed" + ColorAnimation { duration: 100 } + } + ] + } + } +} \ No newline at end of file diff --git a/contents/ui/FlatButton.qmlc b/contents/ui/FlatButton.qmlc new file mode 100644 index 0000000..c0d5180 Binary files /dev/null and b/contents/ui/FlatButton.qmlc differ diff --git a/contents/ui/Hierarchy.md b/contents/ui/Hierarchy.md new file mode 100644 index 0000000..769cec0 --- /dev/null +++ b/contents/ui/Hierarchy.md @@ -0,0 +1,36 @@ +Main + SearchModel + SearchResultsModel + LauncherIcon + Popup + SearchView + SidebarView + SearchResultsView + SearchResultsList + SearchField + TileGrid + + +krunner_id (filename) + +org.kde.activities (activityrunner) +Audio Player Control Runner (audioplayercontrol) +baloosearch (baloosearch) +bookmarks (bookmarks) +calculator (calculator) +unitconverter (converter) +org.kde.datetime (datetime) +Dictionary (dictionary) +Kill Runner (kill) +kwin (kwin) +locations (locations) +places (places) +Name=plasma-desktop (plasma) +PowerDevil (powerdevil) +services (services) +desktopsessions (sessions) +shell (shell) +Spell Checker (spellchecker) +webshortcuts (webshortcuts) +org.kde.windowedwidgets (windowedwidgets) +windows (windows) diff --git a/contents/ui/HoverOutlineButtonEffect.qml b/contents/ui/HoverOutlineButtonEffect.qml new file mode 100644 index 0000000..6dba73f --- /dev/null +++ b/contents/ui/HoverOutlineButtonEffect.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +HoverOutlineEffect { + id: hoverOutlineButtonEffect + anchors.fill: parent + hoverRadius: width/2 + pressedRadius: width +} diff --git a/contents/ui/HoverOutlineButtonEffect.qmlc b/contents/ui/HoverOutlineButtonEffect.qmlc new file mode 100644 index 0000000..996027b Binary files /dev/null and b/contents/ui/HoverOutlineButtonEffect.qmlc differ diff --git a/contents/ui/HoverOutlineButtonStyle.qml b/contents/ui/HoverOutlineButtonStyle.qml new file mode 100644 index 0000000..cdb5423 --- /dev/null +++ b/contents/ui/HoverOutlineButtonStyle.qml @@ -0,0 +1,18 @@ +import QtQuick 2.0 + +Item { + id: style + property int paddingTop: 0 + property int paddingRight: 0 + property int paddingBottom: 0 + property int paddingLeft: 0 + + Loader { + id: hoverOutlineEffectLoader + anchors.fill: parent + active: control.containsMouse + visible: active + source: "HoverOutlineButtonEffect.qml" + } + +} diff --git a/contents/ui/HoverOutlineButtonStyle.qmlc b/contents/ui/HoverOutlineButtonStyle.qmlc new file mode 100644 index 0000000..d0ed69d Binary files /dev/null and b/contents/ui/HoverOutlineButtonStyle.qmlc differ diff --git a/contents/ui/HoverOutlineEffect.qml b/contents/ui/HoverOutlineEffect.qml new file mode 100644 index 0000000..f296131 --- /dev/null +++ b/contents/ui/HoverOutlineEffect.qml @@ -0,0 +1,64 @@ +import QtQuick 2.0 +import QtGraphicalEffects 1.0 + +Item { + id: hoverOutlineEffect + property int hoverOutlineSize: 1 * units.devicePixelRatio + property int hoverRadius: 40 + property int pressedRadius: hoverRadius + property bool useOutlineMask: true + + property int effectRadius: control.pressed ? pressedRadius : hoverRadius + Behavior on effectRadius { + NumberAnimation { + duration: units.longDuration + } + } + + visible: control.containsMouse + + function alpha(c, a) { + return Qt.rgba(c.r, c.g, c.b, a) + } + property color effectColor: theme.textColor + property color fillColor: alpha(effectColor, 1/16) + property color pressedFillColor: alpha(effectColor, 4/16) + property color borderColor: alpha(effectColor, 8/16) + + Rectangle { + id: hoverOutline + visible: !hoverOutlineEffect.useOutlineMask + anchors.fill: parent + // color: "transparent" + color: control.pressed ? pressedFillColor : fillColor + border.color: borderColor + border.width: hoverOutlineSize + + Behavior on color { + ColorAnimation { + duration: units.longDuration + } + } + } + + RadialGradient { + id: hoverOutlineMask + visible: false + anchors.fill: parent + horizontalOffset: hoverOutlineEffect.visible ? control.mouseX - width/2 : 0 + verticalOffset: hoverOutlineEffect.visible ? control.mouseY - height/2 : 0 + horizontalRadius: effectRadius + verticalRadius: effectRadius + gradient: Gradient { + GradientStop { position: 0.0; color: "#FFFFFFFF" } + GradientStop { position: 1; color: "#00FFFFFF" } + } + } + + OpacityMask { + anchors.fill: parent + visible: hoverOutlineEffect.useOutlineMask + source: hoverOutline + maskSource: hoverOutlineMask + } +} diff --git a/contents/ui/HoverOutlineEffect.qmlc b/contents/ui/HoverOutlineEffect.qmlc new file mode 100644 index 0000000..b2fd76f Binary files /dev/null and b/contents/ui/HoverOutlineEffect.qmlc differ diff --git a/contents/ui/KickerAppModel.qml b/contents/ui/KickerAppModel.qml new file mode 100644 index 0000000..0f2e033 --- /dev/null +++ b/contents/ui/KickerAppModel.qml @@ -0,0 +1,81 @@ +import QtQuick 2.0 +import org.kde.plasma.private.kicker 0.1 as Kicker + +Kicker.FavoritesModel { + // Kicker.FavoritesModel must be a child object of RootModel. + // appEntry.actions() looks at the parent object for parent.appletInterface and will crash plasma if it can't find it. + // https://github.com/KDE/plasma-desktop/blob/master/applets/kicker/plugin/appentry.cpp#L151 + id: kickerAppModel + + signal triggerIndex(int index) + onTriggerIndex: { + var closeRequested = kickerAppModel.trigger(index, "", null) + if (closeRequested) { + plasmoid.expanded = false + } + } + + signal triggerIndexAction(int index, string actionId, string actionArgument) + onTriggerIndexAction: { + var closeRequested = kickerAppModel.trigger(index, actionId, actionArgument) + if (closeRequested) { + plasmoid.expanded = false + } + } + + // DescriptionRole Qt.UserRole + 1 + // GroupRole Qt.UserRole + 2 + // FavoriteIdRole Qt.UserRole + 3 + // IsSeparatorRole Qt.UserRole + 4 + // IsDropPlaceholderRole Qt.UserRole + 5 + // IsParentRole Qt.UserRole + 6 + // HasChildrenRole Qt.UserRole + 7 + // HasActionListRole Qt.UserRole + 8 + // ActionListRole Qt.UserRole + 9 + // UrlRole Qt.UserRole + 10 + function getApp(url) { + for (var i = 0; i < count; i++) { + var modelIndex = kickerAppModel.index(i, 0) + var favoriteId = kickerAppModel.data(modelIndex, Qt.UserRole + 3) + if (favoriteId == url) { + var app = {} + app.indexInModel = i + app.favoriteId = favoriteId + app.display = kickerAppModel.data(modelIndex, Qt.DisplayRole) + app.decoration = kickerAppModel.data(modelIndex, Qt.DecorationRole) + app.description = kickerAppModel.data(modelIndex, Qt.UserRole + 1) + app.group = kickerAppModel.data(modelIndex, Qt.UserRole + 2) + app.url = kickerAppModel.data(modelIndex, Qt.UserRole + 10) + + // console.log(app, app.display, app.decoration, app.description, app.group, app.favoriteId) + + return app + } + } + console.log('getApp', url, 'no index') + return null + } + function runApp(url) { + for (var i = 0; i < count; i++) { + var modelIndex = kickerAppModel.index(i, 0) + var favoriteId = kickerAppModel.data(modelIndex, Qt.UserRole + 3) + if (favoriteId == url) { + kickerAppModel.triggerIndex(i) + return + } + } + console.log('runApp', url, 'no index') + } + + function indexHasActionList(i) { + var modelIndex = kickerAppModel.index(i, 0) + var hasActionList = kickerAppModel.data(modelIndex, Qt.UserRole + 8) + return hasActionList + } + + function getActionListAtIndex(i) { + var modelIndex = kickerAppModel.index(i, 0) + var actionList = kickerAppModel.data(modelIndex, Qt.UserRole + 9) + return actionList + } +} diff --git a/contents/ui/KickerAppModel.qmlc b/contents/ui/KickerAppModel.qmlc new file mode 100644 index 0000000..0541604 Binary files /dev/null and b/contents/ui/KickerAppModel.qmlc differ diff --git a/contents/ui/KickerListModel.qml b/contents/ui/KickerListModel.qml new file mode 100644 index 0000000..71fff97 --- /dev/null +++ b/contents/ui/KickerListModel.qml @@ -0,0 +1,136 @@ +import QtQuick 2.0 + +ListModel { + id: listModel + + property var list: [] + + signal refreshing() + signal refreshed() + + onListChanged: { + clear() + for (var i = 0; i < list.length; i++) { + append(list[i]); + } + } + + + function parseAppsModelItem(model, i) { + // https://github.com/KDE/plasma-desktop/blob/master/applets/kicker/plugin/actionlist.h#L30 + var DescriptionRole = Qt.UserRole + 1; + var GroupRole = DescriptionRole + 1; + var FavoriteIdRole = DescriptionRole + 2; + var IsSeparatorRole = DescriptionRole + 3; + var IsDropPlaceholderRole = DescriptionRole + 4; + var IsParentRole = DescriptionRole + 5; + var HasChildrenRole = DescriptionRole + 6; + var HasActionListRole = DescriptionRole + 7; + var ActionListRole = DescriptionRole + 8; + var UrlRole = DescriptionRole + 9; + + var modelIndex = model.index(i, 0); + + var item = { + parentModel: model, + indexInParent: i, + parentName: model.name, + name: model.data(modelIndex, Qt.DisplayRole), + description: model.data(modelIndex, DescriptionRole), + favoriteId: model.data(modelIndex, FavoriteIdRole), + largeIcon: false, // for KickerListView + }; + + // ListView.append() doesn't like it when we have { key: [object] }. + var url = model.data(modelIndex, UrlRole); + if (typeof url === 'object') { + url = url.toString(); + } + item.url = url; + + var icon = model.data(modelIndex, Qt.DecorationRole); + item.icon = typeof icon === 'object' ? icon : undefined; + item.iconName = typeof icon === 'string' ? icon : undefined; + + return item; + } + + function parseModel(appList, model, path) { + // console.log(path, model, model.description, model.count); + for (var i = 0; i < model.count; i++) { + var item = model.modelForRow(i); + if (!item) { + item = parseAppsModelItem(model, i); + } + var itemPath = (path || []).concat(i); + if (item && item.hasChildren) { + // console.log(item) + parseModel(appList, item, itemPath); + } else { + // console.log(itemPath, item, item.description); + appList.push(item); + } + } + } + + + function refresh() { + refreshing() + + refreshed() + } + + function log() { + for (var i = 0; i < list.length; i++) { + var item = list[i]; + console.log(JSON.stringify({ + name: item.name, + description: item.description, + }, null, '\t')) + } + } + + function triggerIndex(index) { + var item = list[index] + item.parentModel.trigger(item.indexInParent, "", null); + itemTriggered() + } + + signal itemTriggered() + + function hasActionList(index) { + var DescriptionRole = Qt.UserRole + 1; + var HasActionListRole = DescriptionRole + 7; + + var item = list[index] + var modelIndex = item.parentModel.index(item.indexInParent, 0) + return item.parentModel.data(modelIndex, HasActionListRole) + } + + function getActionList(index) { + var DescriptionRole = Qt.UserRole + 1; + var ActionListRole = DescriptionRole + 8; + + var item = list[index] + var modelIndex = item.parentModel.index(item.indexInParent, 0) + return item.parentModel.data(modelIndex, ActionListRole) + } + + function triggerIndexAction(index, actionId, actionArgument) { + // kicker/code/tools.js triggerAction() + + var item = list[index] + item.parentModel.trigger(item.indexInParent, actionId, actionArgument) + itemTriggered() + } + + function getByValue(key, value) { + for (var i = 0; i < count; i++) { + var item = get(i) + if (item[key] == value) { + return item + } + } + return null + } +} diff --git a/contents/ui/KickerListModel.qmlc b/contents/ui/KickerListModel.qmlc new file mode 100644 index 0000000..3901cea Binary files /dev/null and b/contents/ui/KickerListModel.qmlc differ diff --git a/contents/ui/KickerListView.qml b/contents/ui/KickerListView.qml new file mode 100644 index 0000000..6d06aa7 --- /dev/null +++ b/contents/ui/KickerListView.qml @@ -0,0 +1,117 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.draganddrop 2.0 as DragAndDrop + +ListView { + id: listView + width: parent.width + Layout.fillHeight: true + clip: true + cacheBuffer: 200 // Don't unload when scrolling (prevent stutter) + + // snapMode: ListView.SnapToItem + keyNavigationWraps: true + highlightMoveDuration: 0 + highlightResizeDuration: 0 + + property bool showItemUrl: true + property bool showDesktopFileUrl: false + property int iconSize: 36 * units.devicePixelRatio + + section.delegate: Item { + id: sectionDelegate + + width: parent.width + height: childrenRect.height + + PlasmaComponents.Label { + id: sectionHeading + anchors { + left: parent.left + leftMargin: units.smallSpacing + } + text: section + font.bold: true + font.pointSize: 14 + + property bool centerOverIcon: sectionHeading.contentWidth <= listView.iconSize + width: centerOverIcon ? listView.iconSize : parent.width + horizontalAlignment: centerOverIcon ? Text.AlignHCenter : Text.AlignLeft + } + } + + delegate: MenuListItem {} + + property var modelList: model ? model.list : [] + + // currentIndex: 0 + // Connections { + // target: appsModel.allAppsModel + // onRefreshing: { + // console.log('appsList.onRefreshing') + // appsList.model = [] + // // console.log('search.results.onRefreshed') + // appsList.currentIndex = 0 + // } + // onRefreshed: { + // console.log('appsList.onRefreshed') + // // appsList.model = appsModel.allAppsList + // appsList.model = appsModel.allAppsList + // appsList.modelList = appsModel.allAppsList.list + // appsList.currentIndex = 0 + // } + // } + + highlight: PlasmaComponents.Highlight { + visible: listView.currentItem && !listView.currentItem.isSeparator + } + + // function triggerIndex(index) { + // model.triggerIndex(index) + // } + + function goUp() { + if (verticalLayoutDirection == ListView.TopToBottom) { + decrementCurrentIndex() + } else { // ListView.BottomToTop + incrementCurrentIndex() + } + } + + function goDown() { + if (verticalLayoutDirection == ListView.TopToBottom) { + incrementCurrentIndex() + } else { // ListView.BottomToTop + decrementCurrentIndex() + } + } + + function skipToMin() { + currentIndex = Math.max(0, currentIndex - 10) + } + + function skipToMax() { + currentIndex = Math.min(currentIndex + 10, count-1) + } + + function pageUp() { + if (verticalLayoutDirection == ListView.TopToBottom) { + skipToMin() + } else { // ListView.BottomToTop + skipToMax() + } + } + + function pageDown() { + if (verticalLayoutDirection == ListView.TopToBottom) { + skipToMax() + } else { // ListView.BottomToTop + skipToMin() + } + } +} diff --git a/contents/ui/KickerListView.qmlc b/contents/ui/KickerListView.qmlc new file mode 100644 index 0000000..74f2dd9 Binary files /dev/null and b/contents/ui/KickerListView.qmlc differ diff --git a/contents/ui/LauncherIcon.qml b/contents/ui/LauncherIcon.qml new file mode 100644 index 0000000..c45e3f7 --- /dev/null +++ b/contents/ui/LauncherIcon.qml @@ -0,0 +1,98 @@ +import QtQuick 2.0 +import QtQuick.Layouts 1.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.draganddrop 2.0 as DragAndDrop + +MouseArea { + id: launcherIcon + + readonly property bool inPanel: (plasmoid.location == PlasmaCore.Types.TopEdge + || plasmoid.location == PlasmaCore.Types.RightEdge + || plasmoid.location == PlasmaCore.Types.BottomEdge + || plasmoid.location == PlasmaCore.Types.LeftEdge) + + Layout.minimumWidth: { + switch (plasmoid.formFactor) { + case PlasmaCore.Types.Vertical: + return 0; + case PlasmaCore.Types.Horizontal: + return height; + default: + return units.gridUnit * 3; + } + } + + Layout.minimumHeight: { + switch (plasmoid.formFactor) { + case PlasmaCore.Types.Vertical: + return width; + case PlasmaCore.Types.Horizontal: + return 0; + default: + return units.gridUnit * 3; + } + } + + readonly property int maxSize: Math.max(width, height) + property int size: { + if (inPanel) { + if (plasmoid.configuration.fixedPanelIcon) { + return units.iconSizeHints.panel + } else { + return maxSize + } + } else { + return -1 + } + } + Layout.maximumWidth: size + Layout.maximumHeight: size + + + property int iconSize: Math.min(width, height) + property alias iconSource: icon.source + + PlasmaCore.IconItem { + id: icon + anchors.centerIn: parent + source: "start-here-kde" + width: launcherIcon.iconSize + height: launcherIcon.iconSize + active: launcherIcon.containsMouse + smooth: true + } + + // Debugging + // Rectangle { anchors.fill: parent; border.color: "#ff0"; color: "transparent"; border.width: 1; } + // Rectangle { anchors.fill: icon; border.color: "#f00"; color: "transparent"; border.width: 1; } + + + hoverEnabled: true + // cursorShape: Qt.PointingHandCursor + + onClicked: { + plasmoid.expanded = !plasmoid.expanded + } + + property alias activateOnDrag: dropArea.enabled + DragAndDrop.DropArea { + id: dropArea + anchors.fill: parent + + onDragEnter: { + dragHoverTimer.restart() + } + } + + onContainsMouseChanged: { + if (!containsMouse) { + dragHoverTimer.stop() + } + } + + Timer { + id: dragHoverTimer + interval: 250 // Same as taskmanager's activationTimer in MouseHandler.qml + onTriggered: plasmoid.expanded = true + } +} diff --git a/contents/ui/LauncherIcon.qmlc b/contents/ui/LauncherIcon.qmlc new file mode 100644 index 0000000..590b067 Binary files /dev/null and b/contents/ui/LauncherIcon.qmlc differ diff --git a/contents/ui/Main.qml b/contents/ui/Main.qml new file mode 100644 index 0000000..bd5328e --- /dev/null +++ b/contents/ui/Main.qml @@ -0,0 +1,245 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Layouts 1.1 +import org.kde.plasma.core 2.0 as PlasmaCore + +import org.kde.plasma.plasmoid 2.0 +import org.kde.plasma.private.kicker 0.1 as Kicker +import org.kde.kcoreaddons 1.0 as KCoreAddons + +import "lib" + +Item { + id: widget + + Logger { + id: logger + name: 'tiledmenu' + // showDebug: true + } + + SearchModel { + id: search + Component.onCompleted: { + search.applyDefaultFilters() + } + } + + property alias rootModel: appsModel.rootModel + AppsModel { + id: appsModel + } + + Item { + XdgPathsLoader { id: xdgPathsLoader } + + KCoreAddons.KUser { + id: kuser + } + + Kicker.SystemSettings { + id: systemSettings + } + + Kicker.DragHelper { + id: dragHelper + + dragIconSize: units.iconSizes.medium + + onDropped: widget.draggedFavoriteId = "" + } + + Kicker.ProcessRunner { + id: processRunner + // .runMenuEditor() to run kmenuedit + } + + Kicker.WindowSystem { + id: windowSystem + } + + PlasmaCore.DataSource { + id: executable + engine: "executable" + connectedSources: [] + onNewData: disconnectSource(sourceName) // cmd finished + function exec(cmd) { + connectSource(cmd) + } + } + } + + // Workaround for passing the favoriteId to the drop handler. + // Use until event.mimeData.mimeData is exposed. + // https://github.com/KDE/kdeclarative/blob/0e47f91b3a2c93655f25f85150faadad0d65d2c1/src/qmlcontrols/draganddrop/DeclarativeDragDropEvent.cpp#L66 + property string draggedFavoriteId: "" + // onDraggedFavoriteIdChanged: console.log('onDraggedFavoriteIdChanged', draggedFavoriteId) + + + AppletConfig { + id: config + } + + function logListModel(label, listModel) { + console.log(label + '.count', listModel.count); + // logObj(label, listModel); + for (var i = 0; i < listModel.count; i++) { + var item = listModel.modelForRow(i); + var itemLabel = label + '[' + i + ']'; + console.log(itemLabel, item); + logObj(itemLabel, item); + if (('' + item).indexOf('Model') >= 0) { + logListModel(itemLabel, item); + } + } + } + function logObj(label, obj) { + // if (obj && typeof obj === 'object') { + // console.log(label, Object.keys(obj)) + // } + + for (var key in obj) { + var val = obj[key]; + if (typeof val !== 'function') { + var itemLabel = label + '.' + key; + console.log(itemLabel, typeof val, val); + if (('' + val).indexOf('Model') >= 0) { + logListModel(itemLabel, val); + } + } + } + } + + Plasmoid.compactRepresentation: LauncherIcon { + id: panelItem + iconSource: plasmoid.configuration.icon || "start-here-kde" + } + + Plasmoid.hideOnWindowDeactivate: !plasmoid.userConfiguring + property bool expanded: plasmoid.expanded + onExpandedChanged: { + if (expanded) { + search.query = "" + search.applyDefaultFilters() + popup.searchView.searchField.forceActiveFocus() + popup.searchView.appsView.show() + // popup.searchView.tileEditorView.open('preferred://browser') + } + } + + // property alias searchResultsView: popup.searchView.searchResultsView + // width: popup.width + // height: popup.height + Popup { + id: popup + anchors.fill: parent + } + Layout.minimumWidth: config.leftSectionWidth + Layout.preferredWidth: config.popupWidth + Layout.preferredHeight: config.popupHeight + + // Layout.minimumHeight: 600 // For quickly testing as a desktop widget + // Layout.minimumWidth: 800 + + Connections { + target: config + property int lastAppListWidth: -1 + onAppListWidthChanged: { + // We we increase the appListWidth, we need to increase the window width too. + // console.log('onAppListWidthChanged') + if (config.appListWidth != lastAppListWidth) { + // console.log('onAppListWidthChanged', config.appListWidth != lastAppListWidth) + if (lastAppListWidth != -1 && lastAppListWidth < config.appListWidth) { + var deltaPixels = config.appListWidth - lastAppListWidth + // console.log('onAppListWidthChanged', deltaPixels) + plasmoid.configuration.width += deltaPixels + } + lastAppListWidth = config.appListWidth + } + } + } + + onWidthChanged: { + // console.log('popup.size', width, height, 'width') + // plasmoid.configuration.width = width + resizeToFit.run() + } + onHeightChanged: { + // console.log('popup.size', width, height, 'height') + resizeHeight.restart() + } + + Timer { + id: resizeHeight + interval: 200 + onTriggered: { + if (!plasmoid.configuration.fullscreen) { + plasmoid.configuration.popupHeight = height / units.devicePixelRatio + } + } + } + Timer { + id: resizeToFit + interval: attemptsLeft == attempts ? 200 : 100 + repeat: attemptsLeft > 0 + property int attempts: 10 + property int attemptsLeft: 10 + + function run() { + restart() + attemptsLeft = attempts + } + + onTriggered: { + if (plasmoid.configuration.fullscreen) { + attemptsLeft = 0 + } else { + var favWidth = Math.max(0, widget.width - config.leftSectionWidth) // 398 // 888-60-430 + // console.log(favWidth, widget.width, config.leftSectionWidth) + // console.log(favWidth / config.cellBoxSize) + // var cols = Math.floor(favWidth / config.favColWidth) * 2 + var cols = Math.floor(favWidth / config.cellBoxSize) + if (plasmoid.configuration.favGridCols != cols) { + // console.log(plasmoid.configuration.favGridCols, cols) + plasmoid.configuration.favGridCols = cols + } + // Force a reflow since Alt+RightClick+Drag resizing doesn't really play nice with PlasmaCore.Dialog. + config.popupWidthChanged() + widget.Layout.preferredWidthChanged() + attemptsLeft -= 1 + } + } + } + // Layout.onPreferredWidthChanged: console.log('popup.size', width, height) + // Layout.onPreferredHeightChanged: console.log('popup.size', width, height) + + + onFocusChanged: { + if (focus) { + popup.searchView.searchField.forceActiveFocus() + } + } + + function action_kinfocenter() { appsModel.launch('org.kde.kinfocenter') } + function action_konsole() { appsModel.launch('org.kde.konsole') } + function action_ksysguard() { appsModel.launch('org.kde.ksysguard') } + function action_systemsettings() { appsModel.launch('systemsettings') } + function action_filemanager() { appsModel.launch('org.kde.dolphin') } + function action_menuedit() { processRunner.runMenuEditor(); } + + Component.onCompleted: { + if (plasmoid.hasOwnProperty("activationTogglesExpanded")) { + plasmoid.activationTogglesExpanded = true + } + plasmoid.setAction("kinfocenter", i18n("System Info"), "hwinfo"); + plasmoid.setAction("konsole", i18n("Terminal"), "utilities-terminal"); + plasmoid.setActionSeparator("systemAppsSection") + plasmoid.setAction("ksysguard", i18n("Task Manager"), "ksysguardd"); + plasmoid.setAction("systemsettings", i18n("System Settings"), "systemsettings"); + plasmoid.setAction("filemanager", i18n("File Manager"), "folder"); + plasmoid.setActionSeparator("configSection") + plasmoid.setAction("menuedit", i18n("Edit Applications..."), "kmenuedit"); + + // plasmoid.action('configure').trigger() // Uncomment to open the config window on load. + } +} diff --git a/contents/ui/Main.qmlc b/contents/ui/Main.qmlc new file mode 100644 index 0000000..a1d52d1 Binary files /dev/null and b/contents/ui/Main.qmlc differ diff --git a/contents/ui/MenuListItem.qml b/contents/ui/MenuListItem.qml new file mode 100644 index 0000000..d6893c4 --- /dev/null +++ b/contents/ui/MenuListItem.qml @@ -0,0 +1,182 @@ +import QtQuick 2.0 +import QtQuick.Layouts 1.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.draganddrop 2.0 as DragAndDrop + +AppToolButton { + id: itemDelegate + + width: parent.width + implicitHeight: row.implicitHeight + + property var parentModel: typeof modelList !== "undefined" && modelList[index] ? modelList[index].parentModel : undefined + property string modelDescription: model.name == model.description ? '' : model.description // Ignore the Comment if it's the same as the Name. + property string description: model.url ? modelDescription : '' // + property bool isDesktopFile: !!(model.url && endsWith(model.url, '.desktop')) + property bool showItemUrl: listView.showItemUrl && (!isDesktopFile || listView.showDesktopFileUrl) + property string secondRowText: showItemUrl && model.url ? model.url : modelDescription + property bool secondRowVisible: secondRowText + property string launcherUrl: model.favoriteId || model.url + property alias iconSource: itemIcon.source + property int iconSize: model.largeIcon ? listView.iconSize * 2 : listView.iconSize + + function endsWith(s, substr) { + return s.indexOf(substr) == s.length - substr.length + } + + // We need to look at the js list since ListModel doesn't support item's with non primitive propeties (like an Image). + property bool modelListPopulated: !!listView.model.list && listView.model.list.length - 1 >= index + property var iconInstance: modelListPopulated && listView.model.list[index] ? listView.model.list[index].icon : "" + Connections { + target: listView.model + onRefreshed: { + // We need to manually trigger an update when we update the model without replacing the list. + // Otherwise the icon won't be in sync. + itemDelegate.iconInstance = listView.model.list[index] ? listView.model.list[index].icon : "" + } + } + + // Drag (based on kicker) + // https://github.com/KDE/plasma-desktop/blob/4aad3fdf16bc5fd25035d3d59bb6968e06f86ec6/applets/kicker/package/contents/ui/ItemListDelegate.qml#L96 + // https://github.com/KDE/plasma-desktop/blob/master/applets/kicker/plugin/draghelper.cpp + property int pressX: -1 + property int pressY: -1 + property bool dragEnabled: launcherUrl + function initDrag(mouse) { + pressX = mouse.x + pressY = mouse.y + } + function shouldStartDrag(mouse) { + return dragEnabled + && pressX != -1 // Drag initialized? + && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y) // Mouse moved far enough? + } + function startDrag() { + widget.draggedFavoriteId = model.favoriteId + + // Requires Plasma 5.9 (probably) https://github.com/KDE/plasma-desktop/commit/85d946b206f6e8a12cf0a03b2386279ff2b0ff1a + // dragHelper.startDrag(widget, model.url, iconInstance, "favoriteId", model.favoriteId) + dragHelper.startDrag(widget, model.url || model.favoriteId, iconInstance) + + resetDragState() + } + function resetDragState() { + pressX = -1 + pressY = -1 + } + onPressed: { + if (mouse.buttons & Qt.LeftButton) { + initDrag(mouse) + } + } + onContainsMouseChanged: { + if (!containsMouse) { + resetDragState() + } + } + onPositionChanged: { + if (shouldStartDrag(mouse)) { + startDrag() + } + } + + RowLayout { // ItemListDelegate + id: row + anchors.left: parent.left + anchors.leftMargin: units.smallSpacing + anchors.right: parent.right + anchors.rightMargin: units.smallSpacing + + Item { + Layout.fillHeight: true + implicitHeight: itemIcon.implicitHeight + implicitWidth: itemIcon.implicitWidth + + PlasmaCore.IconItem { + id: itemIcon + anchors.centerIn: parent + implicitHeight: itemDelegate.iconSize + implicitWidth: implicitHeight + + // visible: iconsEnabled + + animated: false + // usesPlasmaTheme: false + source: itemDelegate.iconInstance + } + } + + ColumnLayout { + Layout.fillWidth: true + // Layout.fillHeight: true + Layout.alignment: Qt.AlignVCenter + spacing: 0 + + RowLayout { + Layout.fillWidth: true + // height: itemLabel.height + + PlasmaComponents.Label { + id: itemLabel + text: model.name + maximumLineCount: 1 + // elide: Text.ElideMiddle + height: implicitHeight + } + + PlasmaComponents.Label { + Layout.fillWidth: true + text: !itemDelegate.secondRowVisible ? itemDelegate.description : '' + color: config.menuItemTextColor2 + maximumLineCount: 1 + elide: Text.ElideRight + height: implicitHeight // ElideRight causes some top padding for some reason + } + } + + PlasmaComponents.Label { + visible: itemDelegate.secondRowVisible + Layout.fillWidth: true + // Layout.fillHeight: true + text: itemDelegate.secondRowText + color: config.menuItemTextColor2 + maximumLineCount: 1 + elide: Text.ElideMiddle + height: implicitHeight + } + } + + } + + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + mouse.accepted = true + logger.debug('MenuListItem.onClicked', mouse.button, Qt.LeftButton, Qt.RightButton) + if (mouse.button == Qt.LeftButton) { + trigger() + } else if (mouse.button == Qt.RightButton) { + contextMenu.open(mouse.x, mouse.y) + } + } + + function trigger() { + listView.model.triggerIndex(index) + } + + // property bool hasActionList: listView.model.hasActionList(index) + // property var actionList: hasActionList ? listView.model.getActionList(index) : [] + AppContextMenu { + id: contextMenu + onPopulateMenu: { + if (launcherUrl && !plasmoid.configuration.tilesLocked) { + menu.addPinToMenuAction(launcherUrl) + } + if (listView.model.hasActionList(index)) { + var actionList = listView.model.getActionList(index) + menu.addActionList(actionList, listView.model, index) + } + } + } + +} // delegate: AppToolButton diff --git a/contents/ui/MenuListItem.qmlc b/contents/ui/MenuListItem.qmlc new file mode 100644 index 0000000..280b1ce Binary files /dev/null and b/contents/ui/MenuListItem.qmlc differ diff --git a/contents/ui/Popup.qml b/contents/ui/Popup.qml new file mode 100644 index 0000000..e19ae2f --- /dev/null +++ b/contents/ui/Popup.qml @@ -0,0 +1,82 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +MouseArea { + property alias searchView: searchView + property alias tileEditorView: searchView.tileEditorView + property alias tileEditorViewLoader: searchView.tileEditorViewLoader + property alias tileGrid: tileGrid + + RowLayout { + anchors.fill: parent + spacing: 0 + + SearchView { + id: searchView + Layout.minimumWidth: config.leftSectionWidth + Layout.maximumWidth: config.leftSectionWidth + Layout.fillHeight: true + } + + TileGrid { + id: tileGrid + Layout.fillWidth: true + Layout.fillHeight: true + + cellSize: config.cellSize + cellMargin: config.cellMargin + cellPushedMargin: config.cellPushedMargin + + tileModel: config.tileModel.value + + onEditTile: tileEditorViewLoader.open(tile) + + onTileModelChanged: saveTileModel.restart() + Timer { + id: saveTileModel + interval: 2000 + onTriggered: config.tileModel.save() + } + } + + } + + MouseArea { + visible: !plasmoid.configuration.tilesLocked && !(plasmoid.location == PlasmaCore.Types.TopEdge || plasmoid.location == PlasmaCore.Types.RightEdge) + anchors.top: parent.top + anchors.right: parent.right + width: units.largeSpacing + height: units.largeSpacing + cursorShape: Qt.WhatsThisCursor + + PlasmaCore.ToolTipArea { + anchors.fill: parent + icon: "help-hint" + mainText: i18n("Resize?") + subText: i18n("Alt + Right Click to resize the menu.") + } + } + + MouseArea { + visible: !plasmoid.configuration.tilesLocked && !(plasmoid.location == PlasmaCore.Types.BottomEdge || plasmoid.location == PlasmaCore.Types.RightEdge) + anchors.bottom: parent.bottom + anchors.right: parent.right + width: units.largeSpacing + height: units.largeSpacing + cursorShape: Qt.WhatsThisCursor + + PlasmaCore.ToolTipArea { + anchors.fill: parent + icon: "help-hint" + mainText: i18n("Resize?") + subText: i18n("Alt + Right Click to resize the menu.") + } + } + + onClicked: searchView.searchField.forceActiveFocus() +} diff --git a/contents/ui/Popup.qmlc b/contents/ui/Popup.qmlc new file mode 100644 index 0000000..4da129d Binary files /dev/null and b/contents/ui/Popup.qmlc differ diff --git a/contents/ui/RoundShadow.qml b/contents/ui/RoundShadow.qml new file mode 100644 index 0000000..d6d2b73 --- /dev/null +++ b/contents/ui/RoundShadow.qml @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2011 by Daker Fernandes Pinheiro + * Copyright (C) 2011 by Marco Martin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. + */ + +/**Documented API +Inherits: + Item + +Imports: + QtQuick 2.1 + org.kde.plasma.core + +Description: + It is a simple Radio button which is using the plasma theme. + TODO Do we need more info? + +Properties: + TODO needs more info?? +**/ + +import QtQuick 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore + +Item { + id: main + state: parent.state + property alias imagePath: shadowSvg.imagePath + property string hoverElement: "hover" + property string focusElement: "focus" + property alias shadowElement: shadow.elementId + + //used to tell apart this implementation with the touch components one + property bool hasOverState: true + + PlasmaCore.Svg { + id: shadowSvg + imagePath: "widgets/actionbutton" + } + + PlasmaCore.SvgItem { + id: hover + svg: shadowSvg + elementId: "hover" + + anchors.fill: parent + + opacity: 0 + } + + PlasmaCore.SvgItem { + id: shadow + svg: shadowSvg + elementId: "shadow" + + anchors.fill: parent + } + + states: [ + State { + name: "shadow" + PropertyChanges { + target: shadow + opacity: 1 + } + PropertyChanges { + target: hover + opacity: 0 + elementId: hoverElement + } + }, + State { + name: "hover" + PropertyChanges { + target: shadow + opacity: 0 + } + PropertyChanges { + target: hover + opacity: 1 + elementId: hoverElement + } + }, + State { + name: "focus" + PropertyChanges { + target: shadow + opacity: 0 + } + PropertyChanges { + target: hover + opacity: 1 + elementId: focusElement + } + }, + State { + name: "hidden" + PropertyChanges { + target: shadow + opacity: 0 + } + PropertyChanges { + target: hover + opacity: 0 + elementId: hoverElement + } + } + ] + + transitions: [ + Transition { + PropertyAnimation { + properties: "opacity" + duration: units.longDuration + easing.type: Easing.OutQuad + } + } + ] +} diff --git a/contents/ui/SearchField.qml b/contents/ui/SearchField.qml new file mode 100644 index 0000000..4854c24 --- /dev/null +++ b/contents/ui/SearchField.qml @@ -0,0 +1,108 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +import QtQuick.Controls.Styles.Plasma 2.0 as PlasmaStyles + +TextField { + id: searchField + placeholderText: { + if (search.isDefaultFilter) { + return i18n("Search") + } else if (search.isAppsFilter) { + return i18n("Search Apps") + } else if (search.isFileFilter) { + return i18n("Search Files") + } else if (search.isBookmarksFilter) { + return i18n("Search Bookmarks") + } else { + return i18nc("Search [krunnerName, krunnerName, ...], ", "Search %1", search.filters) + } + } + property int topMargin: 0 + property int bottomMargin: 0 + property int defaultFontSize: 16 * units.devicePixelRatio // Not the same as pointSize=16 + property int styleMaxFontSize: height - topMargin - bottomMargin + font.pixelSize: Math.min(defaultFontSize, styleMaxFontSize) + + style: plasmoid.configuration.searchFieldFollowsTheme ? plasmaStyle : redmondStyle + Component { + id: plasmaStyle + // Creates the following warning when not in use: + // file:///usr/lib/x86_64-linux-gnu/qt5/qml/QtQuick/Controls/Styles/Plasma/TextFieldStyle.qml:74: ReferenceError: textField is not defined + // Caused by: + // var actionIconSize = Math.max(textField.height * 0.8, units.iconSizes.small); + PlasmaStyles.TextFieldStyle { + id: style + Component.onCompleted: { + searchField.topMargin = Qt.binding(function() { + return style.padding.top + }) + searchField.bottomMargin = Qt.binding(function() { + return style.padding.bottom + }) + } + } + } + Component { + id: redmondStyle + + // https://github.com/qt/qtquickcontrols/blob/dev/src/controls/Styles/Base/TextFieldStyle.qml + // https://github.com/qt/qtquickcontrols/blob/dev/src/controls/Styles/Desktop/TextFieldStyle.qml + TextFieldStyle { + id: style + + background: Rectangle { + color: "#eee" + } + textColor: "#111" + placeholderTextColor: "#777" + + Component.onCompleted: { + searchField.topMargin = Qt.binding(function() { + return style.padding.top + }) + searchField.bottomMargin = Qt.binding(function() { + return style.padding.bottom + }) + } + } + } + + onTextChanged: { + search.query = text + } + Connections { + target: search + onQueryChanged: searchField.text = search.query + } + + property var listView: searchResultsView.listView + Keys.onPressed: { + if (event.key == Qt.Key_Up) { + event.accepted = true; listView.goUp() + } else if (event.key == Qt.Key_Down) { + event.accepted = true; listView.goDown() + } else if (event.key == Qt.Key_PageUp) { + event.accepted = true; listView.pageUp() + } else if (event.key == Qt.Key_PageDown) { + event.accepted = true; listView.pageDown() + } else if (event.key == Qt.Key_Return) { + event.accepted = true; listView.currentItem.trigger() + } else if (event.modifiers & Qt.MetaModifier && event.key == Qt.Key_R) { + event.accepted = true; search.filters = ['shell'] + } else if (event.modifiers & Qt.MetaModifier && event.key == Qt.Key_R) { + event.accepted = true; search.filters = ['shell'] + } else if (event.key == Qt.Key_Escape) { + plasmoid.expanded = false + } + } + + Component.onCompleted: { + forceActiveFocus() + } +} \ No newline at end of file diff --git a/contents/ui/SearchField.qmlc b/contents/ui/SearchField.qmlc new file mode 100644 index 0000000..b883bc4 Binary files /dev/null and b/contents/ui/SearchField.qmlc differ diff --git a/contents/ui/SearchFiltersView.qml b/contents/ui/SearchFiltersView.qml new file mode 100644 index 0000000..4650dd3 --- /dev/null +++ b/contents/ui/SearchFiltersView.qml @@ -0,0 +1,129 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + + +ColumnLayout { + id: searchFiltersView + // width: parent.width + // Layout.fillHeight: true + + SearchFiltersViewItem { + runnerId: "" + indentLevel: 0 + iconSource: "applications-other" + text: i18n("All") + ' (Not working)' + subText: i18n("Search with all KRunner plugins") + checkBox.visible: false + onApplyButtonClicked: search.filters = [] + enabled: false + } + + SearchFiltersViewItem { + runnerId: "" + indentLevel: 0 + iconSource: "applications-other" + text: i18n("Default") + subText: i18n("Search with user selected defaults") + checkBox.visible: false + onApplyButtonClicked: search.applyDefaultFilters() + } + + // Installed runners are listed at: /usr/share/kservices5/plasma-runner-*.desktop + + SearchFiltersViewItem { + runnerId: "services" + indentLevel: 1 + iconSource: "window" + text: i18n("Applications") + } + + SearchFiltersViewItem { + runnerId: "baloosearch" + indentLevel: 1 + iconSource: "document-new" + text: i18n("Files") + } + + //--- baloosearch filters + // https://github.com/KDE/baloo/blob/master/docs/user/searching.md#advanced-searches + // Use `type:Audio` or `type:Document` to filter specific filetypes. + SearchFiltersViewItem { + runnerId: "baloosearch" + indentLevel: 2 + iconSource: "folder-music-symbolic" + text: i18n("Music") + checkBox.visible: false + onApplyButtonClicked: search.setQueryPrefix('type:Audio ') + } + SearchFiltersViewItem { + runnerId: "baloosearch" + indentLevel: 2 + iconSource: "folder-videos-symbolic" + text: i18n("Videos") + checkBox.visible: false + onApplyButtonClicked: search.setQueryPrefix('type:Video ') + } + //--- end baloosearch filters + + SearchFiltersViewItem { + runnerId: "bookmarks" + indentLevel: 1 + iconSource: "globe" + text: i18n("Bookmarks") + } + + SearchFiltersViewItem { + runnerId: "locations" + indentLevel: 1 + iconSource: "system-file-manager" + text: i18n("locations") + } + + SearchFiltersViewItem { + runnerId: "Dictionary" + indentLevel: 1 + iconSource: "accessories-dictionary" + text: i18n("Dictionary") + onApplyButtonClicked: search.setQueryPrefix('define ') + } + + SearchFiltersViewItem { + runnerId: "shell" + indentLevel: 1 + iconSource: "system-run" + text: i18n("Shell") + } + + SearchFiltersViewItem { + runnerId: "calculator" + indentLevel: 1 + iconSource: "accessories-calculator" + text: i18n("Calculator") + } + + SearchFiltersViewItem { + runnerId: "org.kde.windowedwidgets" + indentLevel: 1 + iconSource: "" + text: i18n("Windowed Widgets") + } + + SearchFiltersViewItem { + runnerId: "org.kde.datetime" + indentLevel: 1 + iconSource: "" + text: i18n("Date/Time") + } + + SearchFiltersViewItem { + runnerId: "unitconverter" + indentLevel: 1 + iconSource: "" + text: i18n("Unit Converter") + } +} diff --git a/contents/ui/SearchFiltersView.qmlc b/contents/ui/SearchFiltersView.qmlc new file mode 100644 index 0000000..f89311d Binary files /dev/null and b/contents/ui/SearchFiltersView.qmlc differ diff --git a/contents/ui/SearchFiltersViewItem.qml b/contents/ui/SearchFiltersViewItem.qml new file mode 100644 index 0000000..90c0ab5 --- /dev/null +++ b/contents/ui/SearchFiltersViewItem.qml @@ -0,0 +1,124 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle +import QtQuick.Controls.Styles.Plasma 2.0 as PlasmaStyles + +RowLayout { + id: searchFiltersViewItem + Layout.fillWidth: true + spacing: 0 + + property string runnerId: '' + property int indentLevel: 0 + + property alias iconSource: applyFilterButton.iconSource + property alias text: applyFilterButton.text + property alias subText: applyFilterButton.subText + + property alias checkBox: isDefaultFilter + property alias applyButton: applyFilterButton + + signal applyButtonClicked() + + property var surfaceNormal: PlasmaCore.FrameSvgItem { + anchors.fill: parent + imagePath: "widgets/button" + prefix: "normal" + // prefix: style.flat ? ["toolbutton-hover", "normal"] : "normal" + } + + Item { // Align CheckBoxes buttons to "All" + Layout.minimumWidth: surfaceNormal.margins.left + Layout.maximumWidth: Layout.minimumWidth + Layout.fillHeight: true + // visible: isDefaultFilter.visible && searchFiltersViewItem.indentLevel > 0 + } + + + Item { // Align CheckBoxes buttons to "All" + // Layout.minimumWidth: (isDefaultFilter.Layout.preferredWidth + surfaceNormal.margins.left) * (searchFiltersViewItem.indentLevel - (isDefaultFilter.visible ? 1 : 0)) + Layout.minimumWidth: (isDefaultFilter.Layout.minimumWidth + surfaceNormal.margins.left) * searchFiltersViewItem.indentLevel + Layout.maximumWidth: Layout.minimumWidth + Layout.fillHeight: true + } + + PlasmaComponents.ToolButton { + id: applyFilterButton + Layout.fillWidth: true + property string subText: "" + + style: PlasmaStyles.ToolButtonStyle { + id: style + readonly property bool smallIcon: !control.subText + + label: RowLayout { + PlasmaCore.IconItem { + source: control.iconSource + Layout.preferredHeight: style.smallIcon ? config.flatButtonIconSize : -1 + Layout.preferredWidth: style.smallIcon ? config.flatButtonIconSize : -1 + } + ColumnLayout { + id: textColumn + Layout.fillWidth: true + Layout.fillHeight: true + spacing: 0 + PlasmaComponents.Label { + Layout.fillWidth: true + text: control.text + horizontalAlignment: Text.AlignLeft + maximumLineCount: 1 + elide: Text.ElideRight + } + PlasmaComponents.Label { + Layout.fillWidth: true + text: control.subText + horizontalAlignment: Text.AlignLeft + visible: control.subText + color: config.menuItemTextColor2 + maximumLineCount: 1 + elide: Text.ElideRight + } + } + } + } + onClicked: { + if (searchFiltersViewItem.runnerId) { + search.filters = [searchFiltersViewItem.runnerId] + } + searchFiltersViewItem.applyButtonClicked() + searchResultsView.filterViewOpen = false + } + } + + PlasmaComponents.CheckBox { + id: isDefaultFilter + checked: search.defaultFilters.indexOf(searchFiltersViewItem.runnerId) != -1 + enabled: false + onCheckedChanged: { + if (checked) { + + } else { + + } + } + // Layout.fillHeight: true + Layout.preferredHeight: config.flatButtonIconSize + Layout.minimumWidth: config.flatButtonIconSize + Layout.preferredWidth: implicitWidth + implicitHeight: -1 + text: i18n("Default") + } + + Item { // Align CheckBoxes buttons to "All" + Layout.minimumWidth: surfaceNormal.margins.right + Layout.maximumWidth: Layout.minimumWidth + Layout.fillHeight: true + // visible: isDefaultFilter.visible && searchFiltersViewItem.indentLevel > 0 + } +} diff --git a/contents/ui/SearchFiltersViewItem.qmlc b/contents/ui/SearchFiltersViewItem.qmlc new file mode 100644 index 0000000..bd268e0 Binary files /dev/null and b/contents/ui/SearchFiltersViewItem.qmlc differ diff --git a/contents/ui/SearchModel.qml b/contents/ui/SearchModel.qml new file mode 100644 index 0000000..e88be70 --- /dev/null +++ b/contents/ui/SearchModel.qml @@ -0,0 +1,119 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +import org.kde.plasma.private.kicker 0.1 as Kicker + +Item { + id: search + property alias results: resultModel + property alias runnerModel: runnerModel + + property string query: "" + property bool isSearching: query.length > 0 + onQueryChanged: { + runnerModel.query = search.query + } + + // KRunner runners are defined in /usr/share/kservices5/plasma-runner-*.desktop + // To list the runner ids, use: + // find /usr/share/kservices5/ -iname "plasma-runner-*.desktop" -print0 | xargs -0 grep "PluginInfo-Name" | sort + property var filters: [] + onFiltersChanged: { + runnerModel.deleteWhenEmpty = !runnerModel.deleteWhenEmpty // runnerModel.clear() + runnerModel.runners = filters + clearQueryPrefix() + runnerModel.query = search.query + } + + Kicker.RunnerModel { + id: runnerModel + + appletInterface: plasmoid + favoritesModel: rootModel.favoritesModel + mergeResults: config.searchResultsMerged + + runners: [] // Empty = All runners. + + // deleteWhenEmpty: isDash + // deleteWhenEmpty: false + + onRunnersChanged: debouncedRefresh.restart() + onDataChanged: debouncedRefresh.restart() + onCountChanged: debouncedRefresh.restart() + } + + Timer { + id: debouncedRefresh + interval: 100 + onTriggered: resultModel.refresh() + + function logAndRestart() { + // console.log('debouncedRefresh') + restart() + } + } + + SearchResultsModel { + id: resultModel + } + + property var defaultFilters: [ + 'Dictionary', + 'services', + // 'calculator', + 'shell', + 'org.kde.windowedwidgets', + 'org.kde.datetime', + 'baloosearch', + // 'bookmarks', + 'locations', + 'unitconverter', + ] + + function isFilter(runnerId) { + return filters.length == 1 && filters[0] == runnerId + } + property bool isDefaultFilter: filters == defaultFilters + property bool isAppsFilter: isFilter('services') + property bool isFileFilter: isFilter('baloosearch') + property bool isBookmarksFilter: isFilter('bookmarks') + + function hasFilter(runnerId) { + return filters.indexOf(runnerId) >= 0 + } + + function applyDefaultFilters() { + filters = defaultFilters + } + + function setQueryPrefix(prefix) { + // First check to see if there's already a prefix we need to replace. + var firstSpaceIndex = query.indexOf(' ') + if (firstSpaceIndex > 0) { + var firstToken = query.substring(0, firstSpaceIndex) + + if (/^type:\w+$/.exec(firstToken) // baloosearch + || /^define$/.exec(firstToken) // Dictionary + ) { + // replace existing prefix + query = prefix + query.substring(firstSpaceIndex + 1, query.length) + return + } + } + + // If not, just prepend the prefix + var newQuery = prefix + query + if (newQuery != query) { + query = prefix + query + } + } + + function clearQueryPrefix() { + setQueryPrefix('') + } +} diff --git a/contents/ui/SearchModel.qmlc b/contents/ui/SearchModel.qmlc new file mode 100644 index 0000000..9b1034c Binary files /dev/null and b/contents/ui/SearchModel.qmlc differ diff --git a/contents/ui/SearchResultsList.qml b/contents/ui/SearchResultsList.qml new file mode 100644 index 0000000..49836fb --- /dev/null +++ b/contents/ui/SearchResultsList.qml @@ -0,0 +1,41 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +KickerListView { // RunnerResultsList + id: searchResultsList + + model: [] + delegate: MenuListItem { + property var runner: search.runnerModel.modelForRow(model.runnerIndex) + iconSource: runner && runner.data(runner.index(model.runnerItemIndex, 0), Qt.DecorationRole) + } + + section.property: 'runnerName' + section.criteria: ViewSection.FullString + // verticalLayoutDirection: config.searchResultsDirection + + Connections { + target: search.results + onRefreshing: { + searchResultsList.model = [] + // console.log('search.results.onRefreshed') + searchResultsList.currentIndex = 0 + } + onRefreshed: { + // console.log('search.results.onRefreshed') + searchResultsList.model = search.results + // if (searchResultsList.verticalLayoutDirection == Qt.BottomToTop) { + if (plasmoid.configuration.searchResultsReversed) { + searchResultsList.currentIndex = searchResultsList.model.count - 1 + } else { // TopToBottom (normal) + searchResultsList.currentIndex = 0 + } + } + } + +} diff --git a/contents/ui/SearchResultsList.qmlc b/contents/ui/SearchResultsList.qmlc new file mode 100644 index 0000000..c6f7565 Binary files /dev/null and b/contents/ui/SearchResultsList.qmlc differ diff --git a/contents/ui/SearchResultsModel.qml b/contents/ui/SearchResultsModel.qml new file mode 100644 index 0000000..1b86fb5 --- /dev/null +++ b/contents/ui/SearchResultsModel.qml @@ -0,0 +1,245 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +ListModel { + id: resultModel + + signal refreshing() + signal refreshed() + + function refresh() { + refreshing() + + // console.log('resultModel.refresh') + //--- populate list + var resultList = []; + for (var i = 0; i < runnerModel.count; i++){ + var runner = runnerModel.modelForRow(i); + // console.log(i, runner, runner.runnerId, runner.name) + for (var j = 0; j < runner.count; j++) { + // RunnerMatchesModel.modelForRow is NOT implemented. + // We need to use model.data(model.index(row, 0), role) + // https://github.com/KDE/plasma-desktop/blob/master/applets/kicker/plugin/abstractmodel.cpp#L35 + // https://github.com/KDE/plasma-desktop/blob/master/applets/kicker/plugin/runnermatchesmodel.cpp#L54 + + // https://github.com/KDE/plasma-desktop/blob/master/applets/kicker/plugin/actionlist.h#L30 + var DescriptionRole = Qt.UserRole + 1; + var GroupRole = DescriptionRole + 1; + var FavoriteIdRole = DescriptionRole + 2; + var IsSeparatorRole = DescriptionRole + 3; + var IsDropPlaceholderRole = DescriptionRole + 4; + var IsParentRole = DescriptionRole + 5; + var HasChildrenRole = DescriptionRole + 6; + var HasActionListRole = DescriptionRole + 7; + var ActionListRole = DescriptionRole + 8; + var UrlRole = DescriptionRole + 9; + + var modelIndex = runner.index(j, 0); + + // ListView.append() doesn't like it when we have { key: [object] }. + var url = runner.data(modelIndex, UrlRole); + if (typeof url === 'object') { + url = url.toString(); + } + var icon = runner.data(modelIndex, Qt.DecorationRole); + if (typeof icon === 'object') { + icon = icon.toString(); + } + + var resultItem = { + runnerIndex: i, + runnerName: runner.name, + runnerItemIndex: j, + name: runner.data(modelIndex, Qt.DisplayRole), + description: runner.data(modelIndex, DescriptionRole), + icon: icon, + url: url, + favoriteId: runner.data(modelIndex, FavoriteIdRole), + largeIcon: false, // for KickerListView + }; + + // console.log(resultItem.name, resultItem.url); + // for (var x = 0; x < 10; x++) { + // console.log('\t', typeof runner.data(runner.index(j, 0), DescriptionRole + x)); + // } + // console.log(resultItem.name, Qt.DisplayRole, DescriptionRole, UrlRole) + resultList.push(resultItem); + } + } + + if (config.searchResultsCustomSort) { + //--- sort: runner relevance (English only) + + // We have to sort by .name instead of .runnerId because the later isn't exposed... anywhere. :/ + var runnerOrder = [ + //--- Single line action + "Desktop Sessions", // sessions + "Command Line", // shell + "Locations", // locations (Open website) + + //--- Single line + "Calculator", // calculator + "Date and Time", // datetime + + //--- Small Lists + "Control Audio Player", // audioplayercontrol + "Unit Converter", // converter + "Dictionary", // dictionary + "Terminate Applications", // kill + + //--- Large Lists + "Applications", // services + "System Settings", + "Places", // places + "Windows", // windows + "Bookmarks", // bookmarks + "Recent Documents", // ? baloosearch ? + "Windowed widgets", // windowedwidgets + + //--- ? + "Desktop Search", // baloosearch + "KWin", // kwin + "Plasma Desktop Shell", // plasma-desktop + "Power", // powerdevil + "Spell Checker", // spellchecker + "Web Shortcuts", // webshortcuts + ]; + + resultList = resultList.sort(function(a, b) { + var aOrder = runnerOrder.indexOf(a.runnerName); + var bOrder = runnerOrder.indexOf(b.runnerName); + if (aOrder == -1 && bOrder == -1) { // Neither really matters + return 0; + } else if (aOrder == -1) { // a doesn't matter + return 1; // a should be placed after b + } else if (bOrder == -1) { // b doesn't matter + return -1; // a should be placed before b + } else { + return aOrder - bOrder; + } + }); + + //--- sort: matches start + function moveToTopOfRunner(queryLower) { + // Scan in reverse so we preserve runnerOrder with multiple matches + for (var i = resultList.length-1; i >= 0; i--) { + var resultItem = resultList[i]; + if (resultItem.name.toLowerCase().indexOf(queryLower) == 0) { + for (var j = i-1; j >= 0; j--) { + // Scan (in reverse) for insertion point. + if (resultList[j].runnerName != resultItem.runnerName) { + resultList.splice(i, 1); // remove from old index + resultList.splice(j, 0, resultItem); // insert at new index + break; + } + } + + } + } + } + var queryLower = search.query.toLowerCase(); + moveToTopOfRunner(queryLower) + + //--- sort: exact match + function moveToTop(queryLower) { + // Scan in reverse so we preserve runnerOrder with multiple matches + for (var i = resultList.length-1; i >= 0; i--) { + var resultItem = resultList[i]; + if (queryLower == resultItem.name.toLowerCase()) { + resultList.splice(i, 1); // remove at index + resultList.splice(0, 0, resultItem); // add to beginning + } + } + } + + // sort: clementine (English only) + // /usr/share/applications/clementine.desktop + if (queryLower == 'play') { + moveToTop('Play - Clementine'.toLowerCase()) + } else if (queryLower == 'play') { + moveToTop('Pause - Clementine'.toLowerCase()) + } else if (queryLower == 'play') { + moveToTop('Stop - Clementine'.toLowerCase()) + } else if (queryLower.indexOf('prev') == 0) { // Matches previous as well + moveToTop('Previous - Clementine'.toLowerCase()) + } else if (queryLower == 'next') { + moveToTop('Next - Clementine'.toLowerCase()) + } + } + + //--- Make the (selected) first item bigger. + if (resultList.length > 0) { + resultList[0].largeIcon = true + } + + //--- Reverse the model? + if (plasmoid.configuration.searchResultsReversed) { + resultList.reverse() + } + + //--- apply model + resultModel.clear(); + for (var i = 0; i < resultList.length; i++) { + resultModel.append(resultList[i]); + } + + // console.log(JSON.stringify(resultList, null, '\t')) + + //--- listen for changes + for (var i = 0; i < runnerModel.count; i++){ + var runner = runnerModel.modelForRow(i); + if (!runner.listenersBound) { + runner.countChanged.connect(debouncedRefresh.logAndRestart) + runner.dataChanged.connect(debouncedRefresh.logAndRestart) + runner.listenersBound = true; + } + } + + refreshed() + } + + function triggerIndex(index) { + var model = resultModel.get(index) + var runner = runnerModel.modelForRow(model.runnerIndex) + runner.trigger(model.runnerItemIndex, "", null) + itemTriggered() + } + + signal itemTriggered() + + function hasActionList(index) { + var DescriptionRole = Qt.UserRole + 1; + var HasActionListRole = DescriptionRole + 7; + + var model = resultModel.get(index) + var runner = runnerModel.modelForRow(model.runnerIndex) + var modelIndex = runner.index(model.runnerItemIndex, 0) + return runner.data(modelIndex, HasActionListRole) + } + + function getActionList(index) { + var DescriptionRole = Qt.UserRole + 1; + var ActionListRole = DescriptionRole + 8; + + var model = resultModel.get(index) + var runner = runnerModel.modelForRow(model.runnerIndex) + var modelIndex = runner.index(model.runnerItemIndex, 0) + return runner.data(modelIndex, ActionListRole) + } + + function triggerIndexAction(index, actionId, actionArgument) { + // kicker/code/tools.js triggerAction() + var model = resultModel.get(index) + var runner = runnerModel.modelForRow(model.runnerIndex) + runner.trigger(model.runnerItemIndex, actionId, actionArgument) + itemTriggered() + + // Note that Recent Documents actions do not work (in the search results) as of Plasma 5.8.4 + // https://bugs.kde.org/show_bug.cgi?id=373173 + } +} diff --git a/contents/ui/SearchResultsModel.qmlc b/contents/ui/SearchResultsModel.qmlc new file mode 100644 index 0000000..1f6ec0f Binary files /dev/null and b/contents/ui/SearchResultsModel.qmlc differ diff --git a/contents/ui/SearchResultsView.qml b/contents/ui/SearchResultsView.qml new file mode 100644 index 0000000..97d0d69 --- /dev/null +++ b/contents/ui/SearchResultsView.qml @@ -0,0 +1,136 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +GridLayout { + id: searchResultsView + rowSpacing: 0 + property alias listView: searchResultsList + property bool filterViewOpen: false + + RowLayout { + id: searchFiltersRow + Layout.row: searchView.searchOnTop ? 2 : 0 + Layout.preferredHeight: config.searchFilterRowHeight - 1 // -1px is for the underline seperator + Layout.fillWidth: true + + FlatButton { + iconName: "system-search-symbolic" + Layout.preferredHeight: parent.Layout.preferredHeight + Layout.preferredWidth: parent.Layout.preferredHeight + onClicked: search.applyDefaultFilters() + checked: search.isDefaultFilter + checkedEdge: searchView.searchOnTop ? Qt.TopEdge : Qt.BottomEdge + } + FlatButton { + iconName: "window" + Layout.preferredHeight: parent.Layout.preferredHeight + Layout.preferredWidth: parent.Layout.preferredHeight + onClicked: search.filters = ['services'] + checked: search.isAppsFilter + checkedEdge: searchView.searchOnTop ? Qt.TopEdge : Qt.BottomEdge + } + FlatButton { + iconName: "document-new" + Layout.preferredHeight: parent.Layout.preferredHeight + Layout.preferredWidth: parent.Layout.preferredHeight + onClicked: search.filters = ['baloosearch'] + checked: search.isFileFilter + checkedEdge: searchView.searchOnTop ? Qt.TopEdge : Qt.BottomEdge + } + // FlatButton { + // iconName: "globe" + // Layout.preferredHeight: parent.Layout.preferredHeight + // Layout.preferredWidth: parent.Layout.preferredHeight + // onClicked: search.filters = ['bookmarks'] + // checked: search.isBookmarksFilter + // checkedEdge: searchView.searchOnTop ? Qt.TopEdge : Qt.BottomEdge + // } + + Item { Layout.fillWidth: true } + + FlatButton { + id: moreFiltersButton + Layout.preferredHeight: parent.Layout.preferredHeight + Layout.preferredWidth: moreFiltersButtonRow.implicitWidth + padding*2 + property int padding: (config.searchFilterRowHeight - config.flatButtonIconSize) / 2 + // enabled: false + + RowLayout { + id: moreFiltersButtonRow + anchors.centerIn: parent + anchors.margins: parent.padding + + PlasmaComponents.Label { + id: moreFiltersButtonLabel + text: i18n("Filters") + } + PlasmaCore.IconItem { + source: "usermenu-down" + rotation: searchResultsView.filterViewOpen ? 180 : 0 + Layout.preferredHeight: config.flatButtonIconSize + Layout.preferredWidth: config.flatButtonIconSize + + Behavior on rotation { + NumberAnimation { duration: units.longDuration } + } + } + } + + onClicked: searchResultsView.filterViewOpen = !searchResultsView.filterViewOpen + } + } + + Rectangle { + color: "#111" + height: 1 + width: parent.width + // anchors.bottom: searchFiltersRow.bottom - 1 + } + + + + StackView { + id: searchResultsViewStackView + Layout.row: searchView.searchOnTop ? 0 : 2 + Layout.fillWidth: true + Layout.fillHeight: true + clip: true + initialItem: searchResultsListScrollView + + Connections { + target: searchResultsView + onFilterViewOpenChanged: { + if (searchResultsView.filterViewOpen) { + searchResultsViewStackView.push(searchFiltersViewScrollView) + } else { + searchResultsViewStackView.pop() + } + } + } + + ScrollView { + id: searchResultsListScrollView + visible: false + + SearchResultsList { + id: searchResultsList + } + } + + ScrollView { + id: searchFiltersViewScrollView + visible: false + + SearchFiltersView { + id: searchFiltersView + width: searchFiltersViewScrollView.viewport.width + } + } + + } +} diff --git a/contents/ui/SearchResultsView.qmlc b/contents/ui/SearchResultsView.qmlc new file mode 100644 index 0000000..a7879a0 Binary files /dev/null and b/contents/ui/SearchResultsView.qmlc differ diff --git a/contents/ui/SearchStackView.qml b/contents/ui/SearchStackView.qml new file mode 100644 index 0000000..d74073a --- /dev/null +++ b/contents/ui/SearchStackView.qml @@ -0,0 +1,121 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Layouts 1.1 + +StackView { + id: stackView + clip: true + + delegate: panUp + + property int zoomDuration: 250 + property int zoomDelta: 100 + property real zoomedInRatio: Math.max(1, stackView.width + zoomDelta * units.devicePixelRatio) / stackView.width + property real zoomedOutRatio: Math.max(1, stackView.width - zoomDelta * units.devicePixelRatio) / stackView.width + + readonly property var noTransition: StackViewDelegate {} + + readonly property var panUp: StackViewDelegate { + pushTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "y" + from: stackView.height * (searchView.searchOnTop ? -1 : 1) + to: 0 + } + PropertyAnimation { + target: exitItem + property: "opacity" + from: 1 + to: 0 + } + } + + function transitionFinished(properties) { + properties.exitItem.opacity = 1 + } + } + readonly property var zoomOut: StackViewDelegate { + function transitionFinished(properties) { + properties.exitItem.opacity = 1 + properties.exitItem.scale = 1 + } + + pushTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "opacity" + easing.type: Easing.InQuad + from: 0 + to: 1 + duration: stackView.zoomDuration + } + PropertyAnimation { + target: exitItem + property: "opacity" + easing.type: Easing.InQuad + from: 1 + to: 0 + duration: stackView.zoomDuration + } + PropertyAnimation { + target: enterItem + property: "scale" + easing.type: Easing.Linear + from: stackView.zoomedInRatio + to: 1 + duration: stackView.zoomDuration + } + PropertyAnimation { + target: exitItem + property: "scale" + easing.type: Easing.Linear + from: 1 + to: stackView.zoomedOutRatio + duration: stackView.zoomDuration + } + } + } + readonly property var zoomIn: StackViewDelegate { + function transitionFinished(properties) { + properties.exitItem.opacity = 1 + properties.exitItem.scale = 1 + } + + pushTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "opacity" + easing.type: Easing.InQuad + from: 0 + to: 1 + duration: stackView.zoomDuration + } + PropertyAnimation { + target: exitItem + property: "opacity" + easing.type: Easing.InQuad + from: 1 + to: 0 + duration: stackView.zoomDuration + } + PropertyAnimation { + target: enterItem + property: "scale" + easing.type: Easing.Linear + from: stackView.zoomedOutRatio + to: 1 + duration: stackView.zoomDuration + } + PropertyAnimation { + target: exitItem + property: "scale" + easing.type: Easing.Linear + from: 1 + to: stackView.zoomedInRatio + duration: stackView.zoomDuration + } + } + popTransition: pushTransition + } +} diff --git a/contents/ui/SearchStackView.qmlc b/contents/ui/SearchStackView.qmlc new file mode 100644 index 0000000..0a8ac4f Binary files /dev/null and b/contents/ui/SearchStackView.qmlc differ diff --git a/contents/ui/SearchView.qml b/contents/ui/SearchView.qml new file mode 100644 index 0000000..c46aaee --- /dev/null +++ b/contents/ui/SearchView.qml @@ -0,0 +1,166 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +import org.kde.draganddrop 2.0 as DragAndDrop +import org.kde.kquickcontrolsaddons 2.0 // KCMShell + +import "Utils.js" as Utils + +Item { + id: searchView + width: config.leftSectionWidth + height: config.popupHeight + property alias searchResultsView: searchResultsView + property alias appsView: appsView + property alias tileEditorView: tileEditorViewLoader.item + property alias tileEditorViewLoader: tileEditorViewLoader + property alias searchField: searchField + + property bool searchOnTop: false + + states: [ + State { + name: "searchOnTop" + when: searchOnTop + PropertyChanges { + target: stackViewContainer + anchors.topMargin: searchField.height + } + PropertyChanges { + target: searchField + anchors.top: searchField.parent.top + } + }, + State { + name: "searchOnBottom" + when: !searchOnTop + PropertyChanges { + target: stackViewContainer + anchors.bottomMargin: searchField.height + } + PropertyChanges { + target: searchField + anchors.bottom: searchField.parent.bottom + } + } + ] + + SidebarView { + id: sidebarView + } + + + Item { + id: stackViewContainer + anchors.fill: parent + + SearchResultsView { + id: searchResultsView + visible: false + + Connections { + target: search + onQueryChanged: { + if (search.query.length > 0 && stackView.currentItem != searchResultsView) { + stackView.push(searchResultsView, true) + } + searchResultsView.filterViewOpen = false + } + } + + onVisibleChanged: { + if (!visible) { // !stackView.currentItem + search.query = "" + } + } + + function showDefaultSearch() { + if (stackView.currentItem != searchResultsView) { + stackView.push(searchResultsView, true) + } + search.applyDefaultFilters() + } + } + + AppsView { + id: appsView + visible: false + + function showAppsAlphabetically() { + appsModel.order = "alphabetical" + show() + } + + function showAppsCategorically() { + appsModel.order = "categories" + show() + } + + function show() { + if (stackView.currentItem != appsView) { + stackView.delegate = stackView.panUp + stackView.push({ + item: appsView, + replace: true, + }) + } + appsView.scrollToTop() + } + } + + // TM3.Main { + // id: appsView + // // width: parent.width + // // height: parent.height + + // function show() { + // if (stackView.currentItem != appsView) { + // stackView.push(appsView, true) + // } + // appsView.scrollToTop() + // } + // } + + // Item { + // id: appsView + // } + + Loader { + id: tileEditorViewLoader + source: "TileEditorView.qml" + visible: false + active: false + // asynchronous: true + function open(tile) { + active = true + item.open(tile) + } + } + + SearchStackView { + id: stackView + width: config.appListWidth + anchors.top: parent.top + anchors.right: parent.right + anchors.bottom: parent.bottom + initialItem: appsView + } + } + + + SearchField { + id: searchField + // width: 430 + height: config.searchFieldHeight + anchors.leftMargin: config.sidebarWidth + anchors.left: parent.left + anchors.right: parent.right + + listView: stackView.currentItem && stackView.currentItem.listView ? stackView.currentItem.listView : [] + } +} diff --git a/contents/ui/SearchView.qmlc b/contents/ui/SearchView.qmlc new file mode 100644 index 0000000..9835a9d Binary files /dev/null and b/contents/ui/SearchView.qmlc differ diff --git a/contents/ui/SidebarContextMenu.qml b/contents/ui/SidebarContextMenu.qml new file mode 100644 index 0000000..7231d25 --- /dev/null +++ b/contents/ui/SidebarContextMenu.qml @@ -0,0 +1,58 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +SidebarMenu { + id: sidebarContextMenu + visible: open + open: false + anchors.left: parent.right + anchors.bottom: parent.bottom + width: config.sidebarOpenWidth + height: childrenRect.height + z: 2 + + default property alias _contentChildren: content.data + + Column { + id: content + width: parent.width + height: childrenRect.height + + // We're using Column instead of ColumnLayout, so this isn't needed. + // Keeping it here in case Layout is used in the future. + + // Workaround for crash when using default on a Layout. + // https://bugreports.qt.io/browse/QTBUG-52490 + // Still affecting Qt 5.7.0 + // Component.onDestruction: { + // while (children.length > 0) { + // children[children.length - 1].parent = page; + // } + // } + } + + // onVisibleChanged: { + // if (sidebarContextMenu.visible) { + // sidebarContextMenu.focus = true + // } + // } + + onFocusChanged: { + // console.log('sidebarContextMenu.onFocusChanged', focus) + if (!sidebarContextMenu.focus) { + sidebarContextMenu.open = false + } + } + + onActiveFocusChanged: { + // console.log('sidebarContextMenu.onActiveFocusChanged', activeFocus) + if (!sidebarContextMenu.activeFocus) { + sidebarContextMenu.open = false + } + } +} diff --git a/contents/ui/SidebarContextMenu.qmlc b/contents/ui/SidebarContextMenu.qmlc new file mode 100644 index 0000000..e602c96 Binary files /dev/null and b/contents/ui/SidebarContextMenu.qmlc differ diff --git a/contents/ui/SidebarFavouritesView.qml b/contents/ui/SidebarFavouritesView.qml new file mode 100644 index 0000000..f2c5da2 --- /dev/null +++ b/contents/ui/SidebarFavouritesView.qml @@ -0,0 +1,107 @@ +import QtQuick 2.0 + +Repeater { + id: repeater + property int maxHeight: 1000000 + property int numAvailable: maxHeight / config.flatButtonSize + property int minVisibleIndex: count - numAvailable // Hide items with an index smaller than this + + delegate: SidebarItem { + icon: symbolicIconName || model.iconName || model.decoration + text: xdgDisplayName || model.name || model.display + sidebarMenu: repeater.parent.parent // SidebarContextMenu { Column { Repeater{} } } + onClicked: { + repeater.parent.parent.open = false // SidebarContextMenu { Column { Repeater{} } } + var xdgFolder = isLocalizedFolder() + if (xdgFolder === 'DOCUMENTS') { + executable.exec('xdg-open $(xdg-user-dir DOCUMENTS)') + } else if (xdgFolder === 'DOWNLOAD') { + executable.exec('xdg-open $(xdg-user-dir DOWNLOAD)') + } else if (xdgFolder === 'MUSIC') { + executable.exec('xdg-open $(xdg-user-dir MUSIC)') + } else if (xdgFolder === 'PICTURES') { + executable.exec('xdg-open $(xdg-user-dir PICTURES)') + } else if (xdgFolder === 'VIDEOS') { + executable.exec('xdg-open $(xdg-user-dir VIDEOS)') + } else { + repeater.model.triggerIndex(index) + } + } + visible: index >= minVisibleIndex + + // These files are localize, so open them via commandline + // since Qt 5.7 doesn't expose the localized paths anywhere. + function isLocalizedFolder() { + var s = model.url.toString() + if (startsWith(s, 'xdg:')) { + s = s.substring('xdg:'.length, s.length) + if (s == 'DOCUMENTS' + || s == 'DOWNLOAD' + || s == 'MUSIC' + || s == 'PICTURES' + || s == 'VIDEOS' + ) { + return s + } + } + return '' + } + + function startsWith(s, sub) { + return s.indexOf(sub) === 0 + } + function endsWith(s, sub) { + return s.indexOf(sub) === s.length - sub.length + } + + property string xdgDisplayName: { + var xdgFolder = isLocalizedFolder() + if (xdgFolder) { + return xdgPathsLoader.displayName(xdgFolder) + } else { + return '' + } + } + property string symbolicIconName: { + if (model.url) { + var s = model.url.toString() + if (endsWith(s, '.desktop')) { + if (endsWith(s, '/org.kde.dolphin.desktop')) { + return 'folder-open-symbolic' + } else if (endsWith(s, '/systemsettings.desktop')) { + return 'configure' + } + } else if (startsWith(s, 'file:///home/')) { + s = s.substring('file:///home/'.length, s.length) + // console.log(model.url, s) + + var trimIndex = s.indexOf('/') + if (trimIndex == -1) { // file:///home/username + s = '' + } else { + s = s.substring(trimIndex, s.length) + } + // console.log(model.url, s) + + if (s === '') { // Home Directory + return 'user-home-symbolic' + } + } else if (startsWith(s, 'xdg:')) { + s = s.substring('xdg:'.length, s.length) + if (s === 'DOCUMENTS') { + return 'folder-documents-symbolic' + } else if (s === 'DOWNLOAD') { + return 'folder-download-symbolic' + } else if (s === 'MUSIC') { + return 'folder-music-symbolic' + } else if (s === 'PICTURES') { + return 'folder-pictures-symbolic' + } else if (s === 'VIDEOS') { + return 'folder-videos-symbolic' + } + } + } + return "" + } + } +} diff --git a/contents/ui/SidebarFavouritesView.qmlc b/contents/ui/SidebarFavouritesView.qmlc new file mode 100644 index 0000000..4518b1a Binary files /dev/null and b/contents/ui/SidebarFavouritesView.qmlc differ diff --git a/contents/ui/SidebarItem.qml b/contents/ui/SidebarItem.qml new file mode 100644 index 0000000..62d35a1 --- /dev/null +++ b/contents/ui/SidebarItem.qml @@ -0,0 +1,25 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate +import QtQuick.Controls.Styles.Plasma 2.0 as PlasmaStyles + +FlatButton { + width: parent.width + height: config.flatButtonSize + property var sidebarMenu: parent.parent // Column.SidebarMenu + property bool expanded: sidebarMenu ? sidebarMenu.open : false + labelVisible: expanded + property bool closeOnClick: true + + onClicked: { + if (sidebarMenu.open && closeOnClick) { + sidebarMenu.open = false + } + } +} \ No newline at end of file diff --git a/contents/ui/SidebarItem.qmlc b/contents/ui/SidebarItem.qmlc new file mode 100644 index 0000000..b64ee43 Binary files /dev/null and b/contents/ui/SidebarItem.qmlc differ diff --git a/contents/ui/SidebarItemRepeater.qml b/contents/ui/SidebarItemRepeater.qml new file mode 100644 index 0000000..61061ce --- /dev/null +++ b/contents/ui/SidebarItemRepeater.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +Repeater { + id: repeater + delegate: SidebarItem { + icon: model.iconName || model.decoration + text: model.name || model.display + sidebarMenu: repeater.parent.parent // SidebarContextMenu { Column { Repeater{} } } + onClicked: { + repeater.parent.parent.open = false // SidebarContextMenu { Column { Repeater{} } } + repeater.model.triggerIndex(index) + } + } +} diff --git a/contents/ui/SidebarItemRepeater.qmlc b/contents/ui/SidebarItemRepeater.qmlc new file mode 100644 index 0000000..b0a8c75 Binary files /dev/null and b/contents/ui/SidebarItemRepeater.qmlc differ diff --git a/contents/ui/SidebarMenu.qml b/contents/ui/SidebarMenu.qml new file mode 100644 index 0000000..5fb7be5 --- /dev/null +++ b/contents/ui/SidebarMenu.qml @@ -0,0 +1,51 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +MouseArea { + id: sidebarMenu + hoverEnabled: true + z: 1 + // clip: true + width: open ? config.sidebarOpenWidth : config.sidebarWidth + property bool open: false + + onOpenChanged: { + if (open) { + forceActiveFocus() + } else { + searchField.forceActiveFocus() + } + } + + Rectangle { + anchors.fill: parent + visible: !plasmoid.configuration.sidebarFollowsTheme + color: config.sidebarBackgroundColor + opacity: parent.open ? 1 : 0.5 + } + + Rectangle { + anchors.fill: parent + visible: plasmoid.configuration.sidebarFollowsTheme + color: theme.backgroundColor + opacity: parent.open ? 1 : 0 + } + PlasmaCore.FrameSvgItem { + anchors.fill: parent + visible: plasmoid.configuration.sidebarFollowsTheme + imagePath: "widgets/frame" + prefix: "raised" + } + + property alias showDropShadow: sidebarMenuShadows.visible + SidebarMenuShadows { + id: sidebarMenuShadows + anchors.fill: parent + visible: !plasmoid.configuration.sidebarFollowsTheme && sidebarMenu.open + } +} diff --git a/contents/ui/SidebarMenu.qmlc b/contents/ui/SidebarMenu.qmlc new file mode 100644 index 0000000..d15d078 Binary files /dev/null and b/contents/ui/SidebarMenu.qmlc differ diff --git a/contents/ui/SidebarMenuShadows.qml b/contents/ui/SidebarMenuShadows.qml new file mode 100644 index 0000000..5915716 --- /dev/null +++ b/contents/ui/SidebarMenuShadows.qml @@ -0,0 +1,58 @@ +import QtQuick 2.0 + +Item { + property int dropShadowSize: 4 * units.devicePixelRatio + property int roundShadowHack: dropShadowSize/2 // "dropShadowSize/2" draws enough to fool the eye. + Rectangle { + id: topShadow + anchors.left: parent.left + anchors.bottom: parent.top + width: parent.width + roundShadowHack + height: dropShadowSize + gradient: Gradient { + GradientStop { position: 0.0; color: "#00000000" } + GradientStop { position: 1.0; color: "#60000000" } + } + } + Rectangle { + id: rightShadow + anchors.bottom: parent.top + anchors.left: parent.right + height: dropShadowSize + width: parent.height + + transformOrigin: Item.BottomLeft + rotation: 90 + + gradient: Gradient { + GradientStop { position: 0.0; color: "#00000000" } + GradientStop { position: 1.0; color: "#60000000" } + } + } + Rectangle { + id: bottomShadow + anchors.left: parent.left + anchors.top: parent.bottom + width: parent.width + roundShadowHack + height: dropShadowSize + gradient: Gradient { + GradientStop { position: 0.0; color: "#90000000" } + GradientStop { position: 1.0; color: "#00000000" } + } + } + Rectangle { + id: leftShadow + anchors.bottom: parent.top + anchors.left: parent.left + height: dropShadowSize + width: parent.height + + transformOrigin: Item.BottomLeft + rotation: 90 + + gradient: Gradient { + GradientStop { position: 0.0; color: "#00000000" } + GradientStop { position: 1.0; color: "#20000000" } + } + } +} diff --git a/contents/ui/SidebarMenuShadows.qmlc b/contents/ui/SidebarMenuShadows.qmlc new file mode 100644 index 0000000..0a35269 Binary files /dev/null and b/contents/ui/SidebarMenuShadows.qmlc differ diff --git a/contents/ui/SidebarView.qml b/contents/ui/SidebarView.qml new file mode 100644 index 0000000..9a2d77b --- /dev/null +++ b/contents/ui/SidebarView.qml @@ -0,0 +1,155 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +import org.kde.draganddrop 2.0 as DragAndDrop +import org.kde.kquickcontrolsaddons 2.0 // KCMShell + +import "Utils.js" as Utils + +Item { + id: sidebarView + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: parent.bottom + z: 1 + + width: sidebarMenu.width + Behavior on width { NumberAnimation { duration: 100 } } + + DragAndDrop.DropArea { + anchors.fill: sidebarMenu + + onDrop: { + if (event && event.mimeData && event.mimeData.url) { + var url = event.mimeData.url.toString() + url = Utils.parseDropUrl(url) + appsModel.sidebarModel.addFavorite(url, 0) + } + } + } + + SidebarMenu { + id: sidebarMenu + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: parent.bottom + + + Column { + id: sidebarMenuTop + width: parent.width + height: childrenRect.height + + SidebarItem { + iconName: 'open-menu-symbolic' + text: i18n("Menu") + closeOnClick: false + onClicked: sidebarMenu.open = !sidebarMenu.open + zoomOnPush: expanded + } + SidebarItem { + iconName: 'view-sort-ascending-symbolic' + text: i18n("Apps") + onClicked: appsView.showAppsAlphabetically() + // checked: stackView.currentItem == appsView + // checkedEdge: Qt.RightEdge + // checkedEdgeWidth: 4 * units.devicePixelRatio // Twice as thick as normal + } + SidebarItem { + iconName: 'view-list-tree' + text: i18n("Categories") + onClicked: appsView.showAppsCategorically() + // checked: stackView.currentItem == appsView + // checkedEdge: Qt.RightEdge + // checkedEdgeWidth: 4 * units.devicePixelRatio // Twice as thick as normal + } + // SidebarItem { + // iconName: 'system-search-symbolic' + // text: i18n("Search") + // onClicked: searchResultsView.showDefaultSearch() + // // checked: stackView.currentItem == searchResultsView + // // checkedEdge: Qt.RightEdge + // // checkedEdgeWidth: 4 * units.devicePixelRatio // Twice as thick as normal + // } + } + Column { + width: parent.width + height: childrenRect.height + anchors.bottom: parent.bottom + + SidebarItem { + iconName: kuser.faceIconUrl ? kuser.faceIconUrl : 'user-identity' + text: kuser.fullName + onClicked: userMenu.open = !userMenu.open + + SidebarContextMenu { + id: userMenu + + SidebarItem { + iconName: 'system-users' + text: i18n("User Manager") + onClicked: KCMShell.open('user_manager') + visible: KCMShell.authorize('user_manager.desktop').length > 0 + } + + SidebarItemRepeater { + model: appsModel.sessionActionsModel + } + } + } + + // Repeater { + // model: appsModel.sidebarModel + // onCountChanged: console.log(count, 'appsModel.sidebarModel', appsModel.sidebarModel) + + // delegate: SidebarItem { + + // } + + // } + SidebarFavouritesView { + model: appsModel.sidebarModel + maxHeight: sidebarMenu.height - sidebarMenuTop.height - 2 * config.flatButtonSize + } + + // SidebarItem { + // iconName: 'folder-open-symbolic' + // text: i18n("File Manager") + // onClicked: appsModel.launch('org.kde.dolphin') + // } + // SidebarItem { + // iconName: 'configure' + // text: i18n("Settings") + // onClicked: appsModel.launch('systemsettings') + // } + + SidebarItem { + iconName: 'system-shutdown-symbolic' + text: i18n("Power") + onClicked: powerMenu.open = !powerMenu.open + + SidebarContextMenu { + id: powerMenu + + SidebarItemRepeater { + model: appsModel.powerActionsModel + } + } + } + } + + onFocusChanged: { + logger.debug('searchView.onFocusChanged', focus) + if (!focus) { + open = false + } + } + } + + +} diff --git a/contents/ui/SidebarView.qmlc b/contents/ui/SidebarView.qmlc new file mode 100644 index 0000000..d3141b7 Binary files /dev/null and b/contents/ui/SidebarView.qmlc differ diff --git a/contents/ui/TileDataModel.qml b/contents/ui/TileDataModel.qml new file mode 100644 index 0000000..3c85d92 --- /dev/null +++ b/contents/ui/TileDataModel.qml @@ -0,0 +1,56 @@ +import QtQuick 2.0 + +Item { + id: tileData + property string configKey: 'tileData' + property variant value: { return {} } + property variant defaultValue: { return {} } + property bool writing: false + + function set(obj) { + writing = true + setBase64Json(configKey, obj) + writing = false + } + + function load() { + // console.log('plasmoid.configuration[key]', plasmoid.configuration[configKey]) + value = getBase64Json(configKey, defaultValue) + // console.log(configKey, 'load()', value, defaultValue) + // console.log('discover', getTileData("org.kde.dolphin.desktop").label) + // console.log('discover', value["org.kde.dolphin.desktop"].label) + } + + Connections { + target: plasmoid.configuration + onTileDataChanged: { + tileData.load() + } + } + + Component.onCompleted: { + // console.log('tileData.value', value) + // console.log('tileData.defaultValue', defaultValue) + // console.log('plasmoid.configuration[key]', plasmoid.configuration[configKey]) + tileData.load() + } + + // function getTileData(url) { + // // console.log('getTileData', url.toString()) + // // console.log('getTileData', url, value[url.toString()]) + // var tile = value[url] || {} + // tile.x = tile.x || -1 + // tile.y = tile.y || -1 + // tile.size = tile.size || "2x2" + // tile.label = tile.label || "" + // return tile + // } + + function setItemProperty(itemKey, key, value) { + var item = value[itemKey] || {} + item[key] = value + value[itemKey] = item + set(value) + valueChanged() + } +} diff --git a/contents/ui/TileEditorColorField.qml b/contents/ui/TileEditorColorField.qml new file mode 100644 index 0000000..01d9047 --- /dev/null +++ b/contents/ui/TileEditorColorField.qml @@ -0,0 +1,95 @@ +import QtQuick 2.2 +import QtQuick.Window 2.1 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.0 +import QtQuick.Dialogs 1.0 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.extras 2.0 as PlasmaExtras + +import "lib" + +GroupBox { + id: tileEditorColorField + title: "Label" + implicitWidth: parent.implicitWidth + Layout.fillWidth: true + property alias placeholderText: textField.placeholderText + property alias enabled: textField.enabled + property string key: '' + + style: GroupBoxStyle {} + + RowLayout { + anchors.fill: parent + + MouseArea { + id: mouseArea + width: textField.height + height: textField.height + hoverEnabled: true + + onClicked: dialog.open() + + Rectangle { + anchors.fill: parent + color: textField.text + border.width: 3 + border.color: mouseArea.containsMouse ? theme.highlightColor : theme.backgroundColor + + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + border.width: 1 + border.color: mouseArea.containsMouse ? theme.highlightColor : theme.textColor + } + } + + ColorDialog { + id: dialog + visible: false + // modality: Qt.WindowModal // Don't dim the menu + title: tileEditorColorField.title + showAlphaChannel: true + color: textField.text + onCurrentColorChanged: { + if (visible && color != currentColor) { + textField.text = currentColor + } + } + } + } + + PlasmaComponents.TextField { + id: textField + Layout.fillWidth: true + text: key && appObj.tile && appObj.tile[key] ? appObj.tile[key] : '' + property bool updateOnChange: false + onTextChanged: { + if (key && updateOnChange) { + if (text) { + appObj.tile[key] = text + } else { + delete appObj.tile[key] + } + appObj.tileChanged() + tileGrid.tileModelChanged() + } + } + + Connections { + target: appObj + + onTileChanged: { + if (key && tile) { + textField.updateOnChange = false + textField.text = appObj.tile[key] || '' + textField.updateOnChange = true + } + } + } + } + } +} diff --git a/contents/ui/TileEditorColorField.qmlc b/contents/ui/TileEditorColorField.qmlc new file mode 100644 index 0000000..af70629 Binary files /dev/null and b/contents/ui/TileEditorColorField.qmlc differ diff --git a/contents/ui/TileEditorField.qml b/contents/ui/TileEditorField.qml new file mode 100644 index 0000000..db1ae23 --- /dev/null +++ b/contents/ui/TileEditorField.qml @@ -0,0 +1,88 @@ +import QtQuick 2.2 +import QtQuick.Window 2.1 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.0 +import QtQuick.Dialogs 1.0 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.extras 2.0 as PlasmaExtras +import QtQuick.Controls.Styles.Plasma 2.0 as PlasmaStyles + +import "lib" + +GroupBox { + id: tileEditorField + title: "Label" + Layout.fillWidth: true + property alias text: textField.text + property alias placeholderText: textField.placeholderText + property alias enabled: textField.enabled + property string key: '' + property string checkedKey: '' + checkable: checkedKey + property bool checkedDefault: true + + property bool updateOnChange: false + onCheckedChanged: { + if (checkedKey && tileEditorField.updateOnChange) { + appObj.tile[checkedKey] = checked + appObj.tileChanged() + tileGrid.tileModelChanged() + } + } + + default property alias _contentChildren: content.data + + Connections { + target: appObj + + onTileChanged: { + if (checkedKey && tile) { + tileEditorField.updateOnChange = false + tileEditorField.checked = typeof appObj.tile[checkedKey] !== "undefined" ? appObj.tile[checkedKey] : checkedDefault + tileEditorField.updateOnChange = true + } + } + } + + style: PlasmaStyles.GroupBoxStyle {} + + RowLayout { + id: content + anchors.left: parent.left + anchors.right: parent.right + + PlasmaComponents.TextField { + id: textField + Layout.fillWidth: true + text: key && appObj.tile && appObj.tile[key] ? appObj.tile[key] : '' + property bool updateOnChange: false + onTextChanged: { + if (key && textField.updateOnChange) { + appObj.tile[key] = text + appObj.tileChanged() + tileGrid.tileModelChanged() + } + } + + Connections { + target: appObj + + onTileChanged: { + if (key && tile) { + textField.updateOnChange = false + textField.text = appObj.tile[key] || '' + textField.updateOnChange = true + } + } + } + } + + Component.onDestruction: { + while (children.length > 0) { + children[children.length - 1].parent = tileEditorField + } + } + } +} diff --git a/contents/ui/TileEditorField.qmlc b/contents/ui/TileEditorField.qmlc new file mode 100644 index 0000000..c377a5b Binary files /dev/null and b/contents/ui/TileEditorField.qmlc differ diff --git a/contents/ui/TileEditorRectField.qml b/contents/ui/TileEditorRectField.qml new file mode 100644 index 0000000..7c5f914 --- /dev/null +++ b/contents/ui/TileEditorRectField.qml @@ -0,0 +1,90 @@ +import QtQuick 2.2 +import QtQuick.Window 2.1 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.0 +import QtQuick.Dialogs 1.0 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.extras 2.0 as PlasmaExtras + +import "lib" + +GroupBox { + id: tileEditorRectField + title: "Label" + implicitWidth: parent.implicitWidth + Layout.fillWidth: true + + // readonly property int xLeft: tileGrid.columns - (appObj.tileX + appObj.tileW) + + style: GroupBoxStyle {} + + RowLayout { + anchors.fill: parent + + ColumnLayout { + Layout.fillWidth: true + + RowLayout { + PlasmaComponents.Label { text: "x:" } + TileEditorSpinBox { + key: 'x' + minimumValue: 0 + // maximumValue: tileGrid.columns - (appObj.tile && appObj.tile.w-1 || 0) + // maximumValue: appObj.tileX + tileEditorRectField.xLeft + } + } + RowLayout { + PlasmaComponents.Label { text: "y:" } + TileEditorSpinBox { + key: 'y' + minimumValue: 0 + } + } + RowLayout { + PlasmaComponents.Label { text: "w:" } + TileEditorSpinBox { + key: 'w' + minimumValue: 1 + // maximumValue: tileGrid.columns - (appObj.tile && appObj.tile.x || 0) + // maximumValue: appObj.tileW + tileEditorRectField.xLeft + } + } + RowLayout { + PlasmaComponents.Label { text: "h:" } + TileEditorSpinBox { + key: 'h' + minimumValue: 1 + } + } + } + + GridLayout { + id: resizeGrid + Layout.fillWidth: true + rows: 4 + columns: 4 + + Repeater { + model: resizeGrid.rows * resizeGrid.columns + + PlasmaComponents.Button { + Layout.fillWidth: true + implicitWidth: 20 + property int w: (modelData % resizeGrid.columns) + 1 + property int h: Math.floor(modelData / resizeGrid.columns) + 1 + text: '' + w + 'x' + h + checked: w <= appObj.tileW && h <= appObj.tileH + // enabled: w - appObj.tileW <= tileEditorRectField.xLeft + onClicked: { + appObj.tile.w = w + appObj.tile.h = h + appObj.tileChanged() + tileGrid.tileModelChanged() + } + } + } + } + } +} diff --git a/contents/ui/TileEditorRectField.qmlc b/contents/ui/TileEditorRectField.qmlc new file mode 100644 index 0000000..9e78685 Binary files /dev/null and b/contents/ui/TileEditorRectField.qmlc differ diff --git a/contents/ui/TileEditorSpinBox.qml b/contents/ui/TileEditorSpinBox.qml new file mode 100644 index 0000000..ca144f0 --- /dev/null +++ b/contents/ui/TileEditorSpinBox.qml @@ -0,0 +1,38 @@ +import QtQuick 2.2 +import QtQuick.Window 2.1 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.0 +import QtQuick.Dialogs 1.0 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.extras 2.0 as PlasmaExtras + +SpinBox { + id: spinBox + property string key: '' + Layout.fillWidth: true + implicitWidth: 20 + Layout.minimumWidth: 20 + value: appObj.tile && appObj.tile[key] || 0 + property bool updateOnChange: false + onValueChanged: { + if (key && updateOnChange) { + appObj.tile[key] = value + appObj.tileChanged() + tileGrid.tileModelChanged() + } + } + + Connections { + target: appObj + + onTileChanged: { + if (key && tile) { + spinBox.updateOnChange = false + spinBox.value = appObj.tile[key] || 0 + spinBox.updateOnChange = true + } + } + } +} diff --git a/contents/ui/TileEditorSpinBox.qmlc b/contents/ui/TileEditorSpinBox.qmlc new file mode 100644 index 0000000..be0e47b Binary files /dev/null and b/contents/ui/TileEditorSpinBox.qmlc differ diff --git a/contents/ui/TileEditorView.qml b/contents/ui/TileEditorView.qml new file mode 100644 index 0000000..663a8cb --- /dev/null +++ b/contents/ui/TileEditorView.qml @@ -0,0 +1,177 @@ +import QtQuick 2.2 +import QtQuick.Window 2.1 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.0 +import QtQuick.Dialogs 1.0 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.extras 2.0 as PlasmaExtras +import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons + +import "./config" + +ColumnLayout { + id: tileEditorView + Layout.alignment: Qt.AlignTop + + AppObject { + id: appObj + } + property alias tile: appObj.tile + + function resetView() { + tile = null + } + + function resetTile() { + delete appObj.tile.showIcon + delete appObj.tile.showLabel + delete appObj.tile.label + delete appObj.tile.icon + delete appObj.tile.backgroundColor + delete appObj.tile.backgroundImage + appObj.tileChanged() + tileGrid.tileModelChanged() + } + + + RowLayout { + PlasmaExtras.Heading { + Layout.fillWidth: true + level: 2 + text: i18n("Edit Tile") + } + + PlasmaComponents.Button { + text: i18n("Reset Tile") + onClicked: resetTile() + } + + PlasmaComponents.Button { + text: i18n("Close") + onClicked: { + tileEditorView.close() + } + } + } + + + ScrollView { + id: scrollView + Layout.fillHeight: true + Layout.fillWidth: true + + readonly property int viewportWidth: viewport ? viewport.width : 0 + + ColumnLayout { + id: scrollContent + width: scrollView.viewportWidth + + TileEditorField { + visible: appObj.isLauncher + title: i18n("Url") + key: 'url' + } + + TileEditorField { + id: labelField + title: i18n("Label") + placeholderText: appObj.appLabel + key: 'label' + checkedKey: 'showLabel' + } + + TileEditorField { + id: iconField + title: i18n("Icon") + // placeholderText: appObj.appIcon ? appObj.appIcon.toString() : '' + key: 'icon' + checkedKey: 'showIcon' + checkedDefault: appObj.defaultShowIcon + + PlasmaComponents.Button { + iconName: "document-open" + onClicked: iconDialog.open() + + KQuickAddons.IconDialog { + id: iconDialog + onIconNameChanged: iconField.text = iconName + } + } + } + + TileEditorField { + id: backgroundImageField + title: i18n("Background Image") + key: 'backgroundImage' + + PlasmaComponents.Button { + iconName: 'document-open' + onClicked: imagePicker.open() + + FileDialog { + id: imagePicker + + title: i18n("Choose an image") + + selectFolder: false + selectMultiple: false + + nameFilters: [ i18n("Image Files (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)") ] + + onFileUrlChanged: { + backgroundImageField.text = fileUrl + if (fileUrl) { + labelField.checked = false + iconField.checked = false + } + } + } + } + } + + TileEditorColorField { + title: i18n("Background Color") + placeholderText: config.defaultTileColor + key: 'backgroundColor' + } + + TileEditorRectField { + title: i18n("Position / Size") + } + + Item { // Consume the extra space below + Layout.fillHeight: true + } + } + } + + function show() { + if (stackView.currentItem != tileEditorView) { + stackView.push(tileEditorView, true) + } + } + + function open(tile) { + resetView() + tileEditorView.tile = tile + show() + } + + function close() { + appsView.show() + } + + + Connections { + target: stackView + + onCurrentItemChanged: { + if (stackView.currentItem != tileEditorView) { + tileEditorView.resetView() + } + } + } + +} diff --git a/contents/ui/TileEditorView.qmlc b/contents/ui/TileEditorView.qmlc new file mode 100644 index 0000000..5f737d8 Binary files /dev/null and b/contents/ui/TileEditorView.qmlc differ diff --git a/contents/ui/TileGrid.qml b/contents/ui/TileGrid.qml new file mode 100644 index 0000000..f2d05d5 --- /dev/null +++ b/contents/ui/TileGrid.qml @@ -0,0 +1,527 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.draganddrop 2.0 as DragAndDrop +import org.kde.plasma.private.kicker 0.1 as Kicker +import org.kde.kquickcontrolsaddons 2.0 + +// MouseArea { +DragAndDrop.DropArea { + id: tileGrid + + // hoverEnabled: true + property bool isDragging: cellRepeater.dropping + + property int cellSize: 60 * units.devicePixelRatio + property real cellMargin: 3 * units.devicePixelRatio + property real cellPushedMargin: 6 * units.devicePixelRatio + property int cellBoxSize: cellMargin + cellSize + cellMargin + property int hoverOutlineSize: 2 * units.devicePixelRatio + + property int minColumns: Math.floor(width / cellBoxSize) + property int minRows: Math.floor(height / cellBoxSize) + + property int maxColumn: 0 + property int maxRow: 0 + property int maxWidth: 0 + property int maxHeight: 0 + property int columns: Math.max(minColumns, maxColumn) + property int rows: Math.max(minRows, maxRow) + + property var addedItem: null + readonly property bool adding: addedItem + property int draggedIndex: -1 + readonly property var draggedItem: draggedIndex >= 0 ? tileModel[draggedIndex] : null + property bool editing: isDragging && draggedItem || adding + property int dropHoverX: -1 + property int dropHoverY: -1 + property int dropOffsetX: 0 + property int dropOffsetY: 0 + readonly property int dropWidth: draggedItem ? draggedItem.w : addedItem ? addedItem.w : 0 + readonly property int dropHeight: draggedItem ? draggedItem.h : addedItem ? addedItem.h : 0 + property bool canDrop: false + function resetDragHover() { + dropHoverX = -1 + dropHoverY = -1 + dropOffsetX = 0 + dropOffsetY = 0 + scrollUpArea.containsDrag = false + scrollDownArea.containsDrag = false + addedItem = null + } + function resetDrag() { + resetDragHover() + cellRepeater.dropping = false + draggedIndex = -1 + } + function startDrag(index) { + draggedIndex = index + dropHoverX = draggedItem.x + dropHoverY = draggedItem.y + cellRepeater.dropping = true + } + + + onDrop: { + // console.log('onDrop', JSON.stringify(draggedItem)) + if (draggedItem) { + draggedItem.x = dropHoverX + draggedItem.y = dropHoverY + tileGrid.tileModelChanged() + tileGrid.resetDrag() + // event.accept(Qt.MoveAction) + } else if (addedItem) { + addedItem.x = dropHoverX + addedItem.y = dropHoverY + tileGrid.tileModel.push(addedItem) + tileGrid.tileModelChanged() + tileGrid.resetDrag() + } + } + function parseDropUrl(url) { + var workingDir = Qt.resolvedUrl('.') + var endsWithDesktop = url.indexOf('.desktop') === url.length - '.desktop'.length + var isRelativeDesktopUrl = endsWithDesktop && ( + url.indexOf(workingDir) === 0 + // || url.indexOf('file:///usr/share/applications/') === 0 + // || url.indexOf('/.local/share/applications/') >= 0 + || url.indexOf('/share/applications/') >= 0 // 99% certain this desktop file should be accessed relatively. + ) + logger.debug('parseDropUrl', workingDir, endsWithDesktop, isRelativeDesktopUrl) + logger.debug('onUrlDropped', 'url', url) + if (isRelativeDesktopUrl) { + // Remove the path because .favoriteId is just the file name. + // However passing the favoriteId in mimeData.url will prefix the current QML path because it's a QUrl. + var tokens = url.toString().split('/') + var favoriteId = tokens[tokens.length-1] + logger.debug('isRelativeDesktopUrl', tokens, favoriteId) + return favoriteId + } else { + return url + } + } + + function dragTick(event) { + var dragX = event.x + scrollView.flickableItem.contentX - dropOffsetX + var dragY = event.y + scrollView.flickableItem.contentY - dropOffsetY + var modelX = Math.floor(dragX / cellBoxSize) + var modelY = Math.floor(dragY / cellBoxSize) + // console.log('onDragMove', event.x, event.y, modelX, modelY) + scrollUpArea.checkContains(event) + scrollDownArea.checkContains(event) + + if (draggedItem) { + } else if (addedItem) { + } else if (event && event.mimeData && event.mimeData.url) { + var url = event.mimeData.url.toString() + // console.log('new addedItem', event.mimeData.url, url) + url = parseDropUrl(url) + + addedItem = newTile(url) + dropHoverX = modelX + dropHoverY = modelY + } else { + return + } + + dropHoverX = Math.max(0, Math.min(modelX, columns - dropWidth)) + dropHoverY = Math.max(0, modelY) + canDrop = !hits(dropHoverX, dropHoverY, dropWidth, dropHeight) + } + onDragEnter: dragTick(event) + onDragMove: dragTick(event) + onDragLeave: { + // console.log('onExited') + resetDragHover() + } + + property var hitBox: [] // hitBox[y][x] + function updateSize() { + var c = 0; + var r = 0; + var w = 1; + var h = 1; + for (var i = 0; i < tileModel.length; i++) { + var tile = tileModel[i] + c = Math.max(c, tile.x + tile.w) + r = Math.max(r, tile.y + tile.h) + w = Math.max(w, tile.w) + h = Math.max(h, tile.h) + } + // Add extra rows when dragging so we can drop scrolled down + if (draggedItem) { + // c += draggedItem.w + r += draggedItem.h + } + + // Rebuild hitBox + var hbColumns = Math.max(minColumns, c) + var hbRows = Math.max(minRows, r) + var hb = new Array(hbRows) + for (var i = 0; i < hbRows; i++) { + hb[i] = new Array(hbColumns) + } + for (var i = 0; i < tileModel.length; i++) { + var tile = tileModel[i] + if (i == draggedIndex) { + continue; + } + for (var j = tile.y; j < tile.y + tile.h; j++) { + for (var k = tile.x; k < tile.x + tile.w; k++) { + hb[j][k] = true + } + } + } + + // Update Properties + hitBox = hb + maxColumn = c + maxRow = r + maxWidth = w + maxHeight = h + } + function update() { + var urlList = [] + for (var i = 0; i < tileModel.length; i++) { + var tile = tileModel[i] + if (tile.url) { + urlList.push(tile.url) + } + } + appsModel.tileGridModel.favorites = urlList + updateSize() + } + onDraggedItemChanged: update() + onTileModelChanged: update() + property var tileModel: [] + + + function hits(x, y, w, h) { + // console.log('hits', [columns,rows], [x,y,w,h], hitBox) + for (var j = y; j < y + h; j++) { + if (j < 0 || j >= hitBox.length) { + continue; // Should we return true when out of bounds? + } + for (var k = x; k < x + w; k++) { + if (k < 0 || k >= hitBox[j].length) { + continue; // Should we return true when out of bounds? + } + if (hitBox[j][k]) { + return true + } + } + } + return false + } + + + ScrollView { + id: scrollView + anchors.fill: parent + + readonly property int scrollTop: flickableItem ? flickableItem.contentY : 0 + readonly property int scrollHeight: flickableItem ? flickableItem.contentHeight : 0 + readonly property int scrollTopAtBottom: viewport ? scrollHeight - viewport.height : 0 + readonly property bool scrollAtTop: scrollTop == 0 + readonly property bool scrollAtBottom: scrollTop >= scrollTopAtBottom + + function scrollBy(deltaY) { + if (flickableItem) { + // console.log('scrollHeight', scrollTopAtBottom, scrollHeight, viewport.height) + flickableItem.contentY = Math.max(0, Math.min(scrollTop + deltaY, scrollTopAtBottom)) + } + } + + __wheelAreaScrollSpeed: cellBoxSize + style: ScrollViewStyle { + transientScrollBars: true + } + + Item { + id: scrollItem + + width: columns * cellBoxSize + height: rows * cellBoxSize + + // Rectangle { + // anchors.fill: parent + // color: "#88336699" + // } + + Repeater { + id: cellRepeater + property int cellCount: columns * rows + property bool dropping: false + onCellCountChanged: { + if (!dropping) { + model = cellCount + } + } + model: 0 + + Item { + id: cellItem + property int modelX: modelData % columns + property int modelY: Math.floor(modelData / columns) + x: modelX * cellBoxSize + y: modelY * cellBoxSize + width: cellBoxSize + height: cellBoxSize + + property bool hovered: { + if (tileGrid.editing && dropHoverX >= 0 && dropHoverY >= 0) { + return dropHoverX <= modelX && modelX < dropHoverX + dropWidth && dropHoverY <= modelY && modelY < dropHoverY + dropHeight + } else { + return false + } + } + + Rectangle { + anchors.fill: parent + anchors.margins: cellMargin + color: { + if (cellItem.hovered) { + if (canDrop) { + return "#88336699" + } else { + return "#88880000" + } + } else { + return "transparent" + } + } + border.width: 1 + border.color: tileGrid.editing ? "#44000000" : "transparent" + } + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.RightButton + onClicked: { + if (mouse.button == Qt.RightButton) { + cellContextMenu.cellX = cellItem.modelX + cellContextMenu.cellY = cellItem.modelY + var pos = mapToItem(scrollItem, mouse.x, mouse.y) // cellContextMenu is a child of scrollItem + cellContextMenu.open(pos.x, pos.y) + } + } + + } + } + } + PlasmaComponents.ContextMenu { + id: cellContextMenu + property int cellX: -1 + property int cellY: -1 + + PlasmaComponents.MenuItem { + icon: "group-new" + text: i18n("New Group") + visible: !plasmoid.configuration.tilesLocked + onClicked: { + var tile = tileGrid.addGroup(cellContextMenu.cellX, cellContextMenu.cellY) + tileGrid.editTile(tile) + } + } + + PlasmaComponents.MenuItem { + icon: plasmoid.configuration.tilesLocked ? "object-unlocked" : "object-locked" + text: plasmoid.configuration.tilesLocked ? i18n("Unlock Tiles") : i18n("Lock Tiles") + onClicked: { + plasmoid.configuration.tilesLocked = !plasmoid.configuration.tilesLocked + } + } + } + + Repeater { + id: tileModelRepeater + model: tileModel + // onCountChanged: console.log('onCountChanged', count) + + TileItem { + id: tileItem + } + + } + } + } + + /* Scroll on hover with drag */ + property int scrollAreaTickDelta: cellBoxSize + property int scrollAreaTickInterval: 200 + property int scrollAreaSize: Math.min(cellBoxSize * 1.5, scrollView.height / 5) // 20vh or 90pt + + Item { + id: scrollUpArea + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + height: scrollAreaSize + property bool active: !scrollView.scrollAtTop + property bool containsDrag: false + property bool ticking: active && containsDrag + + function checkContains(event) { + containsDrag = scrollUpArea.contains(Qt.point(event.x, event.y)) + } + + Timer { + id: scrollUpTicker + interval: scrollAreaTickInterval + repeat: true + running: parent.ticking + onTriggered: { + scrollView.scrollBy(-scrollAreaTickDelta) + } + } + + Rectangle { + anchors.fill: parent + opacity: parent.ticking ? 1 : 0 + gradient: Gradient { + GradientStop { position: 0.0; color: theme.highlightColor } + GradientStop { position: 0.3; color: "transparent" } + } + } + } + + Item { + id: scrollDownArea + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: scrollAreaSize + property bool active: !scrollView.scrollAtBottom + property bool containsDrag: false + property bool ticking: active && containsDrag + + function checkContains(event) { + var mouseY = event.y - (parent.height - height) + containsDrag = scrollDownArea.contains(Qt.point(event.x, mouseY)) + } + + Timer { + id: scrollDownTicker + interval: scrollAreaTickInterval + repeat: true + running: parent.ticking + onTriggered: { + scrollView.scrollBy(scrollAreaTickDelta) + } + } + + Rectangle { + anchors.fill: parent + opacity: parent.ticking ? 1 : 0 + gradient: Gradient { + GradientStop { position: 0.7; color: "transparent" } + GradientStop { position: 1.0; color: theme.highlightColor } + } + } + } + + function newTile(url) { + return { + "x": 0, + "y": 0, + "w": 2, + "h": 2, + "url": url, + } + } + + function removeIndex(i) { + tileModel.splice(i, 1) // remove 1 item at index + tileModelChanged() + } + + function removeApp(url) { + var removedCount = 0 + for (var i = tileModel.length - 1; i >= 0; i--) { + var tile = tileModel[i] + if (tile.url == url) { + removedCount += 1 + tileModel.splice(i, 1) // remove 1 item at index + } + } + if (removedCount > 0) { + tileModelChanged() + } + } + + function addTile(tile) { + tileModel.push(tile) + tileModelChanged() + } + + function findOpenPos(w, h) { + for (var y = 0; y < rows; y++) { + for (var x = 0; x < columns - (w-1); x++) { + if (hits(x, y, w, h)) + continue + + // Room open for + return { + x: x, + y: y, + } + } + } + + // Current grid has no room. + // Add to new row. + return { + x: 0, + y: rows + } + } + + function parseTileXY(tile, x, y) { + if (typeof x !== "undefined" && typeof y !== "undefined") { + tile.x = x + tile.y = y + } else { + var openPos = findOpenPos(tile.w, tile.h) + tile.x = openPos.x + tile.y = openPos.y + } + } + function addApp(url, x, y) { + var tile = newTile(url) + parseTileXY(tile, x, y) + tileModel.push(tile) + tileModelChanged() + return tile + } + + function hasAppTile(url) { + for (var i = 0; i < tileModel.length; i++) { + var tile = tileModel[i] + if (tile.url == url) { + return true + } + } + return false + } + + function limit(minValue, value, maxValue) { + return Math.max(minValue, Math.min(value, maxValue)) + } + function addGroup(x, y) { + var tile = newTile("") + parseTileXY(tile, x, y) + tile.tileType = "group" + tile.label = i18nc("default group label", "Group") + tile.w = limit(2, columns-x, 6) // 6 unless we have less columns. + tile.h = 1 + tileModel.push(tile) + tileModelChanged() + return tile + } + + signal editTile(var tile) +} diff --git a/contents/ui/TileGrid.qmlc b/contents/ui/TileGrid.qmlc new file mode 100644 index 0000000..e7caf03 Binary files /dev/null and b/contents/ui/TileGrid.qmlc differ diff --git a/contents/ui/TileItem.qml b/contents/ui/TileItem.qml new file mode 100644 index 0000000..747b41a --- /dev/null +++ b/contents/ui/TileItem.qml @@ -0,0 +1,121 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.draganddrop 2.0 as DragAndDrop +import QtGraphicalEffects 1.0 + +Item { + id: tileItem + x: modelData.x * cellBoxSize + y: modelData.y * cellBoxSize + width: modelData.w * cellBoxSize + height: modelData.h * cellBoxSize + + AppObject { + id: appObj + tile: modelData + } + readonly property alias app: appObj.app + + readonly property bool faded: tileGrid.editing || tileMouseArea.isLeftPressed + readonly property int fadedWidth: width - cellPushedMargin + opacity: faded ? 0.75 : 1 + scale: faded ? fadedWidth / width : 1 + Behavior on opacity { NumberAnimation { duration: 200 } } + Behavior on scale { NumberAnimation { duration: 200 } } + + //--- View Start + TileItemView { + id: tileItemView + anchors.fill: parent + anchors.margins: cellMargin + width: modelData.w * cellBoxSize + height: modelData.h * cellBoxSize + readonly property int minSize: Math.min(width, height) + hovered: tileMouseArea.containsMouse + } + + HoverOutlineEffect { + id: hoverOutlineEffect + anchors.fill: parent + anchors.margins: cellMargin + hoverRadius: tileItemView.minSize + hoverOutlineSize: tileGrid.hoverOutlineSize + property alias control: tileMouseArea + } + + //--- View End + + DragAndDrop.DragArea { + anchors.fill: parent + enabled: !plasmoid.configuration.tilesLocked + delegate: tileItemView + onDragStarted: { + console.log('onDragStarted', JSON.stringify(modelData), index, tileModel.length) + // tileGrid.draggedItem = tileModel.splice(index, 1)[0] + tileGrid.startDrag(index) + tileGrid.dropOffsetX = Math.floor(tileMouseArea.mouseX / cellBoxSize) * cellBoxSize + tileGrid.dropOffsetY = Math.floor(tileMouseArea.mouseY / cellBoxSize) * cellBoxSize + } + onDrop: { + console.log('DragArea.onDrop', draggedItem) + tileGrid.resetDrag() + } + + MouseArea { + id: tileMouseArea + anchors.fill: parent + hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton + cursorShape: editing ? Qt.ClosedHandCursor : Qt.ArrowCursor + readonly property bool isLeftPressed: pressedButtons & Qt.LeftButton + + // This MouseArea will spam "QQuickItem::ungrabMouse(): Item is not the mouse grabber." + // but there's no other way of having a clickable drag area. + onClicked: { + mouse.accepted = true + if (mouse.button == Qt.LeftButton) { + if (tileEditorView && tileEditorView.tile) { + openTileEditor() + } else { + appsModel.tileGridModel.runApp(modelData.url) + } + } else if (mouse.button == Qt.RightButton) { + contextMenu.open(mouse.x, mouse.y) + } + } + } + } + + AppContextMenu { + id: contextMenu + tileIndex: index + onPopulateMenu: { + if (!plasmoid.configuration.tilesLocked) { + menu.addPinToMenuAction(modelData.url) + } + + appObj.addActionList(menu) + + if (!plasmoid.configuration.tilesLocked) { + var menuItem = menu.newMenuItem() + menuItem.text = i18n("Edit Tile") + menuItem.icon = 'rectangle-shape' + menuItem.onClicked.connect(function(){ + tileItem.openTileEditor() + }) + } + } + } + + function openTileEditor() { + tileGrid.editTile(tileGrid.tileModel[index]) + } + function closeTileEditor() { + + } +} diff --git a/contents/ui/TileItem.qmlc b/contents/ui/TileItem.qmlc new file mode 100644 index 0000000..590be5d Binary files /dev/null and b/contents/ui/TileItem.qmlc differ diff --git a/contents/ui/TileItemView.qml b/contents/ui/TileItemView.qml new file mode 100644 index 0000000..fcb877f --- /dev/null +++ b/contents/ui/TileItemView.qml @@ -0,0 +1,96 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.draganddrop 2.0 as DragAndDrop + +Rectangle { + id: tileItemView + color: appObj.backgroundColor + + readonly property int smallIconSize: 32 * units.devicePixelRatio + readonly property int mediumIconSize: 72 * units.devicePixelRatio + readonly property int largeIconSize: 96 * units.devicePixelRatio + + readonly property int tileLabelAlignment: config.tileLabelAlignment + + property bool hovered: false + + states: [ + State { + when: modelData.w == 1 && modelData.h >= 1 + PropertyChanges { target: icon; size: smallIconSize } + PropertyChanges { target: label; visible: false } + }, + State { + when: modelData.w >= 2 && modelData.h == 1 + AnchorChanges { target: icon + anchors.horizontalCenter: undefined + anchors.left: tileItemView.left + } + PropertyChanges { target: icon; anchors.leftMargin: 4 } + AnchorChanges { target: label + anchors.verticalCenter: tileItemView.verticalCenter + anchors.left: icon.right + anchors.bottom: undefined + anchors.right: tileItemView.right + } + }, + State { + when: modelData.w == 2 && modelData.h == 2 + PropertyChanges { target: icon; size: mediumIconSize } + }, + State { + when: modelData.w == 4 && modelData.h == 2 + PropertyChanges { target: icon; size: mediumIconSize } + }, + State { + when: modelData.w == 4 && modelData.h == 4 + PropertyChanges { target: icon; size: largeIconSize } + } + ] + + Image { + id: backgroundImage + anchors.fill: parent + visible: appObj.backgroundImage + source: appObj.backgroundImage + fillMode: Image.PreserveAspectCrop + asynchronous: true + } + + PlasmaCore.IconItem { + id: icon + visible: appObj.showIcon + source: appObj.iconSource + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + // property int size: 72 // Just a default, overriden in State change + property int size: Math.min(parent.width, parent.height) / 2 + width: appObj.showIcon ? size : 0 + height: appObj.showIcon ? size : 0 + anchors.fill: appObj.iconFill ? parent : null + smooth: appObj.iconFill + } + + PlasmaComponents.Label { + id: label + visible: appObj.showLabel + text: appObj.labelText + anchors.leftMargin: 4 + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.rightMargin: 4 + wrapMode: Text.Wrap + horizontalAlignment: tileLabelAlignment + width: parent.width + font.pointSize: 10 + renderType: Text.QtRendering // Fix pixelation when scaling. Plasma.Label uses NativeRendering. + style: Text.Outline + styleColor: tileItemView.color + } +} diff --git a/contents/ui/TileItemView.qmlc b/contents/ui/TileItemView.qmlc new file mode 100644 index 0000000..5d27d95 Binary files /dev/null and b/contents/ui/TileItemView.qmlc differ diff --git a/contents/ui/Utils.js b/contents/ui/Utils.js new file mode 100644 index 0000000..d6f0e87 --- /dev/null +++ b/contents/ui/Utils.js @@ -0,0 +1,24 @@ +.pragma library + +function parseDropUrl(url) { + var workingDir = Qt.resolvedUrl('.') + var endsWithDesktop = url.indexOf('.desktop') === url.length - '.desktop'.length + var isRelativeDesktopUrl = endsWithDesktop && ( + url.indexOf(workingDir) === 0 + // || url.indexOf('file:///usr/share/applications/') === 0 + // || url.indexOf('/.local/share/applications/') >= 0 + || url.indexOf('/share/applications/') >= 0 // 99% certain this desktop file should be accessed relatively. + ) + // logger.debug('parseDropUrl', workingDir, endsWithDesktop, isRelativeDesktopUrl) + // logger.debug('onUrlDropped', 'url', url) + if (isRelativeDesktopUrl) { + // Remove the path because .favoriteId is just the file name. + // However passing the favoriteId in mimeData.url will prefix the current QML path because it's a QUrl. + var tokens = url.toString().split('/') + var favoriteId = tokens[tokens.length-1] + // logger.debug('isRelativeDesktopUrl', tokens, favoriteId) + return favoriteId + } else { + return url + } +} diff --git a/contents/ui/Utils.jsc b/contents/ui/Utils.jsc new file mode 100644 index 0000000..45e85fc Binary files /dev/null and b/contents/ui/Utils.jsc differ diff --git a/contents/ui/XdgPaths.qml b/contents/ui/XdgPaths.qml new file mode 100644 index 0000000..b6655df --- /dev/null +++ b/contents/ui/XdgPaths.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 +import Qt.labs.platform 1.0 // StandardPaths (Qt 5.8+) + +QtObject { + id: xdgPaths + + readonly property string documents: StandardPaths.displayName(StandardPaths.DocumentsLocation) + readonly property string download: StandardPaths.displayName(StandardPaths.DownloadLocation) + readonly property string music: StandardPaths.displayName(StandardPaths.MusicLocation) + readonly property string pictures: StandardPaths.displayName(StandardPaths.PicturesLocation) + readonly property string movies: StandardPaths.displayName(StandardPaths.MoviesLocation) +} diff --git a/contents/ui/XdgPathsLoader.qml b/contents/ui/XdgPathsLoader.qml new file mode 100644 index 0000000..853c0c8 --- /dev/null +++ b/contents/ui/XdgPathsLoader.qml @@ -0,0 +1,18 @@ +import QtQuick 2.0 + +Loader { + id: xdgPathsLoader + source: "XdgPaths.qml" + + function displayName(type) { + var key = type.toLowerCase() + if (key == 'videos') { + key = 'movies' + } + if (xdgPathsLoader.item) { + return xdgPathsLoader.item[key] + } else { + return type + } + } +} diff --git a/contents/ui/XdgPathsLoader.qmlc b/contents/ui/XdgPathsLoader.qmlc new file mode 100644 index 0000000..b0efcfd Binary files /dev/null and b/contents/ui/XdgPathsLoader.qmlc differ diff --git a/contents/ui/config/ConfigGeneral.qml b/contents/ui/config/ConfigGeneral.qml new file mode 100644 index 0000000..729e53c --- /dev/null +++ b/contents/ui/config/ConfigGeneral.qml @@ -0,0 +1,342 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.0 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.kcoreaddons 1.0 as KCoreAddons + +import ".." +import "../lib" + +ConfigPage { + id: page + showAppletVersion: true + + AppletConfig { + id: config + } + + XdgPathsLoader { id: xdgPathsLoader } + + ConfigSection { + label: i18n("Popup") + + ConfigCheckBox { + text: i18n("Fullscreen") + configKey: 'fullscreen' + } + } + + ConfigSection { + label: i18n("Panel Icon") + + ConfigIcon { + configKey: 'icon' + previewIconSize: units.iconSizes.large + + ConfigCheckBox { + text: i18n("Fixed Size") + configKey: 'fixedPanelIcon' + } + } + } + + ExclusiveGroup { id: tilesThemeGroup } + ConfigSection { + label: i18n("Tiles") + + RowLayout { + visible: false + ConfigSpinBox { + configKey: 'tileScale' + before: i18n("Tile Size") + suffix: i18n("x") + minimumValue: 0.1 + maximumValue: 4 + decimals: 1 + } + Label { + text: i18n("%1 px", config.cellBoxSize) + } + } + ConfigSpinBox { + configKey: 'tileMargin' + before: i18n("Tile Margin") + suffix: i18n("px") + minimumValue: 0 + maximumValue: config.cellBoxUnits/2 + } + RadioButton { + text: i18n("Desktop Theme (%1)", theme.themeName) + exclusiveGroup: tilesThemeGroup + checked: false + enabled: false + } + RowLayout { + RadioButton { + id: defaultTileColorRadioButton + text: i18n("Custom Color") + exclusiveGroup: tilesThemeGroup + checked: true + } + ConfigColor { + id: defaultTileColorColor + label: "" + configKey: 'defaultTileColor' + } + } + RadioButton { + text: i18n("Transparent") + exclusiveGroup: tilesThemeGroup + onClicked: { + defaultTileColorColor.setValue("#00000000") + defaultTileColorRadioButton.checked = true + } + } + ConfigComboBox { + configKey: "tileLabelAlignment" + label: i18n("Text Alignment") + model: [ + { value: "left", text: i18n("Left") }, + { value: "center", text: i18n("Center") }, + { value: "right", text: i18n("Right") }, + ] + } + + // ConfigStringList { + // configKey: 'favoriteApps' + // enabled: false + // } + } + + ExclusiveGroup { id: sidebarThemeGroup } + ConfigSection { + label: i18n("Sidebar") + + RadioButton { + text: i18n("Desktop Theme (%1)", theme.themeName) + exclusiveGroup: sidebarThemeGroup + checked: plasmoid.configuration.sidebarFollowsTheme + onClicked: plasmoid.configuration.sidebarFollowsTheme = true + } + RowLayout { + RadioButton { + text: i18n("Custom Color") + exclusiveGroup: sidebarThemeGroup + checked: !plasmoid.configuration.sidebarFollowsTheme + onClicked: plasmoid.configuration.sidebarFollowsTheme = false + } + ConfigColor { + label: "" + configKey: 'sidebarBackgroundColor' + } + } + + } + + ConfigSection { + label: i18n("Sidebar Shortcuts") + + RowLayout { + ConfigStringList { + id: sidebarShortcuts + configKey: 'sidebarShortcuts' + Layout.fillHeight: true + + KCoreAddons.KUser { + id: kuser + } + + function startsWith(a, b) { + return a.substr(0, b.length) === b + } + + function parseText(text) { + var urls = text.split("\n") + for (var i = 0; i < urls.length; i++) { + if (startsWith(urls[i], '~/')) { // Starts with '~/' (home dir) + if (kuser.loginName) { + urls[i] = '/home/' + kuser.loginName + urls[i].substr(1) + } + } + if (startsWith(urls[i], '/')) { // Starts with '/' (root) + urls[i] = 'file://' + urls[i] // Prefix URL file scheme when serializing. + } + } + return urls + } + + function addUrl(str) { + if (hasItem(str)) { + // Skip. Kicker.FavoritesModel will remove it anyways, + // and can cause a serialize + deserialize loop. + } else { + prepend(str) + } + selectItem(str) // Select the existing text to highlight it's existence. + } + } + + ColumnLayout { + id: sidebarDefaultsColumn + + Label { + text: i18n("Add Default") + } + + ConfigIconButton { + iconName: "folder-documents-symbolic" + text: xdgPathsLoader.displayName('DOCUMENTS') + onClicked: sidebarShortcuts.addUrl('xdg:DOCUMENTS') + } + ConfigIconButton { + iconName: "folder-download-symbolic" + // Component.onCompleted: contentItem.alignment = Qt.AlignLeft + text: xdgPathsLoader.displayName('DOWNLOAD') + onClicked: sidebarShortcuts.addUrl('xdg:DOWNLOAD') + } + ConfigIconButton { + iconName: "folder-music-symbolic" + text: xdgPathsLoader.displayName('MUSIC') + onClicked: sidebarShortcuts.addUrl('xdg:MUSIC') + } + ConfigIconButton { + iconName: "folder-pictures-symbolic" + text: xdgPathsLoader.displayName('PICTURES') + onClicked: sidebarShortcuts.addUrl('xdg:PICTURES') + } + ConfigIconButton { + iconName: "folder-videos-symbolic" + text: xdgPathsLoader.displayName('VIDEOS') // Uhg, it's displayed 'Movies' instead of 'Videos'... + onClicked: sidebarShortcuts.addUrl('xdg:VIDEOS') + } + ConfigIconButton { + iconName: "folder-open-symbolic" + text: i18nd("dolphin", "Dolphin") + onClicked: sidebarShortcuts.addUrl('org.kde.dolphin.desktop') + } + ConfigIconButton { + iconName: "configure" + text: i18nd("systemsettings", "System Settings") + onClicked: sidebarShortcuts.addUrl('systemsettings.desktop') + } + Item { Layout.fillHeight: true } + } + } + } + + + ExclusiveGroup { id: searchBoxThemeGroup } + ConfigSection { + label: i18n("Search Box") + + ConfigSpinBox { + configKey: 'searchFieldHeight' + before: i18n("Search Field Height") + suffix: i18n("px") + minimumValue: 0 + } + + RadioButton { + text: i18n("Desktop Theme (%1)", theme.themeName) + exclusiveGroup: searchBoxThemeGroup + checked: plasmoid.configuration.searchFieldFollowsTheme + onClicked: plasmoid.configuration.searchFieldFollowsTheme = true + } + RadioButton { + text: i18n("Windows (White)") + exclusiveGroup: searchBoxThemeGroup + checked: !plasmoid.configuration.searchFieldFollowsTheme + onClicked: plasmoid.configuration.searchFieldFollowsTheme = false + } + } + + ConfigSection { + label: i18n("App List") + + ConfigSpinBox { + id: appListWidthControl + configKey: 'appListWidth' + before: i18n("App List Area Width") + suffix: i18n("px") + minimumValue: 0 + } + + ConfigComboBox { + id: defaultAppListOrderControl + configKey: "defaultAppListOrder" + label: i18n("Default Order") + model: [ + { value: "alphabetical", text: i18n("Alphabetical") }, + { value: "categories", text: i18n("Categories") }, + ] + } + + ConfigComboBox { + id: appDescriptionControl + configKey: "appDescription" + label: i18n("App Description") + model: [ + { value: "hidden", text: i18n("Hidden") }, + { value: "after", text: i18n("After") }, + { value: "below", text: i18n("Below") }, + ] + onValueChanged: { + if (value == "below") { + if (menuItemHeightControl.value <= 36) { // Smaller than 2 lines of text + menuItemHeightControl.value = 36 + } + } + } + } + + ConfigCheckBox { + text: i18n("Show recent applications") + configKey: 'showRecentApps' + } + + ConfigSpinBox { + id: menuItemHeightControl + configKey: 'menuItemHeight' + before: i18n("Icon Size") + suffix: i18n("px") + minimumValue: 18 // 1 line of text + maximumValue: 128 + onValueChanged: { + if (value < 36) { // Smaller than 2 lines of text + if (appDescriptionControl.value == "below") { + appDescriptionControl.setValue("after") + } + } + } + } + } + + ExclusiveGroup { id: searchResultsMergedGroup } + ConfigSection { + label: i18n("Search Results") + + RadioButton { + exclusiveGroup: searchResultsMergedGroup + text: i18n("Merged (Application Launcher)") + checked: plasmoid.configuration.searchResultsMerged + onClicked: { + plasmoid.configuration.searchResultsMerged = true + plasmoid.configuration.searchResultsCustomSort = false + } + } + RadioButton { + exclusiveGroup: searchResultsMergedGroup + text: i18n("Split into Categories (Application Menu / Dashboard)") + checked: !plasmoid.configuration.searchResultsMerged + onClicked: plasmoid.configuration.searchResultsMerged = false + } + // ConfigCheckBox { + // enabled: !plasmoid.configuration.searchResultsMerged + // text: i18n("Custom Sort (Prefer partial matches)") + // configKey: 'searchResultsCustomSort' + // } + } + +} diff --git a/contents/ui/config/ConfigGeneral.qmlc b/contents/ui/config/ConfigGeneral.qmlc new file mode 100644 index 0000000..892ac1e Binary files /dev/null and b/contents/ui/config/ConfigGeneral.qmlc differ diff --git a/contents/ui/lib/AppletVersion.qml b/contents/ui/lib/AppletVersion.qml new file mode 100644 index 0000000..b61caf5 --- /dev/null +++ b/contents/ui/lib/AppletVersion.qml @@ -0,0 +1,49 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.0 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.plasmoid 2.0 + +Item { + implicitWidth: label.implicitWidth + implicitHeight: label.implicitHeight + + property string version: "?" + property string metadataFilepath: plasmoid.file("", "../metadata.desktop") + + PlasmaCore.DataSource { + id: executable + engine: "executable" + connectedSources: [] + onNewData: { + var exitCode = data["exit code"] + var exitStatus = data["exit status"] + var stdout = data["stdout"] + var stderr = data["stderr"] + exited(exitCode, exitStatus, stdout, stderr) + disconnectSource(sourceName) // cmd finished + } + function exec(cmd) { + connectSource(cmd) + } + signal exited(int exitCode, int exitStatus, string stdout, string stderr) + } + + Connections { + target: executable + onExited: { + version = stdout.replace('\n', ' ').trim() + } + } + + Label { + id: label + text: i18n("Version: %1", version) + } + + Component.onCompleted: { + var cmd = 'kreadconfig5 --file "' + metadataFilepath + '" --group "Desktop Entry" --key "X-KDE-PluginInfo-Version"' + executable.exec(cmd) + } + +} diff --git a/contents/ui/lib/AppletVersion.qmlc b/contents/ui/lib/AppletVersion.qmlc new file mode 100644 index 0000000..823259e Binary files /dev/null and b/contents/ui/lib/AppletVersion.qmlc differ diff --git a/contents/ui/lib/ConfigAdvanced.qml b/contents/ui/lib/ConfigAdvanced.qml new file mode 100644 index 0000000..f1f9de9 --- /dev/null +++ b/contents/ui/lib/ConfigAdvanced.qml @@ -0,0 +1,308 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Styles 1.0 +import QtQuick.Layouts 1.0 + +ConfigPage { + id: page + + Component { + id: textFieldStyle + TextFieldStyle { + // textColor: syspal.text + + background: Rectangle { + radius: 2 + color: control.activeFocus ? syspal.base : "transparent" + border.color: control.activeFocus ? syspal.highlight : "transparent" + border.width: 1 + } + } + } + + ScrollView { + Layout.fillWidth: true + Layout.fillHeight: true + + ListView { + id: configTable + + Layout.fillWidth: true + Layout.fillHeight: true + + spacing: units.smallSpacing + + model: [] + cacheBuffer: 100000 + + Component { + id: boolControl + CheckBox { + checked: modelValue + text: modelValue + onClicked: plasmoid.configuration[modelKey] = !modelValue + } + } + + Component { + id: numberControl + SpinBox { + value: modelValue + property bool isInteger: modelConfigType === 'UInt' || modelConfigType === 'int' + decimals: isInteger ? 0 : 3 + maximumValue: 2147483647 + Component.onCompleted: { + valueChanged.connect(function() { + plasmoid.configuration[modelKey] = value + }) + } + } + } + + Component { + id: stringListControl + TextArea { + text: '' + modelValue + readOnly: true + implicitHeight: contentHeight + font.pixelSize + wrapMode: TextEdit.Wrap + } + } + + Component { + id: stringControl + TextArea { + text: modelValue + // readOnly: true + implicitHeight: contentHeight + font.pixelSize + wrapMode: TextEdit.Wrap + Component.onCompleted: { + textChanged.connect(function() { + plasmoid.configuration[modelKey] = text + }) + } + } + } + + Component { + id: base64jsonControl + TextArea { + text: { + if (modelValue) { + var data = JSON.parse(Qt.atob(modelValue)) + return JSON.stringify(data, null, ' ') + } else { + return '' + } + } + readOnly: true + implicitHeight: contentHeight + font.pixelSize + wrapMode: TextEdit.Wrap + } + } + + delegate: RowLayout { + width: parent.width + + property bool isDefault: ('' + model.value) === model.defaultValue + + TextField { + Layout.alignment: Qt.AlignTop | Qt.AlignLeft + // Layout.fillWidth: true + text: model.key + readOnly: true + style: textFieldStyle + Layout.preferredWidth: 200 * units.devicePixelRatio + font.bold: !isDefault + } + TextField { + Layout.alignment: Qt.AlignTop | Qt.AlignLeft + text: model.stringType || model.configType || model.valueType + readOnly: true + style: textFieldStyle + Layout.preferredWidth: 80 * units.devicePixelRatio + } + Loader { + id: valueControlLoader + Layout.fillWidth: true + property var modelKey: model.key + property var modelValueType: model.valueType + property var modelValue: model.value + property var modelConfigType: model.configType + sourceComponent: { + if (model.valueType === 'boolean') { + return boolControl + } else if (model.valueType === 'number') { + return numberControl + } else if (model.valueType === 'object') { // StringList + return stringListControl + } else { // string + if (model.stringType === 'base64json') { + return base64jsonControl + } else { + return stringControl + } + } + + } + } + + } + } + } + + ListModel { + id: configDefaults + + property bool loading: false + property bool error: false + property string source: plasmoid.file("", "config/main.xml") + + signal updated() + + // http://stackoverflow.com/a/29881855/947742 + function fetch() { + var doc = new XMLHttpRequest() + doc.onreadystatechange = function() { + error = false + if (doc.readyState === XMLHttpRequest.DONE) { + if (doc.status != 200) { + error = true + } else { + var rootNode = doc.responseXML.documentElement + parse(rootNode) + } + loading = false + updated() + } + } + loading = true + doc.open("GET", source) + doc.send() + } + + function findNode(parentNode, tagName) { + for (var i = 0; i < parentNode.childNodes.length; i++) { + var node = parentNode.childNodes[i] + if (node.nodeName === tagName) { + return node + } + } + } + + function findAll(parentNode, tagName, callback) { + for (var i = 0; i < parentNode.childNodes.length; i++) { + var node = parentNode.childNodes[i] + if (node.nodeName === tagName) { + callback(node) + } + } + } + + function getText(parentNode) { + for (var i = 0; i < parentNode.childNodes.length; i++) { + var node = parentNode.childNodes[i] + if (node.nodeName === '#text') { + return node.nodeValue + } + } + } + + // http://doc.qt.io/qt-5/qdomnode.html + function parse(rootNode) { + clear() + findAll(rootNode, 'group', function(group) { + findAll(group, 'entry', function(entry) { + var key = entry.attributes['name'].nodeValue + var valueType = entry.attributes['type'].nodeValue + var value = getText(findNode(entry, 'default')) + + var stringType = entry.attributes['stringType'] + if (stringType) { + stringType = stringType.nodeValue + } else { + stringType = null + } + + configDefaults.append({ + key: key, + valueType: valueType, + value: value, + stringType: stringType + }) + }) + }) + } + + Component.onCompleted: fetch() + } + + + // plasmoid.configuration is a KDeclarative::ConfigPropertyMap which inherits QQmlPropertyMap + // https://github.com/KDE/kdeclarative/blob/master/src/kdeclarative/configpropertymap.h + // http://doc.qt.io/qt-5/qqmlpropertymap.html + ListModel { + id: configTableModel + dynamicRoles: true + + property var keys: [] + + Component.onCompleted: { + keys = plasmoid.configuration.keys() + // console.log(JSON.stringify(keys, null, '\t')) + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + if (key === 'minimumWidth') { + break // Where is this defined?! Exit loop when we reach this key. + } + + var value = plasmoid.configuration[key] + + configTableModel.append({ + key: key, + valueType: typeof value, + value: value, + configType: null, + stringType: null, + defaultValue: null, + }) + } + configTable.model = configTableModel + } + } + + Connections { + target: configDefaults + onUpdated: { + var keys = configTableModel.keys + // Assume the default main.xml's order and plasmoid.configuration is the same (we probably shouldn't). + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + var value = plasmoid.configuration[key] + var valueStr = '' + value + var node = configDefaults.get(i) + if (!node) { + console.log('configDefaults doesn\'t conain an entry for plasmoid.configuration.' + key) + continue + } + var configType = node.valueType + var stringType = node.stringType + var defaultValue = node.value + + configTableModel.setProperty(i, 'configType', configType) + configTableModel.setProperty(i, 'stringType', stringType) + configTableModel.setProperty(i, 'defaultValue', defaultValue) + } + } + } + + Connections { + target: plasmoid.configuration + onValueChanged: { + var keyIndex = configTableModel.keys.indexOf(key) + if (keyIndex >= 0) { + configTableModel.setProperty(keyIndex, 'value', value) + } + } + } +} diff --git a/contents/ui/lib/ConfigCheckBox.qml b/contents/ui/lib/ConfigCheckBox.qml new file mode 100644 index 0000000..e2c0d05 --- /dev/null +++ b/contents/ui/lib/ConfigCheckBox.qml @@ -0,0 +1,16 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.0 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +import ".." + +CheckBox { + id: configCheckBox + + property string configKey: '' + checked: plasmoid.configuration[configKey] + onClicked: plasmoid.configuration[configKey] = !plasmoid.configuration[configKey] +} diff --git a/contents/ui/lib/ConfigCheckBox.qmlc b/contents/ui/lib/ConfigCheckBox.qmlc new file mode 100644 index 0000000..6c8e413 Binary files /dev/null and b/contents/ui/lib/ConfigCheckBox.qmlc differ diff --git a/contents/ui/lib/ConfigColor.qml b/contents/ui/lib/ConfigColor.qml new file mode 100644 index 0000000..528de49 --- /dev/null +++ b/contents/ui/lib/ConfigColor.qml @@ -0,0 +1,89 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.0 +import QtQuick.Dialogs 1.2 +import QtQuick.Window 2.2 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +import ".." + +RowLayout { + id: configColor + spacing: 2 + // Layout.fillWidth: true + Layout.maximumWidth: 300 + + property alias label: label.text + property alias horizontalAlignment: label.horizontalAlignment + + property string configKey: '' + property string value: configKey ? plasmoid.configuration[configKey] : "#000" + onValueChanged: { + if (!textField.activeFocus) { + textField.text = configColor.value + } + if (configKey) { + plasmoid.configuration[configKey] = value + } + } + + function setValue(newColor) { + textField.text = newColor + } + + Label { + id: label + text: "Label" + Layout.fillWidth: horizontalAlignment == Text.AlignRight + horizontalAlignment: Text.AlignLeft + } + + MouseArea { + // width: label.font.pixelSize + // height: label.font.pixelSize + width: textField.height + height: textField.height + hoverEnabled: true + + onClicked: dialog.open() + + Rectangle { + anchors.fill: parent + color: configColor.value + border.width: 2 + border.color: parent.containsMouse ? theme.highlightColor : "#BB000000" + } + } + + TextField { + id: textField + placeholderText: "#AARRGGBB" + Layout.fillWidth: label.horizontalAlignment == Text.AlignLeft + onTextChanged: { + // Make sure the text is: + // Empty (use default) + // or #123 or #112233 or #11223344 before applying the color. + if (text.length === 0 + || (text.indexOf('#') === 0 && (text.length == 4 || text.length == 7 || text.length == 9)) + ) { + configColor.value = text + } + } + } + + ColorDialog { + id: dialog + visible: false + modality: Qt.WindowModal + title: configColor.label + showAlphaChannel: true + color: configColor.value + onCurrentColorChanged: { + if (visible && color != currentColor) { + configColor.value = currentColor + } + } + } +} diff --git a/contents/ui/lib/ConfigColor.qmlc b/contents/ui/lib/ConfigColor.qmlc new file mode 100644 index 0000000..4a74db2 Binary files /dev/null and b/contents/ui/lib/ConfigColor.qmlc differ diff --git a/contents/ui/lib/ConfigComboBox.qml b/contents/ui/lib/ConfigComboBox.qml new file mode 100644 index 0000000..11e9b50 --- /dev/null +++ b/contents/ui/lib/ConfigComboBox.qml @@ -0,0 +1,89 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.0 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +import ".." + +/* +** Example: +** +ConfigComboBox { + configKey: "appDescription" + model: [ + { value: "hidden", text: i18n("Hidden") }, + { value: "after", text: i18n("After") }, + { value: "below", text: i18n("Below") }, + ] +} +*/ +RowLayout { + id: configComboBox + spacing: 2 + // Layout.fillWidth: true + Layout.maximumWidth: 300 + + property alias label: label.text + property alias horizontalAlignment: label.horizontalAlignment + + property string configKey: '' + readonly property string value: configKey ? plasmoid.configuration[configKey] : "" + onValueChanged: comboBox.selectValue(value) + function setValue(val) { comboBox.selectValue(val) } + + property alias model: comboBox.model + + signal populate() + Component.onCompleted: populate() + + Label { + id: label + text: "Label" + Layout.fillWidth: horizontalAlignment == Text.AlignRight + horizontalAlignment: Text.AlignLeft + } + + ComboBox { + id: comboBox + Layout.fillWidth: label.horizontalAlignment == Text.AlignLeft + + onCurrentIndexChanged: { + if (currentIndex >= 0 && typeof model !== 'number') { + var val = model[currentIndex].value + if (configKey && val) { + plasmoid.configuration[configKey] = val + } + } + } + + function size() { + if (typeof model === "number") { + return model + } else if (typeof model.count === "number") { + return model.count + } else if (typeof model.length === "number") { + return model.length + } else { + return 0 + } + } + + function findValue(val) { + for (var i = 0; i < size(); i++) { + if (model[i].value == val) { + return i + } + } + return -1 + } + + function selectValue(val) { + var index = comboBox.findValue(val) + if (index >= 0) { + comboBox.currentIndex = index + } + } + } +} diff --git a/contents/ui/lib/ConfigComboBox.qmlc b/contents/ui/lib/ConfigComboBox.qmlc new file mode 100644 index 0000000..4834cf5 Binary files /dev/null and b/contents/ui/lib/ConfigComboBox.qmlc differ diff --git a/contents/ui/lib/ConfigIcon.qml b/contents/ui/lib/ConfigIcon.qml new file mode 100644 index 0000000..ff84dd5 --- /dev/null +++ b/contents/ui/lib/ConfigIcon.qml @@ -0,0 +1,132 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.0 +import QtQuick.Dialogs 1.2 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons + +import ".." + +RowLayout { + id: configIcon + + default property alias _contentChildren: content.data + + property string configKey: '' + property alias value: textField.text + readonly property string configValue: configKey ? plasmoid.configuration[configKey] : "" + onConfigValueChanged: { + if (!textField.focus && value != configValue) { + value = configValue + } + } + property int previewIconSize: units.iconSizes.medium + property string defaultValue: "start-here-kde" + + // org.kde.plasma.kickoff + Button { + id: iconButton + Layout.minimumWidth: previewFrame.width + units.smallSpacing * 2 + Layout.maximumWidth: Layout.minimumWidth + Layout.minimumHeight: previewFrame.height + units.smallSpacing * 2 + Layout.maximumHeight: Layout.minimumWidth + + + + // just to provide some visual feedback, cannot have checked without checkable enabled + checkable: true + onClicked: { + checked = Qt.binding(function() { // never actually allow it being checked + return iconMenu.status === PlasmaComponents.DialogStatus.Open + }) + + iconMenu.open(0, height) + } + + PlasmaCore.FrameSvgItem { + id: previewFrame + anchors.centerIn: parent + imagePath: plasmoid.location === PlasmaCore.Types.Vertical || plasmoid.location === PlasmaCore.Types.Horizontal + ? "widgets/panel-background" : "widgets/background" + width: previewIconSize + fixedMargins.left + fixedMargins.right + height: previewIconSize + fixedMargins.top + fixedMargins.bottom + + PlasmaCore.IconItem { + anchors.centerIn: parent + width: previewIconSize + height: previewIconSize + source: configIcon.value + } + } + + // QQC Menu can only be opened at cursor position, not a random one + PlasmaComponents.ContextMenu { + id: iconMenu + visualParent: iconButton + + PlasmaComponents.MenuItem { + text: i18ndc("plasma_applet_org.kde.plasma.kickoff", "@item:inmenu Open icon chooser dialog", "Choose...") + icon: "document-open" + onClicked: iconDialog.open() + } + PlasmaComponents.MenuItem { + text: i18ndc("plasma_applet_org.kde.plasma.kickoff", "@item:inmenu Reset icon to default", "Clear Icon") + icon: "edit-clear" + onClicked: configIcon.value = defaultValue + } + } + } + + ColumnLayout { + id: content + Layout.fillWidth: true + + RowLayout { + TextField { + id: textField + Layout.fillWidth: true + + text: configIcon.configValue + onTextChanged: serializeTimer.restart() + + ToolButton { + iconName: "edit-clear" + onClicked: configIcon.value = defaultValue + + anchors.top: parent.top + anchors.right: parent.right + anchors.bottom: parent.bottom + + width: height + } + } + + Button { + iconName: "document-open" + onClicked: iconDialog.open() + } + } + + // Workaround for crash when using default on a Layout. + // https://bugreports.qt.io/browse/QTBUG-52490 + // Still affecting Qt 5.7.0 + Component.onDestruction: { + while (children.length > 0) { + children[children.length - 1].parent = configIcon; + } + } + } + + KQuickAddons.IconDialog { + id: iconDialog + onIconNameChanged: configIcon.value = iconName + } + + Timer { // throttle + id: serializeTimer + interval: 300 + onTriggered: plasmoid.configuration[configKey] = configIcon.value + } +} diff --git a/contents/ui/lib/ConfigIcon.qmlc b/contents/ui/lib/ConfigIcon.qmlc new file mode 100644 index 0000000..b2ea4e7 Binary files /dev/null and b/contents/ui/lib/ConfigIcon.qmlc differ diff --git a/contents/ui/lib/ConfigIconButton.qml b/contents/ui/lib/ConfigIconButton.qml new file mode 100644 index 0000000..829e60b --- /dev/null +++ b/contents/ui/lib/ConfigIconButton.qml @@ -0,0 +1,28 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.0 +import QtQuick.Controls 2.0 as QQC2 + +// QtQuick2 button using Kirigami theme +// /usr/lib/x86_64-linux-gnu/qt5/qml/QtQuick/Controls.2/org.kde.desktop/Button.qml +// import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +// https://github.com/KDE/qqc2-desktop-style/blob/master/plugin/kquickstyleitem.cpp#L1162 + +// The normal 'button' elementType centers the IconLabel, +// with no way to set the alignment or the minimum width. +// So we use toolbutton which left aligns. +QQC2.Button { + id: iconButton + + property string iconName: "" + + Component.onCompleted: { + background.elementType = 'toolbutton' + + // icon.name is a Qt 5.10 feature + // So to be backward compatible with Kubuntu which has Qt 5.9, we need to do this. + if (iconButton.hasOwnProperty("icon") && iconName && !icon.name) { + icon.name = iconName + } + } +} diff --git a/contents/ui/lib/ConfigIconButton.qmlc b/contents/ui/lib/ConfigIconButton.qmlc new file mode 100644 index 0000000..9e07453 Binary files /dev/null and b/contents/ui/lib/ConfigIconButton.qmlc differ diff --git a/contents/ui/lib/ConfigPage.qml b/contents/ui/lib/ConfigPage.qml new file mode 100644 index 0000000..5bff015 --- /dev/null +++ b/contents/ui/lib/ConfigPage.qml @@ -0,0 +1,37 @@ +// Version 3 + +import QtQuick 2.0 +import QtQuick.Layouts 1.0 + +Item { + id: page + Layout.fillWidth: true + default property alias _contentChildren: content.data + implicitHeight: content.implicitHeight + + ColumnLayout { + id: content + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + + // Workaround for crash when using default on a Layout. + // https://bugreports.qt.io/browse/QTBUG-52490 + // Still affecting Qt 5.7.0 + Component.onDestruction: { + while (children.length > 0) { + children[children.length - 1].parent = page; + } + } + } + + property alias showAppletVersion: appletVersionLoader.active + Loader { + id: appletVersionLoader + active: false + visible: active + source: "AppletVersion.qml" + anchors.right: parent.right + anchors.bottom: parent.top + } +} diff --git a/contents/ui/lib/ConfigPage.qmlc b/contents/ui/lib/ConfigPage.qmlc new file mode 100644 index 0000000..8b19368 Binary files /dev/null and b/contents/ui/lib/ConfigPage.qmlc differ diff --git a/contents/ui/lib/ConfigSection.qml b/contents/ui/lib/ConfigSection.qml new file mode 100644 index 0000000..ecdd5bb --- /dev/null +++ b/contents/ui/lib/ConfigSection.qml @@ -0,0 +1,52 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.0 + +// Alternative to GroupBox for when we want the title to always be left aligned. +Rectangle { + id: control + Layout.fillWidth: true + default property alias _contentChildren: content.data + property string label: "" + + color: "#0c000000" + border.width: 2 + border.color: "#10000000" + // radius: 5 + property int padding: 8 + implicitHeight: childrenRect.height + padding + padding + property alias spacing: content.spacing + + Label { + id: title + visible: control.label + text: control.label + font.bold: true + font.pointSize: 13 + anchors.leftMargin: padding + // anchors.topMargin: padding + anchors.left: parent.left + anchors.top: parent.top + anchors.right: parent.right + height: visible ? implicitHeight : padding + } + + ColumnLayout { + id: content + anchors.top: title.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: padding + // spacing: 0 + // height: childrenRect.height + + // Workaround for crash when using default on a Layout. + // https://bugreports.qt.io/browse/QTBUG-52490 + // Still affecting Qt 5.7.0 + Component.onDestruction: { + while (children.length > 0) { + children[children.length - 1].parent = control; + } + } + } +} diff --git a/contents/ui/lib/ConfigSection.qmlc b/contents/ui/lib/ConfigSection.qmlc new file mode 100644 index 0000000..2bb758a Binary files /dev/null and b/contents/ui/lib/ConfigSection.qmlc differ diff --git a/contents/ui/lib/ConfigSpinBox.qml b/contents/ui/lib/ConfigSpinBox.qml new file mode 100644 index 0000000..76c2efb --- /dev/null +++ b/contents/ui/lib/ConfigSpinBox.qml @@ -0,0 +1,47 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.0 + +RowLayout { + id: configSpinBox + + property string configKey: '' + property alias decimals: spinBox.decimals + property alias horizontalAlignment: spinBox.horizontalAlignment + property alias maximumValue: spinBox.maximumValue + property alias minimumValue: spinBox.minimumValue + property alias prefix: spinBox.prefix + property alias stepSize: spinBox.stepSize + property alias suffix: spinBox.suffix + property alias value: spinBox.value + + property alias before: labelBefore.text + property alias after: labelAfter.text + + Label { + id: labelBefore + text: "" + visible: text + } + + SpinBox { + id: spinBox + + value: plasmoid.configuration[configKey] + // onValueChanged: plasmoid.configuration[configKey] = value + onValueChanged: serializeTimer.start() + maximumValue: 2147483647 + } + + Label { + id: labelAfter + text: "" + visible: text + } + + Timer { // throttle + id: serializeTimer + interval: 300 + onTriggered: plasmoid.configuration[configKey] = value + } +} diff --git a/contents/ui/lib/ConfigSpinBox.qmlc b/contents/ui/lib/ConfigSpinBox.qmlc new file mode 100644 index 0000000..8576f3c Binary files /dev/null and b/contents/ui/lib/ConfigSpinBox.qmlc differ diff --git a/contents/ui/lib/ConfigStringList.qml b/contents/ui/lib/ConfigStringList.qml new file mode 100644 index 0000000..81fe918 --- /dev/null +++ b/contents/ui/lib/ConfigStringList.qml @@ -0,0 +1,115 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.0 + +RowLayout { + id: configStringList + Layout.fillWidth: true + // implicitHeight: textArea.implicitHeight + // Layout.preferredHeight: textArea.Layout.preferredHeight + + property string configKey: '' + + property alias enabled: textArea.enabled + + readonly property var configValue: configKey ? plasmoid.configuration[configKey] : "" + onConfigValueChanged: deserialize() + readonly property var value: parseStringList(configValue) + + property alias textArea: textArea + property alias textAreaText: textArea.text + + function parseStringList(stringList) { + return stringList.toString().split(",") + } + function parseValue(value) { + return value.join("\n") + } + function parseText(text) { + return text.split("\n") + } + + function setValue(val) { + var newText = parseValue(val) + if (textArea.text != newText) { + textArea.text = newText + } + } + + function deserialize() { + // console.log('deserialize', configValue) + if (!textArea.focus) { + setValue(value) + } + } + function serialize() { + var newValue = parseText(textArea.text) + // console.log('serialize', configKey, newValue) + if (plasmoid.configuration[configKey] != newValue) { + plasmoid.configuration[configKey] = newValue + } + } + + + function prepend(str) { + textArea.focus = true + textArea.select(0, 0) // Make sure the text area has focus or we'll enter a loop. + textAreaText = str + '\n' + textAreaText + } + + function append(str) { + textArea.focus = true + textArea.select(0, 0) // Make sure the text area has focus or we'll enter a loop. + textAreaText += '\n' + str + } + + function hasItem(str) { + var list = parseText(textArea.text) + for (var i = 0; i < list.length; i++) { + if (list[i].trim() == str) { + return true + } + } + return false + } + + function selectItem(str) { + var start = textArea.text.indexOf(str) + textArea.select(start, start + str.length) + } + + property alias before: labelBefore.text + property alias after: labelAfter.text + + Label { + id: labelBefore + text: "" + visible: text + } + + TextArea { + id: textArea + Layout.fillWidth: true + Layout.fillHeight: configStringList.Layout.fillHeight + // implicitHeight: font.pixelSize * (lineCount + 2) + // Layout.minimumHeight: implicitHeight + // Layout.preferredHeight: implicitHeight + // Layout.maximumHeight: implicitHeight + + // text: parseValue(configStringList.value) + onTextChanged: serializeTimer.restart() + // onFocusChanged: console.log('textArea.focus', focus) + } + + Label { + id: labelAfter + text: "" + visible: text + } + + Timer { // throttle + id: serializeTimer + interval: 300 + onTriggered: serialize() + } +} diff --git a/contents/ui/lib/ConfigStringList.qmlc b/contents/ui/lib/ConfigStringList.qmlc new file mode 100644 index 0000000..8d66e30 Binary files /dev/null and b/contents/ui/lib/ConfigStringList.qmlc differ diff --git a/contents/ui/lib/GroupBoxStyle.qml b/contents/ui/lib/GroupBoxStyle.qml new file mode 100644 index 0000000..44c4862 --- /dev/null +++ b/contents/ui/lib/GroupBoxStyle.qml @@ -0,0 +1,57 @@ +// Based on PlasmaStyles.GroupBoxStyle +// https://github.com/KDE/plasma-framework/blob/master/src/declarativeimports/plasmastyle/GroupBoxStyle.qml + +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.2 as QtQuickControlStyle +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +Style { + id: styleRoot + + property color textColor: theme.textColor + readonly property bool hasLabelRow: control.checkable || control.title + + property Component checkbox: PlasmaComponents.CheckBox { + checked: control.checked + } + + property Component panel: Item { + anchors.fill: parent + + Loader { + id: checkboxloader + anchors.left: parent.left + anchors.leftMargin: styleRoot.padding.left + sourceComponent: control.checkable ? checkbox : null + anchors.verticalCenter: label.verticalCenter + width: item ? item.implicitWidth : 0 + height: item ? label.implicitHeight : 0 + } + + PlasmaComponents.Label { + id: label + anchors.top: parent.top + anchors.left: checkboxloader.right + // anchors.leftMargin: control.checkable ? units.smallSpacing : 0 + text: control.title + } + + PlasmaCore.FrameSvgItem { + id: frame + anchors.fill: parent + imagePath: "widgets/frame" + prefix: "plain" + visible: !control.flat + colorGroup: PlasmaCore.ColorScope.colorGroup + Component.onCompleted: { + styleRoot.padding.left = frame.margins.left + styleRoot.padding.top = frame.margins.top + (styleRoot.hasLabelRow ? label.implicitHeight + units.smallSpacing : 0) + styleRoot.padding.right = frame.margins.right + styleRoot.padding.bottom = frame.margins.bottom + } + } + } +} diff --git a/contents/ui/lib/GroupBoxStyle.qmlc b/contents/ui/lib/GroupBoxStyle.qmlc new file mode 100644 index 0000000..c802242 Binary files /dev/null and b/contents/ui/lib/GroupBoxStyle.qmlc differ diff --git a/contents/ui/lib/Logger.qml b/contents/ui/lib/Logger.qml new file mode 100644 index 0000000..54b404b --- /dev/null +++ b/contents/ui/lib/Logger.qml @@ -0,0 +1,47 @@ +import QtQuick 2.0 + +Item { + id: logger + property string name: 'logger' + property bool showDebug: false + + function prettifyArguments(rawArgs) { + var args = Array.apply(null, rawArgs) + for (var i = 0; i < args.length; i++) { + if (typeof args[i] === "object" || args[i] instanceof Array) { + args[i] = JSON.stringify(args[i], null, '\t') + } + } + return args + } + + function debug() { + if (showDebug) { + var args = Array.apply(null, arguments) + args.unshift('[' + name + ':debug]') + console.log.apply(console, args) + } + } + + function debugJSON() { + if (showDebug) { + var args = prettifyArguments(arguments) + args.unshift('[' + name + ':debug]') + console.log.apply(console, args) + } + } + + function log() { + var args = Array.apply(null, arguments) + args.unshift('[' + name + ']') + console.log.apply(console, args) + } + + function logJSON() { + if (showDebug) { + var args = prettifyArguments(arguments) + args.unshift('[' + name + ']') + console.log.apply(console, args) + } + } +} diff --git a/contents/ui/lib/Logger.qmlc b/contents/ui/lib/Logger.qmlc new file mode 100644 index 0000000..2a0be8d Binary files /dev/null and b/contents/ui/lib/Logger.qmlc differ diff --git a/metadata.desktop b/metadata.desktop new file mode 100644 index 0000000..6709813 --- /dev/null +++ b/metadata.desktop @@ -0,0 +1,21 @@ +[Desktop Entry] +Name=Tiled Menu +Comment=A menu based on Windows 10's Start Menu. + +Type=Service +Icon=start-here-kde +X-KDE-ServiceTypes=Plasma/Applet + +X-Plasma-API=declarativeappletscript +X-Plasma-MainScript=ui/Main.qml + +X-KDE-PluginInfo-Author=Chris Holland +X-KDE-PluginInfo-Email=zrenfire@gmail.com +X-KDE-PluginInfo-Name=com.github.zren.tiledmenu +X-KDE-PluginInfo-Version=23 +X-KDE-PluginInfo-Website=https://github.com/Zren/plasma-applet-tiledmenu +X-KDE-PluginInfo-KdeStoreId=1160672 +X-KDE-PluginInfo-Category=Application Launchers +X-KDE-PluginInfo-Depends= + +X-Plasma-Provides=org.kde.plasma.launchermenu diff --git a/translate/ReadMe.md b/translate/ReadMe.md new file mode 100644 index 0000000..d416f8d --- /dev/null +++ b/translate/ReadMe.md @@ -0,0 +1,43 @@ +> Version 3 of Zren's i18n scripts. + +With KDE Frameworks v5.37 and above, translations are bundled with the *.plasmoid file downloaded from the store. + +## Install Translations + +Go to `~/.local/share/plasma/plasmoids/com.github.zren.tiledmenu/translate/` and run `sh ./build --restartplasma`. + +## New Translations + +1. Fill out [`template.pot`](template.pot) with your translations then open a [new issue](https://github.com/Zren/plasma-applet-tiledmenu/issues/new), name the file `spanish.txt`, attach the txt file to the issue (drag and drop). + +Or if you know how to make a pull request + +1. Copy the `template.pot` file and name it your locale's code (Eg: `en`/`de`/`fr`) with the extension `.po`. Then fill out all the `msgstr ""`. + +## Scripts + +* `./merge` will parse the `i18n()` calls in the `*.qml` files and write it to the `template.pot` file. Then it will merge any changes into the `*.po` language files. +* `./build` will convert the `*.po` files to it's binary `*.mo` version and move it to `contents/locale/...` which will bundle the translations in the *.plasmoid without needed the user to manually install them. +* `./install` will convert the `*.po` files to it's binary `*.mo` version and move it to `~/.local/share/locale/...`. +* `./test` will run `./merge` then `./install`. + +## Links + +* https://techbase.kde.org/Development/Tutorials/Localization/i18n_Build_Systems + +## Examples + +* https://websvn.kde.org/trunk/l10n-kf5/fr/messages/kde-workspace/ +* https://github.com/psifidotos/nowdock-plasmoid/tree/master/po +* https://github.com/kotelnik/plasma-applet-redshift-control/tree/master/translations + +## Status +| Locale | Lines | % Done| +|----------|---------|-------| +| Template | 92 | | +| de | 44/92 | 47% | +| es | 78/92 | 84% | +| fr | 25/92 | 27% | +| nl_NL | 92/92 | 100% | +| pl | 1/92 | 1% | +| zh_CN | 92/92 | 100% | diff --git a/translate/build b/translate/build new file mode 100755 index 0000000..dfd7da5 --- /dev/null +++ b/translate/build @@ -0,0 +1,53 @@ +#!/bin/sh +# Version: 4 + +# This script will convert the *.po files to *.mo files, rebuilding the package/contents/locale folder. +# Feature discussion: https://phabricator.kde.org/D5209 +# Eg: contents/locale/fr_CA/LC_MESSAGES/plasma_applet_org.kde.plasma.eventcalendar.mo + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +plasmoidName=`kreadconfig5 --file="$DIR/../metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Name"` +website=`kreadconfig5 --file="$DIR/../metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Website"` +bugAddress="$website" +packageRoot=".." # Root of translatable sources +projectName="plasma_applet_${plasmoidName}" # project name + +#--- +if [ -z "$plasmoidName" ]; then + echo "[build] Error: Couldn't read plasmoidName." + exit +fi + +if [ -z "$(which msgfmt)" ]; then + echo "[build] Error: msgfmt command not found. Need to install gettext" + echo "[build] Running 'sudo apt install gettext'" + sudo apt install gettext + echo "[build] gettext installation should be finished. Going back to installing translations." +fi + +#--- +echo "[build] Compiling messages" + +catalogs=`find . -name '*.po'` +for cat in $catalogs; do + echo "$cat" + catLocale=`basename ${cat%.*}` + msgfmt -o "${catLocale}.mo" "$cat" + + installPath="$DIR/../contents/locale/${catLocale}/LC_MESSAGES/${projectName}.mo" + + echo "[build] Install to ${installPath}" + mkdir -p "$(dirname "$installPath")" + mv "${catLocale}.mo" "${installPath}" +done + +echo "[build] Done building messages" + +if [ "$1" = "--restartplasma" ]; then + echo "[build] Restarting plasmashell" + killall plasmashell + kstart5 plasmashell + echo "[build] Done restarting plasmashell" +else + echo "[build] (re)install the plasmoid and restart plasmashell to test." +fi diff --git a/translate/de.po b/translate/de.po new file mode 100644 index 0000000..225f841 --- /dev/null +++ b/translate/de.po @@ -0,0 +1,411 @@ +# Translation of tiledmenu in de +# Copyright (C) 2016 +# This file is distributed under the same license as the tiledmenu package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: tiledmenu \n" +"Report-Msgid-Bugs-To: https://github.com/Zren/plasma-applet-tiledmenu\n" +"POT-Creation-Date: 2018-08-02 19:46-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Ruman Gerst \n" +"Language-Team: German \n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../contents/config/config.qml:26 +msgid "General" +msgstr "Allgemein" + +#: ../contents/config/config.qml:31 +msgid "Advanced" +msgstr "" + +#: ../contents/ui/AppContextMenu.qml:69 +msgid "Unpin from Menu" +msgstr "Von Menü loslösen" + +#: ../contents/ui/AppContextMenu.qml:79 +msgid "Pin to Menu" +msgstr "An Menü anheften" + +#: ../contents/ui/AppContextMenu.qml:120 +msgid "Pin to Taskbar" +msgstr "An Anwendungsleiste anheften" + +#: ../contents/ui/config/ConfigGeneral.qml:23 +msgid "Popup" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:26 +msgid "Fullscreen" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:32 +msgid "Panel Icon" +msgstr "Symbol" + +#: ../contents/ui/config/ConfigGeneral.qml:39 +msgid "Fixed Size" +msgstr "Feste Größe" + +#: ../contents/ui/config/ConfigGeneral.qml:47 +msgid "Tiles" +msgstr "Kacheln" + +#: ../contents/ui/config/ConfigGeneral.qml:53 +msgid "Tile Size" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:54 +msgid "x" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:60 +msgid "%1 px" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:65 +msgid "Tile Margin" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:66 ../contents/ui/config/ConfigGeneral.qml:237 ../contents/ui/config/ConfigGeneral.qml:262 ../contents/ui/config/ConfigGeneral.qml:303 +msgid "px" +msgstr "px" + +#: ../contents/ui/config/ConfigGeneral.qml:71 ../contents/ui/config/ConfigGeneral.qml:118 ../contents/ui/config/ConfigGeneral.qml:242 +msgid "Desktop Theme (%1)" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:79 ../contents/ui/config/ConfigGeneral.qml:125 +msgid "Custom Color" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:90 +msgid "Transparent" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:99 +msgid "Text Alignment" +msgstr "Textausrichtung" + +#: ../contents/ui/config/ConfigGeneral.qml:101 +msgid "Left" +msgstr "Links" + +#: ../contents/ui/config/ConfigGeneral.qml:102 +msgid "Center" +msgstr "Mitte" + +#: ../contents/ui/config/ConfigGeneral.qml:103 +msgid "Right" +msgstr "Rechts" + +#: ../contents/ui/config/ConfigGeneral.qml:115 +msgid "Sidebar" +msgstr "Seitenleiste" + +#: ../contents/ui/config/ConfigGeneral.qml:139 +msgid "Sidebar Shortcuts" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:185 +msgid "Add Default" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:232 +msgid "Search Box" +msgstr "Suchleiste" + +#: ../contents/ui/config/ConfigGeneral.qml:236 +msgid "Search Field Height" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:248 +msgid "Windows (White)" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:256 +msgid "App List" +msgstr "Anwendungsliste" + +#: ../contents/ui/config/ConfigGeneral.qml:261 +msgid "App List Area Width" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:269 +msgid "Default Order" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:271 +msgid "Alphabetical" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:272 ../contents/ui/SidebarView.qml:65 +msgid "Categories" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:279 +msgid "App Description" +msgstr "Anwendungsbeschreibung" + +#: ../contents/ui/config/ConfigGeneral.qml:281 +msgid "Hidden" +msgstr "Versteckt" + +#: ../contents/ui/config/ConfigGeneral.qml:282 +msgid "After" +msgstr "Danach" + +#: ../contents/ui/config/ConfigGeneral.qml:283 +msgid "Below" +msgstr "Darunter" + +#: ../contents/ui/config/ConfigGeneral.qml:295 +msgid "Show recent applications" +msgstr "Letzte Anwendungen anzeigen" + +#: ../contents/ui/config/ConfigGeneral.qml:302 +msgid "Icon Size" +msgstr "Symbolgröße" + +#: ../contents/ui/config/ConfigGeneral.qml:318 +msgid "Search Results" +msgstr "Suchergebnisse" + +#: ../contents/ui/config/ConfigGeneral.qml:322 +msgid "Merged (Application Launcher)" +msgstr "Vereinigt (Anwendungsstarter)" + +#: ../contents/ui/config/ConfigGeneral.qml:331 +msgid "Split into Categories (Application Menu / Dashboard)" +msgstr "In Kategorien unterteilen (Anwendungsmenü / Dashboard)" + +#: ../contents/ui/lib/AppletVersion.qml:41 +msgid "Version: %1" +msgstr "" + +#: ../contents/ui/Main.qml:234 +msgid "System Info" +msgstr "Systeminformationen" + +#: ../contents/ui/Main.qml:235 +msgid "Terminal" +msgstr "Terminal" + +#: ../contents/ui/Main.qml:237 +msgid "Task Manager" +msgstr "Taskmanager" + +#: ../contents/ui/Main.qml:238 +msgid "System Settings" +msgstr "Systemeinstellungen" + +#: ../contents/ui/Main.qml:239 +msgid "File Manager" +msgstr "Dateiverwaltung" + +#: ../contents/ui/Main.qml:241 +msgid "Edit Applications..." +msgstr "Anwendungen bearbeiten..." + +#: ../contents/ui/Popup.qml:60 ../contents/ui/Popup.qml:76 +msgid "Resize?" +msgstr "Größe ändern?" + +#: ../contents/ui/Popup.qml:61 ../contents/ui/Popup.qml:77 +msgid "Alt + Right Click to resize the menu." +msgstr "Alt + Rechtsklick um Menügröße zu ändern." + +#: ../contents/ui/SearchField.qml:15 +msgid "Search" +msgstr "Suchen" + +#: ../contents/ui/SearchField.qml:17 +msgid "Search Apps" +msgstr "Suche Anwendungen" + +#: ../contents/ui/SearchField.qml:19 +msgid "Search Files" +msgstr "Suche Dateien" + +#: ../contents/ui/SearchField.qml:21 +msgid "Search Bookmarks" +msgstr "Suche Lesezeichen" + +#: ../contents/ui/SearchField.qml:23 +msgctxt "Search [krunnerName, krunnerName, ...], " +msgid "Search %1" +msgstr "Suche %1" + +#: ../contents/ui/SearchFiltersViewItem.qml:115 ../contents/ui/SearchFiltersView.qml:30 +msgid "Default" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:19 +msgid "All" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:20 +msgid "Search with all KRunner plugins" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:31 +msgid "Search with user selected defaults" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:42 +msgid "Applications" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:49 +msgid "Files" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:59 +msgid "Music" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:67 +msgid "Videos" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:77 +msgid "Bookmarks" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:84 +msgid "locations" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:91 +msgid "Dictionary" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:99 +msgid "Shell" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:106 +msgid "Calculator" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:113 +msgid "Windowed Widgets" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:120 +msgid "Date/Time" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:127 +msgid "Unit Converter" +msgstr "" + +#: ../contents/ui/SearchResultsView.qml:70 +msgid "Filters" +msgstr "" + +#: ../contents/ui/SidebarView.qml:50 +msgid "Menu" +msgstr "Menü" + +#: ../contents/ui/SidebarView.qml:57 +msgid "Apps" +msgstr "Anwendungen" + +#: ../contents/ui/SidebarView.qml:95 +msgid "User Manager" +msgstr "Benutzerverwaltung" + +#: ../contents/ui/SidebarView.qml:133 +msgid "Power" +msgstr "Ein/Aus" + +#: ../contents/ui/TileEditorView.qml:43 ../contents/ui/TileItem.qml:106 +msgid "Edit Tile" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:47 +msgid "Reset Tile" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:52 +msgid "Close" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:73 +msgid "Url" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:79 +msgid "Label" +msgstr "Beschriftung" + +#: ../contents/ui/TileEditorView.qml:87 +msgid "Icon" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:106 +msgid "Background Image" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:116 +msgid "Choose an image" +msgstr "Bild auswählen" + +#: ../contents/ui/TileEditorView.qml:121 +msgid "Image Files (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)" +msgstr "Bilder (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)" + +#: ../contents/ui/TileEditorView.qml:135 +msgid "Background Color" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:141 +msgid "Position / Size" +msgstr "" + +#: ../contents/ui/TileGrid.qml:323 +msgid "New Group" +msgstr "" + +#: ../contents/ui/TileGrid.qml:333 +msgid "Unlock Tiles" +msgstr "" + +#: ../contents/ui/TileGrid.qml:333 +msgid "Lock Tiles" +msgstr "" + +#: ../contents/ui/TileGrid.qml:518 +msgctxt "default group label" +msgid "Group" +msgstr "" + +#~ msgctxt "@item:inmenu Open icon chooser dialog" +#~ msgid "Choose..." +#~ msgstr "Auswählen..." + +#~ msgctxt "@item:inmenu Reset icon to default" +#~ msgid "Clear Icon" +#~ msgstr "Symbol zurücksetzen" + +#~ msgid "More" +#~ msgstr "Mehr" + +#~ msgid "Size" +#~ msgstr "Größe" + +#~ msgid "Small" +#~ msgstr "Klein" + +#~ msgid "Medium" +#~ msgstr "Mittel" + +#~ msgid "Settings" +#~ msgstr "Einstellungen" diff --git a/translate/es.po b/translate/es.po new file mode 100644 index 0000000..a9e0969 --- /dev/null +++ b/translate/es.po @@ -0,0 +1,396 @@ +# Translation of tiledmenu in es +# Copyright (C) 2017 +# This file is distributed under the same license as the tiledmenu package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: tiledmenu \n" +"Report-Msgid-Bugs-To: https://github.com/Zren/plasma-applet-tiledmenu\n" +"POT-Creation-Date: 2018-08-02 19:46-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Kepa Badiola \n" +"Language-Team: Spanish \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../contents/config/config.qml:26 +msgid "General" +msgstr "General" + +#: ../contents/config/config.qml:31 +msgid "Advanced" +msgstr "Avanzado" + +#: ../contents/ui/AppContextMenu.qml:69 +msgid "Unpin from Menu" +msgstr "Desanclar del Menú" + +#: ../contents/ui/AppContextMenu.qml:79 +msgid "Pin to Menu" +msgstr "Anclar al Menú" + +#: ../contents/ui/AppContextMenu.qml:120 +msgid "Pin to Taskbar" +msgstr "Anclar a la Barra de Tareas" + +#: ../contents/ui/config/ConfigGeneral.qml:23 +msgid "Popup" +msgstr "Mensaje Emergente" + +#: ../contents/ui/config/ConfigGeneral.qml:26 +msgid "Fullscreen" +msgstr "Pantalla Completa" + +#: ../contents/ui/config/ConfigGeneral.qml:32 +msgid "Panel Icon" +msgstr "Icono del Panel" + +#: ../contents/ui/config/ConfigGeneral.qml:39 +msgid "Fixed Size" +msgstr "Tamaño Fijo" + +#: ../contents/ui/config/ConfigGeneral.qml:47 +msgid "Tiles" +msgstr "Baldosas" + +#: ../contents/ui/config/ConfigGeneral.qml:53 +msgid "Tile Size" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:54 +msgid "x" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:60 +msgid "%1 px" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:65 +msgid "Tile Margin" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:66 ../contents/ui/config/ConfigGeneral.qml:237 ../contents/ui/config/ConfigGeneral.qml:262 ../contents/ui/config/ConfigGeneral.qml:303 +msgid "px" +msgstr "px" + +#: ../contents/ui/config/ConfigGeneral.qml:71 ../contents/ui/config/ConfigGeneral.qml:118 ../contents/ui/config/ConfigGeneral.qml:242 +msgid "Desktop Theme (%1)" +msgstr "Tema de Escritorio (%1)" + +#: ../contents/ui/config/ConfigGeneral.qml:79 ../contents/ui/config/ConfigGeneral.qml:125 +msgid "Custom Color" +msgstr "Color Personalizado" + +#: ../contents/ui/config/ConfigGeneral.qml:90 +msgid "Transparent" +msgstr "Transparente" + +#: ../contents/ui/config/ConfigGeneral.qml:99 +msgid "Text Alignment" +msgstr "Alineamiento del Texto" + +#: ../contents/ui/config/ConfigGeneral.qml:101 +msgid "Left" +msgstr "Izquierda" + +#: ../contents/ui/config/ConfigGeneral.qml:102 +msgid "Center" +msgstr "Centro" + +#: ../contents/ui/config/ConfigGeneral.qml:103 +msgid "Right" +msgstr "Derecha" + +#: ../contents/ui/config/ConfigGeneral.qml:115 +msgid "Sidebar" +msgstr "Barra Lateral" + +#: ../contents/ui/config/ConfigGeneral.qml:139 +msgid "Sidebar Shortcuts" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:185 +msgid "Add Default" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:232 +msgid "Search Box" +msgstr "Caja de Búsqueda" + +#: ../contents/ui/config/ConfigGeneral.qml:236 +msgid "Search Field Height" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:248 +msgid "Windows (White)" +msgstr "Ventanas (Blanco)" + +#: ../contents/ui/config/ConfigGeneral.qml:256 +msgid "App List" +msgstr "Lista de Aplicaciones" + +#: ../contents/ui/config/ConfigGeneral.qml:261 +msgid "App List Area Width" +msgstr "Ancho del area de la Lista de Aplicaciones" + +#: ../contents/ui/config/ConfigGeneral.qml:269 +msgid "Default Order" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:271 +msgid "Alphabetical" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:272 ../contents/ui/SidebarView.qml:65 +msgid "Categories" +msgstr "Categorías" + +#: ../contents/ui/config/ConfigGeneral.qml:279 +msgid "App Description" +msgstr "Descripción de la Applicación" + +#: ../contents/ui/config/ConfigGeneral.qml:281 +msgid "Hidden" +msgstr "Oculto" + +#: ../contents/ui/config/ConfigGeneral.qml:282 +msgid "After" +msgstr "Después" + +#: ../contents/ui/config/ConfigGeneral.qml:283 +msgid "Below" +msgstr "Debajo" + +#: ../contents/ui/config/ConfigGeneral.qml:295 +msgid "Show recent applications" +msgstr "Mostrar aplicaciones recientes" + +#: ../contents/ui/config/ConfigGeneral.qml:302 +msgid "Icon Size" +msgstr "Tamaño de Icono" + +#: ../contents/ui/config/ConfigGeneral.qml:318 +msgid "Search Results" +msgstr "Resultados de la Búsqueda" + +#: ../contents/ui/config/ConfigGeneral.qml:322 +msgid "Merged (Application Launcher)" +msgstr "Fusionado (Lanzador de Aplicaciones)" + +#: ../contents/ui/config/ConfigGeneral.qml:331 +msgid "Split into Categories (Application Menu / Dashboard)" +msgstr "Dividir en Categorías (Menú de Aplicaciones / Tablero de Mandos)" + +#: ../contents/ui/lib/AppletVersion.qml:41 +msgid "Version: %1" +msgstr "Versión: %1" + +#: ../contents/ui/Main.qml:234 +msgid "System Info" +msgstr "Información del Sistema" + +#: ../contents/ui/Main.qml:235 +msgid "Terminal" +msgstr "Terminal" + +#: ../contents/ui/Main.qml:237 +msgid "Task Manager" +msgstr "Administrador de Tareas" + +#: ../contents/ui/Main.qml:238 +msgid "System Settings" +msgstr "Preferencias del Sistema" + +#: ../contents/ui/Main.qml:239 +msgid "File Manager" +msgstr "Explorador de Archivos" + +#: ../contents/ui/Main.qml:241 +msgid "Edit Applications..." +msgstr "Editar Aplicaciones..." + +#: ../contents/ui/Popup.qml:60 ../contents/ui/Popup.qml:76 +msgid "Resize?" +msgstr "¿Redimensionar?" + +#: ../contents/ui/Popup.qml:61 ../contents/ui/Popup.qml:77 +msgid "Alt + Right Click to resize the menu." +msgstr "Alt + Click Derecho para redimensioanr el menú" + +#: ../contents/ui/SearchField.qml:15 +msgid "Search" +msgstr "Buscar" + +#: ../contents/ui/SearchField.qml:17 +msgid "Search Apps" +msgstr "Buscar Aplicaciones" + +#: ../contents/ui/SearchField.qml:19 +msgid "Search Files" +msgstr "Buscar Archivos" + +#: ../contents/ui/SearchField.qml:21 +msgid "Search Bookmarks" +msgstr "Buscar Marcadores" + +#: ../contents/ui/SearchField.qml:23 +msgctxt "Search [krunnerName, krunnerName, ...], " +msgid "Search %1" +msgstr "Buscar %1" + +#: ../contents/ui/SearchFiltersViewItem.qml:115 ../contents/ui/SearchFiltersView.qml:30 +msgid "Default" +msgstr "Predeterminado" + +#: ../contents/ui/SearchFiltersView.qml:19 +msgid "All" +msgstr "Todo" + +#: ../contents/ui/SearchFiltersView.qml:20 +msgid "Search with all KRunner plugins" +msgstr "Buscar con todos los complementos de KRunner" + +#: ../contents/ui/SearchFiltersView.qml:31 +msgid "Search with user selected defaults" +msgstr "Buscar con los ajustes predeterminados seleccionados por el usuario" + +#: ../contents/ui/SearchFiltersView.qml:42 +msgid "Applications" +msgstr "Aplicaciones" + +#: ../contents/ui/SearchFiltersView.qml:49 +msgid "Files" +msgstr "Archivos" + +#: ../contents/ui/SearchFiltersView.qml:59 +msgid "Music" +msgstr "Música" + +#: ../contents/ui/SearchFiltersView.qml:67 +msgid "Videos" +msgstr "Vídeos" + +#: ../contents/ui/SearchFiltersView.qml:77 +msgid "Bookmarks" +msgstr "Marcadores" + +#: ../contents/ui/SearchFiltersView.qml:84 +msgid "locations" +msgstr "Ubicaciones" + +#: ../contents/ui/SearchFiltersView.qml:91 +msgid "Dictionary" +msgstr "Diccionario" + +#: ../contents/ui/SearchFiltersView.qml:99 +msgid "Shell" +msgstr "Intérprete de Comandos" + +#: ../contents/ui/SearchFiltersView.qml:106 +msgid "Calculator" +msgstr "Calculadora" + +#: ../contents/ui/SearchFiltersView.qml:113 +msgid "Windowed Widgets" +msgstr "Elementos Gráficos en Modo Ventana" + +#: ../contents/ui/SearchFiltersView.qml:120 +msgid "Date/Time" +msgstr "Fecha/Hora" + +#: ../contents/ui/SearchFiltersView.qml:127 +msgid "Unit Converter" +msgstr "Conversor de Unidades" + +#: ../contents/ui/SearchResultsView.qml:70 +msgid "Filters" +msgstr "Filtros" + +#: ../contents/ui/SidebarView.qml:50 +msgid "Menu" +msgstr "Menú" + +#: ../contents/ui/SidebarView.qml:57 +msgid "Apps" +msgstr "Aplicaciones" + +#: ../contents/ui/SidebarView.qml:95 +msgid "User Manager" +msgstr "Administrador de Usuario" + +#: ../contents/ui/SidebarView.qml:133 +msgid "Power" +msgstr "Inicio y Apagado" + +#: ../contents/ui/TileEditorView.qml:43 ../contents/ui/TileItem.qml:106 +msgid "Edit Tile" +msgstr "Editar Baldosa" + +#: ../contents/ui/TileEditorView.qml:47 +msgid "Reset Tile" +msgstr "Reiniciar Baldosa" + +#: ../contents/ui/TileEditorView.qml:52 +msgid "Close" +msgstr "Cerrar" + +#: ../contents/ui/TileEditorView.qml:73 +msgid "Url" +msgstr "Url" + +#: ../contents/ui/TileEditorView.qml:79 +msgid "Label" +msgstr "Etiqueta" + +#: ../contents/ui/TileEditorView.qml:87 +msgid "Icon" +msgstr "Icono" + +#: ../contents/ui/TileEditorView.qml:106 +msgid "Background Image" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:116 +msgid "Choose an image" +msgstr "Elegir una Imagen" + +#: ../contents/ui/TileEditorView.qml:121 +msgid "Image Files (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)" +msgstr "Archivos de Imagen (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)" + +#: ../contents/ui/TileEditorView.qml:135 +msgid "Background Color" +msgstr "Color de Fondo" + +#: ../contents/ui/TileEditorView.qml:141 +msgid "Position / Size" +msgstr "Posición / Tamaño" + +#: ../contents/ui/TileGrid.qml:323 +msgid "New Group" +msgstr "" + +#: ../contents/ui/TileGrid.qml:333 +msgid "Unlock Tiles" +msgstr "" + +#: ../contents/ui/TileGrid.qml:333 +msgid "Lock Tiles" +msgstr "" + +#: ../contents/ui/TileGrid.qml:518 +msgctxt "default group label" +msgid "Group" +msgstr "" + +#~ msgctxt "@item:inmenu Open icon chooser dialog" +#~ msgid "Choose..." +#~ msgstr "Elegir..." + +#~ msgctxt "@item:inmenu Reset icon to default" +#~ msgid "Clear Icon" +#~ msgstr "Limpiar Icono" diff --git a/translate/fr.po b/translate/fr.po new file mode 100644 index 0000000..3a658ff --- /dev/null +++ b/translate/fr.po @@ -0,0 +1,416 @@ +# Translation of tiledmenu in fr +# Copyright (C) 2016 +# This file is distributed under the same license as the tiledmenu package. +# FIRST AUTHOR , YEAR. +# +# Various translations taken from: +# https://websvn.kde.org/trunk/l10n-kf5/fr/messages/kde-workspace/ +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: tiledmenu \n" +"Report-Msgid-Bugs-To: https://github.com/Zren/plasma-applet-tiledmenu\n" +"POT-Creation-Date: 2018-08-02 19:46-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: fr\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../contents/config/config.qml:26 +msgid "General" +msgstr "Général" + +#: ../contents/config/config.qml:31 +msgid "Advanced" +msgstr "" + +#: ../contents/ui/AppContextMenu.qml:69 +msgid "Unpin from Menu" +msgstr "" + +#: ../contents/ui/AppContextMenu.qml:79 +msgid "Pin to Menu" +msgstr "" + +#: ../contents/ui/AppContextMenu.qml:120 +msgid "Pin to Taskbar" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:23 +msgid "Popup" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:26 +msgid "Fullscreen" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:32 +msgid "Panel Icon" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:39 +msgid "Fixed Size" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:47 +msgid "Tiles" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:53 +msgid "Tile Size" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:54 +msgid "x" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:60 +msgid "%1 px" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:65 +msgid "Tile Margin" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:66 ../contents/ui/config/ConfigGeneral.qml:237 ../contents/ui/config/ConfigGeneral.qml:262 ../contents/ui/config/ConfigGeneral.qml:303 +msgid "px" +msgstr "px" + +#: ../contents/ui/config/ConfigGeneral.qml:71 ../contents/ui/config/ConfigGeneral.qml:118 ../contents/ui/config/ConfigGeneral.qml:242 +msgid "Desktop Theme (%1)" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:79 ../contents/ui/config/ConfigGeneral.qml:125 +msgid "Custom Color" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:90 +msgid "Transparent" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:99 +msgid "Text Alignment" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:101 +msgid "Left" +msgstr "Gauche" + +#: ../contents/ui/config/ConfigGeneral.qml:102 +msgid "Center" +msgstr "Centre" + +#: ../contents/ui/config/ConfigGeneral.qml:103 +msgid "Right" +msgstr "Droite" + +#: ../contents/ui/config/ConfigGeneral.qml:115 +msgid "Sidebar" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:139 +msgid "Sidebar Shortcuts" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:185 +msgid "Add Default" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:232 +msgid "Search Box" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:236 +msgid "Search Field Height" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:248 +msgid "Windows (White)" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:256 +msgid "App List" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:261 +msgid "App List Area Width" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:269 +msgid "Default Order" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:271 +msgid "Alphabetical" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:272 ../contents/ui/SidebarView.qml:65 +msgid "Categories" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:279 +msgid "App Description" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:281 +msgid "Hidden" +msgstr "Masqué" + +#: ../contents/ui/config/ConfigGeneral.qml:282 +msgid "After" +msgstr "Après" + +#: ../contents/ui/config/ConfigGeneral.qml:283 +msgid "Below" +msgstr "En-dessous" + +#: ../contents/ui/config/ConfigGeneral.qml:295 +msgid "Show recent applications" +msgstr "Afficher les applications récentes" + +#: ../contents/ui/config/ConfigGeneral.qml:302 +#, fuzzy +msgid "Icon Size" +msgstr "Taille des icônes" + +#: ../contents/ui/config/ConfigGeneral.qml:318 +msgid "Search Results" +msgstr "Résultats de la recherche" + +#: ../contents/ui/config/ConfigGeneral.qml:322 +msgid "Merged (Application Launcher)" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:331 +msgid "Split into Categories (Application Menu / Dashboard)" +msgstr "" + +#: ../contents/ui/lib/AppletVersion.qml:41 +msgid "Version: %1" +msgstr "" + +#: ../contents/ui/Main.qml:234 +msgid "System Info" +msgstr "Centre d'informations" + +#: ../contents/ui/Main.qml:235 +msgid "Terminal" +msgstr "Terminal" + +#: ../contents/ui/Main.qml:237 +msgid "Task Manager" +msgstr "Surveillance du système" + +#: ../contents/ui/Main.qml:238 +msgid "System Settings" +msgstr "Configuration du système" + +#: ../contents/ui/Main.qml:239 +msgid "File Manager" +msgstr "Gestionnaire de fichiers" + +#: ../contents/ui/Main.qml:241 +msgid "Edit Applications..." +msgstr "Éditer les applications…" + +#: ../contents/ui/Popup.qml:60 ../contents/ui/Popup.qml:76 +msgid "Resize?" +msgstr "" + +#: ../contents/ui/Popup.qml:61 ../contents/ui/Popup.qml:77 +msgid "Alt + Right Click to resize the menu." +msgstr "" + +#: ../contents/ui/SearchField.qml:15 +msgid "Search" +msgstr "Chercher" + +#: ../contents/ui/SearchField.qml:17 +msgid "Search Apps" +msgstr "" + +#: ../contents/ui/SearchField.qml:19 +msgid "Search Files" +msgstr "Rechercher des fichiers" + +#: ../contents/ui/SearchField.qml:21 +msgid "Search Bookmarks" +msgstr "" + +#: ../contents/ui/SearchField.qml:23 +msgctxt "Search [krunnerName, krunnerName, ...], " +msgid "Search %1" +msgstr "" + +#: ../contents/ui/SearchFiltersViewItem.qml:115 ../contents/ui/SearchFiltersView.qml:30 +msgid "Default" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:19 +msgid "All" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:20 +msgid "Search with all KRunner plugins" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:31 +msgid "Search with user selected defaults" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:42 +msgid "Applications" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:49 +msgid "Files" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:59 +msgid "Music" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:67 +msgid "Videos" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:77 +msgid "Bookmarks" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:84 +msgid "locations" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:91 +msgid "Dictionary" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:99 +msgid "Shell" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:106 +msgid "Calculator" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:113 +msgid "Windowed Widgets" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:120 +msgid "Date/Time" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:127 +msgid "Unit Converter" +msgstr "" + +#: ../contents/ui/SearchResultsView.qml:70 +msgid "Filters" +msgstr "" + +#: ../contents/ui/SidebarView.qml:50 +msgid "Menu" +msgstr "Menu" + +#: ../contents/ui/SidebarView.qml:57 +msgid "Apps" +msgstr "Applications" + +#: ../contents/ui/SidebarView.qml:95 +#, fuzzy +msgid "User Manager" +msgstr "Gestionnaire d'utilisateurs" + +#: ../contents/ui/SidebarView.qml:133 +msgid "Power" +msgstr "Énergie" + +#: ../contents/ui/TileEditorView.qml:43 ../contents/ui/TileItem.qml:106 +msgid "Edit Tile" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:47 +msgid "Reset Tile" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:52 +msgid "Close" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:73 +msgid "Url" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:79 +msgid "Label" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:87 +msgid "Icon" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:106 +msgid "Background Image" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:116 +msgid "Choose an image" +msgstr "Choisir une image" + +#: ../contents/ui/TileEditorView.qml:121 +msgid "Image Files (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)" +msgstr "Fichiers d'image (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)" + +#: ../contents/ui/TileEditorView.qml:135 +msgid "Background Color" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:141 +msgid "Position / Size" +msgstr "" + +#: ../contents/ui/TileGrid.qml:323 +msgid "New Group" +msgstr "" + +#: ../contents/ui/TileGrid.qml:333 +msgid "Unlock Tiles" +msgstr "" + +#: ../contents/ui/TileGrid.qml:333 +msgid "Lock Tiles" +msgstr "" + +#: ../contents/ui/TileGrid.qml:518 +msgctxt "default group label" +msgid "Group" +msgstr "" + +#~ msgctxt "@item:inmenu Open icon chooser dialog" +#~ msgid "Choose..." +#~ msgstr "Sélectionner…" + +#~ msgctxt "@item:inmenu Reset icon to default" +#~ msgid "Clear Icon" +#~ msgstr "Réinitialiser l'icône" + +#~ msgid "More" +#~ msgstr "Plus" + +#~ msgid "Size" +#~ msgstr "Taille" + +#~ msgid "Small" +#~ msgstr "Petit" + +#~ msgid "Medium" +#~ msgstr "Moyen" + +#~ msgid "Settings" +#~ msgstr "Configuration" diff --git a/translate/install b/translate/install new file mode 100755 index 0000000..0b74142 --- /dev/null +++ b/translate/install @@ -0,0 +1,54 @@ +#!/bin/sh +# Version: 3 + +# TODO: Call a CMakeLists.txt ... +# OR just find out what env variables it looks at to determine the "/usr/share" dir. +# TODO: check if run as root, and if so, install to /usr/share instead of ~/.local/share + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +plasmoidName=`kreadconfig5 --file="$DIR/../metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Name"` +website=`kreadconfig5 --file="$DIR/../metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Website"` +bugAddress="$website" +packageRoot=".." # Root of translatable sources +projectName="plasma_applet_${plasmoidName}" # project name + +#--- +if [ -z "$plasmoidName" ]; then + echo "[install] Error: Couldn't read plasmoidName." + exit +fi + +if [ -z "$(which msgfmt)" ]; then + echo "[install] Error: msgfmt command not found. Need to install gettext" + echo "[install] Running 'sudo apt install gettext'" + sudo apt install gettext + echo "[install] gettext installation should be finished. Going back to installing translations." +fi + +#--- +echo "[install] Installing messages" + +catalogs=`find . -name '*.po'` +for cat in $catalogs; do + echo "$cat" + catLocale=`basename ${cat%.*}` + msgfmt -o "${catLocale}.mo" "$cat" + + # installPath="/usr/share/locale/${catLocale}/LC_MESSAGES/${projectName}.mo" + installPath="${HOME}/.local/share/locale/${catLocale}/LC_MESSAGES/${projectName}.mo" + + mkdir -p "$(dirname "$installPath")" + + echo "[install] Install to ${installPath}" + + # sudo mv "${catLocale}.mo" "${installPath}" + # sudo chown root "${installPath}" + mv "${catLocale}.mo" "${installPath}" +done + +echo "[install] Done installing messages (will take effect after restarting plasmashell)" + +echo "[install] Restarting plasmashell" +killall plasmashell +kstart5 plasmashell +echo "[install] Done restarting plasmashell" diff --git a/translate/merge b/translate/merge new file mode 100755 index 0000000..39f8ead --- /dev/null +++ b/translate/merge @@ -0,0 +1,109 @@ +#!/bin/sh +# Version: 7 + +# https://techbase.kde.org/Development/Tutorials/Localization/i18n_Build_Systems +# Based on: https://github.com/psifidotos/nowdock-plasmoid/blob/master/po/Messages.sh + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +plasmoidName=`kreadconfig5 --file="$DIR/../metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Name"` +widgetName="${plasmoidName##*.}" # Strip namespace +website=`kreadconfig5 --file="$DIR/../metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Website"` +bugAddress="$website" +packageRoot=".." # Root of translatable sources +projectName="plasma_applet_${plasmoidName}" # project name + +#--- +if [ -z "$plasmoidName" ]; then + echo "[merge] Error: Couldn't read plasmoidName." + exit +fi + +if [ -z "$(which xgettext)" ]; then + echo "[merge] Error: xgettext command not found. Need to install gettext" + echo "[merge] Running 'sudo apt install gettext'" + sudo apt install gettext + echo "[merge] gettext installation should be finished. Going back to merging translations." +fi + +#--- +echo "[merge] Extracting messages" +find "${packageRoot}" -name '*.cpp' -o -name '*.h' -o -name '*.c' -o -name '*.qml' | sort > "${DIR}/infiles.list" + +xgettext --from-code=UTF-8 -C -kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 \ + -ktr2i18n:1 -kI18N_NOOP:1 -kI18N_NOOP2:1c,2 -kN_:1 -kaliasLocale -kki18n:1 -kki18nc:1c,2 \ + -kki18np:1,2 -kki18ncp:1c,2,3 --msgid-bugs-address="${bugAddress}" --files-from=infiles.list \ + --width=200 --package-name="${widgetName}" --package-version="" \ + -D "${packageRoot}" -D "${DIR}" -o "template.pot.new" || \ + { echo "[merge] error while calling xgettext. aborting."; exit 1; } + +sed -i 's/# SOME DESCRIPTIVE TITLE./'"# Translation of ${widgetName} in LANGUAGE"'/' "template.pot.new" +sed -i 's/# Copyright (C) YEAR THE PACKAGE'"'"'S COPYRIGHT HOLDER/'"# Copyright (C) $(date +%Y)"'/' "template.pot.new" + +if [ -f "template.pot" ]; then + newPotDate=`grep "POT-Creation-Date:" template.pot.new | sed 's/.\{3\}$//'` + oldPotDate=`grep "POT-Creation-Date:" template.pot | sed 's/.\{3\}$//'` + sed -i 's/'"${newPotDate}"'/'"${oldPotDate}"'/' "template.pot.new" + changes=`diff "template.pot" "template.pot.new"` + if [ ! -z "$changes" ]; then + # There's been changes + sed -i 's/'"${oldPotDate}"'/'"${newPotDate}"'/' "template.pot.new" + mv "template.pot.new" "template.pot" + + addedKeys=`echo "$changes" | grep "> msgid" | cut -c 9- | sort` + removedKeys=`echo "$changes" | grep "< msgid" | cut -c 9- | sort` + echo "" + echo "Added Keys:" + echo "$addedKeys" + echo "" + echo "Removed Keys:" + echo "$removedKeys" + echo "" + + else + # No changes + rm "template.pot.new" + fi +else + # template.pot didn't already exist + mv "template.pot.new" "template.pot" +fi + +potMessageCount=`expr $(grep -c 'msgstr ""' "template.pot") - 1` +echo "| Locale | Lines | % Done|" > "./Status.md" +echo "|----------|---------|-------|" >> "./Status.md" +entryFormat="| %-8s | %7s | %5s |" +templateLine=`perl -e "printf(\"$entryFormat\", \"Template\", \"${potMessageCount}\", \"\")"` +echo "$templateLine" >> "./Status.md" + +rm "${DIR}/infiles.list" +echo "[merge] Done extracting messages" + +#--- +echo "[merge] Merging messages" +catalogs=`find . -name '*.po' | sort` +for cat in $catalogs; do + echo "[merge] $cat" + catLocale=`basename ${cat%.*}` + msgmerge \ + --width=400 \ + --no-fuzzy-matching \ + -o "$cat.new" "$cat" "${DIR}/template.pot" + sed -i 's/# SOME DESCRIPTIVE TITLE./'"# Translation of ${widgetName} in ${catLocale}"'/' "$cat.new" + sed -i 's/# Translation of '"${widgetName}"' in LANGUAGE/'"# Translation of ${widgetName} in ${catLocale}"'/' "$cat.new" + sed -i 's/# Copyright (C) YEAR THE PACKAGE'"'"'S COPYRIGHT HOLDER/'"# Copyright (C) $(date +%Y)"'/' "$cat.new" + + poEmptyMessageCount=`expr $(grep -Pzo 'msgstr ""\n\n' "$cat.new" | grep -c 'msgstr ""')` + poMessagesDoneCount=`expr $potMessageCount - $poEmptyMessageCount` + poCompletion=`perl -e "printf(\"%d\", $poMessagesDoneCount * 100 / $potMessageCount)"` + poLine=`perl -e "printf(\"$entryFormat\", $catLocale, \"${poMessagesDoneCount}/${potMessageCount}\", \"${poCompletion}%\")"` + echo "$poLine" >> "./Status.md" + + # mv "$cat" "$cat.old" + mv "$cat.new" "$cat" +done + +sed -i '/^|/ d' ./ReadMe.md # Remove status table from ReadMe +cat ./Status.md >> ./ReadMe.md +rm ./Status.md + +echo "[merge] Done merging messages" diff --git a/translate/metadata.desktop b/translate/metadata.desktop new file mode 100644 index 0000000..6709813 --- /dev/null +++ b/translate/metadata.desktop @@ -0,0 +1,21 @@ +[Desktop Entry] +Name=Tiled Menu +Comment=A menu based on Windows 10's Start Menu. + +Type=Service +Icon=start-here-kde +X-KDE-ServiceTypes=Plasma/Applet + +X-Plasma-API=declarativeappletscript +X-Plasma-MainScript=ui/Main.qml + +X-KDE-PluginInfo-Author=Chris Holland +X-KDE-PluginInfo-Email=zrenfire@gmail.com +X-KDE-PluginInfo-Name=com.github.zren.tiledmenu +X-KDE-PluginInfo-Version=23 +X-KDE-PluginInfo-Website=https://github.com/Zren/plasma-applet-tiledmenu +X-KDE-PluginInfo-KdeStoreId=1160672 +X-KDE-PluginInfo-Category=Application Launchers +X-KDE-PluginInfo-Depends= + +X-Plasma-Provides=org.kde.plasma.launchermenu diff --git a/translate/nl_NL.po b/translate/nl_NL.po new file mode 100644 index 0000000..6a722c1 --- /dev/null +++ b/translate/nl_NL.po @@ -0,0 +1,389 @@ +# Translation of tiledmenu in nl_NL +# Copyright (C) 2018 +# This file is distributed under the same license as the tiledmenu package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: tiledmenu\n" +"Report-Msgid-Bugs-To: https://github.com/Zren/plasma-applet-tiledmenu\n" +"POT-Creation-Date: 2018-08-02 19:46-0400\n" +"PO-Revision-Date: 2018-06-15 20:51+0200\n" +"Last-Translator: Heimen Stoffels \n" +"Language-Team: \n" +"Language: nl_NL\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.0.8\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: ../contents/config/config.qml:26 +msgid "General" +msgstr "Algemeen" + +#: ../contents/config/config.qml:31 +msgid "Advanced" +msgstr "Geavanceerd" + +#: ../contents/ui/AppContextMenu.qml:69 +msgid "Unpin from Menu" +msgstr "Losmaken" + +#: ../contents/ui/AppContextMenu.qml:79 +msgid "Pin to Menu" +msgstr "Vastmaken aan menu" + +#: ../contents/ui/AppContextMenu.qml:120 +msgid "Pin to Taskbar" +msgstr "Vastmaken aan taakbalk" + +#: ../contents/ui/config/ConfigGeneral.qml:23 +msgid "Popup" +msgstr "Pop-up" + +#: ../contents/ui/config/ConfigGeneral.qml:26 +msgid "Fullscreen" +msgstr "Volledig scherm" + +#: ../contents/ui/config/ConfigGeneral.qml:32 +msgid "Panel Icon" +msgstr "Paneelpictogram" + +#: ../contents/ui/config/ConfigGeneral.qml:39 +msgid "Fixed Size" +msgstr "Vaste grootte" + +#: ../contents/ui/config/ConfigGeneral.qml:47 +msgid "Tiles" +msgstr "Tegels" + +#: ../contents/ui/config/ConfigGeneral.qml:53 +msgid "Tile Size" +msgstr "Tegelgrootte" + +#: ../contents/ui/config/ConfigGeneral.qml:54 +msgid "x" +msgstr "x" + +#: ../contents/ui/config/ConfigGeneral.qml:60 +msgid "%1 px" +msgstr "%1 px" + +#: ../contents/ui/config/ConfigGeneral.qml:65 +msgid "Tile Margin" +msgstr "Tegelruimte" + +#: ../contents/ui/config/ConfigGeneral.qml:66 ../contents/ui/config/ConfigGeneral.qml:237 ../contents/ui/config/ConfigGeneral.qml:262 ../contents/ui/config/ConfigGeneral.qml:303 +msgid "px" +msgstr "px" + +#: ../contents/ui/config/ConfigGeneral.qml:71 ../contents/ui/config/ConfigGeneral.qml:118 ../contents/ui/config/ConfigGeneral.qml:242 +msgid "Desktop Theme (%1)" +msgstr "Bureaubladthema (%1)" + +#: ../contents/ui/config/ConfigGeneral.qml:79 ../contents/ui/config/ConfigGeneral.qml:125 +msgid "Custom Color" +msgstr "Aangepaste kleur" + +#: ../contents/ui/config/ConfigGeneral.qml:90 +msgid "Transparent" +msgstr "Doorzichtig" + +#: ../contents/ui/config/ConfigGeneral.qml:99 +msgid "Text Alignment" +msgstr "Tekstuitlijning" + +#: ../contents/ui/config/ConfigGeneral.qml:101 +msgid "Left" +msgstr "Links" + +#: ../contents/ui/config/ConfigGeneral.qml:102 +msgid "Center" +msgstr "Gecentreerd" + +#: ../contents/ui/config/ConfigGeneral.qml:103 +msgid "Right" +msgstr "Rechts" + +#: ../contents/ui/config/ConfigGeneral.qml:115 +msgid "Sidebar" +msgstr "Zijbalk" + +#: ../contents/ui/config/ConfigGeneral.qml:139 +msgid "Sidebar Shortcuts" +msgstr "Snelkoppelingen in zijbalk" + +#: ../contents/ui/config/ConfigGeneral.qml:185 +msgid "Add Default" +msgstr "Standaard:" + +#: ../contents/ui/config/ConfigGeneral.qml:232 +msgid "Search Box" +msgstr "Zoekvak" + +#: ../contents/ui/config/ConfigGeneral.qml:236 +msgid "Search Field Height" +msgstr "Hoogte" + +#: ../contents/ui/config/ConfigGeneral.qml:248 +msgid "Windows (White)" +msgstr "Windows (wit)" + +#: ../contents/ui/config/ConfigGeneral.qml:256 +msgid "App List" +msgstr "Applicatielijst" + +#: ../contents/ui/config/ConfigGeneral.qml:261 +msgid "App List Area Width" +msgstr "Breedte" + +#: ../contents/ui/config/ConfigGeneral.qml:269 +msgid "Default Order" +msgstr "Standaardvolgorde" + +#: ../contents/ui/config/ConfigGeneral.qml:271 +msgid "Alphabetical" +msgstr "Alfabetisch" + +#: ../contents/ui/config/ConfigGeneral.qml:272 ../contents/ui/SidebarView.qml:65 +msgid "Categories" +msgstr "Categorieën" + +#: ../contents/ui/config/ConfigGeneral.qml:279 +msgid "App Description" +msgstr "Beschrijving" + +#: ../contents/ui/config/ConfigGeneral.qml:281 +msgid "Hidden" +msgstr "Verborgen" + +#: ../contents/ui/config/ConfigGeneral.qml:282 +msgid "After" +msgstr "Naast" + +#: ../contents/ui/config/ConfigGeneral.qml:283 +msgid "Below" +msgstr "Onder" + +#: ../contents/ui/config/ConfigGeneral.qml:295 +msgid "Show recent applications" +msgstr "Recente applicaties tonen" + +#: ../contents/ui/config/ConfigGeneral.qml:302 +msgid "Icon Size" +msgstr "Pictogramgrootte" + +#: ../contents/ui/config/ConfigGeneral.qml:318 +msgid "Search Results" +msgstr "Zoekresultaten" + +#: ../contents/ui/config/ConfigGeneral.qml:322 +msgid "Merged (Application Launcher)" +msgstr "Samengevoegd (applicatiestarter)" + +#: ../contents/ui/config/ConfigGeneral.qml:331 +msgid "Split into Categories (Application Menu / Dashboard)" +msgstr "Opgesplitst in categorieën (applicatiemenu/dashboard)" + +#: ../contents/ui/lib/AppletVersion.qml:41 +msgid "Version: %1" +msgstr "Versie: %1" + +#: ../contents/ui/Main.qml:234 +msgid "System Info" +msgstr "Systeeminformatie" + +#: ../contents/ui/Main.qml:235 +msgid "Terminal" +msgstr "Terminalvenster" + +#: ../contents/ui/Main.qml:237 +msgid "Task Manager" +msgstr "Systeemmonitor" + +#: ../contents/ui/Main.qml:238 +msgid "System Settings" +msgstr "Systeeminstellingen" + +#: ../contents/ui/Main.qml:239 +msgid "File Manager" +msgstr "Bestandsbeheerder" + +#: ../contents/ui/Main.qml:241 +msgid "Edit Applications..." +msgstr "Applicaties bewerken..." + +#: ../contents/ui/Popup.qml:60 ../contents/ui/Popup.qml:76 +msgid "Resize?" +msgstr "Grootte aanpassen?" + +#: ../contents/ui/Popup.qml:61 ../contents/ui/Popup.qml:77 +msgid "Alt + Right Click to resize the menu." +msgstr "Gebruik Alt + rechtermuisklik om de grootte van het menu aan te passen." + +#: ../contents/ui/SearchField.qml:15 +msgid "Search" +msgstr "Zoeken" + +#: ../contents/ui/SearchField.qml:17 +msgid "Search Apps" +msgstr "Zoeken naar apps" + +#: ../contents/ui/SearchField.qml:19 +msgid "Search Files" +msgstr "Zoeken naar bestanden" + +#: ../contents/ui/SearchField.qml:21 +msgid "Search Bookmarks" +msgstr "Zoeken naar bladwijzers" + +#: ../contents/ui/SearchField.qml:23 +msgctxt "Search [krunnerName, krunnerName, ...], " +msgid "Search %1" +msgstr "%1 zoeken" + +#: ../contents/ui/SearchFiltersViewItem.qml:115 ../contents/ui/SearchFiltersView.qml:30 +msgid "Default" +msgstr "Standaard" + +#: ../contents/ui/SearchFiltersView.qml:19 +msgid "All" +msgstr "Alles" + +#: ../contents/ui/SearchFiltersView.qml:20 +msgid "Search with all KRunner plugins" +msgstr "Zoeken met alle KRunner-plug-ins" + +#: ../contents/ui/SearchFiltersView.qml:31 +msgid "Search with user selected defaults" +msgstr "Zoeken met door gebruiker opgegeven standaardwaarden" + +#: ../contents/ui/SearchFiltersView.qml:42 +msgid "Applications" +msgstr "Applicaties" + +#: ../contents/ui/SearchFiltersView.qml:49 +msgid "Files" +msgstr "Bestanden" + +#: ../contents/ui/SearchFiltersView.qml:59 +msgid "Music" +msgstr "Muziek" + +#: ../contents/ui/SearchFiltersView.qml:67 +msgid "Videos" +msgstr "Video's" + +#: ../contents/ui/SearchFiltersView.qml:77 +msgid "Bookmarks" +msgstr "Bladwijzers" + +#: ../contents/ui/SearchFiltersView.qml:84 +msgid "locations" +msgstr "locaties" + +#: ../contents/ui/SearchFiltersView.qml:91 +msgid "Dictionary" +msgstr "Woordenboek" + +#: ../contents/ui/SearchFiltersView.qml:99 +msgid "Shell" +msgstr "Shell" + +#: ../contents/ui/SearchFiltersView.qml:106 +msgid "Calculator" +msgstr "Rekenmachine" + +#: ../contents/ui/SearchFiltersView.qml:113 +msgid "Windowed Widgets" +msgstr "Vensterwidgets" + +#: ../contents/ui/SearchFiltersView.qml:120 +msgid "Date/Time" +msgstr "Datum/Tijd" + +#: ../contents/ui/SearchFiltersView.qml:127 +msgid "Unit Converter" +msgstr "Eenheden omzetten" + +#: ../contents/ui/SearchResultsView.qml:70 +msgid "Filters" +msgstr "Filters" + +#: ../contents/ui/SidebarView.qml:50 +msgid "Menu" +msgstr "Menu" + +#: ../contents/ui/SidebarView.qml:57 +msgid "Apps" +msgstr "Apps" + +#: ../contents/ui/SidebarView.qml:95 +msgid "User Manager" +msgstr "Gebruikersbeheer" + +#: ../contents/ui/SidebarView.qml:133 +msgid "Power" +msgstr "Afsluitmenu" + +#: ../contents/ui/TileEditorView.qml:43 ../contents/ui/TileItem.qml:106 +msgid "Edit Tile" +msgstr "Tegel bewerken" + +#: ../contents/ui/TileEditorView.qml:47 +msgid "Reset Tile" +msgstr "Standaardwaarden" + +#: ../contents/ui/TileEditorView.qml:52 +msgid "Close" +msgstr "Sluiten" + +#: ../contents/ui/TileEditorView.qml:73 +msgid "Url" +msgstr "URL" + +#: ../contents/ui/TileEditorView.qml:79 +msgid "Label" +msgstr "Label" + +#: ../contents/ui/TileEditorView.qml:87 +msgid "Icon" +msgstr "Pictogram" + +#: ../contents/ui/TileEditorView.qml:106 +msgid "Background Image" +msgstr "Achtergrondafbeelding" + +#: ../contents/ui/TileEditorView.qml:116 +msgid "Choose an image" +msgstr "Kies een afbeelding" + +#: ../contents/ui/TileEditorView.qml:121 +msgid "Image Files (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)" +msgstr "Afbeeldingsbestanden (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)" + +#: ../contents/ui/TileEditorView.qml:135 +msgid "Background Color" +msgstr "Achtergrondkleur" + +#: ../contents/ui/TileEditorView.qml:141 +msgid "Position / Size" +msgstr "Positie / Grootte" + +#: ../contents/ui/TileGrid.qml:323 +msgid "New Group" +msgstr "Nieuwe groep" + +#: ../contents/ui/TileGrid.qml:333 +msgid "Unlock Tiles" +msgstr "Tegels ontgrendelen" + +#: ../contents/ui/TileGrid.qml:333 +msgid "Lock Tiles" +msgstr "Tegels vergrendelen" + +#: ../contents/ui/TileGrid.qml:518 +msgctxt "default group label" +msgid "Group" +msgstr "Groep" diff --git a/translate/pl.po b/translate/pl.po new file mode 100644 index 0000000..a84496b --- /dev/null +++ b/translate/pl.po @@ -0,0 +1,388 @@ +# Translation of tiledmenu in pl +# Copyright (C) 2016 +# This file is distributed under the same license as the tiledmenu package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: tiledmenu \n" +"Report-Msgid-Bugs-To: https://github.com/Zren/plasma-applet-tiledmenu\n" +"POT-Creation-Date: 2018-08-02 19:46-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: pl\n" +"Language: pl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../contents/config/config.qml:26 +msgid "General" +msgstr "" + +#: ../contents/config/config.qml:31 +msgid "Advanced" +msgstr "" + +#: ../contents/ui/AppContextMenu.qml:69 +msgid "Unpin from Menu" +msgstr "" + +#: ../contents/ui/AppContextMenu.qml:79 +msgid "Pin to Menu" +msgstr "" + +#: ../contents/ui/AppContextMenu.qml:120 +msgid "Pin to Taskbar" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:23 +msgid "Popup" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:26 +msgid "Fullscreen" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:32 +msgid "Panel Icon" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:39 +msgid "Fixed Size" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:47 +msgid "Tiles" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:53 +msgid "Tile Size" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:54 +msgid "x" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:60 +msgid "%1 px" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:65 +msgid "Tile Margin" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:66 ../contents/ui/config/ConfigGeneral.qml:237 ../contents/ui/config/ConfigGeneral.qml:262 ../contents/ui/config/ConfigGeneral.qml:303 +msgid "px" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:71 ../contents/ui/config/ConfigGeneral.qml:118 ../contents/ui/config/ConfigGeneral.qml:242 +msgid "Desktop Theme (%1)" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:79 ../contents/ui/config/ConfigGeneral.qml:125 +msgid "Custom Color" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:90 +msgid "Transparent" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:99 +msgid "Text Alignment" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:101 +msgid "Left" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:102 +msgid "Center" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:103 +msgid "Right" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:115 +msgid "Sidebar" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:139 +msgid "Sidebar Shortcuts" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:185 +msgid "Add Default" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:232 +msgid "Search Box" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:236 +msgid "Search Field Height" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:248 +msgid "Windows (White)" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:256 +msgid "App List" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:261 +msgid "App List Area Width" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:269 +msgid "Default Order" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:271 +msgid "Alphabetical" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:272 ../contents/ui/SidebarView.qml:65 +msgid "Categories" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:279 +msgid "App Description" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:281 +msgid "Hidden" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:282 +msgid "After" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:283 +msgid "Below" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:295 +msgid "Show recent applications" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:302 +msgid "Icon Size" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:318 +msgid "Search Results" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:322 +msgid "Merged (Application Launcher)" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:331 +msgid "Split into Categories (Application Menu / Dashboard)" +msgstr "" + +#: ../contents/ui/lib/AppletVersion.qml:41 +msgid "Version: %1" +msgstr "" + +#: ../contents/ui/Main.qml:234 +msgid "System Info" +msgstr "" + +#: ../contents/ui/Main.qml:235 +msgid "Terminal" +msgstr "" + +#: ../contents/ui/Main.qml:237 +msgid "Task Manager" +msgstr "" + +#: ../contents/ui/Main.qml:238 +msgid "System Settings" +msgstr "" + +#: ../contents/ui/Main.qml:239 +msgid "File Manager" +msgstr "" + +#: ../contents/ui/Main.qml:241 +msgid "Edit Applications..." +msgstr "" + +#: ../contents/ui/Popup.qml:60 ../contents/ui/Popup.qml:76 +msgid "Resize?" +msgstr "" + +#: ../contents/ui/Popup.qml:61 ../contents/ui/Popup.qml:77 +msgid "Alt + Right Click to resize the menu." +msgstr "" + +#: ../contents/ui/SearchField.qml:15 +msgid "Search" +msgstr "" + +#: ../contents/ui/SearchField.qml:17 +msgid "Search Apps" +msgstr "" + +#: ../contents/ui/SearchField.qml:19 +msgid "Search Files" +msgstr "" + +#: ../contents/ui/SearchField.qml:21 +msgid "Search Bookmarks" +msgstr "" + +#: ../contents/ui/SearchField.qml:23 +msgctxt "Search [krunnerName, krunnerName, ...], " +msgid "Search %1" +msgstr "" + +#: ../contents/ui/SearchFiltersViewItem.qml:115 ../contents/ui/SearchFiltersView.qml:30 +msgid "Default" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:19 +msgid "All" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:20 +msgid "Search with all KRunner plugins" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:31 +msgid "Search with user selected defaults" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:42 +msgid "Applications" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:49 +msgid "Files" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:59 +msgid "Music" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:67 +msgid "Videos" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:77 +msgid "Bookmarks" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:84 +msgid "locations" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:91 +msgid "Dictionary" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:99 +msgid "Shell" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:106 +msgid "Calculator" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:113 +msgid "Windowed Widgets" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:120 +msgid "Date/Time" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:127 +msgid "Unit Converter" +msgstr "" + +#: ../contents/ui/SearchResultsView.qml:70 +msgid "Filters" +msgstr "" + +#: ../contents/ui/SidebarView.qml:50 +msgid "Menu" +msgstr "" + +#: ../contents/ui/SidebarView.qml:57 +msgid "Apps" +msgstr "" + +#: ../contents/ui/SidebarView.qml:95 +msgid "User Manager" +msgstr "" + +#: ../contents/ui/SidebarView.qml:133 +msgid "Power" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:43 ../contents/ui/TileItem.qml:106 +msgid "Edit Tile" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:47 +msgid "Reset Tile" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:52 +msgid "Close" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:73 +msgid "Url" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:79 +msgid "Label" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:87 +msgid "Icon" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:106 +msgid "Background Image" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:116 +msgid "Choose an image" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:121 +msgid "Image Files (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:135 +msgid "Background Color" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:141 +msgid "Position / Size" +msgstr "" + +#: ../contents/ui/TileGrid.qml:323 +msgid "New Group" +msgstr "" + +#: ../contents/ui/TileGrid.qml:333 +msgid "Unlock Tiles" +msgstr "" + +#: ../contents/ui/TileGrid.qml:333 +msgid "Lock Tiles" +msgstr "" + +#: ../contents/ui/TileGrid.qml:518 +msgctxt "default group label" +msgid "Group" +msgstr "" diff --git a/translate/template.pot b/translate/template.pot new file mode 100644 index 0000000..f0cdbbd --- /dev/null +++ b/translate/template.pot @@ -0,0 +1,388 @@ +# Translation of tiledmenu in LANGUAGE +# Copyright (C) 2018 +# This file is distributed under the same license as the tiledmenu package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: tiledmenu \n" +"Report-Msgid-Bugs-To: https://github.com/Zren/plasma-applet-tiledmenu\n" +"POT-Creation-Date: 2018-08-02 19:46-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../contents/config/config.qml:26 +msgid "General" +msgstr "" + +#: ../contents/config/config.qml:31 +msgid "Advanced" +msgstr "" + +#: ../contents/ui/AppContextMenu.qml:69 +msgid "Unpin from Menu" +msgstr "" + +#: ../contents/ui/AppContextMenu.qml:79 +msgid "Pin to Menu" +msgstr "" + +#: ../contents/ui/AppContextMenu.qml:120 +msgid "Pin to Taskbar" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:23 +msgid "Popup" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:26 +msgid "Fullscreen" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:32 +msgid "Panel Icon" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:39 +msgid "Fixed Size" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:47 +msgid "Tiles" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:53 +msgid "Tile Size" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:54 +msgid "x" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:60 +msgid "%1 px" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:65 +msgid "Tile Margin" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:66 ../contents/ui/config/ConfigGeneral.qml:237 ../contents/ui/config/ConfigGeneral.qml:262 ../contents/ui/config/ConfigGeneral.qml:303 +msgid "px" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:71 ../contents/ui/config/ConfigGeneral.qml:118 ../contents/ui/config/ConfigGeneral.qml:242 +msgid "Desktop Theme (%1)" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:79 ../contents/ui/config/ConfigGeneral.qml:125 +msgid "Custom Color" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:90 +msgid "Transparent" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:99 +msgid "Text Alignment" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:101 +msgid "Left" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:102 +msgid "Center" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:103 +msgid "Right" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:115 +msgid "Sidebar" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:139 +msgid "Sidebar Shortcuts" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:185 +msgid "Add Default" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:232 +msgid "Search Box" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:236 +msgid "Search Field Height" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:248 +msgid "Windows (White)" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:256 +msgid "App List" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:261 +msgid "App List Area Width" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:269 +msgid "Default Order" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:271 +msgid "Alphabetical" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:272 ../contents/ui/SidebarView.qml:65 +msgid "Categories" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:279 +msgid "App Description" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:281 +msgid "Hidden" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:282 +msgid "After" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:283 +msgid "Below" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:295 +msgid "Show recent applications" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:302 +msgid "Icon Size" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:318 +msgid "Search Results" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:322 +msgid "Merged (Application Launcher)" +msgstr "" + +#: ../contents/ui/config/ConfigGeneral.qml:331 +msgid "Split into Categories (Application Menu / Dashboard)" +msgstr "" + +#: ../contents/ui/lib/AppletVersion.qml:41 +msgid "Version: %1" +msgstr "" + +#: ../contents/ui/Main.qml:234 +msgid "System Info" +msgstr "" + +#: ../contents/ui/Main.qml:235 +msgid "Terminal" +msgstr "" + +#: ../contents/ui/Main.qml:237 +msgid "Task Manager" +msgstr "" + +#: ../contents/ui/Main.qml:238 +msgid "System Settings" +msgstr "" + +#: ../contents/ui/Main.qml:239 +msgid "File Manager" +msgstr "" + +#: ../contents/ui/Main.qml:241 +msgid "Edit Applications..." +msgstr "" + +#: ../contents/ui/Popup.qml:60 ../contents/ui/Popup.qml:76 +msgid "Resize?" +msgstr "" + +#: ../contents/ui/Popup.qml:61 ../contents/ui/Popup.qml:77 +msgid "Alt + Right Click to resize the menu." +msgstr "" + +#: ../contents/ui/SearchField.qml:15 +msgid "Search" +msgstr "" + +#: ../contents/ui/SearchField.qml:17 +msgid "Search Apps" +msgstr "" + +#: ../contents/ui/SearchField.qml:19 +msgid "Search Files" +msgstr "" + +#: ../contents/ui/SearchField.qml:21 +msgid "Search Bookmarks" +msgstr "" + +#: ../contents/ui/SearchField.qml:23 +msgctxt "Search [krunnerName, krunnerName, ...], " +msgid "Search %1" +msgstr "" + +#: ../contents/ui/SearchFiltersViewItem.qml:115 ../contents/ui/SearchFiltersView.qml:30 +msgid "Default" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:19 +msgid "All" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:20 +msgid "Search with all KRunner plugins" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:31 +msgid "Search with user selected defaults" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:42 +msgid "Applications" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:49 +msgid "Files" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:59 +msgid "Music" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:67 +msgid "Videos" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:77 +msgid "Bookmarks" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:84 +msgid "locations" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:91 +msgid "Dictionary" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:99 +msgid "Shell" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:106 +msgid "Calculator" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:113 +msgid "Windowed Widgets" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:120 +msgid "Date/Time" +msgstr "" + +#: ../contents/ui/SearchFiltersView.qml:127 +msgid "Unit Converter" +msgstr "" + +#: ../contents/ui/SearchResultsView.qml:70 +msgid "Filters" +msgstr "" + +#: ../contents/ui/SidebarView.qml:50 +msgid "Menu" +msgstr "" + +#: ../contents/ui/SidebarView.qml:57 +msgid "Apps" +msgstr "" + +#: ../contents/ui/SidebarView.qml:95 +msgid "User Manager" +msgstr "" + +#: ../contents/ui/SidebarView.qml:133 +msgid "Power" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:43 ../contents/ui/TileItem.qml:106 +msgid "Edit Tile" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:47 +msgid "Reset Tile" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:52 +msgid "Close" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:73 +msgid "Url" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:79 +msgid "Label" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:87 +msgid "Icon" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:106 +msgid "Background Image" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:116 +msgid "Choose an image" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:121 +msgid "Image Files (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:135 +msgid "Background Color" +msgstr "" + +#: ../contents/ui/TileEditorView.qml:141 +msgid "Position / Size" +msgstr "" + +#: ../contents/ui/TileGrid.qml:323 +msgid "New Group" +msgstr "" + +#: ../contents/ui/TileGrid.qml:333 +msgid "Unlock Tiles" +msgstr "" + +#: ../contents/ui/TileGrid.qml:333 +msgid "Lock Tiles" +msgstr "" + +#: ../contents/ui/TileGrid.qml:518 +msgctxt "default group label" +msgid "Group" +msgstr "" diff --git a/translate/test b/translate/test new file mode 100644 index 0000000..04f39da --- /dev/null +++ b/translate/test @@ -0,0 +1,5 @@ +#!/bin/sh +# Version: 1 + +sh ./merge +sh ./install diff --git a/translate/zh_CN.po b/translate/zh_CN.po new file mode 100644 index 0000000..9493f44 --- /dev/null +++ b/translate/zh_CN.po @@ -0,0 +1,389 @@ +# Translation of tiledmenu in zh_CN +# Copyright (C) 2018 +# This file is distributed under the same license as the tiledmenu package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: tiledmenu \n" +"Report-Msgid-Bugs-To: https://github.com/Zren/plasma-applet-tiledmenu\n" +"POT-Creation-Date: 2018-08-02 19:46-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Lin Mu \n" +"Language-Team: Chinese \n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../contents/config/config.qml:26 +msgid "General" +msgstr "一般" + +#: ../contents/config/config.qml:31 +msgid "Advanced" +msgstr "高级" + +#: ../contents/ui/AppContextMenu.qml:69 +msgid "Unpin from Menu" +msgstr "从菜单上移除" + +#: ../contents/ui/AppContextMenu.qml:79 +msgid "Pin to Menu" +msgstr "添加到菜单" + +#: ../contents/ui/AppContextMenu.qml:120 +msgid "Pin to Taskbar" +msgstr "添加到任务栏" + +#: ../contents/ui/config/ConfigGeneral.qml:23 +msgid "Popup" +msgstr "弹出" + +#: ../contents/ui/config/ConfigGeneral.qml:26 +msgid "Fullscreen" +msgstr "全屏" + +#: ../contents/ui/config/ConfigGeneral.qml:32 +msgid "Panel Icon" +msgstr "面板图标" + +#: ../contents/ui/config/ConfigGeneral.qml:39 +msgid "Fixed Size" +msgstr "修复大小" + +#: ../contents/ui/config/ConfigGeneral.qml:47 +msgid "Tiles" +msgstr "磁贴" + +#: ../contents/ui/config/ConfigGeneral.qml:53 +msgid "Tile Size" +msgstr "磁贴大小" + +#: ../contents/ui/config/ConfigGeneral.qml:54 +msgid "x" +msgstr "x" + +#: ../contents/ui/config/ConfigGeneral.qml:60 +msgid "%1 px" +msgstr "%1 像素" + +#: ../contents/ui/config/ConfigGeneral.qml:65 +msgid "Tile Margin" +msgstr "磁贴边缘" + +#: ../contents/ui/config/ConfigGeneral.qml:66 ../contents/ui/config/ConfigGeneral.qml:237 ../contents/ui/config/ConfigGeneral.qml:262 ../contents/ui/config/ConfigGeneral.qml:303 +msgid "px" +msgstr "像素" + +#: ../contents/ui/config/ConfigGeneral.qml:71 ../contents/ui/config/ConfigGeneral.qml:118 ../contents/ui/config/ConfigGeneral.qml:242 +msgid "Desktop Theme (%1)" +msgstr "桌面主题 (%1)" + +#: ../contents/ui/config/ConfigGeneral.qml:79 ../contents/ui/config/ConfigGeneral.qml:125 +msgid "Custom Color" +msgstr "自定义颜色" + +#: ../contents/ui/config/ConfigGeneral.qml:90 +msgid "Transparent" +msgstr "透明" + +#: ../contents/ui/config/ConfigGeneral.qml:99 +msgid "Text Alignment" +msgstr "文字对齐" + +#: ../contents/ui/config/ConfigGeneral.qml:101 +msgid "Left" +msgstr "左" + +#: ../contents/ui/config/ConfigGeneral.qml:102 +msgid "Center" +msgstr "中" + +#: ../contents/ui/config/ConfigGeneral.qml:103 +msgid "Right" +msgstr "右" + +#: ../contents/ui/config/ConfigGeneral.qml:115 +msgid "Sidebar" +msgstr "侧栏" + +#: ../contents/ui/config/ConfigGeneral.qml:139 +msgid "Sidebar Shortcuts" +msgstr "侧栏快捷方式" + +#: ../contents/ui/config/ConfigGeneral.qml:185 +msgid "Add Default" +msgstr "添加默认值" + +#: ../contents/ui/config/ConfigGeneral.qml:232 +msgid "Search Box" +msgstr "搜索框" + +#: ../contents/ui/config/ConfigGeneral.qml:236 +msgid "Search Field Height" +msgstr "搜索区域高度" + +#: ../contents/ui/config/ConfigGeneral.qml:248 +msgid "Windows (White)" +msgstr "Windows (白色)" + +#: ../contents/ui/config/ConfigGeneral.qml:256 +msgid "App List" +msgstr "应用列表" + +#: ../contents/ui/config/ConfigGeneral.qml:261 +msgid "App List Area Width" +msgstr "应用列表区域宽度" + +#: ../contents/ui/config/ConfigGeneral.qml:269 +msgid "Default Order" +msgstr "默认顺序" + +#: ../contents/ui/config/ConfigGeneral.qml:271 +msgid "Alphabetical" +msgstr "字母顺序" + +#: ../contents/ui/config/ConfigGeneral.qml:272 ../contents/ui/SidebarView.qml:65 +msgid "Categories" +msgstr "分组" + +#: ../contents/ui/config/ConfigGeneral.qml:279 +msgid "App Description" +msgstr "应用描述" + +#: ../contents/ui/config/ConfigGeneral.qml:281 +msgid "Hidden" +msgstr "隐藏" + +#: ../contents/ui/config/ConfigGeneral.qml:282 +msgid "After" +msgstr "后方" + +#: ../contents/ui/config/ConfigGeneral.qml:283 +msgid "Below" +msgstr "下方" + +#: ../contents/ui/config/ConfigGeneral.qml:295 +msgid "Show recent applications" +msgstr "显示最近运行应用" + +#: ../contents/ui/config/ConfigGeneral.qml:302 +msgid "Icon Size" +msgstr "图标大小" + +#: ../contents/ui/config/ConfigGeneral.qml:318 +msgid "Search Results" +msgstr "搜索结果" + +#: ../contents/ui/config/ConfigGeneral.qml:322 +msgid "Merged (Application Launcher)" +msgstr "合并(应用启动器)" + +#: ../contents/ui/config/ConfigGeneral.qml:331 +msgid "Split into Categories (Application Menu / Dashboard)" +msgstr "分类(应用菜单/仪表板)" + +#: ../contents/ui/lib/AppletVersion.qml:41 +msgid "Version: %1" +msgstr "版本: %1" + +#: ../contents/ui/Main.qml:234 +msgid "System Info" +msgstr "系统信息" + +#: ../contents/ui/Main.qml:235 +msgid "Terminal" +msgstr "终端" + +#: ../contents/ui/Main.qml:237 +msgid "Task Manager" +msgstr "任务管理器" + +#: ../contents/ui/Main.qml:238 +msgid "System Settings" +msgstr "系统设置" + +#: ../contents/ui/Main.qml:239 +msgid "File Manager" +msgstr "文件管理器" + +#: ../contents/ui/Main.qml:241 +msgid "Edit Applications..." +msgstr "编辑应用列表" + +#: ../contents/ui/Popup.qml:60 ../contents/ui/Popup.qml:76 +msgid "Resize?" +msgstr "调整大小?" + +#: ../contents/ui/Popup.qml:61 ../contents/ui/Popup.qml:77 +msgid "Alt + Right Click to resize the menu." +msgstr "Alt + 右键调整菜单大小" + +#: ../contents/ui/SearchField.qml:15 +msgid "Search" +msgstr "搜索" + +#: ../contents/ui/SearchField.qml:17 +msgid "Search Apps" +msgstr "搜索应用" + +#: ../contents/ui/SearchField.qml:19 +msgid "Search Files" +msgstr "搜索文件" + +#: ../contents/ui/SearchField.qml:21 +msgid "Search Bookmarks" +msgstr "搜索书签" + +#: ../contents/ui/SearchField.qml:23 +msgctxt "Search [krunnerName, krunnerName, ...], " +msgid "Search %1" +msgstr "搜索 %1" + +#: ../contents/ui/SearchFiltersViewItem.qml:115 ../contents/ui/SearchFiltersView.qml:30 +msgid "Default" +msgstr "默认" + +#: ../contents/ui/SearchFiltersView.qml:19 +msgid "All" +msgstr "全部" + +#: ../contents/ui/SearchFiltersView.qml:20 +msgid "Search with all KRunner plugins" +msgstr "使用全部 KRunner 插件搜索" + +#: ../contents/ui/SearchFiltersView.qml:31 +msgid "Search with user selected defaults" +msgstr "使用用户选择的默认值进行搜索" + +#: ../contents/ui/SearchFiltersView.qml:42 +msgid "Applications" +msgstr "应用" + +#: ../contents/ui/SearchFiltersView.qml:49 +msgid "Files" +msgstr "文件" + +#: ../contents/ui/SearchFiltersView.qml:59 +msgid "Music" +msgstr "音乐" + +#: ../contents/ui/SearchFiltersView.qml:67 +msgid "Videos" +msgstr "视频" + +#: ../contents/ui/SearchFiltersView.qml:77 +msgid "Bookmarks" +msgstr "书签" + +#: ../contents/ui/SearchFiltersView.qml:84 +msgid "locations" +msgstr "位置" + +#: ../contents/ui/SearchFiltersView.qml:91 +msgid "Dictionary" +msgstr "词典" + +#: ../contents/ui/SearchFiltersView.qml:99 +msgid "Shell" +msgstr "命令行" + +#: ../contents/ui/SearchFiltersView.qml:106 +msgid "Calculator" +msgstr "计算器" + +#: ../contents/ui/SearchFiltersView.qml:113 +msgid "Windowed Widgets" +msgstr "窗口小部件" + +#: ../contents/ui/SearchFiltersView.qml:120 +msgid "Date/Time" +msgstr "日期/时间" + +#: ../contents/ui/SearchFiltersView.qml:127 +msgid "Unit Converter" +msgstr "单位转换" + +#: ../contents/ui/SearchResultsView.qml:70 +msgid "Filters" +msgstr "过滤器" + +#: ../contents/ui/SidebarView.qml:50 +msgid "Menu" +msgstr "菜单" + +#: ../contents/ui/SidebarView.qml:57 +msgid "Apps" +msgstr "应用" + +#: ../contents/ui/SidebarView.qml:95 +#, fuzzy +msgid "User Manager" +msgstr "用户管理程序" + +#: ../contents/ui/SidebarView.qml:133 +msgid "Power" +msgstr "电源" + +#: ../contents/ui/TileEditorView.qml:43 ../contents/ui/TileItem.qml:106 +msgid "Edit Tile" +msgstr "编辑磁贴" + +#: ../contents/ui/TileEditorView.qml:47 +msgid "Reset Tile" +msgstr "重置磁贴" + +#: ../contents/ui/TileEditorView.qml:52 +msgid "Close" +msgstr "关闭" + +#: ../contents/ui/TileEditorView.qml:73 +msgid "Url" +msgstr "网址" + +#: ../contents/ui/TileEditorView.qml:79 +msgid "Label" +msgstr "标签" + +#: ../contents/ui/TileEditorView.qml:87 +msgid "Icon" +msgstr "图标" + +#: ../contents/ui/TileEditorView.qml:106 +msgid "Background Image" +msgstr "背景图片" + +#: ../contents/ui/TileEditorView.qml:116 +msgid "Choose an image" +msgstr "选择一张图片" + +#: ../contents/ui/TileEditorView.qml:121 +msgid "Image Files (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)" +msgstr "图片文件 (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)" + +#: ../contents/ui/TileEditorView.qml:135 +msgid "Background Color" +msgstr "背景颜色" + +#: ../contents/ui/TileEditorView.qml:141 +msgid "Position / Size" +msgstr "位置/大小" + +#: ../contents/ui/TileGrid.qml:323 +msgid "New Group" +msgstr "新群组" + +#: ../contents/ui/TileGrid.qml:333 +msgid "Unlock Tiles" +msgstr "解锁磁贴" + +#: ../contents/ui/TileGrid.qml:333 +msgid "Lock Tiles" +msgstr "锁定磁贴" + +#: ../contents/ui/TileGrid.qml:518 +msgctxt "default group label" +msgid "Group" +msgstr "群组"