mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Merge pull request #726 from srazi/master
Fixed downloader issue and some ftp related changes.
This commit is contained in:
commit
ecb1d54af3
@ -863,6 +863,7 @@ RegisterQAppAssociation* MainApplication::associationManager()
|
||||
m_registerQAppAssociation->addCapability(".htm", "QupZilla.HTM", "HTM File", fileIconPath, RegisterQAppAssociation::FileAssociation);
|
||||
m_registerQAppAssociation->addCapability("http", "QupZilla.HTTP", "URL:HyperText Transfer Protocol", appIconPath, RegisterQAppAssociation::UrlAssociation);
|
||||
m_registerQAppAssociation->addCapability("https", "QupZilla.HTTPS", "URL:HyperText Transfer Protocol with Privacy", appIconPath, RegisterQAppAssociation::UrlAssociation);
|
||||
m_registerQAppAssociation->addCapability("ftp", "QupZilla.FTP", "URL:File Transfer Protocol", appIconPath, RegisterQAppAssociation::UrlAssociation);
|
||||
}
|
||||
return m_registerQAppAssociation;
|
||||
}
|
||||
|
@ -320,13 +320,19 @@ void DownloadItem::stop(bool askForDeleteFile)
|
||||
return;
|
||||
}
|
||||
m_downloadStopped = true;
|
||||
QString host = m_reply ? m_reply->url().host() : m_ftpDownloader->url().host();
|
||||
QString host;
|
||||
if (m_reply) {
|
||||
host = m_reply->url().host();
|
||||
}
|
||||
else if (m_ftpDownloader) {
|
||||
host = m_ftpDownloader->url().host();
|
||||
}
|
||||
m_openAfterFinish = false;
|
||||
m_timer.stop();
|
||||
if (m_reply) {
|
||||
m_reply->abort();
|
||||
}
|
||||
else {
|
||||
else if (m_ftpDownloader) {
|
||||
m_ftpDownloader->abort();
|
||||
m_ftpDownloader->close();
|
||||
}
|
||||
@ -454,8 +460,8 @@ void DownloadItem::error()
|
||||
ui->downloadInfo->setText(tr("Error: ") + m_reply->errorString());
|
||||
}
|
||||
else if (m_ftpDownloader && m_ftpDownloader->error() != QFtp::NoError) {
|
||||
ui->downloadInfo->setText(tr("Error: ") + m_ftpDownloader->errorString());
|
||||
stop(false);
|
||||
ui->downloadInfo->setText(tr("Error: ") + m_ftpDownloader->errorString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -464,9 +470,10 @@ void DownloadItem::updateDownload()
|
||||
#ifdef DOWNMANAGER_DEBUG
|
||||
qDebug() << __FUNCTION__ ;
|
||||
#endif
|
||||
bool downoaderIsFinished = (m_reply && m_reply->isFinished())
|
||||
|| (m_ftpDownloader && m_ftpDownloader->isFinished());
|
||||
if (ui->progressBar->maximum() == 0 && m_outputFile.isOpen() && downoaderIsFinished) {
|
||||
// after caling stop() (from readyRead()) m_reply will be a dangling pointer,
|
||||
// thus it should be checked after m_outputFile.isOpen()
|
||||
if (ui->progressBar->maximum() == 0 && m_outputFile.isOpen() &&
|
||||
((m_reply && m_reply->isFinished()) || (m_ftpDownloader && m_ftpDownloader->isFinished()))) {
|
||||
downloadProgress(0, 0);
|
||||
finished();
|
||||
}
|
||||
|
@ -433,8 +433,14 @@ QString QzTools::buildSystem()
|
||||
QIcon QzTools::iconFromFileName(const QString &fileName)
|
||||
{
|
||||
QFileInfo tempInfo(fileName);
|
||||
if (m_iconCache.contains(tempInfo.suffix())) {
|
||||
return m_iconCache.value(tempInfo.suffix());
|
||||
}
|
||||
|
||||
QTemporaryFile tempFile(mApp->tempPath() + "/XXXXXX." + tempInfo.suffix());
|
||||
tempFile.open();
|
||||
tempInfo.setFile(tempFile.fileName());
|
||||
return QFileIconProvider().icon(tempInfo);
|
||||
QIcon icon(QFileIconProvider().icon(tempInfo));
|
||||
m_iconCache.insert(tempInfo.suffix(), icon);
|
||||
return icon;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QHash>
|
||||
|
||||
#include "qz_namespace.h"
|
||||
|
||||
@ -73,6 +74,8 @@ bool listContainsIndex(const QList<T> &list, int index)
|
||||
return (index >= 0 && list.count() > index);
|
||||
}
|
||||
|
||||
static QHash<QString, QIcon> m_iconCache;
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // GLOBALFUNCTIONS_H
|
||||
|
@ -319,6 +319,7 @@ SectionGroup $(TITLE_SecSetASDefault) SecSetASDefault
|
||||
Section $(TITLE_SecProtocols) SecProtocols
|
||||
${RegisterAssociation} "http" "$INSTDIR\qupzilla.exe" "QupZilla.HTTP" "URL:HyperText Transfer Protocol" "$INSTDIR\qupzilla.exe,0" "protocol"
|
||||
${RegisterAssociation} "https" "$INSTDIR\qupzilla.exe" "QupZilla.HTTPS" "URL:HyperText Transfer Protocol with Privacy" "$INSTDIR\qupzilla.exe,0" "protocol"
|
||||
${RegisterAssociation} "ftp" "$INSTDIR\qupzilla.exe" "QupZilla.FTP" "URL:File Transfer Protocol" "$INSTDIR\qupzilla.exe,0" "protocol"
|
||||
${UpdateSystemIcons}
|
||||
SectionEnd
|
||||
SectionGroupEnd
|
||||
@ -399,6 +400,7 @@ notRunning:
|
||||
${UnRegisterAssociation} ".html" "QupZilla.HTML" "$INSTDIR\qupzilla.exe" "file"
|
||||
${UnRegisterAssociation} "http" "QupZilla.HTTP" "$INSTDIR\qupzilla.exe" "protocol"
|
||||
${UnRegisterAssociation} "https" "QupZilla.HTTPS" "$INSTDIR\qupzilla.exe" "protocol"
|
||||
${UnRegisterAssociation} "ftp" "QupZilla.FTP" "$INSTDIR\qupzilla.exe" "protocol"
|
||||
${UpdateSystemIcons}
|
||||
SectionEnd
|
||||
|
||||
@ -476,6 +478,7 @@ Function RegisterCapabilities
|
||||
${CreateProgId} "QupZilla.HTML" "$INSTDIR\qupzilla.exe" $(FILE_Html) "$INSTDIR\qupzilla.exe,1"
|
||||
${CreateProgId} "QupZilla.HTTP" "$INSTDIR\qupzilla.exe" "URL:HyperText Transfer Protocol" "$INSTDIR\qupzilla.exe,0"
|
||||
${CreateProgId} "QupZilla.HTTPS" "$INSTDIR\qupzilla.exe" "URL:HyperText Transfer Protocol with Privacy" "$INSTDIR\qupzilla.exe,0"
|
||||
${CreateProgId} "QupZilla.FTP" "$INSTDIR\qupzilla.exe" "URL:File Transfer Protocol" "$INSTDIR\qupzilla.exe,0"
|
||||
|
||||
; note: these lines just introduce capabilities of QupZilla to OS and don't change defaults!
|
||||
WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}" "ApplicationDescription" "$(PRODUCT_DESC)"
|
||||
@ -485,6 +488,7 @@ Function RegisterCapabilities
|
||||
WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}\FileAssociations" ".html" "QupZilla.HTML"
|
||||
WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}\URLAssociations" "http" "QupZilla.HTTP"
|
||||
WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}\URLAssociations" "https" "QupZilla.HTTPS"
|
||||
WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}\URLAssociations" "ftp" "QupZilla.FTP"
|
||||
WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}\Startmenu" "StartMenuInternet" "$INSTDIR\qupzilla.exe"
|
||||
WriteRegStr HKLM "SOFTWARE\RegisteredApplications" "${PRODUCT_NAME}" "${PRODUCT_CAPABILITIES_KEY}"
|
||||
${EndIf}
|
||||
|
Loading…
Reference in New Issue
Block a user