DebugInfoDialog: Add Tails version

This commit is contained in:
tobtoht 2020-10-15 01:36:33 +02:00
parent 1febbc869f
commit ec0d88cf1b
3 changed files with 20 additions and 1 deletions

View file

@ -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_seedType->setText(ctx->currentWallet->getCacheAttribute("feather.seed").isEmpty() ? "25 word" : "14 word");
ui->label_viewOnly->setText(ctx->currentWallet->viewOnly() ? "True" : "False"); 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())); ui->label_timestamp->setText(QString::number(QDateTime::currentSecsSinceEpoch()));
connect(ui->btn_Copy, &QPushButton::clicked, this, &DebugInfoDialog::copyToClipboad); connect(ui->btn_Copy, &QPushButton::clicked, this, &DebugInfoDialog::copyToClipboad);

View file

@ -38,6 +38,20 @@ bool TailsOS::detectDotPersistence()
return QDir(tailsPathData + "dotfiles").exists(); 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() void TailsOS::showDataPersistenceDisabledWarning()
{ {
QMessageBox msgBox; QMessageBox msgBox;

View file

@ -13,6 +13,7 @@ public:
static bool detect(); static bool detect();
static bool detectDataPersistence(); static bool detectDataPersistence();
static bool detectDotPersistence(); static bool detectDotPersistence();
static QString version();
static void showDataPersistenceDisabledWarning(); static void showDataPersistenceDisabledWarning();
static void askPersistence(); static void askPersistence();