send: don't allow fiat conversion if websocket is disabled

This commit is contained in:
tobtoht 2023-02-13 10:41:07 +01:00
parent 7961b74cc6
commit 199e085709
No known key found for this signature in database
GPG key ID: E45B10DD027D2472
3 changed files with 16 additions and 0 deletions

View file

@ -606,6 +606,7 @@ void MainWindow::onWebsocketStatusChanged(bool enabled) {
ui->tabWidget->setTabVisible(Tabs::EXCHANGES, enabled && config()->get(Config::showTabExchange).toBool());
m_historyWidget->setWebsocketEnabled(enabled);
m_sendWidget->setWebsocketEnabled(enabled);
#ifdef HAS_XMRIG
m_xmrig->setDownloadsTabEnabled(enabled);

View file

@ -236,6 +236,10 @@ void SendWidget::updateConversionLabel() {
return;
}
if (config()->get(Config::disableWebsocket).toBool()) {
return;
}
QString conversionAmountStr = [this]{
QString currency = ui->comboCurrencySelection->currentText();
if (currency != "XMR") {
@ -331,6 +335,16 @@ void SendWidget::disableSendButton() {
ui->btnSend->setEnabled(false);
}
void SendWidget::setWebsocketEnabled(bool enabled) {
this->updateConversionLabel();
if (enabled) {
this->setupComboBox();
} else {
ui->comboCurrencySelection->clear();
ui->comboCurrencySelection->insertItem(0, "XMR");
}
}
void SendWidget::onDataPasted(const QString &data) {
if (!data.isEmpty()) {
QVariantMap uriData = m_ctx->wallet->parse_uri_to_object(data);

View file

@ -41,6 +41,7 @@ public slots:
void onOpenAliasResolved(const QString &openAlias, const QString &address, bool dnssecValid);
void onPreferredFiatCurrencyChanged();
void disableSendButton();
void setWebsocketEnabled(bool enabled);
void onInitiateTransaction();
void onEndTransaction();