mirror of
https://gitgud.io/wackyideas/aerothemeplasma.git
synced 2024-08-15 00:43:43 +00:00
Very early KDE 6 release.
This commit is contained in:
parent
7cc4ccabbc
commit
686046d4f7
6272 changed files with 140920 additions and 529657 deletions
|
@ -0,0 +1,397 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2014-2020 Ivan Cukic <ivan.cukic(at)kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||
import org.kde.plasma.activityswitcher as ActivitySwitcher
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
|
||||
import org.kde.kcmutils // KCMLauncher
|
||||
|
||||
import "static.js" as S
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property int innerPadding : Kirigami.Units.gridUnit
|
||||
|
||||
property bool current : false
|
||||
property bool selected : false
|
||||
property bool stoppable : true
|
||||
|
||||
property alias title : title.text
|
||||
property alias icon : icon.source
|
||||
property alias hasWindows : hasWindowsIndicator.visible
|
||||
|
||||
z : current ? 10 :
|
||||
selected ? 5 : 0
|
||||
|
||||
property string activityId : ""
|
||||
|
||||
property string background : ""
|
||||
|
||||
onBackgroundChanged: if (background[0] !== '#') {
|
||||
// We have a proper wallpaper, hurroo!
|
||||
backgroundColor.visible = false;
|
||||
|
||||
} else {
|
||||
// We have only a color
|
||||
backgroundColor.color = background;
|
||||
backgroundColor.visible = true;
|
||||
}
|
||||
|
||||
signal clicked
|
||||
|
||||
width : 200
|
||||
height : width * 9.0 / 16.0
|
||||
|
||||
Item {
|
||||
anchors {
|
||||
fill: parent
|
||||
}
|
||||
|
||||
// Background until we get something real
|
||||
Rectangle {
|
||||
id: backgroundColor
|
||||
|
||||
anchors.fill: parent
|
||||
// This is intentional - while waiting for the wallpaper,
|
||||
// we are showing a semi-transparent black background
|
||||
color: "black"
|
||||
|
||||
opacity: root.selected ? .8 : .5
|
||||
}
|
||||
|
||||
Image {
|
||||
id: backgroundWallpaper
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
visible: !backgroundColor.visible
|
||||
source: "image://wallpaperthumbnail/" + background
|
||||
sourceSize: Qt.size(width, height)
|
||||
}
|
||||
|
||||
// Title and the icon
|
||||
|
||||
Rectangle {
|
||||
id: shade
|
||||
|
||||
width: parent.height
|
||||
height: parent.width
|
||||
|
||||
anchors.centerIn: parent
|
||||
rotation: 90
|
||||
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 1.0; color: "black" }
|
||||
GradientStop { position: 0.0; color: "transparent" }
|
||||
}
|
||||
|
||||
opacity : root.selected ? 0.5 : 1.0
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: currentActivityHighlight
|
||||
|
||||
visible: root.current
|
||||
|
||||
border.width: root.current ? Kirigami.Units.smallSpacing : 0
|
||||
border.color: Kirigami.Theme.highlightColor
|
||||
|
||||
z: 10
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
// Hide the rounding error on the bottom of the rectangle
|
||||
bottomMargin: -1
|
||||
}
|
||||
|
||||
color: "transparent"
|
||||
}
|
||||
|
||||
Item {
|
||||
id: titleBar
|
||||
|
||||
anchors {
|
||||
top : parent.top
|
||||
left : parent.left
|
||||
right : parent.right
|
||||
|
||||
leftMargin : 2 * Kirigami.Units.smallSpacing + 2
|
||||
topMargin : 2 * Kirigami.Units.smallSpacing
|
||||
}
|
||||
|
||||
Text {
|
||||
id: title
|
||||
|
||||
color : "white"
|
||||
elide : Text.ElideRight
|
||||
visible : shade.visible
|
||||
|
||||
font.bold : true
|
||||
|
||||
anchors {
|
||||
top : parent.top
|
||||
left : parent.left
|
||||
right : icon.left
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: description
|
||||
|
||||
color : "white"
|
||||
elide : Text.ElideRight
|
||||
text : model.description
|
||||
opacity : .6
|
||||
|
||||
anchors {
|
||||
top : title.bottom
|
||||
left : parent.left
|
||||
right : icon.left
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.Icon {
|
||||
id: icon
|
||||
|
||||
width : Kirigami.Units.iconSizes.medium
|
||||
height : width
|
||||
|
||||
anchors {
|
||||
right : parent.right
|
||||
rightMargin : 2 * Kirigami.Units.smallSpacing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: statsBar
|
||||
|
||||
height: childrenRect.height + Kirigami.Units.smallSpacing
|
||||
|
||||
anchors {
|
||||
bottom : controlBar.top
|
||||
left : parent.left
|
||||
right : parent.right
|
||||
|
||||
leftMargin : 2 * Kirigami.Units.smallSpacing + 2
|
||||
rightMargin : 2 * Kirigami.Units.smallSpacing
|
||||
bottomMargin : Kirigami.Units.smallSpacing
|
||||
}
|
||||
|
||||
Kirigami.Icon {
|
||||
id : hasWindowsIndicator
|
||||
source : "window-duplicate"
|
||||
width : 16
|
||||
height : width
|
||||
opacity : .6
|
||||
visible : false
|
||||
}
|
||||
|
||||
Text {
|
||||
id: lastUsedDate
|
||||
|
||||
color : "white"
|
||||
elide : Text.ElideRight
|
||||
opacity : .6
|
||||
|
||||
text: root.current ?
|
||||
i18nd("plasma_shell_org.kde.plasma.desktop", "Currently being used") :
|
||||
model.lastTimeUsedString
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: dropHighlight
|
||||
visible: moveDropAction.isHovered || copyDropAction.isHovered
|
||||
|
||||
onVisibleChanged: {
|
||||
ActivitySwitcher.Backend.setDropMode(visible);
|
||||
if (visible) {
|
||||
root.state = "dropAreasShown";
|
||||
} else {
|
||||
root.state = "plain";
|
||||
}
|
||||
}
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
topMargin: icon.height + 3 * Kirigami.Units.smallSpacing
|
||||
}
|
||||
|
||||
opacity: .75
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
}
|
||||
|
||||
TaskDropArea {
|
||||
id: moveDropAction
|
||||
|
||||
anchors {
|
||||
right: parent.horizontalCenter
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
topPadding: icon.height + 3 * Kirigami.Units.smallSpacing
|
||||
actionVisible: dropHighlight.visible
|
||||
|
||||
actionTitle: i18nd("plasma_shell_org.kde.plasma.desktop", "Move to\nthis activity")
|
||||
|
||||
onTaskDropped: {
|
||||
ActivitySwitcher.Backend.dropMove(mimeData, root.activityId);
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
root.clicked();
|
||||
}
|
||||
|
||||
onEntered: {
|
||||
S.showActivityItemActionsBar(root);
|
||||
}
|
||||
|
||||
visible: ActivitySwitcher.Backend.dropEnabled
|
||||
}
|
||||
|
||||
TaskDropArea {
|
||||
id: copyDropAction
|
||||
|
||||
topPadding: icon.height + 3 * Kirigami.Units.smallSpacing
|
||||
actionVisible: dropHighlight.visible
|
||||
|
||||
anchors {
|
||||
right: parent.right
|
||||
left: parent.horizontalCenter
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
actionTitle: i18nd("plasma_shell_org.kde.plasma.desktop", "Show also\nin this activity")
|
||||
|
||||
onTaskDropped: {
|
||||
ActivitySwitcher.Backend.dropCopy(mimeData, root.activityId);
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
root.clicked();
|
||||
}
|
||||
|
||||
onEntered: {
|
||||
S.showActivityItemActionsBar(root);
|
||||
}
|
||||
|
||||
visible: ActivitySwitcher.Backend.dropEnabled
|
||||
|
||||
}
|
||||
|
||||
// Controls
|
||||
Item {
|
||||
id: controlBar
|
||||
|
||||
height: root.state == "showingControls" ?
|
||||
(configButton.height + 4 * Kirigami.Units.smallSpacing) :
|
||||
0
|
||||
|
||||
Behavior on height {
|
||||
NumberAnimation {
|
||||
duration: Kirigami.Units.longDuration
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Kirigami.Units.shortDuration
|
||||
}
|
||||
}
|
||||
|
||||
clip: true
|
||||
|
||||
anchors {
|
||||
bottom : parent.bottom
|
||||
left : parent.left
|
||||
right : parent.right
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: - 2 * Kirigami.Units.smallSpacing
|
||||
}
|
||||
|
||||
opacity: .75
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
}
|
||||
|
||||
PlasmaComponents.Button {
|
||||
id: configButton
|
||||
|
||||
icon.name: "configure"
|
||||
PlasmaComponents.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
PlasmaComponents.ToolTip.visible: hovered
|
||||
PlasmaComponents.ToolTip.text: i18nd("plasma_shell_org.kde.plasma.desktop", "Configure")
|
||||
|
||||
onClicked: KCMLauncher.openSystemSettings("kcm_activities", root.activityId);
|
||||
|
||||
anchors {
|
||||
left : parent.left
|
||||
top : parent.top
|
||||
leftMargin : 2 * Kirigami.Units.smallSpacing + 2
|
||||
topMargin : 2 * Kirigami.Units.smallSpacing
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.Button {
|
||||
id: stopButton
|
||||
|
||||
visible: stoppable
|
||||
icon.name: "process-stop"
|
||||
PlasmaComponents.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
PlasmaComponents.ToolTip.visible: hovered
|
||||
PlasmaComponents.ToolTip.text: i18nd("plasma_shell_org.kde.plasma.desktop", "Stop activity")
|
||||
|
||||
onClicked: ActivitySwitcher.Backend.stopActivity(activityId);
|
||||
|
||||
anchors {
|
||||
right : parent.right
|
||||
top : parent.top
|
||||
rightMargin : 2 * Kirigami.Units.smallSpacing + 2
|
||||
topMargin : 2 * Kirigami.Units.smallSpacing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "plain"
|
||||
PropertyChanges { target: shade; visible: true }
|
||||
PropertyChanges { target: controlBar; opacity: 0 }
|
||||
},
|
||||
State {
|
||||
name: "showingControls"
|
||||
PropertyChanges { target: shade; visible: true }
|
||||
PropertyChanges { target: controlBar; opacity: 1 }
|
||||
},
|
||||
State {
|
||||
name: "dropAreasShown"
|
||||
// PropertyChanges { target: shade; visible: false }
|
||||
PropertyChanges { target: statsBar; visible: false }
|
||||
PropertyChanges { target: controlBar; opacity: 0 }
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
NumberAnimation {
|
||||
properties : "opacity"
|
||||
duration : Kirigami.Units.shortDuration
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,197 @@
|
|||
/* vim:set foldmethod=marker:
|
||||
|
||||
SPDX-FileCopyrightText: 2014 Ivan Cukic <ivan.cukic(at)kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
import org.kde.activities 0.1 as Activities
|
||||
|
||||
import org.kde.plasma.activityswitcher as ActivitySwitcher
|
||||
|
||||
Flickable {
|
||||
id: root
|
||||
|
||||
// contentWidth: content.width
|
||||
contentHeight: content.height
|
||||
|
||||
property var model: ActivitySwitcher.Backend.runningActivitiesModel()
|
||||
property string filterString: ""
|
||||
property bool showSwitcherOnly: false
|
||||
|
||||
property int itemsWidth: 0
|
||||
|
||||
property int selectedIndex: -1
|
||||
|
||||
function _selectRelativeToCurrent(distance)
|
||||
{
|
||||
var startingWithSelected = selectedIndex;
|
||||
|
||||
do {
|
||||
selectedIndex += distance;
|
||||
|
||||
if (selectedIndex >= activitiesList.count) {
|
||||
selectedIndex = 0;
|
||||
}
|
||||
|
||||
if (selectedIndex < 0) {
|
||||
selectedIndex = activitiesList.count - 1;
|
||||
}
|
||||
|
||||
// Searching for the first item that is visible, or back to the one
|
||||
// that we started with
|
||||
} while (!activitiesList.itemAt(selectedIndex).visible
|
||||
&& startingWithSelected !== selectedIndex);
|
||||
|
||||
_updateSelectedItem();
|
||||
|
||||
}
|
||||
|
||||
function selectNext()
|
||||
{
|
||||
_selectRelativeToCurrent(1);
|
||||
}
|
||||
|
||||
function selectPrevious()
|
||||
{
|
||||
_selectRelativeToCurrent(-1);
|
||||
}
|
||||
|
||||
function _updateSelectedItem()
|
||||
{
|
||||
for (var i = 0; i < activitiesList.count; i++) {
|
||||
activitiesList.itemAt(i).selected = (i === selectedIndex);
|
||||
}
|
||||
}
|
||||
|
||||
function openSelected()
|
||||
{
|
||||
var selectedItem = null;
|
||||
|
||||
if (selectedIndex >= 0 && selectedIndex < activitiesList.count) {
|
||||
selectedItem = activitiesList.itemAt(selectedIndex);
|
||||
|
||||
} else if (root.filterString != "") {
|
||||
// If we have only one item shown, activate it. It doesn't matter
|
||||
// that it is not really selected
|
||||
|
||||
for (var i = 0; i < activitiesList.count; i++) {
|
||||
var item = activitiesList.itemAt(i);
|
||||
|
||||
if (item.visible) {
|
||||
selectedItem = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedItem !== null) {
|
||||
ActivitySwitcher.Backend.setCurrentActivity(selectedItem.activityId);
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: content
|
||||
|
||||
// width: root.width - (root.width % 10)
|
||||
width: root.itemsWidth
|
||||
spacing: Kirigami.Units.smallSpacing * 2
|
||||
|
||||
// Running activities
|
||||
|
||||
Repeater {
|
||||
id: activitiesList
|
||||
|
||||
model: ActivitySwitcher.Backend.runningActivitiesModel()
|
||||
|
||||
ActivityItem {
|
||||
|
||||
width: content.width
|
||||
|
||||
visible : (root.filterString == "") ||
|
||||
(title.toLowerCase().indexOf(root.filterString) != -1)
|
||||
|
||||
activityId : model.id
|
||||
title : model.name
|
||||
icon : model.iconSource
|
||||
background : model.background
|
||||
current : model.isCurrent
|
||||
hasWindows : model.hasWindows
|
||||
innerPadding : 2 * Kirigami.Units.smallSpacing
|
||||
stoppable : activitiesList.count > 1
|
||||
|
||||
onClicked : {
|
||||
ActivitySwitcher.Backend.setCurrentActivity(model.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Stopped activities
|
||||
|
||||
Item {
|
||||
// spacer
|
||||
width : parent.width
|
||||
height : Kirigami.Units.gridUnit
|
||||
}
|
||||
|
||||
Kirigami.Heading {
|
||||
id: stoppedActivitiesHeading
|
||||
|
||||
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Stopped activities:")
|
||||
textFormat: Text.PlainText
|
||||
level: 3
|
||||
visible: !root.showSwitcherOnly && stoppedActivitiesList.count > 0
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: stoppedActivitiesList
|
||||
|
||||
model: root.showSwitcherOnly ? null : ActivitySwitcher.Backend.stoppedActivitiesModel()
|
||||
|
||||
delegate: StoppedActivityItem {
|
||||
id: stoppedActivityItem
|
||||
|
||||
width: parent.width
|
||||
|
||||
visible : (root.filterString == "") ||
|
||||
(title.toLowerCase().indexOf(root.filterString) != -1)
|
||||
|
||||
activityId : model.id
|
||||
title : model.name
|
||||
icon : model.iconSource
|
||||
innerPadding : 2 * Kirigami.Units.smallSpacing
|
||||
|
||||
onClicked: {
|
||||
ActivitySwitcher.Backend.setCurrentActivity(model.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
// spacer
|
||||
width : parent.width
|
||||
height : Kirigami.Units.gridUnit * 2
|
||||
|
||||
visible: stoppedActivitiesHeading.visible
|
||||
}
|
||||
|
||||
add: Transition {
|
||||
NumberAnimation {
|
||||
properties: "x"
|
||||
from: -100
|
||||
duration: Kirigami.Units.shortDuration
|
||||
}
|
||||
}
|
||||
|
||||
move: Transition {
|
||||
NumberAnimation {
|
||||
id: animation
|
||||
properties: "y"
|
||||
duration: Kirigami.Units.longDuration
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>
|
||||
SPDX-FileCopyrightText: 2014 Ivan Cukic <ivan.cukic@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
import org.kde.config as KConfig // KAuthorized
|
||||
import org.kde.kcmutils // KCMLauncher
|
||||
|
||||
|
||||
FocusScope {
|
||||
id: root
|
||||
signal closed()
|
||||
|
||||
function parentClosed() {
|
||||
activityBrowser.parentClosed();
|
||||
}
|
||||
|
||||
//this is used to perfectly align the filter field and delegates
|
||||
property int cellWidth: Kirigami.Units.iconSizes.sizeForLabels * 30
|
||||
property int spacing: 2 * Kirigami.Units.smallSpacing
|
||||
|
||||
property bool showSwitcherOnly: false
|
||||
|
||||
width: Kirigami.Units.gridUnit * 16
|
||||
|
||||
Item {
|
||||
id: activityBrowser
|
||||
|
||||
property int spacing: 2 * Kirigami.Units.smallSpacing
|
||||
|
||||
signal closeRequested()
|
||||
|
||||
Keys.onPressed: {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
if (heading.searchString.length > 0) {
|
||||
heading.searchString = "";
|
||||
} else {
|
||||
activityBrowser.closeRequested();
|
||||
}
|
||||
|
||||
} else if (event.key === Qt.Key_Up) {
|
||||
activityList.selectPrevious();
|
||||
|
||||
} else if (event.key === Qt.Key_Down) {
|
||||
activityList.selectNext();
|
||||
|
||||
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
||||
activityList.openSelected();
|
||||
|
||||
} else if (event.key === Qt.Key_Tab) {
|
||||
// console.log("TAB KEY");
|
||||
|
||||
} else {
|
||||
// console.log("OTHER KEY");
|
||||
// event.accepted = false;
|
||||
// heading.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
||||
// Rectangle {
|
||||
// anchors.fill : parent
|
||||
// opacity : .4
|
||||
// color : "white"
|
||||
// }
|
||||
|
||||
Heading {
|
||||
id: heading
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
|
||||
leftMargin: Kirigami.Units.smallSpacing
|
||||
rightMargin: Kirigami.Units.smallSpacing
|
||||
}
|
||||
|
||||
visible: !root.showSwitcherOnly
|
||||
|
||||
onCloseRequested: activityBrowser.closeRequested()
|
||||
}
|
||||
|
||||
PlasmaComponents.ScrollView {
|
||||
anchors {
|
||||
top: heading.visible ? heading.bottom : parent.top
|
||||
bottom: bottomPanel.visible ? bottomPanel.top : parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
topMargin: activityBrowser.spacing
|
||||
}
|
||||
|
||||
ActivityList {
|
||||
id: activityList
|
||||
showSwitcherOnly: root.showSwitcherOnly
|
||||
filterString: heading.searchString.toLowerCase()
|
||||
itemsWidth: root.width - Kirigami.Units.smallSpacing
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: bottomPanel
|
||||
|
||||
height: newActivityButton.height + Kirigami.Units.gridUnit
|
||||
|
||||
visible: !root.showSwitcherOnly
|
||||
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
PlasmaComponents.ToolButton {
|
||||
id: newActivityButton
|
||||
|
||||
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Create activity…")
|
||||
icon.name: "list-add"
|
||||
|
||||
width: parent.width
|
||||
|
||||
onClicked: KCMLauncher.openSystemSettings("kcm_activities", "newActivity")
|
||||
|
||||
visible: KConfig.KAuthorized.authorize("plasma-desktop/add_activities")
|
||||
opacity: newActivityDialog.status == Loader.Ready ?
|
||||
1 - newActivityDialog.item.opacity : 1
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: newActivityDialog
|
||||
|
||||
z: 100
|
||||
|
||||
anchors.bottom: newActivityButton.bottom
|
||||
anchors.left: newActivityButton.left
|
||||
anchors.right: newActivityButton.right
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
onCloseRequested: root.closed()
|
||||
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/* vim:set foldmethod=marker:
|
||||
|
||||
SPDX-FileCopyrightText: 2014 Ivan Cukic <ivan.cukic(at)kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Layouts 1.2
|
||||
|
||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
|
||||
import org.kde.kcmutils as KCM
|
||||
import org.kde.config as KConfig
|
||||
|
||||
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 {
|
||||
Kirigami.Heading {
|
||||
id: heading
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
level: 1
|
||||
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Activities")
|
||||
textFormat: Text.PlainText
|
||||
elide: Text.ElideRight
|
||||
|
||||
visible: !root.showingSearch
|
||||
}
|
||||
|
||||
PlasmaExtras.SearchField {
|
||||
id: searchText
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
focus: true
|
||||
visible: root.showingSearch
|
||||
|
||||
onTextChanged: if (text != "") root.showingSearch = true
|
||||
}
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
PlasmaComponents.ToolButton {
|
||||
id: searchButton
|
||||
icon.name: "edit-find"
|
||||
|
||||
// checkable: true
|
||||
// onClicked: root.closeRequested()
|
||||
onClicked: root.showingSearch = !root.showingSearch
|
||||
checked: root.showingSearch
|
||||
}
|
||||
|
||||
PlasmaComponents.ToolButton {
|
||||
id: configureButton
|
||||
icon.name: "configure"
|
||||
visible: KConfig.KAuthorized.authorizeControlModule("kcm_activities")
|
||||
onClicked: {
|
||||
KCM.KCMLauncher.openSystemSettings("kcm_activities");
|
||||
root.closeRequested();
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.ToolButton {
|
||||
id: closeButton
|
||||
icon.name: "window-close"
|
||||
onClicked: root.closeRequested()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,190 @@
|
|||
/* vim:set foldmethod=marker:
|
||||
|
||||
SPDX-FileCopyrightText: 2014 Ivan Cukic <ivan.cukic(at)kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
|
||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||
import org.kde.ksvg 1.0 as KSvg
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
|
||||
import org.kde.kcmutils // KCMLauncher
|
||||
import org.kde.config // KAuthorized
|
||||
|
||||
import org.kde.plasma.activityswitcher as ActivitySwitcher
|
||||
|
||||
import "static.js" as S
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property int innerPadding: Kirigami.Units.smallSpacing
|
||||
|
||||
property string activityId : ""
|
||||
|
||||
property alias title : title.text
|
||||
property alias icon : icon.source
|
||||
|
||||
signal clicked
|
||||
|
||||
width : 200
|
||||
height : icon.height + 2 * Kirigami.Units.smallSpacing
|
||||
|
||||
// Background until we get something real
|
||||
KSvg.FrameSvgItem {
|
||||
id: highlight
|
||||
imagePath: "widgets/viewitem"
|
||||
visible: rootArea.containsMouse
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
rightMargin: -highlight.margins.right
|
||||
bottomMargin: -highlight.margins.bottom
|
||||
}
|
||||
|
||||
prefix: "normal"
|
||||
}
|
||||
|
||||
Item {
|
||||
anchors {
|
||||
fill: parent
|
||||
|
||||
leftMargin: highlight.margins.left
|
||||
topMargin: highlight.margins.top
|
||||
}
|
||||
|
||||
// Title and the icon
|
||||
|
||||
Kirigami.Icon {
|
||||
id: icon
|
||||
|
||||
width : Kirigami.Units.iconSizes.medium
|
||||
height : width
|
||||
|
||||
anchors {
|
||||
left : parent.left
|
||||
margins : root.innerPadding
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: title
|
||||
|
||||
elide : Text.ElideRight
|
||||
|
||||
anchors {
|
||||
left : icon.right
|
||||
right : parent.right
|
||||
margins : root.innerPadding * 2
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
textFormat: Text.PlainText
|
||||
}
|
||||
|
||||
// Controls
|
||||
|
||||
MouseArea {
|
||||
id: rootArea
|
||||
|
||||
anchors.fill : parent
|
||||
hoverEnabled : true
|
||||
|
||||
Accessible.name : root.title
|
||||
Accessible.role : Accessible.Button
|
||||
Accessible.selectable : false
|
||||
Accessible.onPressAction : root.clicked()
|
||||
|
||||
onClicked : root.clicked()
|
||||
onEntered : S.showActivityItemActionsBar(root)
|
||||
}
|
||||
|
||||
Item {
|
||||
id: controlBar
|
||||
|
||||
height: root.state == "showingControls" ?
|
||||
root.height :
|
||||
0
|
||||
|
||||
Behavior on height {
|
||||
NumberAnimation {
|
||||
duration: Kirigami.Units.longDuration
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Kirigami.Units.shortDuration
|
||||
}
|
||||
}
|
||||
|
||||
clip: true
|
||||
|
||||
anchors {
|
||||
left : parent.left
|
||||
right : parent.right
|
||||
bottom : parent.bottom
|
||||
}
|
||||
|
||||
PlasmaComponents.Button {
|
||||
id: configButton
|
||||
|
||||
icon.name: "configure"
|
||||
PlasmaComponents.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
PlasmaComponents.ToolTip.visible: hovered
|
||||
PlasmaComponents.ToolTip.text: i18nd("plasma_shell_org.kde.plasma.desktop", "Configure activity")
|
||||
|
||||
onClicked: KCMLauncher.openSystemSettings("kcm_activities", root.activityId)
|
||||
|
||||
anchors {
|
||||
right : deleteButton.left
|
||||
rightMargin : 2 * Kirigami.Units.smallSpacing
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.Button {
|
||||
id: deleteButton
|
||||
|
||||
icon.name: "edit-delete"
|
||||
PlasmaComponents.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
PlasmaComponents.ToolTip.visible: hovered
|
||||
PlasmaComponents.ToolTip.text: i18nd("plasma_shell_org.kde.plasma.desktop", "Delete")
|
||||
|
||||
onClicked: ActivitySwitcher.Backend.removeActivity(root.activityId)
|
||||
visible: KAuthorized.authorize("plasma-desktop/add_activities")
|
||||
|
||||
anchors {
|
||||
right : parent.right
|
||||
rightMargin : 2 * Kirigami.Units.smallSpacing + 2
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "plain"
|
||||
PropertyChanges { target: controlBar; opacity: 0 }
|
||||
},
|
||||
State {
|
||||
name: "showingControls"
|
||||
PropertyChanges { target: controlBar; opacity: 1 }
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
NumberAnimation {
|
||||
properties : "opacity"
|
||||
duration : Kirigami.Units.shortDuration
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2020 Ivan Cukic <ivan.cukic(at)kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
import org.kde.draganddrop 2.0 as DND
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
|
||||
DND.DropArea {
|
||||
id: root
|
||||
|
||||
signal taskDropped(variant mimeData, variant modifiers)
|
||||
signal clicked()
|
||||
signal entered()
|
||||
|
||||
property int topPadding: 0
|
||||
property string activityName: ""
|
||||
property bool selected: false
|
||||
property string actionTitle: ""
|
||||
property bool isHovered: false
|
||||
property bool actionVisible: false
|
||||
|
||||
PlasmaExtras.Highlight {
|
||||
id: dropHighlight
|
||||
anchors {
|
||||
fill: parent
|
||||
// topMargin: icon.height + 3 * Kirigami.Units.smallSpacing
|
||||
topMargin: root.topPadding
|
||||
}
|
||||
visible: root.isHovered
|
||||
z: -1
|
||||
}
|
||||
|
||||
Text {
|
||||
id: dropAreaLeftText
|
||||
anchors {
|
||||
fill: dropHighlight
|
||||
leftMargin: Kirigami.Units.gridUnit
|
||||
rightMargin: Kirigami.Units.gridUnit
|
||||
}
|
||||
|
||||
color: Kirigami.Theme.textColor
|
||||
visible: root.actionVisible
|
||||
|
||||
text: root.actionTitle
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
maximumLineCount: 3
|
||||
}
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.horizontalCenter
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
preventStealing: true
|
||||
enabled: true
|
||||
|
||||
onDrop: {
|
||||
root.taskDropped(event.mimeData, event.modifiers);
|
||||
}
|
||||
|
||||
onDragEnter: {
|
||||
root.isHovered = true;
|
||||
}
|
||||
|
||||
onDragLeave: {
|
||||
root.isHovered = false;
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill : parent
|
||||
onClicked : root.clicked()
|
||||
hoverEnabled : true
|
||||
onEntered : root.entered()
|
||||
|
||||
Accessible.name : root.activityName
|
||||
Accessible.role : Accessible.Button
|
||||
Accessible.selected : root.selected
|
||||
Accessible.onPressAction : root.clicked()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/* vim:set foldmethod=marker:
|
||||
|
||||
SPDX-FileCopyrightText: 2014 Ivan Cukic <ivan.cukic(at)kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
Image {
|
||||
id: main
|
||||
|
||||
width: 480
|
||||
height: 425
|
||||
|
||||
source: "images/window2.png"
|
||||
anchors.centerIn: parent
|
||||
|
||||
Item {
|
||||
id: title
|
||||
|
||||
|
||||
width: titleText.width + 32
|
||||
height: titleText.height + 32
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "black"
|
||||
radius: Kirigami.Units.cornerRadius
|
||||
opacity: .7
|
||||
}
|
||||
|
||||
Text {
|
||||
id: titleText
|
||||
color: "white"
|
||||
text: "Firefox"
|
||||
font.pointSize: 24
|
||||
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Drag.active: mouseArea.drag.active
|
||||
Drag.hotSpot.x: 32
|
||||
Drag.hotSpot.y: 32
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
|
||||
drag {
|
||||
target: title
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/* vim:set foldmethod=marker:
|
||||
|
||||
SPDX-FileCopyrightText: 2015 Ivan Cukic <ivan.cukic(at)kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
.pragma library
|
||||
|
||||
var currentlyHoveredActivityItem = null
|
||||
function showActivityItemActionsBar(
|
||||
activityItem
|
||||
)
|
||||
{
|
||||
if (activityItem == currentlyHoveredActivityItem) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentlyHoveredActivityItem != null) {
|
||||
currentlyHoveredActivityItem.state = "plain"
|
||||
}
|
||||
|
||||
currentlyHoveredActivityItem = activityItem;
|
||||
currentlyHoveredActivityItem.state = "showingControls";
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue