// React to a click on a day button, by removing it from the list void ByWeekdayColumnWidget::onDayClicked() { QPushButton *dayButton = qobject_cast<QPushButton*>(this->sender()); // Remove the last number button listLayout->removeWidget(dayButton); dayButton->hide(); dayButton->deleteLater(); // Remove the day from the internal list days.removeOne(reverse ? -dayButton->text().toInt() : dayButton->text().toInt()); }
CertificateDialog::CertificateDialog(const QSslCertificate &cert, QWidget *parent, bool removePath) : QDialog( parent ) , d( new CertificateDialogPrivate ) { d->setupUi( this ); QPushButton *save = d->buttonBox->button(QDialogButtonBox::Save); if(save && Settings(QSettings::SystemScope).value("disableSave", false).toBool()) { d->buttonBox->removeButton(save); save->deleteLater(); } if(removePath) d->tabWidget->removeTab( 2 ); d->cert = cert; SslCertificate c = cert; QString i; QTextStream s( &i ); s << "<b>" << tr("Certificate Information") << "</b><br />"; s << "<hr>"; s << "<b>" << tr("This certificate is intended for following purpose(s):") << "</b>"; s << "<ul>"; for(const QString &ext: c.enhancedKeyUsage()) s << "<li>" << ext << "</li>"; s << "</ul>"; s << "<br /><br /><br /><br />"; //s << tr("* Refer to the certification authority's statement for details.") << "<br />"; s << "<hr>"; s << "<p style='margin-left: 30px;'>"; s << "<b>" << tr("Issued to:") << "</b> " << c.subjectInfo( QSslCertificate::CommonName ); s << "<br /><br /><br />"; s << "<b>" << tr("Issued by:") << "</b> " << c.issuerInfo( QSslCertificate::CommonName ); s << "<br /><br /><br />"; s << "<b>" << tr("Valid from") << "</b> " << c.effectiveDate().toLocalTime().toString( "dd.MM.yyyy" ) << " "; s << "<b>" << tr("to") << "</b> "<< c.expiryDate().toLocalTime().toString( "dd.MM.yyyy" ); s << "</p>"; d->info->setHtml( i ); d->addItem( tr("Version"), "V" + c.version() ); d->addItem( tr("Serial number"), QString( "%1 (0x%2)" ) .arg( c.serialNumber().constData() ) .arg( c.serialNumber( true ).constData() ) ); d->addItem( tr("Signature algorithm"), c.signatureAlgorithm() ); QStringList text, textExt; for(const QByteArray &obj: c.issuerInfoAttributes()) { const QString &data = c.issuerInfo( obj ); if( data.isEmpty() ) continue; text << data; textExt << QString( "%1 = %2" ).arg( obj.constData() ).arg( data ); } d->addItem( tr("Issuer"), text.join( ", " ), textExt.join( "\n" ) ); d->addItem( tr("Valid from"), DateTime( c.effectiveDate().toLocalTime() ).toStringZ( "dd.MM.yyyy hh:mm:ss" ) ); d->addItem( tr("Valid to"), DateTime( c.expiryDate().toLocalTime() ).toStringZ( "dd.MM.yyyy hh:mm:ss" ) ); text.clear(); textExt.clear(); for(const QByteArray &obj: c.subjectInfoAttributes()) { const QString &data = c.subjectInfo( obj ); if( data.isEmpty() ) continue; text << data; textExt << QString( "%1 = %2" ).arg( obj.constData() ).arg( data ); } d->addItem( tr("Subject"), text.join( ", " ), textExt.join( "\n" ) ); d->addItem( tr("Public key"), c.keyName(), c.publicKeyHex() ); QStringList enhancedKeyUsage = c.enhancedKeyUsage().values(); if( !enhancedKeyUsage.isEmpty() ) d->addItem( tr("Enhanched key usage"), enhancedKeyUsage.join( ", " ), enhancedKeyUsage.join( "\n" ) ); QStringList policies = c.policies(); if( !policies.isEmpty() ) d->addItem( tr("Certificate policies"), policies.join( ", " ) ); d->addItem( tr("Authority key identifier"), c.toHex( c.authorityKeyIdentifier() ) ); d->addItem( tr("Subject key identifier"), c.toHex( c.subjectKeyIdentifier() ) ); QStringList keyUsage = c.keyUsage().values(); if( !keyUsage.isEmpty() ) d->addItem( tr("Key usage"), keyUsage.join( ", " ), keyUsage.join( "\n" ) ); d->parameters->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); }