~syleam/openobject-client/trunk-filter_domain_in_selection

1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
1
#####################################################################################
711 by Stephane Wirtel
Add the copyright and use the version
2
#
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
3
# Copyright (c) 2004-TODAY OpenERP S.A. (http://www.openerp.com) All Rights Reserved.
711 by Stephane Wirtel
Add the copyright and use the version
4
#
5
# WARNING: This program as such is intended to be used by professional
6
# programmers who take the whole responsability of assessing all potential
7
# consequences resulting from its eventual inadequacies and bugs
8
# End users who are looking for a ready-to-use solution with commercial
9
# garantees and support are strongly adviced to contract a Free Software
10
# Service Company
11
#
12
# This program is Free Software; you can redistribute it and/or
13
# modify it under the terms of the GNU General Public License
715 by Stephane Wirtel
Change the version of GPL
14
# as published by the Free Software Foundation; either version 3
711 by Stephane Wirtel
Add the copyright and use the version
15
# of the License, or (at your option) any later version.
16
#
17
# This program is distributed in the hope that it will be useful,
18
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
# GNU General Public License for more details.
21
#
22
# You should have received a copy of the GNU General Public License
23
# along with this program; if not, write to the Free Software
24
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
25
#####################################################################################
26
27
!include 'MUI2.nsh'
28
!include 'FileFunc.nsh'
29
!include 'LogicLib.nsh'
30
!include 'Sections.nsh'
31
32
!define PUBLISHER 'OpenERP S.A.'
1744 by Stephane Wirtel
[FIX] Add new parameters in the setup.nsi
33
!ifndef MAJOR_VERSION
34
    !define MAJOR_VERSION '6'
35
!endif
36
!ifndef MINOR_VERSION
37
    !define MINOR_VERSION '0'
38
!endif
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
39
!ifndef REVISION_VERSION
1744 by Stephane Wirtel
[FIX] Add new parameters in the setup.nsi
40
    !define REVISION_VERSION '0'
