diff --git a/applets/kickoff/package/contents/config/config.qml b/applets/kickoff/package/contents/config/config.qml index 71594a05e..b50b4b0d9 100644 --- a/applets/kickoff/package/contents/config/config.qml +++ b/applets/kickoff/package/contents/config/config.qml @@ -1,29 +1,29 @@ /* * Copyright 2013 Marco Martin * * 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 2.010-1301, USA. */ import QtQuick 2.0 import org.kde.plasma.configuration 2.0 ConfigModel { ConfigCategory { - name: i18n("Appearance") - icon: "preferences-desktop-color" + name: i18n("General") + icon: "preferences-desktop-plasma" source: "ConfigGeneral.qml" } } diff --git a/applets/kickoff/package/contents/ui/ConfigButtons.qml b/applets/kickoff/package/contents/ui/ConfigButtons.qml index 88a808f49..c4685abec 100644 --- a/applets/kickoff/package/contents/ui/ConfigButtons.qml +++ b/applets/kickoff/package/contents/ui/ConfigButtons.qml @@ -1,212 +1,224 @@ /* * Copyright 2016 John Salatas * * 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 2.010-1301, USA. */ -import QtQuick 2.0 -import QtQuick.Layouts 1.0 as Layouts -import QtQuick.Controls 1.0 as Controls +import QtQuick 2.5 import QtQml.Models 2.1 + import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.kirigami 2.5 as Kirigami GridView { id: configButtons - cellHeight: units.gridUnit * 5 + cellHeight: units.gridUnit * 6 + units.smallSpacing cellWidth: units.gridUnit * 6 width: cellWidth * 5 height: cellHeight * 2 property var items: { "bookmark": { icon: "bookmarks", text: i18n("Favorites")}, "application": { icon: "applications-other", text: i18n("Applications")}, "computer": { icon: "pm", text: i18n("Computer")}, "used": { icon: "view-history", text: i18n("History")}, "oftenUsed": { icon: "office-chart-pie", text: i18n("Often Used")}, "leave": { icon: "system-log-out", text: i18n("Leave")} } property var menuItems property var previousCell: [-1, -1] property alias listModel: visualModel.model property int sourceIndex: -1 Component.onCompleted: { menuItems = plasmoid.configuration.menuItems; resetModel(); } function updateModel() { var enabledItems = []; var disabledItems = []; for(var i = 0; i < menuItems.length; i++) { var confItemName = menuItems[i].substring(0, menuItems[i].indexOf(":")); var confItemEnabled = menuItems[i].substring(menuItems[i].length-1) === "t"; var listItem = items[confItemName]; listItem['name'] = confItemName; listItem['enabled'] = confItemEnabled; if(confItemEnabled) { enabledItems.push(listItem); } else { disabledItems.push(listItem); } } fillEmpty(enabledItems); fillEmpty(disabledItems); return enabledItems.concat(disabledItems); } function fillEmpty(list) { var emptyItem = { icon: undefined, text: undefined, name: 'empty', enabled: undefined}; var itemsToAdd = 5 - list.length; for(var j = 0; j < itemsToAdd; j++) { list.push(emptyItem); } } function updateConfiguration() { menuItems = []; for(var i = 0; i < visualModel.items.count; i++) { var itemName = visualModel.items.get(i).model['name']; if(itemName !== 'empty') { var configItem = itemName +":" +(i<5?"t":"f"); menuItems.push(configItem); } } resetModel(); } function resetModel() { listModel.clear(); var items = updateModel(); for(var i = 0; i< items.length; i++) { listModel.append(items[i]); } } displaced: Transition { NumberAnimation { properties: "x,y"; easing.type: Easing.OutQuad } } PlasmaCore.DataSource { id: pmSource engine: "powermanagement" connectedSources: ["PowerDevil"] } model: DelegateModel { id: visualModel model: ListModel { id: listModel } delegate: MouseArea { id: delegateRoot width: units.gridUnit * 6 height: units.gridUnit * 5 property int visualIndex: DelegateModel.itemsIndex drag.target: button onReleased: { button.Drag.drop() } KickoffConfigurationButton { id: button icon: model.icon === "pm" ? (pmSource.data["PowerDevil"] && pmSource.data["PowerDevil"]["Is Lid Present"] ? "computer-laptop" : "computer") : model.icon text: model.text || "" name: model.name anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter } Drag.active: delegateRoot.drag.active && name != 'empty' Drag.source: delegateRoot Drag.hotSpot.x: 36 Drag.hotSpot.y: 36 onStateChanged: { if(!Drag.active && sourceIndex != -1) { sourceIndex = -1; updateConfiguration(); } } states: [ State { when: button.Drag.active ParentChange { target: button; parent: root; } AnchorChanges { target: button; anchors.horizontalCenter: undefined; anchors.verticalCenter: undefined; } } ] } DropArea { anchors { fill: parent; margins: 15 } onEntered: { var source = drag.source.visualIndex; var target = delegateRoot.visualIndex; sourceIndex = drag.source.visualIndex; if(!(previousCell[0] === source && previousCell[1] === target)) { previousCell = [source, target]; if(source < 5 && target >= 5) { visualModel.items.move(source, target); visualModel.items.move(target === 9 ? 8 : 9, 4); } else if (source >= 5 && target < 5) { visualModel.items.move(source, target); visualModel.items.move(5, 9); } else { visualModel.items.move(source, target); } } } onDropped: { var targetIndex = drag.source.visualIndex; updateConfiguration(); sourceIndex = -1; previousCell = [-1, -1]; } } } } + + Kirigami.Heading { + level: 2 + text: i18n("Active Tabs") + anchors.bottom: configButtons.top + } + + Kirigami.Heading { + level: 2 + text: i18n("Inactive Tabs") + anchors.bottom: configButtons.verticalCenter + } } diff --git a/applets/kickoff/package/contents/ui/ConfigGeneral.qml b/applets/kickoff/package/contents/ui/ConfigGeneral.qml index 44790740d..862eac345 100644 --- a/applets/kickoff/package/contents/ui/ConfigGeneral.qml +++ b/applets/kickoff/package/contents/ui/ConfigGeneral.qml @@ -1,168 +1,129 @@ /* * Copyright 2013 David Edmundson * * 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 2.010-1301, USA. */ -import QtQuick 2.0 +import QtQuick 2.5 import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.0 as QtControls +import QtQuick.Controls 2.5 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 org.kde.plasma.extras 2.0 as PlasmaExtras +import org.kde.kirigami 2.5 as Kirigami ColumnLayout { + property string cfg_icon: plasmoid.configuration.icon property alias cfg_switchTabsOnHover: switchTabsOnHoverCheckbox.checked property alias cfg_showAppsByName: showApplicationsByNameCheckbox.checked property alias cfg_useExtraRunners: useExtraRunners.checked property alias cfg_alphaSort: alphaSort.checked property alias cfg_menuItems: configButtons.menuItems - spacing: units.smallSpacing + Kirigami.FormLayout { - RowLayout { - spacing: units.smallSpacing + Button { + id: iconButton - QtControls.Label { - text: i18n("Icon:") - } + Kirigami.FormData.label: i18n("Icon:") - QtControls.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 + implicitWidth: previewFrame.width + units.smallSpacing * 2 + implicitHeight: previewFrame.height + units.smallSpacing * 2 KQuickAddons.IconDialog { id: iconDialog - onIconNameChanged: cfg_icon = iconName || "start-here-kde" // TODO use actual default + onIconNameChanged: cfg_icon = iconName || "start-here-kde" } - // 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) - } + onClicked: iconMenu.opened ? iconMenu.close() : iconMenu.open() 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_icon } } - } - // QQC Menu can only be opened at cursor position, not a random one - PlasmaComponents.ContextMenu { - id: iconMenu - visualParent: iconButton + Menu { + id: iconMenu - PlasmaComponents.MenuItem { - text: i18nc("@item:inmenu Open icon chooser dialog", "Choose...") - icon: "document-open-folder" - onClicked: iconDialog.open() - } - PlasmaComponents.MenuItem { - text: i18nc("@item:inmenu Reset icon to default", "Clear Icon") - icon: "edit-clear" - onClicked: cfg_icon = "start-here-kde" // TODO reset to actual default + // Appear below the button + y: +parent.height + + MenuItem { + text: i18nc("@item:inmenu Open icon chooser dialog", "Choose...") + icon.name: "document-open-folder" + onPressed: iconDialog.open() + } + MenuItem { + text: i18nc("@item:inmenu Reset icon to default", "Clear Icon") + icon.name: "edit-clear" + onClicked: cfg_icon = "start-here-kde" + } } } - } - - QtControls.CheckBox { - id: switchTabsOnHoverCheckbox - text: i18n("Switch tabs on hover") - } - QtControls.CheckBox { - id: showApplicationsByNameCheckbox - text: i18n("Show applications by name") - } + Item { + Kirigami.FormData.isSection: true + } - QtControls.CheckBox { - id: useExtraRunners - text: i18n("Expand search to bookmarks, files and emails") - } + CheckBox { + id: switchTabsOnHoverCheckbox - QtControls.CheckBox { - id: alphaSort - text: i18n("Sort alphabetically") - } + Kirigami.FormData.label: i18n("General:") - Item { - width: height - height: units.gridUnit / 2 - } + text: i18n("Switch tabs on hover") + } - SystemPalette { - id: palette - } + CheckBox { + id: showApplicationsByNameCheckbox + text: i18n("Show applications by name") + } - PlasmaExtras.Heading { - level: 2 - text: i18n("Menu Buttons") - color: palette.text - } + CheckBox { + id: useExtraRunners + text: i18n("Expand search to bookmarks, files and emails") + } - Row { - spacing: units.gridUnit - Column { - QtControls.Label { - text: i18n("Visible Tabs") - height: configButtons.cellHeight - } - QtControls.Label { - text: i18n("Hidden Tabs") - height: configButtons.cellHeight - } + CheckBox { + id: alphaSort + text: i18n("Sort alphabetically") } - Column { - ConfigButtons { - id: configButtons - } + + Item { + Kirigami.FormData.isSection: true } } - QtControls.Label { + ConfigButtons { + id: configButtons + } + + Label { Layout.fillWidth: true text: i18n("Drag tabs between the boxes to show/hide them, or reorder the visible tabs by dragging.") wrapMode: Text.WordWrap } - - Item { - //spacer - Layout.fillHeight: true - } }