1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

[FTP] Caching file icons, also added ftp to installer script and associationManager()

This commit is contained in:
S. Razi Alavizadeh 2013-01-29 20:03:56 +03:30
parent de7c9d56d3
commit 62d3fd8bbb
4 changed files with 15 additions and 1 deletions

View File

@ -863,6 +863,7 @@ RegisterQAppAssociation* MainApplication::associationManager()
m_registerQAppAssociation->addCapability(".htm", "QupZilla.HTM", "HTM File", fileIconPath, RegisterQAppAssociation::FileAssociation); 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("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("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; return m_registerQAppAssociation;
} }

View File

@ -433,8 +433,14 @@ QString QzTools::buildSystem()
QIcon QzTools::iconFromFileName(const QString &fileName) QIcon QzTools::iconFromFileName(const QString &fileName)
{ {
QFileInfo tempInfo(fileName); QFileInfo tempInfo(fileName);
if (m_iconCache.contains(tempInfo.suffix())) {
return m_iconCache.value(tempInfo.suffix());
}
QTemporaryFile tempFile(mApp->tempPath() + "/XXXXXX." + tempInfo.suffix()); QTemporaryFile tempFile(mApp->tempPath() + "/XXXXXX." + tempInfo.suffix());
tempFile.open(); tempFile.open();
tempInfo.setFile(tempFile.fileName()); tempInfo.setFile(tempFile.fileName());
return QFileIconProvider().icon(tempInfo); QIcon icon(QFileIconProvider().icon(tempInfo));
m_iconCache.insert(tempInfo.suffix(), icon);
return icon;
} }

View File

@ -20,6 +20,7 @@
#include <QList> #include <QList>
#include <QString> #include <QString>
#include <QHash>
#include "qz_namespace.h" #include "qz_namespace.h"
@ -73,6 +74,8 @@ bool listContainsIndex(const QList<T> &list, int index)
return (index >= 0 && list.count() > index); return (index >= 0 && list.count() > index);
} }
static QHash<QString, QIcon> m_iconCache;
} // namespace } // namespace
#endif // GLOBALFUNCTIONS_H #endif // GLOBALFUNCTIONS_H

View File

@ -319,6 +319,7 @@ SectionGroup $(TITLE_SecSetASDefault) SecSetASDefault
Section $(TITLE_SecProtocols) SecProtocols Section $(TITLE_SecProtocols) SecProtocols
${RegisterAssociation} "http" "$INSTDIR\qupzilla.exe" "QupZilla.HTTP" "URL:HyperText Transfer Protocol" "$INSTDIR\qupzilla.exe,0" "protocol" ${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} "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} ${UpdateSystemIcons}
SectionEnd SectionEnd
SectionGroupEnd SectionGroupEnd
@ -399,6 +400,7 @@ notRunning:
${UnRegisterAssociation} ".html" "QupZilla.HTML" "$INSTDIR\qupzilla.exe" "file" ${UnRegisterAssociation} ".html" "QupZilla.HTML" "$INSTDIR\qupzilla.exe" "file"
${UnRegisterAssociation} "http" "QupZilla.HTTP" "$INSTDIR\qupzilla.exe" "protocol" ${UnRegisterAssociation} "http" "QupZilla.HTTP" "$INSTDIR\qupzilla.exe" "protocol"
${UnRegisterAssociation} "https" "QupZilla.HTTPS" "$INSTDIR\qupzilla.exe" "protocol" ${UnRegisterAssociation} "https" "QupZilla.HTTPS" "$INSTDIR\qupzilla.exe" "protocol"
${UnRegisterAssociation} "ftp" "QupZilla.FTP" "$INSTDIR\qupzilla.exe" "protocol"
${UpdateSystemIcons} ${UpdateSystemIcons}
SectionEnd SectionEnd
@ -476,6 +478,7 @@ Function RegisterCapabilities
${CreateProgId} "QupZilla.HTML" "$INSTDIR\qupzilla.exe" $(FILE_Html) "$INSTDIR\qupzilla.exe,1" ${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.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.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! ; note: these lines just introduce capabilities of QupZilla to OS and don't change defaults!
WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}" "ApplicationDescription" "$(PRODUCT_DESC)" 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}\FileAssociations" ".html" "QupZilla.HTML"
WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}\URLAssociations" "http" "QupZilla.HTTP" WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}\URLAssociations" "http" "QupZilla.HTTP"
WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}\URLAssociations" "https" "QupZilla.HTTPS" 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 "${PRODUCT_CAPABILITIES_KEY}\Startmenu" "StartMenuInternet" "$INSTDIR\qupzilla.exe"
WriteRegStr HKLM "SOFTWARE\RegisteredApplications" "${PRODUCT_NAME}" "${PRODUCT_CAPABILITIES_KEY}" WriteRegStr HKLM "SOFTWARE\RegisteredApplications" "${PRODUCT_NAME}" "${PRODUCT_CAPABILITIES_KEY}"
${EndIf} ${EndIf}