diff ui/certificateitemwidget.cpp @ 1297:c2fd36cd4093

(issue123) Use gcr-viewer to view certificate details on Linux
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 29 Sep 2014 16:24:05 +0200
parents d2b32c75efcf
children 9017c524e762
line wrap: on
line diff
--- a/ui/certificateitemwidget.cpp	Mon Sep 29 16:12:47 2014 +0200
+++ b/ui/certificateitemwidget.cpp	Mon Sep 29 16:24:05 2014 +0200
@@ -13,6 +13,7 @@
 #include <QToolButton>
 #include <QSignalBlocker>
 #include <QPushButton>
+#include <QMessageBox>
 
 void CheckLessToolBtn::paintEvent(QPaintEvent * pe) {
 
@@ -67,7 +68,6 @@
     QLabel *firstLabel = new QLabel(QString::fromLatin1("<big><b>%1</b></big> ").arg
         (mCertificate.subjectCN()));
 
-#ifdef Q_OS_WIN
     QHBoxLayout *firstLabelButtonLayout = new QHBoxLayout;
     firstLabelButtonLayout->addWidget(firstLabel);
     QPushButton *detailsBtn = new QPushButton;
@@ -78,9 +78,6 @@
     firstLabelButtonLayout->addStretch(-1);
     connect(detailsBtn, SIGNAL(clicked()), this, SLOT(showCertDlg()));
     labelLayout->addLayout(firstLabelButtonLayout);
-#else
-    labelLayout->addWidget(firstLabel);
-#endif
     QLabel *secondLabel = new QLabel(QString::fromLatin1("%2<br/>%3<br/>%4").arg
         (mCertificate.subjectO()).arg(validity).arg
         (fpstring));
@@ -114,7 +111,16 @@
 {
     /* This is a totally evil cast but legitimate on Windows
      * HANDLES are only 32 bit even on Windows 64 bit */
-    qDebug() << "Showing native ui: " <<  mCertificate.showNativeUI((void*)effectiveWinId());
+    if (!mCertificate.showNativeUI((void*)effectiveWinId())) {
+        qDebug() << "Failed to show native dialog";
+#ifdef WIN32
+        // maybe old windows version
+        QMessageBox::warning(this, tr("TrustBridge error"), tr("Failed to open native viewer."));
+#else
+        QMessageBox::warning(this, tr("TrustBridge error"), tr("Failed to open 'gcr-viewer'.") + "\n" +
+                tr("TrustBridge uses 'gcr-viewer' to show certificate details. Please ensure that 'gcr-viewer' is installed."));
+#endif
+    }
     return;
 }
 

http://wald.intevation.org/projects/trustbridge/