Port AccountMenu to ConvergentContextMenu
This commit is contained in:
@@ -6,20 +6,19 @@ import QtQuick.Controls as QQC2
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
|
import org.kde.kirigamiaddons.components as KirigamiComponents
|
||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
import org.kde.neochat.settings
|
import org.kde.neochat.settings
|
||||||
import org.kde.neochat.devtools
|
import org.kde.neochat.devtools
|
||||||
|
|
||||||
QQC2.Menu {
|
KirigamiComponents.ConvergentContextMenu {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property NeoChatConnection connection
|
required property NeoChatConnection connection
|
||||||
required property Kirigami.ApplicationWindow window
|
required property Kirigami.ApplicationWindow window
|
||||||
|
|
||||||
margins: Kirigami.Units.smallSpacing
|
QQC2.Action {
|
||||||
|
|
||||||
QQC2.MenuItem {
|
|
||||||
text: i18nc("@action:button", "Show QR Code")
|
text: i18nc("@action:button", "Show QR Code")
|
||||||
icon.name: "view-barcode-qr-symbolic"
|
icon.name: "view-barcode-qr-symbolic"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
@@ -36,7 +35,8 @@ QQC2.Menu {
|
|||||||
qrMax.open();
|
qrMax.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QQC2.MenuItem {
|
|
||||||
|
QQC2.Action {
|
||||||
text: i18n("Edit This Account")
|
text: i18n("Edit This Account")
|
||||||
icon.name: "document-edit"
|
icon.name: "document-edit"
|
||||||
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), {
|
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), {
|
||||||
@@ -45,21 +45,24 @@ QQC2.Menu {
|
|||||||
title: i18n("Account editor")
|
title: i18n("Account editor")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QQC2.MenuItem {
|
|
||||||
|
QQC2.Action {
|
||||||
text: i18n("Notification Settings")
|
text: i18n("Notification Settings")
|
||||||
icon.name: "notifications"
|
icon.name: "notifications"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
NeoChatSettingsView.open('notifications');
|
NeoChatSettingsView.open('notifications');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QQC2.MenuItem {
|
|
||||||
|
QQC2.Action {
|
||||||
text: i18n("Devices")
|
text: i18n("Devices")
|
||||||
icon.name: "computer-symbolic"
|
icon.name: "computer-symbolic"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
NeoChatSettingsView.open('devices');
|
NeoChatSettingsView.open('devices');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QQC2.MenuItem {
|
|
||||||
|
Kirigami.Action {
|
||||||
text: i18n("Open Developer Tools")
|
text: i18n("Open Developer Tools")
|
||||||
icon.name: "tools"
|
icon.name: "tools"
|
||||||
visible: NeoChatConfig.developerTools
|
visible: NeoChatConfig.developerTools
|
||||||
@@ -71,7 +74,8 @@ QQC2.Menu {
|
|||||||
height: Kirigami.Units.gridUnit * 42
|
height: Kirigami.Units.gridUnit * 42
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QQC2.MenuItem {
|
|
||||||
|
Kirigami.Action {
|
||||||
text: i18nc("@action:inmenu", "Open Secret Backup")
|
text: i18nc("@action:inmenu", "Open Secret Backup")
|
||||||
icon.name: "unlock"
|
icon.name: "unlock"
|
||||||
visible: NeoChatConfig.secretBackup
|
visible: NeoChatConfig.secretBackup
|
||||||
@@ -79,22 +83,21 @@ QQC2.Menu {
|
|||||||
title: i18nc("@title:window", "Open Key Backup")
|
title: i18nc("@title:window", "Open Key Backup")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
QQC2.MenuItem {
|
|
||||||
|
QQC2.Action {
|
||||||
text: i18nc("@action:inmenu", "Verify This Device")
|
text: i18nc("@action:inmenu", "Verify This Device")
|
||||||
icon.name: "security-low"
|
icon.name: "security-low"
|
||||||
onTriggered: root.connection.startSelfVerification()
|
onTriggered: root.connection.startSelfVerification()
|
||||||
enabled: Controller.csSupported
|
enabled: Controller.csSupported
|
||||||
}
|
}
|
||||||
QQC2.MenuItem {
|
|
||||||
|
QQC2.Action {
|
||||||
text: i18n("Logout")
|
text: i18n("Logout")
|
||||||
icon.name: "im-kick-user"
|
icon.name: "im-kick-user"
|
||||||
onTriggered: confirmLogoutDialogComponent.createObject(QQC2.ApplicationWindow.window.overlay).open()
|
onTriggered: confirmLogoutDialogComponent.createObject(QQC2.ApplicationWindow.window.overlay).open()
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
readonly property Component confirmLogoutDialogComponent: ConfirmLogoutDialog {
|
||||||
id: confirmLogoutDialogComponent
|
connection: root.connection
|
||||||
ConfirmLogoutDialog {
|
|
||||||
connection: root.connection
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,9 +53,11 @@ RowLayout {
|
|||||||
NeoChatSettingsView.open("accounts")
|
NeoChatSettingsView.open("accounts")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onPressAndHold: accountMenu.popup();
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton
|
||||||
onTapped: accountMenu.open()
|
onTapped: accountMenu.popup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user