diff --git a/applets/showActivityManager/package/contents/config/config.qml b/applets/showActivityManager/package/contents/config/config.qml new file mode 100644 index 000000000..5109e7135 --- /dev/null +++ b/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" + } +} diff --git a/applets/showActivityManager/package/contents/config/main.xml b/applets/showActivityManager/package/contents/config/main.xml new file mode 100644 index 000000000..0abbed796 --- /dev/null +++ b/applets/showActivityManager/package/contents/config/main.xml @@ -0,0 +1,22 @@ + + + + + + + + true + + + + true + + + + + + + diff --git a/applets/showActivityManager/package/contents/ui/ConfigAppearance.qml b/applets/showActivityManager/package/contents/ui/ConfigAppearance.qml new file mode 100644 index 000000000..9b844e23b --- /dev/null +++ b/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") + } +} diff --git a/applets/showActivityManager/package/contents/ui/main.qml b/applets/showActivityManager/package/contents/ui/main.qml index e756ac2a2..76dbc2277 100644 --- a/applets/showActivityManager/package/contents/ui/main.qml +++ b/applets/showActivityManager/package/contents/ui/main.qml @@ -1,68 +1,105 @@ /* * 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 * 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.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 onClicked: { var service = dataSource.serviceForSource(activeSource) var operation = service.operationDescription("toggleActivityManager") service.startOperationCall(operation) } PlasmaCore.DataSource { id: dataSource engine: "org.kde.activities" connectedSources: [activeSource] } PlasmaCore.ToolTipArea { id: tooltip mainText: i18n("Show Activity Manager") subText: i18n("Click to show the activity manager") anchors.fill: parent 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 + } + } + }