Xmr.to: disable tor checkbox on Tails and Whonix

This commit is contained in:
tobtoht 2020-10-11 18:38:33 +02:00
parent 12940361d8
commit 892416bc51
2 changed files with 7 additions and 6 deletions

View file

@ -15,6 +15,7 @@ XMRToWidget::XMRToWidget(QWidget *parent) :
ui(new Ui::XMRToWidget) ui(new Ui::XMRToWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
m_ctx = MainWindow::getContext();
QString amount_rx = R"(^\d*\.\d*$)"; QString amount_rx = R"(^\d*\.\d*$)";
QRegExp rx; QRegExp rx;
@ -62,6 +63,10 @@ XMRToWidget::XMRToWidget(QWidget *parent) :
m_contextMenu->popup(ui->historyTable->viewport()->mapToGlobal(point)); m_contextMenu->popup(ui->historyTable->viewport()->mapToGlobal(point));
} }
}); });
if (m_ctx->isTails || m_ctx->isWhonix) {
ui->torCheckBox->setDisabled(true);
}
} }
void XMRToWidget::setHistoryModel(XmrToModel *model) { void XMRToWidget::setHistoryModel(XmrToModel *model) {
@ -81,8 +86,6 @@ void XMRToWidget::onWalletClosed() {
void XMRToWidget::onCreateOrder() { void XMRToWidget::onCreateOrder() {
// @TODO: regex verify // @TODO: regex verify
if(m_ctx == nullptr)
this->m_ctx = MainWindow::getContext();
auto amount = ui->lineAmount->text(); auto amount = ui->lineAmount->text();
if(amount.isEmpty()) { if(amount.isEmpty()) {
@ -123,9 +126,6 @@ void XMRToWidget::onTorCheckBoxToggled(int state) {
} }
void XMRToWidget::updateConversionLabel() { void XMRToWidget::updateConversionLabel() {
if(m_ctx == nullptr)
this->m_ctx = MainWindow::getContext();
QString amount = ui->lineAmount->text(); QString amount = ui->lineAmount->text();
int curIndex = ui->comboBox_currency->currentIndex(); int curIndex = ui->comboBox_currency->currentIndex();

View file

@ -51,7 +51,8 @@ private:
Ui::XMRToWidget *ui; Ui::XMRToWidget *ui;
AppContext *m_ctx; AppContext *m_ctx;
bool m_ratesDisplayed = false; 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; double m_unlockedBalance = 0;
XmrToModel *tableModel; XmrToModel *tableModel;