Warning, /plasma/plasma-desktop/desktoppackage/contents/activitymanager/StoppedActivityItem.qml is written in an unsupported language. File is not indexed.

0001 /*   vim:set foldmethod=marker:
0002 
0003     SPDX-FileCopyrightText: 2014 Ivan Cukic <ivan.cukic(at)kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 import QtQuick 2.2
0009 
0010 import org.kde.plasma.components 3.0 as PlasmaComponents
0011 import org.kde.ksvg 1.0 as KSvg
0012 import org.kde.kirigami 2.20 as Kirigami
0013 
0014 import org.kde.kcmutils  // KCMLauncher
0015 import org.kde.config  // KAuthorized
0016 
0017 import org.kde.plasma.activityswitcher as ActivitySwitcher
0018 
0019 import "static.js" as S
0020 
0021 Item {
0022     id: root
0023 
0024     property int innerPadding: Kirigami.Units.smallSpacing
0025 
0026     property string activityId : ""
0027 
0028     property alias title       : title.text
0029     property alias icon        : icon.source
0030 
0031     signal clicked
0032 
0033     width  : 200
0034     height : icon.height + 2 * Kirigami.Units.smallSpacing
0035 
0036     // Background until we get something real
0037     KSvg.FrameSvgItem {
0038         id: highlight
0039         imagePath: "widgets/viewitem"
0040         visible: rootArea.containsMouse
0041 
0042         anchors {
0043             fill: parent
0044             rightMargin: -highlight.margins.right
0045             bottomMargin: -highlight.margins.bottom
0046         }
0047 
0048         prefix: "normal"
0049     }
0050 
0051     Item {
0052         anchors {
0053             fill: parent
0054 
0055             leftMargin: highlight.margins.left
0056             topMargin: highlight.margins.top
0057         }
0058 
0059         // Title and the icon
0060 
0061         Kirigami.Icon {
0062             id: icon
0063 
0064             width  : Kirigami.Units.iconSizes.medium
0065             height : width
0066 
0067             anchors {
0068                 left    : parent.left
0069                 margins : root.innerPadding
0070                 verticalCenter: parent.verticalCenter
0071             }
0072         }
0073 
0074         PlasmaComponents.Label {
0075             id: title
0076 
0077             elide : Text.ElideRight
0078 
0079             anchors {
0080                 left    : icon.right
0081                 right   : parent.right
0082                 margins : root.innerPadding * 2
0083                 verticalCenter: parent.verticalCenter
0084             }
0085             textFormat: Text.PlainText
0086         }
0087 
0088         // Controls
0089 
0090         MouseArea {
0091             id: rootArea
0092 
0093             anchors.fill : parent
0094             hoverEnabled : true
0095 
0096             Accessible.name          : root.title
0097             Accessible.role          : Accessible.Button
0098             Accessible.selectable    : false
0099             Accessible.onPressAction : root.clicked()
0100 
0101             onClicked    : root.clicked()
0102             onEntered    : S.showActivityItemActionsBar(root)
0103         }
0104 
0105         Item {
0106             id: controlBar
0107 
0108             height: root.state == "showingControls" ?
0109                         root.height :
0110                         0
0111 
0112             Behavior on height {
0113                 NumberAnimation {
0114                     duration: Kirigami.Units.longDuration
0115                 }
0116             }
0117 
0118             Behavior on opacity {
0119                 NumberAnimation {
0120                     duration: Kirigami.Units.shortDuration
0121                 }
0122             }
0123 
0124             clip: true
0125 
0126             anchors {
0127                 left   : parent.left
0128                 right  : parent.right
0129                 bottom : parent.bottom
0130             }
0131 
0132             PlasmaComponents.Button {
0133                 id: configButton
0134 
0135                 icon.name: "configure"
0136                 PlasmaComponents.ToolTip.delay: Kirigami.Units.toolTipDelay
0137                 PlasmaComponents.ToolTip.visible: hovered
0138                 PlasmaComponents.ToolTip.text: i18nd("plasma_shell_org.kde.plasma.desktop", "Configure activity")
0139 
0140                 onClicked: KCMLauncher.openSystemSettings("kcm_activities", root.activityId)
0141 
0142                 anchors {
0143                     right       : deleteButton.left
0144                     rightMargin : 2 * Kirigami.Units.smallSpacing
0145                     verticalCenter: parent.verticalCenter
0146                 }
0147             }
0148 
0149             PlasmaComponents.Button {
0150                 id: deleteButton
0151 
0152                 icon.name: "edit-delete"
0153                 PlasmaComponents.ToolTip.delay: Kirigami.Units.toolTipDelay
0154                 PlasmaComponents.ToolTip.visible: hovered
0155                 PlasmaComponents.ToolTip.text: i18nd("plasma_shell_org.kde.plasma.desktop", "Delete")
0156 
0157                 onClicked: ActivitySwitcher.Backend.removeActivity(root.activityId)
0158                 visible: KAuthorized.authorize("plasma-desktop/add_activities")
0159 
0160                 anchors {
0161                     right       : parent.right
0162                     rightMargin : 2 * Kirigami.Units.smallSpacing + 2
0163                     verticalCenter: parent.verticalCenter
0164                 }
0165             }
0166         }
0167     }
0168 
0169     states: [
0170         State {
0171             name: "plain"
0172             PropertyChanges { target: controlBar; opacity: 0 }
0173         },
0174         State {
0175             name: "showingControls"
0176             PropertyChanges { target: controlBar; opacity: 1 }
0177         }
0178     ]
0179 
0180     transitions: [
0181         Transition {
0182             NumberAnimation {
0183                 properties : "opacity"
0184                 duration   : Kirigami.Units.shortDuration
0185             }
0186         }
0187     ]
0188 }
0189 
0190