2023-03-27 12:49:32 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
import "../stores"
|
|
|
|
|
|
|
|
StatusMenu {
|
|
|
|
id: root
|
|
|
|
|
2023-04-13 10:27:56 +00:00
|
|
|
required property string uniqueIdentifier // unique idetifier added as postfix to options' objectName (used for ui tests)
|
2023-03-27 12:49:32 +00:00
|
|
|
property var account
|
|
|
|
|
|
|
|
signal editAccountClicked()
|
|
|
|
signal deleteAccountClicked()
|
|
|
|
signal addNewAccountClicked()
|
|
|
|
signal addWatchOnlyAccountClicked()
|
|
|
|
|
|
|
|
width: 204
|
|
|
|
|
|
|
|
onAboutToShow: {
|
|
|
|
d.resetCopyAddressAction()
|
|
|
|
}
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
function resetCopyAddressAction() {
|
|
|
|
copyAddressAction.action.text = qsTr("Copy address")
|
|
|
|
copyAddressAction.action.type = StatusAction.Type.Normal
|
|
|
|
copyAddressAction.action.icon.name = "copy"
|
|
|
|
copyAddressAction.action.icon.color = Theme.palette.primaryColor1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
id: copyAddressAction
|
2023-04-13 10:27:56 +00:00
|
|
|
objectName: "AccountMenu-CopyAddressAction-%1".arg(root.uniqueIdentifier)
|
2023-03-27 12:49:32 +00:00
|
|
|
enabled: !!root.account
|
|
|
|
text: qsTr("Copy address")
|
|
|
|
action: StatusAction {}
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
|
|
onClicked: {
|
|
|
|
RootStore.copyToClipboard(root.account.address?? "")
|
|
|
|
copyAddressAction.action.text = qsTr("Address copied")
|
|
|
|
copyAddressAction.action.type = StatusAction.Type.Success
|
|
|
|
copyAddressAction.action.icon.name = "tiny/checkmark"
|
|
|
|
copyAddressAction.action.icon.color = Theme.palette.successColor1
|
|
|
|
|
|
|
|
Backpressure.debounce(root, 1500, function () {
|
|
|
|
d.resetCopyAddressAction()
|
|
|
|
root.dismiss()
|
|
|
|
})()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuSeparator {
|
|
|
|
visible: !!root.account
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusAction {
|
2023-04-13 10:27:56 +00:00
|
|
|
objectName: "AccountMenu-EditAction-%1".arg(root.uniqueIdentifier)
|
2023-03-27 12:49:32 +00:00
|
|
|
enabled: !!root.account
|
|
|
|
text: qsTr("Edit")
|
|
|
|
icon.name: "pencil-outline"
|
|
|
|
onTriggered: {
|
|
|
|
root.editAccountClicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusAction {
|
2023-04-13 10:27:56 +00:00
|
|
|
objectName: "AccountMenu-DeleteAction-%1".arg(root.uniqueIdentifier)
|
2023-03-27 12:49:32 +00:00
|
|
|
enabled: !!root.account && root.account.walletType !== ""
|
|
|
|
text: qsTr("Delete")
|
|
|
|
icon.name: "info"
|
|
|
|
type: StatusAction.Type.Danger
|
|
|
|
onTriggered: {
|
|
|
|
root.deleteAccountClicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuSeparator {
|
|
|
|
visible: !!root.account
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusAction {
|
2023-04-13 10:27:56 +00:00
|
|
|
objectName: "AccountMenu-AddNewAccountAction-%1".arg(root.uniqueIdentifier)
|
2023-03-27 12:49:32 +00:00
|
|
|
text: qsTr("Add new account")
|
|
|
|
icon.name: "add"
|
|
|
|
onTriggered: {
|
|
|
|
root.addNewAccountClicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusAction {
|
2023-04-13 10:27:56 +00:00
|
|
|
objectName: "AccountMenu-AddWatchOnlyAccountAction-%1".arg(root.uniqueIdentifier)
|
2023-03-27 12:49:32 +00:00
|
|
|
text: qsTr("Add watch-only account")
|
|
|
|
icon.name: "show"
|
|
|
|
onTriggered: {
|
|
|
|
root.addWatchOnlyAccountClicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|