diff ui/certificateitemwidget.cpp @ 1303:78637257f547

Merged.
author Emanuel Schuetze <emanuel@intevation.de>
date Mon, 29 Sep 2014 16:38:09 +0200
parents 9017c524e762
children
line wrap: on
line diff
--- a/ui/certificateitemwidget.cpp	Mon Sep 29 16:37:49 2014 +0200
+++ b/ui/certificateitemwidget.cpp	Mon Sep 29 16:38:09 2014 +0200
@@ -13,6 +13,7 @@
 #include <QToolButton>
 #include <QSignalBlocker>
 #include <QPushButton>
+#include <QMessageBox>
 
 void CheckLessToolBtn::paintEvent(QPaintEvent * pe) {
 
@@ -67,20 +68,16 @@
     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;
-    detailsBtn->setIcon(QIcon(":/img/preferences-network_16.png")); // TODO
+    detailsBtn->setIcon(QIcon(":/img/document-preview.png"));
     detailsBtn->setToolTip(tr("Open the Windows certificate information dialog."));
 
     firstLabelButtonLayout->addWidget(detailsBtn);
     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/