diff --git a/applets/kicker/package/contents/ui/ActionMenu.qml b/applets/kicker/package/contents/ui/ActionMenu.qml index 7163b7489..f11403ef9 100644 --- a/applets/kicker/package/contents/ui/ActionMenu.qml +++ b/applets/kicker/package/contents/ui/ActionMenu.qml @@ -1,138 +1,138 @@ /*************************************************************************** * Copyright (C) 2013 by Aurélien Gâteau * * Copyright (C) 2014-2015 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.components 2.0 as PlasmaComponents Item { id: root property QtObject menu property Item visualParent property variant actionList property bool opened: menu ? (menu.status !== PlasmaComponents.DialogStatus.Closed) : false signal actionClicked(string actionId, variant actionArgument) signal closed onActionListChanged: refreshMenu(); onOpenedChanged: { if (!opened) { closed(); } } function open(x, y) { if (!actionList) { return; } if (x && y) { menu.open(x, y); } else { menu.open(); } } function refreshMenu() { if (menu) { menu.destroy(); } if (!actionList) { return; } menu = contextMenuComponent.createObject(root); fillMenu(menu, actionList); } function fillMenu(menu, items) { items.forEach(function(actionItem) { if (actionItem.subActions) { // This is a menu var submenuItem = contextSubmenuItemComponent.createObject( menu, { "actionItem" : actionItem }); fillMenu(submenuItem.submenu, actionItem.subActions); } else { var item = contextMenuItemComponent.createObject( menu, { "actionItem": actionItem, } ); } }); } Component { id: contextMenuComponent PlasmaComponents.ContextMenu { visualParent: root.visualParent } } Component { id: contextSubmenuItemComponent PlasmaComponents.MenuItem { id: submenuItem property variant actionItem text: actionItem.text ? actionItem.text : "" icon: actionItem.icon ? actionItem.icon : null property variant submenu : submenu_ PlasmaComponents.ContextMenu { id: submenu_ visualParent: submenuItem.action } } } 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 checkable : actionItem.checkable ? actionItem.checkable : false checked : actionItem.checked ? actionItem.checked : false onClicked: { - actionClicked(actionItem.actionId, actionItem.actionArgument); + root.actionClicked(actionItem.actionId, actionItem.actionArgument); } } } } diff --git a/applets/kicker/package/contents/ui/CompactRepresentation.qml b/applets/kicker/package/contents/ui/CompactRepresentation.qml index fde5a9af3..dd59e4fad 100644 --- a/applets/kicker/package/contents/ui/CompactRepresentation.qml +++ b/applets/kicker/package/contents/ui/CompactRepresentation.qml @@ -1,130 +1,130 @@ /*************************************************************************** * Copyright (C) 2013-2014 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 QtQuick.Layouts 1.1 import org.kde.plasma.core 2.0 as PlasmaCore Item { id: root readonly property bool inPanel: (plasmoid.location === PlasmaCore.Types.TopEdge || plasmoid.location === PlasmaCore.Types.RightEdge || plasmoid.location === PlasmaCore.Types.BottomEdge || plasmoid.location === PlasmaCore.Types.LeftEdge) readonly property bool vertical: (plasmoid.formFactor === PlasmaCore.Types.Vertical) readonly property bool useCustomButtonImage: (plasmoid.configuration.useCustomButtonImage && plasmoid.configuration.customButtonImage.length !== 0) property QtObject dashWindow: null onWidthChanged: updateSizeHints() onHeightChanged: updateSizeHints() onDashWindowChanged: { if (dashWindow) { dashWindow.visualParent = root; } } function updateSizeHints() { if (useCustomButtonImage) { if (vertical) { var scaledHeight = Math.floor(parent.width * (buttonIcon.implicitHeight / buttonIcon.implicitWidth)); root.Layout.minimumHeight = scaledHeight; root.Layout.maximumHeight = scaledHeight; root.Layout.minimumWidth = units.iconSizes.small; root.Layout.maximumWidth = inPanel ? units.iconSizeHints.panel : -1; } else { var scaledWidth = Math.floor(parent.height * (buttonIcon.implicitWidth / buttonIcon.implicitHeight)); root.Layout.minimumWidth = scaledWidth; root.Layout.maximumWidth = scaledWidth; root.Layout.minimumHeight = units.iconSizes.small; root.Layout.maximumHeight = inPanel ? units.iconSizeHints.panel : -1; } } else { root.Layout.minimumWidth = units.iconSizes.small; root.Layout.maximumWidth = inPanel ? units.iconSizeHints.panel : -1; root.Layout.minimumHeight = units.iconSizes.small; root.Layout.maximumHeight = inPanel ? units.iconSizeHints.panel : -1; } } Connections { target: units.iconSizeHints - onPanelChanged: updateSizeHints() + onPanelChanged: root.updateSizeHints() } PlasmaCore.IconItem { id: buttonIcon anchors.fill: parent - readonly property double aspectRatio: (vertical ? implicitHeight / implicitWidth + readonly property double aspectRatio: (root.vertical ? implicitHeight / implicitWidth : implicitWidth / implicitHeight) - source: useCustomButtonImage ? plasmoid.configuration.customButtonImage : plasmoid.configuration.icon + source: root.useCustomButtonImage ? plasmoid.configuration.customButtonImage : plasmoid.configuration.icon active: mouseArea.containsMouse && !justOpenedTimer.running smooth: true // A custom icon could also be rectangular. However, if a square, custom, icon is given, assume it // to be an icon and round it to the nearest icon size again to avoid scaling artifacts. - roundToIconSize: !useCustomButtonImage || aspectRatio === 1 + roundToIconSize: !root.useCustomButtonImage || aspectRatio === 1 - onSourceChanged: updateSizeHints() + onSourceChanged: root.updateSizeHints() } MouseArea { id: mouseArea property bool wasExpanded: false; anchors.fill: parent - hoverEnabled: !dashWindow || !dashWindow.visible + hoverEnabled: !root.dashWindow || !root.dashWindow.visible onPressed: { if (!isDash) { wasExpanded = plasmoid.expanded } } onClicked: { if (isDash) { - dashWindow.toggle(); + root.dashWindow.toggle(); justOpenedTimer.start(); } else { plasmoid.expanded = !wasExpanded; } } } Component.onCompleted: { if (isDash) { dashWindow = Qt.createQmlObject("DashboardRepresentation {}", root); plasmoid.activated.connect(function() { dashWindow.toggle() justOpenedTimer.start() }) } } } diff --git a/applets/kicker/package/contents/ui/ConfigGeneral.qml b/applets/kicker/package/contents/ui/ConfigGeneral.qml index d461a1e46..b3dfbf982 100644 --- a/applets/kicker/package/contents/ui/ConfigGeneral.qml +++ b/applets/kicker/package/contents/ui/ConfigGeneral.qml @@ -1,251 +1,251 @@ /*************************************************************************** * Copyright (C) 2014 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.5 import QtQuick.Controls 2.5 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons import org.kde.draganddrop 2.0 as DragDrop import org.kde.kirigami 2.5 as Kirigami import org.kde.plasma.private.kicker 0.1 as Kicker Kirigami.FormLayout { id: configGeneral anchors.left: parent.left anchors.right: parent.right property bool isDash: (plasmoid.pluginName === "org.kde.plasma.kickerdash") property string cfg_icon: plasmoid.configuration.icon property bool cfg_useCustomButtonImage: plasmoid.configuration.useCustomButtonImage property string cfg_customButtonImage: plasmoid.configuration.customButtonImage property alias cfg_appNameFormat: appNameFormat.currentIndex property alias cfg_limitDepth: limitDepth.checked property alias cfg_alphaSort: alphaSort.checked property alias cfg_showIconsRootLevel: showIconsRootLevel.checked property alias cfg_recentOrdering: recentOrdering.currentIndex property alias cfg_showRecentApps: showRecentApps.checked property alias cfg_showRecentDocs: showRecentDocs.checked property alias cfg_showRecentContacts: showRecentContacts.checked property alias cfg_useExtraRunners: useExtraRunners.checked property alias cfg_alignResultsToBottom: alignResultsToBottom.checked Button { id: iconButton Kirigami.FormData.label: i18n("Icon:") implicitWidth: previewFrame.width + units.smallSpacing * 2 implicitHeight: previewFrame.height + units.smallSpacing * 2 // Just to provide some visual feedback when dragging; // cannot have checked without checkable enabled checkable: true checked: dropArea.containsAcceptableDrag onPressed: iconMenu.opened ? iconMenu.close() : iconMenu.open() DragDrop.DropArea { id: dropArea property bool containsAcceptableDrag: false anchors.fill: parent onDragEnter: { // Cannot use string operations (e.g. indexOf()) on "url" basic type. var urlString = event.mimeData.url.toString(); // This list is also hardcoded in KIconDialog. var extensions = [".png", ".xpm", ".svg", ".svgz"]; containsAcceptableDrag = urlString.indexOf("file:///") === 0 && extensions.some(function (extension) { return urlString.indexOf(extension) === urlString.length - extension.length; // "endsWith" }); if (!containsAcceptableDrag) { event.ignore(); } } onDragLeave: containsAcceptableDrag = false onDrop: { if (containsAcceptableDrag) { // Strip file:// prefix, we already verified in onDragEnter that we have only local URLs. iconDialog.setCustomButtonImage(event.mimeData.url.toString().substr("file://".length)); } containsAcceptableDrag = false; } } KQuickAddons.IconDialog { id: iconDialog function setCustomButtonImage(image) { - cfg_customButtonImage = image || cfg_icon || "start-here-kde" - cfg_useCustomButtonImage = true; + configGeneral.cfg_customButtonImage = image || configGeneral.cfg_icon || "start-here-kde" + configGeneral.cfg_useCustomButtonImage = true; } onIconNameChanged: setCustomButtonImage(iconName); } PlasmaCore.FrameSvgItem { id: previewFrame anchors.centerIn: parent imagePath: plasmoid.location === PlasmaCore.Types.Vertical || plasmoid.location === PlasmaCore.Types.Horizontal ? "widgets/panel-background" : "widgets/background" width: units.iconSizes.large + fixedMargins.left + fixedMargins.right height: units.iconSizes.large + fixedMargins.top + fixedMargins.bottom PlasmaCore.IconItem { anchors.centerIn: parent width: units.iconSizes.large height: width - source: cfg_useCustomButtonImage ? cfg_customButtonImage : cfg_icon + source: configGeneral.cfg_useCustomButtonImage ? configGeneral.cfg_customButtonImage : configGeneral.cfg_icon } } Menu { id: iconMenu // Appear below the button y: +parent.height onClosed: iconButton.checked = false; MenuItem { text: i18nc("@item:inmenu Open icon chooser dialog", "Choose...") icon.name: "document-open-folder" onClicked: iconDialog.open() } MenuItem { text: i18nc("@item:inmenu Reset icon to default", "Clear Icon") icon.name: "edit-clear" onClicked: { - cfg_icon = "start-here-kde" - cfg_useCustomButtonImage = false + configGeneral.cfg_icon = "start-here-kde" + configGeneral.cfg_useCustomButtonImage = false } } } } Item { Kirigami.FormData.isSection: true } ComboBox { id: appNameFormat Kirigami.FormData.label: i18n("Show applications as:") model: [i18n("Name only"), i18n("Description only"), i18n("Name (Description)"), i18n("Description (Name)")] } Item { Kirigami.FormData.isSection: true } CheckBox { id: alphaSort Kirigami.FormData.label: i18n("Behavior:") text: i18n("Sort applications alphabetically") } CheckBox { id: limitDepth visible: !isDash text: i18n("Flatten sub-menus to a single level") } CheckBox { id: showIconsRootLevel - visible: !isDash + visible: !configGeneral.isDash text: i18n("Show icons on the root level of the menu") } Item { Kirigami.FormData.isSection: true } CheckBox { id: showRecentApps Kirigami.FormData.label: i18n("Show categories:") text: recentOrdering.currentIndex == 0 ? i18n("Recent applications") : i18n("Often used applications") } CheckBox { id: showRecentDocs text: recentOrdering.currentIndex == 0 ? i18n("Recent documents") : i18n("Often used documents") } CheckBox { id: showRecentContacts text: recentOrdering.currentIndex == 0 ? i18n("Recent contacts") : i18n("Often used contacts") } ComboBox { id: recentOrdering Kirigami.FormData.label: i18n("Sort items in categories by:") model: [i18nc("@item:inlistbox Sort items in categories by [Recently used | Often used]", "Recently used"), i18nc("@item:inlistbox Sort items in categories by [Recently used | Ofetn used]", "Often used")] } Item { Kirigami.FormData.isSection: true } CheckBox { id: useExtraRunners Kirigami.FormData.label: i18n("Search:") text: i18n("Expand search to bookmarks, files and emails") } CheckBox { id: alignResultsToBottom - visible: !isDash + visible: !configGeneral.isDash text: i18n("Align search results to bottom") } } diff --git a/applets/kicker/package/contents/ui/DashboardRepresentation.qml b/applets/kicker/package/contents/ui/DashboardRepresentation.qml index 9a46fa106..c53aff13d 100644 --- a/applets/kicker/package/contents/ui/DashboardRepresentation.qml +++ b/applets/kicker/package/contents/ui/DashboardRepresentation.qml @@ -1,1083 +1,1083 @@ /*************************************************************************** * Copyright (C) 2015 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.4 import QtGraphicalEffects 1.0 import org.kde.plasma.core 2.1 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 import org.kde.kwindowsystem 1.0 import org.kde.plasma.private.shell 2.0 import org.kde.plasma.private.kicker 0.1 as Kicker import "code/tools.js" as Tools /* TODO * Reverse middleRow layout + keyboard nav + filter list text alignment in rtl locales. * Keep cursor column when arrow'ing down past non-full trailing rows into a lower grid. * Make DND transitions cleaner by performing an item swap instead of index reinsertion. */ Kicker.DashboardWindow { id: root property bool smallScreen: ((Math.floor(width / units.iconSizes.huge) <= 22) || (Math.floor(height / units.iconSizes.huge) <= 14)) property int iconSize: smallScreen ? units.iconSizes.large : units.iconSizes.huge property int cellSize: iconSize + theme.mSize(theme.defaultFont).height + (2 * units.smallSpacing) + (2 * Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom, highlightItemSvg.margins.left + highlightItemSvg.margins.right)) property int columns: Math.floor(((smallScreen ? 85 : 80)/100) * Math.ceil(width / cellSize)) property bool searching: (searchField.text != "") property var widgetExplorer: null keyEventProxy: searchField backgroundColor: Qt.rgba(0, 0, 0, 0.737) onKeyEscapePressed: { if (searching) { searchField.clear(); } else { root.toggle(); } } onVisibleChanged: { tabBar.activeTab = 0; reset(); if (visible) { preloadAllAppsTimer.restart(); } } onSearchingChanged: { if (!searching) { reset(); } else { filterList.currentIndex = -1; if (tabBar.activeTab == 1) { widgetExplorer.widgetsModel.filterQuery = ""; widgetExplorer.widgetsModel.filterType = ""; } } } function reset() { searchField.clear(); globalFavoritesGrid.currentIndex = -1; systemFavoritesGrid.currentIndex = -1; filterList.currentIndex = 0; funnelModel.sourceModel = rootModel.modelForRow(0); mainGrid.model = (tabBar.activeTab == 0) ? funnelModel : root.widgetExplorer.widgetsModel; mainGrid.currentIndex = -1; filterListScrollArea.focus = true; filterList.model = (tabBar.activeTab == 0) ? rootModel : root.widgetExplorer.filterModel; } function updateWidgetExplorer() { if (tabBar.activeTab == 1 /* Widgets */ || tabBar.hoveredTab == 1) { if (!root.widgetExplorer) { root.widgetExplorer = widgetExplorerComponent.createObject(root, { containment: containmentInterface.screenContainment(plasmoid) }); } } else if (root.widgetExplorer) { root.widgetExplorer.destroy(); root.widgetExplorer = null; } } mainItem: MouseArea { id: rootItem anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft LayoutMirroring.childrenInherit: true Connections { target: kicker onReset: { - if (!searching) { + if (!root.searching) { filterList.applyFilter(); if (tabBar.activeTab == 0) { funnelModel.reset(); } } } onDragSourceChanged: { if (!dragSource) { // FIXME TODO HACK: Reset all views post-DND to work around // mouse grab bug despite QQuickWindow::mouseGrabberItem==0x0. // Needs a more involved hunt through Qt Quick sources later since // it's not happening with near-identical code in the menu repr. rootModel.refresh(); } else if (tabBar.activeTab == 1) { root.toggle(); containmentInterface.ensureMutable(containmentInterface.screenContainment(plasmoid)); kwindowsystem.showingDesktop = true; } } } KWindowSystem { id: kwindowsystem } Component { id: widgetExplorerComponent WidgetExplorer { showSpecialFilters: false } } Connections { target: plasmoid onUserConfiguringChanged: { if (plasmoid.userConfiguring) { root.hide() } } } PlasmaComponents.Menu { id: contextMenu PlasmaComponents.MenuItem { action: plasmoid.action("configure") } } PlasmaExtras.Heading { id: dummyHeading visible: false width: 0 level: 1 } TextMetrics { id: headingMetrics font: dummyHeading.font } Kicker.FunnelModel { id: funnelModel onSourceModelChanged: { if (mainColumn.visible) { mainGrid.currentIndex = -1; mainGrid.forceLayout(); } } } Timer { id: preloadAllAppsTimer property bool done: false interval: 1000 repeat: false onTriggered: { - if (done || searching) { + if (done || root.searching) { return; } for (var i = 0; i < rootModel.count; ++i) { var model = rootModel.modelForRow(i); if (model.description === "KICKER_ALL_MODEL") { allAppsGrid.model = model; done = true; break; } } } function defer() { if (running && !done) { restart(); } } } Kicker.ContainmentInterface { id: containmentInterface } DashboardTabBar { id: tabBar y: 0 anchors.horizontalCenter: parent.horizontalCenter visible: (plasmoid.immutability !== PlasmaCore.Types.SystemImmutable) onActiveTabChanged: { - updateWidgetExplorer(); - reset(); + root.updateWidgetExplorer(); + root.reset(); } - onHoveredTabChanged: updateWidgetExplorer() + onHoveredTabChanged: root.updateWidgetExplorer() Keys.onDownPressed: { mainColumn.tryActivate(0, 0); } } TextEdit { id: searchField width: 0 height: 0 visible: false persistentSelection: true onTextChanged: { if (tabBar.activeTab == 0) { runnerModel.query = searchField.text; } else { - widgetExplorer.widgetsModel.searchTerm = searchField.text; + root.widgetExplorer.widgetsModel.searchTerm = searchField.text; } } function clear() { text = ""; } onSelectionStartChanged: Qt.callLater(searchHeading.updateSelection) onSelectionEndChanged: Qt.callLater(searchHeading.updateSelection) } TextEdit { id: searchHeading anchors { horizontalCenter: parent.horizontalCenter } - y: (middleRow.anchors.topMargin / 2) - (smallScreen ? (height/10) : 0) + y: (middleRow.anchors.topMargin / 2) - (root.smallScreen ? (height/10) : 0) font.pointSize: dummyHeading.font.pointSize * 1.5 wrapMode: Text.NoWrap opacity: 1.0 selectByMouse: false cursorVisible: false color: "white" - text: searching ? i18n("Searching for '%1'", searchField.text) : i18n("Type to search...") + text: root.searching ? i18n("Searching for '%1'", searchField.text) : i18n("Type to search...") function updateSelection() { if (!searchField.selectedText) { return; } var delta = text.lastIndexOf(searchField.text, text.length - 2); searchHeading.select(searchField.selectionStart + delta, searchField.selectionEnd + delta); } } PlasmaComponents.ToolButton { id: cancelSearchButton anchors { left: searchHeading.right leftMargin: units.largeSpacing verticalCenter: searchHeading.verticalCenter } width: units.iconSizes.large height: width visible: (searchField.text != "") iconName: "dialog-close" flat: false onClicked: searchField.clear(); Keys.onPressed: { if (event.key === Qt.Key_Tab) { event.accepted = true; if (runnerModel.count) { mainColumn.tryActivate(0, 0); } else { systemFavoritesGrid.tryActivate(0, 0); } } else if (event.key === Qt.Key_Backtab) { event.accepted = true; if (tabBar.visible) { tabBar.focus = true; } else if (globalFavoritesGrid.enabled) { globalFavoritesGrid.tryActivate(0, 0); } else { systemFavoritesGrid.tryActivate(0, 0); } } } } Row { id: middleRow anchors { top: parent.top topMargin: units.gridUnit * (smallScreen ? 8 : 10) bottom: parent.bottom bottomMargin: (units.gridUnit * 2) horizontalCenter: parent.horizontalCenter } - width: (root.columns * cellSize) + (2 * spacing) + width: (root.columns * root.cellSize) + (2 * spacing) spacing: units.gridUnit * 2 Item { id: favoritesColumn anchors { top: parent.top bottom: parent.bottom } - width: (columns * cellSize) + units.gridUnit + width: (columns * root.cellSize) + units.gridUnit property int columns: 3 PlasmaExtras.Heading { id: favoritesColumnLabel enabled: (tabBar.activeTab == 0) anchors { top: parent.top } x: units.smallSpacing width: parent.width - x elide: Text.ElideRight wrapMode: Text.NoWrap color: "white" level: 1 text: i18n("Favorites") opacity: (enabled ? 1.0 : 0.3) Behavior on opacity { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } } } PlasmaCore.SvgItem { id: favoritesColumnLabelUnderline enabled: (tabBar.activeTab == 0) anchors { top: favoritesColumnLabel.bottom } width: parent.width - units.gridUnit height: lineSvg.horLineHeight svg: lineSvg elementId: "horizontal-line" opacity: (enabled ? 1.0 : 0.3) Behavior on opacity { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } } } ItemGridView { id: globalFavoritesGrid enabled: (tabBar.activeTab == 0) anchors { top: favoritesColumnLabelUnderline.bottom topMargin: units.largeSpacing } property int rows: (Math.floor((parent.height - favoritesColumnLabel.height - - favoritesColumnLabelUnderline.height - units.largeSpacing) / cellSize) + - favoritesColumnLabelUnderline.height - units.largeSpacing) / root.cellSize) - systemFavoritesGrid.rows) width: parent.width - height: rows * cellSize + height: rows * root.cellSize - cellWidth: cellSize - cellHeight: cellSize + cellWidth: root.cellSize + cellHeight: root.cellSize iconSize: root.iconSize model: globalFavorites dropEnabled: true usesPlasmaTheme: false opacity: (enabled ? 1.0 : 0.3) Behavior on opacity { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } } onCurrentIndexChanged: { preloadAllAppsTimer.defer(); } onKeyNavRight: { mainColumn.tryActivate(currentRow(), 0); } onKeyNavDown: { systemFavoritesGrid.tryActivate(0, currentCol()); } Keys.onPressed: { if (event.key === Qt.Key_Tab) { event.accepted = true; if (tabBar.visible) { tabBar.focus = true; - } else if (searching) { + } else if (root.searching) { cancelSearchButton.focus = true; } else { mainColumn.tryActivate(0, 0); } } else if (event.key === Qt.Key_Backtab) { event.accepted = true; systemFavoritesGrid.tryActivate(0, 0); } } Binding { target: globalFavorites property: "iconSize" value: root.iconSize } } ItemGridView { id: systemFavoritesGrid anchors { top: globalFavoritesGrid.bottom } - property int rows: Math.ceil(count / Math.floor(width / cellSize)) + property int rows: Math.ceil(count / Math.floor(width / root.cellSize)) width: parent.width - height: rows * cellSize + height: rows * root.cellSize - cellWidth: cellSize - cellHeight: cellSize + cellWidth: root.cellSize + cellHeight: root.cellSize iconSize: root.iconSize model: systemFavorites dropEnabled: true usesPlasmaTheme: true onCurrentIndexChanged: { preloadAllAppsTimer.defer(); } onKeyNavRight: { mainColumn.tryActivate(globalFavoritesGrid.rows + currentRow(), 0); } onKeyNavUp: { globalFavoritesGrid.tryActivate(globalFavoritesGrid.rows - 1, currentCol()); } Keys.onPressed: { if (event.key === Qt.Key_Tab) { event.accepted = true; if (globalFavoritesGrid.enabled) { globalFavoritesGrid.tryActivate(0, 0); } else if (tabBar.visible) { tabBar.focus = true; - } else if (searching && !runnerModel.count) { + } else if (root.searching && !runnerModel.count) { cancelSearchButton.focus = true; } else { mainColumn.tryActivate(0, 0); } } else if (event.key === Qt.Key_Backtab) { event.accepted = true; if (filterList.enabled) { filterList.forceActiveFocus(); - } else if (searching && !runnerModel.count) { + } else if (root.searching && !runnerModel.count) { cancelSearchButton.focus = true; } else { mainColumn.tryActivate(0, 0); } } } } } Item { id: mainColumn anchors.top: parent.top - width: (columns * cellSize) + units.gridUnit - height: Math.floor(parent.height / cellSize) * cellSize + mainGridContainer.headerHeight + width: (columns * root.cellSize) + units.gridUnit + height: Math.floor(parent.height / root.cellSize) * root.cellSize + mainGridContainer.headerHeight property int columns: root.columns - favoritesColumn.columns - filterListColumn.columns property Item visibleGrid: mainGrid function tryActivate(row, col) { if (visibleGrid) { visibleGrid.tryActivate(row, col); } } Item { id: mainGridContainer anchors.fill: parent z: (opacity == 1.0) ? 1 : 0 enabled: (opacity == 1.0) ? 1 : 0 property int headerHeight: mainColumnLabel.height + mainColumnLabelUnderline.height + units.largeSpacing opacity: { - if (tabBar.activeTab == 0 && searching) { + if (tabBar.activeTab == 0 && root.searching) { return 0.0; } if (filterList.allApps) { return 0.0; } return 1.0; } onOpacityChanged: { if (opacity == 1.0) { mainColumn.visibleGrid = mainGrid; } } PlasmaExtras.Heading { id: mainColumnLabel anchors { top: parent.top } x: units.smallSpacing width: parent.width - x elide: Text.ElideRight wrapMode: Text.NoWrap opacity: 1.0 color: "white" level: 1 text: (tabBar.activeTab == 0) ? funnelModel.description : i18n("Widgets") } PlasmaCore.SvgItem { id: mainColumnLabelUnderline visible: mainGrid.count anchors { top: mainColumnLabel.bottom } width: parent.width - units.gridUnit height: lineSvg.horLineHeight svg: lineSvg elementId: "horizontal-line" } ItemGridView { id: mainGrid anchors { top: mainColumnLabelUnderline.bottom topMargin: units.largeSpacing } width: parent.width height: systemFavoritesGrid.y + systemFavoritesGrid.height - mainGridContainer.headerHeight - cellWidth: (tabBar.activeTab == 0 ? cellSize : cellSize * 2) + cellWidth: (tabBar.activeTab == 0 ? root.cellSize : root.cellSize * 2) cellHeight: cellWidth iconSize: (tabBar.activeTab == 0 ? root.iconSize : cellWidth - (units.largeSpacing * 2)) model: funnelModel onCurrentIndexChanged: { preloadAllAppsTimer.defer(); } onKeyNavLeft: { if (tabBar.activeTab == 0) { var row = currentRow(); var target = row + 1 > globalFavoritesGrid.rows ? systemFavoritesGrid : globalFavoritesGrid; var targetRow = row + 1 > globalFavoritesGrid.rows ? row - globalFavoritesGrid.rows : row; target.tryActivate(targetRow, favoritesColumn.columns - 1); } } onKeyNavRight: { filterListScrollArea.focus = true; } onKeyNavUp: { if (tabBar.visible) { tabBar.focus = true; } } onItemActivated: { if (tabBar.activeTab == 1) { containmentInterface.ensureMutable(containmentInterface.screenContainment(plasmoid)); root.widgetExplorer.addApplet(currentItem.m.pluginName); root.toggle(); kwindowsystem.showingDesktop = true; } } } } ItemMultiGridView { id: allAppsGrid anchors { top: parent.top } z: (opacity == 1.0) ? 1 : 0 width: parent.width height: systemFavoritesGrid.y + systemFavoritesGrid.height enabled: (opacity == 1.0) ? 1 : 0 opacity: filterList.allApps ? 1.0 : 0.0 onOpacityChanged: { if (opacity == 1.0) { allAppsGrid.flickableItem.contentY = 0; mainColumn.visibleGrid = allAppsGrid; } } onKeyNavLeft: { var row = 0; for (var i = 0; i < subGridIndex; i++) { row += subGridAt(i).lastRow() + 2; // Header counts as one. } row += subGridAt(subGridIndex).currentRow(); var target = row + 1 > globalFavoritesGrid.rows ? systemFavoritesGrid : globalFavoritesGrid; var targetRow = row + 1 > globalFavoritesGrid.rows ? row - globalFavoritesGrid.rows : row; target.tryActivate(targetRow, favoritesColumn.columns - 1); } onKeyNavRight: { filterListScrollArea.focus = true; } } ItemMultiGridView { id: runnerGrid anchors { top: parent.top } z: (opacity == 1.0) ? 1 : 0 width: parent.width height: Math.min(implicitHeight, systemFavoritesGrid.y + systemFavoritesGrid.height) enabled: (opacity == 1.0) ? 1 : 0 model: runnerModel grabFocus: true - opacity: (tabBar.activeTab == 0 && searching) ? 1.0 : 0.0 + opacity: (tabBar.activeTab == 0 && root.searching) ? 1.0 : 0.0 onOpacityChanged: { if (opacity == 1.0) { mainColumn.visibleGrid = runnerGrid; } } onKeyNavLeft: { var row = 0; for (var i = 0; i < subGridIndex; i++) { row += subGridAt(i).lastRow() + 2; // Header counts as one. } row += subGridAt(subGridIndex).currentRow(); var target = row + 1 > globalFavoritesGrid.rows ? systemFavoritesGrid : globalFavoritesGrid; var targetRow = row + 1 > globalFavoritesGrid.rows ? row - globalFavoritesGrid.rows : row; target.tryActivate(targetRow, favoritesColumn.columns - 1); } } Keys.onPressed: { if (event.key === Qt.Key_Tab) { event.accepted = true; if (filterList.enabled) { filterList.forceActiveFocus(); } else { systemFavoritesGrid.tryActivate(0, 0); } } else if (event.key === Qt.Key_Backtab) { event.accepted = true; - if (searching) { + if (root.searching) { cancelSearchButton.focus = true; } else if (tabBar.visible) { tabBar.focus = true; } else if (globalFavoritesGrid.enabled) { globalFavoritesGrid.tryActivate(0, 0); } else { systemFavoritesGrid.tryActivate(0, 0); } } } } Item { id: filterListColumn anchors { top: parent.top topMargin: mainColumnLabelUnderline.y + mainColumnLabelUnderline.height + units.largeSpacing bottom: parent.bottom } - width: columns * cellSize + width: columns * root.cellSize property int columns: 3 PlasmaExtras.ScrollArea { id: filterListScrollArea x: root.visible ? 0 : units.gridUnit Behavior on x { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } } width: parent.width height: mainGrid.height - enabled: !searching + enabled: !root.searching property alias currentIndex: filterList.currentIndex - opacity: root.visible ? (searching ? 0.30 : 1.0) : 0.3 + opacity: root.visible ? (root.searching ? 0.30 : 1.0) : 0.3 Behavior on opacity { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } } verticalScrollBarPolicy: (opacity == 1.0) ? Qt.ScrollBarAsNeeded : Qt.ScrollBarAlwaysOff onEnabledChanged: { if (!enabled) { filterList.currentIndex = -1; } } onCurrentIndexChanged: { focus = (currentIndex != -1); } ListView { id: filterList focus: true property bool allApps: false property int eligibleWidth: width property int hItemMargins: Math.max(highlightItemSvg.margins.left + highlightItemSvg.margins.right, listItemSvg.margins.left + listItemSvg.margins.right) model: rootModel boundsBehavior: Flickable.StopAtBounds snapMode: ListView.SnapToItem spacing: 0 keyNavigationWraps: true delegate: MouseArea { id: item signal actionTriggered(string actionId, variant actionArgument) signal aboutToShowActionMenu(variant actionMenu) property var m: model property int textWidth: label.contentWidth property int mouseCol property bool hasActionList: ((model.favoriteId !== null) || (("hasActionList" in model) && (model.hasActionList === true))) property Item menu: actionMenu width: parent.width height: Math.ceil((label.paintedHeight + Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom, listItemSvg.margins.top + listItemSvg.margins.bottom)) / 2) * 2 Accessible.role: Accessible.MenuItem Accessible.name: model.display acceptedButtons: Qt.LeftButton | Qt.RightButton hoverEnabled: true onContainsMouseChanged: { if (!containsMouse) { updateCurrentItemTimer.stop(); } } onPositionChanged: { // Lazy menu implementation. mouseCol = mouse.x; if (justOpenedTimer.running || ListView.view.currentIndex === 0 || index === ListView.view.currentIndex) { updateCurrentItem(); } else if ((index == ListView.view.currentIndex - 1) && mouse.y < (height - 6) || (index == ListView.view.currentIndex + 1) && mouse.y > 5) { if (mouse.x > ListView.view.eligibleWidth - 5) { updateCurrentItem(); } } else if (mouse.x > ListView.view.eligibleWidth) { updateCurrentItem(); } updateCurrentItemTimer.restart(); } onPressed: { if (mouse.buttons & Qt.RightButton) { if (hasActionList) { openActionMenu(item, mouse.x, mouse.y); } } } onClicked: { if (mouse.button == Qt.LeftButton) { updateCurrentItem(); } } onAboutToShowActionMenu: { var actionList = hasActionList ? model.actionList : []; Tools.fillActionMenu(i18n, actionMenu, actionList, ListView.view.model.favoritesModel, model.favoriteId); } onActionTriggered: { if (Tools.triggerAction(ListView.view.model, model.index, actionId, actionArgument) === true) { plasmoid.expanded = false; } } function openActionMenu(visualParent, x, y) { aboutToShowActionMenu(actionMenu); actionMenu.visualParent = visualParent; actionMenu.open(x, y); } function updateCurrentItem() { ListView.view.currentIndex = index; ListView.view.eligibleWidth = Math.min(width, mouseCol); } ActionMenu { id: actionMenu onActionClicked: { actionTriggered(actionId, actionArgument); } } Timer { id: updateCurrentItemTimer interval: 50 repeat: false onTriggered: parent.updateCurrentItem() } PlasmaExtras.Heading { id: label anchors { fill: parent leftMargin: highlightItemSvg.margins.left rightMargin: highlightItemSvg.margins.right } elide: Text.ElideRight wrapMode: Text.NoWrap opacity: 1.0 color: "white" level: 1 text: model.display } } highlight: PlasmaComponents.Highlight { anchors { top: filterList.currentItem ? filterList.currentItem.top : undefined left: filterList.currentItem ? filterList.currentItem.left : undefined bottom: filterList.currentItem ? filterList.currentItem.bottom : undefined } opacity: filterListScrollArea.focus ? 1.0 : 0.7 width: (highlightItemSvg.margins.left + filterList.currentItem.textWidth + highlightItemSvg.margins.right + units.smallSpacing) visible: filterList.currentItem } highlightFollowsCurrentItem: false highlightMoveDuration: 0 highlightResizeDuration: 0 onCurrentIndexChanged: applyFilter() onCountChanged: { var width = 0; for (var i = 0; i < rootModel.count; ++i) { headingMetrics.text = rootModel.labelForRow(i); if (headingMetrics.width > width) { width = headingMetrics.width; } } - filterListColumn.columns = Math.ceil(width / cellSize); + filterListColumn.columns = Math.ceil(width / root.cellSize); filterListScrollArea.width = width + hItemMargins + (units.gridUnit * 2); } function applyFilter() { - if (!searching && currentIndex >= 0) { + if (!root.searching && currentIndex >= 0) { if (tabBar.activeTab == 1) { root.widgetExplorer.widgetsModel.filterQuery = currentItem.m.filterData; root.widgetExplorer.widgetsModel.filterType = currentItem.m.filterType; allApps = false; funnelModel.sourceModel = model; return; } if (preloadAllAppsTimer.running) { preloadAllAppsTimer.stop(); } var model = rootModel.modelForRow(currentIndex); if (model.description === "KICKER_ALL_MODEL") { allAppsGrid.model = model; allApps = true; funnelModel.sourceModel = null; preloadAllAppsTimer.done = true; } else { funnelModel.sourceModel = model; allApps = false; } } else { funnelModel.sourceModel = null; allApps = false; } } Keys.onPressed: { if (event.key === Qt.Key_Left) { event.accepted = true; var currentRow = Math.max(0, Math.ceil(currentItem.y / mainGrid.cellHeight) - 1); mainColumn.tryActivate(currentRow, mainColumn.columns - 1); } else if (event.key === Qt.Key_Tab) { event.accepted = true; systemFavoritesGrid.tryActivate(0, 0); } else if (event.key === Qt.Key_Backtab) { event.accepted = true; mainColumn.tryActivate(0, 0); } } } } } } onPressed: { if (mouse.button == Qt.RightButton) { contextMenu.open(mouse.x, mouse.y); } } onClicked: { if (mouse.button == Qt.LeftButton) { root.toggle(); } } } } diff --git a/applets/kicker/package/contents/ui/DashboardTabButton.qml b/applets/kicker/package/contents/ui/DashboardTabButton.qml index 96348fc30..6b7f61d55 100644 --- a/applets/kicker/package/contents/ui/DashboardTabButton.qml +++ b/applets/kicker/package/contents/ui/DashboardTabButton.qml @@ -1,74 +1,74 @@ /*************************************************************************** * Copyright (C) 2016 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.4 import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.extras 2.0 as PlasmaExtras Item { id: tab width: label.contentWidth + (units.largeSpacing * 2) height: label.contentHeight + (units.smallSpacing * 2) property int index: 0 property bool active: false property alias text: label.text Accessible.name: text Accessible.role: Accessible.PageTab Rectangle { anchors.fill: parent color: tab.parent.focus ? theme.highlightColor : "black" - opacity: active ? 0.4 : 0.15 + opacity: tab.active ? 0.4 : 0.15 Behavior on opacity { SmoothedAnimation { duration: units.shortDuration; velocity: 0.01 } } } PlasmaExtras.Heading { id: label x: units.largeSpacing elide: Text.ElideNone wrapMode: Text.NoWrap - opacity: active ? 1.0 : 0.6 + opacity: tab.active ? 1.0 : 0.6 Behavior on opacity { SmoothedAnimation { duration: units.shortDuration; velocity: 0.01 } } color: tab.parent.focus ? theme.highlightedTextColor : "white" level: 1 } MouseArea { anchors.fill: parent hoverEnabled: true onClicked: { tab.parent.activeTab = tab.index; } onContainsMouseChanged: { - tab.parent.containsMouseChanged(index, containsMouse); + tab.parent.containsMouseChanged(tab.index, containsMouse); } } } diff --git a/applets/kicker/package/contents/ui/ItemGridDelegate.qml b/applets/kicker/package/contents/ui/ItemGridDelegate.qml index 94e7d3658..f94fb27e6 100644 --- a/applets/kicker/package/contents/ui/ItemGridDelegate.qml +++ b/applets/kicker/package/contents/ui/ItemGridDelegate.qml @@ -1,132 +1,132 @@ /*************************************************************************** * Copyright (C) 2015 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.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import "code/tools.js" as Tools Item { id: item width: GridView.view.cellWidth height: width property bool showLabel: true property int itemIndex: model.index property string favoriteId: model.favoriteId !== undefined ? model.favoriteId : "" property url url: model.url !== undefined ? model.url : "" property variant icon: model.decoration !== undefined ? model.decoration : "" property var m: model property bool hasActionList: ((model.favoriteId !== null) || (("hasActionList" in model) && (model.hasActionList === true))) Accessible.role: Accessible.MenuItem Accessible.name: model.display function openActionMenu(x, y) { var actionList = hasActionList ? model.actionList : []; Tools.fillActionMenu(i18n, actionMenu, actionList, GridView.view.model.favoritesModel, model.favoriteId); actionMenu.visualParent = item; actionMenu.open(x, y); } function actionTriggered(actionId, actionArgument) { var close = (Tools.triggerAction(GridView.view.model, model.index, actionId, actionArgument) === true); if (close) { root.toggle(); } } PlasmaCore.IconItem { id: icon - y: showLabel ? (2 * highlightItemSvg.margins.top) : undefined + y: item.showLabel ? (2 * highlightItemSvg.margins.top) : undefined anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: showLabel ? undefined : parent.verticalCenter + anchors.verticalCenter: item.showLabel ? undefined : parent.verticalCenter width: iconSize height: width colorGroup: PlasmaCore.Theme.ComplementaryColorGroup animated: false usesPlasmaTheme: item.GridView.view.usesPlasmaTheme source: model.decoration } PlasmaComponents.Label { id: label - visible: showLabel + visible: item.showLabel anchors { top: icon.bottom topMargin: units.smallSpacing left: parent.left leftMargin: highlightItemSvg.margins.left right: parent.right rightMargin: highlightItemSvg.margins.right } horizontalAlignment: Text.AlignHCenter maximumLineCount: 2 elide: Text.ElideRight wrapMode: Text.Wrap color: "white" // FIXME TODO: Respect theming? text: ("name" in model ? model.name : model.display) } PlasmaCore.ToolTipArea { id: toolTip property string text: model.display anchors.fill: parent active: root.visible && label.truncated mainItem: toolTipDelegate onContainsMouseChanged: item.GridView.view.itemContainsMouseChanged(containsMouse) } Keys.onPressed: { if (event.key === Qt.Key_Menu && hasActionList) { event.accepted = true; openActionMenu(item); } else if ((event.key === Qt.Key_Enter || event.key === Qt.Key_Return)) { event.accepted = true; if ("trigger" in GridView.view.model) { GridView.view.model.trigger(index, "", null); root.toggle(); } itemGrid.itemActivated(index, "", null); } } } diff --git a/applets/kicker/package/contents/ui/main.qml b/applets/kicker/package/contents/ui/main.qml index 40a941682..94e62e164 100644 --- a/applets/kicker/package/contents/ui/main.qml +++ b/applets/kicker/package/contents/ui/main.qml @@ -1,283 +1,283 @@ /*************************************************************************** * Copyright (C) 2014-2015 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 QtQuick.Layouts 1.1 import org.kde.plasma.plasmoid 2.0 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: kicker anchors.fill: parent signal reset property bool isDash: (plasmoid.pluginName === "org.kde.plasma.kickerdash") Plasmoid.switchWidth: isDash || !Plasmoid.fullRepresentationItem ? 0 : Plasmoid.fullRepresentationItem.Layout.minimumWidth Plasmoid.switchHeight: isDash || !Plasmoid.fullRepresentationItem ? 0 : Plasmoid.fullRepresentationItem.Layout.minimumHeight // this is a bit of a hack to prevent Plasma from spawning a dialog on its own when we're Dash Plasmoid.preferredRepresentation: isDash ? Plasmoid.fullRepresentation : null Plasmoid.compactRepresentation: isDash ? null : compactRepresentation Plasmoid.fullRepresentation: isDash ? compactRepresentation : menuRepresentation property QtObject itemListDialogComponent: Qt.createComponent("ItemListDialog.qml"); property Item dragSource: null property QtObject globalFavorites: rootModel.favoritesModel property QtObject systemFavorites: rootModel.systemFavoritesModel Plasmoid.icon: plasmoid.configuration.useCustomButtonImage ? plasmoid.configuration.customButtonImage : plasmoid.configuration.icon onSystemFavoritesChanged: { systemFavorites.favorites = plasmoid.configuration.favoriteSystemActions; } function action_menuedit() { processRunner.runMenuEditor(); } function updateSvgMetrics() { lineSvg.horLineHeight = lineSvg.elementSize("horizontal-line").height; lineSvg.vertLineWidth = lineSvg.elementSize("vertical-line").width; } Component { id: compactRepresentation CompactRepresentation {} } Component { id: menuRepresentation MenuRepresentation {} } Kicker.RootModel { id: rootModel autoPopulate: false appNameFormat: plasmoid.configuration.appNameFormat - flat: isDash ? true : plasmoid.configuration.limitDepth + flat: kicker.isDash ? true : plasmoid.configuration.limitDepth sorted: plasmoid.configuration.alphaSort - showSeparators: !isDash + showSeparators: !kicker.isDash appletInterface: plasmoid - showAllApps: isDash + showAllApps: kicker.isDash showAllAppsCategorized: true - showTopLevelItems: !isDash + showTopLevelItems: !kicker.isDash showRecentApps: plasmoid.configuration.showRecentApps showRecentDocs: plasmoid.configuration.showRecentDocs showRecentContacts: plasmoid.configuration.showRecentContacts recentOrdering: plasmoid.configuration.recentOrdering onShowRecentAppsChanged: { plasmoid.configuration.showRecentApps = showRecentApps; } onShowRecentDocsChanged: { plasmoid.configuration.showRecentDocs = showRecentDocs; } onShowRecentContactsChanged: { plasmoid.configuration.showRecentContacts = showRecentContacts; } onRecentOrderingChanged: { plasmoid.configuration.recentOrdering = recentOrdering; } Component.onCompleted: { favoritesModel.initForClient("org.kde.plasma.kicker.favorites.instance-" + plasmoid.id) if (!plasmoid.configuration.favoritesPortedToKAstats) { favoritesModel.portOldFavorites(plasmoid.configuration.favoriteApps); plasmoid.configuration.favoritesPortedToKAstats = true; } rootModel.refresh(); } } Connections { target: globalFavorites onFavoritesChanged: { plasmoid.configuration.favoriteApps = target.favorites; } } Connections { target: systemFavorites onFavoritesChanged: { plasmoid.configuration.favoriteSystemActions = target.favorites; } } Connections { target: plasmoid.configuration onFavoriteAppsChanged: { globalFavorites.favorites = plasmoid.configuration.favoriteApps; } onFavoriteSystemActionsChanged: { systemFavorites.favorites = plasmoid.configuration.favoriteSystemActions; } } Kicker.RunnerModel { id: runnerModel appletInterface: plasmoid favoritesModel: globalFavorites runners: { var runners = new Array("services"); - if (isDash) { + if (kicker.isDash) { runners = runners.concat(new Array("desktopsessions", "PowerDevil", "calculator", "unitconverter")); } if (plasmoid.configuration.useExtraRunners) { runners = runners.concat(plasmoid.configuration.extraRunners); } return runners; } - deleteWhenEmpty: isDash + deleteWhenEmpty: kicker.isDash } Kicker.DragHelper { id: dragHelper dragIconSize: units.iconSizes.medium } Kicker.ProcessRunner { id: processRunner; } Kicker.WindowSystem { id: windowSystem; } PlasmaCore.FrameSvgItem { id : highlightItemSvg visible: false imagePath: "widgets/viewitem" prefix: "hover" } PlasmaCore.FrameSvgItem { id : listItemSvg visible: false imagePath: "widgets/listitem" prefix: "normal" } PlasmaCore.Svg { id: arrows imagePath: "widgets/arrows" size: "16x16" } PlasmaCore.Svg { id: lineSvg imagePath: "widgets/line" property int horLineHeight property int vertLineWidth } PlasmaComponents.Label { id: toolTipDelegate width: contentWidth height: undefined property Item toolTip text: (toolTip != null) ? toolTip.text : "" } Timer { id: justOpenedTimer repeat: false interval: 600 } Connections { target: plasmoid onExpandedChanged: { if (expanded) { windowSystem.monitorWindowVisibility(plasmoid.fullRepresentationItem); justOpenedTimer.start(); } else { kicker.reset(); } } } function resetDragSource() { dragSource = null; } function enableHideOnWindowDeactivate() { plasmoid.hideOnWindowDeactivate = true; } Component.onCompleted: { if (plasmoid.hasOwnProperty("activationTogglesExpanded")) { - plasmoid.activationTogglesExpanded = !isDash + plasmoid.activationTogglesExpanded = !kicker.isDash } windowSystem.focusIn.connect(enableHideOnWindowDeactivate); plasmoid.hideOnWindowDeactivate = true; if (plasmoid.immutability !== PlasmaCore.Types.SystemImmutable) { plasmoid.setAction("menuedit", i18n("Edit Applications..."), "kmenuedit"); } updateSvgMetrics(); theme.themeChanged.connect(updateSvgMetrics); rootModel.refreshed.connect(reset); dragHelper.dropped.connect(resetDragSource); } }