41
!endif
42
!ifndef BUILD_VERSION
43
    !define VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${REVISION_VERSION}"
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
44
!else
1744 by Stephane Wirtel
[FIX] Add new parameters in the setup.nsi
45
    !define VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${REVISION_VERSION}-${BUILD_VERSION}"
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
46
!endif
47
!define PRODUCT_NAME "OpenERP GTK Client"
1744 by Stephane Wirtel
[FIX] Add new parameters in the setup.nsi
48
!define DISPLAY_NAME "${PRODUCT_NAME} ${MAJOR_VERSION}.${MINOR_VERSION}"
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
49
50
!define UNINSTALL_REGISTRY_ROOT HKLM
51
!define UNINSTALL_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${DISPLAY_NAME}"
52
53
!define REGISTRY_KEY "Software\${DISPLAY_NAME}"
54
55
Name '${DISPLAY_NAME}'
56
Caption "${PRODUCT_NAME} ${VERSION} Setup"
711 by Stephane Wirtel
Add the copyright and use the version
57
OutFile "openerp-client-setup-${VERSION}.exe"
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
58
SetCompressor /final /solid lzma
711 by Stephane Wirtel
Add the copyright and use the version
59
SetCompress auto
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
60
ShowInstDetails show
61
62
XPStyle on
63
1744 by Stephane Wirtel
[FIX] Add new parameters in the setup.nsi
64
InstallDir "$PROGRAMFILES\OpenERP ${MAJOR_VERSION}.${MINOR_VERSION}\Client"
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
65
InstallDirRegKey HKCU "${REGISTRY_KEY}" ""
66
67
BrandingText '${PRODUCT_NAME} ${VERSION}'
68
691 by Stephane Wirtel
* Add a shortcut to the documentation - http://www.openerp.com
69
RequestExecutionLevel admin
217 by ced
CLIENT: improve layout win32 installer
70
1744 by Stephane Wirtel
[FIX] Add new parameters in the setup.nsi
71
#VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
72
#VIAddVersionKey "CompanyName" "${PUBLISHER}"
73
#VIAddVersionKey "FileDescription" "Installer of ${DISPLAY_NAME}" 
74
#VIAddVersionKey "LegalCopyright" "${PUBLISHER}"
75
#VIAddVersionKey "LegalTrademark" "OpenERP is a trademark of ${PUBLISHER}"
76
#VIAddVersionKey "FileVersion" "${MAJOR_VERSION}.${MINOR_VERSION}.${REVISION_VERSION}"
77
#VIProductVersion "${MAJOR_VERSION}.${MINOR_VERSION}.${REVISION_VERSION}"
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
78
79
!insertmacro GetParameters
80
!insertmacro GetOptions
81
82
Var Option_AllInOne
83
Var cmdLineParams
84
691 by Stephane Wirtel
* Add a shortcut to the documentation - http://www.openerp.com
85
Var MUI_TEMP
86
Var STARTMENU_FOLDER
217 by ced
CLIENT: improve layout win32 installer
87
691 by Stephane Wirtel
* Add a shortcut to the documentation - http://www.openerp.com
88
!define MUI_ABORTWARNING
713 by Stephane Wirtel
Use the new icon (temp)
89
!define MUI_ICON ".\bin\pixmaps\openerp-icon.ico"
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
90
693 by Stephane Wirtel
Improvement of the Installer
91
!define MUI_WELCOMEFINISHPAGE_BITMAP ".\bin\pixmaps\openerp-intro.bmp"
92
!define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\bin\pixmaps\openerp-intro.bmp"
691 by Stephane Wirtel
* Add a shortcut to the documentation - http://www.openerp.com
93
!define MUI_HEADERIMAGE
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
94
!define MUI_HEADERIMAGE_BITMAP ".\bin\pixmaps\openerp-slogan.bmp"
693 by Stephane Wirtel
Improvement of the Installer
95
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
96
!define MUI_HEADER_TRANSPARENT_TEXT ""
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
97
691 by Stephane Wirtel
* Add a shortcut to the documentation - http://www.openerp.com
98
!insertmacro MUI_PAGE_WELCOME
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
99
!insertmacro MUI_PAGE_LICENSE "doc\Licence.txt"
691 by Stephane Wirtel
* Add a shortcut to the documentation - http://www.openerp.com
100
!insertmacro MUI_PAGE_DIRECTORY
827 by Stephane Wirtel
[IMP] Use the ALLINONE flag
101
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" 
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
102
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${REGISTRY_KEY}"
103
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${DISPLAY_NAME}"
691 by Stephane Wirtel
* Add a shortcut to the documentation - http://www.openerp.com
104
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
105
!insertmacro MUI_PAGE_INSTFILES
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
106
691 by Stephane Wirtel
* Add a shortcut to the documentation - http://www.openerp.com
107
!define MUI_FINISHPAGE_NOAUTOCLOSE
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
108
!define MUI_FINISHPAGE_LINK $(DESC_FinishPage_Link) 
109
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.openerp.com/contact"
691 by Stephane Wirtel
* Add a shortcut to the documentation - http://www.openerp.com
110
!insertmacro MUI_PAGE_FINISH
111
112
!insertmacro MUI_UNPAGE_WELCOME
113
!insertmacro MUI_UNPAGE_CONFIRM
114
!insertmacro MUI_UNPAGE_INSTFILES
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
115
!insertmacro MUI_UNPAGE_FINISH
217 by ced
CLIENT: improve layout win32 installer
116
691 by Stephane Wirtel
* Add a shortcut to the documentation - http://www.openerp.com
117
!insertmacro MUI_LANGUAGE "English"
828 by Stephane Wirtel
[IMP] Use the NSIS::LangDLL plugin
118
!insertmacro MUI_LANGUAGE "French"
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
119
!insertmacro MUI_RESERVEFILE_LANGDLL
691 by Stephane Wirtel
* Add a shortcut to the documentation - http://www.openerp.com
120
121
!macro CreateInternetShortcut FILENAME URL
122
	WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
123
!macroend
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
124
; English
125
LangString DESC_FinishPage_Link ${LANG_ENGLISH} "Contact OpenERP for Partnership and/or Support"
126
127
; French
128
LangString DESC_FinishPage_Link ${LANG_FRENCH} "Contactez OpenERP pour un Partenariat et/ou du Support"
129
130
Section OpenERP_GTK_Client SectionOpenERP_GTK_Client
131
    SetOutPath '$INSTDIR'
132
    ;
133
    ;ADD YOUR OWN FILES HERE...
134
    File /r "dist\*"
135
136
    SetOutPath "$INSTDIR\GTK"
137
    File /r "C:\GTK\*"
138
139
    SetOutPath "$INSTDIR\doc"
140
    File "doc\*"
141
142
    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
143
        ;Create shortcuts
144
        CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
145
        !insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Documentation" "http://www.openerp.com"
146
147
        CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninstall.exe"
148
        CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\OpenERP Client.lnk" "$INSTDIR\openerp-client.exe"
149
        CreateShortCut "$DESKTOP\OpenERP Client.lnk" "$INSTDIR\openerp-client.exe"
