2020-06-17 15:18:31 -04:00
import QtQuick 2.13
import QtQuick . Controls 2.13
import QtQuick . Layouts 1.13
2021-08-27 12:44:39 +02:00
import StatusQ . Components 0.1
2021-09-09 11:20:16 +02:00
import "../../../../shared"
2021-09-28 18:04:06 +03:00
import utils 1.0
2020-07-21 17:03:22 -04:00
import "./constants.js" as ProfileConstants
2020-05-27 16:57:36 -04:00
2020-07-21 17:03:22 -04:00
ScrollView {
2020-10-21 10:45:28 -04:00
property var changeProfileSection: function ( sectionId ) {
2021-07-29 10:32:40 +02:00
Config . currentMenuTab = sectionId
2020-10-21 10:45:28 -04:00
}
2021-08-27 12:44:39 +02:00
ScrollBar.horizontal.policy: Qt . ScrollBarAlwaysOff
2021-04-13 12:25:04 +02:00
contentHeight: menuItems . height + 24
2020-05-27 16:57:36 -04:00
2020-07-21 17:03:22 -04:00
id: profileMenu
2021-03-25 14:12:33 -04:00
clip: true
2020-07-21 17:03:22 -04:00
Column {
2021-04-13 12:25:04 +02:00
id: menuItems
2021-08-27 12:44:39 +02:00
spacing: 4
2020-07-21 17:03:22 -04:00
Repeater {
2021-03-14 18:05:18 +02:00
model: ProfileConstants . mainMenuButtons
2021-08-27 12:44:39 +02:00
delegate: StatusNavigationListItem {
itemId: modelData . id
title: modelData . text
icon.name: modelData . icon
selected: Config . currentMenuTab === modelData . id
onClicked: Config . currentMenuTab = modelData . id
2021-03-14 18:05:18 +02:00
}
}
2021-08-27 12:44:39 +02:00
StatusListSectionHeadline { text: "Settings" }
2021-03-14 18:05:18 +02:00
Repeater {
model: ProfileConstants . settingsMenuButtons
2021-08-27 12:44:39 +02:00
delegate: StatusNavigationListItem {
2021-09-09 12:38:16 +03:00
id: settingsMenuDelegate
2021-08-27 12:44:39 +02:00
itemId: modelData . id
title: modelData . text
icon.name: modelData . icon
selected: Config . currentMenuTab === modelData . id
2021-09-01 19:14:36 -04:00
onClicked: Config . currentMenuTab = modelData . id
visible: {
if ( ( profileModel . fleets . fleet == Constants . waku_prod || profileModel . fleets . fleet === Constants . waku_test ) && modelData . id === 8 ) {
// Disable sync settings. - TODO: remove this once wakuV2 compatibility is added
return false ;
}
return modelData . ifEnabled !== "browser" || appSettings . isBrowserEnabled
}
2021-09-09 12:38:16 +03:00
badge.value: ( ! profileModel . mnemonic . isBackedUp && ( settingsMenuDelegate . title ===
ProfileConstants . settingsMenuButtons [ 0 ] . text ) ) ? 1 : 0
2021-03-14 18:05:18 +02:00
}
}
2021-08-27 12:44:39 +02:00
Item {
id: invisibleSeparator
height: 16
width: parent . width
2021-03-14 18:05:18 +02:00
}
Repeater {
model: ProfileConstants . extraMenuButtons
2021-08-27 12:44:39 +02:00
delegate: StatusNavigationListItem {
itemId: modelData . id
title: modelData . text
icon.name: modelData . icon
selected: Config . currentMenuTab === modelData . id
visible: modelData . ifEnabled !== "browser" || appSettings . isBrowserEnabled
2020-07-21 17:03:22 -04:00
onClicked: function ( ) {
2021-03-16 10:54:34 -04:00
if ( modelData . function === "exit" ) {
2021-09-09 11:20:16 +02:00
return confirmDialog . open ( )
2021-03-16 10:54:34 -04:00
}
2021-07-29 10:32:40 +02:00
Config . currentMenuTab = modelData . id
2020-06-17 16:33:44 -04:00
}
2020-05-27 16:57:36 -04:00
}
}
}
2021-09-09 11:20:16 +02: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 17:28:25 -04:00
}