mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-22 02:34:36 +00:00
Merge pull request #3111
be1f63f9
PasswordDialog: configurable Ok btn text/icon, non-primary Cancel (xiphon)
This commit is contained in:
commit
619b2d7947
3 changed files with 30 additions and 4 deletions
|
@ -44,6 +44,8 @@ Item {
|
||||||
|
|
||||||
property alias password: passwordInput1.text
|
property alias password: passwordInput1.text
|
||||||
property string walletName
|
property string walletName
|
||||||
|
property var okButtonText
|
||||||
|
property string okButtonIcon
|
||||||
property string errorText
|
property string errorText
|
||||||
property bool passwordDialogMode
|
property bool passwordDialogMode
|
||||||
property bool passphraseDialogMode
|
property bool passphraseDialogMode
|
||||||
|
@ -75,10 +77,12 @@ Item {
|
||||||
appWindow.updateBalance();
|
appWindow.updateBalance();
|
||||||
}
|
}
|
||||||
|
|
||||||
function open(walletName, errorText) {
|
function open(walletName, errorText, okButtonText, okButtonIcon) {
|
||||||
passwordDialogMode = true;
|
passwordDialogMode = true;
|
||||||
passphraseDialogMode = false;
|
passphraseDialogMode = false;
|
||||||
newPasswordDialogMode = false;
|
newPasswordDialogMode = false;
|
||||||
|
root.okButtonText = okButtonText;
|
||||||
|
root.okButtonIcon = okButtonIcon ? okButtonIcon : "";
|
||||||
_openInit(walletName, errorText);
|
_openInit(walletName, errorText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,6 +278,7 @@ Item {
|
||||||
|
|
||||||
MoneroComponents.StandardButton {
|
MoneroComponents.StandardButton {
|
||||||
id: cancelButton
|
id: cancelButton
|
||||||
|
primary: false
|
||||||
small: true
|
small: true
|
||||||
text: qsTr("Cancel") + translationManager.emptyString
|
text: qsTr("Cancel") + translationManager.emptyString
|
||||||
KeyNavigation.tab: passwordInput1
|
KeyNavigation.tab: passwordInput1
|
||||||
|
@ -282,8 +287,10 @@ Item {
|
||||||
|
|
||||||
MoneroComponents.StandardButton {
|
MoneroComponents.StandardButton {
|
||||||
id: okButton
|
id: okButton
|
||||||
|
fontAwesomeIcon: true
|
||||||
|
rightIcon: okButtonIcon
|
||||||
small: true
|
small: true
|
||||||
text: qsTr("Ok") + translationManager.emptyString
|
text: okButtonText ? okButtonText : qsTr("Ok") + translationManager.emptyString
|
||||||
KeyNavigation.tab: cancelButton
|
KeyNavigation.tab: cancelButton
|
||||||
enabled: (passwordDialogMode == true) ? true : passwordInput1.text === passwordInput2.text
|
enabled: (passwordDialogMode == true) ? true : passwordInput1.text === passwordInput2.text
|
||||||
onClicked: onOk()
|
onClicked: onOk()
|
||||||
|
|
|
@ -29,10 +29,13 @@
|
||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
|
import FontAwesome 1.0
|
||||||
|
|
||||||
import "../components" as MoneroComponents
|
import "../components" as MoneroComponents
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: button
|
id: button
|
||||||
|
property bool fontAwesomeIcon: false
|
||||||
property bool primary: true
|
property bool primary: true
|
||||||
property string rightIcon: ""
|
property string rightIcon: ""
|
||||||
property string rightIconInactive: ""
|
property string rightIconInactive: ""
|
||||||
|
@ -135,7 +138,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
visible: button.rightIcon !== ""
|
visible: !fontAwesomeIcon && button.rightIcon !== ""
|
||||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
||||||
width: button.small ? 16 : 20
|
width: button.small ? 16 : 20
|
||||||
height: button.small ? 16 : 20
|
height: button.small ? 16 : 20
|
||||||
|
@ -146,6 +149,16 @@ Item {
|
||||||
return button.rightIcon;
|
return button.rightIcon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
||||||
|
color: MoneroComponents.Style.defaultFontColor
|
||||||
|
font.family: FontAwesome.fontFamilySolid
|
||||||
|
font.pixelSize: button.small ? 16 : 20
|
||||||
|
font.styleName: "Solid"
|
||||||
|
text: button.rightIcon
|
||||||
|
visible: fontAwesomeIcon && button.rightIcon !== ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
8
main.qml
8
main.qml
|
@ -33,6 +33,8 @@ import QtQuick.Controls.Styles 1.1
|
||||||
import QtQuick.Dialogs 1.2
|
import QtQuick.Dialogs 1.2
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
|
import FontAwesome 1.0
|
||||||
|
|
||||||
import moneroComponents.Network 1.0
|
import moneroComponents.Network 1.0
|
||||||
import moneroComponents.Wallet 1.0
|
import moneroComponents.Wallet 1.0
|
||||||
import moneroComponents.WalletManager 1.0
|
import moneroComponents.WalletManager 1.0
|
||||||
|
@ -1488,7 +1490,11 @@ ApplicationWindow {
|
||||||
if(!persistentSettings.askPasswordBeforeSending) {
|
if(!persistentSettings.askPasswordBeforeSending) {
|
||||||
handleAccepted()
|
handleAccepted()
|
||||||
} else {
|
} else {
|
||||||
passwordDialog.open()
|
passwordDialog.open(
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
(appWindow.viewOnly ? qsTr("Save transaction file") : qsTr("Send transaction")) + translationManager.emptyString,
|
||||||
|
appWindow.viewOnly ? "" : FontAwesome.arrowCircleRight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue