Index: applets/showActivityManager/package/contents/config/config.qml =================================================================== --- /dev/null +++ applets/showActivityManager/package/contents/config/config.qml @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Ivan Čukić + * + * 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.0 + +import org.kde.plasma.configuration 2.0 + +ConfigModel { + ConfigCategory { + name: i18n("Appearance") + icon: "activities" + source: "ConfigAppearance.qml" + } +} Index: applets/showActivityManager/package/contents/config/main.xml =================================================================== --- /dev/null +++ applets/showActivityManager/package/contents/config/main.xml @@ -0,0 +1,22 @@ + + + + + + + + true + + + + true + + + + + + + Index: applets/showActivityManager/package/contents/ui/ConfigAppearance.qml =================================================================== --- /dev/null +++ applets/showActivityManager/package/contents/ui/ConfigAppearance.qml @@ -0,0 +1,62 @@ +/* + * Copyright 2020 Ivan Čukić + * + * 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.0 +import QtQuick.Controls 2.5 + +import org.kde.kirigami 2.5 as Kirigami +import org.kde.plasma.plasmoid 2.0 +import org.kde.plasma.core 2.0 as PlasmaCore + +Kirigami.FormLayout { + anchors.left: parent.left + anchors.right: parent.right + + property alias cfg_showActivityIcon: radioCurrentActivityIcon.checked + property alias cfg_showActivityName: checkShowActivityName.checked + property bool disableSetting: plasmoid.formFactor === PlasmaCore.Types.Vertical + + Item { Kirigami.FormData.isSection: true } + + RadioButton { + id: radioCurrentActivityIcon + + Kirigami.FormData.label: i18n("Icon:") + + enabled: !disableSetting + text: i18n("Show the current activity icon") + } + + RadioButton { + id: radioGenericActivityIcon + enabled: !disableSetting + checked: !radioCurrentActivityIcon.checked + text: i18n("Show the generic activity icon") + } + + Item { Kirigami.FormData.isSection: true } + + CheckBox { + id: checkShowActivityName + + Kirigami.FormData.label: i18n("Title:") + + text: i18n("Show the current activity name") + } +} Index: applets/showActivityManager/package/contents/ui/main.qml =================================================================== --- applets/showActivityManager/package/contents/ui/main.qml +++ applets/showActivityManager/package/contents/ui/main.qml @@ -1,5 +1,6 @@ /* * Copyright 2012 Gregor Taetzner + * Copyright 2020 Ivan Čukić * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -21,20 +22,32 @@ 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.activities 0.1 as Activities MouseArea { - id: iconContainer + id: root property string activeSource: "Status" height: units.iconSizes.large width: units.iconSizes.large + property bool showActivityName: plasmoid.configuration.showActivityName + property bool showActivityIcon: plasmoid.configuration.showActivityIcon + 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.maximumWidth: inPanel ? units.iconSizeHints.panel : -1 - Layout.maximumHeight: inPanel ? units.iconSizeHints.panel : -1 + Layout.maximumWidth: Infinity + Layout.maximumHeight: Infinity + + Layout.preferredWidth : icon.width + units.smallSpacing + (root.showActivityName ? name.implicitWidth : 0) + Layout.preferredHeight: inPanel ? units.iconSizeHints.panel : -1 + + Layout.minimumWidth: 0 + Layout.minimumHeight: 0 Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation @@ -58,11 +71,35 @@ icon: "activities" } + Activities.ActivityInfo { + id: currentActivity + activityId: ":current" + } + PlasmaCore.IconItem { id: icon - source: "activities" - width: parent.width + source: !root.showActivityIcon ? "activities" : + currentActivity.icon == "" ? "activities" : + currentActivity.icon + height: parent.height + width: height } + + PlasmaComponents.Label { + id: name + + text: currentActivity.name + height: parent.height + width: implicitWidth + + visible: root.showActivityName + + anchors { + left: icon.right + leftMargin: units.smallSpacing + } + } + }