Skip to content

Commit

Permalink
Add file association for .qgs/.qgz on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Sep 8, 2024
1 parent 9cb3e54 commit 112d123
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cmake/NSIS.template.in
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,25 @@ Section "-Core installation"

!insertmacro MUI_STARTMENU_WRITE_END

WriteRegStr HKCR '.qgs' '' 'QField'
WriteRegStr HKCR '.qgz' '' 'QField'
WriteRegStr HKCR '.qgs\OpenWithProgids' 'QField' ''
WriteRegStr HKCR '.qgz\OpenWithProgids' 'QField' ''
WriteRegStr HKCR '.kml\OpenWithProgids' 'QField' ''
WriteRegStr HKCR '.kmz\OpenWithProgids' 'QField' ''
WriteRegStr HKCR '.gpkg\OpenWithProgids' 'QField' ''
WriteRegStr HKCR '.geojson\OpenWithProgids' 'QField' ''
WriteRegStr HKCR '.mbtiles\OpenWithProgids' 'QField' ''
WriteRegStr HKCR '.tif\OpenWithProgids' 'QField' ''
WriteRegStr HKCR '.tiff\OpenWithProgids' 'QField' ''
WriteRegStr HKCR 'QField' '' 'QField'
WriteRegStr HKCR 'QField\shell' '' 'open'
WriteRegStr HKCR 'QField\DefaultIcon' '' '$INSTDIR\usr\bin\qfield.exe,0'
WriteRegStr HKCR 'QField\shell\open\command' '' '"$INSTDIR\usr\bin\qfield.exe" "%1"'
WriteRegStr HKCR 'QField\shell\edit' '' 'Edit'
WriteRegStr HKCR 'QField\shell\edit\command' '' '"$INSTDIR\usr\bin\qfield.exe" "%1"'
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'

@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@

SectionEnd
Expand Down Expand Up @@ -849,6 +868,8 @@ Section "Uninstall"
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "InstallToDesktop"
;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP "

DeleteRegKey HKCR 'QField'

@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@

;Remove files we installed.
Expand Down
1 change: 1 addition & 0 deletions cmake/Package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ if(WIN32)
message(STATUS " + NSIS YES ")
set(CPACK_NSIS_EXECUTABLES_DIRECTORY "usr\\\\bin")
set(CPACK_NSIS_DISPLAY_NAME "QField")

list(APPEND CPACK_GENERATOR "NSIS")
endif()

Expand Down

1 comment on commit 112d123

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.