feat(Communities): Add TokenMasterActionPopup to MintTokensSettingsPanel
Closes: #11622
This commit is contained in:
parent
383cd6dcf7
commit
a793865835
|
@ -1,6 +1,8 @@
|
|||
import QtQuick 2.14
|
||||
import QtQuick.Controls 2.14
|
||||
import QtQuick.Layouts 1.14
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import Qt.labs.settings 1.0
|
||||
|
||||
import AppLayouts.Communities.panels 1.0
|
||||
import AppLayouts.Chat.stores 1.0
|
||||
|
@ -185,6 +187,12 @@ SplitView {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Settings {
|
||||
property alias editorModelChecked: editorModelChecked.checked
|
||||
property alias privilegedModelChecked: privilegedModelChecked.checked
|
||||
property alias completeModelChecked: completeModelChecked.checked
|
||||
}
|
||||
}
|
||||
|
||||
// category: Panels
|
||||
|
|
|
@ -4,6 +4,7 @@ ListModel {
|
|||
id: root
|
||||
|
||||
readonly property ListModel tokenOwnersModel: TokenHoldersModel {}
|
||||
readonly property ListModel emptyModel: ListModel {}
|
||||
|
||||
readonly property var data: [
|
||||
{
|
||||
|
@ -24,7 +25,8 @@ ListModel {
|
|||
chainId: 2,
|
||||
chainName: "Optimism",
|
||||
chainIcon: ModelsData.networks.optimism,
|
||||
accountName: "Another account - generated"
|
||||
accountName: "Another account - generated",
|
||||
tokenOwnersModel: root.emptyModel
|
||||
},
|
||||
{
|
||||
isPrivilegedToken: true,
|
||||
|
@ -44,7 +46,8 @@ ListModel {
|
|||
chainId: 2,
|
||||
chainName: "Optimism",
|
||||
chainIcon: ModelsData.networks.optimism,
|
||||
accountName: "Another account - generated"
|
||||
accountName: "Another account - generated",
|
||||
tokenOwnersModel: root.tokenOwnersModel
|
||||
},
|
||||
{
|
||||
isPrivilegedToken: false,
|
||||
|
@ -64,7 +67,8 @@ ListModel {
|
|||
chainId: 1,
|
||||
chainName: "Testnet",
|
||||
chainIcon: ModelsData.networks.testnet,
|
||||
accountName: "Status Account"
|
||||
accountName: "Status Account",
|
||||
tokenOwnersModel: root.emptyModel
|
||||
},
|
||||
{
|
||||
isPrivilegedToken: false,
|
||||
|
@ -84,7 +88,8 @@ ListModel {
|
|||
chainId: 2,
|
||||
chainName: "Optimism",
|
||||
chainIcon: ModelsData.networks.optimism,
|
||||
accountName: "Status New Account"
|
||||
accountName: "Status New Account",
|
||||
tokenOwnersModel: root.emptyModel
|
||||
},
|
||||
{
|
||||
isPrivilegedToken: false,
|
||||
|
@ -104,7 +109,8 @@ ListModel {
|
|||
chainId: 5,
|
||||
chainName: "Custom",
|
||||
chainIcon: ModelsData.networks.custom,
|
||||
accountName: "Other Account"
|
||||
accountName: "Other Account",
|
||||
tokenOwnersModel: root.emptyModel
|
||||
},
|
||||
{
|
||||
isPrivilegedToken: false,
|
||||
|
@ -144,7 +150,8 @@ ListModel {
|
|||
chainId: 2,
|
||||
chainName: "Optimism",
|
||||
chainIcon: ModelsData.networks.optimism,
|
||||
accountName: "Status SNT Account"
|
||||
accountName: "Status SNT Account",
|
||||
tokenOwnersModel: root.emptyModel
|
||||
},
|
||||
{
|
||||
isPrivilegedToken: false,
|
||||
|
@ -163,7 +170,8 @@ ListModel {
|
|||
chainId: 1,
|
||||
chainName: "Testnet",
|
||||
chainIcon: ModelsData.networks.testnet,
|
||||
accountName: "Status Account"
|
||||
accountName: "Status Account",
|
||||
tokenOwnersModel: root.emptyModel
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
@ -540,8 +540,58 @@ StackView {
|
|||
}
|
||||
|
||||
onRemoteDestructRequested: {
|
||||
remotelyDestructPopup.open()
|
||||
// TODO: set the address selected in the popup's list
|
||||
if (token.isPrivilegedToken) {
|
||||
tokenMasterActionPopup.openPopup(
|
||||
TokenMasterActionPopup.ActionType.RemotelyDestruct, name)
|
||||
} else {
|
||||
remotelyDestructPopup.open()
|
||||
// TODO: set the address selected in the popup's list
|
||||
}
|
||||
}
|
||||
|
||||
onBanRequested: {
|
||||
tokenMasterActionPopup.openPopup(
|
||||
TokenMasterActionPopup.ActionType.Ban, name)
|
||||
}
|
||||
|
||||
onKickRequested: {
|
||||
tokenMasterActionPopup.openPopup(
|
||||
TokenMasterActionPopup.ActionType.Kick, name)
|
||||
}
|
||||
|
||||
TokenMasterActionPopup {
|
||||
id: tokenMasterActionPopup
|
||||
|
||||
communityName: root.communityName
|
||||
networkName: view.token.chainName
|
||||
|
||||
accountsModel: SortFilterProxyModel {
|
||||
sourceModel: root.accounts
|
||||
proxyRoles: [
|
||||
ExpressionRole {
|
||||
name: "color"
|
||||
|
||||
function getColor(colorId) {
|
||||
return Utils.getColorForId(colorId)
|
||||
}
|
||||
|
||||
// Direct call for singleton function is not handled properly by
|
||||
// SortFilterProxyModel that's why helper function is used instead.
|
||||
expression: { return getColor(model.colorId) }
|
||||
}
|
||||
]
|
||||
filters: ValueFilter {
|
||||
roleName: "walletType"
|
||||
value: Constants.watchWalletType
|
||||
inverted: true
|
||||
}
|
||||
}
|
||||
|
||||
function openPopup(type, userName) {
|
||||
tokenMasterActionPopup.actionType = type
|
||||
tokenMasterActionPopup.userName = userName
|
||||
open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ Control {
|
|||
signal viewProfileRequested(string address)
|
||||
signal viewMessagesRequested(string address)
|
||||
signal airdropRequested(string address)
|
||||
signal remoteDestructRequested(string address)
|
||||
signal kickRequested(string address)
|
||||
signal banRequested(string address)
|
||||
signal remoteDestructRequested(string name, string address)
|
||||
signal kickRequested(string name, string address)
|
||||
signal banRequested(string name, string address)
|
||||
|
||||
signal generalAirdropRequested
|
||||
|
||||
|
@ -134,11 +134,9 @@ Control {
|
|||
return
|
||||
|
||||
const entry = ModelUtils.get(proxyModel, index)
|
||||
const address = entry.walletAddress
|
||||
const name = entry.name
|
||||
|
||||
menu.rawAddress = name === ""
|
||||
menu.currentAddress = address
|
||||
menu.name = entry.name
|
||||
menu.currentAddress = entry.walletAddress
|
||||
menu.popup(parent, mouse.x, mouse.y)
|
||||
|
||||
holdersList.currentIndex = index
|
||||
|
@ -149,8 +147,9 @@ Control {
|
|||
StatusMenu {
|
||||
id: menu
|
||||
|
||||
property string name
|
||||
property string currentAddress
|
||||
property bool rawAddress
|
||||
readonly property bool rawAddress: name === ""
|
||||
|
||||
onClosed: holdersList.currentIndex = -1
|
||||
|
||||
|
@ -190,7 +189,8 @@ Control {
|
|||
enabled: root.showRemotelyDestructMenuItem
|
||||
type: StatusBaseButton.Type.Danger
|
||||
|
||||
onTriggered: root.remoteDestructRequested(menu.currentAddress)
|
||||
onTriggered: root.remoteDestructRequested(menu.name,
|
||||
menu.currentAddress)
|
||||
}
|
||||
|
||||
StatusAction {
|
||||
|
@ -201,7 +201,8 @@ Control {
|
|||
enabled: !menu.rawAddress
|
||||
type: StatusBaseButton.Type.Danger
|
||||
|
||||
onTriggered: root.kickRequested(menu.currentAddress)
|
||||
onTriggered: root.kickRequested(menu.name,
|
||||
menu.currentAddress)
|
||||
}
|
||||
|
||||
StatusAction {
|
||||
|
@ -212,7 +213,8 @@ Control {
|
|||
enabled: !menu.rawAddress
|
||||
type: StatusBaseButton.Type.Danger
|
||||
|
||||
onTriggered: root.banRequested(menu.currentAddress)
|
||||
onTriggered: root.banRequested(menu.name,
|
||||
menu.currentAddress)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,9 @@ StatusScrollView {
|
|||
signal airdropRequested(string address)
|
||||
signal generalAirdropRequested
|
||||
|
||||
signal remoteDestructRequested(string address)
|
||||
signal remoteDestructRequested(string name, string address)
|
||||
signal kickRequested(string name, string address)
|
||||
signal banRequested(string name, string address)
|
||||
|
||||
signal deployFeesRequested
|
||||
|
||||
|
@ -150,8 +152,6 @@ StatusScrollView {
|
|||
accountErrorText: root.feeErrorText
|
||||
|
||||
model: QtObject {
|
||||
id: singleFeeModel
|
||||
|
||||
readonly property string title: root.feeLabel
|
||||
readonly property string feeText: root.isFeeLoading ?
|
||||
"" : root.feeText
|
||||
|
@ -159,7 +159,7 @@ StatusScrollView {
|
|||
}
|
||||
|
||||
accountsSelector.model: SortFilterProxyModel {
|
||||
sourceModel: root.accounts
|
||||
sourceModel: root.accounts || null
|
||||
proxyRoles: [
|
||||
ExpressionRole {
|
||||
name: "color"
|
||||
|
@ -230,7 +230,10 @@ StatusScrollView {
|
|||
|
||||
onAirdropRequested: root.airdropRequested(address)
|
||||
onGeneralAirdropRequested: root.generalAirdropRequested()
|
||||
onRemoteDestructRequested: root.remoteDestructRequested(address)
|
||||
onRemoteDestructRequested: root.remoteDestructRequested(name, address)
|
||||
|
||||
onKickRequested: root.kickRequested(name, address)
|
||||
onBanRequested: root.banRequested(name, address)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue