]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
send: don't allow fiat conversion if websocket is disabled
authortobtoht <tob@featherwallet.org>
Mon, 13 Feb 2023 09:41:07 +0000 (10:41 +0100)
committertobtoht <tob@featherwallet.org>
Mon, 13 Feb 2023 09:41:07 +0000 (10:41 +0100)
src/MainWindow.cpp
src/SendWidget.cpp
src/SendWidget.h

index fa8a9d76da913943db6254dc9dc4adbf40b64bb1..1ea4e5167f4debf41c52bba436b5912de11345ce 100644 (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);
index 5fd063a6fa8aa7a4ee01c90ddcd9558743816cb5..205db7505692628f3cfce4ca41e6fa83c789f1a8 100644 (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);
index 0df426e12841fd077cd9a85832369cdaf64adae6..5369ac7dce1bbea5aa2a78897694fa37a6a08189 100644 (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();