Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion panels/notification/center/GroupNotify.qml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ NotifyItem {
onClicked: function () {
console.log("group setting", root.appName)
let pos = mapToItem(root, Qt.point(width / 2, height))
root.setting(pos)
root.setting(pos, false)
}
}
AnimationSettingButton {
Expand Down
23 changes: 22 additions & 1 deletion panels/notification/center/NotifySettingMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,35 @@ Menu {
closePolicy: Popup.CloseOnPressOutside | Popup.CloseOnEscape
modal: true

function toggle()
Timer {
id: closePolicyTimer
interval: 1000
onTriggered: {
if (root.visible) {
root.closePolicy = Popup.CloseOnPressOutside | Popup.CloseOnEscape
}
}
}

function toggle(isTouch)
{
if (!visible) {
console.log("Open menu")
if (isTouch) {
closePolicy = Popup.CloseOnEscape
}
open()
if (isTouch) {
closePolicyTimer.restart()
}
} else {
console.log("Close menu")
close()
}
}

onClosed: {
closePolicyTimer.stop()
closePolicy = Popup.CloseOnPressOutside | Popup.CloseOnEscape
}
}
4 changes: 2 additions & 2 deletions panels/notification/center/NotifyView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Control {
id: notifyDelegate
notifyModel: root.notifyModel
view: view
onSetting: function (pos, params) {
onSetting: function (pos, params, isTouch) {
let appName = params.appName
let pinned = params.pinned
notifySetting.x = pos.x - notifySetting.width / 2
Expand All @@ -137,7 +137,7 @@ Control {
notifySetting.pinned = pinned

console.log("setting", appName, pinned)
notifySetting.toggle();
notifySetting.toggle(isTouch);
}
}
add: Transition {
Expand Down
34 changes: 25 additions & 9 deletions panels/notification/center/NotifyViewDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ DelegateChooser {
required property NotifyModel notifyModel
required property Item view

signal setting(var pos, var params)
signal setting(var pos, var params, bool isTouch)

role: "type"

Expand Down Expand Up @@ -74,12 +74,12 @@ DelegateChooser {
root.view.requestFocusOnExpand(collapseIndex)
}

onSetting: function (pos) {
onSetting: function (pos, isTouch) {
let tmp = mapToItem(root.view, pos)
root.setting(tmp, {
appName: model.appName,
pinned: model.pinned
})
}, isTouch)
}
onRemove: function () {
console.log("remove group", model.appName)
Expand Down Expand Up @@ -116,18 +116,20 @@ DelegateChooser {
acceptedButtons: Qt.RightButton
onPressedChanged: function () {
if (pressed) {
if (point.device.type === PointerDevice.TouchScreen)
return
let pos = point.position
setting(pos)
setting(pos, false)
}
}
}

onSetting: function (pos) {
onSetting: function (pos, isTouch) {
let tmp = mapToItem(root.view, pos)
root.setting(tmp, {
appName: model.appName,
pinned: model.pinned
})
}, isTouch)
}
onRemove: function () {
console.log("remove normal", model.id)
Expand Down Expand Up @@ -201,12 +203,26 @@ DelegateChooser {
acceptedButtons: Qt.RightButton
onPressedChanged: function () {
if (pressed) {
if (point.device.type === PointerDevice.TouchScreen)
return
let pos = point.position
setting(pos)
setting(pos, false)
}
}
}

TapHandler {
acceptedDevices: PointerDevice.TouchScreen
onTapped: {
overlapNotify.forceActiveFocus()
overlapNotify.expand()
}
onLongPressed: {
let pos = point.position
setting(pos, true)
}
}

onExpand: function ()
{
console.log("expand")
Expand All @@ -215,12 +231,12 @@ DelegateChooser {
root.view.jiggleUpdate()
root.view.requestFocusOnExpand(expandIndex + 1)
}
onSetting: function (pos) {
onSetting: function (pos, isTouch) {
let tmp = mapToItem(root.view, pos)
root.setting(tmp, {
appName: model.appName,
pinned: model.pinned
})
}, isTouch)
}
onRemove: function () {
console.log("remove overlap", model.appName)
Expand Down
1 change: 1 addition & 0 deletions panels/notification/center/OverlapNotify.qml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ NotifyItem {
TapHandler {
enabled: !root.enableDismissed
acceptedButtons: Qt.LeftButton
acceptedDevices: PointerDevice.Mouse
onTapped: {
root.forceActiveFocus()
root.expand()
Expand Down
2 changes: 1 addition & 1 deletion panels/notification/plugin/NotifyItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ FocusScope {

signal remove()
signal dismiss()
signal setting(var pos)
signal setting(var pos, bool isTouch)
signal actionInvoked(var actionId)
signal linkActivated(var link)

Expand Down
Loading