From 892416bc5155d5ee5ba0ab03fd53daff4d5e5a3b Mon Sep 17 00:00:00 2001 From: tobtoht Date: Sun, 11 Oct 2020 18:38:33 +0200 Subject: [PATCH] Xmr.to: disable tor checkbox on Tails and Whonix --- src/xmrtowidget.cpp | 10 +++++----- src/xmrtowidget.h | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/xmrtowidget.cpp b/src/xmrtowidget.cpp index fb930a2..b9263b1 100644 --- a/src/xmrtowidget.cpp +++ b/src/xmrtowidget.cpp @@ -15,6 +15,7 @@ XMRToWidget::XMRToWidget(QWidget *parent) : ui(new Ui::XMRToWidget) { ui->setupUi(this); + m_ctx = MainWindow::getContext(); QString amount_rx = R"(^\d*\.\d*$)"; QRegExp rx; @@ -62,6 +63,10 @@ XMRToWidget::XMRToWidget(QWidget *parent) : m_contextMenu->popup(ui->historyTable->viewport()->mapToGlobal(point)); } }); + + if (m_ctx->isTails || m_ctx->isWhonix) { + ui->torCheckBox->setDisabled(true); + } } void XMRToWidget::setHistoryModel(XmrToModel *model) { @@ -81,8 +86,6 @@ void XMRToWidget::onWalletClosed() { void XMRToWidget::onCreateOrder() { // @TODO: regex verify - if(m_ctx == nullptr) - this->m_ctx = MainWindow::getContext(); auto amount = ui->lineAmount->text(); if(amount.isEmpty()) { @@ -123,9 +126,6 @@ void XMRToWidget::onTorCheckBoxToggled(int state) { } void XMRToWidget::updateConversionLabel() { - if(m_ctx == nullptr) - this->m_ctx = MainWindow::getContext(); - QString amount = ui->lineAmount->text(); int curIndex = ui->comboBox_currency->currentIndex(); diff --git a/src/xmrtowidget.h b/src/xmrtowidget.h index 8d33d7a..4afe3d1 100644 --- a/src/xmrtowidget.h +++ b/src/xmrtowidget.h @@ -51,7 +51,8 @@ private: Ui::XMRToWidget *ui; AppContext *m_ctx; bool m_ratesDisplayed = false; - const QString m_regionBlockMessage = "Beware that XMR.To region blocks certain IPs, which can be problematic in combination with Tor. Use the clearnet option if this is a problem."; + const QString m_regionBlockMessage = "Beware that XMR.To region blocks certain IPs, which can be problematic in combination with Tor. " + "Wait a few minutes for the circuit to switch, or disable the option to relay over Tor if the problem persists."; double m_unlockedBalance = 0; XmrToModel *tableModel;