Remove trailing whitespace

This commit is contained in:
Devin Lin 2024-07-26 23:47:44 -04:00
parent 5d84e6e47d
commit eb9509ce68
79 changed files with 647 additions and 647 deletions

6
.gitignore vendored
View file

@ -2,9 +2,9 @@
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
build build
*.config *.config
*.creator *.creator
*.files *.files
*.includes *.includes
*.user *.user

View file

@ -1,4 +1,4 @@
Copyright (c) <year> <owner>. Copyright (c) <year> <owner>.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

View file

@ -119,4 +119,4 @@ express Statement of Purpose.
d. Affirmer understands and acknowledges that Creative Commons is not a d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to party to this document and has no duty or obligation with respect to
this CC0 or use of the Work. this CC0 or use of the Work.

View file

@ -93,7 +93,7 @@ that permit, the user to recombine or relink the Application with a modified
version of the Linked Version to produce a modified Combined Work, in the version of the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying Corresponding Source. manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
1) Use a suitable shared library mechanism for linking with the Library. 1) Use a suitable shared library mechanism for linking with the Library.
A suitable mechanism is one that (a) uses at run time a copy of the Library A suitable mechanism is one that (a) uses at run time a copy of the Library
already present on the user's computer system, and (b) will operate properly already present on the user's computer system, and (b) will operate properly
with a modified version of the Library that is interface-compatible with the with a modified version of the Library that is interface-compatible with the

View file

@ -1,5 +1,5 @@
<!-- <!--
- SPDX-FileCopyrightText: None - SPDX-FileCopyrightText: None
- SPDX-License-Identifier: CC0-1.0 - SPDX-License-Identifier: CC0-1.0
--> -->

View file

@ -17,17 +17,17 @@ import org.kde.kirigami 2.20 as Kirigami
Item { Item {
id: root id: root
/** /**
* The model for the notification widget. * The model for the notification widget.
*/ */
property var notificationModel property var notificationModel
/** /**
* The model type for the notification widget. * The model type for the notification widget.
*/ */
property var notificationModelType: MobileShell.NotificationsModelType.NotificationsModel property var notificationModelType: MobileShell.NotificationsModelType.NotificationsModel
/** /**
* The notification settings object to be used in the notification widget. * The notification settings object to be used in the notification widget.
*/ */
@ -35,21 +35,21 @@ Item {
/** /**
* Whether actions should be subject to restricted permissions (ex. lockscreen). * Whether actions should be subject to restricted permissions (ex. lockscreen).
* *
* The permissionsRequested() signal emits when authentication is requested. * The permissionsRequested() signal emits when authentication is requested.
*/ */
property bool restrictedPermissions: false property bool restrictedPermissions: false
/** /**
* The amount of pixels moved by touch/mouse in the process of opening/closing the panel. * The amount of pixels moved by touch/mouse in the process of opening/closing the panel.
*/ */
property real offset: 0 property real offset: 0
/** /**
* Whether the panel is being dragged. * Whether the panel is being dragged.
*/ */
property bool dragging: false property bool dragging: false
/** /**
* Whether the panel is open after touch/mouse release from the first opening swipe. * Whether the panel is open after touch/mouse release from the first opening swipe.
*/ */
@ -60,52 +60,52 @@ Item {
* Only applies to portrait mode. * Only applies to portrait mode.
*/ */
property bool openToPinnedMode: true property bool openToPinnedMode: true
/** /**
* Direction the panel is currently moving in. * Direction the panel is currently moving in.
*/ */
property int direction: MobileShell.Direction.None property int direction: MobileShell.Direction.None
/** /**
* The notifications widget being shown. May be null. * The notifications widget being shown. May be null.
*/ */
property var notificationsWidget: contentContainerLoader.item.notificationsWidget property var notificationsWidget: contentContainerLoader.item.notificationsWidget
/** /**
* The mode of the action drawer (portrait or landscape). * The mode of the action drawer (portrait or landscape).
*/ */
property int mode: (height > width && width <= largePortraitThreshold) ? ActionDrawer.Portrait : ActionDrawer.Landscape property int mode: (height > width && width <= largePortraitThreshold) ? ActionDrawer.Portrait : ActionDrawer.Landscape
/** /**
* At some point, even if the screen is technically portrait, if we have a ton of width it'd be best to just show the landscape mode. * At some point, even if the screen is technically portrait, if we have a ton of width it'd be best to just show the landscape mode.
*/ */
readonly property real largePortraitThreshold: Kirigami.Units.gridUnit * 35 readonly property real largePortraitThreshold: Kirigami.Units.gridUnit * 35
enum Mode { enum Mode {
Portrait = 0, Portrait = 0,
Landscape Landscape
} }
/** /**
* Emitted when the drawer has closed. * Emitted when the drawer has closed.
*/ */
signal drawerClosed() signal drawerClosed()
/** /**
* Emitted when the drawer has opened. * Emitted when the drawer has opened.
*/ */
signal drawerOpened() signal drawerOpened()
/** /**
* Emitted when permissions are requested (ex. unlocking the phone). * Emitted when permissions are requested (ex. unlocking the phone).
* *
* Only gets emitted when restrictedPermissions is set to true. * Only gets emitted when restrictedPermissions is set to true.
*/ */
signal permissionsRequested() signal permissionsRequested()
/** /**
* Runs the held notification action that was pending for authentication. * Runs the held notification action that was pending for authentication.
* *
* Should be called by users if authentication is successful after permissionsRequested() was emitted. * Should be called by users if authentication is successful after permissionsRequested() was emitted.
*/ */
signal runPendingNotificationAction() signal runPendingNotificationAction()
@ -119,13 +119,13 @@ Item {
if (offset < 0) { if (offset < 0) {
offset = 0; offset = 0;
} }
root.direction = (oldOffset === offset) root.direction = (oldOffset === offset)
? MobileShell.Direction.None ? MobileShell.Direction.None
: (offset > oldOffset ? MobileShell.Direction.Down : MobileShell.Direction.Up); : (offset > oldOffset ? MobileShell.Direction.Down : MobileShell.Direction.Up);
oldOffset = offset; oldOffset = offset;
// close panel immediately after panel is not shown, and the flickable is not being dragged // close panel immediately after panel is not shown, and the flickable is not being dragged
if (opened && root.offset <= 0 && !swipeArea.moving && !closeAnim.running && !openAnim.running) { if (opened && root.offset <= 0 && !swipeArea.moving && !closeAnim.running && !openAnim.running) {
root.updateState(); root.updateState();
@ -137,7 +137,7 @@ Item {
closeAnim.stop(); closeAnim.stop();
openAnim.stop(); openAnim.stop();
} }
function open() { function open() {
cancelAnimations(); cancelAnimations();
if (openToPinnedMode) { if (openToPinnedMode) {
@ -146,36 +146,36 @@ Item {
expandAnim.restart(); // go to maximized height expandAnim.restart(); // go to maximized height
} }
} }
function closeImmediately() { function closeImmediately() {
cancelAnimations(); cancelAnimations();
offset = 0; offset = 0;
closeAnim.finished(); closeAnim.finished();
} }
function close() { function close() {
cancelAnimations(); cancelAnimations();
closeAnim.restart(); closeAnim.restart();
} }
function expand() { function expand() {
cancelAnimations(); cancelAnimations();
expandAnim.restart(); expandAnim.restart();
} }
function updateState() { function updateState() {
cancelAnimations(); cancelAnimations();
let openThreshold = Kirigami.Units.gridUnit; let openThreshold = Kirigami.Units.gridUnit;
if (root.offset <= 0) { if (root.offset <= 0) {
// close immediately, so that we don't have to wait Kirigami.Units.longDuration // close immediately, so that we don't have to wait Kirigami.Units.longDuration
root.visible = false; root.visible = false;
close(); close();
} else if (root.direction === MobileShell.Direction.None || !root.opened) { } else if (root.direction === MobileShell.Direction.None || !root.opened) {
// if the panel has not been opened yet, run open animation only if drag passed threshold // if the panel has not been opened yet, run open animation only if drag passed threshold
(root.offset < openThreshold) ? close() : open(); (root.offset < openThreshold) ? close() : open();
} else if (root.offset > contentContainerLoader.maximizedQuickSettingsOffset) { } else if (root.offset > contentContainerLoader.maximizedQuickSettingsOffset) {
// if drag has gone past the fully expanded view // if drag has gone past the fully expanded view
expand(); expand();
@ -187,7 +187,7 @@ Item {
// go back to pinned, or close if pinned mode is disabled // go back to pinned, or close if pinned mode is disabled
openToPinnedMode ? open() : close(); openToPinnedMode ? open() : close();
} }
} else if (root.direction === MobileShell.Direction.Down) { } else if (root.direction === MobileShell.Direction.Down) {
// if drag is between pinned view and open view, and dragging down // if drag is between pinned view and open view, and dragging down
open(); open();
@ -226,7 +226,7 @@ Item {
to: contentContainerLoader.maximizedQuickSettingsOffset to: contentContainerLoader.maximizedQuickSettingsOffset
onFinished: root.opened = true; onFinished: root.opened = true;
} }
MobileShell.SwipeArea { MobileShell.SwipeArea {
id: swipeArea id: swipeArea
mode: MobileShell.SwipeArea.VerticalOnly mode: MobileShell.SwipeArea.VerticalOnly
@ -247,14 +247,14 @@ Item {
Loader { Loader {
id: contentContainerLoader id: contentContainerLoader
anchors.fill: parent anchors.fill: parent
property real minimizedQuickSettingsOffset: item ? item.minimizedQuickSettingsOffset : 0 property real minimizedQuickSettingsOffset: item ? item.minimizedQuickSettingsOffset : 0
property real maximizedQuickSettingsOffset: item ? item.maximizedQuickSettingsOffset : 0 property real maximizedQuickSettingsOffset: item ? item.maximizedQuickSettingsOffset : 0
asynchronous: true asynchronous: true
sourceComponent: root.mode == ActionDrawer.Portrait ? portraitContentContainer : landscapeContentContainer sourceComponent: root.mode == ActionDrawer.Portrait ? portraitContentContainer : landscapeContentContainer
} }
Component { Component {
id: portraitContentContainer id: portraitContentContainer
PortraitContentContainer { PortraitContentContainer {
@ -263,7 +263,7 @@ Item {
height: root.height height: root.height
} }
} }
Component { Component {
id: landscapeContentContainer id: landscapeContentContainer
LandscapeContentContainer { LandscapeContentContainer {

View file

@ -14,30 +14,30 @@ import org.kde.plasma.private.nanoshell 2.0 as NanoShell
/** /**
* Window with the ActionDrawer component embedded in it. * Window with the ActionDrawer component embedded in it.
* *
* Used for overlaying the ActionDrawer if the original window does not cover * Used for overlaying the ActionDrawer if the original window does not cover
* the whole screen. * the whole screen.
*/ */
NanoShell.FullScreenOverlay { NanoShell.FullScreenOverlay {
id: window id: window
/** /**
* The ActionDrawer component. * The ActionDrawer component.
*/ */
property alias actionDrawer: drawer property alias actionDrawer: drawer
visible: drawer.visible visible: drawer.visible
width: Screen.width width: Screen.width
height: Screen.height height: Screen.height
color: "transparent" color: "transparent"
onActiveChanged: { onActiveChanged: {
if (!active) { if (!active) {
drawer.close(); drawer.close();
} }
} }
ActionDrawer { ActionDrawer {
id: drawer id: drawer
anchors.fill: parent anchors.fill: parent

View file

@ -21,53 +21,53 @@ import org.kde.plasma.private.mobileshell as MobileShell
*/ */
Item { Item {
id: root id: root
required property var actionDrawer required property var actionDrawer
property alias notificationsWidget: notificationWidget property alias notificationsWidget: notificationWidget
readonly property real minimizedQuickSettingsOffset: height readonly property real minimizedQuickSettingsOffset: height
readonly property real maximizedQuickSettingsOffset: height readonly property real maximizedQuickSettingsOffset: height
readonly property bool isOnLargeScreen: width > quickSettings.width * 2.5 readonly property bool isOnLargeScreen: width > quickSettings.width * 2.5
readonly property real minWidthHeight: Math.min(root.width, root.height) readonly property real minWidthHeight: Math.min(root.width, root.height)
readonly property real opacityValue: Math.max(0, Math.min(1, actionDrawer.offset / root.minimizedQuickSettingsOffset)) readonly property real opacityValue: Math.max(0, Math.min(1, actionDrawer.offset / root.minimizedQuickSettingsOffset))
Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.colorSet: Kirigami.Theme.View
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
// fullscreen background // fullscreen background
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
// darken if there are notifications // darken if there are notifications
color: Qt.rgba(Kirigami.Theme.backgroundColor.r, color: Qt.rgba(Kirigami.Theme.backgroundColor.r,
Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.g,
Kirigami.Theme.backgroundColor.b, Kirigami.Theme.backgroundColor.b,
notificationWidget.hasNotifications ? 0.95 : 0.9) notificationWidget.hasNotifications ? 0.95 : 0.9)
Behavior on color { ColorAnimation { duration: Kirigami.Units.longDuration } } Behavior on color { ColorAnimation { duration: Kirigami.Units.longDuration } }
opacity: opacityValue opacity: opacityValue
} }
P5Support.DataSource { P5Support.DataSource {
id: timeSource id: timeSource
engine: "time" engine: "time"
connectedSources: ["Local"] connectedSources: ["Local"]
interval: 60 * 1000 interval: 60 * 1000
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
// dismiss drawer when background is clicked // dismiss drawer when background is clicked
onClicked: root.actionDrawer.close(); onClicked: root.actionDrawer.close();
// left side // left side
ColumnLayout { ColumnLayout {
id: columnLayout id: columnLayout
opacity: opacityValue opacity: opacityValue
spacing: 0 spacing: 0
anchors { anchors {
top: mediaWidget.bottom top: mediaWidget.bottom
topMargin: 0 topMargin: 0
@ -77,7 +77,7 @@ Item {
left: parent.left left: parent.left
} }
anchors.margins: minWidthHeight * 0.06 anchors.margins: minWidthHeight * 0.06
MobileShell.NotificationsWidget { MobileShell.NotificationsWidget {
id: notificationWidget id: notificationWidget
historyModel: root.actionDrawer.notificationModel historyModel: root.actionDrawer.notificationModel
@ -85,17 +85,17 @@ Item {
notificationSettings: root.actionDrawer.notificationSettings notificationSettings: root.actionDrawer.notificationSettings
actionsRequireUnlock: root.actionDrawer.restrictedPermissions actionsRequireUnlock: root.actionDrawer.restrictedPermissions
onUnlockRequested: root.actionDrawer.permissionsRequested() onUnlockRequested: root.actionDrawer.permissionsRequested()
Connections { Connections {
target: root.actionDrawer target: root.actionDrawer
function onRunPendingNotificationAction() { function onRunPendingNotificationAction() {
notificationWidget.runPendingAction(); notificationWidget.runPendingAction();
} }
} }
onBackgroundClicked: root.actionDrawer.close(); onBackgroundClicked: root.actionDrawer.close();
// don't allow notifications widget to get too wide // don't allow notifications widget to get too wide
Layout.maximumWidth: Kirigami.Units.gridUnit * 25 Layout.maximumWidth: Kirigami.Units.gridUnit * 25
Layout.fillHeight: true Layout.fillHeight: true
@ -103,32 +103,32 @@ Item {
Layout.topMargin: minWidthHeight * 0.02 Layout.topMargin: minWidthHeight * 0.02
} }
} }
PlasmaComponents.Label { PlasmaComponents.Label {
id: clock id: clock
text: Qt.formatTime(timeSource.data.Local.DateTime, MobileShell.ShellUtil.isSystem24HourFormat ? "h:mm" : "h:mm ap") text: Qt.formatTime(timeSource.data.Local.DateTime, MobileShell.ShellUtil.isSystem24HourFormat ? "h:mm" : "h:mm ap")
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter
opacity: columnLayout.opacity opacity: columnLayout.opacity
anchors { anchors {
left: parent.left left: parent.left
top: parent.top top: parent.top
topMargin: columnLayout.anchors.margins / 2 topMargin: columnLayout.anchors.margins / 2
leftMargin: columnLayout.anchors.margins leftMargin: columnLayout.anchors.margins
} }
font.pixelSize: Math.min(40, minWidthHeight * 0.1) font.pixelSize: Math.min(40, minWidthHeight * 0.1)
font.weight: Font.ExtraLight font.weight: Font.ExtraLight
elide: Text.ElideRight elide: Text.ElideRight
} }
PlasmaComponents.Label { PlasmaComponents.Label {
id: date id: date
text: Qt.formatDate(timeSource.data.Local.DateTime, "ddd MMMM d") text: Qt.formatDate(timeSource.data.Local.DateTime, "ddd MMMM d")
verticalAlignment: Qt.AlignTop verticalAlignment: Qt.AlignTop
color: Kirigami.Theme.disabledTextColor color: Kirigami.Theme.disabledTextColor
opacity: columnLayout.opacity opacity: columnLayout.opacity
anchors { anchors {
left: parent.left left: parent.left
top: clock.bottom top: clock.bottom
@ -140,15 +140,15 @@ Item {
font.pixelSize: Math.min(20, minWidthHeight * 0.05) font.pixelSize: Math.min(20, minWidthHeight * 0.05)
font.weight: Font.Light font.weight: Font.Light
} }
MobileShell.MediaControlsWidget { MobileShell.MediaControlsWidget {
id: mediaWidget id: mediaWidget
property real fullHeight: visible ? height + Kirigami.Units.smallSpacing * 6 : 0 property real fullHeight: visible ? height + Kirigami.Units.smallSpacing * 6 : 0
y: isOnLargeScreen ? date.y - height + date.implicitHeight : date.y + date.implicitHeight + columnLayout.anchors.margins / 2 y: isOnLargeScreen ? date.y - height + date.implicitHeight : date.y + date.implicitHeight + columnLayout.anchors.margins / 2
opacity: columnLayout.opacity opacity: columnLayout.opacity
anchors { anchors {
right: quickSettings.left right: quickSettings.left
left: isOnLargeScreen ? date.right : parent.left left: isOnLargeScreen ? date.right : parent.left
@ -156,21 +156,21 @@ Item {
rightMargin: columnLayout.anchors.margins - quickSettings.leftPadding rightMargin: columnLayout.anchors.margins - quickSettings.leftPadding
} }
} }
// right sidebar // right sidebar
MobileShell.QuickSettingsPanel { MobileShell.QuickSettingsPanel {
id: quickSettings id: quickSettings
height: quickSettings.contentImplicitHeight + quickSettings.topPadding + quickSettings.bottomPadding height: quickSettings.contentImplicitHeight + quickSettings.topPadding + quickSettings.bottomPadding
width: intendedWidth width: intendedWidth
readonly property real intendedWidth: 360 readonly property real intendedWidth: 360
anchors.top: parent.top anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right
actionDrawer: root.actionDrawer actionDrawer: root.actionDrawer
fullScreenHeight: root.height fullScreenHeight: root.height
transform: Translate { transform: Translate {
id: translate id: translate
property real offsetRatio: quickSettings.height / root.height property real offsetRatio: quickSettings.height / root.height

View file

@ -18,56 +18,56 @@ import org.kde.kirigami 2.20 as Kirigami
*/ */
Item { Item {
id: root id: root
required property var actionDrawer required property var actionDrawer
property alias notificationsWidget: notificationWidget property alias notificationsWidget: notificationWidget
// pinned position (disabled when openToPinnedMode is false) // pinned position (disabled when openToPinnedMode is false)
readonly property real minimizedQuickSettingsOffset: quickSettings.minimizedHeight readonly property real minimizedQuickSettingsOffset: quickSettings.minimizedHeight
// fully open position // fully open position
readonly property real maximizedQuickSettingsOffset: minimizedQuickSettingsOffset + quickSettings.maxAddedHeight readonly property real maximizedQuickSettingsOffset: minimizedQuickSettingsOffset + quickSettings.maxAddedHeight
Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.colorSet: Kirigami.Theme.View
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
function applyMinMax(val) { function applyMinMax(val) {
return Math.max(0, Math.min(1, val)); return Math.max(0, Math.min(1, val));
} }
// fullscreen background // fullscreen background
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
// darken if there are notifications // darken if there are notifications
color: Qt.rgba(Kirigami.Theme.backgroundColor.r, color: Qt.rgba(Kirigami.Theme.backgroundColor.r,
Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.g,
Kirigami.Theme.backgroundColor.b, Kirigami.Theme.backgroundColor.b,
0.95) 0.95)
Behavior on color { ColorAnimation { duration: Kirigami.Units.longDuration } } Behavior on color { ColorAnimation { duration: Kirigami.Units.longDuration } }
opacity: Math.max(0, Math.min(1, actionDrawer.offset / root.minimizedQuickSettingsOffset)) opacity: Math.max(0, Math.min(1, actionDrawer.offset / root.minimizedQuickSettingsOffset))
} }
MobileShell.QuickSettingsDrawer { MobileShell.QuickSettingsDrawer {
id: quickSettings id: quickSettings
z: 1 // ensure it's above notifications z: 1 // ensure it's above notifications
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
actionDrawer: root.actionDrawer actionDrawer: root.actionDrawer
// opacity and move animation (disabled when openToPinnedMode is false) // opacity and move animation (disabled when openToPinnedMode is false)
property real offsetDist: actionDrawer.offset - minimizedQuickSettingsOffset property real offsetDist: actionDrawer.offset - minimizedQuickSettingsOffset
property real totalOffsetDist: maximizedQuickSettingsOffset - minimizedQuickSettingsOffset property real totalOffsetDist: maximizedQuickSettingsOffset - minimizedQuickSettingsOffset
minimizedToFullProgress: actionDrawer.openToPinnedMode ? (actionDrawer.opened ? applyMinMax(offsetDist / totalOffsetDist) : 0) : 1 minimizedToFullProgress: actionDrawer.openToPinnedMode ? (actionDrawer.opened ? applyMinMax(offsetDist / totalOffsetDist) : 0) : 1
// this drawer opens in two stages when pinned mode is enabled: // this drawer opens in two stages when pinned mode is enabled:
// --- // ---
// stage 1: the transform effect is used, the drawer physically moves down to the pinned mode // stage 1: the transform effect is used, the drawer physically moves down to the pinned mode
// stage 2: the rectangle increases height to reveal content, but the content stays still // stage 2: the rectangle increases height to reveal content, but the content stays still
// when pinned mode is disabled, only stage 1 happens // when pinned mode is disabled, only stage 1 happens
// increase height of drawer when between pinned mode <-> maximized mode // increase height of drawer when between pinned mode <-> maximized mode
addedHeight: { addedHeight: {
if (!actionDrawer.openToPinnedMode) { if (!actionDrawer.openToPinnedMode) {
@ -88,7 +88,7 @@ Item {
return (quickSettings.maxAddedHeight * effectProgress) + Math.max(0, Math.min(quickSettings.maxAddedHeight, root.actionDrawer.offset - minimizedQuickSettingsOffset)); return (quickSettings.maxAddedHeight * effectProgress) + Math.max(0, Math.min(quickSettings.maxAddedHeight, root.actionDrawer.offset - minimizedQuickSettingsOffset));
} }
} }
// physically move the drawer when between closed <-> pinned mode // physically move the drawer when between closed <-> pinned mode
transform: Translate { transform: Translate {
id: translate id: translate
@ -96,7 +96,7 @@ Item {
y: Math.min(root.actionDrawer.offset - offsetHeight, 0) y: Math.min(root.actionDrawer.offset - offsetHeight, 0)
} }
} }
MobileShell.NotificationsWidget { MobileShell.NotificationsWidget {
id: notificationWidget id: notificationWidget
historyModel: root.actionDrawer.notificationModel historyModel: root.actionDrawer.notificationModel
@ -104,17 +104,17 @@ Item {
notificationSettings: root.actionDrawer.notificationSettings notificationSettings: root.actionDrawer.notificationSettings
actionsRequireUnlock: root.actionDrawer.restrictedPermissions actionsRequireUnlock: root.actionDrawer.restrictedPermissions
onUnlockRequested: root.actionDrawer.permissionsRequested() onUnlockRequested: root.actionDrawer.permissionsRequested()
Connections { Connections {
target: root.actionDrawer target: root.actionDrawer
function onRunPendingNotificationAction() { function onRunPendingNotificationAction() {
notificationWidget.runPendingAction(); notificationWidget.runPendingAction();
} }
} }
onBackgroundClicked: root.actionDrawer.close(); onBackgroundClicked: root.actionDrawer.close();
anchors { anchors {
top: quickSettings.top top: quickSettings.top
topMargin: quickSettings.height + translate.y topMargin: quickSettings.height + translate.y
@ -123,7 +123,7 @@ Item {
right: parent.right right: parent.right
} }
opacity: applyMinMax(root.actionDrawer.offset / root.minimizedQuickSettingsOffset) opacity: applyMinMax(root.actionDrawer.offset / root.minimizedQuickSettingsOffset)
// HACK: there are weird issues with text rendering black regardless of opacity, just set the text to be invisible once it's out // HACK: there are weird issues with text rendering black regardless of opacity, just set the text to be invisible once it's out
visible: opacity > 0.05 visible: opacity > 0.05
} }

View file

@ -10,15 +10,15 @@ import org.kde.kirigami 2.20 as Kirigami
Rectangle { Rectangle {
id: handle id: handle
signal tapped() signal tapped()
implicitWidth: Kirigami.Units.gridUnit * 3 implicitWidth: Kirigami.Units.gridUnit * 3
implicitHeight: 3 implicitHeight: 3
radius: height radius: height
color: Kirigami.Theme.textColor color: Kirigami.Theme.textColor
opacity: 0.5 opacity: 0.5
TapHandler { TapHandler {
cursorShape: pressed ? Qt.ClosedHandCursor : Qt.PointingHandCursor cursorShape: pressed ? Qt.ClosedHandCursor : Qt.PointingHandCursor
onTapped: handle.tapped() onTapped: handle.tapped()

View file

@ -21,7 +21,7 @@ import org.kde.kirigami 2.20 as Kirigami
Item { Item {
id: root id: root
clip: true clip: true
required property var actionDrawer required property var actionDrawer
required property int mode required property int mode
@ -34,19 +34,19 @@ Item {
readonly property real columnWidth: Math.floor(width / columns) readonly property real columnWidth: Math.floor(width / columns)
readonly property int minimizedColumns: Math.round(Math.min(8, Math.max(5, width / intendedMinimizedColumnWidth))) readonly property int minimizedColumns: Math.round(Math.min(8, Math.max(5, width / intendedMinimizedColumnWidth)))
readonly property real minimizedColumnWidth: Math.floor(width / minimizedColumns) readonly property real minimizedColumnWidth: Math.floor(width / minimizedColumns)
readonly property real rowHeight: columnWidth * 0.7 readonly property real rowHeight: columnWidth * 0.7
readonly property real fullHeight: fullView.implicitHeight readonly property real fullHeight: fullView.implicitHeight
readonly property real intendedColumnWidth: Kirigami.Units.gridUnit * 7 readonly property real intendedColumnWidth: Kirigami.Units.gridUnit * 7
readonly property real intendedMinimizedColumnWidth: Kirigami.Units.gridUnit * 4 + Kirigami.Units.smallSpacing readonly property real intendedMinimizedColumnWidth: Kirigami.Units.gridUnit * 4 + Kirigami.Units.smallSpacing
readonly property real minimizedRowHeight: Kirigami.Units.gridUnit * 4 + Kirigami.Units.smallSpacing readonly property real minimizedRowHeight: Kirigami.Units.gridUnit * 4 + Kirigami.Units.smallSpacing
property real minimizedViewProgress: 0 property real minimizedViewProgress: 0
property real fullViewProgress: 1 property real fullViewProgress: 1
readonly property QS.QuickSettingsModel quickSettingsModel: QS.QuickSettingsModel {} readonly property QS.QuickSettingsModel quickSettingsModel: QS.QuickSettingsModel {}
readonly property int columnCount: Math.floor(width/columnWidth) readonly property int columnCount: Math.floor(width/columnWidth)
readonly property int rowCount: { readonly property int rowCount: {
let totalRows = Math.ceil(quickSettingsCount / columnCount); let totalRows = Math.ceil(quickSettingsCount / columnCount);
@ -56,17 +56,17 @@ Item {
let maxRows = 5; // more than 5 is just disorienting let maxRows = 5; // more than 5 is just disorienting
let targetRows = Math.floor(Window.height * 0.65 / rowHeight); let targetRows = Math.floor(Window.height * 0.65 / rowHeight);
return Math.min(maxRows, Math.min(totalRows, targetRows)); return Math.min(maxRows, Math.min(totalRows, targetRows));
} else if (root.mode === QuickSettings.ScrollView) { } else if (root.mode === QuickSettings.ScrollView) {
// horizontal orientation // horizontal orientation
let targetRows = Math.floor(Window.height * 0.8 / rowHeight); let targetRows = Math.floor(Window.height * 0.8 / rowHeight);
return Math.min(totalRows, targetRows); return Math.min(totalRows, targetRows);
} }
} }
readonly property int pageSize: rowCount * columnCount readonly property int pageSize: rowCount * columnCount
readonly property int quickSettingsCount: quickSettingsModel.count readonly property int quickSettingsCount: quickSettingsModel.count
function resetSwipeView() { function resetSwipeView() {
if (root.mode === QuickSettings.Pages) { if (root.mode === QuickSettings.Pages) {
pageLoader.item.view.currentIndex = 0; pageLoader.item.view.currentIndex = 0;
@ -83,29 +83,29 @@ Item {
} }
} }
} }
// view when fully open // view when fully open
ColumnLayout { ColumnLayout {
id: fullView id: fullView
opacity: root.fullViewProgress opacity: root.fullViewProgress
visible: opacity !== 0 visible: opacity !== 0
transform: Translate { y: (1 - fullView.opacity) * root.rowHeight } transform: Translate { y: (1 - fullView.opacity) * root.rowHeight }
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
// Dynamically loads the appropriate view // Dynamically loads the appropriate view
Loader { Loader {
id: pageLoader id: pageLoader
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumHeight: rowCount * rowHeight Layout.minimumHeight: rowCount * rowHeight
asynchronous: true asynchronous: true
sourceComponent: root.mode === QuickSettings.Pages ? swipeViewComponent : scrollViewComponent sourceComponent: root.mode === QuickSettings.Pages ? swipeViewComponent : scrollViewComponent
} }
BrightnessItem { BrightnessItem {
id: brightnessItem id: brightnessItem
Layout.bottomMargin: Kirigami.Units.smallSpacing * 2 Layout.bottomMargin: Kirigami.Units.smallSpacing * 2
@ -114,7 +114,7 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
} }
} }
// view when in minimized mode // view when in minimized mode
RowLayout { RowLayout {
id: minimizedView id: minimizedView
@ -122,11 +122,11 @@ Item {
opacity: root.minimizedViewProgress opacity: root.minimizedViewProgress
visible: opacity !== 0 visible: opacity !== 0
transform: Translate { y: (1 - minimizedView.opacity) * -root.rowHeight } transform: Translate { y: (1 - minimizedView.opacity) * -root.rowHeight }
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
Repeater { Repeater {
model: QS.PaginateModel { model: QS.PaginateModel {
sourceModel: quickSettingsModel sourceModel: quickSettingsModel
@ -134,22 +134,22 @@ Item {
} }
delegate: MobileShell.BaseItem { delegate: MobileShell.BaseItem {
required property var modelData required property var modelData
implicitHeight: root.minimizedRowHeight implicitHeight: root.minimizedRowHeight
implicitWidth: root.minimizedColumnWidth implicitWidth: root.minimizedColumnWidth
horizontalPadding: (width - Kirigami.Units.gridUnit * 3) / 2 horizontalPadding: (width - Kirigami.Units.gridUnit * 3) / 2
verticalPadding: (height - Kirigami.Units.gridUnit * 3) / 2 verticalPadding: (height - Kirigami.Units.gridUnit * 3) / 2
contentItem: QuickSettingsMinimizedDelegate { contentItem: QuickSettingsMinimizedDelegate {
restrictedPermissions: actionDrawer.restrictedPermissions restrictedPermissions: actionDrawer.restrictedPermissions
text: modelData.text text: modelData.text
status: modelData.status status: modelData.status
icon: modelData.icon icon: modelData.icon
enabled: modelData.enabled enabled: modelData.enabled
settingsCommand: modelData.settingsCommand settingsCommand: modelData.settingsCommand
toggleFunction: modelData.toggle toggleFunction: modelData.toggle
onCloseRequested: { onCloseRequested: {
actionDrawer.close(); actionDrawer.close();
} }
@ -157,28 +157,28 @@ Item {
} }
} }
} }
// Loads portrait quick settings view // Loads portrait quick settings view
Component { Component {
id: swipeViewComponent id: swipeViewComponent
ColumnLayout { ColumnLayout {
readonly property var view: swipeView readonly property var view: swipeView
SwipeView { SwipeView {
id: swipeView id: swipeView
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: rowCount * rowHeight Layout.preferredHeight: rowCount * rowHeight
Repeater { Repeater {
model: Math.ceil(quickSettingsCount / pageSize) model: Math.ceil(quickSettingsCount / pageSize)
delegate: Flow { delegate: Flow {
id: flow id: flow
spacing: 0 spacing: 0
required property int index required property int index
Repeater { Repeater {
model: QS.PaginateModel { model: QS.PaginateModel {
sourceModel: quickSettingsModel sourceModel: quickSettingsModel
@ -187,34 +187,34 @@ Item {
} }
delegate: Loader { delegate: Loader {
required property var modelData required property var modelData
asynchronous: true asynchronous: true
sourceComponent: quickSettingComponent sourceComponent: quickSettingComponent
} }
} }
} }
} }
} }
Loader { Loader {
id: indicatorLoader id: indicatorLoader
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
Layout.topMargin: Kirigami.Units.smallSpacing Layout.topMargin: Kirigami.Units.smallSpacing
Layout.leftMargin: Kirigami.Units.smallSpacing Layout.leftMargin: Kirigami.Units.smallSpacing
Layout.rightMargin: Kirigami.Units.smallSpacing Layout.rightMargin: Kirigami.Units.smallSpacing
// Avoid wasting space when not loaded // Avoid wasting space when not loaded
Layout.maximumHeight: active ? item.implicitHeight : 0 Layout.maximumHeight: active ? item.implicitHeight : 0
active: swipeView.count > 1 ? true: false active: swipeView.count > 1 ? true: false
asynchronous: true asynchronous: true
sourceComponent: PageIndicator { sourceComponent: PageIndicator {
count: swipeView.count count: swipeView.count
currentIndex: swipeView.currentIndex currentIndex: swipeView.currentIndex
delegate: Rectangle { delegate: Rectangle {
implicitWidth: 8 implicitWidth: 8
implicitHeight: count > 1 ? 8 : 0 implicitHeight: count > 1 ? 8 : 0
@ -228,28 +228,28 @@ Item {
} }
} }
} }
// Loads landscape quick settings view // Loads landscape quick settings view
Component { Component {
id: scrollViewComponent id: scrollViewComponent
Item { Item {
width: parent.width width: parent.width
height: rowCount * rowHeight height: rowCount * rowHeight
Flickable { Flickable {
id: flickable id: flickable
anchors.fill: parent anchors.fill: parent
contentWidth: width contentWidth: width
contentHeight: flow.height contentHeight: flow.height
clip: true clip: true
ScrollIndicator.vertical: ScrollIndicator { ScrollIndicator.vertical: ScrollIndicator {
id: scrollIndicator id: scrollIndicator
visible: quickSettingsCount > pageSize ? true : false visible: quickSettingsCount > pageSize ? true : false
position: 0.1 position: 0.1
contentItem: Item { contentItem: Item {
implicitWidth: Kirigami.Units.smallSpacing / 4 implicitWidth: Kirigami.Units.smallSpacing / 4
Rectangle { Rectangle {
@ -257,28 +257,28 @@ Item {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: 2 anchors.leftMargin: 2
anchors.rightMargin: -2 anchors.rightMargin: -2
color: Kirigami.Theme.textColor color: Kirigami.Theme.textColor
opacity: scrollIndicator.active ? 0.5 : 0 opacity: scrollIndicator.active ? 0.5 : 0
Behavior on opacity { NumberAnimation {} } Behavior on opacity { NumberAnimation {} }
} }
} }
} }
Flow { Flow {
id: flow id: flow
width: parent.width width: parent.width
height: Math.ceil(quickSettingsCount / columnCount) * rowHeight height: Math.ceil(quickSettingsCount / columnCount) * rowHeight
spacing: 0 spacing: 0
Repeater { Repeater {
model: quickSettingsModel model: quickSettingsModel
delegate: Loader { delegate: Loader {
required property var modelData required property var modelData
asynchronous: true asynchronous: true
sourceComponent: quickSettingComponent sourceComponent: quickSettingComponent
} }
} }
@ -286,11 +286,11 @@ Item {
} }
} }
} }
// Quick setting component // Quick setting component
Component { Component {
id: quickSettingComponent id: quickSettingComponent
MobileShell.BaseItem { MobileShell.BaseItem {
height: root.rowHeight height: root.rowHeight
width: root.columnWidth width: root.columnWidth
@ -298,14 +298,14 @@ Item {
contentItem: QuickSettingsFullDelegate { contentItem: QuickSettingsFullDelegate {
restrictedPermissions: actionDrawer.restrictedPermissions restrictedPermissions: actionDrawer.restrictedPermissions
text: modelData.text text: modelData.text
status: modelData.status status: modelData.status
icon: modelData.icon icon: modelData.icon
enabled: modelData.enabled enabled: modelData.enabled
settingsCommand: modelData.settingsCommand settingsCommand: modelData.settingsCommand
toggleFunction: modelData.toggle toggleFunction: modelData.toggle
onCloseRequested: { onCloseRequested: {
actionDrawer.close(); actionDrawer.close();
} }

View file

@ -20,40 +20,40 @@ import org.kde.plasma.private.mobileshell as MobileShell
*/ */
MobileShell.BaseItem { MobileShell.BaseItem {
id: root id: root
required property var actionDrawer required property var actionDrawer
/** /**
* The amount of height to add to the panel (increasing the height of the quick settings area). * The amount of height to add to the panel (increasing the height of the quick settings area).
*/ */
property real addedHeight: 0 property real addedHeight: 0
/** /**
* The maximum amount of added height to snap to the full height of the quick settings panel. * The maximum amount of added height to snap to the full height of the quick settings panel.
*/ */
readonly property real maxAddedHeight: quickSettings.fullHeight - minimizedQuickSettingsHeight // first row is part of minimized height readonly property real maxAddedHeight: quickSettings.fullHeight - minimizedQuickSettingsHeight // first row is part of minimized height
/** /**
* Height of panel when in minimized mode. * Height of panel when in minimized mode.
*/ */
readonly property real minimizedHeight: bottomPadding + topPadding + statusBar.height + minimizedQuickSettingsHeight + mediaWidget.height + handle.fullHeight readonly property real minimizedHeight: bottomPadding + topPadding + statusBar.height + minimizedQuickSettingsHeight + mediaWidget.height + handle.fullHeight
/** /**
* Height of just the QuickSettings component in minimized mode. * Height of just the QuickSettings component in minimized mode.
*/ */
readonly property real minimizedQuickSettingsHeight: quickSettings.minimizedRowHeight + Kirigami.Units.gridUnit readonly property real minimizedQuickSettingsHeight: quickSettings.minimizedRowHeight + Kirigami.Units.gridUnit
/** /**
* Progress of showing the full quick settings view from pinned. * Progress of showing the full quick settings view from pinned.
*/ */
property real minimizedToFullProgress: 1 property real minimizedToFullProgress: 1
// we need extra padding if the background side border is enabled // we need extra padding if the background side border is enabled
topPadding: Kirigami.Units.smallSpacing topPadding: Kirigami.Units.smallSpacing
leftPadding: Kirigami.Units.smallSpacing leftPadding: Kirigami.Units.smallSpacing
rightPadding: Kirigami.Units.smallSpacing rightPadding: Kirigami.Units.smallSpacing
bottomPadding: Kirigami.Units.smallSpacing * 4 bottomPadding: Kirigami.Units.smallSpacing * 4
background: KSvg.FrameSvgItem { background: KSvg.FrameSvgItem {
enabledBorders: KSvg.FrameSvgItem.BottomBorder enabledBorders: KSvg.FrameSvgItem.BottomBorder
imagePath: "widgets/background" imagePath: "widgets/background"
@ -62,7 +62,7 @@ MobileShell.BaseItem {
contentItem: Item { contentItem: Item {
id: containerItem id: containerItem
implicitHeight: column.implicitHeight implicitHeight: column.implicitHeight
// use container item so that our column doesn't get stretched if base item is anchored // use container item so that our column doesn't get stretched if base item is anchored
ColumnLayout { ColumnLayout {
id: column id: column
@ -70,29 +70,29 @@ MobileShell.BaseItem {
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
spacing: 0 spacing: 0
MobileShell.StatusBar { MobileShell.StatusBar {
id: statusBar id: statusBar
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: MobileShell.Constants.topPanelHeight + Kirigami.Units.gridUnit * 0.8 Layout.preferredHeight: MobileShell.Constants.topPanelHeight + Kirigami.Units.gridUnit * 0.8
Kirigami.Theme.colorSet: Kirigami.Theme.Window Kirigami.Theme.colorSet: Kirigami.Theme.Window
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
backgroundColor: "transparent" backgroundColor: "transparent"
showSecondRow: true showSecondRow: true
showDropShadow: false showDropShadow: false
// security reasons, system tray also doesn't work on lockscreen // security reasons, system tray also doesn't work on lockscreen
disableSystemTray: actionDrawer.restrictedPermissions disableSystemTray: actionDrawer.restrictedPermissions
} }
MobileShell.QuickSettings { MobileShell.QuickSettings {
id: quickSettings id: quickSettings
Layout.preferredHeight: root.minimizedQuickSettingsHeight + root.addedHeight Layout.preferredHeight: root.minimizedQuickSettingsHeight + root.addedHeight
Layout.topMargin: Kirigami.Units.smallSpacing Layout.topMargin: Kirigami.Units.smallSpacing
Layout.fillWidth: true Layout.fillWidth: true
mode: QuickSettings.Pages mode: QuickSettings.Pages
actionDrawer: root.actionDrawer actionDrawer: root.actionDrawer
minimizedViewProgress: 1 - root.minimizedToFullProgress minimizedViewProgress: 1 - root.minimizedToFullProgress
@ -100,7 +100,7 @@ MobileShell.BaseItem {
height: root.minimizedQuickSettingsHeight + root.addedHeight height: root.minimizedQuickSettingsHeight + root.addedHeight
width: parent.width width: parent.width
} }
MobileShell.MediaControlsWidget { MobileShell.MediaControlsWidget {
id: mediaWidget id: mediaWidget
property real fullHeight: height + Layout.topMargin property real fullHeight: height + Layout.topMargin
@ -109,13 +109,13 @@ MobileShell.BaseItem {
Layout.leftMargin: Kirigami.Units.largeSpacing Layout.leftMargin: Kirigami.Units.largeSpacing
Layout.rightMargin: Kirigami.Units.largeSpacing Layout.rightMargin: Kirigami.Units.largeSpacing
} }
Handle { Handle {
id: handle id: handle
property real fullHeight: height + Layout.topMargin property real fullHeight: height + Layout.topMargin
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.topMargin: Kirigami.Units.smallSpacing * 2 Layout.topMargin: Kirigami.Units.smallSpacing * 2
onTapped: { onTapped: {
if (root.minimizedToFullProgress < 0.5) { if (root.minimizedToFullProgress < 0.5) {
root.actionDrawer.expand(); root.actionDrawer.expand();

View file

@ -19,22 +19,22 @@ import org.kde.plasma.core as PlasmaCore
*/ */
MobileShell.BaseItem { MobileShell.BaseItem {
id: root id: root
required property var actionDrawer required property var actionDrawer
required property real fullScreenHeight required property real fullScreenHeight
/** /**
* Implicit height of the contents of the panel. * Implicit height of the contents of the panel.
*/ */
readonly property real contentImplicitHeight: column.implicitHeight readonly property real contentImplicitHeight: column.implicitHeight
// we need extra padding since the background side border is enabled // we need extra padding since the background side border is enabled
topPadding: Kirigami.Units.smallSpacing * 4 topPadding: Kirigami.Units.smallSpacing * 4
leftPadding: Kirigami.Units.smallSpacing * 4 leftPadding: Kirigami.Units.smallSpacing * 4
rightPadding: Kirigami.Units.smallSpacing * 4 rightPadding: Kirigami.Units.smallSpacing * 4
bottomPadding: Kirigami.Units.smallSpacing * 4 bottomPadding: Kirigami.Units.smallSpacing * 4
background: KSvg.FrameSvgItem { background: KSvg.FrameSvgItem {
enabledBorders: KSvg.FrameSvgItem.AllBorders enabledBorders: KSvg.FrameSvgItem.AllBorders
imagePath: "widgets/background" imagePath: "widgets/background"
@ -42,7 +42,7 @@ MobileShell.BaseItem {
contentItem: Item { contentItem: Item {
id: containerItem id: containerItem
// use container item so that our column doesn't get stretched if base item is anchored // use container item so that our column doesn't get stretched if base item is anchored
ColumnLayout { ColumnLayout {
id: column id: column
@ -51,14 +51,14 @@ MobileShell.BaseItem {
anchors.top: parent.top anchors.top: parent.top
height: root.fullScreenHeight height: root.fullScreenHeight
spacing: 0 spacing: 0
MobileShell.StatusBar { MobileShell.StatusBar {
id: statusBar id: statusBar
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5 Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5
Layout.maximumHeight: Kirigami.Units.gridUnit * 1.5 Layout.maximumHeight: Kirigami.Units.gridUnit * 1.5
Kirigami.Theme.colorSet: Kirigami.Theme.Window Kirigami.Theme.colorSet: Kirigami.Theme.Window
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
@ -66,31 +66,31 @@ MobileShell.BaseItem {
showSecondRow: false showSecondRow: false
showDropShadow: false showDropShadow: false
showTime: false showTime: false
// security reasons, system tray also doesn't work on lockscreen // security reasons, system tray also doesn't work on lockscreen
disableSystemTray: actionDrawer.restrictedPermissions disableSystemTray: actionDrawer.restrictedPermissions
} }
MobileShell.QuickSettings { MobileShell.QuickSettings {
id: quickSettings id: quickSettings
mode: QuickSettings.ScrollView mode: QuickSettings.ScrollView
width: column.width width: column.width
implicitHeight: quickSettings.fullHeight implicitHeight: quickSettings.fullHeight
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumHeight: root.fullScreenHeight - root.topPadding - root.bottomPadding - statusBar.height - Kirigami.Units.smallSpacing Layout.maximumHeight: root.fullScreenHeight - root.topPadding - root.bottomPadding - statusBar.height - Kirigami.Units.smallSpacing
Layout.maximumWidth: column.width Layout.maximumWidth: column.width
actionDrawer: root.actionDrawer actionDrawer: root.actionDrawer
minimizedViewProgress: 0 minimizedViewProgress: 0
fullViewProgress: 1 fullViewProgress: 1
} }
Item { Layout.fillHeight: true } Item { Layout.fillHeight: true }
} }
Handle { Handle {
id: handle id: handle
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter

View file

@ -4,18 +4,18 @@
import QtQuick 2.15 import QtQuick 2.15
/** /**
* Serves a similar function as a QQC2.Control, but does not * Serves a similar function as a QQC2.Control, but does not
* take touch input events, preventing conflicts with Flickable. * take touch input events, preventing conflicts with Flickable.
*/ */
Item { Item {
id: root id: root
property real topInset: 0 property real topInset: 0
property real bottomInset: 0 property real bottomInset: 0
property real leftInset: 0 property real leftInset: 0
property real rightInset: 0 property real rightInset: 0
property real padding: 0 property real padding: 0
property real verticalPadding: padding property real verticalPadding: padding
property real horizontalPadding: padding property real horizontalPadding: padding
@ -23,10 +23,10 @@ Item {
property real bottomPadding: verticalPadding property real bottomPadding: verticalPadding
property real leftPadding: horizontalPadding property real leftPadding: horizontalPadding
property real rightPadding: horizontalPadding property real rightPadding: horizontalPadding
property Item contentItem: Item {} property Item contentItem: Item {}
property Item background: Item {} property Item background: Item {}
implicitHeight: topPadding + bottomPadding + contentItem.implicitHeight implicitHeight: topPadding + bottomPadding + contentItem.implicitHeight
implicitWidth: leftPadding + rightPadding + contentItem.implicitWidth implicitWidth: leftPadding + rightPadding + contentItem.implicitWidth
@ -34,12 +34,12 @@ Item {
contentItem.parent = contentItemLoader; contentItem.parent = contentItemLoader;
contentItem.anchors.fill = contentItemLoader; contentItem.anchors.fill = contentItemLoader;
} }
onBackgroundChanged: { onBackgroundChanged: {
background.parent = backgroundLoader; background.parent = backgroundLoader;
background.anchors.fill = backgroundLoader; background.anchors.fill = backgroundLoader;
} }
Item { Item {
id: backgroundLoader id: backgroundLoader
anchors.fill: parent anchors.fill: parent
@ -48,7 +48,7 @@ Item {
anchors.topMargin: root.topInset anchors.topMargin: root.topInset
anchors.bottomMargin: root.bottomInset anchors.bottomMargin: root.bottomInset
} }
Item { Item {
id: contentItemLoader id: contentItemLoader
anchors.fill: parent anchors.fill: parent

View file

@ -6,29 +6,29 @@ import QtQuick.Controls 2.15 as QQC2
/** /**
* This component is an AbstractButton with some added functionality to simulate a MouseArea. * This component is an AbstractButton with some added functionality to simulate a MouseArea.
* *
* The hovered property of AbstractButton is much more accurate than the containsMouse property of MouseArea, * The hovered property of AbstractButton is much more accurate than the containsMouse property of MouseArea,
* and so this is useful for creating custom buttons. * and so this is useful for creating custom buttons.
*/ */
QQC2.AbstractButton { QQC2.AbstractButton {
id: root id: root
/** /**
* The cursor shape when the mouse is over the button. * The cursor shape when the mouse is over the button.
*/ */
property alias cursorShape: hoverHandler.cursorShape property alias cursorShape: hoverHandler.cursorShape
/** /**
* Alias to MouseArea used in the button. * Alias to MouseArea used in the button.
*/ */
property alias mouseArea: mouseArea property alias mouseArea: mouseArea
/** /**
* Whether a mouse is hovering over the button (not touch). * Whether a mouse is hovering over the button (not touch).
*/ */
readonly property bool mouseHovered: hoverHandler.hovered readonly property bool mouseHovered: hoverHandler.hovered
/** /**
* Signal that is emitted when the right click button is pressed. * Signal that is emitted when the right click button is pressed.
*/ */
@ -46,7 +46,7 @@ QQC2.AbstractButton {
} }
} }
} }
HoverHandler { HoverHandler {
id: hoverHandler id: hoverHandler
acceptedDevices: PointerDevice.Mouse acceptedDevices: PointerDevice.Mouse

View file

@ -12,26 +12,26 @@ import org.kde.plasma.components 3.0 as PlasmaComponents
PlasmaComponents.Label { PlasmaComponents.Label {
id: root id: root
required property string inputText required property string inputText
readonly property string filteredText: inputText.replace(/\n/g, ' ') // remove new line characters readonly property string filteredText: inputText.replace(/\n/g, ' ') // remove new line characters
readonly property int interval: 200 // update position every 200 ms readonly property int interval: 200 // update position every 200 ms
readonly property int longDuration: 300 readonly property int longDuration: 300
readonly property int waitDuration: 900 readonly property int waitDuration: 900
readonly property int charactersOverflow: Math.ceil((txtMeter.advanceWidth - root.width) / (txtMeter.advanceWidth / filteredText.length)) readonly property int charactersOverflow: Math.ceil((txtMeter.advanceWidth - root.width) / (txtMeter.advanceWidth / filteredText.length))
property int step: 0 property int step: 0
TextMetrics { TextMetrics {
id: txtMeter id: txtMeter
font: root.font font: root.font
text: filteredText text: filteredText
} }
Timer { Timer {
property bool paused: false property bool paused: false
interval: root.interval interval: root.interval
running: visible && charactersOverflow > 0 running: visible && charactersOverflow > 0
repeat: true repeat: true
@ -52,13 +52,13 @@ PlasmaComponents.Label {
} }
} }
} }
onRunningChanged: { onRunningChanged: {
if (!running) { if (!running) {
step = 0; step = 0;
} }
} }
} }
text: filteredText.substring(step, step + filteredText.length - charactersOverflow) text: filteredText.substring(step, step + filteredText.length - charactersOverflow)
} }

View file

@ -96,5 +96,5 @@ NanoShell.FullScreenOverlay {
} }
} }
} }
} }

View file

@ -10,27 +10,27 @@ import QtQuick 2.15
QtObject { QtObject {
id: root id: root
property bool zeroVelocityCounts: false property bool zeroVelocityCounts: false
property real velocity: 0 property real velocity: 0
function changePosition(position) { function changePosition(position) {
__pushDragEvent(position); __pushDragEvent(position);
} }
function startMeasure(position) { function startMeasure(position) {
__dragEvents = []; __dragEvents = [];
__pushDragEvent(position); __pushDragEvent(position);
} }
//BEGIN internal //BEGIN internal
property var __dragEvents: [] property var __dragEvents: []
property var __dateTime: new function() { property var __dateTime: new function() {
this.getCurrentTimeMs = function() {return new Date().getTime()} this.getCurrentTimeMs = function() {return new Date().getTime()}
} }
function __updateSpeed() { function __updateSpeed() {
var totalSpeed = 0; var totalSpeed = 0;
for (var i = 0; i < __dragEvents.length; i++) { for (var i = 0; i < __dragEvents.length; i++) {
@ -61,13 +61,13 @@ QtObject {
return 0; return 0;
} }
} }
function __pushDragEvent(position) { function __pushDragEvent(position) {
let currentTime = __dateTime.getCurrentTimeMs(); let currentTime = __dateTime.getCurrentTimeMs();
__dragEvents.push([currentTime, position, __getEventSpeed(currentTime, position)]); __dragEvents.push([currentTime, position, __getEventSpeed(currentTime, position)]);
__cullOldDragEvents(currentTime); __cullOldDragEvents(currentTime);
__updateSpeed(); __updateSpeed();
} }
//END internal //END internal
} }

View file

@ -17,7 +17,7 @@ QtObject {
property bool isVisible: pmSource.data["Battery"]["Has Cumulative"] property bool isVisible: pmSource.data["Battery"]["Has Cumulative"]
property int percent: pmSource.data["Battery"]["Percent"] property int percent: pmSource.data["Battery"]["Percent"]
property bool pluggedIn: pmSource.data["AC Adapter"] ? pmSource.data["AC Adapter"]["Plugged in"] : false property bool pluggedIn: pmSource.data["AC Adapter"] ? pmSource.data["AC Adapter"]["Plugged in"] : false
property P5Support.DataSource pmSource: P5Support.DataSource { property P5Support.DataSource pmSource: P5Support.DataSource {
engine: "powermanagement" engine: "powermanagement"
connectedSources: ["Battery", "AC Adapter"] connectedSources: ["Battery", "AC Adapter"]

View file

@ -16,9 +16,9 @@ QtObject {
id: root id: root
readonly property bool isVisible: BluezQt.Manager.bluetoothOperational readonly property bool isVisible: BluezQt.Manager.bluetoothOperational
readonly property string icon: deviceConnected ? "network-bluetooth-activated" : "network-bluetooth" readonly property string icon: deviceConnected ? "network-bluetooth-activated" : "network-bluetooth"
property bool deviceConnected: false property bool deviceConnected: false
function updateStatus() { function updateStatus() {
let connectedDevices = []; let connectedDevices = [];
@ -28,13 +28,13 @@ QtObject {
connectedDevices.push(device); connectedDevices.push(device);
} }
} }
root.deviceConnected = connectedDevices.length > 0; root.deviceConnected = connectedDevices.length > 0;
} }
property var connections: Connections { property var connections: Connections {
target: BluezQt.Manager target: BluezQt.Manager
function onDeviceAdded() { function onDeviceAdded() {
root.updateStatus(); root.updateStatus();
} }
@ -51,7 +51,7 @@ QtObject {
root.updateStatus(); root.updateStatus();
} }
} }
Component.onCompleted: { Component.onCompleted: {
updateStatus(); updateStatus();
} }

View file

@ -17,15 +17,15 @@ import org.kde.plasma.private.mobileshell.state as MobileShellState
Item { Item {
id: root id: root
property bool shadow: false property bool shadow: false
property color backgroundColor property color backgroundColor
property var foregroundColorGroup property var foregroundColorGroup
property NavigationPanelAction leftAction property NavigationPanelAction leftAction
property NavigationPanelAction middleAction property NavigationPanelAction middleAction
property NavigationPanelAction rightAction property NavigationPanelAction rightAction
property NavigationPanelAction leftCornerAction property NavigationPanelAction leftCornerAction
property NavigationPanelAction rightCornerAction property NavigationPanelAction rightCornerAction
@ -41,7 +41,7 @@ Item {
shadowVerticalOffset: 1 shadowVerticalOffset: 1
shadowOpacity: 0.8 shadowOpacity: 0.8
} }
Item { Item {
id: icons id: icons
anchors.fill: parent anchors.fill: parent

View file

@ -11,6 +11,6 @@ QtObject {
property bool visible: true property bool visible: true
property string iconSource property string iconSource
property real iconSizeFactor property real iconSizeFactor
signal triggered() signal triggered()
} }

View file

@ -28,20 +28,20 @@ Controls.AbstractButton {
} }
onPressed: haptics.buttonVibrate() onPressed: haptics.buttonVibrate()
Rectangle { Rectangle {
id: rect id: rect
radius: height/2 radius: height/2
anchors.fill: parent anchors.fill: parent
opacity: 0 opacity: 0
color: Kirigami.Theme.textColor color: Kirigami.Theme.textColor
// this way of calculating animations lets the animation fully complete before switching back (tap runs the full animation) // this way of calculating animations lets the animation fully complete before switching back (tap runs the full animation)
property bool buttonHeld: button.pressed && button.enabled property bool buttonHeld: button.pressed && button.enabled
onButtonHeldChanged: showBackground(buttonHeld) onButtonHeldChanged: showBackground(buttonHeld)
Component.onCompleted: showBackground(buttonHeld) Component.onCompleted: showBackground(buttonHeld)
function showBackground(show) { function showBackground(show) {
if (show) { if (show) {
if (!opacityAnimator.running && opacityAnimator.to !== 0.1) { if (!opacityAnimator.running && opacityAnimator.to !== 0.1) {

View file

@ -23,9 +23,9 @@ RowLayout {
PlasmaComponents.Label { PlasmaComponents.Label {
id: clock id: clock
property bool is24HourTime: MobileShell.ShellUtil.isSystem24HourFormat property bool is24HourTime: MobileShell.ShellUtil.isSystem24HourFormat
text: Qt.formatTime(source.data.Local.DateTime, is24HourTime ? "h:mm" : "h:mm ap") text: Qt.formatTime(source.data.Local.DateTime, is24HourTime ? "h:mm" : "h:mm ap")
color: Kirigami.Theme.textColor color: Kirigami.Theme.textColor
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter

View file

@ -16,7 +16,7 @@ import org.kde.plasma.private.mobileshell as MobileShell
RowLayout { RowLayout {
property real textPixelSize: Kirigami.Units.gridUnit * 0.6 property real textPixelSize: Kirigami.Units.gridUnit * 0.6
visible: MobileShell.BatteryInfo.isVisible visible: MobileShell.BatteryInfo.isVisible
PW.BatteryIcon { PW.BatteryIcon {

View file

@ -14,7 +14,7 @@ import org.kde.plasma.private.mobileshell as MobileShell
Kirigami.Icon { Kirigami.Icon {
id: connectionIcon id: connectionIcon
source: MobileShell.BluetoothInfo.icon source: MobileShell.BluetoothInfo.icon
visible: MobileShell.BluetoothInfo.isVisible visible: MobileShell.BluetoothInfo.isVisible

View file

@ -15,13 +15,13 @@ import org.kde.plasma.private.mobileshell as MobileShell
Item { Item {
property InternetIndicator internetIndicator property InternetIndicator internetIndicator
// check if the internet indicator icon is a mobile data related one // check if the internet indicator icon is a mobile data related one
readonly property bool isInternetIndicatorMobileData: internetIndicator && internetIndicator.icon && internetIndicator.icon.startsWith('network-mobile-') readonly property bool isInternetIndicatorMobileData: internetIndicator && internetIndicator.icon && internetIndicator.icon.startsWith('network-mobile-')
property bool showLabel: true property bool showLabel: true
property real textPixelSize: Kirigami.Units.gridUnit * 0.6 property real textPixelSize: Kirigami.Units.gridUnit * 0.6
width: strengthIcon.width + label.width width: strengthIcon.width + label.width
Layout.minimumWidth: strengthIcon.width + label.width Layout.minimumWidth: strengthIcon.width + label.width
@ -33,11 +33,11 @@ Item {
height: parent.height height: parent.height
source: MobileShell.SignalStrengthInfo.icon source: MobileShell.SignalStrengthInfo.icon
// don't show mobile indicator icon if the networkmanager one is already showing // don't show mobile indicator icon if the networkmanager one is already showing
visible: (!isInternetIndicatorMobileData || wirelessStatus.hotspotSSID.length !== 0) && MobileShell.SignalStrengthInfo.showIndicator visible: (!isInternetIndicatorMobileData || wirelessStatus.hotspotSSID.length !== 0) && MobileShell.SignalStrengthInfo.showIndicator
} }
PlasmaComponents.Label { PlasmaComponents.Label {
id: label id: label
visible: showLabel visible: showLabel

View file

@ -16,7 +16,7 @@ import org.kde.plasma.private.mobileshell as MobileShell
Kirigami.Icon { Kirigami.Icon {
id: paIcon id: paIcon
source: MobileShell.AudioInfo.icon source: MobileShell.AudioInfo.icon
visible: MobileShell.AudioInfo.isVisible visible: MobileShell.AudioInfo.isVisible

View file

@ -20,7 +20,7 @@ import org.kde.plasma.private.volume
// capture presses on the audio applet so it doesn't close the overlay // capture presses on the audio applet so it doesn't close the overlay
ColumnLayout { ColumnLayout {
spacing: 0 spacing: 0
PulseObjectFilterModel { PulseObjectFilterModel {
id: paSinkFilterModel id: paSinkFilterModel
sortRoleName: "SortByDefault" sortRoleName: "SortByDefault"
@ -46,14 +46,14 @@ ColumnLayout {
} }
// ui elements // ui elements
PopupCard { PopupCard {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: Kirigami.Units.gridUnit Layout.bottomMargin: Kirigami.Units.gridUnit
contentItem: ColumnLayout { contentItem: ColumnLayout {
anchors.rightMargin: Kirigami.Units.smallSpacing anchors.rightMargin: Kirigami.Units.smallSpacing
anchors.leftMargin: Kirigami.Units.smallSpacing anchors.leftMargin: Kirigami.Units.smallSpacing
Kirigami.Heading { Kirigami.Heading {
level: 2 level: 2
text: i18n("Outputs") text: i18n("Outputs")
@ -61,11 +61,11 @@ ColumnLayout {
Layout.topMargin: Kirigami.Units.smallSpacing Layout.topMargin: Kirigami.Units.smallSpacing
Layout.leftMargin: Kirigami.Units.smallSpacing Layout.leftMargin: Kirigami.Units.smallSpacing
} }
Repeater { Repeater {
id: sinkView id: sinkView
Layout.fillWidth: true Layout.fillWidth: true
model: paSinkFilterModel model: paSinkFilterModel
delegate: DeviceListItem { delegate: DeviceListItem {
Layout.fillWidth: true Layout.fillWidth: true
@ -76,14 +76,14 @@ ColumnLayout {
} }
} }
} }
PopupCard { PopupCard {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: Kirigami.Units.gridUnit Layout.bottomMargin: Kirigami.Units.gridUnit
contentItem: ColumnLayout { contentItem: ColumnLayout {
anchors.rightMargin: Kirigami.Units.smallSpacing anchors.rightMargin: Kirigami.Units.smallSpacing
anchors.leftMargin: Kirigami.Units.smallSpacing anchors.leftMargin: Kirigami.Units.smallSpacing
Kirigami.Heading { Kirigami.Heading {
level: 2 level: 2
text: i18n("Inputs") text: i18n("Inputs")
@ -91,11 +91,11 @@ ColumnLayout {
Layout.topMargin: Kirigami.Units.smallSpacing Layout.topMargin: Kirigami.Units.smallSpacing
Layout.leftMargin: Kirigami.Units.smallSpacing Layout.leftMargin: Kirigami.Units.smallSpacing
} }
Repeater { Repeater {
id: sourceView id: sourceView
Layout.fillWidth: true Layout.fillWidth: true
model: paSourceFilterModel model: paSourceFilterModel
delegate: DeviceListItem { delegate: DeviceListItem {
Layout.fillWidth: true Layout.fillWidth: true
@ -106,7 +106,7 @@ ColumnLayout {
} }
} }
} }
PopupCard { PopupCard {
visible: sourceInputView.model.count + sourceMediaInputView.model.count !== 0 visible: sourceInputView.model.count + sourceMediaInputView.model.count !== 0
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
@ -114,7 +114,7 @@ ColumnLayout {
contentItem: ColumnLayout { contentItem: ColumnLayout {
anchors.rightMargin: Kirigami.Units.smallSpacing anchors.rightMargin: Kirigami.Units.smallSpacing
anchors.leftMargin: Kirigami.Units.smallSpacing anchors.leftMargin: Kirigami.Units.smallSpacing
Kirigami.Heading { Kirigami.Heading {
level: 2 level: 2
text: i18n("Playback Streams") text: i18n("Playback Streams")
@ -122,11 +122,11 @@ ColumnLayout {
Layout.topMargin: Kirigami.Units.smallSpacing Layout.topMargin: Kirigami.Units.smallSpacing
Layout.leftMargin: Kirigami.Units.smallSpacing Layout.leftMargin: Kirigami.Units.smallSpacing
} }
Repeater { Repeater {
id: sourceMediaInputView id: sourceMediaInputView
Layout.fillWidth: true Layout.fillWidth: true
model: PulseObjectFilterModel { model: PulseObjectFilterModel {
filters: [ { role: "Name", value: "sink-input-by-media-role:event" } ] filters: [ { role: "Name", value: "sink-input-by-media-role:event" } ]
sourceModel: StreamRestoreModel {} sourceModel: StreamRestoreModel {}
@ -139,11 +139,11 @@ ColumnLayout {
devicesModel: sourceView.model devicesModel: sourceView.model
} }
} }
Repeater { Repeater {
id: sourceInputView id: sourceInputView
Layout.fillWidth: true Layout.fillWidth: true
model: PulseObjectFilterModel { model: PulseObjectFilterModel {
filters: [ { role: "VirtualStream", value: false } ] filters: [ { role: "VirtualStream", value: false } ]
sourceModel: SinkInputModel {} sourceModel: SinkInputModel {}
@ -159,7 +159,7 @@ ColumnLayout {
} }
} }
} }
PopupCard { PopupCard {
visible: sourceOutputView.model.count !== 0 visible: sourceOutputView.model.count !== 0
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
@ -167,7 +167,7 @@ ColumnLayout {
contentItem: ColumnLayout { contentItem: ColumnLayout {
anchors.rightMargin: Kirigami.Units.smallSpacing anchors.rightMargin: Kirigami.Units.smallSpacing
anchors.leftMargin: Kirigami.Units.smallSpacing anchors.leftMargin: Kirigami.Units.smallSpacing
Kirigami.Heading { Kirigami.Heading {
level: 2 level: 2
text: i18n("Recording Streams") text: i18n("Recording Streams")
@ -175,11 +175,11 @@ ColumnLayout {
Layout.topMargin: Kirigami.Units.smallSpacing Layout.topMargin: Kirigami.Units.smallSpacing
Layout.leftMargin: Kirigami.Units.smallSpacing Layout.leftMargin: Kirigami.Units.smallSpacing
} }
Repeater { Repeater {
id: sourceOutputView id: sourceOutputView
Layout.fillWidth: true Layout.fillWidth: true
model: PulseObjectFilterModel { model: PulseObjectFilterModel {
filters: [ { role: "VirtualStream", value: false } ] filters: [ { role: "VirtualStream", value: false } ]
sourceModel: SourceOutputModel {} sourceModel: SourceOutputModel {}

View file

@ -23,21 +23,21 @@ import "icon.js" as Icon
// adapted from https://invent.kde.org/plasma/plasma-pa/-/blob/master/applet/contents/ui/ListItemBase.qml // adapted from https://invent.kde.org/plasma/plasma-pa/-/blob/master/applet/contents/ui/ListItemBase.qml
Controls.ItemDelegate { Controls.ItemDelegate {
id: baseItem id: baseItem
property string label property string label
property alias listIcon: clientIcon.source property alias listIcon: clientIcon.source
property string type // sink, source, source-output property string type // sink, source, source-output
onClicked: { onClicked: {
if (selectButton.visible) { if (selectButton.visible) {
model.PulseObject.default = true; model.PulseObject.default = true;
} }
} }
contentItem: RowLayout { contentItem: RowLayout {
id: row id: row
spacing: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing
PlasmaComponents.RadioButton { PlasmaComponents.RadioButton {
id: selectButton id: selectButton
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
@ -46,7 +46,7 @@ Controls.ItemDelegate {
visible: (baseItem.type == "sink" && sinkView.model.count > 1) || (baseItem.type == "source" && sourceView.model.count > 1) visible: (baseItem.type == "sink" && sinkView.model.count > 1) || (baseItem.type == "source" && sourceView.model.count > 1)
onClicked: model.PulseObject.default = true onClicked: model.PulseObject.default = true
} }
// application icon // application icon
Kirigami.Icon { Kirigami.Icon {
id: clientIcon id: clientIcon
@ -62,17 +62,17 @@ Controls.ItemDelegate {
} }
} }
} }
ColumnLayout { ColumnLayout {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true Layout.fillWidth: true
spacing: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
spacing: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing
Layout.alignment: Qt.AlignBottom Layout.alignment: Qt.AlignBottom
PlasmaComponents.Label { PlasmaComponents.Label {
id: mainLabel id: mainLabel
text: baseItem.label text: baseItem.label
@ -80,7 +80,7 @@ Controls.ItemDelegate {
Layout.fillWidth: true Layout.fillWidth: true
elide: Text.ElideRight elide: Text.ElideRight
} }
PlasmaComponents.ToolButton { PlasmaComponents.ToolButton {
Layout.alignment: Qt.AlignBottom Layout.alignment: Qt.AlignBottom
Layout.bottomMargin: -Kirigami.Units.smallSpacing Layout.bottomMargin: -Kirigami.Units.smallSpacing
@ -95,7 +95,7 @@ Controls.ItemDelegate {
PlasmaComponents.ToolTip { PlasmaComponents.ToolTip {
text: i18n("Show additional options for %1", baseItem.label) text: i18n("Show additional options for %1", baseItem.label)
} }
ListItemMenu { ListItemMenu {
id: contextMenu id: contextMenu
pulseObject: model.PulseObject pulseObject: model.PulseObject
@ -123,17 +123,17 @@ Controls.ItemDelegate {
} }
} }
} }
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
spacing: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing
// this slider was effectively copied from the source (linked at the top of the file) // this slider was effectively copied from the source (linked at the top of the file)
PlasmaComponents.Slider { PlasmaComponents.Slider {
id: slider id: slider
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
// Helper properties to allow async slider updates. // Helper properties to allow async slider updates.
// While we are sliding we must not react to value updates // While we are sliding we must not react to value updates
// as otherwise we can easily end up in a loop where value // as otherwise we can easily end up in a loop where value
@ -141,14 +141,14 @@ Controls.ItemDelegate {
property int volume: Volume property int volume: Volume
property bool ignoreValueChange: true property bool ignoreValueChange: true
readonly property bool forceRaiseMaxVolume: volume >= PulseAudio.NormalVolume * 1.01 readonly property bool forceRaiseMaxVolume: volume >= PulseAudio.NormalVolume * 1.01
from: PulseAudio.MinimalVolume from: PulseAudio.MinimalVolume
to: PulseAudio.NormalVolume to: PulseAudio.NormalVolume
stepSize: to / (to / PulseAudio.NormalVolume * 100.0) stepSize: to / (to / PulseAudio.NormalVolume * 100.0)
visible: HasVolume visible: HasVolume
enabled: VolumeWritable enabled: VolumeWritable
opacity: Muted ? 0.5 : 1 opacity: Muted ? 0.5 : 1
Accessible.name: i18nc("Accessibility data on volume slider", "Adjust volume for %1", baseItem.label) Accessible.name: i18nc("Accessibility data on volume slider", "Adjust volume for %1", baseItem.label)
background: KSvg.FrameSvgItem { background: KSvg.FrameSvgItem {
@ -247,7 +247,7 @@ Controls.ItemDelegate {
} }
} }
} }
function setVolumeByPercent(targetPercent) { function setVolumeByPercent(targetPercent) {
model.PulseObject.volume = Math.round(PulseAudio.NormalVolume * (targetPercent/100)); model.PulseObject.volume = Math.round(PulseAudio.NormalVolume * (targetPercent/100));
} }

View file

@ -19,7 +19,7 @@ import org.kde.milou as Milou
import org.kde.kirigami 2.19 as Kirigami import org.kde.kirigami 2.19 as Kirigami
/** /**
* Search widget that is embedded into the homescreen. The dimensions of * Search widget that is embedded into the homescreen. The dimensions of
* the root item is assumed to be the available screen area for applications. * the root item is assumed to be the available screen area for applications.
*/ */
Item { Item {
@ -35,22 +35,22 @@ Item {
queryField.text = ""; queryField.text = "";
flickable.contentY = closedContentY; flickable.contentY = closedContentY;
} }
function updateGestureOffset(yOffset) { function updateGestureOffset(yOffset) {
flickable.contentY = Math.max(0, Math.min(closedContentY, flickable.contentY + yOffset)); flickable.contentY = Math.max(0, Math.min(closedContentY, flickable.contentY + yOffset));
} }
// call when the touch gesture has let go // call when the touch gesture has let go
function endGesture() { function endGesture() {
flickable.opening ? open() : close(); flickable.opening ? open() : close();
} }
// open the search widget (animated) // open the search widget (animated)
function open() { function open() {
anim.to = openedContentY; anim.to = openedContentY;
anim.restart(); anim.restart();
} }
// close the search widget (animated) // close the search widget (animated)
function close() { function close() {
anim.to = closedContentY; anim.to = closedContentY;
@ -59,24 +59,24 @@ Item {
// emitted when an item on the ListView is triggered // emitted when an item on the ListView is triggered
signal actionTriggered() signal actionTriggered()
readonly property real closedContentY: Kirigami.Units.gridUnit * 5 readonly property real closedContentY: Kirigami.Units.gridUnit * 5
readonly property real openedContentY: 0 readonly property real openedContentY: 0
readonly property real openFactor: Math.max(0, Math.min(1, 1 - flickable.contentY / closedContentY)) readonly property real openFactor: Math.max(0, Math.min(1, 1 - flickable.contentY / closedContentY))
readonly property bool isOpen: openFactor != 0 readonly property bool isOpen: openFactor != 0
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Qt.rgba(0, 0, 0, 0.3) color: Qt.rgba(0, 0, 0, 0.3)
opacity: root.openFactor opacity: root.openFactor
} }
onOpacityChanged: { onOpacityChanged: {
if (opacity === 0) { if (opacity === 0) {
close(); close();
} }
} }
Keys.onPressed: event => { Keys.onPressed: event => {
if (event.key === Qt.Key_Down) { if (event.key === Qt.Key_Down) {
listView.forceActiveFocus(); listView.forceActiveFocus();
@ -85,35 +85,35 @@ Item {
Flickable { Flickable {
id: flickable id: flickable
anchors.fill: parent anchors.fill: parent
anchors.topMargin: root.topMargin anchors.topMargin: root.topMargin
anchors.bottomMargin: root.bottomMargin anchors.bottomMargin: root.bottomMargin
anchors.leftMargin: root.leftMargin anchors.leftMargin: root.leftMargin
anchors.rightMargin: root.rightMargin anchors.rightMargin: root.rightMargin
contentHeight: flickable.height + root.closedContentY contentHeight: flickable.height + root.closedContentY
contentY: root.closedContentY contentY: root.closedContentY
property real oldContentY: contentY property real oldContentY: contentY
property bool opening: false property bool opening: false
onContentYChanged: { onContentYChanged: {
opening = contentY < oldContentY; opening = contentY < oldContentY;
oldContentY = contentY; oldContentY = contentY;
if (contentY !== root.openedContentY) { if (contentY !== root.openedContentY) {
queryField.focus = false; queryField.focus = false;
} }
} }
onMovementEnded: root.endGesture() onMovementEnded: root.endGesture()
onDraggingChanged: { onDraggingChanged: {
if (!dragging) { if (!dragging) {
root.endGesture(); root.endGesture();
} }
} }
NumberAnimation on contentY { NumberAnimation on contentY {
id: anim id: anim
duration: Kirigami.Units.longDuration * 2 duration: Kirigami.Units.longDuration * 2
@ -125,12 +125,12 @@ Item {
} }
} }
} }
ColumnLayout { ColumnLayout {
id: column id: column
height: flickable.height height: flickable.height
width: flickable.width width: flickable.width
Controls.Control { Controls.Control {
opacity: root.openFactor opacity: root.openFactor
Layout.fillWidth: true Layout.fillWidth: true
@ -139,14 +139,14 @@ Item {
Layout.topMargin: Kirigami.Units.gridUnit Layout.topMargin: Kirigami.Units.gridUnit
Layout.leftMargin: Kirigami.Units.gridUnit Layout.leftMargin: Kirigami.Units.gridUnit
Layout.rightMargin: Kirigami.Units.gridUnit Layout.rightMargin: Kirigami.Units.gridUnit
leftPadding: Kirigami.Units.smallSpacing leftPadding: Kirigami.Units.smallSpacing
rightPadding: Kirigami.Units.smallSpacing rightPadding: Kirigami.Units.smallSpacing
topPadding: Kirigami.Units.smallSpacing topPadding: Kirigami.Units.smallSpacing
bottomPadding: Kirigami.Units.smallSpacing bottomPadding: Kirigami.Units.smallSpacing
background: Item { background: Item {
// shadow for search window // shadow for search window
MultiEffect { MultiEffect {
anchors.fill: parent anchors.fill: parent
@ -156,7 +156,7 @@ Item {
shadowVerticalOffset: 1 shadowVerticalOffset: 1
shadowOpacity: 0.15 shadowOpacity: 0.15
} }
Rectangle { Rectangle {
id: rectBackground id: rectBackground
anchors.fill: parent anchors.fill: parent
@ -164,7 +164,7 @@ Item {
radius: Kirigami.Units.smallSpacing radius: Kirigami.Units.smallSpacing
} }
} }
contentItem: RowLayout { contentItem: RowLayout {
Item { Item {
implicitHeight: queryField.height implicitHeight: queryField.height
@ -183,13 +183,13 @@ Item {
} }
} }
} }
Controls.ScrollView { Controls.ScrollView {
opacity: root.openFactor === 1 ? 1 : 0 opacity: root.openFactor === 1 ? 1 : 0
Behavior on opacity { Behavior on opacity {
NumberAnimation { duration: Kirigami.Units.shortDuration } NumberAnimation { duration: Kirigami.Units.shortDuration }
} }
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: listView.contentHeight > availableHeight Layout.fillHeight: listView.contentHeight > availableHeight

View file

@ -9,10 +9,10 @@ import org.kde.kirigami 2.20 as Kirigami
Item { Item {
id: root id: root
property string imageSource property string imageSource
property bool darken: false property bool darken: false
// clip corners so that the image has rounded corners // clip corners so that the image has rounded corners
layer.enabled: true layer.enabled: true
layer.effect: OpacityMask { layer.effect: OpacityMask {
@ -33,16 +33,16 @@ Item {
id: img id: img
source: root.imageSource source: root.imageSource
asynchronous: true asynchronous: true
anchors.fill: parent anchors.fill: parent
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
// ensure text is readable // ensure text is readable
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Qt.rgba(0, 0, 0, root.darken ? 0.8 : 0.6) color: Qt.rgba(0, 0, 0, root.darken ? 0.8 : 0.6)
} }
// apply lighten, saturate and blur effect // apply lighten, saturate and blur effect
layer.enabled: true layer.enabled: true
layer.effect: MultiEffect { layer.effect: MultiEffect {

View file

@ -33,11 +33,11 @@ Item {
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
MediaControlsSource { MediaControlsSource {
id: mpris2Source id: mpris2Source
} }
// page indicator // page indicator
RowLayout { RowLayout {
z: 1 z: 1
@ -46,7 +46,7 @@ Item {
anchors.bottomMargin: Kirigami.Units.smallSpacing anchors.bottomMargin: Kirigami.Units.smallSpacing
anchors.bottom: view.bottom anchors.bottom: view.bottom
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
Repeater { Repeater {
model: view.count model: view.count
delegate: Rectangle { delegate: Rectangle {
@ -57,24 +57,24 @@ Item {
} }
} }
} }
// list of app media widgets // list of app media widgets
QQC2.SwipeView { QQC2.SwipeView {
id: view id: view
clip: true clip: true
anchors.fill: parent anchors.fill: parent
Repeater { Repeater {
id: sourceRepeater id: sourceRepeater
model: mpris2Source.mpris2Model model: mpris2Source.mpris2Model
delegate: Loader { delegate: Loader {
id: delegate id: delegate
// NOTE: model is PlayerContainer from KMpris in plasma-workspace // NOTE: model is PlayerContainer from KMpris in plasma-workspace
asynchronous: true asynchronous: true
function getTrackName() { function getTrackName() {
console.log('track name: ' + model.title); console.log('track name: ' + model.title);
if (model.title) { if (model.title) {
@ -108,31 +108,31 @@ Item {
MobileShell.AppLaunch.launchOrActivateApp(model.desktopEntry + ".desktop"); MobileShell.AppLaunch.launchOrActivateApp(model.desktopEntry + ".desktop");
MobileShellState.ShellDBusClient.closeActionDrawer(); MobileShellState.ShellDBusClient.closeActionDrawer();
} }
onClicked: { onClicked: {
root.detailledView = !root.detailledView root.detailledView = !root.detailledView
} }
MobileShell.BaseItem { MobileShell.BaseItem {
id: playerItem id: playerItem
anchors.fill: parent anchors.fill: parent
padding: root.padding padding: root.padding
implicitHeight: root.contentHeight + root.padding * 2 implicitHeight: root.contentHeight + root.padding * 2
implicitWidth: root.width implicitWidth: root.width
background: BlurredBackground { background: BlurredBackground {
darken: mouseArea.pressed darken: mouseArea.pressed
imageSource: model.artUrl imageSource: model.artUrl
} }
contentItem: ColumnLayout { contentItem: ColumnLayout {
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
width: playerItem.width - playerItem.leftPadding - playerItem.rightPadding width: playerItem.width - playerItem.leftPadding - playerItem.rightPadding
spacing: Kirigami.Units.largeSpacing spacing: Kirigami.Units.largeSpacing
RowLayout { RowLayout {
id: controlsRow id: controlsRow
spacing: 0 spacing: 0

View file

@ -1,7 +1,7 @@
/* /*
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org> * SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
* SPDX-FileCopyrightText: 2018-2019 Kai Uwe Broulik <kde@privat.broulik.de> * SPDX-FileCopyrightText: 2018-2019 Kai Uwe Broulik <kde@privat.broulik.de>
* *
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/ */
@ -13,12 +13,12 @@ import org.kde.plasma.components 3.0 as PlasmaComponents
Item { Item {
id: actionContainer id: actionContainer
required property BaseNotificationItem notification required property BaseNotificationItem notification
implicitHeight: Math.max(actionFlow.implicitHeight, replyLoader.height) implicitHeight: Math.max(actionFlow.implicitHeight, replyLoader.height)
visible: actionRepeater.count > 0 visible: actionRepeater.count > 0
Flow { Flow {
id: actionFlow id: actionFlow
width: parent.width width: parent.width
@ -26,7 +26,7 @@ Item {
layoutDirection: Qt.RightToLeft layoutDirection: Qt.RightToLeft
enabled: !replyLoader.active enabled: !replyLoader.active
opacity: replyLoader.active ? 0 : 1 opacity: replyLoader.active ? 0 : 1
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: Kirigami.Units.longDuration duration: Kirigami.Units.longDuration
@ -48,14 +48,14 @@ Item {
label: actionLabels[i] label: actionLabels[i]
}); });
} }
if (notificationItem.hasReplyAction) { if (notificationItem.hasReplyAction) {
buttons.unshift({ buttons.unshift({
actionName: "inline-reply", actionName: "inline-reply",
label: notificationItem.replyActionLabel || i18nc("Reply to message", "Reply") label: notificationItem.replyActionLabel || i18nc("Reply to message", "Reply")
}); });
} }
return buttons; return buttons;
} }
@ -73,19 +73,19 @@ Item {
} }
} }
} }
// inline reply field // inline reply field
Loader { Loader {
id: replyLoader id: replyLoader
width: parent.width width: parent.width
height: active ? item.implicitHeight : 0 height: active ? item.implicitHeight : 0
// When there is only one action and it is a reply action, show text field right away // When there is only one action and it is a reply action, show text field right away
active: false active: false
visible: active visible: active
opacity: active ? 1 : 0 opacity: active ? 1 : 0
x: active ? 0 : parent.width x: active ? 0 : parent.width
Behavior on x { Behavior on x {
NumberAnimation { NumberAnimation {
duration: Kirigami.Units.longDuration duration: Kirigami.Units.longDuration
@ -109,7 +109,7 @@ Item {
buttonIconName: notificationItem.replySubmitButtonIconName buttonIconName: notificationItem.replySubmitButtonIconName
buttonText: notificationItem.replySubmitButtonText buttonText: notificationItem.replySubmitButtonText
onReplied: notificationItem.replied(text) onReplied: notificationItem.replied(text)
replying: replyLoader.active replying: replyLoader.active
onBeginReplyRequested: replyLoader.beginReply() onBeginReplyRequested: replyLoader.beginReply()
} }

View file

@ -1,7 +1,7 @@
/* /*
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org> * SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
* SPDX-FileCopyrightText: 2018-2019 Kai Uwe Broulik <kde@privat.broulik.de> * SPDX-FileCopyrightText: 2018-2019 Kai Uwe Broulik <kde@privat.broulik.de>
* *
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/ */
@ -20,17 +20,17 @@ import org.kde.coreaddons 1.0 as KCoreAddons
PlasmaComponents.Label { PlasmaComponents.Label {
id: ageLabel id: ageLabel
property int notificationType: model.type property int notificationType: model.type
property int jobState property int jobState
property QtObject jobDetails property QtObject jobDetails
property var time property var time
property P5Support.DataSource timeSource property P5Support.DataSource timeSource
// notification created/updated time changed // notification created/updated time changed
onTimeChanged: updateAgoText() onTimeChanged: updateAgoText()
Connections { Connections {
target: timeSource target: timeSource
// clock time changed // clock time changed
@ -38,13 +38,13 @@ PlasmaComponents.Label {
ageLabel.updateAgoText() ageLabel.updateAgoText()
} }
} }
Component.onCompleted: updateAgoText() Component.onCompleted: updateAgoText()
function updateAgoText() { function updateAgoText() {
ageLabel.agoText = MobileShell.NotificationsUtils.generateNotificationHeaderAgoText(time, jobState); ageLabel.agoText = MobileShell.NotificationsUtils.generateNotificationHeaderAgoText(time, jobState);
} }
font.pixelSize: Kirigami.Theme.defaultFont.pixelSize * 0.8 font.pixelSize: Kirigami.Theme.defaultFont.pixelSize * 0.8
// the "n minutes ago" text, for jobs we show remaining time instead // the "n minutes ago" text, for jobs we show remaining time instead

View file

@ -1,6 +1,6 @@
/* /*
* SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de> * SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>
* *
* SPDX-License-Identifier: LGPL-2.0-or-later * SPDX-License-Identifier: LGPL-2.0-or-later
*/ */

View file

@ -37,7 +37,7 @@ QQC2.StackView {
onWallpaperPluginConfigChanged: { onWallpaperPluginConfigChanged: {
onWallpaperConfigurationChanged(); onWallpaperConfigurationChanged();
} }
function onWallpaperConfigurationChanged() { function onWallpaperConfigurationChanged() {
let wallpaperConfig = root.wallpaperPluginConfig let wallpaperConfig = root.wallpaperPluginConfig
if (!wallpaperConfig || !root.currentItem) { if (!wallpaperConfig || !root.currentItem) {
@ -46,21 +46,21 @@ QQC2.StackView {
wallpaperConfig.keys().forEach(key => { wallpaperConfig.keys().forEach(key => {
const cfgKey = "cfg_" + key; const cfgKey = "cfg_" + key;
if (cfgKey in root.currentItem) { if (cfgKey in root.currentItem) {
var changedSignal = root.currentItem[cfgKey + "Changed"] var changedSignal = root.currentItem[cfgKey + "Changed"]
if (changedSignal) { if (changedSignal) {
changedSignal.disconnect(root.onConfigurationChanged); changedSignal.disconnect(root.onConfigurationChanged);
} }
root.currentItem[cfgKey] = wallpaperConfig[key]; root.currentItem[cfgKey] = wallpaperConfig[key];
changedSignal = root.currentItem[cfgKey + "Changed"] changedSignal = root.currentItem[cfgKey + "Changed"]
if (changedSignal) { if (changedSignal) {
changedSignal.connect(root.onConfigurationChanged) changedSignal.connect(root.onConfigurationChanged)
} }
} }
}) })
} }
function loadSourceFile() { function loadSourceFile() {
let wallpaperConfig = root.wallpaperPluginConfig; let wallpaperConfig = root.wallpaperPluginConfig;
let wallpaperPluginSource = root.wallpaperPluginSource; let wallpaperPluginSource = root.wallpaperPluginSource;
@ -71,16 +71,16 @@ QQC2.StackView {
"configDialog": root.configDialog, "configDialog": root.configDialog,
"wallpaperConfiguration": wallpaperConfig "wallpaperConfiguration": wallpaperConfig
}; };
wallpaperConfig.keys().forEach(key => { wallpaperConfig.keys().forEach(key => {
// Preview is not part of the config, only of the WallpaperObject // Preview is not part of the config, only of the WallpaperObject
if (!key.startsWith("Preview")) { if (!key.startsWith("Preview")) {
props["cfg_" + key] = wallpaperConfig[key]; props["cfg_" + key] = wallpaperConfig[key];
} }
}); });
var newItem = replace(Qt.resolvedUrl(wallpaperPluginSource), props) var newItem = replace(Qt.resolvedUrl(wallpaperPluginSource), props)
wallpaperConfig.keys().forEach(key => { wallpaperConfig.keys().forEach(key => {
const cfgKey = "cfg_" + key; const cfgKey = "cfg_" + key;
if (cfgKey in root.currentItem) { if (cfgKey in root.currentItem) {

View file

@ -15,7 +15,7 @@ ColumnLayout {
readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software
readonly property bool is24HourTime: MobileShell.ShellUtil.isSystem24HourFormat readonly property bool is24HourTime: MobileShell.ShellUtil.isSystem24HourFormat
spacing: 0 spacing: 0
Label { Label {
@ -23,9 +23,9 @@ ColumnLayout {
color: "white" color: "white"
style: softwareRendering ? Text.Outline : Text.Normal style: softwareRendering ? Text.Outline : Text.Normal
styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" // no outline, doesn't matter styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" // no outline, doesn't matter
Layout.fillWidth: true Layout.fillWidth: true
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
font.weight: Font.Bold // this font weight may switch to regular on distros that don't have a light variant font.weight: Font.Bold // this font weight may switch to regular on distros that don't have a light variant
@ -34,23 +34,23 @@ ColumnLayout {
layer.enabled: true layer.enabled: true
layer.effect: MobileShell.TextDropShadow {} layer.effect: MobileShell.TextDropShadow {}
} }
Label { Label {
Layout.topMargin: Kirigami.Units.smallSpacing Layout.topMargin: Kirigami.Units.smallSpacing
Layout.fillWidth: true Layout.fillWidth: true
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
text: Qt.formatDate(timeSource.data["Local"]["DateTime"], "ddd, MMM d") text: Qt.formatDate(timeSource.data["Local"]["DateTime"], "ddd, MMM d")
color: "white" color: "white"
style: softwareRendering ? Text.Outline : Text.Normal style: softwareRendering ? Text.Outline : Text.Normal
styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" // no outline, doesn't matter styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" // no outline, doesn't matter
font.pointSize: 12 font.pointSize: 12
layer.enabled: true layer.enabled: true
layer.effect: MobileShell.TextDropShadow {} layer.effect: MobileShell.TextDropShadow {}
} }
P5Support.DataSource { P5Support.DataSource {
id: timeSource id: timeSource
engine: "time" engine: "time"

View file

@ -16,10 +16,10 @@ import org.kde.private.mobile.homescreen.halcyon as Halcyon
MobileShell.GridView { MobileShell.GridView {
id: root id: root
required property var searchWidget required property var searchWidget
// don't set anchors.margins since we want everywhere to be draggable // don't set anchors.margins since we want everywhere to be draggable
required property bool twoColumn required property bool twoColumn
signal openConfigureRequested() signal openConfigureRequested()
signal requestOpenFolder(Halcyon.ApplicationFolder folder) signal requestOpenFolder(Halcyon.ApplicationFolder folder)
@ -27,7 +27,7 @@ MobileShell.GridView {
property bool openingSearchWidget: false property bool openingSearchWidget: false
property bool canOpenSearchWidget: false property bool canOpenSearchWidget: false
property real oldVerticalOvershoot: verticalOvershoot property real oldVerticalOvershoot: verticalOvershoot
onVerticalOvershootChanged: { onVerticalOvershootChanged: {
if (dragging && canOpenSearchWidget && verticalOvershoot < 0) { if (dragging && canOpenSearchWidget && verticalOvershoot < 0) {
if (!openingSearchWidget) { if (!openingSearchWidget) {
@ -55,7 +55,7 @@ MobileShell.GridView {
TapHandler { TapHandler {
onLongPressed: root.openConfigureRequested() onLongPressed: root.openConfigureRequested()
} }
header: MobileShell.BaseItem { header: MobileShell.BaseItem {
topPadding: Math.round(root.height * 0.2) topPadding: Math.round(root.height * 0.2)
bottomPadding: Kirigami.Units.gridUnit bottomPadding: Kirigami.Units.gridUnit
@ -69,12 +69,12 @@ MobileShell.GridView {
} }
contentItem: Clock {} contentItem: Clock {}
} }
Keys.onReturnPressed: currentItem.appDelegate.launch() Keys.onReturnPressed: currentItem.appDelegate.launch()
model: DelegateModel { model: DelegateModel {
id: visualModel id: visualModel
model: Halcyon.PinnedModel model: Halcyon.PinnedModel
delegate: Item { delegate: Item {
id: delegateRoot id: delegateRoot
property int visualIndex: DelegateModel.itemsIndex property int visualIndex: DelegateModel.itemsIndex
@ -82,21 +82,21 @@ MobileShell.GridView {
width: root.cellWidth width: root.cellWidth
height: root.cellHeight height: root.cellHeight
function moveDragToCurrentPos(from, to) { function moveDragToCurrentPos(from, to) {
if (from !== to) { if (from !== to) {
visualModel.items.move(from, to); visualModel.items.move(from, to);
Halcyon.PinnedModel.moveEntry(from, to); Halcyon.PinnedModel.moveEntry(from, to);
} }
} }
function topDragEnter(drag) { function topDragEnter(drag) {
if (transitionAnim.running || appDelegate.drag.active) return; // don't do anything when reordering if (transitionAnim.running || appDelegate.drag.active) return; // don't do anything when reordering
let fromIndex = drag.source.visualIndex; let fromIndex = drag.source.visualIndex;
let delegateVisualIndex = appDelegate.visualIndex; let delegateVisualIndex = appDelegate.visualIndex;
let reorderIndex = -1; let reorderIndex = -1;
if (fromIndex < delegateVisualIndex) { // dragged item from above if (fromIndex < delegateVisualIndex) { // dragged item from above
// move to spot above // move to spot above
reorderIndex = delegateVisualIndex - (root.twoColumn ? 2 : 1); reorderIndex = delegateVisualIndex - (root.twoColumn ? 2 : 1);
@ -104,19 +104,19 @@ MobileShell.GridView {
// move to current spot // move to current spot
reorderIndex = delegateVisualIndex; reorderIndex = delegateVisualIndex;
} }
if (reorderIndex >= 0 && reorderIndex < root.count) { if (reorderIndex >= 0 && reorderIndex < root.count) {
delegateRoot.moveDragToCurrentPos(fromIndex, reorderIndex) delegateRoot.moveDragToCurrentPos(fromIndex, reorderIndex)
} }
} }
function bottomDragEnter(drag) { function bottomDragEnter(drag) {
if (transitionAnim.running || appDelegate.drag.active) return; // don't do anything when reordering if (transitionAnim.running || appDelegate.drag.active) return; // don't do anything when reordering
let fromIndex = drag.source.visualIndex; let fromIndex = drag.source.visualIndex;
let delegateVisualIndex = appDelegate.visualIndex; let delegateVisualIndex = appDelegate.visualIndex;
let reorderIndex = -1; let reorderIndex = -1;
if (fromIndex < delegateVisualIndex) { // dragged item from above if (fromIndex < delegateVisualIndex) { // dragged item from above
// move to current spot // move to current spot
reorderIndex = delegateVisualIndex; reorderIndex = delegateVisualIndex;
@ -124,7 +124,7 @@ MobileShell.GridView {
// move to spot below // move to spot below
reorderIndex = delegateVisualIndex + (root.twoColumn ? 2 : 1); reorderIndex = delegateVisualIndex + (root.twoColumn ? 2 : 1);
} }
if (reorderIndex >= 0 && reorderIndex < root.count) { if (reorderIndex >= 0 && reorderIndex < root.count) {
delegateRoot.moveDragToCurrentPos(fromIndex, reorderIndex); delegateRoot.moveDragToCurrentPos(fromIndex, reorderIndex);
} }
@ -139,7 +139,7 @@ MobileShell.GridView {
height: delegateRoot.height * 0.2 height: delegateRoot.height * 0.2
onEntered: (drag) => delegateRoot.topDragEnter(drag) onEntered: (drag) => delegateRoot.topDragEnter(drag)
} }
// bottom drop area // bottom drop area
DropArea { DropArea {
id: bottomDropArea id: bottomDropArea
@ -149,7 +149,7 @@ MobileShell.GridView {
height: delegateRoot.height * 0.2 height: delegateRoot.height * 0.2
onEntered: (drag) => delegateRoot.bottomDragEnter(drag) onEntered: (drag) => delegateRoot.bottomDragEnter(drag)
} }
// left drop area // left drop area
DropArea { DropArea {
id: leftDropArea id: leftDropArea
@ -159,7 +159,7 @@ MobileShell.GridView {
width: root.twoColumn ? Math.max(appDelegate.leftPadding, delegateRoot.width * 0.1) : 0 width: root.twoColumn ? Math.max(appDelegate.leftPadding, delegateRoot.width * 0.1) : 0
onEntered: (drag) => delegateRoot.topDragEnter(drag) onEntered: (drag) => delegateRoot.topDragEnter(drag)
} }
// right drop area // right drop area
DropArea { DropArea {
id: rightDropArea id: rightDropArea
@ -169,7 +169,7 @@ MobileShell.GridView {
width: root.twoColumn ? Math.max(appDelegate.rightPadding, delegateRoot.width * 0.1) : 0 width: root.twoColumn ? Math.max(appDelegate.rightPadding, delegateRoot.width * 0.1) : 0
onEntered: (drag) => delegateRoot.bottomDragEnter(drag) onEntered: (drag) => delegateRoot.bottomDragEnter(drag)
} }
// folder drop area // folder drop area
DropArea { DropArea {
anchors.top: topDropArea.bottom anchors.top: topDropArea.bottom
@ -195,7 +195,7 @@ MobileShell.GridView {
folderAnim.to = 0; folderAnim.to = 0;
folderAnim.restart(); folderAnim.restart();
} }
NumberAnimation { NumberAnimation {
id: folderAnim id: folderAnim
target: appDelegate target: appDelegate
@ -203,18 +203,18 @@ MobileShell.GridView {
duration: 100 duration: 100
} }
} }
// actual visual delegate // actual visual delegate
FavoritesAppDelegate { FavoritesAppDelegate {
id: appDelegate id: appDelegate
visualIndex: delegateRoot.visualIndex visualIndex: delegateRoot.visualIndex
isFolder: model.isFolder isFolder: model.isFolder
folder: model.folder folder: model.folder
application: model.application application: model.application
onFolderOpenRequested: root.requestOpenFolder(model.folder) onFolderOpenRequested: root.requestOpenFolder(model.folder)
menuActions: [ menuActions: [
Kirigami.Action { Kirigami.Action {
icon.name: "emblem-favorite" icon.name: "emblem-favorite"
@ -222,13 +222,13 @@ MobileShell.GridView {
onTriggered: Halcyon.PinnedModel.removeEntry(model.index) onTriggered: Halcyon.PinnedModel.removeEntry(model.index)
} }
] ]
implicitWidth: root.cellWidth implicitWidth: root.cellWidth
implicitHeight: visible ? root.cellHeight : 0 implicitHeight: visible ? root.cellHeight : 0
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
states: [ states: [
State { State {
when: appDelegate.drag.active when: appDelegate.drag.active
@ -236,7 +236,7 @@ MobileShell.GridView {
target: appDelegate target: appDelegate
parent: root parent: root
} }
AnchorChanges { AnchorChanges {
target: appDelegate target: appDelegate
anchors.horizontalCenter: undefined anchors.horizontalCenter: undefined
@ -247,7 +247,7 @@ MobileShell.GridView {
} }
} }
} }
// animations // animations
displaced: Transition { displaced: Transition {
NumberAnimation { NumberAnimation {
@ -256,21 +256,21 @@ MobileShell.GridView {
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
} }
ColumnLayout { ColumnLayout {
id: placeholder id: placeholder
spacing: Kirigami.Units.gridUnit spacing: Kirigami.Units.gridUnit
visible: root.count == 0 visible: root.count == 0
opacity: 0.9 opacity: 0.9
anchors.fill: parent anchors.fill: parent
anchors.topMargin: Math.round(swipeView.height * 0.2) - (root.contentY - root.originY) anchors.topMargin: Math.round(swipeView.height * 0.2) - (root.contentY - root.originY)
anchors.leftMargin: root.leftMargin anchors.leftMargin: root.leftMargin
anchors.rightMargin: root.rightMargin anchors.rightMargin: root.rightMargin
layer.enabled: true layer.enabled: true
layer.effect: MobileShell.TextDropShadow {} layer.effect: MobileShell.TextDropShadow {}
Kirigami.Icon { Kirigami.Icon {
id: icon id: icon
Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter
@ -279,7 +279,7 @@ MobileShell.GridView {
source: "arrow-left" source: "arrow-left"
color: "white" color: "white"
} }
Kirigami.Heading { Kirigami.Heading {
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumWidth: placeholder.width * 0.75 Layout.maximumWidth: placeholder.width * 0.75
@ -290,7 +290,7 @@ MobileShell.GridView {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: i18n("Add applications to your favourites so they show up here.") text: i18n("Add applications to your favourites so they show up here.")
} }
TapHandler { TapHandler {
onLongPressed: root.openConfigureRequested() onLongPressed: root.openConfigureRequested()
} }

View file

@ -19,22 +19,22 @@ Item {
required property bool interactive required property bool interactive
required property var searchWidget required property var searchWidget
readonly property real twoColumnThreshold: Kirigami.Units.gridUnit * 16 readonly property real twoColumnThreshold: Kirigami.Units.gridUnit * 16
readonly property bool twoColumn: root.width / 2 > twoColumnThreshold readonly property bool twoColumn: root.width / 2 > twoColumnThreshold
readonly property real cellWidth: twoColumn ? (root.width - leftMargin - rightMargin) / 2 : (root.width - leftMargin - rightMargin) readonly property real cellWidth: twoColumn ? (root.width - leftMargin - rightMargin) / 2 : (root.width - leftMargin - rightMargin)
readonly property real cellHeight: delegateHeight readonly property real cellHeight: delegateHeight
readonly property real leftMargin: Math.round(width * 0.1) readonly property real leftMargin: Math.round(width * 0.1)
readonly property real rightMargin: Math.round(width * 0.1) readonly property real rightMargin: Math.round(width * 0.1)
readonly property real delegateHeight: Math.round(Kirigami.Units.gridUnit * 3) readonly property real delegateHeight: Math.round(Kirigami.Units.gridUnit * 3)
property bool folderShown: false property bool folderShown: false
signal openConfigureRequested() signal openConfigureRequested()
signal pageForwardRequested(); signal pageForwardRequested();
Connections { Connections {
target: parent target: parent
@ -46,12 +46,12 @@ Item {
function goToBeginning() { function goToBeginning() {
goToBeginningAnim.restart(); goToBeginningAnim.restart();
} }
function closeFolder() { function closeFolder() {
folderShown = false; folderShown = false;
closeFolderAnim.restart() closeFolderAnim.restart()
} }
function openFolder() { function openFolder() {
folderShown = true; folderShown = true;
openFolderAnim.restart() openFolderAnim.restart()
@ -60,29 +60,29 @@ Item {
function resetHighlight() { function resetHighlight() {
favoritesGrid.currentIndex = -1; favoritesGrid.currentIndex = -1;
} }
FavoritesGrid { FavoritesGrid {
id: favoritesGrid id: favoritesGrid
property real openFolderProgress: 0 property real openFolderProgress: 0
anchors.fill: parent anchors.fill: parent
interactive: root.interactive interactive: root.interactive
searchWidget: root.searchWidget searchWidget: root.searchWidget
cellWidth: root.cellWidth cellWidth: root.cellWidth
cellHeight: root.cellHeight cellHeight: root.cellHeight
leftMargin: root.leftMargin leftMargin: root.leftMargin
rightMargin: root.rightMargin rightMargin: root.rightMargin
twoColumn: root.twoColumn twoColumn: root.twoColumn
onOpenConfigureRequested: root.openConfigureRequested() onOpenConfigureRequested: root.openConfigureRequested()
onRequestOpenFolder: (folder) => { onRequestOpenFolder: (folder) => {
folderGrid.folder = folder; folderGrid.folder = folder;
root.openFolder(); root.openFolder();
} }
property real translateX: openFolderProgress * -Kirigami.Units.gridUnit property real translateX: openFolderProgress * -Kirigami.Units.gridUnit
transform: Translate { x: favoritesGrid.translateX } transform: Translate { x: favoritesGrid.translateX }
opacity: 1 - openFolderProgress opacity: 1 - openFolderProgress
@ -92,46 +92,46 @@ Item {
pageForwardRequested(); pageForwardRequested();
} }
} }
FolderGrid { FolderGrid {
id: folderGrid id: folderGrid
property real openProgress: 0 property real openProgress: 0
anchors.fill: parent anchors.fill: parent
folder: null folder: null
interactive: root.interactive interactive: root.interactive
cellWidth: root.cellWidth cellWidth: root.cellWidth
cellHeight: root.cellHeight cellHeight: root.cellHeight
leftMargin: root.leftMargin leftMargin: root.leftMargin
rightMargin: root.rightMargin rightMargin: root.rightMargin
twoColumn: root.twoColumn twoColumn: root.twoColumn
onOpenConfigureRequested: root.openConfigureRequested() onOpenConfigureRequested: root.openConfigureRequested()
onCloseRequested: root.closeFolder() onCloseRequested: root.closeFolder()
property real translateX: (1 - openProgress) * Kirigami.Units.gridUnit property real translateX: (1 - openProgress) * Kirigami.Units.gridUnit
transform: Translate { x: folderGrid.translateX } transform: Translate { x: folderGrid.translateX }
opacity: openProgress opacity: openProgress
visible: opacity !== 0 visible: opacity !== 0
} }
// handle horizontal dragging in a folder // handle horizontal dragging in a folder
DragHandler { DragHandler {
id: dragHandler id: dragHandler
target: folderGrid target: folderGrid
enabled: folderGrid.visible enabled: folderGrid.visible
yAxis.enabled: false yAxis.enabled: false
xAxis.enabled: true xAxis.enabled: true
grabPermissions: PointerHandler.TakeOverForbidden grabPermissions: PointerHandler.TakeOverForbidden
property real oldTranslationX property real oldTranslationX
property bool isClosing: false property bool isClosing: false
// when dragged // when dragged
onTranslationChanged: { onTranslationChanged: {
let moveAmount = Math.max(0, translation.x) / (Kirigami.Units.gridUnit * 5); let moveAmount = Math.max(0, translation.x) / (Kirigami.Units.gridUnit * 5);
@ -139,7 +139,7 @@ Item {
isClosing = translation.x > oldTranslationX; isClosing = translation.x > oldTranslationX;
oldTranslationX = translation.x; oldTranslationX = translation.x;
} }
// when drag is let go // when drag is let go
onActiveChanged: { onActiveChanged: {
if (!active) { if (!active) {
@ -147,7 +147,7 @@ Item {
} }
} }
} }
NumberAnimation { NumberAnimation {
id: goToBeginningAnim id: goToBeginningAnim
target: favoritesGrid target: favoritesGrid
@ -156,10 +156,10 @@ Item {
duration: 200 duration: 200
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
SequentialAnimation { SequentialAnimation {
id: openFolderAnim id: openFolderAnim
ParallelAnimation { ParallelAnimation {
NumberAnimation { NumberAnimation {
target: favoritesGrid target: favoritesGrid
@ -169,7 +169,7 @@ Item {
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
ParallelAnimation { ParallelAnimation {
NumberAnimation { NumberAnimation {
target: folderGrid target: folderGrid
@ -180,10 +180,10 @@ Item {
} }
} }
} }
SequentialAnimation { SequentialAnimation {
id: closeFolderAnim id: closeFolderAnim
ParallelAnimation { ParallelAnimation {
NumberAnimation { NumberAnimation {
target: folderGrid target: folderGrid
@ -193,7 +193,7 @@ Item {
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
ParallelAnimation { ParallelAnimation {
NumberAnimation { NumberAnimation {
target: favoritesGrid target: favoritesGrid

View file

@ -17,22 +17,22 @@ import org.kde.private.mobile.homescreen.halcyon as Halcyon
MobileShell.GridView { MobileShell.GridView {
id: root id: root
property Halcyon.ApplicationFolder folder: null property Halcyon.ApplicationFolder folder: null
property string folderName: folder ? folder.name : "" property string folderName: folder ? folder.name : ""
property var folderModel: folder ? folder.applications : [] property var folderModel: folder ? folder.applications : []
required property bool twoColumn required property bool twoColumn
signal openConfigureRequested() signal openConfigureRequested()
signal closeRequested() signal closeRequested()
property bool inFolderTitleEditMode: false property bool inFolderTitleEditMode: false
TapHandler { TapHandler {
onLongPressed: root.openConfigureRequested() onLongPressed: root.openConfigureRequested()
onTapped: root.closeRequested() onTapped: root.closeRequested()
} }
header: MobileShell.BaseItem { header: MobileShell.BaseItem {
topPadding: Math.round(root.height * 0.2) topPadding: Math.round(root.height * 0.2)
bottomPadding: Kirigami.Units.gridUnit bottomPadding: Kirigami.Units.gridUnit
@ -42,29 +42,29 @@ MobileShell.GridView {
background: Rectangle { background: Rectangle {
color: 'transparent' color: 'transparent'
TapHandler { TapHandler {
onLongPressed: root.openConfigureRequested() onLongPressed: root.openConfigureRequested()
onTapped: root.closeRequested() onTapped: root.closeRequested()
} }
} }
Component { Component {
id: folderTitleEdit id: folderTitleEdit
TextEdit { TextEdit {
text: root.folderName text: root.folderName
color: "white" color: "white"
selectByMouse: true selectByMouse: true
wrapMode: TextEdit.Wrap wrapMode: TextEdit.Wrap
Component.onCompleted: forceActiveFocus() Component.onCompleted: forceActiveFocus()
font.weight: Font.Bold font.weight: Font.Bold
font.pointSize: 18 font.pointSize: 18
layer.enabled: true layer.enabled: true
layer.effect: MobileShell.TextDropShadow {} layer.effect: MobileShell.TextDropShadow {}
onTextChanged: { onTextChanged: {
if (text.includes('\n')) { if (text.includes('\n')) {
// exit text edit mode when new line is entered // exit text edit mode when new line is entered
@ -76,10 +76,10 @@ MobileShell.GridView {
onEditingFinished: root.inFolderTitleEditMode = false onEditingFinished: root.inFolderTitleEditMode = false
} }
} }
Component { Component {
id: folderTitleLabel id: folderTitleLabel
QQC2.Label { QQC2.Label {
text: root.folderName text: root.folderName
color: "white" color: "white"
@ -87,7 +87,7 @@ MobileShell.GridView {
styleColor: "transparent" styleColor: "transparent"
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
textFormat: Text.MarkdownText textFormat: Text.MarkdownText
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.Wrap wrapMode: Text.Wrap
maximumLineCount: 2 maximumLineCount: 2
@ -97,35 +97,35 @@ MobileShell.GridView {
layer.enabled: true layer.enabled: true
layer.effect: MobileShell.TextDropShadow {} layer.effect: MobileShell.TextDropShadow {}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: root.inFolderTitleEditMode = true onClicked: root.inFolderTitleEditMode = true
} }
} }
} }
contentItem: RowLayout { contentItem: RowLayout {
id: rowLayout id: rowLayout
spacing: Kirigami.Units.smallSpacing * 2 spacing: Kirigami.Units.smallSpacing * 2
// close folder button // close folder button
MouseArea { MouseArea {
id: button id: button
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
implicitHeight: Kirigami.Units.iconSizes.small + Kirigami.Units.gridUnit implicitHeight: Kirigami.Units.iconSizes.small + Kirigami.Units.gridUnit
implicitWidth: Kirigami.Units.iconSizes.small + Kirigami.Units.gridUnit implicitWidth: Kirigami.Units.iconSizes.small + Kirigami.Units.gridUnit
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: root.closeRequested() onClicked: root.closeRequested()
// button background // button background
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Qt.rgba(255, 255, 255, button.pressed ? 0.2 : 0) color: Qt.rgba(255, 255, 255, button.pressed ? 0.2 : 0)
radius: button.width / 2 radius: button.width / 2
} }
// button icon // button icon
Kirigami.Icon { Kirigami.Icon {
anchors.centerIn: parent anchors.centerIn: parent
@ -144,7 +144,7 @@ MobileShell.GridView {
} }
} }
} }
// folder title // folder title
Loader { Loader {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
@ -154,18 +154,18 @@ MobileShell.GridView {
} }
} }
} }
model: DelegateModel { model: DelegateModel {
id: visualModel id: visualModel
model: root.folderModel model: root.folderModel
delegate: Item { delegate: Item {
id: delegateRoot id: delegateRoot
width: root.cellWidth width: root.cellWidth
height: root.cellHeight height: root.cellHeight
property int visualIndex: DelegateModel.itemsIndex property int visualIndex: DelegateModel.itemsIndex
DropArea { DropArea {
anchors.fill: parent anchors.fill: parent
onEntered: (drag) => { onEntered: (drag) => {
@ -175,14 +175,14 @@ MobileShell.GridView {
root.folder.moveEntry(from, to); root.folder.moveEntry(from, to);
} }
} }
FavoritesAppDelegate { FavoritesAppDelegate {
id: appDelegate id: appDelegate
visualIndex: delegateRoot.visualIndex visualIndex: delegateRoot.visualIndex
isFolder: false isFolder: false
application: model.application application: model.application
menuActions: [ menuActions: [
Kirigami.Action { Kirigami.Action {
icon.name: "emblem-favorite" icon.name: "emblem-favorite"
@ -195,13 +195,13 @@ MobileShell.GridView {
onTriggered: root.folder.moveAppOut(model.index) onTriggered: root.folder.moveAppOut(model.index)
} }
] ]
implicitWidth: root.cellWidth implicitWidth: root.cellWidth
implicitHeight: visible ? root.cellHeight : 0 implicitHeight: visible ? root.cellHeight : 0
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
states: [ states: [
State { State {
when: appDelegate.drag.active when: appDelegate.drag.active
@ -209,7 +209,7 @@ MobileShell.GridView {
target: appDelegate target: appDelegate
parent: root parent: root
} }
AnchorChanges { AnchorChanges {
target: appDelegate target: appDelegate
anchors.horizontalCenter: undefined anchors.horizontalCenter: undefined
@ -220,7 +220,7 @@ MobileShell.GridView {
} }
} }
} }
// animations // animations
displaced: Transition { displaced: Transition {
NumberAnimation { NumberAnimation {

View file

@ -25,23 +25,23 @@ MouseArea {
height: GridView.view.cellHeight height: GridView.view.cellHeight
property Halcyon.Application application: model.application property Halcyon.Application application: model.application
property int reservedSpaceForLabel property int reservedSpaceForLabel
property alias iconItem: icon property alias iconItem: icon
readonly property real margins: Math.floor(width * 0.2) readonly property real margins: Math.floor(width * 0.2)
signal launch(int x, int y, var source, string title, string storageId) signal launch(int x, int y, var source, string title, string storageId)
function openContextMenu() { function openContextMenu() {
dialogLoader.active = true; dialogLoader.active = true;
dialogLoader.item.open(); dialogLoader.item.open();
} }
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressAndHold: openContextMenu() onPressAndHold: openContextMenu()
function launchApp() { function launchApp() {
// launch app // launch app
if (application.running) { if (application.running) {
@ -50,15 +50,15 @@ MouseArea {
delegate.launch(delegate.x + (Kirigami.Units.smallSpacing * 2), delegate.y + (Kirigami.Units.smallSpacing * 2), icon.source, application.name, application.storageId); delegate.launch(delegate.x + (Kirigami.Units.smallSpacing * 2), delegate.y + (Kirigami.Units.smallSpacing * 2), icon.source, application.name, application.storageId);
} }
} }
Loader { Loader {
id: dialogLoader id: dialogLoader
active: false active: false
sourceComponent: PlasmaComponents.Menu { sourceComponent: PlasmaComponents.Menu {
title: label.text title: label.text
closePolicy: PlasmaComponents.Menu.CloseOnReleaseOutside | PlasmaComponents.Menu.CloseOnEscape closePolicy: PlasmaComponents.Menu.CloseOnReleaseOutside | PlasmaComponents.Menu.CloseOnEscape
PlasmaComponents.MenuItem { PlasmaComponents.MenuItem {
icon.name: "emblem-favorite" icon.name: "emblem-favorite"
text: i18n("Add to favourites") text: i18n("Add to favourites")
@ -72,15 +72,15 @@ MouseArea {
// grow/shrink animation // grow/shrink animation
property real zoomScale: 1 property real zoomScale: 1
transform: Scale { transform: Scale {
origin.x: delegate.width / 2; origin.x: delegate.width / 2;
origin.y: delegate.height / 2; origin.y: delegate.height / 2;
xScale: delegate.zoomScale xScale: delegate.zoomScale
yScale: delegate.zoomScale yScale: delegate.zoomScale
} }
property bool launchAppRequested: false property bool launchAppRequested: false
NumberAnimation on zoomScale { NumberAnimation on zoomScale {
id: shrinkAnim id: shrinkAnim
running: false running: false
@ -92,7 +92,7 @@ MouseArea {
} }
} }
} }
NumberAnimation on zoomScale { NumberAnimation on zoomScale {
id: growAnim id: growAnim
running: false running: false
@ -105,7 +105,7 @@ MouseArea {
} }
} }
} }
onPressedChanged: { onPressedChanged: {
if (pressed) { if (pressed) {
growAnim.stop(); growAnim.stop();
@ -122,7 +122,7 @@ MouseArea {
launchAppRequested = true; launchAppRequested = true;
} }
} }
ColumnLayout { ColumnLayout {
anchors { anchors {
fill: parent fill: parent
@ -138,7 +138,7 @@ MouseArea {
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: Math.floor(parent.height - delegate.reservedSpaceForLabel) Layout.preferredHeight: Math.floor(parent.height - delegate.reservedSpaceForLabel)
@ -158,7 +158,7 @@ MouseArea {
height: width height: width
color: Kirigami.Theme.highlightColor color: Kirigami.Theme.highlightColor
} }
// darken effect when hovered/pressed // darken effect when hovered/pressed
layer { layer {
enabled: delegate.pressed enabled: delegate.pressed
@ -167,7 +167,7 @@ MouseArea {
colorizationColor: Qt.rgba(0, 0, 0, 0.3) colorizationColor: Qt.rgba(0, 0, 0, 0.3)
} }
} }
FontMetrics { FontMetrics {
id: labelFontMetrics id: labelFontMetrics
font: label.font font: label.font
@ -183,7 +183,7 @@ MouseArea {
Layout.topMargin: Kirigami.Units.smallSpacing Layout.topMargin: Kirigami.Units.smallSpacing
Layout.leftMargin: -parent.anchors.leftMargin + Kirigami.Units.smallSpacing Layout.leftMargin: -parent.anchors.leftMargin + Kirigami.Units.smallSpacing
Layout.rightMargin: -parent.anchors.rightMargin + Kirigami.Units.smallSpacing Layout.rightMargin: -parent.anchors.rightMargin + Kirigami.Units.smallSpacing
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
maximumLineCount: 2 maximumLineCount: 2
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter

View file

@ -14,18 +14,18 @@ Kirigami.PromptDialog {
property string headingText property string headingText
property string devicePath property string devicePath
property string specificPath property string specificPath
signal donePressed(string password) signal donePressed(string password)
function openAndClear() { function openAndClear() {
warning.visible = false; warning.visible = false;
this.open(); this.open();
passwordField.text = ""; passwordField.text = "";
passwordField.focus = true; passwordField.focus = true;
} }
standardButtons: Controls.Dialog.Ok | Controls.Dialog.Cancel standardButtons: Controls.Dialog.Ok | Controls.Dialog.Cancel
onOpened: passwordField.forceActiveFocus() onOpened: passwordField.forceActiveFocus()
onRejected: { onRejected: {
dialogRoot.close(); dialogRoot.close();
@ -40,23 +40,23 @@ Kirigami.PromptDialog {
} }
passwordField.focus = false; passwordField.focus = false;
} }
ColumnLayout { ColumnLayout {
id: column id: column
spacing: Kirigami.Units.largeSpacing spacing: Kirigami.Units.largeSpacing
PasswordField { PasswordField {
id: passwordField id: passwordField
Layout.fillWidth: true Layout.fillWidth: true
securityType: dialogRoot.securityType securityType: dialogRoot.securityType
onAccepted: dialogRoot.accept() onAccepted: dialogRoot.accept()
} }
Controls.Label { Controls.Label {
id: warning id: warning
text: i18n("Invalid input.") text: i18n("Invalid input.")
visible: false visible: false
} }
} }
} }

View file

@ -32,7 +32,7 @@ FormCard.AbstractFormDelegate {
Layout.rightMargin: Kirigami.Units.gridUnit Layout.rightMargin: Kirigami.Units.gridUnit
implicitWidth: Kirigami.Units.iconSizes.smallMedium implicitWidth: Kirigami.Units.iconSizes.smallMedium
implicitHeight: Kirigami.Units.iconSizes.smallMedium implicitHeight: Kirigami.Units.iconSizes.smallMedium
Kirigami.Icon { Kirigami.Icon {
implicitWidth: Kirigami.Units.iconSizes.smallMedium implicitWidth: Kirigami.Units.iconSizes.smallMedium
implicitHeight: Kirigami.Units.iconSizes.smallMedium implicitHeight: Kirigami.Units.iconSizes.smallMedium
@ -55,7 +55,7 @@ FormCard.AbstractFormDelegate {
font.bold: ConnectionState === PlasmaNM.Enums.Activated font.bold: ConnectionState === PlasmaNM.Enums.Activated
Accessible.ignored: true // base class sets this text on root already Accessible.ignored: true // base class sets this text on root already
} }
RowLayout { RowLayout {
Kirigami.Icon { Kirigami.Icon {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter

View file

@ -93,11 +93,11 @@ Item {
model: mobileProxyModel model: mobileProxyModel
delegate: ConnectionItemDelegate { delegate: ConnectionItemDelegate {
editMode: false editMode: false
// connected or saved // connected or saved
property bool shouldDisplay: (Uuid != "") || ConnectionState === PlasmaNM.Enums.Activated property bool shouldDisplay: (Uuid != "") || ConnectionState === PlasmaNM.Enums.Activated
onShouldDisplayChanged: savedCard.updateCount() onShouldDisplayChanged: savedCard.updateCount()
// separate property for visible since visible is false when the whole card is not visible // separate property for visible since visible is false when the whole card is not visible
visible: (Uuid != "") || ConnectionState === PlasmaNM.Enums.Activated visible: (Uuid != "") || ConnectionState === PlasmaNM.Enums.Activated
} }

View file

@ -50,10 +50,10 @@ Item {
const darkWallpaperFolder = 'wallpapers/Next/contents/images_dark/'; const darkWallpaperFolder = 'wallpapers/Next/contents/images_dark/';
const wallpaperUrl = StandardPaths.locate( const wallpaperUrl = StandardPaths.locate(
StandardPaths.GenericDataLocation, StandardPaths.GenericDataLocation,
(Prepare.PrepareUtil.usingDarkTheme ? darkWallpaperFolder : lightWallpaperFolder) + imgFile (Prepare.PrepareUtil.usingDarkTheme ? darkWallpaperFolder : lightWallpaperFolder) + imgFile
); );
if (!wallpaperUrl) { if (!wallpaperUrl) {
return StandardPaths.locate(StandardPaths.GenericDataLocation, lightWallpaperFolder + imgFile); return StandardPaths.locate(StandardPaths.GenericDataLocation, lightWallpaperFolder + imgFile);
} }

View file

@ -4,7 +4,7 @@
kcmutils_add_qml_kcm(kcm_cellular_network) kcmutils_add_qml_kcm(kcm_cellular_network)
target_sources(kcm_cellular_network PRIVATE target_sources(kcm_cellular_network PRIVATE
cellularnetworksettings.cpp cellularnetworksettings.cpp
modem.cpp modem.cpp
modemdetails.cpp modemdetails.cpp
sim.cpp sim.cpp

View file

@ -14,7 +14,7 @@ import cellularnetworkkcm 1.0
Kirigami.ScrollablePage { Kirigami.ScrollablePage {
id: root id: root
title: i18n("Available Networks") title: i18n("Available Networks")
property Modem modem property Modem modem
property Sim sim property Sim sim
@ -24,7 +24,7 @@ Kirigami.ScrollablePage {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
spacing: 0 spacing: 0
MessagesList { MessagesList {
visible: count != 0 visible: count != 0
Layout.fillWidth: true Layout.fillWidth: true
@ -32,7 +32,7 @@ Kirigami.ScrollablePage {
model: kcm.messages model: kcm.messages
} }
} }
Kirigami.PlaceholderMessage { Kirigami.PlaceholderMessage {
anchors.centerIn: parent anchors.centerIn: parent
visible: !modem.details.isScanningNetworks && listView.count == 0 visible: !modem.details.isScanningNetworks && listView.count == 0
@ -45,16 +45,16 @@ Kirigami.ScrollablePage {
onTriggered: modem.details.scanNetworks() onTriggered: modem.details.scanNetworks()
} }
} }
Controls.BusyIndicator { Controls.BusyIndicator {
anchors.centerIn: parent anchors.centerIn: parent
visible: modem.details.isScanningNetworks visible: modem.details.isScanningNetworks
implicitWidth: Kirigami.Units.iconSizes.large implicitWidth: Kirigami.Units.iconSizes.large
implicitHeight: implicitWidth implicitHeight: implicitWidth
} }
model: modem.details.networks model: modem.details.networks
delegate: FormCard.FormRadioDelegate { delegate: FormCard.FormRadioDelegate {
checked: modelData.isCurrentlyUsed checked: modelData.isCurrentlyUsed

View file

@ -18,13 +18,13 @@ FormCard.FormCardPage {
bottomPadding: Kirigami.Units.gridUnit bottomPadding: Kirigami.Units.gridUnit
leftPadding: 0 leftPadding: 0
rightPadding: 0 rightPadding: 0
property Modem modem property Modem modem
property ProfileSettings profile property ProfileSettings profile
FormCard.FormCard { FormCard.FormCard {
Layout.topMargin: Kirigami.Units.gridUnit Layout.topMargin: Kirigami.Units.gridUnit
FormCard.FormTextFieldDelegate { FormCard.FormTextFieldDelegate {
id: profileName id: profileName
label: i18n("Name") label: i18n("Name")

View file

@ -11,17 +11,17 @@ import cellularnetworkkcm 1.0
ColumnLayout { ColumnLayout {
id: root id: root
property var model property var model
property alias count: repeater.count property alias count: repeater.count
spacing: 0 spacing: 0
visible: count > 0 visible: count > 0
Repeater { Repeater {
id: repeater id: repeater
model: root.model model: root.model
delegate: Kirigami.InlineMessage { delegate: Kirigami.InlineMessage {
Layout.bottomMargin: Kirigami.Units.largeSpacing Layout.bottomMargin: Kirigami.Units.largeSpacing
Layout.fillWidth: true Layout.fillWidth: true
@ -34,9 +34,9 @@ ColumnLayout {
case InlineMessage.Warning: return Kirigami.MessageType.Warning; case InlineMessage.Warning: return Kirigami.MessageType.Warning;
case InlineMessage.Error: return Kirigami.MessageType.Error; case InlineMessage.Error: return Kirigami.MessageType.Error;
} }
return Kirigami.MessageType.Error; return Kirigami.MessageType.Error;
} }
actions: [ actions: [
Kirigami.Action { Kirigami.Action {
icon.name: "dialog-close" icon.name: "dialog-close"

View file

@ -9,24 +9,24 @@ import org.kde.kirigami 2.12 as Kirigami
Controls.Dialog { Controls.Dialog {
id: dialog id: dialog
anchors.centerIn: Controls.Overlay.overlay anchors.centerIn: Controls.Overlay.overlay
modal: true modal: true
padding: Kirigami.Units.smallSpacing padding: Kirigami.Units.smallSpacing
closePolicy: Controls.Popup.CloseOnEscape | Controls.Popup.CloseOnReleaseOutside closePolicy: Controls.Popup.CloseOnEscape | Controls.Popup.CloseOnReleaseOutside
property int translateY: (1 - opacity) * Kirigami.Units.gridUnit * 2 property int translateY: (1 - opacity) * Kirigami.Units.gridUnit * 2
NumberAnimation on opacity { NumberAnimation on opacity {
from: 0; to: 1; from: 0; to: 1;
duration: Kirigami.Units.veryShortDuration duration: Kirigami.Units.veryShortDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
running: true running: true
} }
contentItem.transform: Translate { y: dialog.translateY } contentItem.transform: Translate { y: dialog.translateY }
footer.transform: Translate { y: dialog.translateY } footer.transform: Translate { y: dialog.translateY }
header: Item { header: Item {
transform: Translate { y: dialog.translateY } transform: Translate { y: dialog.translateY }
implicitHeight: heading.implicitHeight + Kirigami.Units.largeSpacing * 2 implicitHeight: heading.implicitHeight + Kirigami.Units.largeSpacing * 2
@ -40,7 +40,7 @@ Controls.Dialog {
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: Kirigami.Units.largeSpacing anchors.leftMargin: Kirigami.Units.largeSpacing
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
// use tooltip for long text that is elided // use tooltip for long text that is elided
Controls.ToolTip.visible: truncated && titleHoverHandler.hovered Controls.ToolTip.visible: truncated && titleHoverHandler.hovered
Controls.ToolTip.text: dialog.title Controls.ToolTip.text: dialog.title
@ -49,10 +49,10 @@ Controls.Dialog {
} }
} }
} }
background: Item { background: Item {
transform: Translate { y: dialog.translateY } transform: Translate { y: dialog.translateY }
RectangularGlow { RectangularGlow {
anchors.fill: rect anchors.fill: rect
anchors.topMargin: 1 anchors.topMargin: 1
@ -68,7 +68,7 @@ Controls.Dialog {
Kirigami.Theme.colorSet: Kirigami.Theme.Window Kirigami.Theme.colorSet: Kirigami.Theme.Window
color: Kirigami.Theme.backgroundColor color: Kirigami.Theme.backgroundColor
radius: Kirigami.Units.smallSpacing radius: Kirigami.Units.smallSpacing
Kirigami.Separator { Kirigami.Separator {
id: topSeparator id: topSeparator
anchors.left: parent.left anchors.left: parent.left
@ -76,7 +76,7 @@ Controls.Dialog {
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: dialog.header.implicitHeight anchors.topMargin: dialog.header.implicitHeight
} }
Kirigami.Separator { Kirigami.Separator {
id: bottomSeparator id: bottomSeparator
anchors.left: parent.left anchors.left: parent.left
@ -84,7 +84,7 @@ Controls.Dialog {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: dialog.footer.implicitHeight anchors.bottomMargin: dialog.footer.implicitHeight
} }
Rectangle { Rectangle {
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.colorSet: Kirigami.Theme.View
@ -95,6 +95,6 @@ Controls.Dialog {
anchors.bottom: bottomSeparator.top anchors.bottom: bottomSeparator.top
} }
} }
} }
} }

View file

@ -19,7 +19,7 @@ Kirigami.ScrollablePage {
property Modem modem property Modem modem
property bool editMode: false property bool editMode: false
title: i18n("APNs") title: i18n("APNs")
actions: [ actions: [
Kirigami.Action { Kirigami.Action {
@ -40,18 +40,18 @@ Kirigami.ScrollablePage {
Layout.margins: Kirigami.Units.largeSpacing Layout.margins: Kirigami.Units.largeSpacing
model: kcm.messages model: kcm.messages
} }
Kirigami.InlineMessage { Kirigami.InlineMessage {
id: cannotFindWarning id: cannotFindWarning
Layout.margins: visible ? Kirigami.Units.largeSpacing : 0 Layout.margins: visible ? Kirigami.Units.largeSpacing : 0
Layout.topMargin: visible && !messagesList.visible ? Kirigami.Units.largeSpacing : 0 Layout.topMargin: visible && !messagesList.visible ? Kirigami.Units.largeSpacing : 0
Layout.fillWidth: true Layout.fillWidth: true
visible: false visible: false
type: Kirigami.MessageType.Warning type: Kirigami.MessageType.Warning
showCloseButton: true showCloseButton: true
text: i18n("Unable to autodetect connection settings for your carrier. Please find your carrier's APN settings by either contacting support or searching online.") text: i18n("Unable to autodetect connection settings for your carrier. Please find your carrier's APN settings by either contacting support or searching online.")
Connections { Connections {
target: modem target: modem
function onCouldNotAutodetectSettings() { function onCouldNotAutodetectSettings() {
@ -59,7 +59,7 @@ Kirigami.ScrollablePage {
} }
} }
} }
FormCard.FormHeader { FormCard.FormHeader {
title: i18n("APN List") title: i18n("APN List")
} }
@ -110,7 +110,7 @@ Kirigami.ScrollablePage {
kcm.push("EditProfilePage.qml", { "profile": null, "modem": modem }); kcm.push("EditProfilePage.qml", { "profile": null, "modem": modem });
} }
} }
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
text: i18n("Automatically detect APN") text: i18n("Automatically detect APN")
icon.name: 'list-add' icon.name: 'list-add'

View file

@ -3,7 +3,7 @@
kcmutils_add_qml_kcm(kcm_mobile_info) kcmutils_add_qml_kcm(kcm_mobile_info)
target_sources(kcm_mobile_info PRIVATE target_sources(kcm_mobile_info PRIVATE
info.cpp info.cpp
distroinfo.cpp distroinfo.cpp
softwareinfo.cpp softwareinfo.cpp

View file

@ -20,13 +20,13 @@ Canvas
{ {
id: canvas id: canvas
antialiasing: true antialiasing: true
readonly property real xTicksAtDontCare: 0 readonly property real xTicksAtDontCare: 0
readonly property real xTicksAtTwelveOClock: 1 readonly property real xTicksAtTwelveOClock: 1
readonly property real xTicksAtFullHour: 2 readonly property real xTicksAtFullHour: 2
readonly property real xTicksAtHalfHour: 3 readonly property real xTicksAtHalfHour: 3
readonly property real xTicksAtFullSecondHour: 4 readonly property real xTicksAtFullSecondHour: 4
readonly property real xTicksAtTenMinutes: 5 readonly property real xTicksAtTenMinutes: 5
readonly property real xTicksAtFullTwoHours: 6 readonly property real xTicksAtFullTwoHours: 6
property int xPadding: 45 property int xPadding: 45
@ -115,7 +115,7 @@ Canvas
c.lineTo(point.x, point.y) c.lineTo(point.x, point.y)
} }
} }
c.stroke(); c.stroke();
c.strokeStyle = 'rgba(0, 0, 0, 0)'; c.strokeStyle = 'rgba(0, 0, 0, 0)';
c.lineTo(point.x, height - yPadding); c.lineTo(point.x, height - yPadding);
@ -164,7 +164,7 @@ Canvas
var hours = currentDateTime.getHours() var hours = currentDateTime.getHours()
var minutes = currentDateTime.getMinutes() var minutes = currentDateTime.getMinutes()
var seconds = currentDateTime.getSeconds() var seconds = currentDateTime.getSeconds()
var diff var diff
switch (xTicksAt) { switch (xTicksAt) {
@ -188,7 +188,7 @@ Canvas
} }
var xGridOffset = plotWidth * (diff / xDuration) var xGridOffset = plotWidth * (diff / xDuration)
var dateChanged = false var dateChanged = false
var dashedLines = 50 var dashedLines = 50
var dashedLineLength = plotHeight / dashedLines var dashedLineLength = plotHeight / dashedLines
@ -197,7 +197,7 @@ Canvas
for (var i = xDivisions; i >= -1; i--) { for (var i = xDivisions; i >= -1; i--) {
xTickPos = i * xGridDistance + xPadding - xGridOffset xTickPos = i * xGridDistance + xPadding - xGridOffset
if ((xTickPos > xPadding) && (xTickPos < plotWidth + xPadding)) if ((xTickPos > xPadding) && (xTickPos < plotWidth + xPadding))
{ {
xTickDateTime = new Date(currentUnixTime - (xDivisions - i) * xDivisionWidth - diff * 1000) xTickDateTime = new Date(currentUnixTime - (xDivisions - i) * xDivisionWidth - diff * 1000)
xTickDateStr = xTickDateTime.toLocaleDateString(Qt.locale(), Locale.ShortFormat) xTickDateStr = xTickDateTime.toLocaleDateString(Qt.locale(), Locale.ShortFormat)
@ -206,12 +206,12 @@ Canvas
if (lastDateStr != xTickDateStr) { if (lastDateStr != xTickDateStr) {
dateChanged = true dateChanged = true
} }
if ((i % 2 == 0) || (xDivisions < 10)) if ((i % 2 == 0) || (xDivisions < 10))
{ {
// Display the time // Display the time
c.fillText(xTickTimeStr, xTickPos, canvas.height - yPadding / 2) c.fillText(xTickTimeStr, xTickPos, canvas.height - yPadding / 2)
// If the date has changed and is not the current day in a <= 24h graph, display it // If the date has changed and is not the current day in a <= 24h graph, display it
// Always display the date for 48h and 1 week graphs // Always display the date for 48h and 1 week graphs
if (dateChanged || (xDuration > (60*60*48))) { if (dateChanged || (xDuration > (60*60*48))) {
@ -222,13 +222,13 @@ Canvas
// Tick markers // Tick markers
c.moveTo(xTickPos, canvas.height - yPadding) c.moveTo(xTickPos, canvas.height - yPadding)
c.lineTo(xTickPos, canvas.height - (yPadding * 4) / 5) c.lineTo(xTickPos, canvas.height - (yPadding * 4) / 5)
dashedLineDutyCycle = 0.5 dashedLineDutyCycle = 0.5
} else { } else {
dashedLineDutyCycle = 0.1 dashedLineDutyCycle = 0.1
} }
for (var j = 0; j < dashedLines; j++) { for (var j = 0; j < dashedLines; j++) {
c.moveTo(xTickPos, yPadding + j * dashedLineLength) c.moveTo(xTickPos, yPadding + j * dashedLineLength)
c.lineTo(xTickPos, yPadding + j * dashedLineLength + dashedLineDutyCycle * dashedLineLength) c.lineTo(xTickPos, yPadding + j * dashedLineLength + dashedLineDutyCycle * dashedLineLength)
} }

View file

@ -10,11 +10,11 @@ import org.kde.kirigami as Kirigami
RowLayout { RowLayout {
id: root id: root
property int hours: 0 property int hours: 0
property int minutes: 0 property int minutes: 0
readonly property bool twelveHourTime: !kcm.twentyFour // am/pm readonly property bool twelveHourTime: !kcm.twentyFour // am/pm
onHoursChanged: updateHours() onHoursChanged: updateHours()
onMinutesChanged: minutesSpinbox.value = minutes onMinutesChanged: minutesSpinbox.value = minutes
onTwelveHourTimeChanged: updateHours() onTwelveHourTimeChanged: updateHours()
@ -35,7 +35,7 @@ RowLayout {
hoursSpinbox.value = hours; hoursSpinbox.value = hours;
} }
} }
RowLayout { RowLayout {
spacing: Kirigami.Units.largeSpacing spacing: Kirigami.Units.largeSpacing
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
@ -44,7 +44,7 @@ RowLayout {
// for 24-hour time, we have hours from 0-23 // for 24-hour time, we have hours from 0-23
TimePickerSpinBox { TimePickerSpinBox {
id: hoursSpinbox id: hoursSpinbox
onValueModified: { onValueModified: {
if (root.twelveHourTime) { if (root.twelveHourTime) {
if (root.hours >= 12) { if (root.hours >= 12) {
@ -57,22 +57,22 @@ RowLayout {
} }
} }
} }
Kirigami.Heading { Kirigami.Heading {
level: 1 level: 1
text: ":" text: ":"
} }
TimePickerSpinBox { TimePickerSpinBox {
id: minutesSpinbox id: minutesSpinbox
from: 0 from: 0
to: 59 to: 59
onValueModified: { onValueModified: {
root.minutes = value; root.minutes = value;
} }
} }
Button { Button {
id: amPmToggle id: amPmToggle
visible: root.twelveHourTime visible: root.twelveHourTime

View file

@ -33,15 +33,15 @@ Item {
Kirigami.Theme.colorSet: Kirigami.Theme.Button Kirigami.Theme.colorSet: Kirigami.Theme.Button
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
implicitWidth: Kirigami.Units.gridUnit * 4 implicitWidth: Kirigami.Units.gridUnit * 4
implicitHeight: column.implicitHeight implicitHeight: column.implicitHeight
readonly property color buttonColor: Kirigami.Theme.backgroundColor readonly property color buttonColor: Kirigami.Theme.backgroundColor
readonly property color buttonHoverColor: Qt.darker(buttonColor, 1.05) readonly property color buttonHoverColor: Qt.darker(buttonColor, 1.05)
readonly property color buttonPressedColor: Qt.darker(buttonColor, 1.2) readonly property color buttonPressedColor: Qt.darker(buttonColor, 1.2)
readonly property color buttonBorderColor: Qt.alpha(Kirigami.Theme.textColor, 0.3) readonly property color buttonBorderColor: Qt.alpha(Kirigami.Theme.textColor, 0.3)
ColumnLayout { ColumnLayout {
id: column id: column
spacing: 0 spacing: 0
@ -128,7 +128,7 @@ Item {
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter
inputMethodHints: Qt.ImhFormattedNumbersOnly inputMethodHints: Qt.ImhFormattedNumbersOnly
function applyTextBinding() { function applyTextBinding() {
text = Qt.binding(function () { return spinBox.displayText.length == 1 ? '0' + spinBox.displayText : spinBox.displayText }); text = Qt.binding(function () { return spinBox.displayText.length == 1 ? '0' + spinBox.displayText : spinBox.displayText });
} }

View file

@ -125,7 +125,7 @@ SimpleKCM {
bottomPadding: 0 bottomPadding: 0
leftPadding: Kirigami.Units.smallSpacing leftPadding: Kirigami.Units.smallSpacing
rightPadding: Kirigami.Units.smallSpacing rightPadding: Kirigami.Units.smallSpacing
background: Rectangle { background: Rectangle {
color: Kirigami.Theme.backgroundColor color: Kirigami.Theme.backgroundColor
} }

View file

@ -14,18 +14,18 @@ Kirigami.PromptDialog {
property string headingText property string headingText
property string devicePath property string devicePath
property string specificPath property string specificPath
signal donePressed(string password) signal donePressed(string password)
function openAndClear() { function openAndClear() {
warning.visible = false; warning.visible = false;
this.open(); this.open();
passwordField.text = ""; passwordField.text = "";
passwordField.focus = true; passwordField.focus = true;
} }
standardButtons: Controls.Dialog.Ok | Controls.Dialog.Cancel standardButtons: Controls.Dialog.Ok | Controls.Dialog.Cancel
onOpened: passwordField.forceActiveFocus() onOpened: passwordField.forceActiveFocus()
onRejected: { onRejected: {
dialogRoot.close(); dialogRoot.close();
@ -40,23 +40,23 @@ Kirigami.PromptDialog {
} }
passwordField.focus = false; passwordField.focus = false;
} }
ColumnLayout { ColumnLayout {
id: column id: column
spacing: Kirigami.Units.largeSpacing spacing: Kirigami.Units.largeSpacing
PasswordField { PasswordField {
id: passwordField id: passwordField
Layout.fillWidth: true Layout.fillWidth: true
securityType: dialogRoot.securityType securityType: dialogRoot.securityType
onAccepted: dialogRoot.accept() onAccepted: dialogRoot.accept()
} }
Controls.Label { Controls.Label {
id: warning id: warning
text: i18n("Invalid input.") text: i18n("Invalid input.")
visible: false visible: false
} }
} }
} }

View file

@ -32,7 +32,7 @@ FormCard.AbstractFormDelegate {
Layout.rightMargin: Kirigami.Units.gridUnit Layout.rightMargin: Kirigami.Units.gridUnit
implicitWidth: Kirigami.Units.iconSizes.smallMedium implicitWidth: Kirigami.Units.iconSizes.smallMedium
implicitHeight: Kirigami.Units.iconSizes.smallMedium implicitHeight: Kirigami.Units.iconSizes.smallMedium
Kirigami.Icon { Kirigami.Icon {
implicitWidth: Kirigami.Units.iconSizes.smallMedium implicitWidth: Kirigami.Units.iconSizes.smallMedium
implicitHeight: Kirigami.Units.iconSizes.smallMedium implicitHeight: Kirigami.Units.iconSizes.smallMedium
@ -55,7 +55,7 @@ FormCard.AbstractFormDelegate {
font.bold: ConnectionState === PlasmaNM.Enums.Activated font.bold: ConnectionState === PlasmaNM.Enums.Activated
Accessible.ignored: true // base class sets this text on root already Accessible.ignored: true // base class sets this text on root already
} }
RowLayout { RowLayout {
Kirigami.Icon { Kirigami.Icon {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter

View file

@ -1,5 +1,5 @@
<!-- <!--
- SPDX-FileCopyrightText: None - SPDX-FileCopyrightText: None
- SPDX-License-Identifier: CC0-1.0 - SPDX-License-Identifier: CC0-1.0
--> -->

View file

@ -27,8 +27,8 @@ Loader {
const output = window.output; const output = window.output;
const desktop = window.desktops[0]; // assume it's the first desktop that the window is on const desktop = window.desktops[0]; // assume it's the first desktop that the window is on
const maximizeRect = KWinComponents.Workspace.clientArea(KWinComponents.Workspace.MaximizeArea, output, desktop); const maximizeRect = KWinComponents.Workspace.clientArea(KWinComponents.Workspace.MaximizeArea, output, desktop);
// set the window to the maximized size and position instantly, avoiding race condition // set the window to the maximized size and position instantly, avoiding race condition
// between maximizing and window decorations being turned off (changing window height) // between maximizing and window decorations being turned off (changing window height)
// see: https://invent.kde.org/teams/plasma-mobile/issues/-/issues/256 // see: https://invent.kde.org/teams/plasma-mobile/issues/-/issues/256
window.frameGeometry = maximizeRect; window.frameGeometry = maximizeRect;

View file

@ -33,7 +33,7 @@ Item {
onTriggered: root.cancelRequested() onTriggered: root.cancelRequested()
shortcut: "Escape" shortcut: "Escape"
} }
Rectangle { Rectangle {
id: blackOverlay id: blackOverlay
anchors.fill: parent anchors.fill: parent
@ -125,12 +125,12 @@ Item {
} }
} }
} }
Item { Item {
id: buttons id: buttons
anchors.fill: parent anchors.fill: parent
opacity: 0 opacity: 0
ColumnLayout { ColumnLayout {
anchors.centerIn: parent anchors.centerIn: parent
spacing: Kirigami.Units.gridUnit spacing: Kirigami.Units.gridUnit
@ -162,7 +162,7 @@ Item {
} }
} }
} }
ActionButton { ActionButton {
anchors { anchors {
bottom: parent.bottom bottom: parent.bottom

View file

@ -3,7 +3,7 @@
import QtQuick import QtQuick
import QtQuick.Controls as QQC2 import QtQuick.Controls as QQC2
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Window import QtQuick.Window
import Qt5Compat.GraphicalEffects import Qt5Compat.GraphicalEffects
import QtQuick.Templates as T import QtQuick.Templates as T
@ -11,7 +11,7 @@ import org.kde.kirigami as Kirigami
Item { Item {
id: root id: root
// -- public API: should match plasma-workspace implementation -- // -- public API: should match plasma-workspace implementation --
default property Item mainItem default property Item mainItem
@ -27,7 +27,7 @@ Item {
readonly property int flags: Qt.FramelessWindowHint | Qt.Dialog readonly property int flags: Qt.FramelessWindowHint | Qt.Dialog
property var standardButtons // footerButtonBox standardButtons property var standardButtons // footerButtonBox standardButtons
readonly property int spacing: Kirigami.Units.gridUnit readonly property int spacing: Kirigami.Units.gridUnit
function present() { function present() {
window.showMaximized(); window.showMaximized();
} }
@ -140,7 +140,7 @@ Item {
id: footerButtonBox id: footerButtonBox
// ensure we never have no buttons, we always must have the cancel button available // ensure we never have no buttons, we always must have the cancel button available
standardButtons: (root.standardButtons === QQC2.DialogButtonBox.NoButton) ? QQC2.DialogButtonBox.Cancel : root.standardButtons standardButtons: (root.standardButtons === QQC2.DialogButtonBox.NoButton) ? QQC2.DialogButtonBox.Cancel : root.standardButtons
Layout.topMargin: Kirigami.Units.largeSpacing Layout.topMargin: Kirigami.Units.largeSpacing
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumWidth: root.window.maximumWidth Layout.maximumWidth: root.window.maximumWidth

View file

@ -6,7 +6,7 @@ import QtQuick 2.15
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
import org.kde.plasma.private.mobileshell as MobileShell import org.kde.plasma.private.mobileshell as MobileShell
QS.QuickSetting { QS.QuickSetting {
text: i18n("Battery") text: i18n("Battery")
status: i18n("%1%", MobileShell.BatteryInfo.percent) status: i18n("%1%", MobileShell.BatteryInfo.percent)
icon: "battery-full" + (MobileShell.BatteryInfo.pluggedIn ? "-charging" : "") icon: "battery-full" + (MobileShell.BatteryInfo.pluggedIn ? "-charging" : "")

View file

@ -28,7 +28,7 @@ QS.QuickSetting {
property int cookie1: -1 property int cookie1: -1
property int cookie2: -1 property int cookie2: -1
function toggle() { function toggle() {
let inhibit = !enabled; let inhibit = !enabled;
const service = pmSource.serviceForSource("PowerDevil"); const service = pmSource.serviceForSource("PowerDevil");

View file

@ -11,11 +11,11 @@ import org.kde.plasma.workspace.keyboardlayout 1.0 as Keyboards
QS.QuickSetting { QS.QuickSetting {
text: i18n("Virtual Keyboard") text: i18n("Virtual Keyboard")
icon: "input-keyboard-virtual" icon: "input-keyboard-virtual"
status: enabled ? i18n("On") : status: enabled ? i18n("On") :
(Keyboards.KWinVirtualKeyboard.available ? i18n("Off") : i18n("Tap to open settings")) (Keyboards.KWinVirtualKeyboard.available ? i18n("Off") : i18n("Tap to open settings"))
enabled: Keyboards.KWinVirtualKeyboard.enabled && Keyboards.KWinVirtualKeyboard.available enabled: Keyboards.KWinVirtualKeyboard.enabled && Keyboards.KWinVirtualKeyboard.available
settingsCommand: "plasma-open-settings kcm_mobile_onscreenkeyboard" settingsCommand: "plasma-open-settings kcm_mobile_onscreenkeyboard"
function toggle() { function toggle() {
if (!Keyboards.KWinVirtualKeyboard.available) { if (!Keyboards.KWinVirtualKeyboard.available) {
// select a keyboard in the settings (none is likely set) // select a keyboard in the settings (none is likely set)

View file

@ -23,10 +23,10 @@ QS.QuickSetting {
return i18n("Not Available"); return i18n("Not Available");
} }
} }
settingsCommand: "plasma-open-settings kcm_cellular_network" settingsCommand: "plasma-open-settings kcm_cellular_network"
enabled: PlasmaMM.SignalIndicator.mobileDataEnabled enabled: PlasmaMM.SignalIndicator.mobileDataEnabled
function toggle() { function toggle() {
if (PlasmaMM.SignalIndicator.needsAPNAdded || !PlasmaMM.SignalIndicator.mobileDataSupported) { if (PlasmaMM.SignalIndicator.needsAPNAdded || !PlasmaMM.SignalIndicator.mobileDataSupported) {
// open settings if unable to toggle mobile data // open settings if unable to toggle mobile data

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!-- <!--
- SPDX-FileCopyrightText: 2020 Vlad Zahorodnii - SPDX-FileCopyrightText: 2020 Vlad Zahorodnii
- SPDX-License-Identifier: GPL-2.0-or-later - SPDX-License-Identifier: GPL-2.0-or-later
--> -->

View file

@ -17,7 +17,7 @@ target_link_libraries(powermenuplugin
KF6::CoreAddons KF6::CoreAddons
PW::KWorkspace PW::KWorkspace
) )
set_property(TARGET powermenuplugin PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/quicksetting/powermenu) set_property(TARGET powermenuplugin PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/quicksetting/powermenu)
file(COPY qmldir DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/quicksetting/powermenu) file(COPY qmldir DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/org/kde/plasma/quicksetting/powermenu)

View file

@ -12,7 +12,7 @@ QS.QuickSetting {
icon: "system-shutdown-symbolic" icon: "system-shutdown-symbolic"
status: i18n("Open power menu") status: i18n("Open power menu")
enabled: false enabled: false
function toggle() { function toggle() {
PowerMenu.PowerMenuUtil.openShutdownScreen(); PowerMenu.PowerMenuUtil.openShutdownScreen();
} }

View file

@ -48,7 +48,7 @@ QS.QuickSetting {
} else { } else {
RecordUtil.showNotification(i18n("New Screen Recording"), i18n("New Screen Recording saved in %1", record.output), record.output); RecordUtil.showNotification(i18n("New Screen Recording"), i18n("New Screen Recording saved in %1", record.output), record.output);
} }
enabled = !enabled enabled = !enabled
MobileShellState.ShellDBusClient.closeActionDrawer(); MobileShellState.ShellDBusClient.closeActionDrawer();
} }

View file

@ -12,14 +12,14 @@ QS.QuickSetting {
status: i18n("Tap to screenshot") status: i18n("Tap to screenshot")
icon: "spectacle" icon: "spectacle"
enabled: false enabled: false
property bool screenshotRequested: false property bool screenshotRequested: false
function toggle() { function toggle() {
screenshotRequested = true; screenshotRequested = true;
MobileShellState.ShellDBusClient.closeActionDrawer(); MobileShellState.ShellDBusClient.closeActionDrawer();
} }
Connections { Connections {
target: MobileShellState.ShellDBusClient target: MobileShellState.ShellDBusClient
@ -30,7 +30,7 @@ QS.QuickSetting {
} }
} }
} }
// HACK: KWin's fade effect may have the window ending up being in the screenshot if taken too fast // HACK: KWin's fade effect may have the window ending up being in the screenshot if taken too fast
Timer { Timer {
id: timer id: timer

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: None SPDX-FileCopyrightText: None
SPDX-License-Identifier: CC0-1.0 SPDX-License-Identifier: CC0-1.0

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: None SPDX-FileCopyrightText: None
SPDX-License-Identifier: CC0-1.0 SPDX-License-Identifier: CC0-1.0

View file

@ -20,13 +20,13 @@ Rectangle {
color: "transparent" color: "transparent"
//BEGIN properties //BEGIN properties
property bool isContainment: false property bool isContainment: false
property alias app: appLoader.item property alias app: appLoader.item
property bool loadApp: true property bool loadApp: true
signal appLoaded() signal appLoaded()
//END properties //END properties
//BEGIN model //BEGIN model
@ -44,7 +44,7 @@ Rectangle {
return sourceModel.data(sourceModel.index(row, 0), ConfigModel.VisibleRole); return sourceModel.data(sourceModel.index(row, 0), ConfigModel.VisibleRole);
} }
} }
//END model //END model
//BEGIN functions //BEGIN functions
@ -87,7 +87,7 @@ Rectangle {
root.saveConfig(); root.saveConfig();
} }
} }
function pushReplace(item, config) { function pushReplace(item, config) {
let page; let page;
if (app.pageStack.depth === 0) { if (app.pageStack.depth === 0) {
@ -97,7 +97,7 @@ Rectangle {
} }
app.currentConfigPage = page; app.currentConfigPage = page;
} }
function open(item) { function open(item) {
app.isAboutPage = false; app.isAboutPage = false;
if (item.source) { if (item.source) {
@ -109,7 +109,7 @@ Rectangle {
app.pageStack.pop(); app.pageStack.pop();
} }
} }
//END functions //END functions
@ -123,7 +123,7 @@ Rectangle {
} }
} }
} }
//END connections //END connections
//BEGIN UI components //BEGIN UI components
@ -132,7 +132,7 @@ Rectangle {
id: configurationKcmPageComponent id: configurationKcmPageComponent
ConfigurationKcmPage {} ConfigurationKcmPage {}
} }
Loader { Loader {
id: appLoader id: appLoader
anchors.fill: parent anchors.fill: parent
@ -146,14 +146,14 @@ Rectangle {
} else { } else {
root.open(configDialog.configModel.get(0)) root.open(configDialog.configModel.get(0))
} }
root.appLoaded(); root.appLoaded();
} }
sourceComponent: Kirigami.ApplicationItem { sourceComponent: Kirigami.ApplicationItem {
id: app id: app
anchors.fill: parent anchors.fill: parent
// animation on show // animation on show
opacity: 0 opacity: 0
NumberAnimation on opacity { NumberAnimation on opacity {
@ -162,14 +162,14 @@ Rectangle {
duration: Kirigami.Units.longDuration duration: Kirigami.Units.longDuration
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
pageStack.globalToolBar.canContainHandles: true pageStack.globalToolBar.canContainHandles: true
pageStack.globalToolBar.style: Kirigami.ApplicationHeaderStyle.ToolBar pageStack.globalToolBar.style: Kirigami.ApplicationHeaderStyle.ToolBar
pageStack.globalToolBar.showNavigationButtons: Kirigami.ApplicationHeaderStyle.ShowBackButton; pageStack.globalToolBar.showNavigationButtons: Kirigami.ApplicationHeaderStyle.ShowBackButton;
property var currentConfigPage: null property var currentConfigPage: null
property bool isAboutPage: false property bool isAboutPage: false
// pop pages when not in use // pop pages when not in use
Connections { Connections {
target: app.pageStack target: app.pageStack
@ -178,7 +178,7 @@ Rectangle {
timer.restart(); timer.restart();
} }
} }
Timer { Timer {
id: timer id: timer
interval: 300 interval: 300
@ -207,7 +207,7 @@ Rectangle {
delegate: configCategoryDelegate delegate: configCategoryDelegate
} }
} }
Component { Component {
id: configCategoryDelegate id: configCategoryDelegate
Kirigami.NavigationTabButton { Kirigami.NavigationTabButton {
@ -215,13 +215,13 @@ Rectangle {
text: model.name text: model.name
width: footerBar.buttonWidth width: footerBar.buttonWidth
QQC2.ButtonGroup.group: footerBar.tabGroup QQC2.ButtonGroup.group: footerBar.tabGroup
onClicked: { onClicked: {
if (checked) { if (checked) {
root.open(model); root.open(model);
} }
} }
checked: { checked: {
if (app.pageStack.currentItem) { if (app.pageStack.currentItem) {
if (model.kcm && app.pageStack.currentItem.kcm) { if (model.kcm && app.pageStack.currentItem.kcm) {

View file

@ -24,7 +24,7 @@ AppletConfiguration {
app.width = root.width < root.height ? root.width : Math.min(root.width, Math.max(app.implicitWidth, Kirigami.Units.gridUnit * 45)); app.width = root.width < root.height ? root.width : Math.min(root.width, Math.max(app.implicitWidth, Kirigami.Units.gridUnit * 45));
app.height = Math.min(root.height, Math.max(app.implicitHeight, Kirigami.Units.gridUnit * 29)); app.height = Math.min(root.height, Math.max(app.implicitHeight, Kirigami.Units.gridUnit * 29));
} }
//BEGIN model //BEGIN model
globalConfigModel: globalContainmentConfigModel globalConfigModel: globalContainmentConfigModel

View file

@ -25,50 +25,50 @@ ApplicationWindow {
width: 360 width: 360
height: 720 height: 720
visible: true visible: true
Image { Image {
source: "assets/background.jpg" source: "assets/background.jpg"
anchors.fill: parent anchors.fill: parent
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
} }
MobileShell.StatusBar { MobileShell.StatusBar {
id: statusBar id: statusBar
z: 1 z: 1
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: Kirigami.Units.gridUnit * 1.25 height: Kirigami.Units.gridUnit * 1.25
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
backgroundColor: "transparent" backgroundColor: "transparent"
showSecondRow: false showSecondRow: false
showDropShadow: true showDropShadow: true
showTime: true showTime: true
disableSystemTray: true // prevent SIGABRT, since loading the system tray leads to bad... things disableSystemTray: true // prevent SIGABRT, since loading the system tray leads to bad... things
} }
MobileShell.ActionDrawerOpenSurface { MobileShell.ActionDrawerOpenSurface {
anchors.fill: statusBar anchors.fill: statusBar
actionDrawer: drawer actionDrawer: drawer
z: 1 z: 1
} }
MobileShell.ActionDrawer { MobileShell.ActionDrawer {
id: drawer id: drawer
z: 1 z: 1
anchors.fill: parent anchors.fill: parent
notificationSettings: NotificationManager.Settings {} notificationSettings: NotificationManager.Settings {}
notificationModelType: MobileShell.NotificationsModelType.WatchedNotificationsModel notificationModelType: MobileShell.NotificationsModelType.WatchedNotificationsModel
notificationModel: NotificationManager.WatchedNotificationsModel {} notificationModel: NotificationManager.WatchedNotificationsModel {}
} }
PC3.Label { PC3.Label {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: Kirigami.Units.gridUnit anchors.bottomMargin: Kirigami.Units.gridUnit

View file

@ -17,7 +17,7 @@ ApplicationWindow {
width: 360 width: 360
height: 720 height: 720
visible: true visible: true
// simulate kscreenlocker wallpaper // simulate kscreenlocker wallpaper
Image { Image {
id: wallpaper // id passed in by kscreenlocker id: wallpaper // id passed in by kscreenlocker
@ -25,11 +25,11 @@ ApplicationWindow {
anchors.fill: parent anchors.fill: parent
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
} }
// simulate kscreenlocker authenticator object // simulate kscreenlocker authenticator object
QtObject { QtObject {
id: authenticator // id passed in by kscreenlocker id: authenticator // id passed in by kscreenlocker
property string infoMessage: "" property string infoMessage: ""
property string errorMessage: "" property string errorMessage: ""
property string prompt: "" property string prompt: ""
@ -37,11 +37,11 @@ ApplicationWindow {
signal succeeded() signal succeeded()
signal failed() signal failed()
// these are not kscreenlocker properties, for test purposes only // these are not kscreenlocker properties, for test purposes only
property string password: "" property string password: ""
property bool shouldPrompt: true property bool shouldPrompt: true
function startAuthenticating() { function startAuthenticating() {
if (shouldPrompt) { if (shouldPrompt) {
shouldPrompt = false; shouldPrompt = false;
@ -55,12 +55,12 @@ ApplicationWindow {
failed(); failed();
} }
} }
function respond(promptPassword) { function respond(promptPassword) {
password = promptPassword; password = promptPassword;
} }
} }
// component to test // component to test
LockScreen.LockScreen { LockScreen.LockScreen {
anchors.fill: parent anchors.fill: parent

View file

@ -1,5 +1,5 @@
<!-- <!--
- SPDX-FileCopyrightText: None - SPDX-FileCopyrightText: None
- SPDX-License-Identifier: CC0-1.0 - SPDX-License-Identifier: CC0-1.0
--> -->