Remove obsolete not used code

This commit is contained in:
Jakub Melka 2022-08-09 14:04:34 +02:00
parent b8ca3833bd
commit 9cbb6aba88
3 changed files with 3 additions and 83 deletions

View File

@ -30,8 +30,6 @@
#include <QFileDialog>
#include <QListWidgetItem>
#include <QTextToSpeech>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#include <QDomDocument>
#include <QStyledItemDelegate>
@ -73,9 +71,7 @@ PDFViewerSettingsDialog::PDFViewerSettingsDialog(const PDFViewerSettings::Settin
m_isLoadingData(false),
m_certificateStore(certificateStore),
m_enabledPlugins(enabledPlugins),
m_plugins(plugins),
m_networkAccessManager(nullptr),
m_downloadCertificatesFromEUTLReply(nullptr)
m_plugins(plugins)
{
ui->setupUi(this);
@ -830,12 +826,6 @@ void PDFViewerSettingsDialog::setSpeechEngine(const QString& engine)
bool PDFViewerSettingsDialog::canCloseDialog()
{
if (m_downloadCertificatesFromEUTLReply)
{
QMessageBox::warning(this, tr("Download"), tr("Downloading certificates from EUTL didn't finish yet. Can't close the dialog."));
return false;
}
return true;
}
@ -871,62 +861,6 @@ void PDFViewerSettingsDialog::on_cmsProfileDirectoryButton_clicked()
}
}
void PDFViewerSettingsDialog::on_trustedCertificateStoreDownloadEUTLButton_clicked()
{
if (m_downloadCertificatesFromEUTLReply)
{
// Jakub Melka: We are already downloading the data
return;
}
if (QMessageBox::question(this, tr("Download EUTL"), tr("Do you want do download EU trusted certificates list from https://ec.europa.eu/information_society/policy/esignature/trusted-list/tl-mp.xml ?")) == QMessageBox::Yes)
{
if (!m_networkAccessManager)
{
m_networkAccessManager = new QNetworkAccessManager(this);
}
m_downloadCertificatesFromEUTLReply = m_networkAccessManager->get(QNetworkRequest(QUrl("https://ec.europa.eu/information_society/policy/esignature/trusted-list/tl-mp.xml")));
auto onFinished = [this]()
{
QNetworkReply::NetworkError error = m_downloadCertificatesFromEUTLReply->error();
if (error == QNetworkReply::NoError)
{
QByteArray data = m_downloadCertificatesFromEUTLReply->readAll();
QDomDocument document;
QString errorMessage;
if (document.setContent(data, &errorMessage))
{
QDomNodeList certificateElements = document.elementsByTagName("X509Certificate");
for (int i = 0; i < certificateElements.count(); ++i)
{
QDomElement certificateElement = certificateElements.at(i).toElement();
QString certificateBase64Encoded = certificateElement.text();
QByteArray certificateData = QByteArray::fromBase64(certificateBase64Encoded.toLatin1(), QByteArray::Base64Encoding);
m_certificateStore.add(pdf::PDFCertificateStore::EntryType::EUTL, certificateData);
}
updateTrustedCertificatesTable();
}
else
{
QMessageBox::critical(this, tr("Error"), errorMessage);
}
}
else
{
QMessageBox::critical(this, tr("Error"), m_downloadCertificatesFromEUTLReply->errorString());
}
m_downloadCertificatesFromEUTLReply->deleteLater();
m_downloadCertificatesFromEUTLReply = nullptr;
};
connect(m_downloadCertificatesFromEUTLReply, &QNetworkReply::finished, this, onFinished);
}
}
void PDFViewerSettingsDialog::on_removeCertificateButton_clicked()
{
std::set<int> rows;

View File

@ -24,8 +24,6 @@
#include <QDialog>
class QListWidgetItem;
class QNetworkReply;
class QNetworkAccessManager;
namespace Ui
{
@ -93,9 +91,6 @@ public:
private slots:
void on_optionsPagesWidget_currentItemChanged(QListWidgetItem* current, QListWidgetItem* previous);
void on_cmsProfileDirectoryButton_clicked();
void on_trustedCertificateStoreDownloadEUTLButton_clicked();
void on_removeCertificateButton_clicked();
private:
@ -129,8 +124,6 @@ private:
pdf::PDFCertificateStore m_certificateStore;
QStringList m_enabledPlugins;
pdf::PDFPluginInfos m_plugins;
QNetworkAccessManager* m_networkAccessManager;
QNetworkReply* m_downloadCertificatesFromEUTLReply;
};
} // namespace pdfviewer

View File

@ -35,7 +35,7 @@
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>5</number>
<number>10</number>
</property>
<widget class="QWidget" name="enginePage">
<layout class="QVBoxLayout" name="enginePageLayout">
@ -1346,13 +1346,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="trustedCertificateStoreDownloadEUTLButton">
<property name="text">
<string>Download EUTL</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -1365,7 +1358,7 @@
<item>
<widget class="QLabel" name="signatureInfoLabel">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Settings for verification of digital signatures. Digital signatures are verified as strict, as possible, to avoid any malicious content or signature manipulation. Verification can also be turned off, if it is not wanted. When &lt;span style=&quot; font-weight:600;&quot;&gt;Strict mode&lt;/span&gt; is turned on, every warning is treated as error. You can also ignore certificate expiration date, but do this only, if you know what you are doing, because it is dangerous. For verification, list of trusted certificates is used. System certificates can be inserted into the list, and also you can manage your own list of trusted certificates. Also, certificates from EUTL (EU trusted list) can be downloaded into the trusted certificate storage.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Settings for verification of digital signatures. Digital signatures are verified as strict, as possible, to avoid any malicious content or signature manipulation. Verification can also be turned off, if it is not wanted. When &lt;span style=&quot; font-weight:600;&quot;&gt;Strict mode&lt;/span&gt; is turned on, every warning is treated as error. You can also ignore certificate expiration date, but do this only, if you know what you are doing, because it is dangerous. For verification, list of trusted certificates is used. System certificates can be inserted into the list, and also you can manage your own list of trusted certificates. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>