diff --git a/src/downloads/downloaditem.cpp b/src/downloads/downloaditem.cpp index d0fb57530..5219b6ad3 100644 --- a/src/downloads/downloaditem.cpp +++ b/src/downloads/downloaditem.cpp @@ -95,8 +95,8 @@ DownloadItem::DownloadItem(QListWidgetItem* item, QNetworkReply* reply, QString m_downloadPage = webPage->mainFrame()->url(); else if (webPage->history()->canGoBack()) m_downloadPage = webPage->history()->backItem().url(); - else if (webPage->history()->count() == 0) - webPage->getView()->closeTab(); +// else if (webPage->history()->count() == 0) +// webPage->getView()->closeTab(); } } diff --git a/src/downloads/downloadmanager.cpp b/src/downloads/downloadmanager.cpp index 117a42577..eafa4a458 100644 --- a/src/downloads/downloadmanager.cpp +++ b/src/downloads/downloadmanager.cpp @@ -25,6 +25,7 @@ #include "qtwin.h" #include "desktopnotificationsfactory.h" #include "globalfunctions.h" +#include "webpage.h" DownloadManager::DownloadManager(QWidget* parent) : QWidget(parent) @@ -173,6 +174,13 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply* reply, bool askWha m_hfileIcon = m_iconProvider->icon(tempInfo).pixmap(30,30); QString mimeType = m_iconProvider->type(tempInfo); + //Get Download Page and Close Empty Tab + QNetworkRequest request = m_hreply->request(); + QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100)); + WebPage* webPage = (WebPage*)(v.value()); + if (webPage && webPage->mainFrame()->url().isEmpty() && !webPage->history()->canGoBack() && webPage->history()->count() == 0) + webPage->getView()->closeTab(); + if (askWhatToDo) { DownloadOptionsDialog* dialog = new DownloadOptionsDialog(m_h_fileName, m_hfileIcon, mimeType, reply->url(), mApp->activeWindow()); dialog->show();