comparison ui/certificateitemwidget.cpp @ 743:a467204a35f5

Rework User Interface. Certificate lists are now plain lists of widgets and no longer a ListWidget. Details are no longer shown extra but included in the list. List entries are somewhat larger accordingly.
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 04 Jul 2014 16:15:59 +0200
parents 86c9ff4cfb02
children b6172b9f885d
comparison
equal deleted inserted replaced
742:627e8d678b6d 743:a467204a35f5
31 /* We use the label as data to hide it in the normal dropdown menu and only 31 /* We use the label as data to hide it in the normal dropdown menu and only
32 * show it when the popup is shown.*/ 32 * show it when the popup is shown.*/
33 33
34 void CertificateItemWidget::setupGUI() 34 void CertificateItemWidget::setupGUI()
35 { 35 {
36 mLabel = new QLabel(mCertificate.subjectCN()); 36 mLabel = new QLabel;
37 mComboBox = new IconOnlyTextPopupBox; 37 mComboBox = new IconOnlyTextPopupBox;
38 QStyle *fusionStyle = QStyleFactory::create("Fusion"); 38 QStyle *fusionStyle = QStyleFactory::create("Fusion");
39 if (!fusionStyle) { 39 if (!fusionStyle) {
40 qDebug() << "Failed to create fusion style"; 40 qDebug() << "Failed to create fusion style";
41 } else { 41 } else {
42 mComboBox->setStyle(fusionStyle); 42 mComboBox->setStyle(fusionStyle);
43 } 43 }
44 44
45 mComboBox->setFixedWidth(46); 45 mComboBox->setIconSize(QSize(48, 48));
46 mComboBox->setFixedWidth(68);
47
48 const QString validity = tr("Vopalid: %1 until %2").arg(
49 QLocale::system().toString(mCertificate.validFrom().date(), QLocale::ShortFormat)).arg(
50 QLocale::system().toString(mCertificate.validTo().date(), QLocale::ShortFormat));
51 const QString fpstring = tr("Fingerprint (SHA1): &lt;%1&gt;").arg(mCertificate.fingerprint());
52 mLabel->setText(QString::fromLatin1("<big><b>%1</b><br/>%2<br/>%3<br/>%4</big>").arg
53 (mCertificate.subjectCN()).arg(mCertificate.subjectO()).arg(validity).arg
54 (fpstring));
55 mLabel->setTextFormat(Qt::RichText);
46 56
47 mLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 57 mLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
48 mComboBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); 58 mComboBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
49 connect(mComboBox, SIGNAL(currentIndexChanged(int)), 59 connect(mComboBox, SIGNAL(currentIndexChanged(int)),
50 this, SLOT(currentStateChanged(int))); 60 this, SLOT(currentStateChanged(int)));
62 } 72 }
63 else if (!mCertificate.isInstallCert() && !mEditable){ 73 else if (!mCertificate.isInstallCert() && !mEditable){
64 QImage *img = new QImage(":/img/trash-empty.png"); 74 QImage *img = new QImage(":/img/trash-empty.png");
65 QLabel *imgLabel = new QLabel; 75 QLabel *imgLabel = new QLabel;
66 imgLabel->setPixmap(QPixmap::fromImage(*img)); 76 imgLabel->setPixmap(QPixmap::fromImage(*img));
67 imgLabel->setFixedSize(28, 28); 77 imgLabel->setFixedSize(48, 48);
68 imgLabel->setMargin(2); 78 imgLabel->setMargin(2);
69 layout->addWidget(imgLabel); 79 layout->addWidget(imgLabel);
70 } 80 }
71 else { 81 else {
72 mComboBox->addItem(QIcon(":/img/trash-empty.png"), QString(), tr("uninstall")); 82 mComboBox->addItem(QIcon(":/img/trash-empty.png"), QString(), tr("uninstall"));

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