diff --git a/desktoppackage/contents/activitymanager/Heading.qml b/desktoppackage/contents/activitymanager/Heading.qml index bd913e220..fe44a5d9b 100644 --- a/desktoppackage/contents/activitymanager/Heading.qml +++ b/desktoppackage/contents/activitymanager/Heading.qml @@ -1,120 +1,121 @@ /* vim:set foldmethod=marker: * * Copyright (C) 2014 Ivan Cukic * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, * or (at your option) any later version, as published by the Free * Software Foundation * * 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.2 import QtQuick.Layouts 1.2 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.activities.settings 0.1 Item { id: root property alias searchString: searchText.text property bool showingSearch: false signal closeRequested function focusSearch() { searchText.forceActiveFocus() } onShowingSearchChanged: if (!showingSearch) searchText.text = "" Keys.onPressed: { if (event.key === Qt.Key_Escape) { if (root.showingSearch) { event.accepted = true; root.showingSearch = false; } } } height: childrenRect.height RowLayout { id: buttonRow anchors { top: parent.top left: parent.left right: parent.right } Item { - PlasmaExtras.Title { + PlasmaExtras.Heading { id: heading anchors.fill: parent + level: 1 text: i18nd("plasma_shell_org.kde.plasma.desktop", "Activities") elide: Text.ElideRight visible: !root.showingSearch } PlasmaComponents.TextField { id: searchText anchors.fill: parent focus: true clearButtonShown: true visible: root.showingSearch placeholderText: i18nd("plasma_shell_org.kde.plasma.desktop", "Search...") onTextChanged: if (text != "") root.showingSearch = true } Layout.fillWidth: true Layout.fillHeight: true } PlasmaComponents.ToolButton { id: searchButton iconSource: "edit-find" // checkable: true // onClicked: root.closeRequested() onClicked: root.showingSearch = !root.showingSearch checked: root.showingSearch } PlasmaComponents.ToolButton { id: configureButton iconSource: "configure" onClicked: { ActivitySettings.configureActivities(); root.closeRequested(); } } PlasmaComponents.ToolButton { id: closeButton iconSource: "window-close" onClicked: root.closeRequested() } } } diff --git a/desktoppackage/contents/explorer/WidgetExplorer.qml b/desktoppackage/contents/explorer/WidgetExplorer.qml index 56a0c2245..164870822 100644 --- a/desktoppackage/contents/explorer/WidgetExplorer.qml +++ b/desktoppackage/contents/explorer/WidgetExplorer.qml @@ -1,388 +1,389 @@ /* * Copyright 2011 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 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 02110-1301, USA. */ import QtQuick 2.7 import QtQuick.Controls 2.5 as QQC2 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.kquickcontrolsaddons 2.0 import org.kde.kwindowsystem 1.0 import QtQuick.Window 2.1 import QtQuick.Layouts 1.1 import org.kde.plasma.private.shell 2.0 Item { id: main width: Math.max(heading.paintedWidth, units.iconSizes.enormous * 2 + units.smallSpacing * 4 + units.gridUnit * 2) height: 800//Screen.height opacity: draggingWidget ? 0.3 : 1 property QtObject containment //external drop events can cause a raise event causing us to lose focus and //therefore get deleted whilst we are still in a drag exec() //this is a clue to the owning dialog that hideOnWindowDeactivate should be deleted //See https://bugs.kde.org/show_bug.cgi?id=332733 property bool preventWindowHide: draggingWidget || categoriesDialog.status !== PlasmaComponents.DialogStatus.Closed || getWidgetsDialog.status !== PlasmaComponents.DialogStatus.Closed property bool outputOnly: draggingWidget property Item categoryButton property bool draggingWidget: false signal closed() onVisibleChanged: { if (!visible) { kwindowsystem.showingDesktop = false } } Component.onCompleted: { if (!root.widgetExplorer) { root.widgetExplorer = widgetExplorerComponent.createObject(root) } root.widgetExplorer.containment = main.containment } Component.onDestruction: { if (pendingUninstallTimer.running) { // we're not being destroyed so at least reset the filters widgetExplorer.widgetsModel.filterQuery = "" widgetExplorer.widgetsModel.filterType = "" widgetExplorer.widgetsModel.searchTerm = "" } else { root.widgetExplorer.destroy() root.widgetExplorer = null } } function addCurrentApplet() { var pluginName = list.currentItem ? list.currentItem.pluginName : "" if (pluginName) { widgetExplorer.addApplet(pluginName) } } KWindowSystem { id: kwindowsystem } QQC2.Action { shortcut: "Escape" onTriggered: { if (searchInput.length > 0) { searchInput.text = "" } else { main.closed() } } } QQC2.Action { shortcut: "Up" onTriggered: list.currentIndex = (list.count + list.currentIndex - 1) % list.count } QQC2.Action { shortcut: "Down" onTriggered: list.currentIndex = (list.currentIndex + 1) % list.count } QQC2.Action { shortcut: "Enter" onTriggered: addCurrentApplet() } QQC2.Action { shortcut: "Return" onTriggered: addCurrentApplet() } Component { id: widgetExplorerComponent WidgetExplorer { //view: desktop onShouldClose: main.closed(); } } PlasmaComponents.ModelContextMenu { id: categoriesDialog visualParent: categoryButton // model set on first invocation onClicked: { list.contentX = 0 list.contentY = 0 categoryButton.text = (model.filterData ? model.display : "") widgetExplorer.widgetsModel.filterQuery = model.filterData widgetExplorer.widgetsModel.filterType = model.filterType } } PlasmaComponents.ModelContextMenu { id: getWidgetsDialog visualParent: getWidgetsButton placement: PlasmaCore.Types.TopPosedLeftAlignedPopup // model set on first invocation onClicked: model.trigger() } /* PlasmaCore.Dialog { id: tooltipDialog property Item appletDelegate location: PlasmaCore.Types.RightEdge //actually we want this to be the opposite location of the explorer itself type: PlasmaCore.Dialog.Tooltip flags:Qt.Window|Qt.WindowStaysOnTopHint|Qt.X11BypassWindowManagerHint onAppletDelegateChanged: { if (!appletDelegate) { toolTipHideTimer.restart() toolTipShowTimer.running = false } else if (tooltipDialog.visible) { tooltipDialog.visualParent = appletDelegate } else { tooltipDialog.visualParent = appletDelegate toolTipShowTimer.restart() toolTipHideTimer.running = false } } mainItem: Tooltip { id: tooltipWidget } Behavior on y { NumberAnimation { duration: units.longDuration } } } Timer { id: toolTipShowTimer interval: 500 repeat: false onTriggered: { tooltipDialog.visible = true } } Timer { id: toolTipHideTimer interval: 1000 repeat: false onTriggered: tooltipDialog.visible = false } */ RowLayout { id: topBar anchors { top: parent.top left: parent.left right: parent.right } Item { id: header Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter - PlasmaExtras.Title { + PlasmaExtras.Heading { id: heading anchors.verticalCenter: parent.verticalCenter + level: 1 text: i18nd("plasma_shell_org.kde.plasma.desktop", "Widgets") width: parent.width elide: Text.ElideRight } } PlasmaComponents.ToolButton { id: categoryButton tooltip: i18nd("plasma_shell_org.kde.plasma.desktop", "Categories") iconSource: "view-filter" onClicked: { categoriesDialog.model = widgetExplorer.filterModel categoriesDialog.open(0, categoryButton.height) } } PlasmaComponents.ToolButton { id: closeButton iconSource: "window-close" onClicked: main.closed() } } RowLayout { id: newSearchRow anchors.top: topBar.bottom anchors.topMargin: units.smallSpacing width: topBar.width PlasmaComponents.TextField { id: searchInput Layout.fillWidth: true clearButtonShown: true placeholderText: i18nd("plasma_shell_org.kde.plasma.desktop", "Search...") onTextChanged: { list.positionViewAtBeginning() list.currentIndex = -1 widgetExplorer.widgetsModel.searchTerm = text } Component.onCompleted: forceActiveFocus() } } Timer { id: setModelTimer interval: 20 running: true onTriggered: list.model = widgetExplorer.widgetsModel } PlasmaExtras.ScrollArea { anchors { top: newSearchRow.bottom left: parent.left right: parent.right bottom: bottomBar.top bottomMargin: units.smallSpacing topMargin: units.smallSpacing } verticalScrollBarPolicy: Qt.ScrollBarAlwaysOn // hide the flickering by fading in nicely opacity: setModelTimer.running ? 0 : 1 Behavior on opacity { OpacityAnimator { duration: units.longDuration easing.type: Easing.InOutQuad } } GridView { id: list // model set delayed by Timer above activeFocusOnTab: true keyNavigationWraps: true cellWidth: Math.floor((width - units.smallSpacing) / 2) cellHeight: cellWidth + units.gridUnit * 4 + units.smallSpacing * 2 delegate: AppletDelegate {} highlight: PlasmaComponents.Highlight {} highlightMoveDuration: 0 //highlightResizeDuration: 0 //slide in to view from the left add: Transition { NumberAnimation { properties: "x" from: -list.width duration: units.shortDuration * 3 } } //slide out of view to the right remove: Transition { NumberAnimation { properties: "x" to: list.width duration: units.shortDuration * 3 } } //if we are adding other items into the view use the same animation as normal adding //this makes everything slide in together //if we make it move everything ends up weird addDisplaced: list.add //moved due to filtering displaced: Transition { NumberAnimation { properties: "x,y" duration: units.shortDuration * 3 } } PlasmaExtras.Heading { anchors.fill: parent anchors.margins: units.largeSpacing horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter wrapMode: Text.WordWrap level: 2 text: searchInput.text.length > 0 ? i18n("No widgets matched the search terms") : i18n("No widgets available") enabled: false visible: list.count == 0 } } } Column { id: bottomBar anchors { left: parent.left right: parent.right bottom: parent.bottom } spacing: units.smallSpacing PlasmaComponents.Button { id: getWidgetsButton anchors { left: parent.left right: parent.right } iconSource: "get-hot-new-stuff" text: i18nd("plasma_shell_org.kde.plasma.desktop", "Get New Widgets...") onClicked: { getWidgetsDialog.model = widgetExplorer.widgetsMenuActions getWidgetsDialog.openRelative() } } /* TODO: WidgetExplorer.extraActions is unimplemented Repeater { model: widgetExplorer.extraActions.length PlasmaComponents.Button { anchors { left: parent.left right: parent.right } iconSource: widgetExplorer.extraActions[modelData].icon text: widgetExplorer.extraActions[modelData].text onClicked: widgetExplorer.extraActions[modelData].trigger() } } */ } }