Fixed #174.
This commit is contained in:
parent
2b98065da0
commit
76fa3799a8
@ -15,6 +15,7 @@ Added:
|
||||
|
||||
Fixed:
|
||||
|
||||
▪ When user selects "Save as..." for some file from internal web browser, file selection dialog is always shown. (bug #174)
|
||||
▪ Better detection of MySQL server status. (bug #169)
|
||||
▪ Ordering of messages is now done on SQL server (stands for both MySQL and SQLite). (bug #172)
|
||||
▪ Now title of the RSS/ATOM message is taken into account when deciding message "uniqueness". (bug #171)
|
||||
|
@ -41,13 +41,16 @@
|
||||
#include <QWebSettings>
|
||||
|
||||
|
||||
DownloadItem::DownloadItem(QNetworkReply *reply, QWidget *parent) : QWidget(parent),
|
||||
DownloadItem::DownloadItem(bool is_direct_download, QNetworkReply *reply, QWidget *parent) : QWidget(parent),
|
||||
m_ui(new Ui::DownloadItem), m_reply(reply),
|
||||
m_bytesReceived(0), m_requestFileName(false), m_startedSaving(false), m_finishedDownloading(false),
|
||||
m_gettingFileName(false), m_canceledFileSelect(false) {
|
||||
m_ui->setupUi(this);
|
||||
m_ui->m_btnTryAgain->hide();
|
||||
m_requestFileName = qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::AlwaysPromptForFilename)).toBool();
|
||||
|
||||
m_requestFileName = is_direct_download ?
|
||||
qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::AlwaysPromptForFilename)).toBool() :
|
||||
true;
|
||||
|
||||
connect(m_ui->m_btnStopDownload, SIGNAL(clicked()), this, SLOT(stop()));
|
||||
connect(m_ui->m_btnOpenFile, SIGNAL(clicked()), this, SLOT(openFile()));
|
||||
@ -499,17 +502,17 @@ int DownloadManager::downloadProgress() const {
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadManager::download(const QNetworkRequest &request) {
|
||||
void DownloadManager::download(const QNetworkRequest &request, bool direct_download) {
|
||||
if (!request.url().isEmpty()) {
|
||||
handleUnsupportedContent(m_networkManager->get(request));
|
||||
handleUnsupportedContent(m_networkManager->get(request), direct_download);
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadManager::download(const QUrl &url) {
|
||||
download(QNetworkRequest(url));
|
||||
void DownloadManager::download(const QUrl &url, bool direct_download) {
|
||||
download(QNetworkRequest(url), direct_download);
|
||||
}
|
||||
|
||||
void DownloadManager::handleUnsupportedContent(QNetworkReply *reply) {
|
||||
void DownloadManager::handleUnsupportedContent(QNetworkReply *reply, bool direct_download) {
|
||||
if (reply == NULL || reply->url().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@ -522,7 +525,7 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply *reply) {
|
||||
return;
|
||||
}
|
||||
|
||||
DownloadItem *item = new DownloadItem(reply, this);
|
||||
DownloadItem *item = new DownloadItem(direct_download, reply, this);
|
||||
addItem(item);
|
||||
|
||||
if (!item->m_canceledFileSelect && qApp->settings()->value(GROUP(Downloads),
|
||||
@ -670,7 +673,7 @@ void DownloadManager::load() {
|
||||
bool done = settings->value(GROUP(Downloads), QString(Downloads::ItemDone).arg(i), true).toBool();
|
||||
|
||||
if (!url.isEmpty() && !file_name.isEmpty()) {
|
||||
DownloadItem *item = new DownloadItem(0, this);
|
||||
DownloadItem *item = new DownloadItem(false, 0, this);
|
||||
item->m_output.setFileName(file_name);
|
||||
item->m_url = url;
|
||||
|
||||
|
@ -42,7 +42,7 @@ class DownloadItem : public QWidget {
|
||||
|
||||
public:
|
||||
// Constructors.
|
||||
explicit DownloadItem(QNetworkReply *reply = 0, QWidget *parent = 0);
|
||||
explicit DownloadItem(bool is_direct_download, QNetworkReply *reply = 0, QWidget *parent = 0);
|
||||
virtual ~DownloadItem();
|
||||
|
||||
bool downloading() const;
|
||||
@ -125,9 +125,9 @@ class DownloadManager : public TabContent {
|
||||
static QString dataString(qint64 size);
|
||||
|
||||
public slots:
|
||||
void download(const QNetworkRequest &request);
|
||||
void download(const QUrl &url);
|
||||
void handleUnsupportedContent(QNetworkReply *reply);
|
||||
void download(const QNetworkRequest &request, bool direct_download = false);
|
||||
void download(const QUrl &url, bool direct_download = false);
|
||||
void handleUnsupportedContent(QNetworkReply *reply, bool direct_download = false);
|
||||
void cleanup();
|
||||
|
||||
private slots:
|
||||
|
@ -172,7 +172,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) {
|
||||
switch (reply->error()) {
|
||||
case QNetworkReply::NoError:
|
||||
if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) {
|
||||
qApp->downloadManager()->handleUnsupportedContent(reply);
|
||||
qApp->downloadManager()->handleUnsupportedContent(reply, true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user