fix(@dekstop/chat): clicking on `enable in settings` redirects to network settings

Fixes #4890
This commit is contained in:
Sale Djenic 2022-02-25 14:32:46 +01:00 committed by Iuri Matias
parent 40d10b0cbb
commit d0e0df1e3b
10 changed files with 92 additions and 122 deletions

View File

@ -474,9 +474,7 @@ Rectangle {
}
}
onLaunchBrowserSettings: {
// TODO: replace with shared store constant
// Profile/RootStore.browser_settings_id
Global.changeAppSectionBySectionType(Constants.appSection.profile, 10);
Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.browserSettings);
}
}

View File

@ -78,9 +78,7 @@ Popup {
}
onPreferencesClicked: {
activityCenter.close()
// TODO: replace with shared store constant
// Profile/RootStore.notifications_id
Global.changeAppSection(Constants.profile, 7);
Global.changeAppSection(Constants.profile, Constants.settingsSubsection.notifications);
}
onMarkAllReadClicked: {
errorText = activityCenter.store.activityCenterModuleInst.markAllActivityCenterNotificationsRead()

View File

@ -88,7 +88,7 @@ ModalPopup {
cursorShape: "PointingHandCursor"
onClicked: {
popup.profileClicked();
Global.currentMenuTab = 0;
Global.settingsSubsection = Constants.settingsSubsection.profile;
popup.close();
}
}

View File

@ -36,7 +36,7 @@ StatusAppTwoPanelLayout {
anchors.fill: parent
currentIndex: Global.currentMenuTab
currentIndex: Global.settingsSubsection
onCurrentIndexChanged: {
if(visibleChildren[0] === ensContainer){

View File

@ -24,10 +24,10 @@ Column {
Repeater {
id: mainMenuItems
delegate: StatusNavigationListItem {
itemId: model.menu_id
itemId: model.subsection
title: model.text
icon.name: model.icon
selected: Global.currentMenuTab === model.menu_id
selected: Global.settingsSubsection === model.subsection
onClicked: root.menuItemClicked(model)
}
}
@ -41,10 +41,10 @@ Column {
id: appsMenuItems
delegate: StatusNavigationListItem {
id: appsMenuDelegate
itemId: model.menu_id
itemId: model.subsection
title: model.text
icon.name: model.icon
selected: Global.currentMenuTab === model.menu_id
selected: Global.settingsSubsection === model.subsection
onClicked: root.menuItemClicked(model)
visible: root.appsMenuItemsEnabled
}
@ -56,12 +56,12 @@ Column {
id: settingsMenuItems
delegate: StatusNavigationListItem {
id: settingsMenuDelegate
itemId: model.menu_id
itemId: model.subsection
title: model.text
icon.name: model.icon
selected: Global.currentMenuTab === model.menu_id
selected: Global.settingsSubsection === model.subsection
onClicked: root.menuItemClicked(model)
visible: model.ifEnabled !== "browser" || root.browserMenuItemEnabled
visible: model.subsection !== Constants.settingsSubsection.browserSettings || root.browserMenuItemEnabled
badge.value: !root.privacyStore.mnemonicBackedUp && settingsMenuDelegate.title === qsTr("Privacy and security")
}
}
@ -75,11 +75,11 @@ Column {
Repeater {
id: extraMenuItems
delegate: StatusNavigationListItem {
itemId: model.menu_id
itemId: model.subsection
title: model.text
icon.name: model.icon
selected: Global.currentMenuTab === model.menu_id
visible: model.ifEnabled !== "browser" || root.browserMenuItemEnabled
selected: Global.settingsSubsection === model.subsection
visible: model.subsection !== Constants.settingsSubsection.browserSettings || root.browserMenuItemEnabled
onClicked: root.menuItemClicked(model)
}
}

View File

@ -53,117 +53,74 @@ QtObject {
property var dappList: dappPermissionsModule.dapps
property var permissionList: dappPermissionsModule.permissions
property int profile_id: 0
property int contacts_id: 1
property int ens_id: 2
property int wallet_id: 3
property int privacy_and_security_id: 4
property int appearance_id: 5
property int sound_id: 6
property int language_id: 7
property int notifications_id: 8
property int sync_settings_id: 9
property int devices_settings_id: 10
property int browser_settings_id: 11
property int advanced_id: 12
property int need_help_id: 13
property int about_id: 14
property int signout_id: 15
property bool browserMenuItemEnabled: localAccountSensitiveSettings.isBrowserEnabled
property bool appsMenuItemsEnabled: localAccountSensitiveSettings.isMultiNetworkEnabled
property ListModel mainMenuItems: ListModel {
ListElement {
menu_id: 0
text: qsTr("My Profile")
icon: "profile"
}
ListElement {
menu_id: 1
text: qsTr("Contacts")
icon: "contact"
}
ListElement {
menu_id: 2
text: qsTr("ENS usernames")
icon: "username"
Component.onCompleted: {
append({subsection: Constants.settingsSubsection.profile,
text: qsTr("My Profile"),
icon: "profile"})
append({subsection: Constants.settingsSubsection.contacts,
text: qsTr("Contacts"),
icon: "contact"})
append({subsection: Constants.settingsSubsection.ensUsernames,
text: qsTr("ENS usernames"),
icon: "username"})
}
}
property ListModel appsMenuItems: ListModel {
ListElement {
menu_id: 3
text: qsTr("Wallet")
icon: "wallet"
Component.onCompleted: {
append({subsection: Constants.settingsSubsection.wallet,
text: qsTr("Wallet"),
icon: "wallet"})
}
}
property ListModel settingsMenuItems: ListModel {
ListElement {
menu_id: 4
text: qsTr("Privacy and security")
icon: "security"
}
ListElement {
menu_id: 5
text: qsTr("Appearance")
icon: "appearance"
}
ListElement {
menu_id: 6
text: qsTr("Sound")
icon: "sound"
}
ListElement {
menu_id: 7
text: qsTr("Language")
icon: "language"
}
ListElement {
menu_id: 8
text: qsTr("Notifications")
icon: "notification"
}
ListElement {
menu_id: 9
text: qsTr("Sync settings")
icon: "mobile"
}
ListElement {
menu_id: 10
text: qsTr("Devices settings")
icon: "mobile"
}
ListElement {
menu_id: 11
text: qsTr("Browser settings")
icon: "browser"
ifEnabled: "browser"
}
ListElement {
menu_id: 12
text: qsTr("Advanced")
icon: "settings"
Component.onCompleted: {
append({subsection: Constants.settingsSubsection.privacyAndSecurity,
text: qsTr("Privacy and security"),
icon: "security"})
append({subsection: Constants.settingsSubsection.appearance,
text: qsTr("Appearance"),
icon: "appearance"})
append({subsection: Constants.settingsSubsection.sound,
text: qsTr("Sound"),
icon: "sound"})
append({subsection: Constants.settingsSubsection.language,
text: qsTr("Language"),
icon: "language"})
append({subsection: Constants.settingsSubsection.notifications,
text: qsTr("Notifications"),
icon: "notification"})
append({subsection: Constants.settingsSubsection.syncSettings,
text: qsTr("Sync settings"),
icon: "mobile"})
append({subsection: Constants.settingsSubsection.devicesSettings,
text: qsTr("Devices settings"),
icon: "mobile"})
append({subsection: Constants.settingsSubsection.browserSettings,
text: qsTr("Browser settings"),
icon: "browser"})
append({subsection: Constants.settingsSubsection.advanced,
text: qsTr("Advanced"),
icon: "settings"})
}
}
property ListModel extraMenuItems: ListModel {
ListElement {
menu_id: 13
text: qsTr("Need help?")
icon: "help"
}
ListElement {
menu_id: 14
text: qsTr("About")
icon: "info"
}
ListElement {
menu_id: 15
function_name: "exit"
text: qsTr("Sign out & Quit")
icon: "logout"
Component.onCompleted: {
append({subsection: Constants.settingsSubsection.needHelp,
text: qsTr("Need help?"),
icon: "help"})
append({subsection: Constants.settingsSubsection.about,
text: qsTr("About"),
icon: "info"})
append({subsection: Constants.settingsSubsection.signout,
text: qsTr("Sign out & Quit"),
icon: "logout"})
}
}

View File

@ -42,10 +42,10 @@ Item {
appsMenuItemsEnabled: store.appsMenuItemsEnabled
onMenuItemClicked: {
if (!!menu_item.function_name && menu_item.function_name === "exit") {
if (menu_item.subsection === Constants.settingsSubsection.signout) {
return confirmDialog.open()
}
Global.currentMenuTab = menu_item.menu_id
Global.settingsSubsection = menu_item.subsection
}
}
}

View File

@ -373,9 +373,7 @@ Column {
//% "Enable in Settings"
text: qsTrId("enable-in-settings")
onClicked: {
// TODO: replace with shared store constant
// Profile/RootStore.privacy_and_security_id
Global.changeAppSectionBySectionType(Constants.appSection.profile, 3);
Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.privacyAndSecurity);
}
width: parent.width
anchors.top: sep1.bottom

View File

@ -27,6 +27,25 @@ QtObject {
readonly property int node: 4
}
readonly property QtObject settingsSubsection: QtObject {
property int profile: 0
property int contacts: 1
property int ensUsernames: 2
property int wallet: 3
property int privacyAndSecurity: 4
property int appearance: 5
property int sound: 6
property int language: 7
property int notifications: 8
property int syncSettings: 9
property int devicesSettings: 10
property int browserSettings: 11
property int advanced: 12
property int needHelp: 13
property int about: 14
property int signout: 15
}
readonly property QtObject userStatus: QtObject{
readonly property int offline: 0
readonly property int online: 1

View File

@ -8,7 +8,7 @@ QtObject {
property var applicationWindow
property bool popupOpened: false
property int currentMenuTab: 0
property int settingsSubsection: Constants.settingsSubsection.profile
property var errorSound
property var mainModuleInst
@ -41,13 +41,13 @@ QtObject {
openDownloadModalRequested();
}
function changeAppSectionBySectionType(sectionType, profileSectionId = -1) {
function changeAppSectionBySectionType(sectionType, subsection = 0) {
if(!root.mainModuleInst)
return
mainModuleInst.setActiveSectionBySectionType(sectionType)
if (profileSectionId > -1) {
currentMenuTab = profileSectionId;
if (sectionType === Constants.appSection.profile) {
settingsSubsection = subsection;
}
}