qml: disable menu option associated with current page
This commit is contained in:
@@ -4,6 +4,8 @@ import QtQuick.Controls 2.0
|
|||||||
import QtQuick.Controls.Material 2.0
|
import QtQuick.Controls.Material 2.0
|
||||||
|
|
||||||
Pane {
|
Pane {
|
||||||
|
objectName: 'About'
|
||||||
|
|
||||||
property string title: qsTr("About Electrum")
|
property string title: qsTr("About Electrum")
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import "controls"
|
|||||||
|
|
||||||
Pane {
|
Pane {
|
||||||
id: rootItem
|
id: rootItem
|
||||||
|
objectName: 'Addresses'
|
||||||
|
|
||||||
padding: 0
|
padding: 0
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import "controls"
|
|||||||
|
|
||||||
Pane {
|
Pane {
|
||||||
id: root
|
id: root
|
||||||
|
objectName: 'Channels'
|
||||||
|
|
||||||
padding: 0
|
padding: 0
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import "controls"
|
|||||||
|
|
||||||
Pane {
|
Pane {
|
||||||
id: preferences
|
id: preferences
|
||||||
|
objectName: 'Properties'
|
||||||
|
|
||||||
property string title: qsTr("Preferences")
|
property string title: qsTr("Preferences")
|
||||||
|
|
||||||
|
|||||||
@@ -78,41 +78,42 @@ Item {
|
|||||||
id: menu
|
id: menu
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
icon.color: 'transparent'
|
icon.color: action.enabled ? 'transparent' : Material.iconDisabledColor
|
||||||
|
icon.source: '../../icons/wallet.png'
|
||||||
action: Action {
|
action: Action {
|
||||||
text: qsTr('Wallet details')
|
text: qsTr('Wallet details')
|
||||||
enabled: Daemon.currentWallet
|
enabled: Daemon.currentWallet && app.stack.currentItem.objectName != 'WalletDetails'
|
||||||
onTriggered: menu.openPage(Qt.resolvedUrl('WalletDetails.qml'))
|
onTriggered: menu.openPage(Qt.resolvedUrl('WalletDetails.qml'))
|
||||||
icon.source: '../../icons/wallet.png'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
icon.color: 'transparent'
|
icon.color: action.enabled ? 'transparent' : Material.iconDisabledColor
|
||||||
|
icon.source: '../../icons/tab_addresses.png'
|
||||||
action: Action {
|
action: Action {
|
||||||
text: qsTr('Addresses');
|
text: qsTr('Addresses');
|
||||||
onTriggered: menu.openPage(Qt.resolvedUrl('Addresses.qml'));
|
onTriggered: menu.openPage(Qt.resolvedUrl('Addresses.qml'));
|
||||||
enabled: Daemon.currentWallet
|
enabled: Daemon.currentWallet && app.stack.currentItem.objectName != 'Addresses'
|
||||||
icon.source: '../../icons/tab_addresses.png'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
icon.color: 'transparent'
|
icon.color: action.enabled ? 'transparent' : Material.iconDisabledColor
|
||||||
|
icon.source: '../../icons/lightning.png'
|
||||||
action: Action {
|
action: Action {
|
||||||
text: qsTr('Channels');
|
text: qsTr('Channels');
|
||||||
enabled: Daemon.currentWallet && Daemon.currentWallet.isLightning
|
enabled: Daemon.currentWallet && Daemon.currentWallet.isLightning && app.stack.currentItem.objectName != 'Channels'
|
||||||
onTriggered: menu.openPage(Qt.resolvedUrl('Channels.qml'))
|
onTriggered: menu.openPage(Qt.resolvedUrl('Channels.qml'))
|
||||||
icon.source: '../../icons/lightning.png'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuSeparator { }
|
MenuSeparator { }
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
icon.color: 'transparent'
|
icon.color: action.enabled ? 'transparent' : Material.iconDisabledColor
|
||||||
|
icon.source: '../../icons/file.png'
|
||||||
action: Action {
|
action: Action {
|
||||||
text: qsTr('Other wallets');
|
text: qsTr('Other wallets')
|
||||||
|
enabled: app.stack.currentItem.objectName != 'Wallets'
|
||||||
onTriggered: menu.openPage(Qt.resolvedUrl('Wallets.qml'))
|
onTriggered: menu.openPage(Qt.resolvedUrl('Wallets.qml'))
|
||||||
icon.source: '../../icons/file.png'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,29 +49,32 @@ ApplicationWindow
|
|||||||
id: menu
|
id: menu
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
icon.color: 'transparent'
|
icon.color: action.enabled ? 'transparent' : Material.iconDisabledColor
|
||||||
|
icon.source: '../../icons/network.png'
|
||||||
action: Action {
|
action: Action {
|
||||||
text: qsTr('Network')
|
text: qsTr('Network')
|
||||||
onTriggered: menu.openPage(Qt.resolvedUrl('NetworkOverview.qml'))
|
onTriggered: menu.openPage(Qt.resolvedUrl('NetworkOverview.qml'))
|
||||||
icon.source: '../../icons/network.png'
|
enabled: stack.currentItem.objectName != 'NetworkOverview'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
icon.color: 'transparent'
|
icon.color: action.enabled ? 'transparent' : Material.iconDisabledColor
|
||||||
|
icon.source: '../../icons/preferences.png'
|
||||||
action: Action {
|
action: Action {
|
||||||
text: qsTr('Preferences');
|
text: qsTr('Preferences')
|
||||||
onTriggered: menu.openPage(Qt.resolvedUrl('Preferences.qml'))
|
onTriggered: menu.openPage(Qt.resolvedUrl('Preferences.qml'))
|
||||||
icon.source: '../../icons/preferences.png'
|
enabled: stack.currentItem.objectName != 'Properties'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
icon.color: 'transparent'
|
icon.color: action.enabled ? 'transparent' : Material.iconDisabledColor
|
||||||
|
icon.source: '../../icons/electrum.png'
|
||||||
action: Action {
|
action: Action {
|
||||||
text: qsTr('About');
|
text: qsTr('About');
|
||||||
onTriggered: menu.openPage(Qt.resolvedUrl('About.qml'))
|
onTriggered: menu.openPage(Qt.resolvedUrl('About.qml'))
|
||||||
icon.source: '../../icons/electrum.png'
|
enabled: stack.currentItem.objectName != 'About'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user