void Pastebin::onSslErrors(QNetworkReply *reply, const QList<QSslError> &errors) { QStringList ignoreCerts = AppSettings::instance()->ignoreErrorCerts(); QList<QSslError> ignoreErrors; QList<QSslError> promptErrors; QSslCertificate cert; QStringList errorStrings; foreach(const QSslError &error, errors) { if(ignoreCerts.contains(QString(error.certificate().serialNumber()))) { ignoreErrors.append(error); } else { promptErrors.append(error); if(cert.isNull()) { cert = error.certificate(); } errorStrings << error.errorString(); } } if(!ignoreErrors.isEmpty()) { reply->ignoreSslErrors(ignoreErrors); } if(!promptErrors.isEmpty()) { QString bodyText = tr( "Issued to: %1\n" "Serial number: %2\n" "Issued by: %3\n" "Effective: %4\n" "Expires: %5\n" "\n%6\n\n" "Ignore this error?") .arg(cert.subjectInfo(QSslCertificate::CommonName)) .arg(QString(cert.serialNumber())) .arg(cert.issuerInfo(QSslCertificate::CommonName)) .arg(cert.effectiveDate().toLocalTime().toString(Qt::SystemLocaleShortDate)) .arg(cert.expiryDate().toLocalTime().toString(Qt::SystemLocaleShortDate)) .arg(errorStrings.join("\n")); bb::system::SystemDialog dialog(tr("Yes"), tr("Always"), tr("No")); dialog.setTitle(tr("SSL Error")); dialog.setBody(bodyText); bb::system::SystemUiResult::Type result = dialog.exec(); if(result == bb::system::SystemUiResult::ConfirmButtonSelection || result == bb::system::SystemUiResult::CustomButtonSelection) { reply->ignoreSslErrors(promptErrors); if(result == bb::system::SystemUiResult::CustomButtonSelection) { ignoreCerts << QString(cert.serialNumber()); AppSettings::instance()->setIgnoreErrorCerts(ignoreCerts); } } } }
void PreferencesDialog::addClientCertToTable(const QString& path, const QSslCertificate& cert) { // Do nothing if the file doesn't even exist if(!QFile::exists(path)) return; // Add new row int row = ui->tableClientCerts->rowCount(); ui->tableClientCerts->setRowCount(row + 1); // Fill row with data QTableWidgetItem* cert_file = new QTableWidgetItem(path); cert_file->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); ui->tableClientCerts->setItem(row, 0, cert_file); QTableWidgetItem* cert_subject_cn = new QTableWidgetItem(cert.subjectInfo(QSslCertificate::CommonName).at(0)); cert_subject_cn->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); ui->tableClientCerts->setItem(row, 1, cert_subject_cn); QTableWidgetItem* cert_issuer_cn = new QTableWidgetItem(cert.issuerInfo(QSslCertificate::CommonName).at(0)); cert_issuer_cn->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); ui->tableClientCerts->setItem(row, 2, cert_issuer_cn); QTableWidgetItem* cert_from = new QTableWidgetItem(cert.effectiveDate().toString()); cert_from->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); ui->tableClientCerts->setItem(row, 3, cert_from); QTableWidgetItem* cert_to = new QTableWidgetItem(cert.expiryDate().toString()); cert_to->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); ui->tableClientCerts->setItem(row, 4, cert_to); QTableWidgetItem* cert_serialno = new QTableWidgetItem(QString(cert.serialNumber())); cert_serialno->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); ui->tableClientCerts->setItem(row, 5, cert_serialno); }
bool QSslCertificatePrivate::isBlacklisted(const QSslCertificate &certificate) { for (int a = 0; certificate_blacklist[a] != 0; a++) { QString blacklistedCommonName = QString::fromUtf8(certificate_blacklist[(a+1)]); if (certificate.serialNumber() == certificate_blacklist[a++] && (certificate.subjectInfo(QSslCertificate::CommonName).contains(blacklistedCommonName) || certificate.issuerInfo(QSslCertificate::CommonName).contains(blacklistedCommonName))) return true; } return false; }
QDebug operator<<(QDebug debug, const QSslCertificate &certificate) { debug << "QSslCertificate(" << certificate.version() << "," << certificate.serialNumber() << "," << certificate.digest() << "," << certificate.issuerInfo(QSslCertificate::Organization) << "," << certificate.subjectInfo(QSslCertificate::Organization) << "," << certificate.alternateSubjectNames() #ifndef QT_NO_TEXTSTREAM << "," << certificate.effectiveDate() << "," << certificate.expiryDate() #endif << ")"; return debug; }
QDebug operator<<(QDebug debug, const QSslCertificate &certificate) { debug << "QSslCertificate(" << certificate.version() << ',' << certificate.serialNumber() << ',' << certificate.digest().toBase64() << ',' << certificate.issuerInfo(QSslCertificate::Organization) << ',' << certificate.subjectInfo(QSslCertificate::Organization) << ',' << certificate.subjectAlternativeNames() #ifndef QT_NO_DATESTRING << ',' << certificate.effectiveDate() << ',' << certificate.expiryDate() #endif << ')'; return debug; }
QString clientController::getCertificateString(const QSslCertificate &cert) { QString certInfo; certInfo += "Issuer Org: "; certInfo += cert.issuerInfo(QSslCertificate::Organization).join(" ") + QString("\n"); certInfo += "Common Name: "; certInfo += cert.issuerInfo(QSslCertificate::CommonName).join(" ") + "\n"; certInfo += "Effective Date: "; certInfo += cert.effectiveDate().toString() + "\n"; certInfo += "Expiry Date: "; certInfo += cert.expiryDate().toString() + "\n"; certInfo += "Public Key: "; certInfo += cert.publicKey().toPem() + "\n"; certInfo += "Serial Number: "; certInfo += cert.serialNumber() + "\n"; return certInfo; }
QString Client::getCertificateString(const QSslCertificate &cert) { // Grab the fields and append to certInfo QString certInfo; certInfo += "Issuer Org: "; certInfo += cert.issuerInfo(QSslCertificate::Organization) + "\n"; certInfo += "Common Name: "; certInfo += cert.issuerInfo(QSslCertificate::CommonName) + "\n"; certInfo += "Effective Date: "; certInfo += cert.effectiveDate().toString() + "\n"; certInfo += "Expiry Date: "; certInfo += cert.expiryDate().toString() + "\n"; certInfo += "Public Key: "; certInfo += cert.publicKey().toPem() + "\n"; certInfo += "Serial Number: "; certInfo += cert.serialNumber() + "\n"; return certInfo; }
CertificateInfoWidget::CertificateInfoWidget(const QSslCertificate &cert, QWidget* parent) : QWidget(parent) , ui(new Ui::CertificateInfoWidget) { ui->setupUi(this); //Issued to ui->issuedToCN->setText(showCertInfo(cert.subjectInfo(QSslCertificate::CommonName))); ui->issuedToO->setText(showCertInfo(cert.subjectInfo(QSslCertificate::Organization))); ui->issuedToOU->setText(showCertInfo(cert.subjectInfo(QSslCertificate::OrganizationalUnitName))); ui->issuedToSN->setText(showCertInfo(cert.serialNumber())); //Issued By ui->issuedByCN->setText(showCertInfo(cert.issuerInfo(QSslCertificate::CommonName))); ui->issuedByO->setText(showCertInfo(cert.issuerInfo(QSslCertificate::Organization))); ui->issuedByOU->setText(showCertInfo(cert.issuerInfo(QSslCertificate::OrganizationalUnitName))); //Validity ui->validityIssuedOn->setText(cert.effectiveDate().toString("dddd d. MMMM yyyy")); ui->validityExpiresOn->setText(cert.expiryDate().toString("dddd d. MMMM yyyy")); }
QString dumpCertificate(const QSslCertificate &cert) { if (cert.isNull()) return "\n-\n"; QString s = "\n"; #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) s += cert.toText(); #else QString s_none = QObject::tr("<Not Part of Certificate>"); #define CERTIFICATE_STR(x) ( ((x) == "" ) ? s_none : (x) ) s += "Certificate:\n"; s += "\nIssued To:\n"; s += "CommonName(CN): " + CERTIFICATE_STR(cert.subjectInfo(QSslCertificate::CommonName)) + "\n"; s += "Organization(O): " + CERTIFICATE_STR(cert.subjectInfo(QSslCertificate::Organization)) + "\n"; s += "OrganizationalUnitName(OU): " + CERTIFICATE_STR(cert.subjectInfo(QSslCertificate::OrganizationalUnitName)) + "\n"; s += "Serial Number: " + dumpHexPresentation(cert.serialNumber()) + "\n"; s += "\nIssued By:\n"; s += "CommonName(CN): " + CERTIFICATE_STR(cert.issuerInfo(QSslCertificate::CommonName)) + "\n"; s += "Organization(O): " + CERTIFICATE_STR(cert.issuerInfo(QSslCertificate::Organization)) + "\n"; s += "OrganizationalUnitName(OU): " + CERTIFICATE_STR(cert.issuerInfo(QSslCertificate::OrganizationalUnitName)) + "\n"; s += "\nPeriod Of Validity\n"; s += "Begins On: " + cert.effectiveDate().toString() + "\n"; s += "Expires On: " + cert.expiryDate().toString() + "\n"; s += "IsValid: " + (cert.isValid() ? QString("Yes") : QString("No")) + "\n"; s += "\nFingerprints\n"; s += "SHA1 Fingerprint:\n" + dumpCertificateFingerprint(cert, QCryptographicHash::Sha1) + "\n"; s += "MD5 Fingerprint:\n" + dumpCertificateFingerprint(cert, QCryptographicHash::Md5) + "\n"; #endif s += "\n\n"; s += cert.toPem(); return s; }
static void ReportInvalidCertificate(const QSslCertificate& cert) { #if QT_VERSION < 0x050000 qDebug() << QString("%1: Payment server found an invalid certificate: ").arg(__func__) << cert.serialNumber() << cert.subjectInfo(QSslCertificate::CommonName) << cert.subjectInfo(QSslCertificate::OrganizationalUnitName); #else qDebug() << QString("%1: Payment server found an invalid certificate: ").arg(__func__) << cert.serialNumber() << cert.subjectInfo(QSslCertificate::CommonName) << cert.subjectInfo(QSslCertificate::DistinguishedNameQualifier) << cert.subjectInfo(QSslCertificate::OrganizationalUnitName); #endif }
void LeechCraft::SslErrorsDialog::PopulateTree (const QSslError& error) { QTreeWidgetItem *item = new QTreeWidgetItem (Ui_.Errors_, QStringList ("Error:") << error.errorString ()); QSslCertificate cer = error.certificate (); if (cer.isNull ()) { new QTreeWidgetItem (item, QStringList (tr ("Certificate")) << tr ("(No certificate available for this error)")); return; } new QTreeWidgetItem (item, QStringList (tr ("Valid:")) << (cer.isValid () ? tr ("yes") : tr ("no"))); new QTreeWidgetItem (item, QStringList (tr ("Effective date:")) << cer.effectiveDate ().toString ()); new QTreeWidgetItem (item, QStringList (tr ("Expiry date:")) << cer.expiryDate ().toString ()); new QTreeWidgetItem (item, QStringList (tr ("Version:")) << cer.version ()); new QTreeWidgetItem (item, QStringList (tr ("Serial number:")) << cer.serialNumber ()); new QTreeWidgetItem (item, QStringList (tr ("MD5 digest:")) << cer.digest ().toHex ()); new QTreeWidgetItem (item, QStringList (tr ("SHA1 digest:")) << cer.digest (QCryptographicHash::Sha1).toHex ()); QTreeWidgetItem *issuer = new QTreeWidgetItem (item, QStringList (tr ("Issuer info"))); QString tmpString; #if QT_VERSION >= 0x050000 auto cvt = [] (const QStringList& list) { return list.join ("; "); }; #else auto cvt = [] (const QString& str) { return str; }; #endif tmpString = cvt (cer.issuerInfo (QSslCertificate::Organization)); if (!tmpString.isEmpty ()) new QTreeWidgetItem (issuer, QStringList (tr ("Organization:")) << tmpString); tmpString = cvt (cer.issuerInfo (QSslCertificate::CommonName)); if (!tmpString.isEmpty ()) new QTreeWidgetItem (issuer, QStringList (tr ("Common name:")) << tmpString); tmpString = cvt (cer.issuerInfo (QSslCertificate::LocalityName)); if (!tmpString.isEmpty ()) new QTreeWidgetItem (issuer, QStringList (tr ("Locality:")) << tmpString); tmpString = cvt (cer.issuerInfo (QSslCertificate::OrganizationalUnitName)); if (!tmpString.isEmpty ()) new QTreeWidgetItem (issuer, QStringList (tr ("Organizational unit name:")) << tmpString); tmpString = cvt (cer.issuerInfo (QSslCertificate::CountryName)); if (!tmpString.isEmpty ()) new QTreeWidgetItem (issuer, QStringList (tr ("Country name:")) << tmpString); tmpString = cvt (cer.issuerInfo (QSslCertificate::StateOrProvinceName)); if (!tmpString.isEmpty ()) new QTreeWidgetItem (issuer, QStringList (tr ("State or province name:")) << tmpString); QTreeWidgetItem *subject = new QTreeWidgetItem (item, QStringList (tr ("Subject info"))); tmpString = cvt (cer.subjectInfo (QSslCertificate::Organization)); if (!tmpString.isEmpty ()) new QTreeWidgetItem (subject, QStringList (tr ("Organization:")) << tmpString); tmpString = cvt (cer.subjectInfo (QSslCertificate::CommonName)); if (!tmpString.isEmpty ()) new QTreeWidgetItem (subject, QStringList (tr ("Common name:")) << tmpString); tmpString = cvt (cer.subjectInfo (QSslCertificate::LocalityName)); if (!tmpString.isEmpty ()) new QTreeWidgetItem (subject, QStringList (tr ("Locality:")) << tmpString); tmpString = cvt (cer.subjectInfo (QSslCertificate::OrganizationalUnitName)); if (!tmpString.isEmpty ()) new QTreeWidgetItem (subject, QStringList (tr ("Organizational unit name:")) << tmpString); tmpString = cvt (cer.subjectInfo (QSslCertificate::CountryName)); if (!tmpString.isEmpty ()) new QTreeWidgetItem (subject, QStringList (tr ("Country name:")) << tmpString); tmpString = cvt (cer.subjectInfo (QSslCertificate::StateOrProvinceName)); if (!tmpString.isEmpty ()) new QTreeWidgetItem (subject, QStringList (tr ("State or province name:")) << tmpString); }
void CertificateDialog::updateValue() { const QSslCertificate certificate(m_certificates.value(m_ui->chainItemView->currentIndex().data(Qt::UserRole).toInt())); const CertificateField field(static_cast<CertificateField>(m_ui->detailsItemView->currentIndex().data(Qt::UserRole).toInt())); m_ui->valueTextEdit->clear(); switch (field) { case ValidityField: case PublicKeyField: case ExtensionsField: case DigestField: break; case VersionField: m_ui->valueTextEdit->setPlainText(QString(certificate.version())); break; case SerialNumberField: m_ui->valueTextEdit->setPlainText(formatHex(QString(certificate.serialNumber()), QLatin1Char(':'))); break; case SignatureAlgorithmField: m_ui->valueTextEdit->setPlainText(QRegularExpression(QLatin1String("Signature Algorithm:(.+)")).match(certificate.toText()).captured(1).trimmed()); break; case IssuerField: { const QList<QByteArray> attributes(certificate.issuerInfoAttributes()); for (int i = 0; i < attributes.count(); ++i) { m_ui->valueTextEdit->appendPlainText(QStringLiteral("%1 = %2").arg(QString(attributes.at(i))).arg(certificate.issuerInfo(attributes.at(i)).join(QLatin1String(", ")))); } } break; case ValidityNotBeforeField: m_ui->valueTextEdit->setPlainText(certificate.effectiveDate().toString(QLatin1String("yyyy-MM-dd hh:mm:ss t"))); break; case ValidityNotAfterField: m_ui->valueTextEdit->setPlainText(certificate.expiryDate().toString(QLatin1String("yyyy-MM-dd hh:mm:ss t"))); break; case SubjectField: { const QList<QByteArray> attributes(certificate.subjectInfoAttributes()); for (int i = 0; i < attributes.count(); ++i) { m_ui->valueTextEdit->appendPlainText(QStringLiteral("%1 = %2").arg(QString(attributes.at(i))).arg(certificate.subjectInfo(attributes.at(i)).join(QLatin1String(", ")))); } } break; case PublicKeyValueField: { const QRegularExpression expression(QLatin1String("Public-Key:[.\\s\\S]+Modulus:([.\\s\\S]+)Exponent:(.+)"), QRegularExpression::MultilineOption); const QRegularExpressionMatch match(expression.match(certificate.toText())); if (match.hasMatch()) { m_ui->valueTextEdit->setPlainText(tr("Modulus:\n%1\n\nExponent: %2").arg(formatHex(match.captured(1).trimmed().mid(3))).arg(match.captured(2).trimmed())); } } break; case PublicKeyAlgorithmField: m_ui->valueTextEdit->setPlainText(QRegularExpression(QLatin1String("Public Key Algorithm:(.+)")).match(certificate.toText()).captured(1).trimmed()); break; case ExtensionField: { const QSslCertificateExtension extension(certificate.extensions().value(m_ui->detailsItemView->currentIndex().data(Qt::UserRole + 1).toInt())); m_ui->valueTextEdit->setPlainText(extension.isCritical() ? tr("Critical") : tr("Not Critical")); m_ui->valueTextEdit->appendPlainText(tr("OID: %1").arg(extension.oid())); if (!extension.value().isNull()) { m_ui->valueTextEdit->appendPlainText(tr("Value:")); if (extension.value().type() == QVariant::List) { const QVariantList list(extension.value().toList()); for (int i = 0; i < list.count(); ++i) { m_ui->valueTextEdit->appendPlainText(list.at(i).toString()); } } else if (extension.value().type() == QVariant::Map) { const QVariantMap map(extension.value().toMap()); QVariantMap::const_iterator iterator; for (iterator = map.constBegin(); iterator != map.constEnd(); ++iterator) { m_ui->valueTextEdit->appendPlainText(QStringLiteral("%1 = %2").arg(iterator.key()).arg(iterator.value().toString())); } } else { m_ui->valueTextEdit->appendPlainText(extension.value().toString()); } } } break; case DigestSha1Field: m_ui->valueTextEdit->setPlainText(formatHex(QString(certificate.digest(QCryptographicHash::Sha1).toHex()))); break; case DigestSha256Field: m_ui->valueTextEdit->setPlainText(formatHex(QString(certificate.digest(QCryptographicHash::Sha256).toHex()))); break; default: break; } QTextCursor cursor(m_ui->valueTextEdit->textCursor()); cursor.setPosition(0); m_ui->valueTextEdit->setTextCursor(cursor); }
void PreferencesDialog::loadSettings() { ui->encodingComboBox->setCurrentIndex(ui->encodingComboBox->findText(Settings::getValue("db", "defaultencoding").toString(), Qt::MatchFixedString)); ui->comboDefaultLocation->setCurrentIndex(Settings::getValue("db", "savedefaultlocation").toInt()); ui->locationEdit->setText(Settings::getValue("db", "defaultlocation").toString()); ui->checkUpdates->setChecked(Settings::getValue("checkversion", "enabled").toBool()); ui->checkHideSchemaLinebreaks->setChecked(Settings::getValue("db", "hideschemalinebreaks").toBool()); ui->foreignKeysCheckBox->setChecked(Settings::getValue("db", "foreignkeys").toBool()); ui->spinPrefetchSize->setValue(Settings::getValue("db", "prefetchsize").toInt()); ui->editDatabaseDefaultSqlText->setText(Settings::getValue("db", "defaultsqltext").toString()); ui->defaultFieldTypeComboBox->addItems(DBBrowserDB::Datatypes); int defaultFieldTypeIndex = Settings::getValue("db", "defaultfieldtype").toInt(); if (defaultFieldTypeIndex < DBBrowserDB::Datatypes.count()) { ui->defaultFieldTypeComboBox->setCurrentIndex(defaultFieldTypeIndex); } // Gracefully handle the preferred Data Browser font not being available int matchingFont = ui->comboDataBrowserFont->findText(Settings::getValue("databrowser", "font").toString(), Qt::MatchExactly); if (matchingFont == -1) matchingFont = ui->comboDataBrowserFont->findText(Settings::getDefaultValue("databrowser", "font").toString()); ui->comboDataBrowserFont->setCurrentIndex(matchingFont); ui->spinDataBrowserFontSize->setValue(Settings::getValue("databrowser", "fontsize").toInt()); loadColorSetting(ui->fr_null_fg, "null_fg"); loadColorSetting(ui->fr_null_bg, "null_bg"); loadColorSetting(ui->fr_bin_fg, "bin_fg"); loadColorSetting(ui->fr_bin_bg, "bin_bg"); loadColorSetting(ui->fr_reg_fg, "reg_fg"); loadColorSetting(ui->fr_reg_bg, "reg_bg"); ui->spinSymbolLimit->setValue(Settings::getValue("databrowser", "symbol_limit").toInt()); ui->spinCompleteThreshold->setValue(Settings::getValue("databrowser", "complete_threshold").toInt()); ui->txtNull->setText(Settings::getValue("databrowser", "null_text").toString()); ui->txtBlob->setText(Settings::getValue("databrowser", "blob_text").toString()); ui->editFilterEscape->setText(Settings::getValue("databrowser", "filter_escape").toString()); ui->spinFilterDelay->setValue(Settings::getValue("databrowser", "filter_delay").toInt()); for(int i=0; i < ui->treeSyntaxHighlighting->topLevelItemCount(); ++i) { std::string name = ui->treeSyntaxHighlighting->topLevelItem(i)->text(0).toStdString(); QString colorname = Settings::getValue("syntaxhighlighter", name + "_colour").toString(); QColor color = QColor(colorname); ui->treeSyntaxHighlighting->topLevelItem(i)->setTextColor(2, color); ui->treeSyntaxHighlighting->topLevelItem(i)->setBackgroundColor(2, color); ui->treeSyntaxHighlighting->topLevelItem(i)->setText(2, colorname); if (name != "null" && name != "currentline" && name != "background" && name != "foreground") { ui->treeSyntaxHighlighting->topLevelItem(i)->setCheckState(3, Settings::getValue("syntaxhighlighter", name + "_bold").toBool() ? Qt::Checked : Qt::Unchecked); ui->treeSyntaxHighlighting->topLevelItem(i)->setCheckState(4, Settings::getValue("syntaxhighlighter", name + "_italic").toBool() ? Qt::Checked : Qt::Unchecked); ui->treeSyntaxHighlighting->topLevelItem(i)->setCheckState(5, Settings::getValue("syntaxhighlighter", name + "_underline").toBool() ? Qt::Checked : Qt::Unchecked); } } // Remote settings ui->checkUseRemotes->setChecked(Settings::getValue("remote", "active").toBool()); { auto ca_certs = static_cast<Application*>(qApp)->mainWindow()->getRemote().caCertificates(); ui->tableCaCerts->setRowCount(ca_certs.size()); for(int i=0;i<ca_certs.size();i++) { QSslCertificate cert = ca_certs.at(i); QTableWidgetItem* cert_cn = new QTableWidgetItem(cert.subjectInfo(QSslCertificate::CommonName).at(0)); cert_cn->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); ui->tableCaCerts->setItem(i, 0, cert_cn); QTableWidgetItem* cert_o = new QTableWidgetItem(cert.subjectInfo(QSslCertificate::Organization).at(0)); cert_o->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); ui->tableCaCerts->setItem(i, 1, cert_o); QTableWidgetItem* cert_from = new QTableWidgetItem(cert.effectiveDate().toString()); cert_from->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); ui->tableCaCerts->setItem(i, 2, cert_from); QTableWidgetItem* cert_to = new QTableWidgetItem(cert.expiryDate().toString()); cert_to->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); ui->tableCaCerts->setItem(i, 3, cert_to); QTableWidgetItem* cert_serialno = new QTableWidgetItem(QString(cert.serialNumber())); cert_serialno->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); ui->tableCaCerts->setItem(i, 4, cert_serialno); } } { QStringList client_certs = Settings::getValue("remote", "client_certificates").toStringList(); for(const QString& file : client_certs) { auto certs = QSslCertificate::fromPath(file); for(const QSslCertificate& cert : certs) addClientCertToTable(file, cert); } } ui->editRemoteCloneDirectory->setText(Settings::getValue("remote", "clonedirectory").toString()); // Gracefully handle the preferred Editor font not being available matchingFont = ui->comboEditorFont->findText(Settings::getValue("editor", "font").toString(), Qt::MatchExactly); if (matchingFont == -1) matchingFont = ui->comboDataBrowserFont->findText(Settings::getDefaultValue("editor", "font").toString()); ui->comboEditorFont->setCurrentIndex(matchingFont); ui->spinEditorFontSize->setValue(Settings::getValue("editor", "fontsize").toInt()); ui->spinTabSize->setValue(Settings::getValue("editor", "tabsize").toInt()); ui->spinLogFontSize->setValue(Settings::getValue("log", "fontsize").toInt()); ui->wrapComboBox->setCurrentIndex(Settings::getValue("editor", "wrap_lines").toInt()); ui->quoteComboBox->setCurrentIndex(Settings::getValue("editor", "identifier_quotes").toInt()); ui->checkAutoCompletion->setChecked(Settings::getValue("editor", "auto_completion").toBool()); ui->checkCompleteUpper->setEnabled(Settings::getValue("editor", "auto_completion").toBool()); ui->checkCompleteUpper->setChecked(Settings::getValue("editor", "upper_keywords").toBool()); ui->checkErrorIndicators->setChecked(Settings::getValue("editor", "error_indicators").toBool()); ui->checkHorizontalTiling->setChecked(Settings::getValue("editor", "horizontal_tiling").toBool()); ui->listExtensions->addItems(Settings::getValue("extensions", "list").toStringList()); ui->checkRegexDisabled->setChecked(Settings::getValue("extensions", "disableregex").toBool()); ui->checkAllowLoadExtension->setChecked(Settings::getValue("extensions", "enable_load_extension").toBool()); fillLanguageBox(); ui->appStyleCombo->setCurrentIndex(Settings::getValue("General", "appStyle").toInt()); ui->toolbarStyleComboMain->setCurrentIndex(Settings::getValue("General", "toolbarStyle").toInt()); ui->toolbarStyleComboStructure->setCurrentIndex(Settings::getValue("General", "toolbarStyleStructure").toInt()); ui->toolbarStyleComboBrowse->setCurrentIndex(Settings::getValue("General", "toolbarStyleBrowse").toInt()); ui->toolbarStyleComboSql->setCurrentIndex(Settings::getValue("General", "toolbarStyleSql").toInt()); ui->toolbarStyleComboEditCell->setCurrentIndex(Settings::getValue("General", "toolbarStyleEditCell").toInt()); }