2023-07-04 15:11:41 +00:00
|
|
|
import QtQuick 2.15
|
2023-10-27 17:20:52 +00:00
|
|
|
import QtQml.Models 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2023-07-04 15:11:41 +00:00
|
|
|
|
2023-10-27 17:20:52 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2023-07-04 15:11:41 +00:00
|
|
|
import StatusQ.Popups.Dialog 0.1
|
2023-10-27 17:20:52 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-07-04 15:11:41 +00:00
|
|
|
|
|
|
|
import AppLayouts.Communities.panels 1.0
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
StatusDialog {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property bool isEditMode
|
|
|
|
|
2023-08-22 18:04:58 +00:00
|
|
|
property bool requirementsCheckPending
|
2023-10-27 17:20:52 +00:00
|
|
|
property var keypairSigningModel
|
2023-08-22 18:04:58 +00:00
|
|
|
|
2023-07-04 15:11:41 +00:00
|
|
|
required property string communityName
|
|
|
|
required property string communityIcon
|
|
|
|
property int loginType: Constants.LoginType.Password
|
|
|
|
|
2024-01-24 16:35:53 +00:00
|
|
|
property var walletAssetsModel
|
2023-07-04 15:11:41 +00:00
|
|
|
required property var walletAccountsModel // name, address, emoji, colorId, assets
|
|
|
|
required property var permissionsModel // id, key, permissionType, holdingsListModel, channelsListModel, isPrivate, tokenCriteriaMet
|
|
|
|
required property var assetsModel
|
|
|
|
required property var collectiblesModel
|
|
|
|
|
2024-01-24 16:35:53 +00:00
|
|
|
property var getCurrencyAmount: function (balance, symbol){}
|
|
|
|
|
2023-07-04 15:11:41 +00:00
|
|
|
signal shareSelectedAddressesClicked(string airdropAddress, var sharedAddresses)
|
2023-08-21 18:54:57 +00:00
|
|
|
signal sharedAddressesChanged(string airdropAddress, var sharedAddresses)
|
2023-07-04 15:11:41 +00:00
|
|
|
|
2023-10-27 17:20:52 +00:00
|
|
|
signal prepareForSigning(string airdropAddress, var sharedAddresses)
|
|
|
|
signal editRevealedAddresses()
|
|
|
|
signal signSharedAddressesForAllNonKeycardKeypairs()
|
|
|
|
signal signSharedAddressesForKeypair(string keyUid)
|
|
|
|
|
2023-08-24 20:36:38 +00:00
|
|
|
function setOldSharedAddresses(oldSharedAddresses) {
|
2023-10-27 17:20:52 +00:00
|
|
|
if (!d.displaySigningPanel && !!loader.item) {
|
|
|
|
d.oldSharedAddresses = oldSharedAddresses
|
|
|
|
loader.item.setOldSharedAddresses(oldSharedAddresses)
|
|
|
|
}
|
2023-08-24 20:36:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function setOldAirdropAddress(oldAirdropAddress) {
|
2023-10-27 17:20:52 +00:00
|
|
|
if (!d.displaySigningPanel && !!loader.item) {
|
|
|
|
d.oldAirdropAddress = oldAirdropAddress
|
|
|
|
loader.item.setOldAirdropAddress(oldAirdropAddress)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function sharedAddressesForAllNonKeycardKeypairsSigned() {
|
|
|
|
if (d.displaySigningPanel && !!loader.item) {
|
|
|
|
loader.item.sharedAddressesForAllNonKeycardKeypairsSigned()
|
|
|
|
}
|
2023-08-24 20:36:38 +00:00
|
|
|
}
|
|
|
|
|
2023-10-27 17:20:52 +00:00
|
|
|
title: !!loader.item? loader.item.title : ""
|
2023-07-04 15:11:41 +00:00
|
|
|
implicitWidth: 640 // by design
|
|
|
|
padding: 0
|
|
|
|
|
2023-10-27 17:20:52 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
property bool displaySigningPanel: false
|
|
|
|
property bool allSigned: false
|
|
|
|
|
|
|
|
property var oldSharedAddresses
|
|
|
|
property string oldAirdropAddress
|
|
|
|
|
|
|
|
property var selectAddressesPanelButtons: ObjectModel {}
|
|
|
|
readonly property var signingPanelButtons: ObjectModel {
|
|
|
|
StatusFlatButton {
|
|
|
|
visible: root.isEditMode
|
|
|
|
borderColor: Theme.palette.baseColor2
|
|
|
|
text: qsTr("Cancel")
|
|
|
|
onClicked: root.close()
|
|
|
|
}
|
|
|
|
StatusButton {
|
|
|
|
text: qsTr("Save changes")
|
|
|
|
enabled: d.allSigned
|
|
|
|
onClicked: {
|
|
|
|
root.editRevealedAddresses()
|
|
|
|
root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
readonly property var signingPanelBackButtons: ObjectModel {
|
|
|
|
StatusBackButton {
|
|
|
|
onClicked: {
|
|
|
|
d.displaySigningPanel = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
contentItem: Loader {
|
|
|
|
id: loader
|
|
|
|
sourceComponent: d.displaySigningPanel? sharedAddressesSigningPanelComponent : selectSharedAddressesPanelComponent
|
|
|
|
|
|
|
|
onLoaded: {
|
|
|
|
if (!d.displaySigningPanel) {
|
|
|
|
if (!!d.oldSharedAddresses) {
|
|
|
|
root.setOldSharedAddresses(d.oldSharedAddresses)
|
|
|
|
}
|
|
|
|
if (!!d.oldAirdropAddress) {
|
|
|
|
root.setOldAirdropAddress(d.oldAirdropAddress)
|
|
|
|
}
|
|
|
|
d.selectAddressesPanelButtons = loader.item.buttons
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: selectSharedAddressesPanelComponent
|
|
|
|
SharedAddressesPanel {
|
|
|
|
isEditMode: root.isEditMode
|
|
|
|
requirementsCheckPending: root.requirementsCheckPending
|
|
|
|
communityName: root.communityName
|
|
|
|
communityIcon: root.communityIcon
|
|
|
|
loginType: root.loginType
|
|
|
|
walletAccountsModel: root.walletAccountsModel
|
2024-01-24 16:35:53 +00:00
|
|
|
walletAssetsModel: root.walletAssetsModel
|
2023-10-27 17:20:52 +00:00
|
|
|
permissionsModel: root.permissionsModel
|
|
|
|
assetsModel: root.assetsModel
|
|
|
|
collectiblesModel: root.collectiblesModel
|
|
|
|
onShareSelectedAddressesClicked: root.shareSelectedAddressesClicked(airdropAddress, sharedAddresses)
|
|
|
|
onPrepareForSigning: {
|
|
|
|
root.prepareForSigning(airdropAddress, sharedAddresses)
|
|
|
|
d.displaySigningPanel = true
|
|
|
|
}
|
|
|
|
onSharedAddressesChanged: {
|
|
|
|
root.sharedAddressesChanged(airdropAddress, sharedAddresses)
|
|
|
|
}
|
|
|
|
onClose: root.close()
|
2024-01-24 16:35:53 +00:00
|
|
|
getCurrencyAmount: function (balance, symbol){
|
|
|
|
return root.getCurrencyAmount(balance, symbol)
|
|
|
|
}
|
2023-10-27 17:20:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: sharedAddressesSigningPanelComponent
|
|
|
|
SharedAddressesSigningPanel {
|
|
|
|
|
|
|
|
keypairSigningModel: root.keypairSigningModel
|
|
|
|
|
|
|
|
onSignSharedAddressesForAllNonKeycardKeypairs: {
|
|
|
|
root.signSharedAddressesForAllNonKeycardKeypairs()
|
|
|
|
}
|
|
|
|
|
|
|
|
onSignSharedAddressesForKeypair: {
|
|
|
|
root.signSharedAddressesForKeypair(keyUid)
|
|
|
|
}
|
|
|
|
|
|
|
|
onAllSignedChanged: {
|
|
|
|
d.allSigned = allSigned
|
|
|
|
}
|
2023-08-21 18:54:57 +00:00
|
|
|
}
|
2023-07-04 15:11:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
footer: StatusDialogFooter {
|
|
|
|
spacing: Style.current.padding
|
2023-10-27 17:20:52 +00:00
|
|
|
rightButtons: d.displaySigningPanel? d.signingPanelButtons : d.selectAddressesPanelButtons
|
|
|
|
leftButtons: d.displaySigningPanel? d.signingPanelBackButtons : null
|
2023-07-04 15:11:41 +00:00
|
|
|
}
|
|
|
|
}
|