150
    !insertmacro MUI_STARTMENU_WRITE_END
151
SectionEnd
152
153
Section -Post
154
    WriteRegExpandStr HKLM "${UNINSTALL_REGISTRY_KEY}" "UninstallString" "$INSTDIR\Uninstall.exe"
155
    WriteRegExpandStr HKLM "${UNINSTALL_REGISTRY_KEY}" "InstallLocation" "$INSTDIR"
156
    WriteRegStr HKLM       "${UNINSTALL_REGISTRY_KEY}" "DisplayName" "${DISPLAY_NAME}"
1744 by Stephane Wirtel
[FIX] Add new parameters in the setup.nsi
157
    WriteRegStr HKLM       "${UNINSTALL_REGISTRY_KEY}" "DisplayVersion" "${MAJOR_VERSION}.${MINOR_VERSION}"
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
158
    WriteRegStr HKLM       "${UNINSTALL_REGISTRY_KEY}" "Publisher" "${PUBLISHER}"
159
    WriteRegDWORD HKLM     "${UNINSTALL_REGISTRY_KEY}" "Version" "${VERSION}"
1744 by Stephane Wirtel
[FIX] Add new parameters in the setup.nsi
160
    WriteRegDWORD HKLM     "${UNINSTALL_REGISTRY_KEY}" "VersionMajor" "${MAJOR_VERSION}.${MINOR_VERSION}"
161
    WriteRegDWORD HKLM     "${UNINSTALL_REGISTRY_KEY}" "VersionMinor" "${REVISION_VERSION}"
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
162
    WriteRegStr HKLM       "${UNINSTALL_REGISTRY_KEY}" "HelpLink" "support@openerp.com"
163
    WriteRegStr HKLM       "${UNINSTALL_REGISTRY_KEY}" "HelpTelephone" "+32.81.81.37.00"
164
    WriteRegStr HKLM       "${UNINSTALL_REGISTRY_KEY}" "URLInfoAbout" "http://www.openerp.com"
165
    WriteRegStr HKLM       "${UNINSTALL_REGISTRY_KEY}" "Contact" "sales@openerp.com"
166
    WriteRegDWORD HKLM     "${UNINSTALL_REGISTRY_KEY}" "NoModify" "1"
167
    WriteRegDWORD HKLM     "${UNINSTALL_REGISTRY_KEY}" "NoRepair" "1"
168
    WriteUninstaller "$INSTDIR\Uninstall.exe"
169
SectionEnd
170
171
Section "Uninstall"
172
    !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
173
174
    Delete "$SMPROGRAMS\$MUI_TEMP\Documentation.url"
175
    Delete "$SMPROGRAMS\$MUI_TEMP\OpenERP Client.lnk"
176
    Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
177
    Delete "$DESKTOP\OpenERP Client.lnk"
178
179
    ;Delete empty start menu parent diretories
180
    StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
181
182
    startMenuDeleteLoop:
183
        ClearErrors
184
        RMDir $MUI_TEMP
185
        GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
186
187
        IfErrors startMenuDeleteLoopDone
188
189
        StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
190
    startMenuDeleteLoopDone:
191
192
    Rmdir /r "$INSTDIR"
193
    DeleteRegKey HKLM "${UNINSTALL_REGISTRY_KEY}"
194
SectionEnd
828 by Stephane Wirtel
[IMP] Use the NSIS::LangDLL plugin
195
196
Function .onInit
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
197
    Push $R0
828 by Stephane Wirtel
[IMP] Use the NSIS::LangDLL plugin
198
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
199
    ${GetParameters} $cmdLineParams
709 by Stephane Wirtel
Change the licensepage's text. Add a function .onInit to check a previous installation
200
    ClearErrors
1741 by Stephane Wirtel
[REF] Rewrite the Windows Installer
201
202
    Pop $R0
203
204
    StrCpy $Option_AllInOne 0
205
206
    Push $R0
207
    ${GetOptions} $cmdLineParams '/allinone' $R0
208
    IfErrors +2 0
209
    StrCpy $Option_AllInOne 1
210
    Pop $R0
211
212
    StrCmp $Option_AllInOne 1 AllInOneMode
213
    StrCmp $Option_AllInOne 0 NoAllInOneMode
214
215
    AllInOneMode:
216
        MessageBox MB_OK|MB_ICONINFORMATION "All In One"
217
218
    NoAllInOneMode:
219
    
220
    !insertmacro MUI_LANGDLL_DISPLAY
221
FunctionEnd
828 by Stephane Wirtel
[IMP] Use the NSIS::LangDLL plugin
222