mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-10 03:42:05 +02:00
transfer: messaging for disabled send button
This commit is contained in:
parent
a89ffd02d0
commit
01844efaa7
@ -48,6 +48,7 @@ Rectangle {
|
|||||||
color: "transparent"
|
color: "transparent"
|
||||||
property int mixin: 10 // (ring size 11)
|
property int mixin: 10 // (ring size 11)
|
||||||
property string warningContent: ""
|
property string warningContent: ""
|
||||||
|
property string sendButtonWarning: ""
|
||||||
property string startLinkText: qsTr("<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style><font size='2'> (</font><a href='#'>Start daemon</a><font size='2'>)</font>") + translationManager.emptyString
|
property string startLinkText: qsTr("<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style><font size='2'> (</font><a href='#'>Start daemon</a><font size='2'>)</font>") + translationManager.emptyString
|
||||||
property bool showAdvanced: false
|
property bool showAdvanced: false
|
||||||
|
|
||||||
@ -84,6 +85,7 @@ Rectangle {
|
|||||||
addressLine.text = ""
|
addressLine.text = ""
|
||||||
setPaymentId("");
|
setPaymentId("");
|
||||||
amountLine.text = ""
|
amountLine.text = ""
|
||||||
|
root.sendButtonWarning = ""
|
||||||
setDescription("");
|
setDescription("");
|
||||||
priorityDropdown.currentIndex = 0
|
priorityDropdown.currentIndex = 0
|
||||||
updatePriorityDropdown()
|
updatePriorityDropdown()
|
||||||
@ -356,6 +358,12 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MoneroComponents.WarningBox {
|
||||||
|
id: sendButtonWarningBox
|
||||||
|
text: root.sendButtonWarning
|
||||||
|
visible: root.sendButtonWarning !== ""
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
StandardButton {
|
StandardButton {
|
||||||
id: sendButton
|
id: sendButton
|
||||||
@ -363,35 +371,8 @@ Rectangle {
|
|||||||
rightIconInactive: "../images/rightArrowInactive.png"
|
rightIconInactive: "../images/rightArrowInactive.png"
|
||||||
Layout.topMargin: 4 * scaleRatio
|
Layout.topMargin: 4 * scaleRatio
|
||||||
text: qsTr("Send") + translationManager.emptyString
|
text: qsTr("Send") + translationManager.emptyString
|
||||||
// Send button is enabled when:
|
|
||||||
enabled: {
|
enabled: {
|
||||||
// Currently opened wallet is not view-only
|
updateSendButton()
|
||||||
if(appWindow.viewOnly){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// There is no warning box displayed
|
|
||||||
if(root.warningContent !== ''){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The transactional information is correct
|
|
||||||
if(!pageRoot.checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.nettype)){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// There are sufficient unlocked funds available
|
|
||||||
if(parseFloat(amountLine.text) > parseFloat(unlockedBalanceText)){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The amount does not start with a period (example: `.4`)
|
|
||||||
// @TODO: replace with .startsWith() after Qt >=5.8
|
|
||||||
if(amountLine.text.indexOf('.') === 0){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log("Transfer: paymentClicked")
|
console.log("Transfer: paymentClicked")
|
||||||
@ -717,4 +698,34 @@ Rectangle {
|
|||||||
setPaymentId(paymentId);
|
setPaymentId(paymentId);
|
||||||
setDescription(description);
|
setDescription(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateSendButton(){
|
||||||
|
// reset message
|
||||||
|
root.sendButtonWarning = "";
|
||||||
|
|
||||||
|
// Currently opened wallet is not view-only
|
||||||
|
if(appWindow.viewOnly){
|
||||||
|
root.sendButtonWarning = qsTr("Wallet is view-only and sends are not possible.") + translationManager.emptyString;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// There are sufficient unlocked funds available
|
||||||
|
if(parseFloat(amountLine.text) > parseFloat(middlePanel.unlockedBalanceText)){
|
||||||
|
root.sendButtonWarning = qsTr("Amount is more than unlocked balance.") + translationManager.emptyString;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// There is no warning box displayed
|
||||||
|
if(root.warningContent !== ""){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The transactional information is correct
|
||||||
|
if(!pageRoot.checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.nettype)){
|
||||||
|
if(amountLine.text && addressLine.text)
|
||||||
|
root.sendButtonWarning = qsTr("Transaction information is incorrect.") + translationManager.emptyString;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user