From ec0d88cf1ba95524fd36165d0e9a562d03773878 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Thu, 15 Oct 2020 01:36:33 +0200 Subject: [PATCH] DebugInfoDialog: Add Tails version --- src/dialog/debuginfodialog.cpp | 6 +++++- src/utils/tails.cpp | 14 ++++++++++++++ src/utils/tails.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/dialog/debuginfodialog.cpp b/src/dialog/debuginfodialog.cpp index aa3c1ae..8366f0e 100644 --- a/src/dialog/debuginfodialog.cpp +++ b/src/dialog/debuginfodialog.cpp @@ -43,7 +43,11 @@ DebugInfoDialog::DebugInfoDialog(AppContext *ctx, QWidget *parent) ui->label_seedType->setText(ctx->currentWallet->getCacheAttribute("feather.seed").isEmpty() ? "25 word" : "14 word"); ui->label_viewOnly->setText(ctx->currentWallet->viewOnly() ? "True" : "False"); - ui->label_OS->setText(QSysInfo::prettyProductName()); + QString os = QSysInfo::prettyProductName(); + if (ctx->isTails) { + os = QString("Tails %1").arg(TailsOS::version()); + } + ui->label_OS->setText(os); ui->label_timestamp->setText(QString::number(QDateTime::currentSecsSinceEpoch())); connect(ui->btn_Copy, &QPushButton::clicked, this, &DebugInfoDialog::copyToClipboad); diff --git a/src/utils/tails.cpp b/src/utils/tails.cpp index 8e90149..ae8cbde 100644 --- a/src/utils/tails.cpp +++ b/src/utils/tails.cpp @@ -38,6 +38,20 @@ bool TailsOS::detectDotPersistence() return QDir(tailsPathData + "dotfiles").exists(); } +QString TailsOS::version() +{ + if (!Utils::fileExists("/etc/os-release")) + return ""; + + QByteArray data = Utils::fileOpen("/etc/os-release"); + QRegExp re(R"(TAILS_VERSION_ID="(\d+.\d+))"); + int pos = re.indexIn(data); + if (pos >= 0) { + return re.cap(1); + } + return ""; +} + void TailsOS::showDataPersistenceDisabledWarning() { QMessageBox msgBox; diff --git a/src/utils/tails.h b/src/utils/tails.h index 068c59a..0f827c2 100644 --- a/src/utils/tails.h +++ b/src/utils/tails.h @@ -13,6 +13,7 @@ public: static bool detect(); static bool detectDataPersistence(); static bool detectDotPersistence(); + static QString version(); static void showDataPersistenceDisabledWarning(); static void askPersistence();