X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fidentityeditwidget.cpp;h=3a2534b67c9a64e6346353988b826fbca0c5b11d;hp=684dc61609dcef9a2ab4469359d59912d0f809d3;hb=ab7ef4d24f62b5848b628482b7762ebfc0b53e1a;hpb=c55df5f2d765b100b7a1ead5a72202f969aa9581 diff --git a/src/qtui/settingspages/identityeditwidget.cpp b/src/qtui/settingspages/identityeditwidget.cpp index 684dc616..3a2534b6 100644 --- a/src/qtui/settingspages/identityeditwidget.cpp +++ b/src/qtui/settingspages/identityeditwidget.cpp @@ -23,15 +23,10 @@ #include #include #include +#include #include #include -#include - -#if QT_VERSION < 0x050000 -# include -#else -# include -#endif +#include #include "client.h" #include "icon.h" @@ -115,11 +110,7 @@ IdentityEditWidget::IdentityEditWidget(QWidget *parent) addRow("AP", tr("AM/PM"), true); addRow("dd", tr("day"), true); addRow("MM", tr("month"), true); -#if QT_VERSION > 0x050000 - // Alas, this was only added in Qt 5. We don't know what version the core has, just hope - // for the best (Qt 4 will soon be dropped). addRow("t", tr("current timezone"), true); -#endif formatTooltip << ""; formatTooltip << "

" << tr("Example: Away since %%hh:mm%% on %%dd.MM%%.") << "

"; formatTooltip << "

" << tr("%%%% without anything inside represents %%. Other format " @@ -370,12 +361,7 @@ void IdentityEditWidget::on_clearOrLoadKeyButton_clicked() QSslKey key; if (ui.keyTypeLabel->property("sslKey").toByteArray().isEmpty()) - key = keyByFilename(QFileDialog::getOpenFileName(this, tr("Load a Key"), -#if QT_VERSION < 0x050000 - QDesktopServices::storageLocation(QDesktopServices::HomeLocation))); -#else - QStandardPaths::writableLocation(QStandardPaths::HomeLocation))); -#endif + key = keyByFilename(QFileDialog::getOpenFileName(this, tr("Load a Key"), QStandardPaths::writableLocation(QStandardPaths::HomeLocation))); showKeyState(key); emit widgetHasChanged(); @@ -392,16 +378,8 @@ QSslKey IdentityEditWidget::keyByFilename(const QString &filename) keyFile.close(); for (int i = 0; i < 2; i++) { -#if QT_VERSION >= 0x050500 // On Qt5.5+, support QSsl::KeyAlgorithm::Rsa (1), QSsl::KeyAlgorithm::Dsa (2), and QSsl::KeyAlgorithm::Ec (3) for (int j = 1; j < 4; j++) { -#elif QT_VERSION >= 0x050000 - // On Qt5.0-Qt5.4, support QSsl::KeyAlgorithm::Rsa (1) and QSsl::KeyAlgorithm::Dsa (2) (Ec wasn't added until 5.5) - for (int j = 1; j < 3; j++) { -#else - // On Qt4, support QSsl::KeyAlgorithm::Rsa (0) and QSsl::KeyAlgorithm::Dsa (1) (Qt4 uses different indices for the values) - for (int j = 0; j < 2; j++) { -#endif key = QSslKey(keyRaw, (QSsl::KeyAlgorithm)j, (QSsl::EncodingFormat)i); if (!key.isNull()) goto returnKey; @@ -409,12 +387,10 @@ QSslKey IdentityEditWidget::keyByFilename(const QString &filename) } QMessageBox::information(this, tr("Failed to read key"), tr("Failed to read the key file. It is either incompatible or invalid. Note that the key file must not have a passphrase.")); returnKey: -#if QT_VERSION >= 0x050500 if(!key.isNull() && key.algorithm() == QSsl::KeyAlgorithm::Ec && !Client::isCoreFeatureEnabled(Quassel::Feature::EcdsaCertfpKeys)) { QMessageBox::information(this, tr("Core does not support ECDSA keys"), tr("You loaded an ECDSA key, but the core does not support ECDSA keys. Please contact the core administrator.")); key.clear(); } -#endif return key; } @@ -430,11 +406,9 @@ void IdentityEditWidget::showKeyState(const QSslKey &key) case QSsl::Rsa: ui.keyTypeLabel->setText(tr("RSA")); break; -#if QT_VERSION >= 0x050500 case QSsl::Ec: ui.keyTypeLabel->setText(tr("ECDSA")); break; -#endif case QSsl::Dsa: ui.keyTypeLabel->setText(tr("DSA")); break; @@ -453,12 +427,7 @@ void IdentityEditWidget::on_clearOrLoadCertButton_clicked() QSslCertificate cert; if (ui.certOrgLabel->property("sslCert").toByteArray().isEmpty()) - cert = certByFilename(QFileDialog::getOpenFileName(this, tr("Load a Certificate"), -#if QT_VERSION < 0x050000 - QDesktopServices::storageLocation(QDesktopServices::HomeLocation))); -#else - QStandardPaths::writableLocation(QStandardPaths::HomeLocation))); -#endif + cert = certByFilename(QFileDialog::getOpenFileName(this, tr("Load a Certificate"), QStandardPaths::writableLocation(QStandardPaths::HomeLocation))); showCertState(cert); emit widgetHasChanged(); } @@ -489,13 +458,8 @@ void IdentityEditWidget::showCertState(const QSslCertificate &cert) ui.clearOrLoadCertButton->setText(tr("Load")); } else { -#if QT_VERSION < 0x050000 - ui.certOrgLabel->setText(cert.subjectInfo(QSslCertificate::Organization)); - ui.certCNameLabel->setText(cert.subjectInfo(QSslCertificate::CommonName)); -#else ui.certOrgLabel->setText(cert.subjectInfo(QSslCertificate::Organization).join(", ")); ui.certCNameLabel->setText(cert.subjectInfo(QSslCertificate::CommonName).join(", ")); -#endif ui.clearOrLoadCertButton->setText(tr("Clear")); } ui.certOrgLabel->setProperty("sslCert", cert.toPem());