status-desktop/ui/app/AppLayouts/Profile/LeftTab/Menu.qml

87 lines
2.8 KiB
QML
Raw Normal View History

2020-06-17 19:18:31 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import StatusQ.Components 0.1
import "../../../../shared"
2020-05-27 20:57:36 +00:00
import "../../../../imports"
import "./constants.js" as ProfileConstants
2020-05-27 20:57:36 +00:00
ScrollView {
property var changeProfileSection: function (sectionId) {
Config.currentMenuTab = sectionId
}
ScrollBar.horizontal.policy: Qt.ScrollBarAlwaysOff
contentHeight: menuItems.height + 24
2020-05-27 20:57:36 +00:00
id: profileMenu
2021-03-25 18:12:33 +00:00
clip: true
Column {
id: menuItems
spacing: 4
Repeater {
model: ProfileConstants.mainMenuButtons
delegate: StatusNavigationListItem {
itemId: modelData.id
title: modelData.text
icon.name: modelData.icon
selected: Config.currentMenuTab === modelData.id
onClicked: Config.currentMenuTab = modelData.id
}
}
StatusListSectionHeadline { text: "Settings" }
Repeater {
model: ProfileConstants.settingsMenuButtons
delegate: StatusNavigationListItem {
id: settingsMenuDelegate
itemId: modelData.id
title: modelData.text
icon.name: modelData.icon
selected: Config.currentMenuTab === modelData.id
onClicked: Config.currentMenuTab = modelData.id
2021-04-23 11:43:18 +00:00
visible: modelData.ifEnabled !== "browser" || appSettings.isBrowserEnabled
badge.value: (!profileModel.mnemonic.isBackedUp && (settingsMenuDelegate.title ===
ProfileConstants.settingsMenuButtons[0].text)) ? 1 : 0
}
}
Item {
id: invisibleSeparator
height: 16
width: parent.width
}
Repeater {
model: ProfileConstants.extraMenuButtons
delegate: StatusNavigationListItem {
itemId: modelData.id
title: modelData.text
icon.name: modelData.icon
selected: Config.currentMenuTab === modelData.id
visible: modelData.ifEnabled !== "browser" || appSettings.isBrowserEnabled
onClicked: function () {
2021-03-16 14:54:34 +00:00
if (modelData.function === "exit") {
return confirmDialog.open()
2021-03-16 14:54:34 +00:00
}
Config.currentMenuTab = modelData.id
2020-06-17 20:33:44 +00:00
}
2020-05-27 20:57:36 +00:00
}
}
}
ConfirmationDialog {
id: confirmDialog
header.title: qsTr("Sign out")
confirmationText: qsTr("Make sure you have your account password and seed phrase stored. Without them you can lock yourself out of your account and lose funds.")
confirmButtonLabel: qsTr("Sign out & Quit")
onConfirmButtonClicked: {
Qt.quit()
}
}
2020-05-27 21:28:25 +00:00
}