mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 03:59:38 +00:00
Merge pull request #3611
0ce3e4b
WizardOpenWallet1: navigate with keyboard; enable accessibility (rating89us)
This commit is contained in:
commit
b6682330a6
6 changed files with 101 additions and 16 deletions
3
main.qml
3
main.qml
|
@ -211,6 +211,9 @@ ApplicationWindow {
|
||||||
if (prevState) {
|
if (prevState) {
|
||||||
appWindow.viewState = prevState;
|
appWindow.viewState = prevState;
|
||||||
}
|
}
|
||||||
|
if (wizard.wizardState == "wizardOpenWallet1") {
|
||||||
|
wizard.wizardStateView.wizardOpenWallet1View.pageRoot.forceActiveFocus();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
passwordDialog.open(usefulName(persistentSettings.wallet_path));
|
passwordDialog.open(usefulName(persistentSettings.wallet_path));
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,7 @@ Rectangle {
|
||||||
|
|
||||||
property var m_wallet;
|
property var m_wallet;
|
||||||
property alias wizardState: wizardStateView.state
|
property alias wizardState: wizardStateView.state
|
||||||
|
property alias wizardStateView: wizardStateView
|
||||||
property alias wizardStackView: stackView
|
property alias wizardStackView: stackView
|
||||||
property int wizardSubViewWidth: 780
|
property int wizardSubViewWidth: 780
|
||||||
property int wizardSubViewTopMargin: persistentSettings.customDecorations ? 90 : 32
|
property int wizardSubViewTopMargin: persistentSettings.customDecorations ? 90 : 32
|
||||||
|
|
|
@ -43,7 +43,6 @@ ColumnLayout {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: title
|
text: title
|
||||||
Layout.fillWidth: true
|
|
||||||
font.family: MoneroComponents.Style.fontRegular.name
|
font.family: MoneroComponents.Style.fontRegular.name
|
||||||
color: MoneroComponents.Style.defaultFontColor
|
color: MoneroComponents.Style.defaultFontColor
|
||||||
opacity: MoneroComponents.Style.blackTheme ? 1.0 : 0.8
|
opacity: MoneroComponents.Style.blackTheme ? 1.0 : 0.8
|
||||||
|
@ -59,11 +58,15 @@ ColumnLayout {
|
||||||
leftPadding: 0
|
leftPadding: 0
|
||||||
topPadding: 0
|
topPadding: 0
|
||||||
bottomPadding: 0
|
bottomPadding: 0
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: parent.parent.focus ? MoneroComponents.Style.titleBarButtonHoverColor : "transparent"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
Layout.fillWidth: true
|
Layout.alignment: Qt.AlignLeft
|
||||||
Layout.alignment: Qt.AlignCenter
|
|
||||||
visible: parent.subtitle !== ""
|
visible: parent.subtitle !== ""
|
||||||
|
|
||||||
color: MoneroComponents.Style.dimmedFontColor
|
color: MoneroComponents.Style.dimmedFontColor
|
||||||
|
@ -81,5 +84,10 @@ ColumnLayout {
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
leftPadding: 0
|
leftPadding: 0
|
||||||
topPadding: 0
|
topPadding: 0
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: parent.parent.focus ? MoneroComponents.Style.titleBarButtonHoverColor : "transparent"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,6 +120,7 @@ Rectangle {
|
||||||
|
|
||||||
onMenuClicked: {
|
onMenuClicked: {
|
||||||
wizardStateView.state = "wizardOpenWallet1"
|
wizardStateView.state = "wizardOpenWallet1"
|
||||||
|
wizardStateView.wizardOpenWallet1View.pageRoot.forceActiveFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,8 @@ import "../components" as MoneroComponents
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: menuNav
|
id: menuNav
|
||||||
property alias progressEnabled: wizardProgress.visible
|
property alias progressEnabled: wizardProgress.visible
|
||||||
|
property var btnPrevKeyNavigationBackTab: btnNext
|
||||||
|
property var btnNextKeyNavigationTab: btnPrev
|
||||||
property int progressSteps: 0
|
property int progressSteps: 0
|
||||||
property int progress: 0
|
property int progress: 0
|
||||||
property bool autoTransition: true
|
property bool autoTransition: true
|
||||||
|
@ -77,7 +79,18 @@ RowLayout {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
menuNav.m_prevClicked();
|
menuNav.m_prevClicked();
|
||||||
menuNav.prevClicked();
|
menuNav.prevClicked();
|
||||||
|
focus = false;
|
||||||
}
|
}
|
||||||
|
Accessible.role: Accessible.Button
|
||||||
|
Accessible.name: text
|
||||||
|
KeyNavigation.up: btnPrevKeyNavigationBackTab
|
||||||
|
KeyNavigation.backtab: btnPrevKeyNavigationBackTab
|
||||||
|
KeyNavigation.down: wizardProgress.visible ? wizardProgress
|
||||||
|
: btnNext.visible && btnNext.enabled ? btnNext
|
||||||
|
: btnNextKeyNavigationTab
|
||||||
|
KeyNavigation.tab: wizardProgress.visible ? wizardProgress
|
||||||
|
: btnNext.visible && btnNext.enabled ? btnNext
|
||||||
|
: btnNextKeyNavigationTab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +114,17 @@ RowLayout {
|
||||||
// @TODO: Qt 5.10+ replace === with <=
|
// @TODO: Qt 5.10+ replace === with <=
|
||||||
color: index === menuNav.progress ? MoneroComponents.Style.defaultFontColor : MoneroComponents.Style.progressBarBackgroundColor
|
color: index === menuNav.progress ? MoneroComponents.Style.defaultFontColor : MoneroComponents.Style.progressBarBackgroundColor
|
||||||
}
|
}
|
||||||
|
Accessible.role: Accessible.Indicator
|
||||||
|
Accessible.name: qsTr("Step (%1) of (%2)").arg(currentIndex + 1).arg(count) + translationManager.emptyString
|
||||||
|
KeyNavigation.up: btnPrev
|
||||||
|
KeyNavigation.backtab: btnPrev
|
||||||
|
KeyNavigation.down: btnNext
|
||||||
|
KeyNavigation.tab: btnNext
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: wizardProgress.focus ? MoneroComponents.Style.titleBarButtonHoverColor : "transparent"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +143,14 @@ RowLayout {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
menuNav.m_nextClicked();
|
menuNav.m_nextClicked();
|
||||||
menuNav.nextClicked();
|
menuNav.nextClicked();
|
||||||
|
focus = false;
|
||||||
}
|
}
|
||||||
|
Accessible.role: Accessible.Button
|
||||||
|
Accessible.name: text
|
||||||
|
KeyNavigation.up: wizardProgress.visible ? wizardProgress : btnPrev
|
||||||
|
KeyNavigation.backtab: wizardProgress.visible ? wizardProgress : btnPrev
|
||||||
|
KeyNavigation.down: btnNextKeyNavigationTab
|
||||||
|
KeyNavigation.tab: btnNextKeyNavigationTab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ Rectangle {
|
||||||
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
property alias pageHeight: pageRoot.height
|
property alias pageHeight: pageRoot.height
|
||||||
|
property alias pageRoot: pageRoot
|
||||||
property string viewName: "wizardOpenWallet1"
|
property string viewName: "wizardOpenWallet1"
|
||||||
property int walletCount: walletKeysFilesModel.rowCount()
|
property int walletCount: walletKeysFilesModel.rowCount()
|
||||||
|
|
||||||
|
@ -58,6 +59,7 @@ Rectangle {
|
||||||
width: parent.width - 100
|
width: parent.width - 100
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
anchors.horizontalCenter: parent.horizontalCenter;
|
anchors.horizontalCenter: parent.horizontalCenter;
|
||||||
|
KeyNavigation.tab: openWalletFromFileHeader
|
||||||
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
|
@ -69,8 +71,15 @@ Rectangle {
|
||||||
spacing: 10
|
spacing: 10
|
||||||
|
|
||||||
WizardHeader {
|
WizardHeader {
|
||||||
|
id: openWalletFromFileHeader
|
||||||
title: qsTr("Open a wallet from file") + translationManager.emptyString
|
title: qsTr("Open a wallet from file") + translationManager.emptyString
|
||||||
subtitle: qsTr("Import an existing .keys wallet file from your computer.") + translationManager.emptyString
|
subtitle: qsTr("Import an existing .keys wallet file from your computer.") + translationManager.emptyString
|
||||||
|
Accessible.role: Accessible.StaticText
|
||||||
|
Accessible.name: title + ". " + subtitle
|
||||||
|
Keys.onUpPressed: wizardNav.btnNext.forceActiveFocus();
|
||||||
|
Keys.onBacktabPressed: wizardNav.btnNext.forceActiveFocus();
|
||||||
|
Keys.onDownPressed: recentList.itemAt(0).forceActiveFocus();
|
||||||
|
Keys.onTabPressed: recentList.itemAt(0).forceActiveFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
|
@ -122,6 +131,27 @@ Rectangle {
|
||||||
Layout.minimumWidth: flow.itemHeight
|
Layout.minimumWidth: flow.itemHeight
|
||||||
Layout.preferredHeight: parent.height
|
Layout.preferredHeight: parent.height
|
||||||
|
|
||||||
|
function moveUp(itemIndex) {
|
||||||
|
if (itemIndex == 0) {
|
||||||
|
openWalletFromFileHeader.forceActiveFocus();
|
||||||
|
} else {
|
||||||
|
recentList.itemAt(itemIndex - 1).forceActiveFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveDown(itemIndex) {
|
||||||
|
if (itemIndex + 1 == recentList.count) {
|
||||||
|
wizardNav.btnPrev.forceActiveFocus();
|
||||||
|
} else {
|
||||||
|
recentList.itemAt(itemIndex + 1).forceActiveFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function openSelectedWalletFile(networktype, path) {
|
||||||
|
persistentSettings.nettype = parseInt(networktype);
|
||||||
|
wizardController.openWalletFile(path);
|
||||||
|
}
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
// inherited roles from walletKeysFilesModel:
|
// inherited roles from walletKeysFilesModel:
|
||||||
// index, fileName, modified, accessed, path, networktype, address
|
// index, fileName, modified, accessed, path, networktype, address
|
||||||
|
@ -138,7 +168,24 @@ Rectangle {
|
||||||
else if(networktype === 2) return qsTr("Stagenet");
|
else if(networktype === 2) return qsTr("Stagenet");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
color: "transparent"
|
color: item.focus || itemMouseArea.containsMouse ? MoneroComponents.Style.titleBarButtonHoverColor : "transparent"
|
||||||
|
border.width: item.focus ? 3 : 0
|
||||||
|
border.color: MoneroComponents.Style.inputBorderColorActive
|
||||||
|
|
||||||
|
Accessible.role: Accessible.ListItem
|
||||||
|
Accessible.name: {
|
||||||
|
if (networktype === 0) var networkTypeText = qsTr("Mainnet wallet") + translationManager.emptyString;
|
||||||
|
if (networktype === 1) var networkTypeText = qsTr("Testnet wallet") + translationManager.emptyString;
|
||||||
|
if (networktype === 2) var networkTypeText = qsTr("Stagenet wallet") + translationManager.emptyString;
|
||||||
|
|
||||||
|
return fileName + ". " + networkTypeText;
|
||||||
|
}
|
||||||
|
Keys.onUpPressed: recentList.moveUp(index);
|
||||||
|
Keys.onBacktabPressed: recentList.moveUp(index);
|
||||||
|
Keys.onDownPressed: recentList.moveDown(index);
|
||||||
|
Keys.onTabPressed: recentList.moveDown(index);
|
||||||
|
Keys.onEnterPressed: recentList.openSelectedWalletFile(networktype, path);
|
||||||
|
Keys.onReturnPressed: recentList.openSelectedWalletFile(networktype, path);
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
height: 1
|
height: 1
|
||||||
|
@ -257,21 +304,11 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
id: itemMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: recentList.openSelectedWalletFile(networktype, path);
|
||||||
onEntered: {
|
|
||||||
parent.color = MoneroComponents.Style.titleBarButtonHoverColor;
|
|
||||||
}
|
|
||||||
onExited: {
|
|
||||||
parent.color = "transparent";
|
|
||||||
}
|
|
||||||
onClicked: {
|
|
||||||
persistentSettings.nettype = parseInt(networktype)
|
|
||||||
|
|
||||||
wizardController.openWalletFile(path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,11 +319,15 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
WizardNav {
|
WizardNav {
|
||||||
|
id: wizardNav
|
||||||
Layout.topMargin: 0
|
Layout.topMargin: 0
|
||||||
progressEnabled: false
|
progressEnabled: false
|
||||||
btnPrev.text: qsTr("Back to menu") + translationManager.emptyString
|
btnPrev.text: qsTr("Back to menu") + translationManager.emptyString
|
||||||
btnNext.text: qsTr("Browse filesystem") + translationManager.emptyString
|
btnNext.text: qsTr("Browse filesystem") + translationManager.emptyString
|
||||||
btnNext.visible: true
|
btnNext.visible: true
|
||||||
|
btnPrevKeyNavigationBackTab: recentList.itemAt(recentList.count - 1)
|
||||||
|
btnNextKeyNavigationTab: openWalletFromFileHeader
|
||||||
|
|
||||||
onPrevClicked: {
|
onPrevClicked: {
|
||||||
wizardStateView.state = "wizardHome";
|
wizardStateView.state = "wizardHome";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue