mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-19 18:26:34 +01:00
Windows: Update installer to support install in standard or portable mode
This commit is contained in:
parent
c704c5351c
commit
9227a25bbd
@ -32,11 +32,8 @@
|
||||
!include /NONFATAL WinVer.nsh
|
||||
!include x64.nsh
|
||||
|
||||
!ifndef PORTABLE
|
||||
RequestExecutionLevel admin
|
||||
!else
|
||||
RequestExecutionLevel user
|
||||
!endif
|
||||
Var installAsPortable
|
||||
RequestExecutionLevel admin
|
||||
|
||||
!addplugindir "wininstall\"
|
||||
|
||||
@ -61,8 +58,15 @@ SetCompressor /SOLID /FINAL lzma
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE ${FALKON_BIN_DIR}\COPYRIGHT.txt
|
||||
;;;
|
||||
Page custom InstallationModePage InstallationModeLeave
|
||||
;;;
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE "SkipComponentsIfPortableInstalltion"
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
;;;
|
||||
Page custom installationInfoPage installationInfoLeave
|
||||
;;;
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
!define MUI_FINISHPAGE_RUN
|
||||
@ -198,9 +202,21 @@ notRunning:
|
||||
; in some packages *.bdic files use dash '-' instead of underline '_' followed by a version number. e.g. en-US-3-0.bdic
|
||||
File "${QTWEBENGINE_DICTIONARIES_DIR}\en*US*.bdic"
|
||||
|
||||
!ifndef PORTABLE
|
||||
call RegisterCapabilities
|
||||
!endif
|
||||
call RegisterCapabilities
|
||||
|
||||
StrCmp $installAsPortable "YES" 0 skipPortableMode
|
||||
FileOpen $0 $INSTDIR\falkon.conf w
|
||||
FileWrite $0 "[Config]$\r$\n"
|
||||
FileWrite $0 "Portable=true$\r$\n"
|
||||
|
||||
StrCmp $0 "" 0 closeHandle
|
||||
MessageBox MB_OK|MB_ICONEXCLAMATION $(MSG_PortableWriteError)
|
||||
goto skipPortableMode
|
||||
|
||||
closeHandle:
|
||||
FileClose $0
|
||||
|
||||
skipPortableMode:
|
||||
SectionEnd
|
||||
|
||||
SectionGroup $(TITLE_SecThemes) SecThemes
|
||||
@ -247,51 +263,55 @@ SectionEnd
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecMain} $(DESC_SecMain)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecTranslations} $(DESC_SecTranslations)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} $(DESC_SecPlugins)
|
||||
!ifndef PORTABLE
|
||||
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(DESC_SecDesktop)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecExtensions} $(DESC_SecExtensions)
|
||||
!endif
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecThemes} $(DESC_SecThemes)
|
||||
|
||||
!ifndef PORTABLE
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecThemes} $(DESC_SecThemes)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecSetASDefault} $(DESC_SecSetASDefault)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecProtocols} $(DESC_SecProtocols)
|
||||
!endif
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
|
||||
!ifndef PORTABLE
|
||||
SectionGroup $(TITLE_SecSetASDefault) SecSetASDefault
|
||||
Section $(TITLE_SecExtensions) SecExtensions
|
||||
StrCmp $installAsPortable "NO" 0 skipSetExtentions
|
||||
SetOutPath "$INSTDIR"
|
||||
${RegisterAssociation} ".htm" "$INSTDIR\falkon.exe" "FalkonHTML" "Falkon HTML Document" "$INSTDIR\falkon.exe,1" "file"
|
||||
${RegisterAssociation} ".html" "$INSTDIR\falkon.exe" "FalkonHTML" "Falkon HTML Document" "$INSTDIR\falkon.exe,1" "file"
|
||||
${UpdateSystemIcons}
|
||||
skipSetExtentions:
|
||||
SectionEnd
|
||||
|
||||
Section $(TITLE_SecProtocols) SecProtocols
|
||||
StrCmp $installAsPortable "NO" 0 skipSecProtocols
|
||||
${RegisterAssociation} "http" "$INSTDIR\falkon.exe" "FalkonURL" "Falkon URL" "$INSTDIR\falkon.exe,0" "protocol"
|
||||
${RegisterAssociation} "https" "$INSTDIR\falkon.exe" "FalkonURL" "Falkon URL" "$INSTDIR\falkon.exe,0" "protocol"
|
||||
${RegisterAssociation} "ftp" "$INSTDIR\falkon.exe" "FalkonURL" "Falkon URL" "$INSTDIR\falkon.exe,0" "protocol"
|
||||
${UpdateSystemIcons}
|
||||
skipSecProtocols:
|
||||
SectionEnd
|
||||
SectionGroupEnd
|
||||
|
||||
Section -StartMenu
|
||||
StrCmp $installAsPortable "NO" 0 skipStartMenu
|
||||
SetOutPath "$INSTDIR"
|
||||
SetShellVarContext all
|
||||
CreateDirectory "$SMPROGRAMS\Falkon"
|
||||
CreateShortCut "$SMPROGRAMS\Falkon\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
CreateShortCut "$SMPROGRAMS\Falkon\Falkon.lnk" "$INSTDIR\falkon.exe"
|
||||
CreateShortCut "$SMPROGRAMS\Falkon\License.lnk" "$INSTDIR\COPYRIGHT.txt"
|
||||
skipStartMenu:
|
||||
SectionEnd
|
||||
|
||||
Section $(TITLE_SecDesktop) SecDesktop
|
||||
StrCmp $installAsPortable "NO" 0 skipDesktopIcon
|
||||
SetOutPath "$INSTDIR"
|
||||
CreateShortCut "$DESKTOP\Falkon.lnk" "$INSTDIR\falkon.exe" ""
|
||||
skipDesktopIcon:
|
||||
SectionEnd
|
||||
|
||||
Section -Uninstaller
|
||||
StrCmp $installAsPortable "NO" 0 skipUninstaller
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\falkon.exe"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
|
||||
@ -305,6 +325,7 @@ SectionEnd
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "https://kde.org"
|
||||
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
||||
WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "EstimatedSize" "$0"
|
||||
skipUninstaller:
|
||||
SectionEnd
|
||||
|
||||
Section Uninstall
|
||||
@ -375,7 +396,6 @@ SectionEnd
|
||||
${UnRegisterAssociation} "ftp" "FalkonURL" "$INSTDIR\falkon.exe" "protocol"
|
||||
${UpdateSystemIcons}
|
||||
SectionEnd
|
||||
!endif
|
||||
|
||||
BrandingText "${PRODUCT_NAME} ${PRODUCT_VERSION} Installer"
|
||||
|
||||
@ -396,10 +416,6 @@ Function .onInit
|
||||
${Endif}
|
||||
${EndIf}
|
||||
|
||||
!ifdef PORTABLE
|
||||
StrCpy $InstDir "$DESKTOP\${PRODUCT_NAME} Portable\"
|
||||
!endif
|
||||
|
||||
;Prevent Multiple Instances
|
||||
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "FalkonInstaller-4ECB4694-2C39-4f93-9122-A986344C4E7B") i .r1 ?e'
|
||||
Pop $R0
|
||||
@ -471,9 +487,16 @@ Function .onInit
|
||||
Pop $LANGUAGE
|
||||
StrCmp $LANGUAGE "cancel" 0 +2
|
||||
Abort
|
||||
|
||||
;Extract InstallOptions files
|
||||
;$PLUGINSDIR will automatically be removed when the installer closes
|
||||
InitPluginsDir
|
||||
File /oname=$PLUGINSDIR\portable-mode.ini "portable-mode.ini"
|
||||
File /oname=$PLUGINSDIR\portable-info.ini "portable-info.ini"
|
||||
FunctionEnd
|
||||
|
||||
Function RegisterCapabilities
|
||||
StrCmp $installAsPortable "NO" 0 skipRegisterCapabilities
|
||||
!ifdef ___WINVER__NSH___
|
||||
${If} ${AtLeastWinVista}
|
||||
; even if we don't associate Falkon as default for ".htm" and ".html"
|
||||
@ -495,6 +518,7 @@ Function RegisterCapabilities
|
||||
WriteRegStr HKLM "SOFTWARE\RegisteredApplications" "${PRODUCT_NAME}" "${PRODUCT_CAPABILITIES_KEY}"
|
||||
${EndIf}
|
||||
!endif
|
||||
skipRegisterCapabilities:
|
||||
FunctionEnd
|
||||
|
||||
Function RunFalkonAsUser
|
||||
@ -511,3 +535,56 @@ Function un.onInit
|
||||
Abort
|
||||
found:
|
||||
FunctionEnd
|
||||
|
||||
Function InstallationModePage
|
||||
!insertmacro MUI_HEADER_TEXT "$(TITLE_InstallationMode)" "$(DESC_InstallationMode)"
|
||||
|
||||
WriteINIStr "$PLUGINSDIR\portable-mode.ini" "Field 1" "Text" "$(TITLE_StandardInstallation)"
|
||||
WriteINIStr "$PLUGINSDIR\portable-mode.ini" "Field 2" "Text" "$(TITLE_PortableInstallation)"
|
||||
; set layout direction
|
||||
IntCmp $(^RTL) 1 0 +2
|
||||
WriteINIStr "$PLUGINSDIR\portable-mode.ini" "Settings" "RTL" 1
|
||||
|
||||
InstallOptions::dialog $PLUGINSDIR\portable-mode.ini
|
||||
FunctionEnd
|
||||
|
||||
Function InstallationModeLeave
|
||||
ReadINIStr $0 "$PLUGINSDIR\portable-mode.ini" "Field 2" "State"
|
||||
|
||||
StrCmp $0 1 0 notchecked
|
||||
StrCpy $installAsPortable "YES"
|
||||
StrCpy $InstDir "$DESKTOP\${PRODUCT_NAME} Portable\"
|
||||
|
||||
goto skip
|
||||
|
||||
notchecked:
|
||||
StrCpy $installAsPortable "NO"
|
||||
|
||||
skip:
|
||||
FunctionEnd
|
||||
|
||||
Function installationInfoPage
|
||||
!insertmacro MUI_HEADER_TEXT "$(TITLE_InstallInfo)" "$(DESC_InstallInfo)"
|
||||
; set layout direction
|
||||
IntCmp $(^RTL) 1 0 +2
|
||||
WriteINIStr "$PLUGINSDIR\portable-info.ini" "Settings" "RTL" 1
|
||||
|
||||
StrCmp $installAsPortable "NO" 0 infoPortable
|
||||
WriteINIStr "$PLUGINSDIR\portable-info.ini" "Field 1" "Text" "$(DESC_StandardInstallation)"
|
||||
|
||||
Goto showInfo
|
||||
|
||||
infoPortable:
|
||||
WriteINIStr "$PLUGINSDIR\portable-info.ini" "Field 1" "Text" "$(DESC_PortableInstallation)"
|
||||
|
||||
showInfo:
|
||||
InstallOptions::dialog $PLUGINSDIR\portable-info.ini
|
||||
FunctionEnd
|
||||
|
||||
Function installationInfoLeave
|
||||
FunctionEnd
|
||||
|
||||
Function SkipComponentsIfPortableInstalltion
|
||||
StrCmp $installAsPortable "YES" 0 +2
|
||||
Abort
|
||||
FunctionEnd
|
||||
|
@ -21,6 +21,16 @@ LangString DESC_SecExtensions ${LANG_ENGLISH} "Associate Falkon with .htm(l) fil
|
||||
LangString DESC_SecThemes ${LANG_ENGLISH} "Additional themes for Falkon"
|
||||
LangString DESC_SecSetASDefault ${LANG_ENGLISH} "Set Falkon as default internet browser"
|
||||
LangString DESC_SecProtocols ${LANG_ENGLISH} "Associate Falkon with http(s) and ftp protocols"
|
||||
|
||||
LangString TITLE_InstallationMode ${LANG_ENGLISH} "Installation Mode"
|
||||
LangString DESC_InstallationMode ${LANG_ENGLISH} "Select installation mode"
|
||||
LangString TITLE_StandardInstallation ${LANG_ENGLISH} "Standard installation"
|
||||
LangString TITLE_PortableInstallation ${LANG_ENGLISH} "Portable installation"
|
||||
LangString DESC_PortableInstallation ${LANG_ENGLISH} "Falkon will be installed as a 'Portable Application' to the selected location."
|
||||
LangString DESC_StandardInstallation ${LANG_ENGLISH} "Falkon will be installed on your computer."
|
||||
LangString MSG_PortableWriteError ${LANG_ENGLISH} "Error occurred when creating 'falkon.conf' in installation folder. Create it manually."
|
||||
LangString TITLE_InstallInfo ${LANG_ENGLISH} "Ready to install"
|
||||
LangString DESC_InstallInfo ${LANG_ENGLISH} "To start installation click 'install'."
|
||||
;
|
||||
LangString MSG_RunningInstance ${LANG_ENGLISH} "Falkon is already running! Do you want the installer try to terminate it?"
|
||||
LangString MSG_InstallationCanceled ${LANG_ENGLISH} "Process cancelled by user."
|
||||
@ -541,6 +551,16 @@ LangString DESC_SecExtensions ${LANG_FARSI} "کوپزیلا را برای باز
|
||||
LangString DESC_SecThemes ${LANG_FARSI} "فرهشتهای اضافی برای کوپزیلا"
|
||||
LangString DESC_SecSetASDefault ${LANG_FARSI} "تنظیم کوپزیلا به عنوان مرورگر پیشفرض"
|
||||
LangString DESC_SecProtocols ${LANG_FARSI} "کوپزیلا را به پروتکلهای http(s) و ftp اختصاص میدهد."
|
||||
|
||||
LangString TITLE_InstallationMode ${LANG_FARSI} "حالت نصب"
|
||||
LangString DESC_InstallationMode ${LANG_FARSI} "حالت نصب را انتخاب کنید"
|
||||
LangString TITLE_StandardInstallation ${LANG_FARSI} "نصب استاندارد"
|
||||
LangString TITLE_PortableInstallation ${LANG_FARSI} "نصب همراه"
|
||||
LangString DESC_PortableInstallation ${LANG_FARSI} "فالکون به عنوان 'نرمافزار همراه' در مکان انتخاب شده نصب خواهد شد."
|
||||
LangString DESC_StandardInstallation ${LANG_FARSI} "فالکون بر روی رایانه شما نصب خواهد شد."
|
||||
LangString MSG_PortableWriteError ${LANG_FARSI} "خطایی هنگام ایجاد فایل 'falkon.conf' در محل نصب رخ داد. فایلی خالی با نام 'falkon.conf' در پوشه نصب ایجاد نمایید."
|
||||
LangString TITLE_InstallInfo ${LANG_FARSI} "آماده برای آغاز نصب"
|
||||
LangString DESC_InstallInfo ${LANG_FARSI} "برای شروع نصب روی دکمه 'نصب' کلیک کنید."
|
||||
;
|
||||
LangString MSG_RunningInstance ${LANG_FARSI} "کوپزیلا هماکنون در حال اجراست! آیا میخواهید برنامه نصب تلاش کند به اجرای آن خاتمه دهد؟"
|
||||
LangString MSG_InstallationCanceled ${LANG_FARSI} "فرایند توسط کاربر لغو گردید."
|
||||
|
BIN
windows/portable-info.ini
Normal file
BIN
windows/portable-info.ini
Normal file
Binary file not shown.
BIN
windows/portable-mode.ini
Normal file
BIN
windows/portable-mode.ini
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user