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,261 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15 as QQC2
|
||||
import org.kde.plasma.core as PlasmaCore
|
||||
import org.kde.plasma.components 3.0 as PC3
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
import org.kde.plasma.plasmoid 2.0
|
||||
|
||||
PlasmoidItem {
|
||||
id: root
|
||||
|
||||
enum LayoutType {
|
||||
HorizontalPanel,
|
||||
VerticalPanel,
|
||||
Desktop,
|
||||
DesktopCompact
|
||||
}
|
||||
|
||||
property var errorInformation
|
||||
|
||||
readonly property real minimumPreferredWidth: Kirigami.Units.gridUnit * 12
|
||||
readonly property real minimumPreferredHeight: Kirigami.Units.gridUnit * 12
|
||||
|
||||
// To properly show the error message in panel
|
||||
readonly property int layoutForm: {
|
||||
if (fullRepresentationItem.width >= root.minimumPreferredWidth) {
|
||||
if (fullRepresentationItem.height >= root.minimumPreferredHeight) {
|
||||
return AppletError.Desktop;
|
||||
} else if (fullRepresentationItem.height >= Kirigami.Units.iconSizes.huge + root.fullRepresentationItem.buttonLayout.implicitHeight) {
|
||||
return AppletError.DesktopCompact;
|
||||
}
|
||||
}
|
||||
|
||||
return Plasmoid.formFactor === PlasmaCore.Types.Vertical ? AppletError.VerticalPanel : AppletError.HorizontalPanel;
|
||||
}
|
||||
preloadFullRepresentation: true
|
||||
fullRepresentation: GridLayout {
|
||||
id: fullRep
|
||||
property alias buttonLayout: buttonLayout
|
||||
Layout.minimumWidth: {
|
||||
switch (root.layoutForm) {
|
||||
case AppletError.Desktop:
|
||||
case AppletError.DesktopCompact:
|
||||
// [Icon] [Text]
|
||||
// [Button]
|
||||
// [Information]
|
||||
return Math.max(root.minimumPreferredWidth, buttonLayout.implicitWidth);
|
||||
case AppletError.VerticalPanel:
|
||||
// [Icon]
|
||||
// [Copy]
|
||||
// [Open]
|
||||
return Math.max(headerIcon.implicitWidth, buttonLayout.implicitWidth);
|
||||
case AppletError.HorizontalPanel:
|
||||
// [Icon] [Copy] [Open]
|
||||
return headingLayout.implicitWidth + rowSpacing + buttonLayout.implicitWidth;
|
||||
}
|
||||
}
|
||||
Layout.minimumHeight: {
|
||||
switch (root.layoutForm) {
|
||||
case AppletError.Desktop:
|
||||
return headingLayout.implicitHeight + fullRep.columnSpacing + buttonLayout.implicitHeight + fullRep.columnSpacing + fullContentView.implicitHeight;
|
||||
case AppletError.DesktopCompact:
|
||||
return Math.max(headingLayout.implicitHeight, buttonLayout.implicitHeight);
|
||||
case AppletError.VerticalPanel:
|
||||
return headingLayout.implicitHeight + fullRep.columnSpacing + buttonLayout.implicitHeight;
|
||||
case AppletError.HorizontalPanel:
|
||||
return Math.max(headingLayout.implicitHeight, buttonLayout.implicitHeight);
|
||||
}
|
||||
}
|
||||
// Same as systray popups
|
||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 24
|
||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 24
|
||||
Layout.maximumWidth: Kirigami.Units.gridUnit * 34
|
||||
Layout.maximumHeight: Kirigami.Units.gridUnit * 34
|
||||
|
||||
rowSpacing: textArea.topPadding
|
||||
columnSpacing: rowSpacing
|
||||
flow: {
|
||||
switch (root.layoutForm) {
|
||||
case AppletError.HorizontalPanel:
|
||||
return GridLayout.LeftToRight;
|
||||
default:
|
||||
return GridLayout.TopToBottom;
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: headingLayout
|
||||
|
||||
Layout.margins: root.layoutForm !== AppletError.Desktop ? 0 : Kirigami.Units.gridUnit
|
||||
Layout.maximumWidth: fullRep.width
|
||||
spacing: 0
|
||||
Layout.fillWidth: true
|
||||
|
||||
Kirigami.Icon {
|
||||
id: headerIcon
|
||||
implicitWidth: Math.min(Kirigami.Units.iconSizes.huge, fullRep.width, fullRep.height)
|
||||
implicitHeight: implicitWidth
|
||||
|
||||
activeFocusOnTab: true
|
||||
source: "dialog-error"
|
||||
|
||||
Accessible.description: heading.text
|
||||
|
||||
PlasmaCore.ToolTipArea {
|
||||
anchors.fill: parent
|
||||
enabled: !heading.visible || heading.truncated
|
||||
mainText: heading.text
|
||||
textFormat: Text.PlainText
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.Heading {
|
||||
id: heading
|
||||
visible: root.layoutForm !== AppletError.VerticalPanel
|
||||
// Descent is equal to the amount of space above and below capital letters.
|
||||
// Add descent to the sides to make the spacing around Latin text look more even.
|
||||
leftPadding: headingFontMetrics.descent
|
||||
rightPadding: headingFontMetrics.descent
|
||||
text: root.errorInformation ? root.errorInformation.compactError : "No error information."
|
||||
textFormat: Text.PlainText
|
||||
level: 2
|
||||
wrapMode: Text.Wrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
Layout.maximumHeight: headerIcon.implicitHeight
|
||||
|
||||
FontMetrics {
|
||||
id: headingFontMetrics
|
||||
font: heading.font
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
id: buttonLayout
|
||||
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
|
||||
rowSpacing: fullRep.rowSpacing
|
||||
columnSpacing: parent.columnSpacing
|
||||
flow: {
|
||||
switch (root.layoutForm) {
|
||||
case AppletError.HorizontalPanel:
|
||||
case AppletError.VerticalPanel:
|
||||
return fullRep.flow;
|
||||
default:
|
||||
return GridLayout.LeftToRight;
|
||||
}
|
||||
}
|
||||
|
||||
PC3.Button {
|
||||
id: copyButton
|
||||
display: root.layoutForm === AppletError.HorizontalPanel || root.layoutForm === AppletError.VerticalPanel ? PC3.AbstractButton.IconOnly : PC3.AbstractButton.TextBesideIcon
|
||||
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Copy to Clipboard")
|
||||
icon.name: "edit-copy"
|
||||
onClicked: {
|
||||
textArea.selectAll()
|
||||
textArea.copy()
|
||||
textArea.deselect()
|
||||
}
|
||||
|
||||
PlasmaCore.ToolTipArea {
|
||||
anchors.fill: parent
|
||||
enabled: parent.display === PC3.AbstractButton.IconOnly
|
||||
mainText: parent.text
|
||||
textFormat: Text.PlainText
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: compactContentLoader
|
||||
active: root.layoutForm !== AppletError.Desktop
|
||||
visible: active
|
||||
sourceComponent: PC3.Button {
|
||||
display: copyButton.display
|
||||
icon.name: "window-new"
|
||||
text: i18nd("plasma_shell_org.kde.plasma.desktop", "View Error Details…")
|
||||
checked: dialog.visible
|
||||
onClicked: dialog.visible = !dialog.visible
|
||||
|
||||
PlasmaCore.ToolTipArea {
|
||||
anchors.fill: parent
|
||||
enabled: parent.display === PC3.AbstractButton.IconOnly
|
||||
mainText: parent.text
|
||||
textFormat: Text.PlainText
|
||||
}
|
||||
|
||||
QQC2.ApplicationWindow {
|
||||
id: dialog
|
||||
flags: Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint
|
||||
minimumWidth: dialogFontMetrics.height * 12
|
||||
+ dialogTextArea.leftPadding + dialogTextArea.rightPadding
|
||||
minimumHeight: dialogFontMetrics.height * 12
|
||||
+ dialogTextArea.topPadding + dialogTextArea.bottomPadding
|
||||
width: Kirigami.Units.gridUnit * 24
|
||||
height: Kirigami.Units.gridUnit * 24
|
||||
color: palette.base
|
||||
QQC2.ScrollView {
|
||||
id: dialogScrollView
|
||||
anchors.fill: parent
|
||||
QQC2.TextArea {
|
||||
id: dialogTextArea
|
||||
// HACK: silence binding loop warnings.
|
||||
// contentWidth seems to be causing the binding loop,
|
||||
// but contentWidth is read-only and we have no control
|
||||
// over how it is calculated.
|
||||
implicitWidth: 0
|
||||
wrapMode: TextEdit.Wrap
|
||||
text: textArea.text
|
||||
font.family: "monospace"
|
||||
readOnly: true
|
||||
selectByMouse: true
|
||||
background: null
|
||||
FontMetrics {
|
||||
id: dialogFontMetrics
|
||||
font: dialogTextArea.font
|
||||
}
|
||||
}
|
||||
background: null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PC3.ScrollView {
|
||||
id: fullContentView
|
||||
// Not handled by a Loader because we need
|
||||
// TextEdit::copy() to copy to clipboard.
|
||||
visible: !compactContentLoader.active
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
PC3.TextArea {
|
||||
id: textArea
|
||||
// HACK: silence binding loop warnings.
|
||||
// contentWidth seems to be causing the binding loop,
|
||||
// but contentWidth is read-only and we have no control
|
||||
// over how it is calculated.
|
||||
implicitWidth: 0
|
||||
wrapMode: TextEdit.Wrap
|
||||
text: root.errorInformation && root.errorInformation.errors ?
|
||||
root.errorInformation.errors.join("\n\n")
|
||||
// This is just to suppress warnings. Users should never see this.
|
||||
: "No error information."
|
||||
font.family: "monospace"
|
||||
readOnly: true
|
||||
selectByMouse: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,334 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
|
||||
import org.kde.plasma.core as PlasmaCore
|
||||
import org.kde.ksvg 1.0 as KSvg
|
||||
import org.kde.plasma.plasmoid 2.0
|
||||
import org.kde.kquickcontrolsaddons 2.0
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
|
||||
PlasmaCore.ToolTipArea {
|
||||
id: root
|
||||
objectName: "org.kde.desktop-CompactApplet"
|
||||
anchors.fill: parent
|
||||
|
||||
mainText: plasmoidItem ? plasmoidItem.toolTipMainText : ""
|
||||
subText: plasmoidItem ? plasmoidItem.toolTipSubText : ""
|
||||
location: Plasmoid.location
|
||||
active: plasmoidItem ? !plasmoidItem.expanded : false
|
||||
textFormat: plasmoidItem ? plasmoidItem.toolTipTextFormat : 0
|
||||
mainItem: plasmoidItem && plasmoidItem.toolTipItem ? plasmoidItem.toolTipItem : null
|
||||
|
||||
readonly property bool vertical: location === PlasmaCore.Types.RightEdge || location === PlasmaCore.Types.LeftEdge
|
||||
|
||||
property Item fullRepresentation
|
||||
property Item compactRepresentation
|
||||
property Item expandedFeedback: expandedItem
|
||||
property PlasmoidItem plasmoidItem
|
||||
|
||||
onCompactRepresentationChanged: {
|
||||
if (compactRepresentation) {
|
||||
compactRepresentation.anchors.fill = null;
|
||||
compactRepresentation.parent = compactRepresentationParent;
|
||||
compactRepresentation.anchors.fill = compactRepresentationParent;
|
||||
compactRepresentation.visible = true;
|
||||
}
|
||||
root.visible = true;
|
||||
}
|
||||
|
||||
onFullRepresentationChanged: {
|
||||
if (fullRepresentation) {
|
||||
fullRepresentation.anchors.fill = null;
|
||||
fullRepresentation.parent = appletParent;
|
||||
fullRepresentation.anchors.fill = appletParent;
|
||||
}
|
||||
}
|
||||
|
||||
FocusScope {
|
||||
id: compactRepresentationParent
|
||||
anchors.fill: parent
|
||||
activeFocusOnTab: true
|
||||
onActiveFocusChanged: {
|
||||
// When the scope gets the active focus, try to focus its first descendant,
|
||||
// if there is on which has activeFocusOnTab
|
||||
if (!activeFocus) {
|
||||
return;
|
||||
}
|
||||
let nextItem = nextItemInFocusChain();
|
||||
let candidate = nextItem;
|
||||
while (candidate.parent) {
|
||||
if (candidate === compactRepresentationParent) {
|
||||
nextItem.forceActiveFocus();
|
||||
return;
|
||||
}
|
||||
candidate = candidate.parent;
|
||||
}
|
||||
}
|
||||
|
||||
objectName: "expandApplet"
|
||||
Accessible.name: root.mainText
|
||||
Accessible.description: i18nd("plasma_shell_org.kde.plasma.desktop", "Open %1", root.subText)
|
||||
Accessible.role: Accessible.Button
|
||||
Accessible.onPressAction: Plasmoid.activated()
|
||||
|
||||
Keys.onPressed: {
|
||||
switch (event.key) {
|
||||
case Qt.Key_Space:
|
||||
case Qt.Key_Enter:
|
||||
case Qt.Key_Return:
|
||||
case Qt.Key_Select:
|
||||
Plasmoid.activated();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KSvg.FrameSvgItem {
|
||||
id: expandedItem
|
||||
z: -100
|
||||
|
||||
property var containerMargins: {
|
||||
let item = root;
|
||||
while (item.parent) {
|
||||
item = item.parent;
|
||||
if (item.isAppletContainer) {
|
||||
return item.getMargins;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
property bool returnAllMargins: true
|
||||
// The above makes sure margin is returned even for side margins, that
|
||||
// would be otherwise turned off.
|
||||
bottomMargin: !vertical && containerMargins ? -containerMargins('bottom', returnAllMargins) : 0;
|
||||
topMargin: !vertical && containerMargins ? -containerMargins('top', returnAllMargins) : 0;
|
||||
leftMargin: vertical && containerMargins ? -containerMargins('left', returnAllMargins) : 0;
|
||||
rightMargin: vertical && containerMargins ? -containerMargins('right', returnAllMargins) : 0;
|
||||
}
|
||||
imagePath: "widgets/tabbar"
|
||||
visible: false//opacity > 0
|
||||
prefix: {
|
||||
let prefix;
|
||||
switch (Plasmoid.location) {
|
||||
case PlasmaCore.Types.LeftEdge:
|
||||
prefix = "west-active-tab";
|
||||
break;
|
||||
case PlasmaCore.Types.TopEdge:
|
||||
prefix = "north-active-tab";
|
||||
break;
|
||||
case PlasmaCore.Types.RightEdge:
|
||||
prefix = "east-active-tab";
|
||||
break;
|
||||
default:
|
||||
prefix = "south-active-tab";
|
||||
}
|
||||
if (!hasElementPrefix(prefix)) {
|
||||
prefix = "active-tab";
|
||||
}
|
||||
return prefix;
|
||||
}
|
||||
opacity: plasmoidItem && plasmoidItem.expanded ? 1 : 0
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Kirigami.Units.shortDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: expandedSync
|
||||
interval: 100
|
||||
onTriggered: plasmoidItem.expanded = dialog.visible;
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Plasmoid.internalAction("configure")
|
||||
function onTriggered() {
|
||||
if (root.plasmoidItem.hideOnWindowDeactivate) {
|
||||
plasmoidItem.expanded = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root.Plasmoid
|
||||
function onContextualActionsAboutToShow() { root.hideImmediately() }
|
||||
}
|
||||
|
||||
PlasmaCore.AppletPopup {
|
||||
id: dialog
|
||||
objectName: "popupWindow"
|
||||
|
||||
popupDirection: switch (Plasmoid.location) {
|
||||
case PlasmaCore.Types.TopEdge:
|
||||
return Qt.BottomEdge
|
||||
case PlasmaCore.Types.LeftEdge:
|
||||
return Qt.RightEdge
|
||||
case PlasmaCore.Types.RightEdge:
|
||||
return Qt.LeftEdge
|
||||
default:
|
||||
return Qt.TopEdge
|
||||
}
|
||||
margin: (Plasmoid.containmentDisplayHints & PlasmaCore.Types.ContainmentPrefersFloatingApplets) ? Kirigami.Units.largeSpacing : 0
|
||||
floating: Plasmoid.location == PlasmaCore.Types.Floating
|
||||
removeBorderStrategy: Plasmoid.location === PlasmaCore.Types.Floating
|
||||
? PlasmaCore.AppletPopup.AtScreenEdges
|
||||
: PlasmaCore.AppletPopup.AtScreenEdges | PlasmaCore.AppletPopup.AtPanelEdges
|
||||
|
||||
hideOnWindowDeactivate: root.plasmoidItem && root.plasmoidItem.hideOnWindowDeactivate
|
||||
visible: root.plasmoidItem && root.plasmoidItem.expanded && fullRepresentation
|
||||
visualParent: root.compactRepresentation
|
||||
backgroundHints: (Plasmoid.containmentDisplayHints & PlasmaCore.Types.ContainmentPrefersOpaqueBackground) ? PlasmaCore.AppletPopup.SolidBackground : PlasmaCore.AppletPopup.StandardBackground
|
||||
appletInterface: root.plasmoidItem
|
||||
|
||||
property var oldStatus: PlasmaCore.Types.UnknownStatus
|
||||
|
||||
onVisibleChanged: {
|
||||
if (!visible) {
|
||||
expandedSync.restart();
|
||||
Plasmoid.status = oldStatus;
|
||||
} else {
|
||||
oldStatus = Plasmoid.status;
|
||||
Plasmoid.status = PlasmaCore.Types.RequiresAttentionStatus;
|
||||
// This call currently fails and complains at runtime:
|
||||
// QWindow::setWindowState: QWindow::setWindowState does not accept Qt::WindowActive
|
||||
dialog.requestActivate();
|
||||
}
|
||||
}
|
||||
//It's a MouseEventListener to get all the events, so the eventfilter will be able to catch them
|
||||
mainItem: MouseEventListener {
|
||||
id: appletParent
|
||||
|
||||
focus: true
|
||||
|
||||
Keys.onEscapePressed: {
|
||||
root.plasmoidItem.expanded = false;
|
||||
}
|
||||
|
||||
Layout.minimumWidth: fullRepresentation ? fullRepresentation.Layout.minimumWidth : 0
|
||||
Layout.minimumHeight: fullRepresentation ? fullRepresentation.Layout.minimumHeight : 0
|
||||
|
||||
Layout.maximumWidth: fullRepresentation ? fullRepresentation.Layout.maximumWidth : Infinity
|
||||
Layout.maximumHeight: fullRepresentation ? fullRepresentation.Layout.maximumHeight : Infinity
|
||||
|
||||
implicitWidth: {
|
||||
if (root.fullRepresentation !== null) {
|
||||
/****/ if (root.fullRepresentation.Layout.preferredWidth > 0) {
|
||||
return root.fullRepresentation.Layout.preferredWidth;
|
||||
} else if (root.fullRepresentation.implicitWidth > 0) {
|
||||
return root.fullRepresentation.implicitWidth;
|
||||
}
|
||||
}
|
||||
return Kirigami.Units.iconSizes.sizeForLabels * 35;
|
||||
}
|
||||
implicitHeight: {
|
||||
if (root.fullRepresentation !== null) {
|
||||
/****/ if (fullRepresentation.Layout.preferredHeight > 0) {
|
||||
return fullRepresentation.Layout.preferredHeight;
|
||||
} else if (fullRepresentation.implicitHeight > 0) {
|
||||
return fullRepresentation.implicitHeight;
|
||||
}
|
||||
}
|
||||
return Kirigami.Units.iconSizes.sizeForLabels * 25;
|
||||
}
|
||||
|
||||
onActiveFocusChanged: {
|
||||
if (activeFocus && fullRepresentation) {
|
||||
fullRepresentation.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
|
||||
// Draws a line between the applet dialog and the panel
|
||||
KSvg.SvgItem {
|
||||
id: separator
|
||||
// Only draw for popups of panel applets, not desktop applets
|
||||
visible: [PlasmaCore.Types.TopEdge, PlasmaCore.Types.LeftEdge, PlasmaCore.Types.RightEdge, PlasmaCore.Types.BottomEdge]
|
||||
.includes(Plasmoid.location) && !dialog.margin
|
||||
anchors {
|
||||
topMargin: -dialog.topPadding
|
||||
leftMargin: -dialog.leftPadding
|
||||
rightMargin: -dialog.rightPadding
|
||||
bottomMargin: -dialog.bottomPadding
|
||||
}
|
||||
z: 999 /* Draw the line on top of the applet */
|
||||
elementId: (Plasmoid.location === PlasmaCore.Types.TopEdge || Plasmoid.location === PlasmaCore.Types.BottomEdge) ? "horizontal-line" : "vertical-line"
|
||||
imagePath: "widgets/line"
|
||||
states: [
|
||||
State {
|
||||
when: Plasmoid.location === PlasmaCore.Types.TopEdge
|
||||
AnchorChanges {
|
||||
target: separator
|
||||
anchors {
|
||||
top: separator.parent.top
|
||||
left: separator.parent.left
|
||||
right: separator.parent.right
|
||||
}
|
||||
}
|
||||
PropertyChanges {
|
||||
target: separator
|
||||
height: 1
|
||||
}
|
||||
},
|
||||
State {
|
||||
when: Plasmoid.location === PlasmaCore.Types.LeftEdge
|
||||
AnchorChanges {
|
||||
target: separator
|
||||
anchors {
|
||||
left: separator.parent.left
|
||||
top: separator.parent.top
|
||||
bottom: separator.parent.bottom
|
||||
}
|
||||
}
|
||||
PropertyChanges {
|
||||
target: separator
|
||||
width: 1
|
||||
}
|
||||
},
|
||||
State {
|
||||
when: Plasmoid.location === PlasmaCore.Types.RightEdge
|
||||
AnchorChanges {
|
||||
target: separator
|
||||
anchors {
|
||||
top: separator.parent.top
|
||||
right: separator.parent.right
|
||||
bottom: separator.parent.bottom
|
||||
}
|
||||
}
|
||||
PropertyChanges {
|
||||
target: separator
|
||||
width: 1
|
||||
}
|
||||
},
|
||||
State {
|
||||
when: Plasmoid.location === PlasmaCore.Types.BottomEdge
|
||||
AnchorChanges {
|
||||
target: separator
|
||||
anchors {
|
||||
left: separator.parent.left
|
||||
right: separator.parent.right
|
||||
bottom: separator.parent.bottom
|
||||
}
|
||||
}
|
||||
PropertyChanges {
|
||||
target: separator
|
||||
height: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
|
||||
LayoutMirroring.childrenInherit: true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import org.kde.plasma.core as PlasmaCore
|
||||
import org.kde.plasma.plasmoid 2.0
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
|
||||
Kirigami.Icon {
|
||||
property PlasmoidItem plasmoidItem
|
||||
readonly property bool inPanel: [PlasmaCore.Types.TopEdge, PlasmaCore.Types.RightEdge, PlasmaCore.Types.BottomEdge, PlasmaCore.Types.LeftEdge]
|
||||
.includes(Plasmoid.location)
|
||||
|
||||
Layout.minimumWidth: {
|
||||
switch (Plasmoid.formFactor) {
|
||||
case PlasmaCore.Types.Vertical:
|
||||
return 0;
|
||||
case PlasmaCore.Types.Horizontal:
|
||||
return height;
|
||||
default:
|
||||
return Kirigami.Units.gridUnit * 3;
|
||||
}
|
||||
}
|
||||
|
||||
Layout.minimumHeight: {
|
||||
switch (Plasmoid.formFactor) {
|
||||
case PlasmaCore.Types.Vertical:
|
||||
return width;
|
||||
case PlasmaCore.Types.Horizontal:
|
||||
return 0;
|
||||
default:
|
||||
return Kirigami.Units.gridUnit * 3;
|
||||
}
|
||||
}
|
||||
|
||||
source: Plasmoid.icon || "plasma"
|
||||
active: mouseArea.containsMouse
|
||||
|
||||
activeFocusOnTab: true
|
||||
|
||||
Keys.onPressed: event => {
|
||||
switch (event.key) {
|
||||
case Qt.Key_Space:
|
||||
case Qt.Key_Enter:
|
||||
case Qt.Key_Return:
|
||||
case Qt.Key_Select:
|
||||
Plasmoid.activated();
|
||||
event.accepted = true; // BUG 481393: Prevent system tray from receiving the event
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Accessible.name: Plasmoid.title
|
||||
Accessible.description: plasmoidItem.toolTipSubText ?? ""
|
||||
Accessible.role: Accessible.Button
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
|
||||
property bool wasExpanded: false
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onPressed: wasExpanded = plasmoidItem.expanded
|
||||
onClicked: plasmoidItem.expanded = !wasExpanded
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue