Commit b3884be9 authored by Devin Lin's avatar Devin Lin 🎨
Browse files

actiondrawer: Dismiss on click on empty background area

parent 17f582a1
Pipeline #161003 passed with stages
in 1 minute and 6 seconds
......@@ -54,85 +54,94 @@ PlasmaCore.ColorScope {
interval: 60 * 1000
}
// left side
ColumnLayout {
opacity: applyMinMax(root.actionDrawer.offset / root.maximizedQuickSettingsOffset)
spacing: 0
anchors {
top: parent.top
topMargin: Math.min(root.width, root.height) * 0.06
bottom: parent.bottom
bottomMargin: Math.min(root.width, root.height) * 0.06
right: quickSettings.left
rightMargin: Math.min(root.width, root.height) * 0.06
left: parent.left
leftMargin: Math.min(root.width, root.height) * 0.06
}
MouseArea {
anchors.fill: parent
PlasmaComponents.Label {
id: clock
text: Qt.formatTime(timeSource.data.Local.DateTime, MobileShell.ShellUtil.isSystem24HourFormat ? "h:mm" : "h:mm ap")
verticalAlignment: Qt.AlignTop
Layout.fillWidth: true
font.pixelSize: Math.min(40, Math.min(root.width, root.height) * 0.1)
font.weight: Font.ExtraLight
elide: Text.ElideRight
}
// dismiss drawer when background is clicked
onClicked: root.actionDrawer.close();
PlasmaComponents.Label {
id: date
text: Qt.formatDate(timeSource.data.Local.DateTime, "ddd MMMM d")
verticalAlignment: Qt.AlignTop
color: PlasmaCore.ColorScope.disabledTextColor
Layout.fillWidth: true
Layout.topMargin: PlasmaCore.Units.smallSpacing
// left side
ColumnLayout {
opacity: applyMinMax(root.actionDrawer.offset / root.maximizedQuickSettingsOffset)
spacing: 0
anchors {
top: parent.top
topMargin: Math.min(root.width, root.height) * 0.06
bottom: parent.bottom
bottomMargin: Math.min(root.width, root.height) * 0.06
right: quickSettings.left
rightMargin: Math.min(root.width, root.height) * 0.06
left: parent.left
leftMargin: Math.min(root.width, root.height) * 0.06
}
PlasmaComponents.Label {
id: clock
text: Qt.formatTime(timeSource.data.Local.DateTime, MobileShell.ShellUtil.isSystem24HourFormat ? "h:mm" : "h:mm ap")
verticalAlignment: Qt.AlignTop
Layout.fillWidth: true
font.pixelSize: Math.min(20, Math.min(root.width, root.height) * 0.05)
font.weight: Font.Light
}
MobileShell.NotificationsWidget {
id: notificationWidget
historyModel: root.actionDrawer.notificationModel
historyModelType: root.actionDrawer.notificationModelType
notificationSettings: root.actionDrawer.notificationSettings
actionsRequireUnlock: root.actionDrawer.restrictedPermissions
onUnlockRequested: root.actionDrawer.permissionsRequested()
font.pixelSize: Math.min(40, Math.min(root.width, root.height) * 0.1)
font.weight: Font.ExtraLight
elide: Text.ElideRight
}
PlasmaComponents.Label {
id: date
text: Qt.formatDate(timeSource.data.Local.DateTime, "ddd MMMM d")
verticalAlignment: Qt.AlignTop
color: PlasmaCore.ColorScope.disabledTextColor
Layout.fillWidth: true
Layout.topMargin: PlasmaCore.Units.smallSpacing
font.pixelSize: Math.min(20, Math.min(root.width, root.height) * 0.05)
font.weight: Font.Light
}
Connections {
target: root.actionDrawer
MobileShell.NotificationsWidget {
id: notificationWidget
historyModel: root.actionDrawer.notificationModel
historyModelType: root.actionDrawer.notificationModelType
notificationSettings: root.actionDrawer.notificationSettings
actionsRequireUnlock: root.actionDrawer.restrictedPermissions
onUnlockRequested: root.actionDrawer.permissionsRequested()
function onRunPendingNotificationAction() {
notificationWidget.runPendingAction();
Connections {
target: root.actionDrawer
function onRunPendingNotificationAction() {
notificationWidget.runPendingAction();
}
}
onBackgroundClicked: root.actionDrawer.close();
// don't allow notifications widget to get too wide
Layout.maximumWidth: PlasmaCore.Units.gridUnit * 25
Layout.fillHeight: true
Layout.fillWidth: true
Layout.topMargin: Math.min(root.width, root.height) * 0.02
}
// don't allow notifications widget to get too wide
Layout.maximumWidth: PlasmaCore.Units.gridUnit * 25
Layout.fillHeight: true
Layout.fillWidth: true
Layout.topMargin: Math.min(root.width, root.height) * 0.02
}
}
// right sidebar
QuickSettingsPanel {
id: quickSettings
height: Math.min(root.height, Math.max(quickSettings.minimizedHeight, actionDrawer.offset))
width: intendedWidth
readonly property real intendedWidth: 360
anchors.top: parent.top
anchors.right: parent.right
actionDrawer: root.actionDrawer
fullHeight: root.height
transform: Translate {
id: translate
y: Math.min(root.actionDrawer.offset - quickSettings.minimizedHeight, 0)
// right sidebar
QuickSettingsPanel {
id: quickSettings
height: Math.min(root.height, Math.max(quickSettings.minimizedHeight, actionDrawer.offset))
width: intendedWidth
readonly property real intendedWidth: 360
anchors.top: parent.top
anchors.right: parent.right
actionDrawer: root.actionDrawer
fullHeight: root.height
transform: Translate {
id: translate
y: Math.min(root.actionDrawer.offset - quickSettings.minimizedHeight, 0)
}
}
}
}
......@@ -92,6 +92,8 @@ PlasmaCore.ColorScope {
}
}
onBackgroundClicked: root.actionDrawer.close();
anchors {
top: quickSettings.top
topMargin: quickSettings.height + translate.y
......
......@@ -68,6 +68,11 @@ Item {
*/
signal unlockRequested()
/**
* Emitted when the background is clicked (not a notification or other element).
*/
signal backgroundClicked()
/**
* Run pending action that was pending for authentication when unlockRequested() was emitted.
*/
......@@ -119,6 +124,11 @@ Item {
criteria: ViewSection.FullString
}
MouseArea {
anchors.fill: parent
onClicked: root.backgroundClicked()
}
PlasmaExtras.PlaceholderMessage {
anchors.centerIn: parent
width: parent.width - (PlasmaCore.Units.largeSpacing * 4)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment