mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 15:46:44 +00:00
feat(GODT-2273): menu with "Close window" and "Quit Bridge" button in main window.
This commit is contained in:
@ -29,6 +29,8 @@ Item {
|
|||||||
property var notifications
|
property var notifications
|
||||||
|
|
||||||
signal showSetupGuide(var user, string address)
|
signal showSetupGuide(var user, string address)
|
||||||
|
signal closeWindow()
|
||||||
|
signal quitBridge()
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -107,7 +109,7 @@ Item {
|
|||||||
|
|
||||||
Layout.topMargin: 16
|
Layout.topMargin: 16
|
||||||
Layout.bottomMargin: 9
|
Layout.bottomMargin: 9
|
||||||
Layout.rightMargin: 16
|
Layout.rightMargin: 4
|
||||||
|
|
||||||
horizontalPadding: 0
|
horizontalPadding: 0
|
||||||
|
|
||||||
@ -115,6 +117,55 @@ Item {
|
|||||||
|
|
||||||
onClicked: rightContent.showGeneralSettings()
|
onClicked: rightContent.showGeneralSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: dotMenuButton
|
||||||
|
Layout.bottomMargin: 9
|
||||||
|
Layout.maximumHeight: 36
|
||||||
|
Layout.maximumWidth: 36
|
||||||
|
Layout.minimumHeight: 36
|
||||||
|
Layout.minimumWidth: 36
|
||||||
|
Layout.preferredHeight: 36
|
||||||
|
Layout.preferredWidth: 36
|
||||||
|
Layout.rightMargin: 16
|
||||||
|
Layout.topMargin: 16
|
||||||
|
colorScheme: leftBar.colorScheme
|
||||||
|
horizontalPadding: 0
|
||||||
|
icon.source: "/qml/icons/ic-three-dots-vertical.svg"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
dotMenu.open()
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
id: dotMenu
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
modal: true
|
||||||
|
y: dotMenuButton.Layout.preferredHeight + dotMenuButton.Layout.bottomMargin
|
||||||
|
|
||||||
|
MenuItem {
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
text: qsTr("Close window")
|
||||||
|
onClicked: {
|
||||||
|
root.closeWindow()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MenuItem {
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
text: qsTr("Quit Bridge")
|
||||||
|
onClicked: {
|
||||||
|
root.quitBridge()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClosed: {
|
||||||
|
parent.checked = false
|
||||||
|
}
|
||||||
|
onOpened: {
|
||||||
|
parent.checked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {implicitHeight:10}
|
Item {implicitHeight:10}
|
||||||
|
|||||||
@ -142,6 +142,17 @@ ApplicationWindow {
|
|||||||
onShowSetupGuide: function(user, address) {
|
onShowSetupGuide: function(user, address) {
|
||||||
root.showSetup(user,address)
|
root.showSetup(user,address)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onCloseWindow: {
|
||||||
|
root.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
onQuitBridge: {
|
||||||
|
// If we ever want to add a confirmation dialog before quitting:
|
||||||
|
//root.notifications.askQuestion("Quit Bridge", "Insert warning message here.", "Quit", "Cancel", Backend.quit, null)
|
||||||
|
root.close()
|
||||||
|
Backend.quit()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WelcomeGuide { // 1
|
WelcomeGuide { // 1
|
||||||
|
|||||||
@ -138,4 +138,9 @@ Item {
|
|||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
notification: root.notifications.genericError
|
notification: root.notifications.genericError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NotificationDialog {
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
notification: root.notifications.genericQuestion
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ QtObject {
|
|||||||
signal askResetBridge()
|
signal askResetBridge()
|
||||||
signal askChangeAllMailVisibility(var isVisibleNow)
|
signal askChangeAllMailVisibility(var isVisibleNow)
|
||||||
signal askDeleteAccount(var user)
|
signal askDeleteAccount(var user)
|
||||||
|
signal askQuestion(var title, var description, var option1, var option2, var action1, var action2)
|
||||||
enum Group {
|
enum Group {
|
||||||
Connection = 1,
|
Connection = 1,
|
||||||
Update = 2,
|
Update = 2,
|
||||||
@ -82,7 +82,8 @@ QtObject {
|
|||||||
root.noActiveKeyForRecipient,
|
root.noActiveKeyForRecipient,
|
||||||
root.userBadEvent,
|
root.userBadEvent,
|
||||||
root.imapLoginWhileSignedOut,
|
root.imapLoginWhileSignedOut,
|
||||||
root.genericError
|
root.genericError,
|
||||||
|
root.genericQuestion,
|
||||||
]
|
]
|
||||||
|
|
||||||
// Connection
|
// Connection
|
||||||
@ -1201,4 +1202,50 @@ QtObject {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property Notification genericQuestion: Notification {
|
||||||
|
title: ""
|
||||||
|
brief: ""
|
||||||
|
description: ""
|
||||||
|
type: Notification.NotificationType.Warning
|
||||||
|
group: Notifications.Group.Dialogs
|
||||||
|
property var option1: ""
|
||||||
|
property var option2: ""
|
||||||
|
property variant action1: null
|
||||||
|
property variant action2: null
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: root
|
||||||
|
function onAskQuestion(title, description, option1, option2, action1, action2) {
|
||||||
|
root.genericQuestion.title = title
|
||||||
|
root.genericQuestion.description = description
|
||||||
|
root.genericQuestion.option1 = option1
|
||||||
|
root.genericQuestion.option2 = option2
|
||||||
|
root.genericQuestion.action1 = action1
|
||||||
|
root.genericQuestion.action2 = action2
|
||||||
|
root.genericQuestion.active = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
action: [
|
||||||
|
Action {
|
||||||
|
text: root.genericQuestion.option1
|
||||||
|
|
||||||
|
onTriggered: {
|
||||||
|
root.genericQuestion.active = false
|
||||||
|
if (root.genericQuestion.action1)
|
||||||
|
root.genericQuestion.action1()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Action {
|
||||||
|
text: root.genericQuestion.option2
|
||||||
|
|
||||||
|
onTriggered: {
|
||||||
|
root.genericQuestion.active = false
|
||||||
|
if (root.genericQuestion.action2)
|
||||||
|
root.genericQuestion.action2()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,13 +26,12 @@ T.MenuItem {
|
|||||||
|
|
||||||
property ColorScheme colorScheme
|
property ColorScheme colorScheme
|
||||||
|
|
||||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
width: parent.width // required. Other item overflows to the right of the menu and get clipped.
|
||||||
implicitContentWidth + leftPadding + rightPadding)
|
|
||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
implicitContentHeight + topPadding + bottomPadding,
|
implicitContentHeight + topPadding + bottomPadding,
|
||||||
implicitIndicatorHeight + topPadding + bottomPadding)
|
implicitIndicatorHeight + topPadding + bottomPadding)
|
||||||
|
|
||||||
padding: 6
|
padding: 12
|
||||||
spacing: 6
|
spacing: 6
|
||||||
|
|
||||||
icon.width: 24
|
icon.width: 24
|
||||||
|
|||||||
Reference in New Issue
Block a user