diff --git a/bin/locale/cs_CZ.qm b/bin/locale/cs_CZ.qm index 11d367646..73fb44272 100644 Binary files a/bin/locale/cs_CZ.qm and b/bin/locale/cs_CZ.qm differ diff --git a/src/downloads/downloaditem.cpp b/src/downloads/downloaditem.cpp index 6899f180c..ec79f5f18 100644 --- a/src/downloads/downloaditem.cpp +++ b/src/downloads/downloaditem.cpp @@ -17,6 +17,10 @@ * ============================================================ */ #include "downloaditem.h" #include "ui_downloaditem.h" +#include "mainapplication.h" +#include "qupzilla.h" +#include "tabwidget.h" +#include "webpage.h" //#define DOWNMANAGER_DEBUG @@ -27,6 +31,8 @@ DownloadItem::DownloadItem(QListWidgetItem* item, QNetworkReply* reply, QString ,m_reply(reply) ,m_path(path) ,m_fileName(fileName) + ,m_downUrl(reply->url()) + ,m_downloadPage(QUrl()) ,m_downloading(false) ,m_openAfterFinish(openAfterFinishedDownload) { @@ -76,6 +82,17 @@ DownloadItem::DownloadItem(QListWidgetItem* item, QNetworkReply* reply, QString error(m_reply->error()); } show(); + + //Get Download Page + QNetworkRequest request = m_reply->request(); + QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100)); + WebPage* webPage = (WebPage*)(v.value()); + if (webPage) { + if (!webPage->mainFrame()->url().isEmpty()) + m_downloadPage = webPage->mainFrame()->url(); + else if (webPage->history()->canGoBack()) + m_downloadPage = webPage->history()->backItem().url(); + } } void DownloadItem::metaDataChanged() @@ -85,7 +102,7 @@ void DownloadItem::metaDataChanged() QVariant locationHeader = m_reply->header(QNetworkRequest::LocationHeader); if (!locationHeader.toUrl().isEmpty()) - qWarning("DownloadManager: metaDataChanged << URL: %s", qPrintable(locationHeader.toString())); + qWarning("DownloadManager: metaDataChanged << URL: %s", qPrintable(locationHeader.toString())); // QMessageBox::information(m_item->listWidget()->parentWidget(), "Meta Data Changed", QString("Meta data changed feature unimplemented yet, sorry.\n URL: '%̈́'").arg(locationHeader.toUrl().toString())); } @@ -247,24 +264,33 @@ void DownloadItem::customContextMenuRequested(QPoint pos) menu.addAction(tr("Open Folder"), this, SLOT(openFolder())); menu.addSeparator(); + menu.addAction(tr("Go to Download Page"), this, SLOT(goToDownloadPage()))->setEnabled(!m_downloadPage.isEmpty()); + menu.addAction(QIcon::fromTheme("edit-copy"), tr("Copy Download Link"), this, SLOT(copyDownloadLink())); + menu.addSeparator(); menu.addAction( #ifdef Q_WS_X11 style()->standardIcon(QStyle::SP_BrowserStop) #else QIcon(":/icons/faenza/stop.png") #endif - ,tr("Cancel downloading"), this, SLOT(stop())); - menu.addAction(QIcon::fromTheme("window-close"), tr("Clear"), this, SLOT(clear())); + ,tr("Cancel downloading"), this, SLOT(stop()))->setEnabled(m_downloading); + menu.addAction(QIcon::fromTheme("window-close"), tr("Clear"), this, SLOT(clear()))->setEnabled(!m_downloading); if (m_downloading || ui->downloadInfo->text().startsWith(tr("Cancelled")) || ui->downloadInfo->text().startsWith(tr("Error"))) menu.actions().at(0)->setEnabled(false); - if (!m_downloading) - menu.actions().at(3)->setEnabled(false); - if (m_downloading) - menu.actions().at(4)->setEnabled(false); menu.exec(mapToGlobal(pos)); } +void DownloadItem::goToDownloadPage() +{ + mApp->getWindow()->tabWidget()->addView(m_downloadPage, tr("New tab"), TabWidget::NewSelectedTab); +} + +void DownloadItem::copyDownloadLink() +{ + qApp->clipboard()->setText(m_downUrl.toString()); +} + void DownloadItem::clear() { emit deleteItem(this); diff --git a/src/downloads/downloaditem.h b/src/downloads/downloaditem.h index 0fdcbd551..0492f24b2 100644 --- a/src/downloads/downloaditem.h +++ b/src/downloads/downloaditem.h @@ -70,6 +70,9 @@ private slots: void customContextMenuRequested(QPoint pos); void clear(); + void goToDownloadPage(); + void copyDownloadLink(); + private: void timerEvent(QTimerEvent* event); void updateDownloadInfo(double currSpeed, qint64 received, qint64 total); @@ -84,6 +87,8 @@ private: QTime m_remTime; QBasicTimer m_timer; QFile m_outputFile; + QUrl m_downUrl; + QUrl m_downloadPage; bool m_downloading; bool m_openAfterFinish; diff --git a/src/downloads/downloadmanager.cpp b/src/downloads/downloadmanager.cpp index 039334f1a..08bae47da 100644 --- a/src/downloads/downloadmanager.cpp +++ b/src/downloads/downloadmanager.cpp @@ -90,6 +90,10 @@ void DownloadManager::timerEvent(QTimerEvent* event) if (remTimes.isEmpty()) { ui->speedLabel->clear(); setWindowTitle(tr("Download Manager")); +#ifdef W7API + win7.setProgressValue(0, 0); + win7.setProgressState(win7.Normal); +#endif return; } diff --git a/translations/cs_CZ.ts b/translations/cs_CZ.ts index eb1cb00af..746fed1a1 100644 --- a/translations/cs_CZ.ts +++ b/translations/cs_CZ.ts @@ -719,93 +719,108 @@ p, li { white-space: pre-wrap; } - + Remaining time unavailable Neznámý zbývající čas - + Done - %1 Hotovo - %1 - - + + Cancelled Zrušeno - + few seconds několik sekund - + seconds sekund - + minutes minut - + hours hodin - + Remaining %1 - %2 of %3 (%4) Zbývá %1 - %2 z %3 (%4) - + Cancelled - %1 Zrušeno - %1 - + Delete file Smazat soubor - + Do you want to also delete dowloaded file? Chcete také smazat stahovaný soubor? - + Open File Otevřít soubor - + Open Folder Otevřít složku - + + Go to Download Page + Přejít na stránku stahování + + + + Copy Download Link + Kopírovat stahovaný odkaz + + + Cancel downloading Zrušit stahování - + Clear Vyčistit - + Error Chyba - + + New tab + Nový panel + + + Not found Soubor neexistuje - + Sorry, the file %1 was not found! @@ -814,12 +829,12 @@ p, li { white-space: pre-wrap; } nebyl nalezen! - + Error: Cannot write to file! Chyba: Nelze zapisovat do souboru! - + Error: Chyba: @@ -827,32 +842,32 @@ nebyl nalezen! DownloadManager - + %1% of %2 files (%3) %4 remaining %1% z %2 souborů (%3) %4 zbyvá - + % - Download Manager % - Správce stahování - + Save file as... Uložit soubor jako... - + Warning Varování - + Are you sure to quit? All uncompleted downloads will be cancelled! Jste si jistý že chcete skončit? Všechna nedokončená stahování budou zrušena! - + NoNameDownload BezNazvu diff --git a/translations/sk_SK.ts b/translations/sk_SK.ts index 0846c3760..bcebd9352 100644 --- a/translations/sk_SK.ts +++ b/translations/sk_SK.ts @@ -722,93 +722,108 @@ p, li { white-space: pre-wrap; } - + Remaining time unavailable Neznámy zostávajúci čas - + Done - %1 Dokončené - %1 - - + + Cancelled Zrušené - + few seconds pár sekúnd - + seconds sekúnd - + minutes minút - + hours hodín - + Remaining %1 - %2 of %3 (%4) Zostáva %1 - %2 z %3 (%4) - + Cancelled - %1 Zrušene - %1 - + Delete file Vymazať súbor - + Do you want to also delete dowloaded file? Chcete zmazať sťahovaný súbor? - + Open File Otvoriť súbor - + Open Folder Otvoriť priečinok - + + Go to Download Page + + + + + Copy Download Link + + + + Cancel downloading Zrušiť sťahovanie - + Clear Vyčistiť - + Error Chyba - + + New tab + Nový panel + + + Not found Súbor neexistuje - + Sorry, the file %1 was not found! @@ -817,12 +832,12 @@ p, li { white-space: pre-wrap; } nebol nájdený! - + Error: Cannot write to file! Chyba: Nejde zapisovať do súboru! - + Error: Chyba: @@ -830,32 +845,32 @@ p, li { white-space: pre-wrap; } DownloadManager - + %1% of %2 files (%3) %4 remaining %1% z %2 súborov (%3) %4 zostávajú - + % - Download Manager % - Správca sťahovania - + Save file as... Uložiť súbor ako... - + Warning Upozornenie - + Are you sure to quit? All uncompleted downloads will be cancelled! Ste si istý, že chcete skončiť? Všetky nedokončené sťahovania budú zrušene! - + NoNameDownload BezNázvu