diff --git a/windows/AllAssociation.nsh b/windows/AllAssociation.nsh new file mode 100644 index 000000000..8d71ac186 --- /dev/null +++ b/windows/AllAssociation.nsh @@ -0,0 +1,456 @@ +/* +_____________________________________________________________________________ + + All Association +_____________________________________________________________________________ + + + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ; Date: 2012-Nov-18, S. Razi Alavizadeh, v0.1 ; + ; Some Codes are based on code taken from: ; + ; http://nsis.sourceforge.net/File_Association ; + ; Ability to register protocol and extention associations. ; + ; It supports old association method and new method by using ; + ; IApplicationAssociationRegistration APIs. ; + ; that needed 'AppAssocReg' plugins, downloadable from: ; + ; http://nsis.sourceforge.net/SetVistaDefaultApp_plug-in ; + ; and also add support for set as default backuped association when ; + ; uninstalling. This needed 'Registery' plugins. ; + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + Requirment: + 1. 'AppAssocReg' plugins. + 2. 'Registery' plugins. + + Usage in script: + 1. !include "AllAssociation.nsh" + 2. [Section|Function] + ${AllAssociationFunction} "Param1" "Param2" "..." $var + [SectionEnd|FunctionEnd] + + AllAssociationFunction=[RegisterAssociation|UnRegisterAssociation|CreateProgId|UpdateSystemIcons|SetAsDefaultNoAppName] + +_____________________________________________________________________________ + + ${RegisterAssociation} "[assoc_name]" "[executable]" "[prog_id]" "[description]" "[icon]" "[type]" + +"[assoc_name]" ; assoc_name, which is file format's extention if type is "file" and is protocol's name if type is "protocol". + ; +"[executable]" ; executable which opens the file format or is protocol handler. + ; +"[prog_id]" ; registery internal id for assoc_name, on Vista+ if type is "protocol" this is our registered ProgId for assoc_name and is used for comparison. + ; +"[description]" ; description for the assoc_name. This will be display in Windows Explorer. + ; +"[icon]" ; icon path for this association. + ; +"[type]" ; type of association. "file" for extention and "protocol" for protocol handler. + ; + + ${UnRegisterAssociation} "[assoc_name]" "[prog_id]" "[executable]" "[type]" + +"[assoc_name]" ; assoc_name, which is file format's extention if type is "file" and is protocol's name if type is "protocol". + ; +"[prog_id]" ; registery internal id for assoc_name + ; +"[executable]" ; executable which opens the file format or is protocol handler. + ; +"[type]" ; type of association. "file" for extention and "protocol" for protocol handler. + ; + + ${CreateProgId} "[prog_id]" "[executable]" "[description]" "[icon]" + +"[prog_id]" ; registery internal id for assoc_name + ; +"[executable]" ; executable which opens the file format or is protocol handler. + ; +"[description]" ; description for the assoc_name. This will be display in Windows Explorer. + ; +"[icon]" ; icon path for this prog_id. + ; + + + ${SetAsDefaultNoAppName} "[prog_id]" "[assoc_name]" "[type]" + +"[prog_id]" ; registery internal id for assoc_name + ; +"[assoc_name]" ; assoc_name, which is file format's extention if type is "file" and is protocol's name if type is "protocol". + ; +"[type]" ; type of association. "file" for extention and "protocol" for protocol handler. + ; + + ${UpdateSystemIcons} ; it has not arguments and just notifies OS for updating icons for new associations. + +_____________________________________________________________________________ + + Macros +_____________________________________________________________________________ + + Change log window verbosity (default: 3=no script) + + Example: + !include "AllAssociation.nsh" + !insertmacro RegisterAssociation + ${AllAssociation_VERBOSE} 4 # all verbosity + !insertmacro UnRegisterAssociation + ${AllAssociation_VERBOSE} 3 # no script +*/ + + +!ifndef AllAssociation_INCLUDED +!define AllAssociation_INCLUDED + +!include Util.nsh + +!verbose push +!verbose 3 +!ifndef _AllAssociation_VERBOSE + !define _AllAssociation_VERBOSE 3 +!endif +!verbose ${_AllAssociation_VERBOSE} +!define AllAssociation_VERBOSE `!insertmacro AllAssociation_VERBOSE` +!verbose pop + +!macro AllAssociation_VERBOSE _VERBOSE + !verbose push + !verbose 3 + !undef _AllAssociation_VERBOSE + !define _AllAssociation_VERBOSE ${_VERBOSE} + !verbose pop +!macroend + + +; define some registery macros +!define RegistryRead `!insertmacro RegistryRead` + +!macro RegistryRead _PATH _VALUE _STRING _TYPE + registry::_Read /NOUNLOAD `${_PATH}` `${_VALUE}` + Pop ${_STRING} + Pop ${_TYPE} +!macroend + + +!define RegistryWrite `!insertmacro RegistryWrite` + +!macro RegistryWrite _PATH _VALUE _STRING _TYPE _ERR + registry::_Write /NOUNLOAD `${_PATH}` `${_VALUE}` `${_STRING}` `${_TYPE}` + Pop ${_ERR} +!macroend + +!define RegistryFind `!insertmacro RegistryFind` + +!macro RegistryFind _HANDLE _PATH _VALUEORKEY _STRING _TYPE + registry::_Find /NOUNLOAD `${_HANDLE}` + Pop ${_PATH} + Pop ${_VALUEORKEY} + Pop ${_STRING} + Pop ${_TYPE} +!macroend + +!define RegistryOpen `!insertmacro RegistryOpen` + +!macro RegistryOpen _PATH _OPTIONS _HANDLE + registry::_Open /NOUNLOAD `${_PATH}` `${_OPTIONS}` + Pop ${_HANDLE} +!macroend + +!macro RegisterAssociationCall _EXTENSION _EXECUTABLE _PROG_ID _DESCRIPTION _ICON _TYPE + !verbose push + !verbose ${_AllAssociation_VERBOSE} + + Push `${_EXECUTABLE}` + Push `${_PROG_ID}` + Push `${_DESCRIPTION}` + Push `${_ICON}` + + ${CallArtificialFunction} CreateProgId_ + + + Push `${_PROG_ID}` + Push `${_EXECUTABLE}` + Push `${_EXTENSION}` + Push `${_TYPE}` + + ${CallArtificialFunction} RegisterAssociation_ + + !verbose pop +!macroend + +!macro UnRegisterAssociationCall _EXTENSION _PROG_ID _EXECUTABLE _TYPE + !verbose push + !verbose ${_AllAssociation_VERBOSE} + Push `${_EXTENSION}` + Push `${_EXECUTABLE}` + Push `${_PROG_ID}` + Push `${_TYPE}` + + ${CallArtificialFunction} UnRegisterAssociation_ + + ; backuped ProgId was pushed from UnRegisterAssociation_ + Push `${_EXTENSION}` + Push `${_TYPE}` ; type of association + ${CallArtificialFunction} SetAsDefaultNoAppName_ + + !verbose pop +!macroend + +!macro CreateProgIdCall _PROG_ID _EXECUTABLE _DESCRIPTION _ICON + !verbose push + !verbose ${_AllAssociation_VERBOSE} + Push `${_EXECUTABLE}` + Push `${_PROG_ID}` + Push `${_DESCRIPTION}` + Push `${_ICON}` + + ${CallArtificialFunction} CreateProgId_ + !verbose pop +!macroend + +!macro SetAsDefaultNoAppNameCall _PROG_ID _EXTENSION _TYPE + !verbose push + !verbose ${_AllAssociation_VERBOSE} + Push `${_PROG_ID}` + Push `${_EXTENSION}` + Push `${_TYPE}` + + ${CallArtificialFunction} SetAsDefaultNoAppName_ + !verbose pop +!macroend + +!define SetAsDefaultNoAppName `!insertmacro SetAsDefaultNoAppNameCall` +!define un.SetAsDefaultNoAppName `!insertmacro SetAsDefaultNoAppNameCall` + +!macro SetAsDefaultNoAppName +!macroend + +!macro un.SetAsDefaultNoAppName +!macroend + +!macro SetAsDefaultNoAppName_ + !verbose push + !verbose ${_AllAssociation_VERBOSE} + + Pop $R0 ; TYPE + Pop $R1 ; EXTENSION + Pop $R2 ; PROG_ID + + StrCmp $R2 "No ProgId Pushed" NoBackupedProgId 0 + StrCmp $R2 "" NoBackupedProgId 0 + StrCmp $R1 "" NoBackupedProgId 0 + ${RegistryOpen} "HKLM\SOFTWARE\RegisteredApplications" "/K=0 /V=1 /S=0 /B=1" $R8 ; R8 = first registery handle + StrCmp $R8 0 close 0 +loop1: + ${RegistryFind} "$R8" $1 $R3 $3 $4 ; $R3 = AppRegisteredName + StrCmp $1 "" close 0 + + ${RegistryOpen} "HKLM\$3" "/K=0 /V=1 /S=0 /B=1 /N='$R1'" $R9 ; R9 = second registery handle + StrCmp $R9 0 loop1 0 +loop2: + ${RegistryFind} "$R9" $1 $2 $R4 $4 ; $R4 = ProgId registered for EXTENSION + StrCmp $1 "" loop1 0 + StrCmp $R4 "$R2" 0 loop2 + + AppAssocReg::SetAppAsDefault "$R3" "$R1" "$R0" + +close: + registry::_Close /NOUNLOAD "$R9" + registry::_Close /NOUNLOAD "$R8" + registry::_Unload + +NoBackupedProgId: + !verbose pop +!macroend + +!define CreateProgId `!insertmacro CreateProgIdCall` +!define un.CreateProgId `!insertmacro CreateProgIdCall` + +!macro CreateProgId +!macroend + +!macro un.CreateProgId +!macroend + +!macro CreateProgId_ + !verbose push + !verbose ${_AllAssociation_VERBOSE} + + Pop $R0 ;ICON + Pop $R1 ;DESCRIPTION + Pop $R2 ;PROG_ID + Pop $R3 ;EXECUTABLE + + ReadRegStr $0 HKCR $R2 "" +; StrCmp $0 "" 0 JustSkip ; if icon and description are present then just skip + WriteRegStr HKCR "$R2" "" "$R1" + WriteRegStr HKCR "$R2\shell" "" "open" + WriteRegStr HKCR "$R2\DefaultIcon" "" "$R0" +;JustSkip: + WriteRegStr HKCR "$R2\shell\open\command" "" '"$R3" "%1"' + WriteRegStr HKCR "$R2\shell\edit" "" "Edit $R1" + WriteRegStr HKCR "$R2\shell\edit\command" "" '"$R3" "%1"' + + !verbose pop +!macroend + +!define RegisterAssociation `!insertmacro RegisterAssociationCall` +!define un.RegisterAssociation `!insertmacro RegisterAssociationCall` + +!macro RegisterAssociation +!macroend + +!macro un.RegisterAssociation +!macroend + +!macro RegisterAssociation_ + !verbose push + !verbose ${_AllAssociation_VERBOSE} + + Pop $R0 ;type = file or protocol + Pop $R1 ;association name = ext or protocol + Pop $R2 ;exe + Pop $R3 ;prog_id + + + StrCmp "$R0" "file" 0 NoFile +; file + ReadRegStr $1 HKCR $R1 "" ; read current file association + StrCmp "$1" "" NoFileExtBackup ; is it empty + StrCmp "$1" "$R3" NoFileExtBackup ; it is our own + WriteRegStr HKCR $R1 "backup_val" "$1" ; backup current value +NoFileExtBackup: + WriteRegStr HKCR $R1 "" "$R3" ; set our file association +Goto VistaPlus + +NoFile: +; Protocol + StrCmp "$R0" "protocol" 0 NotSupported + ; write protocol flag + WriteRegStr HKCR $R1 "URL Protocol" "" + ;get prog_id of current default + + AppAssocReg::QueryCurrentDefault $R1 "protocol" "user" + Pop $1 + StrCmp "$1" "method failed" NoProgID 0 + StrCmp "$1" "method not available" NoProgID 0 + StrCmp "$1" "$R3" NoProgID 0 ; it is our own + WriteRegStr HKCR "$R1\shell\open\command" "backup_progid" "$1" ; backup current progid +NoProgID: +; ReadRegStr $1 HKCR "$R1\shell\open\command" "" ; read current protocol association + ; some applications write this as REG_EXPAND_SZ and don't work with REG_SZ (e.g.: some version of Opera) + ${RegistryRead} "HKCR\$R1\shell\open\command" "" '$1' '$0' ; read current protocol association and its registery type + StrCmp "$1" "" NoProtocolBackup ; is it empty + StrCmp "$1" '"$R2" "%1"' NoProtocolBackup ; it is our own + ;WriteRegStr HKCR "$R1\shell\open\command" "backup_val" "$1" ; backup current value + ${RegistryWrite} "HKCR\$R1\shell\open\command" "backup_val" '$1' '$0' '$2'; backup current value and its registery type +NoProtocolBackup: + WriteRegStr HKCR "$R1\shell\open\command" "" '"$R2" "%1"' ; set our file association +;Goto VistaPlus + +; TODO: type = startMenu or type = mime + +VistaPlus: + ;Vista and newer need some more works + AppAssocReg::SetAppAsDefault "${PRODUCT_NAME}" "$R1" "$R0" + +NotSupported: + registry::_Unload + !verbose pop +!macroend + +!define UnRegisterAssociation `!insertmacro UnRegisterAssociationCall` +!define un.UnRegisterAssociation `!insertmacro UnRegisterAssociationCall` + +!macro UnRegisterAssociation +!macroend + +!macro un.UnRegisterAssociation +!macroend + +!macro UnRegisterAssociation_ + !verbose push + !verbose ${_AllAssociation_VERBOSE} + + Pop $R3 ;type = file or protocol + Pop $R2 ;prog_id + Pop $R1 ;exe + Pop $R0 ;association name = ext or protocol + + StrCmp "$R3" "file" 0 NoFile +; file + ReadRegStr $1 HKCR $R0 "" + StrCmp $1 $R2 0 NoOwn ; only do this if we own it + ReadRegStr $1 HKCR $R0 "backup_val" + StrCmp $1 "" 0 RestoreFile ; if backup="" then delete the whole key + Push `"No ProgId Pushed"` + DeleteRegKey HKCR $R0 + Goto NoOwn + + RestoreFile: + Push `$1` + WriteRegStr HKCR $R0 "" $1 + DeleteRegValue HKCR $R0 "backup_val" + DeleteRegKey HKCR $R2 ;Delete key with association name settings + Goto NoOwn + +NoFile: +; Protocol + StrCmp "$R3" "protocol" 0 NoOwn + ReadRegStr $1 HKCR "$R0\shell\open\command" "" + StrCmp $1 '"$R1" "%1"' 0 NoOwn ; only do this if we own it + ; ReadRegStr $1 HKCR "$R0\shell\open\command" "backup_val" + ${RegistryRead} "HKEY_CLASSES_ROOT\$R0\shell\open\command" "backup_val" '$1' '$0' ; read current protocol association and its registery type + StrCmp $1 "" 0 RestoreProtocol ; if backup="" then delete the whole key + Push `"No ProgId Pushed"` + DeleteRegKey HKCR "$R0\shell\open\command" + Goto NoOwn + + RestoreProtocol: + ReadRegStr $2 HKCR "$R0\shell\open\command" "backup_progid" + StrCmp $2 "" 0 HasProgId + Push `"No ProgId Pushed"` + Goto NoProgID + HasProgId: + Push `$2` + NoProgID: + ;WriteRegStr HKCR "$R0\shell\open\command" "" $1 + ${RegistryWrite} "HKEY_CLASSES_ROOT\$R0\shell\open\command" "" '$1' '$0' '$2' + DeleteRegValue HKCR "$R0\shell\open\command" "backup_val" + DeleteRegValue HKCR "$R0\shell\open\command" "backup_progid" + StrCmp $R2 "" NoOwn 0 ;Delete protocol association if it's present + DeleteRegKey HKCR $R2 ;Delete key with association name settings +;Goto NoOwn + +; TODO: type = startMenu or type = mime + + NoOwn: + registry::_Unload + !verbose pop +!macroend + +!define UpdateSystemIcons `!insertmacro UpdateSystemIcons_` +!define un.UpdateSystemIcons `!insertmacro UpdateSystemIcons_` + +!macro UpdateSystemIcons +!macroend + +!macro un.UpdateSystemIcons +!macroend + + ; !defines for use with SHChangeNotify +!ifdef SHCNE_ASSOCCHANGED + !undef SHCNE_ASSOCCHANGED +!endif +!define SHCNE_ASSOCCHANGED 0x08000000 + +!ifdef SHCNF_FLUSHNOWAIT + !undef SHCNF_FLUSHNOWAIT +!endif +!define SHCNF_FLUSHNOWAIT 0x3000 + +!macro UpdateSystemIcons_ +; Using the system.dll plugin to call the SHChangeNotify Win32 API function so we +; can update the shell. + System::Call "shell32::SHChangeNotify(i,i,i,i) (${SHCNE_ASSOCCHANGED}, ${SHCNF_FLUSHNOWAIT}, 0, 0)" +!macroend +!endif # !AllAssociation_INCLUDED diff --git a/windows/AppAssocReg.dll b/windows/AppAssocReg.dll new file mode 100644 index 000000000..b0d7f23bc Binary files /dev/null and b/windows/AppAssocReg.dll differ diff --git a/windows/FileAssociation.nsh b/windows/FileAssociation.nsh deleted file mode 100644 index 223aa702c..000000000 --- a/windows/FileAssociation.nsh +++ /dev/null @@ -1,190 +0,0 @@ -/* -_____________________________________________________________________________ - - File Association -_____________________________________________________________________________ - - Based on code taken from http://nsis.sourceforge.net/File_Association - - Usage in script: - 1. !include "FileAssociation.nsh" - 2. [Section|Function] - ${FileAssociationFunction} "Param1" "Param2" "..." $var - [SectionEnd|FunctionEnd] - - FileAssociationFunction=[RegisterExtension|UnRegisterExtension] - -_____________________________________________________________________________ - - ${RegisterExtension} "[executable]" "[extension]" "[description]" - -"[executable]" ; executable which opens the file format - ; -"[extension]" ; extension, which represents the file format to open - ; -"[description]" ; description for the extension. This will be display in Windows Explorer. - ; - - - ${UnRegisterExtension} "[extension]" "[description]" - -"[extension]" ; extension, which represents the file format to open - ; -"[description]" ; description for the extension. This will be display in Windows Explorer. - ; - -_____________________________________________________________________________ - - Macros -_____________________________________________________________________________ - - Change log window verbosity (default: 3=no script) - - Example: - !include "FileAssociation.nsh" - !insertmacro RegisterExtension - ${FileAssociation_VERBOSE} 4 # all verbosity - !insertmacro UnRegisterExtension - ${FileAssociation_VERBOSE} 3 # no script -*/ - - -!ifndef FileAssociation_INCLUDED -!define FileAssociation_INCLUDED - -!include Util.nsh - -!verbose push -!verbose 3 -!ifndef _FileAssociation_VERBOSE - !define _FileAssociation_VERBOSE 3 -!endif -!verbose ${_FileAssociation_VERBOSE} -!define FileAssociation_VERBOSE `!insertmacro FileAssociation_VERBOSE` -!verbose pop - -!macro FileAssociation_VERBOSE _VERBOSE - !verbose push - !verbose 3 - !undef _FileAssociation_VERBOSE - !define _FileAssociation_VERBOSE ${_VERBOSE} - !verbose pop -!macroend - - - -!macro RegisterExtensionCall _EXECUTABLE _EXTENSION _DESCRIPTION - !verbose push - !verbose ${_FileAssociation_VERBOSE} - Push `${_DESCRIPTION}` - Push `${_EXTENSION}` - Push `${_EXECUTABLE}` - ${CallArtificialFunction} RegisterExtension_ - !verbose pop -!macroend - -!macro UnRegisterExtensionCall _EXTENSION _DESCRIPTION - !verbose push - !verbose ${_FileAssociation_VERBOSE} - Push `${_EXTENSION}` - Push `${_DESCRIPTION}` - ${CallArtificialFunction} UnRegisterExtension_ - !verbose pop -!macroend - - - -!define RegisterExtension `!insertmacro RegisterExtensionCall` -!define un.RegisterExtension `!insertmacro RegisterExtensionCall` - -!macro RegisterExtension -!macroend - -!macro un.RegisterExtension -!macroend - -!macro RegisterExtension_ - !verbose push - !verbose ${_FileAssociation_VERBOSE} - - Exch $R2 ;exe - Exch - Exch $R1 ;ext - Exch - Exch 2 - Exch $R0 ;desc - Exch 2 - Push $0 - Push $1 - - ReadRegStr $1 HKCR $R1 "" ; read current file association - StrCmp "$1" "" NoBackup ; is it empty - StrCmp "$1" "$R0" NoBackup ; is it our own - WriteRegStr HKCR $R1 "backup_val" "$1" ; backup current value -NoBackup: - WriteRegStr HKCR $R1 "" "$R0" ; set our file association - - ReadRegStr $0 HKCR $R0 "" - StrCmp $0 "" 0 Skip - WriteRegStr HKCR "$R0" "" "$R0" - WriteRegStr HKCR "$R0\shell" "" "open" - WriteRegStr HKCR "$R0\DefaultIcon" "" "$R2,0" -Skip: - WriteRegStr HKCR "$R0\shell\open\command" "" '"$R2" "%1"' - WriteRegStr HKCR "$R0\shell\edit" "" "Edit $R0" - WriteRegStr HKCR "$R0\shell\edit\command" "" '"$R2" "%1"' - - Pop $1 - Pop $0 - Pop $R2 - Pop $R1 - Pop $R0 - - !verbose pop -!macroend - - - -!define UnRegisterExtension `!insertmacro UnRegisterExtensionCall` -!define un.UnRegisterExtension `!insertmacro UnRegisterExtensionCall` - -!macro UnRegisterExtension -!macroend - -!macro un.UnRegisterExtension -!macroend - -!macro UnRegisterExtension_ - !verbose push - !verbose ${_FileAssociation_VERBOSE} - - Exch $R1 ;desc - Exch - Exch $R0 ;ext - Exch - Push $0 - Push $1 - - ReadRegStr $1 HKCR $R0 "" - StrCmp $1 $R1 0 NoOwn ; only do this if we own it - ReadRegStr $1 HKCR $R0 "backup_val" - StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key - DeleteRegKey HKCR $R0 - Goto NoOwn - -Restore: - WriteRegStr HKCR $R0 "" $1 - DeleteRegValue HKCR $R0 "backup_val" - DeleteRegKey HKCR $R1 ;Delete key with association name settings - -NoOwn: - - Pop $1 - Pop $0 - Pop $R1 - Pop $R0 - - !verbose pop -!macroend - -!endif # !FileAssociation_INCLUDED diff --git a/windows/installer.nsi b/windows/installer.nsi index cf9c9fd90..38881a077 100644 --- a/windows/installer.nsi +++ b/windows/installer.nsi @@ -1,8 +1,14 @@ RequestExecutionLevel admin + +; WinVer.nsh was added in the same release that RequestExecutionLevel so check +; if ___WINVER__NSH___ is defined to determine if RequestExecutionLevel is +; available. +!include /NONFATAL WinVer.nsh + !addplugindir "wininstall\" !include "FileFunc.nsh" -!include "wininstall\FileAssociation.nsh" +!include "wininstall\AllAssociation.nsh" SetCompressor /SOLID /FINAL lzma !define PRODUCT_NAME "QupZilla" @@ -10,6 +16,7 @@ SetCompressor /SOLID /FINAL lzma !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\qupzilla.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" +!define PRODUCT_CAPABILITIES_KEY "Software\${PRODUCT_NAME}\Capabilities" !include "MUI.nsh" !define MUI_ABORTWARNING @@ -118,6 +125,7 @@ notRunning: SetOutPath "$INSTDIR\sqldrivers" File "sqldrivers\qsqlite4.dll" + call RegisterCapabilities SectionEnd SectionGroup $(TITLE_SecThemes) SecThemes @@ -293,11 +301,20 @@ SetOutPath "$INSTDIR\plugins" File "plugins\*.dll" SectionEnd -Section $(TITLE_SecExtensions) SecExtensions - SetOutPath "$INSTDIR" - ${registerExtension} "$INSTDIR\qupzilla.exe" ".htm" $(FILE_Htm) - ${registerExtension} "$INSTDIR\qupzilla.exe" ".html" $(FILE_Html) -SectionEnd +SectionGroup $(TITLE_SecSetASDefault) SecSetASDefault + Section $(TITLE_SecExtensions) SecExtensions + SetOutPath "$INSTDIR" + ${RegisterAssociation} ".htm" "$INSTDIR\qupzilla.exe" "QupZilla.HTM" $(FILE_Htm) "$INSTDIR\qupzilla.exe,1" "file" + ${RegisterAssociation} ".html" "$INSTDIR\qupzilla.exe" "QupZilla.HTML" $(FILE_Html) "$INSTDIR\qupzilla.exe,1" "file" + ${UpdateSystemIcons} + SectionEnd + + Section $(TITLE_SecProtocols) SecProtocols + ${RegisterAssociation} "http" "$INSTDIR\qupzilla.exe" "QupZilla.HTML" "" "$INSTDIR\qupzilla.exe,0" "protocol" + ${RegisterAssociation} "https" "$INSTDIR\qupzilla.exe" "QupZilla.HTML" "" "$INSTDIR\qupzilla.exe,0" "protocol" + ${UpdateSystemIcons} + SectionEnd +SectionGroupEnd Section -StartMenu SetOutPath "$INSTDIR" @@ -320,6 +337,9 @@ SectionEnd !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(DESC_SecDesktop) !insertmacro MUI_DESCRIPTION_TEXT ${SecExtensions} $(DESC_SecExtensions) !insertmacro MUI_DESCRIPTION_TEXT ${SecThemes} $(DESC_SecThemes) + + !insertmacro MUI_DESCRIPTION_TEXT ${SecSetASDefault} $(DESC_SecSetASDefault) + !insertmacro MUI_DESCRIPTION_TEXT ${SecProtocols} $(DESC_SecProtocols) !insertmacro MUI_FUNCTION_DESCRIPTION_END Section -Uninstaller @@ -364,8 +384,15 @@ notRunning: RMDir /r "$SMPROGRAMS\QupZilla" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" - ${unregisterExtension} ".htm" $(FILE_Htm) - ${unregisterExtension} ".html" $(FILE_Html) + + DeleteRegKey HKLM "Software\${PRODUCT_NAME}" + DeleteRegValue HKLM "SOFTWARE\RegisteredApplications" "${PRODUCT_NAME}" + + ${UnRegisterAssociation} ".htm" "QupZilla.HTM" "$INSTDIR\qupzilla.exe" "file" + ${UnRegisterAssociation} ".html" "QupZilla.HTML" "$INSTDIR\qupzilla.exe" "file" + ${UnRegisterAssociation} "http" "" "$INSTDIR\qupzilla.exe" "protocol" + ${UnRegisterAssociation} "https" "" "$INSTDIR\qupzilla.exe" "protocol" + ${UpdateSystemIcons} SectionEnd BrandingText "${PRODUCT_NAME} ${PRODUCT_VERSION} Installer" @@ -431,3 +458,30 @@ Function .onInit StrCmp $LANGUAGE "cancel" 0 +2 Abort FunctionEnd + +Function RegisterCapabilities + !ifdef ___WINVER__NSH___ + ${If} ${AtLeastWinVista} + ; even if we don't associate QupZilla as default for ".htm" and ".html" + ; we need to write these ProgIds for future use! + ;(e.g.: user uses "Default Programs" on Win7 or Vista to set QupZilla as default.) + ${CreateProgId} "QupZilla.HTM" "$INSTDIR\qupzilla.exe" $(FILE_Htm) "$INSTDIR\qupzilla.exe,1" + ${CreateProgId} "QupZilla.HTML" "$INSTDIR\qupzilla.exe" $(FILE_Html) "$INSTDIR\qupzilla.exe,1" + + ; 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}" "ApplicationIcon" "$INSTDIR\qupzilla.exe,0" + WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}" "ApplicationName" "${PRODUCT_NAME}" + WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}\FileAssociations" ".htm" "QupZilla.HTM" + WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}\FileAssociations" ".html" "QupZilla.HTML" + WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}\URLAssociations" "http" "QupZilla.HTML" + WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}\URLAssociations" "https" "QupZilla.HTML" + WriteRegStr HKLM "${PRODUCT_CAPABILITIES_KEY}\Startmenu" "StartMenuInternet" "$INSTDIR\qupzilla.exe" + WriteRegStr HKLM "SOFTWARE\RegisteredApplications" "${PRODUCT_NAME}" "${PRODUCT_CAPABILITIES_KEY}" + ${EndIf} + !endif +FunctionEnd + +Function IsRunningInstance + +FunctionEnd diff --git a/windows/languages.nsh b/windows/languages.nsh index 7d70d5c3a..69685eb0b 100644 --- a/windows/languages.nsh +++ b/windows/languages.nsh @@ -1,10 +1,14 @@ ;;;;English +LangString PRODUCT_DESC ${LANG_ENGLISH} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +; LangString TITLE_SecMain ${LANG_ENGLISH} "Main Components" LangString TITLE_SecTranslations ${LANG_ENGLISH} "Translations" LangString TITLE_SecPlugins ${LANG_ENGLISH} "Plugins" LangString TITLE_SecDesktop ${LANG_ENGLISH} "Desktop Icon" LangString TITLE_SecExtensions ${LANG_ENGLISH} "File Associations" LangString TITLE_SecThemes ${LANG_ENGLISH} "Themes" +LangString TITLE_SecSetASDefault ${LANG_ENGLISH} "Default Browser" +LangString TITLE_SecProtocols ${LANG_ENGLISH} "Protocol Associations" LangString FILE_Htm ${LANG_ENGLISH} "HTM File" LangString FILE_Html ${LANG_ENGLISH} "HTML File" @@ -15,6 +19,8 @@ LangString DESC_SecPlugins ${LANG_ENGLISH} "Other plugins available to install." LangString DESC_SecDesktop ${LANG_ENGLISH} "Add launcher to desktop." LangString DESC_SecExtensions ${LANG_ENGLISH} "Associate QupZilla with .htm and .html files" LangString DESC_SecThemes ${LANG_ENGLISH} "Additional themes for QupZilla" +LangString DESC_SecSetASDefault ${LANG_ENGLISH} "Set Qupzilla as default internet browser" +LangString DESC_SecProtocols ${LANG_ENGLISH} "Associate QupZilla with http and https protocols" ; LangString MSG_RunningInstance ${LANG_ENGLISH} "QupZilla is already running! Do you want the installer try to terminate it?" LangString MSG_InstallationCanceled ${LANG_ENGLISH} "Process canceled by user." @@ -324,12 +330,16 @@ LangString DESC_SecExtensions ${LANG_UKRAINIAN} "Асоціювати QupZill'у LangString DESC_SecThemes ${LANG_UKRAINIAN} "Додаткові теми для QupZill'и" ;;;;Persian (Farsi) +LangString PRODUCT_DESC ${LANG_FARSI} "‫کوپزیلا مرورگر اینترنتی متن‌باز، جدید، سریع و ایمنی است. کوپزیلا تحت توافقنامه GPL نسخه ۳ یا هر نسخه جدیدتر آن است. کوپزیلا تحت هسته وب‌کیت و چارچوب کیوت می‌باشد.‬" +; LangString TITLE_SecMain ${LANG_FARSI} "بخش اصلی" LangString TITLE_SecTranslations ${LANG_FARSI} "برگردان‌ها" LangString TITLE_SecPlugins ${LANG_FARSI} "افزونه‌ها" LangString TITLE_SecDesktop ${LANG_FARSI} "آیکون میزکار" LangString TITLE_SecExtensions ${LANG_FARSI} "تخصیص فایل" LangString TITLE_SecThemes ${LANG_FARSI} "فرهشت‌ها" +LangString TITLE_SecSetASDefault ${LANG_FARSI} "مرورگر پیش‌فرض" +LangString TITLE_SecProtocols ${LANG_FARSI} "تخصیص پروتکل" ; LangString DESC_SecMain ${LANG_FARSI} "بخش اصلی نرم‌افزار." LangString DESC_SecTranslations ${LANG_FARSI} "دیگر برگردان‌های دردسترس. پیش فرض انگلیسی است." @@ -337,9 +347,12 @@ LangString DESC_SecPlugins ${LANG_FARSI} "افزونه‌های دیگر که ب LangString DESC_SecDesktop ${LANG_FARSI} "افزودن میان‌برِ آغازگر به میزکار" LangString DESC_SecExtensions ${LANG_FARSI} "کوپزیلا را برای بازکردن فایل‌های ‎.htm و ‎.html اختصاص می‌دهد." LangString DESC_SecThemes ${LANG_FARSI} "فرهشت‌های اضافی برای کوپزیلا" +LangString DESC_SecSetASDefault ${LANG_FARSI} "تنظیم کوپزیلا به عنوان مرورگر پیش‌فرض" +LangString DESC_SecProtocols ${LANG_FARSI} "کوپزیلا را به پروتکل‌های http و https اختصاص می‌دهد." ; LangString MSG_RunningInstance ${LANG_FARSI} "کوپزیلا هم‌اکنون در حال اجراست! آیا می‌خواهید برنامه نصب تلاش کند به اجرای آن خاتمه دهد؟" LangString MSG_InstallationCanceled ${LANG_FARSI} "فرایند توسط کاربر لغو گردید." + ;;;;;;;;; ;;;;;;;;; ; Unfinished translations @@ -396,6 +409,111 @@ LangString DESC_SecThemes ${LANG_KOREAN} "Additional themes for QupZilla" LangString DESC_SecThemes ${LANG_RUSSIAN} "Additional themes for QupZilla" LangString DESC_SecThemes ${LANG_SPANISH} "Additional themes for QupZilla" +LangString PRODUCT_DESC ${LANG_CZECH} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_SLOVAK} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_GERMAN} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_DUTCH} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_PORTUGUESE} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_GREEK} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_FRENCH} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_ITALIAN} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_ROMANIAN} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_TRADCHINESE} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_SIMPCHINESE} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_INDONESIAN} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_GEORGIAN} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_JAPANESE} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_SWEDISH} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_POLISH} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_UKRAINIAN} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_KOREAN} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_RUSSIAN} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." +LangString PRODUCT_DESC ${LANG_SPANISH} "QupZilla is a new, fast and secure open-source WWW browser. QupZilla is licensed under GPL version 3 or (at your option) any later version. It is based on WebKit core and Qt Framework." + +LangString TITLE_SecSetASDefault ${LANG_CZECH} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_SLOVAK} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_GERMAN} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_DUTCH} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_PORTUGUESE} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_GREEK} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_FRENCH} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_ITALIAN} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_ROMANIAN} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_TRADCHINESE} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_SIMPCHINESE} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_INDONESIAN} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_GEORGIAN} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_JAPANESE} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_SWEDISH} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_POLISH} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_UKRAINIAN} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_KOREAN} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_RUSSIAN} "Default Browser" +LangString TITLE_SecSetASDefault ${LANG_SPANISH} "Default Browser" + +LangString TITLE_SecProtocols ${LANG_CZECH} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_SLOVAK} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_GERMAN} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_DUTCH} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_PORTUGUESE} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_GREEK} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_FRENCH} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_ITALIAN} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_ROMANIAN} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_TRADCHINESE} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_SIMPCHINESE} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_INDONESIAN} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_GEORGIAN} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_JAPANESE} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_SWEDISH} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_POLISH} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_UKRAINIAN} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_KOREAN} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_RUSSIAN} "Protocol Associations" +LangString TITLE_SecProtocols ${LANG_SPANISH} "Protocol Associations" + +LangString DESC_SecSetASDefault ${LANG_CZECH} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_SLOVAK} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_GERMAN} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_DUTCH} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_PORTUGUESE} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_GREEK} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_FRENCH} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_ITALIAN} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_ROMANIAN} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_TRADCHINESE} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_SIMPCHINESE} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_INDONESIAN} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_GEORGIAN} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_JAPANESE} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_SWEDISH} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_POLISH} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_UKRAINIAN} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_KOREAN} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_RUSSIAN} "Set Qupzilla as default internet browser" +LangString DESC_SecSetASDefault ${LANG_SPANISH} "Set Qupzilla as default internet browser" + +LangString DESC_SecProtocols ${LANG_CZECH} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_SLOVAK} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_GERMAN} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_DUTCH} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_PORTUGUESE} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_GREEK} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_FRENCH} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_ITALIAN} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_ROMANIAN} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_TRADCHINESE} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_SIMPCHINESE} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_INDONESIAN} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_GEORGIAN} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_JAPANESE} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_SWEDISH} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_POLISH} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_UKRAINIAN} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_KOREAN} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_RUSSIAN} "Associate QupZilla with http and https protocols" +LangString DESC_SecProtocols ${LANG_SPANISH} "Associate QupZilla with http and https protocols" + LangString MSG_RunningInstance ${LANG_CZECH} "QupZilla is already running! Do you want the installer try to terminate it?" LangString MSG_RunningInstance ${LANG_SLOVAK} "QupZilla is already running! Do you want the installer try to terminate it?" LangString MSG_RunningInstance ${LANG_GERMAN} "QupZilla is already running! Do you want the installer try to terminate it?" diff --git a/windows/registry.dll b/windows/registry.dll new file mode 100644 index 000000000..3c8bc1eab Binary files /dev/null and b/windows/registry.dll differ