@ -31,6 +31,9 @@ void MainWindow::setupSendTab() {
// Max available Checkbox
QObject : : connect ( ui - > Max1 , & QCheckBox : : stateChanged , this , & MainWindow : : maxAmountChecked ) ;
//Custom Fee Checkbox
QObject : : connect ( ui - > customFee , & QCheckBox : : stateChanged , this , & MainWindow : : toggleMinerFeeEditable ) ;
// The first Address button
QObject : : connect ( ui - > Address1 , & QLineEdit : : textChanged , [ = ] ( auto text ) {
this - > addressChanged ( 1 , text ) ;
@ -57,8 +60,8 @@ void MainWindow::setupSendTab() {
this - > amountChanged ( 1 , text ) ;
} ) ;
// Fee amount changed
ui - > minerFeeAmt - > setReadOnly ( true ) ;
// Fee amount changed
QObject : : connect ( ui - > minerFeeAmt , & QLineEdit : : textChanged , [ = ] ( auto txt ) {
CAmount fee = CAmount : : fromDecimalString ( txt ) ;
@ -520,7 +523,6 @@ Tx MainWindow::createTxFromSendPage() {
CAmount amt ;
// Make sure it parses
amtStr . toDouble ( & ok ) ;
if ( ! ok ) {
@ -534,16 +536,21 @@ Tx MainWindow::createTxFromSendPage() {
QString memo = ui - > sendToWidgets - > findChild < QLabel * > ( QString ( " MemoTxt " ) % QString : : number ( i + 1 ) ) - > text ( ) . trimmed ( ) ;
tx . toAddrs . push_back ( ToFields { addr , amt , memo } ) ;
}
// Allow Custom Fee in SendTab
bool customFee = ui - > customFee - > isChecked ( ) ;
CAmount fee ;
if ( customFee ) {
QString feeStr = ui - > minerFeeAmt - > text ( ) ;
tx . fee = CAmount : : fromDecimalString ( feeStr ) ;
} else {
tx . fee = Settings : : getMinerFee ( ) ;
}
return tx ;
}
@ -797,11 +804,20 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
confirm . lblRecurringDesc - > setText ( rpi - > getScheduleDescription ( ) ) ;
}
CAmount defaultFee = Settings : : getMinerFee ( ) ;
if ( tx . fee . toDecimalString ( ) ! = defaultFee . toDecimalString ( ) ) {
auto customFeeWarning = new QLabel ( confirm . sendToAddrs ) ;
customFeeWarning - > setObjectName ( QStringLiteral ( " Custom Fee " ) ) ;
customFeeWarning - > setText ( tr ( " You are using a custom Fee " ) ) ;
customFeeWarning - > setStyleSheet ( " color: red; " ) ;
confirm . gridLayout - > addWidget ( customFeeWarning ) ;
confirm . gridLayout - > rowStretch ( 1 ) ;
row + + ;
}
// Syncing warning
confirm . syncingWarning - > setVisible ( Settings : : getInstance ( ) - > isSyncing ( ) ) ;
// Show the dialog and submit it if the user confirms
return d . exec ( ) = = QDialog : : Accepted ;
}
@ -864,7 +880,7 @@ void MainWindow::sendButton() {
d - > show ( ) ;
// And send the Tx
rpc - > executeTransaction ( tx ,
rpc - > executeTransaction ( tx , false ,
[ = ] ( QString txid ) {
ui - > statusBar - > showMessage ( Settings : : txidStatusMessage + " " + txid ) ;
@ -956,9 +972,24 @@ QString MainWindow::doSendTxValidations(Tx tx) {
. arg ( available . toDecimalhushString ( ) , total . toDecimalhushString ( ) ) ;
}
if ( total = = 0 ) {
return tr ( " Value or fee must be > 0 \n \n Value and fee cannot both be 0. " ) ;
}
return " " ;
}
void MainWindow : : cancelButton ( ) {
clearSendForm ( ) ;
}
//Check for custom fee checkbox
void MainWindow : : toggleMinerFeeEditable ( int state ) {
if ( state = = Qt : : Checked ) {
ui - > minerFeeAmt - > setReadOnly ( false ) ;
} else {
ui - > minerFeeAmt - > setReadOnly ( true ) ;
ui - > minerFeeAmt - > setText ( Settings : : getMinerFee ( ) . toDecimalString ( ) ) ;
}
}