status-desktop/ui/app/AppLayouts/Profile/views/MyProfileView.qml

120 lines
3.4 KiB
QML
Raw Normal View History

import QtQuick 2.13
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.13
import utils 1.0
import shared 1.0
import shared.panels 1.0
import shared.popups 1.0
import shared.stores 1.0
import shared.controls.chat 1.0
import "../popups"
import "../stores"
2022-06-22 12:16:21 +00:00
import "../controls"
import "./profile"
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1
import StatusQ.Controls 0.1
import AppLayouts.Wallet.stores 1.0
SettingsContentBase {
id: root
2022-06-22 12:16:21 +00:00
property WalletStore walletStore
property ProfileStore profileStore
2022-06-22 12:16:21 +00:00
property PrivacyStore privacyStore
2022-09-27 21:26:26 +00:00
property ContactsStore contactsStore
property NetworkConnectionStore networkConnectionStore
required property WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore
property var communitiesModel
2022-06-22 12:16:21 +00:00
titleRowComponentLoader.sourceComponent: StatusButton {
objectName: "profileSettingsChangePasswordButton"
2022-06-22 12:16:21 +00:00
text: qsTr("Change Password")
onClicked: Global.openPopup(changePasswordModal)
enabled: !userProfile.isKeycardUser
2022-06-22 12:16:21 +00:00
}
dirty: settingsView.dirty
saveChangesButtonEnabled: settingsView.valid
2022-09-27 21:26:26 +00:00
onResetChangesClicked: {
settingsView.reset()
profilePreview.reload()
}
onSaveChangesClicked: {
settingsView.save()
profilePreview.reload()
}
bottomHeaderComponents: StatusTabBar {
id: editPreviwTabBar
StatusTabButton {
leftPadding: 0
width: implicitWidth
text: qsTr("Edit")
}
StatusTabButton {
width: implicitWidth
text: qsTr("Preview")
}
}
ColumnLayout {
2022-06-22 12:16:21 +00:00
id: layout
spacing: Constants.settingsSection.itemSpacing
width: root.contentWidth
2022-06-22 12:16:21 +00:00
StackLayout {
2022-11-11 16:46:35 +00:00
id: stackLayout
2022-06-22 12:16:21 +00:00
currentIndex: editPreviwTabBar.currentIndex
2022-06-22 12:16:21 +00:00
MyProfileSettingsView {
id: settingsView
objectName: "myProfileSettingsView"
2022-06-22 12:16:21 +00:00
profileStore: root.profileStore
privacyStore: root.privacyStore
walletStore: root.walletStore
communitiesModel: root.communitiesModel
walletAssetsStore: root.walletAssetsStore
currencyStore: root.currencyStore
2022-11-11 16:46:35 +00:00
onVisibleChanged: if (visible) stackLayout.Layout.preferredHeight = settingsView.implicitHeight
Component.onCompleted: stackLayout.Layout.preferredHeight = Qt.binding(() => settingsView.implicitHeight)
}
2022-06-22 12:16:21 +00:00
MyProfilePreview {
id: profilePreview
2022-11-11 16:46:35 +00:00
2022-06-22 12:16:21 +00:00
profileStore: root.profileStore
2022-09-27 21:26:26 +00:00
contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore
communitiesModel: root.communitiesModel
dirtyValues: settingsView.dirtyValues
dirty: settingsView.dirty
2022-11-11 16:46:35 +00:00
onVisibleChanged: if (visible) stackLayout.Layout.preferredHeight = Qt.binding(() => profilePreview.implicitHeight)
}
}
Component {
2022-06-22 12:16:21 +00:00
id: changePasswordModal
ChangePasswordModal {
privacyStore: root.privacyStore
onPasswordChanged: Global.openPopup(successPopup);
}
}
Component {
2022-06-22 12:16:21 +00:00
id: successPopup
ChangePasswordSuccessModal { }
2020-08-19 21:01:22 +00:00
}
}
}