From aa69ab87b85592db03e2253e160031d3948472ed Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Sun, 22 May 2022 02:18:04 +0200 Subject: [PATCH 1/4] Detect non-Mac and non-Windows as Unix to support BSDs next to Linux Building on OpenBSD fails since `showCertificate()` attempts to use the Windows-specific `addTempFile()` function. This is because the current code assumes the target platform to be one of either MacOS, Windows or Linux. `Q_OS_MAC` and `Q_OS_WIN` requiring a number of platform specific code aside, the current code under `Q_OS_LINUX` largely works unmodified on other `Q_OS_UNIX` platforms such as OpenBSD. More fixes are required, e.g. to PKCS11 module loading, but this is the only one required to build DigiDoc4 Client as-is on OpenBSD. Signed-off-by: Klemens Nanni --- client/dialogs/CertificateDetails.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/dialogs/CertificateDetails.cpp b/client/dialogs/CertificateDetails.cpp index eb968089..d26b0361 100644 --- a/client/dialogs/CertificateDetails.cpp +++ b/client/dialogs/CertificateDetails.cpp @@ -207,7 +207,7 @@ QString CertificateDetails::decodeCN(const QString &cn) #ifndef Q_OS_MAC void CertificateDetails::showCertificate(const SslCertificate &cert, QWidget *parent, const QString &suffix) { -#ifdef Q_OS_LINUX +#ifdef Q_OS_UNIX CertificateDetails(cert, parent).exec(); #else Q_UNUSED(parent); From 0b6a4e48b0b45e2984b6854e28274a4487ce4fee Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Sun, 22 May 2022 02:26:31 +0200 Subject: [PATCH 2/4] Extend Linux specific Thunderbird support to UNIX to include BSDs `/usr/bin/thunderbird` is the wrong absoloute path on BSD distributions where third-party software ist usually installed under `/usr/local/`. Desktop environment integration however should work the same. Signed-off-by: Klemens Nanni --- client/Application.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/Application.cpp b/client/Application.cpp index 8c39822d..482dde2f 100644 --- a/client/Application.cpp +++ b/client/Application.cpp @@ -712,7 +712,7 @@ void Application::mailTo( const QUrl &url ) default: break; } } -#elif defined(Q_OS_LINUX) +#elif defined(Q_OS_UNIX) QByteArray thunderbird; QProcess p; QStringList env = QProcess::systemEnvironment(); From 18c99728022ee8758b0a26b82801e487d3d56262 Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Sun, 22 May 2022 02:31:57 +0200 Subject: [PATCH 3/4] Enable progressbar stylesheets on BSDs just like on Linux On MacOS `Q_OS_UNIX` is defined, but since the current code is for Linux alone, exclude MacOS to get stylesheets on Linux and BSDs only. Signed-off-by: Klemens Nanni --- client/dialogs/MobileProgress.cpp | 2 +- client/dialogs/SettingsDialog.cpp | 2 +- client/dialogs/SmartIDProgress.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/dialogs/MobileProgress.cpp b/client/dialogs/MobileProgress.cpp index 89512085..84c5c594 100644 --- a/client/dialogs/MobileProgress.cpp +++ b/client/dialogs/MobileProgress.cpp @@ -93,7 +93,7 @@ MobileProgress::MobileProgress(QWidget *parent) d->info->setFont(Styles::font(Styles::Regular, 14)); d->controlCode->setFont(Styles::font(Styles::Regular, 14)); d->signProgressBar->setFont(d->info->font()); -#ifdef Q_OS_LINUX +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) const auto styleSheet = R"(QProgressBar { background-color: #d3d3d3; border-style: solid; diff --git a/client/dialogs/SettingsDialog.cpp b/client/dialogs/SettingsDialog.cpp index 3b3dd8ca..c3a113a5 100644 --- a/client/dialogs/SettingsDialog.cpp +++ b/client/dialogs/SettingsDialog.cpp @@ -113,7 +113,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) ui->txtAccessCert->setFont(regularFont); ui->btInstallManually->setFont(condensed12); ui->btShowCertificate->setFont(condensed12); -#ifdef Q_OS_LINUX +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) ui->btInstallManually->setStyleSheet("background-color: #d3d3d3"); ui->btShowCertificate->setStyleSheet("background-color: #d3d3d3"); #endif diff --git a/client/dialogs/SmartIDProgress.cpp b/client/dialogs/SmartIDProgress.cpp index 7b575321..247dc48e 100644 --- a/client/dialogs/SmartIDProgress.cpp +++ b/client/dialogs/SmartIDProgress.cpp @@ -97,7 +97,7 @@ SmartIDProgress::SmartIDProgress(QWidget *parent) d->info->setFont(Styles::font(Styles::Regular, 14)); d->controlCode->setFont(Styles::font(Styles::Regular, 14)); d->signProgressBar->setFont(d->info->font()); -#ifdef Q_OS_LINUX +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) const auto styleSheet = R"(QProgressBar { background-color: #d3d3d3;; border-style: solid; From 9438894caee3e869e1ebaeffa132c36a37b5b39f Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Sun, 22 May 2022 02:37:19 +0200 Subject: [PATCH 4/4] Right-align positive buttons on BSDs as well No need to exclude to differ here. Signed-off-by: Klemens Nanni --- client/dialogs/WarningDialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/dialogs/WarningDialog.cpp b/client/dialogs/WarningDialog.cpp index 1424b893..0da70ee9 100644 --- a/client/dialogs/WarningDialog.cpp +++ b/client/dialogs/WarningDialog.cpp @@ -89,8 +89,8 @@ void WarningDialog::addButton(const QString& label, int ret, bool red) setLayoutDirection(Qt::RightToLeft); #endif } else { -// For macOS and Linux all positive buttons should be on the right side of the dialog window -#if defined(Q_OS_MAC) || defined(Q_OS_LINUX) +// For macOS, Linux and BSD all positive buttons should be on the right side of the dialog window +#if defined(Q_OS_UNIX) setLayoutDirection(Qt::RightToLeft); #endif }