mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 02:04:45 +00:00
ask pin before executing notification actions
only allow a phone call notification to execute actions without unlocking for the rest open the pin dialog and execute the action only after successful authentication
This commit is contained in:
parent
7fa7879493
commit
57df5430d6
3 changed files with 51 additions and 3 deletions
|
|
@ -41,7 +41,19 @@ PlasmaCore.ColorScope {
|
||||||
function isPinDrawerOpen() {
|
function isPinDrawerOpen() {
|
||||||
return passwordFlickable.contentY === passwordFlickable.columnHeight;
|
return passwordFlickable.contentY === passwordFlickable.columnHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function askPassword() {
|
||||||
|
showPasswordAnim.restart();
|
||||||
|
}
|
||||||
|
NumberAnimation {
|
||||||
|
id: showPasswordAnim
|
||||||
|
target: passwordFlickable
|
||||||
|
property: "contentY"
|
||||||
|
from: 0
|
||||||
|
to: passwordFlickable.contentHeight - passwordFlickable.height
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
// blur background once keypad is open
|
// blur background once keypad is open
|
||||||
FastBlur {
|
FastBlur {
|
||||||
id: blur
|
id: blur
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,13 @@ import org.kde.notificationmanager 1.1 as Notifications
|
||||||
import "../components"
|
import "../components"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
id: notificationsRoot
|
||||||
property alias notificationListHeight: notificationListView.contentHeight
|
property alias notificationListHeight: notificationListView.contentHeight
|
||||||
property int count: notificationListView.count
|
property int count: notificationListView.count
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
|
property var pendingAction: {"notificationId": 0, "actionName": ""}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
z: 1
|
z: 1
|
||||||
anchors {
|
anchors {
|
||||||
|
|
@ -86,7 +89,25 @@ Item {
|
||||||
color: Qt.rgba(1, 1, 1, 0.5)
|
color: Qt.rgba(1, 1, 1, 0.5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: authenticator
|
||||||
|
function onSucceeded() {
|
||||||
|
if (notificationsRoot.pendingAction.notificationId !== 0) {
|
||||||
|
if (notificationsRoot.pendingAction.actionName.length == 0) {
|
||||||
|
notifModel.invokeDefaultAction(pendingAction.notificationId);
|
||||||
|
} else {
|
||||||
|
notifModel.invokeAction(pendingAction.notificationId, pendingAction.actionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
notificationsRoot.pendingAction = {"notificationId": 0, "actionName":""};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onFailed() {
|
||||||
|
notificationsRoot.pendingAction = {"notificationId": 0, "actionName":""};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: notificationListView
|
id: notificationListView
|
||||||
model: notifModel
|
model: notifModel
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,13 @@ Item {
|
||||||
text: modelData.label || ""
|
text: modelData.label || ""
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
notifModel.invokeAction(notificationItem.notification.notificationId, modelData.actionName);
|
if (notificationItem.notification.category === "x-kde.incoming-call") {
|
||||||
|
notifModel.invokeAction(notificationItem.notification.notificationId, modelData.actionName);
|
||||||
|
} else {
|
||||||
|
notificationsRoot.pendingAction = {"notificationId": notificationItem.notification.notificationId,
|
||||||
|
"actionName":modelData.actionName};
|
||||||
|
root.askPassword();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -187,6 +193,15 @@ Item {
|
||||||
} else {
|
} else {
|
||||||
slideAnim.restart();
|
slideAnim.restart();
|
||||||
}
|
}
|
||||||
|
if (notificationItem.notification.hasDefaultAction && Math.abs(rect.x) < units.gridUnit) {
|
||||||
|
if (notificationItem.notification.category === "x-kde.incoming-call") {
|
||||||
|
notifModel.invokeDefaultAction(notificationItem.notification.notificationId);
|
||||||
|
} else {
|
||||||
|
notificationsRoot.pendingAction = {"notificationId": notificationItem.notification.notificationId,
|
||||||
|
"actionName": ""};
|
||||||
|
root.askPassword();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue