Fix network manager destructor exception.
This commit is contained in:
parent
d3dae650db
commit
45e163ecba
@ -228,7 +228,8 @@ void SettingsBrowserMail::saveSettings() {
|
|||||||
qApp->web()->updateProxy();
|
qApp->web()->updateProxy();
|
||||||
|
|
||||||
// Reload settings for all network access managers.
|
// Reload settings for all network access managers.
|
||||||
SilentNetworkAccessManager::instance()->loadSettings();
|
qApp->downloadManager()->networkManager()->loadSettings();
|
||||||
|
|
||||||
onEndSaveSettings();
|
onEndSaveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,6 +144,8 @@ void WebViewer::loadMessages(const QList<Message>& messages, RootItem* root) {
|
|||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
displayMessage();
|
displayMessage();
|
||||||
setEnabled(previously_enabled);
|
setEnabled(previously_enabled);
|
||||||
|
|
||||||
|
page()->runJavaScript(QSL("window.scrollTo(0, 0);"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebViewer::clear() {
|
void WebViewer::clear() {
|
||||||
|
@ -69,7 +69,7 @@ Application::Application(const QString& id, int& argc, char** argv)
|
|||||||
connect(this, &Application::saveStateRequest, this, &Application::onSaveState);
|
connect(this, &Application::saveStateRequest, this, &Application::onSaveState);
|
||||||
|
|
||||||
#if defined(USE_WEBENGINE)
|
#if defined(USE_WEBENGINE)
|
||||||
QWebEngineUrlScheme url_scheme(APP_LOW_NAME);
|
QWebEngineUrlScheme url_scheme(QByteArray(APP_LOW_NAME));
|
||||||
|
|
||||||
url_scheme.setDefaultPort(QWebEngineUrlScheme::SpecialPort::PortUnspecified);
|
url_scheme.setDefaultPort(QWebEngineUrlScheme::SpecialPort::PortUnspecified);
|
||||||
url_scheme.setSyntax(QWebEngineUrlScheme::Syntax::Host);
|
url_scheme.setSyntax(QWebEngineUrlScheme::Syntax::Host);
|
||||||
|
@ -421,7 +421,7 @@ void DownloadItem::updateInfoAndUrlLabel() {
|
|||||||
|
|
||||||
DownloadManager::DownloadManager(QWidget* parent) : TabContent(parent), m_ui(new Ui::DownloadManager),
|
DownloadManager::DownloadManager(QWidget* parent) : TabContent(parent), m_ui(new Ui::DownloadManager),
|
||||||
m_autoSaver(new AutoSaver(this)), m_model(new DownloadModel(this)),
|
m_autoSaver(new AutoSaver(this)), m_model(new DownloadModel(this)),
|
||||||
m_networkManager(SilentNetworkAccessManager::instance()), m_iconProvider(nullptr), m_removePolicy(Never) {
|
m_networkManager(new SilentNetworkAccessManager(this)), m_iconProvider(nullptr), m_removePolicy(Never) {
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_ui->m_viewDownloads->setShowGrid(false);
|
m_ui->m_viewDownloads->setShowGrid(false);
|
||||||
m_ui->m_viewDownloads->verticalHeader()->hide();
|
m_ui->m_viewDownloads->verticalHeader()->hide();
|
||||||
@ -524,7 +524,7 @@ void DownloadManager::addItem(DownloadItem* item) {
|
|||||||
updateRow(item);
|
updateRow(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkAccessManager* DownloadManager::networkManager() const {
|
SilentNetworkAccessManager* DownloadManager::networkManager() const {
|
||||||
return m_networkManager;
|
return m_networkManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -785,7 +785,6 @@ Qt::ItemFlags DownloadModel::flags(const QModelIndex& index) const {
|
|||||||
|
|
||||||
QMimeData* DownloadModel::mimeData(const QModelIndexList& indexes) const {
|
QMimeData* DownloadModel::mimeData(const QModelIndexList& indexes) const {
|
||||||
auto* mimeData = new QMimeData();
|
auto* mimeData = new QMimeData();
|
||||||
|
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
|
|
||||||
foreach (const QModelIndex& index, indexes) {
|
foreach (const QModelIndex& index, indexes) {
|
||||||
|
@ -14,8 +14,11 @@
|
|||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
|
||||||
class AutoSaver;
|
class AutoSaver;
|
||||||
|
|
||||||
class DownloadModel;
|
class DownloadModel;
|
||||||
|
|
||||||
class QFileIconProvider;
|
class QFileIconProvider;
|
||||||
|
|
||||||
class QMimeData;
|
class QMimeData;
|
||||||
|
|
||||||
class DownloadItem : public QWidget {
|
class DownloadItem : public QWidget {
|
||||||
@ -78,9 +81,12 @@ class DownloadItem : public QWidget {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if defined(USE_WEBENGINE)
|
#if defined(USE_WEBENGINE)
|
||||||
|
|
||||||
class WebBrowser;
|
class WebBrowser;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
class SilentNetworkAccessManager;
|
||||||
|
|
||||||
class DownloadManager : public TabContent {
|
class DownloadManager : public TabContent {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(RemovePolicy removePolicy READ removePolicy WRITE setRemovePolicy NOTIFY removePolicyChanged)
|
Q_PROPERTY(RemovePolicy removePolicy READ removePolicy WRITE setRemovePolicy NOTIFY removePolicyChanged)
|
||||||
@ -105,7 +111,7 @@ class DownloadManager : public TabContent {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QNetworkAccessManager* networkManager() const;
|
SilentNetworkAccessManager* networkManager() const;
|
||||||
|
|
||||||
int totalDownloads() const;
|
int totalDownloads() const;
|
||||||
int activeDownloads() const;
|
int activeDownloads() const;
|
||||||
@ -146,7 +152,7 @@ class DownloadManager : public TabContent {
|
|||||||
QScopedPointer<Ui::DownloadManager> m_ui;
|
QScopedPointer<Ui::DownloadManager> m_ui;
|
||||||
AutoSaver* m_autoSaver;
|
AutoSaver* m_autoSaver;
|
||||||
DownloadModel* m_model;
|
DownloadModel* m_model;
|
||||||
QNetworkAccessManager* m_networkManager;
|
SilentNetworkAccessManager* m_networkManager;
|
||||||
|
|
||||||
QScopedPointer<QFileIconProvider> m_iconProvider;
|
QScopedPointer<QFileIconProvider> m_iconProvider;
|
||||||
QList<DownloadItem*> m_downloads;
|
QList<DownloadItem*> m_downloads;
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
#include <QAuthenticator>
|
#include <QAuthenticator>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(SilentNetworkAccessManager, qz_silent_acmanager)
|
|
||||||
|
|
||||||
SilentNetworkAccessManager::SilentNetworkAccessManager(QObject* parent)
|
SilentNetworkAccessManager::SilentNetworkAccessManager(QObject* parent)
|
||||||
: BaseNetworkAccessManager(parent) {
|
: BaseNetworkAccessManager(parent) {
|
||||||
connect(this, &SilentNetworkAccessManager::authenticationRequired,
|
connect(this, &SilentNetworkAccessManager::authenticationRequired,
|
||||||
@ -19,10 +17,6 @@ SilentNetworkAccessManager::~SilentNetworkAccessManager() {
|
|||||||
qDebug("Destroying SilentNetworkAccessManager instance.");
|
qDebug("Destroying SilentNetworkAccessManager instance.");
|
||||||
}
|
}
|
||||||
|
|
||||||
SilentNetworkAccessManager* SilentNetworkAccessManager::instance() {
|
|
||||||
return qz_silent_acmanager();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SilentNetworkAccessManager::onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator) {
|
void SilentNetworkAccessManager::onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator) {
|
||||||
if (reply->property("protected").toBool()) {
|
if (reply->property("protected").toBool()) {
|
||||||
// This feed contains authentication information, it is good.
|
// This feed contains authentication information, it is good.
|
||||||
|
@ -18,9 +18,6 @@ class SilentNetworkAccessManager : public BaseNetworkAccessManager {
|
|||||||
explicit SilentNetworkAccessManager(QObject* parent = nullptr);
|
explicit SilentNetworkAccessManager(QObject* parent = nullptr);
|
||||||
virtual ~SilentNetworkAccessManager();
|
virtual ~SilentNetworkAccessManager();
|
||||||
|
|
||||||
// Returns pointer to global silent network manager
|
|
||||||
static SilentNetworkAccessManager* instance();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
// This cannot do any GUI stuff.
|
// This cannot do any GUI stuff.
|
||||||
|
@ -60,6 +60,9 @@ Message RssParser::extractMessage(const QDomElement& msg_element, QDateTime curr
|
|||||||
new_message.m_enclosures.append(Enclosure(elem_enclosure, elem_enclosure_type));
|
new_message.m_enclosures.append(Enclosure(elem_enclosure, elem_enclosure_type));
|
||||||
qDebug("Found enclosure '%s' for the message.", qPrintable(elem_enclosure));
|
qDebug("Found enclosure '%s' for the message.", qPrintable(elem_enclosure));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
new_message.m_enclosures.append(mrssGetEnclosures(msg_element));
|
||||||
|
}
|
||||||
|
|
||||||
// Deal with link and author.
|
// Deal with link and author.
|
||||||
new_message.m_url = msg_element.namedItem(QSL("link")).toElement().text();
|
new_message.m_url = msg_element.namedItem(QSL("link")).toElement().text();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user