Statistics
| Revision:

root / nsis / sylpheed.nsi @ 3174

History | View | Annotate | Download (21.4 KB)

1
; Script generated by the HM NIS Edit Script Wizard.
2
; Modified by Ikuya Awashiro <ikuya@fruitsbasket.info>
3
; Modified by Hiroyuki Yamamoto <hiro-y@kcn.ne.jp>
4

    
5
; This script requires NsProcess plugin:
6
; http://nsis.sourceforge.net/NsProcess_plugin
7

    
8
!include "sylpheed-defs.nsh"
9

    
10
SetCompressor /SOLID lzma
11

    
12
!include "nsProcess.nsh"
13
!include "Memento.nsh"
14

    
15
; MUI 1.67 compatible ------
16
!include "MUI.nsh"
17
!include "Sections.nsh"
18
!include "LogicLib.nsh"
19

    
20
; MUI Settings
21
!define MUI_ABORTWARNING
22
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-blue.ico"
23
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-blue.ico"
24

    
25
; Welcome page
26
!insertmacro MUI_PAGE_WELCOME
27
; License page
28
!define MUI_LICENSEPAGE_RADIOBUTTONS
29
!insertmacro MUI_PAGE_LICENSE $(license)
30
; Components page
31
!insertmacro MUI_PAGE_COMPONENTS
32
; Directory page
33
!insertmacro MUI_PAGE_DIRECTORY
34
; Instfiles page
35
!insertmacro MUI_PAGE_INSTFILES
36
; Finish page
37
;!define MUI_FINISHPAGE_RUN "$INSTDIR\sylpheed.exe"
38
;!define MUI_FINISHPAGE_RUN_NOTCHECKED
39
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
40
;!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README-win32.txt"
41
;!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README-win32-ja.txt"
42
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION "ShowReadme"
43
!define MUI_FINISHPAGE_SHOWREADME_TEXT "$(readme)"
44
!define MUI_FINISHPAGE_LINK "$(jump)"
45
!define MUI_FINISHPAGE_LINK_LOCATION ${PRODUCT_WEB_SITE}
46
!insertmacro MUI_PAGE_FINISH
47

    
48
; Uninstaller pages
49
!insertmacro MUI_UNPAGE_WELCOME
50
!insertmacro MUI_UNPAGE_CONFIRM
51
!insertmacro MUI_UNPAGE_COMPONENTS
52
!insertmacro MUI_UNPAGE_INSTFILES
53
!insertmacro MUI_UNPAGE_FINISH
54

    
55
; Language files
56
!insertmacro MUI_LANGUAGE "English" # ${LANG_ENGLISH}
57
!insertmacro MUI_LANGUAGE "Spanish" # ${LANG_SPANISH}
58
!insertmacro MUI_LANGUAGE "Japanese" # ${LANG_JAPANESE}
59

    
60
; Reserve files
61
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
62
ReserveFile "${NSISDIR}\Plugins\nsProcess.dll"
63

    
64
; MUI end ------
65

    
66
!include "English.nsh"
67
!include "Spanish.nsh"
68
!include "Japanese.nsh"
69

    
70
Var ISSILENT
71

    
72
;Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
73
;OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}_setup.exe"
74
Name "${INST_NAME} ${INST_VERSION}"
75
OutFile "${INST_FILENAME}-${INST_VERSION}_setup.exe"
76
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
77
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
78
RequestExecutionLevel admin
79
ShowInstDetails hide
80
ShowUnInstDetails hide
81
XPStyle on
82
BrandingText "${INST_NAME} ${INST_VERSION}"
83

    
84
${MementoSection} "!Sylpheed" sec_sylpheed
85
  SetShellVarContext all
86
  SectionIn RO
87
  SetOutPath "$INSTDIR"
88
  File /r "Sylpheed\"
89
  CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
90
  ${If} $LANGUAGE = "${LANG_JAPANESE}"
91
    CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed Manual.lnk" "$INSTDIR\doc\manual\ja\Sylpheed.html"
92
    CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\README.lnk" "$INSTDIR\README-win32-ja.txt"
93
    File /oname=README.txt "Sylpheed\README-win32-ja.txt"
94
  ${ElseIf} $LANGUAGE = "${LANG_SPANISH}"
95
    CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed Manual.lnk" "$INSTDIR\doc\manual\en\Sylpheed.html"
96
    CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\README.lnk" "$INSTDIR\README-win32-es.txt"
97
    File /oname=README.txt "Sylpheed\README-win32-es.txt"
98
  ${Else}
99
    CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed Manual.lnk" "$INSTDIR\doc\manual\en\Sylpheed.html"
100
    CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\README.lnk" "$INSTDIR\README-win32.txt"
101
    File /oname=README.txt "Sylpheed\README-win32.txt"
102
  ${EndIf}
103
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed.lnk" "$INSTDIR\sylpheed.exe"
104
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed (debug mode).lnk" "$INSTDIR\sylpheed.exe" "--debug"
105
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed All Quit.lnk" "$INSTDIR\sylpheed.exe" "--exit"
106
  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${ORIG_WEB_SITE}"
107
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed Homepage.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
108
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
109
${MementoSectionEnd}
110

    
111
SectionGroup /e "$(plugins)" sec_plugins
112

    
113
!ifdef SYLPHEED_PRO
114
${MementoSection} "Sylpheed Pro" sec_sylpheed_pro
115
  SetShellVarContext all
116
  SetOutPath "$INSTDIR"
117
  File /r "Sylpheed-Pro\"
118
  WriteIniStr "$INSTDIR\${INST_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
119
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed Pro Homepage.lnk" "$INSTDIR\${INST_NAME}.url"
120
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed Pro Manual.lnk" "$INSTDIR\doc\manual\sylpheed-pro\ja\search-plugin.html"
121
${MementoSectionEnd}
122
!endif
123

    
124
${MementoSection} "$(attachment_tool_plugin)" sec_attachment_tool_plugin
125
  SetOutPath "$INSTDIR\plugins"
126
  File "plugins\plugins\attachment_tool.dll"
127
  SetOutPath "$INSTDIR\doc\plugins"
128
  File "plugins\doc\plugins\README.attachment_tool.txt"
129
${MementoSectionEnd}
130

    
131
SectionGroupEnd
132

    
133
${MementoSection} "sylfilter" sec_sylfilter
134
  SetOutPath "$INSTDIR"
135
  File /r "sylfilter\"
136
${MementoSectionEnd}
137

    
138
${MementoSection} "bsfilter" sec_bsfilter
139
  SetOutPath "$INSTDIR"
140
  File /r "bsfilter\"
141
${MementoSectionEnd}
142

    
143
${MementoSection} "$(desktop_shortcut)" sec_desktop_shortcut
144
  SetShellVarContext current
145
  CreateShortCut "$DESKTOP\Sylpheed.lnk" "$INSTDIR\sylpheed.exe"
146
${MementoSectionEnd}
147

    
148
${MementoUnselectedSection} "$(quick_shortcut)" sec_quick_shortcut
149
  SetShellVarContext current
150
  CreateShortCut "$QUICKLAUNCH\Sylpheed.lnk" "$INSTDIR\sylpheed.exe"
151
${MementoSectionEnd}
152

    
153
${MementoSection} "$(handler)" sec_handler
154
   ; HKLM
155
   ; .eml
156
   WriteRegStr HKLM "Software\Classes\Sylpheed.EML" "" "Sylpheed Message"
157
   WriteRegDWORD HKLM "Software\Classes\Sylpheed.EML" "EditFlags" 0x00000002
158
   WriteRegStr HKLM "Software\Classes\Sylpheed.EML" "FriendlyTypeName" "Sylpheed Message"
159
   WriteRegStr HKLM "Software\Classes\Sylpheed.EML\DefaultIcon" "" "$INSTDIR\sylpheed.exe,0"
160
   WriteRegStr HKLM "Software\Classes\Sylpheed.EML\shell\open\command" "" "$\"$INSTDIR\sylpheed.exe$\" --open $\"%1$\""
161

    
162
   ; mailto:
163
   WriteRegStr HKLM "Software\Classes\mailto" "" "URL:MailTo Protocol"
164
   WriteRegDWORD HKLM "Software\Classes\mailto" "EditFlags" 0x00000002
165
   WriteRegStr HKLM "Software\Classes\mailto" "FriendlyTypeName" "Sylpheed MailTo"
166
   WriteRegStr HKLM "Software\Classes\mailto" "URL Protocol" ""
167
   WriteRegStr HKLM "Software\Classes\mailto\DefaultIcon" "" "$INSTDIR\sylpheed.exe,0"
168
   WriteRegStr HKLM "Software\Classes\mailto\shell\open\command" "" "$\"$INSTDIR\sylpheed.exe$\" --compose $\"%1$\""
169

    
170
   WriteRegStr HKLM "Software\Classes\Sylpheed.Url.MailTo" "" "URL:MailTo Protocol"
171
   WriteRegDWORD HKLM "Software\Classes\Sylpheed.Url.MailTo" "EditFlags" 0x00000002
172
   WriteRegStr HKLM "Software\Classes\Sylpheed.Url.MailTo" "FriendlyTypeName" "Sylpheed MailTo"
173
   WriteRegStr HKLM "Software\Classes\Sylpheed.Url.MailTo" "URL Protocol" ""
174
   WriteRegStr HKLM "Software\Classes\Sylpheed.Url.MailTo\DefaultIcon" "" "$INSTDIR\sylpheed.exe,0"
175
   WriteRegStr HKLM "Software\Classes\Sylpheed.Url.MailTo\shell\open\command" "" "$\"$INSTDIR\sylpheed.exe$\" --compose $\"%1$\""
176

    
177
   WriteRegStr HKLM "Software\Clients\Mail\Sylpheed" "" "Sylpheed"
178
   WriteRegStr HKLM "Software\Clients\Mail\Sylpheed\DefaultIcon" "" "$INSTDIR\sylpheed.exe,0"
179
   WriteRegStr HKLM "Software\Clients\Mail\Sylpheed\Protocols\mailto" "" "URL:MailTo Protocol"
180
   WriteRegStr HKLM "Software\Clients\Mail\Sylpheed\Protocols\mailto" "URL Protocol" ""
181
   WriteRegStr HKLM "Software\Clients\Mail\Sylpheed\Protocols\mailto\DefaultIcon" "" "$INSTDIR\sylpheed.exe,0"
182
   WriteRegStr HKLM "Software\Clients\Mail\Sylpheed\Protocols\mailto\shell\open\command" "" "$\"$INSTDIR\sylpheed.exe$\" --compose $\"%1$\""
183
   WriteRegStr HKLM "Software\Clients\Mail\Sylpheed\shell\open\command" "" "$\"$INSTDIR\sylpheed.exe$\""
184

    
185
   WriteRegStr HKLM "Software\Clients\Mail\Sylpheed\Capabilities" "ApplicationName" "Sylpheed"
186
   WriteRegStr HKLM "Software\Clients\Mail\Sylpheed\Capabilities" "ApplicationIcon" "$INSTDIR\sylpheed.exe,0"
187
   WriteRegStr HKLM "Software\Clients\Mail\Sylpheed\Capabilities" "ApplicationDescription" "Sylpheed - lightweight and user-friendly e-mail client"
188
   WriteRegStr HKLM "Software\Clients\Mail\Sylpheed\Capabilities\FileAssociations" ".eml" "Sylpheed.EML"
189
   WriteRegStr HKLM "Software\Clients\Mail\Sylpheed\Capabilities\URLAssociations" "mailto" "Sylpheed.Url.MailTo"
190
   WriteRegStr HKLM "Software\Clients\Mail\Sylpheed\Capabilities\StartMenu" "Mail" "Sylpheed"
191

    
192
   WriteRegStr HKLM "Software\RegisteredApplications" "Sylpheed" "SOFTWARE\Clients\Mail\Sylpheed\Capabilities"
193

    
194
   ; HKCU
195
   WriteRegStr HKCU "Software\Clients\Mail" "" "Sylpheed"
196

    
197
   WriteRegStr HKCU "Software\Microsoft\Windows\Shell\Associations\URLAssociations\mailto\UserChoice" "Progid" "Sylpheed.Url.MailTo"
198
   DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.eml\UserChoice"
199
   WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.eml\UserChoice" "Progid" "Sylpheed.EML"
200

    
201
   ; .eml
202
   WriteRegStr HKCU "Software\Classes\.eml" "" "Sylpheed.EML"
203

    
204
   WriteRegStr HKCU "Software\Classes\Sylpheed.EML" "" "Sylpheed Message"
205
   WriteRegDWORD HKCU "Software\Classes\Sylpheed.EML" "EditFlags" 0x00000002
206
   WriteRegStr HKCU "Software\Classes\Sylpheed.EML" "FriendlyTypeName" "Sylpheed Message"
207
   WriteRegStr HKCU "Software\Classes\Sylpheed.EML\DefaultIcon" "" "$INSTDIR\sylpheed.exe,0"
208
   WriteRegStr HKCU "Software\Classes\Sylpheed.EML\shell\open\command" "" "$\"$INSTDIR\sylpheed.exe$\" --open $\"%1$\""
209

    
210
   ; mailto:
211
   WriteRegStr HKCU "Software\Classes\mailto" "" "URL:MailTo Protocol"
212
   WriteRegDWORD HKCU "Software\Classes\mailto" "EditFlags" 0x00000002
213
   WriteRegStr HKCU "Software\Classes\mailto" "FriendlyTypeName" "Sylpheed MailTo"
214
   WriteRegStr HKCU "Software\Classes\mailto" "URL Protocol" ""
215
   WriteRegStr HKCU "Software\Classes\mailto\DefaultIcon" "" "$INSTDIR\sylpheed.exe,0"
216
   WriteRegStr HKCU "Software\Classes\mailto\shell\open\command" "" "$\"$INSTDIR\sylpheed.exe$\" --compose $\"%1$\""
217

    
218
   WriteRegStr HKCU "Software\Classes\Sylpheed.Url.MailTo" "" "URL:MailTo Protocol"
219
   WriteRegDWORD HKCU "Software\Classes\Sylpheed.Url.MailTo" "EditFlags" 0x00000002
220
   WriteRegStr HKCU "Software\Classes\Sylpheed.Url.MailTo" "FriendlyTypeName" "Sylpheed MailTo"
221
   WriteRegStr HKCU "Software\Classes\Sylpheed.Url.MailTo" "URL Protocol" ""
222
   WriteRegStr HKCU "Software\Classes\Sylpheed.Url.MailTo\DefaultIcon" "" "$INSTDIR\sylpheed.exe,0"
223
   WriteRegStr HKCU "Software\Classes\Sylpheed.Url.MailTo\shell\open\command" "" "$\"$INSTDIR\sylpheed.exe$\" --compose $\"%1$\""
224
${MementoSectionEnd}
225

    
226
${MementoSectionDone}
227

    
228
Section -Post
229
  WriteUninstaller "$INSTDIR\uninst.exe"
230
  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\sylpheed.exe"
231
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
232
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
233
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\sylpheed.exe"
234
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
235
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
236
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
237
SectionEnd
238

    
239
Section "!un.Sylpheed" sec_un_sylpheed
240
  SetShellVarContext all
241
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed Manual.lnk"
242
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\README.lnk"
243
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed.lnk"
244
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed (debug mode).lnk"
245
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed All Quit.lnk"
246
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed Homepage.lnk"
247
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
248
  SetShellVarContext current
249

    
250
  Delete "$INSTDIR\plugin-updater.exe"
251
  Delete "$INSTDIR\update-manager.exe"
252

    
253
  Delete "$INSTDIR\curl.exe"
254
  Delete "$INSTDIR\gpgme-w32spawn.exe"
255
  Delete "$INSTDIR\gspawn-win32-helper-console.exe"
256
  Delete "$INSTDIR\gspawn-win32-helper.exe"
257
  Delete "$INSTDIR\iconv.dll"
258
  Delete "$INSTDIR\intl.dll"
259
  Delete "$INSTDIR\jpeg62.dll"
260
  Delete "$INSTDIR\libatk-1.0-0.dll"
261
  Delete "$INSTDIR\libcairo-2.dll"
262
  Delete "$INSTDIR\libcompface.dll"
263
  Delete "$INSTDIR\libeay32.dll"
264
  Delete "$INSTDIR\libgdk-win32-2.0-0.dll"
265
  Delete "$INSTDIR\libgdk_pixbuf-2.0-0.dll"
266
  Delete "$INSTDIR\libglib-2.0-0.dll"
267
  Delete "$INSTDIR\libgmodule-2.0-0.dll"
268
  Delete "$INSTDIR\libgobject-2.0-0.dll"
269
  Delete "$INSTDIR\libgpg-error-0.dll"
270
  Delete "$INSTDIR\libgpgme-11.dll"
271
  Delete "$INSTDIR\libgthread-2.0-0.dll"
272
  Delete "$INSTDIR\libgtk-win32-2.0-0.dll"
273
  Delete "$INSTDIR\libonig.dll"
274
  Delete "$INSTDIR\libpango-1.0-0.dll"
275
  Delete "$INSTDIR\libpangocairo-1.0-0.dll"
276
  Delete "$INSTDIR\libpangowin32-1.0-0.dll"
277
  Delete "$INSTDIR\libpng13.dll"
278
  Delete "$INSTDIR\libsylph-0-1.dll"
279
  Delete "$INSTDIR\libsylpheed-plugin-0-1.dll"
280
  Delete "$INSTDIR\libtiff3.dll"
281
  Delete "$INSTDIR\README-win32-es.txt"
282
  Delete "$INSTDIR\README-win32-ja.txt"
283
  Delete "$INSTDIR\README-win32.txt"
284
  Delete "$INSTDIR\README.txt"
285
  Delete "$INSTDIR\sample-sylpheed.ini"
286
  Delete "$INSTDIR\ssleay32.dll"
287
  Delete "$INSTDIR\sylpheed-128x128.png"
288
  Delete "$INSTDIR\sylpheed-64x64.png"
289
  Delete "$INSTDIR\sylpheed-mailto-protocol_admin.reg"
290
  Delete "$INSTDIR\sylpheed-mailto-protocol_user.reg"
291
  Delete "$INSTDIR\sylpheed.exe"
292
  Delete "$INSTDIR\sylpheed.png"
293
  Delete "$INSTDIR\${PRODUCT_NAME}.url"
294
  Delete "$INSTDIR\uninst.exe"
295
  Delete "$INSTDIR\wabread.exe"
296
  Delete "$INSTDIR\zlib1.dll"
297
  RMDir /r "$INSTDIR\doc"
298
  RMDir /r "$INSTDIR\etc"
299
  RMDir /r "$INSTDIR\lib"
300
  RMDir /r "$INSTDIR\share\themes"
301
  RMDir "$INSTDIR\share"
302
SectionEnd
303

    
304
SectionGroup /e "un.$(plugins)" sec_un_plugins
305

    
306
!ifdef SYLPHEED_PRO
307
Section "un.Sylpheed Pro" sec_un_sylpheed_pro
308
  SetShellVarContext all
309
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed Pro Homepage.lnk"
310
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed Pro Manual.lnk"
311
  SetShellVarContext current
312

    
313
  ; Sylpheed Pro components
314
  Delete "$INSTDIR\bzip2.dll"
315
  Delete "$INSTDIR\dbimport-ext.exe"
316
  Delete "$INSTDIR\dts-indexer.exe"
317
  Delete "$INSTDIR\libarchive2.dll"
318
  Delete "$INSTDIR\libmecab.dll"
319
  Delete "$INSTDIR\libpq.dll"
320
  Delete "$INSTDIR\mecabrc"
321
  Delete "$INSTDIR\Sylpheed Pro.url"
322
  Delete "$INSTDIR\plugins\dbimport.dll"
323
  Delete "$INSTDIR\plugins\scheduler.dll"
324
  RMDir /r "$INSTDIR\dic"
325
  RMDir /r "$INSTDIR\pgsql"
326
  RMDir /r "$INSTDIR\pgsql83"
327
  RMDir /r "$INSTDIR\share\sylpheed-pro"
328
  RMDir "$INSTDIR\share"
329
SectionEnd
330
!endif
331

    
332
Section "un.$(attachment_tool_plugin)" sec_un_attachment_tool_plugin
333
  Delete "$INSTDIR\plugins\attachment_tool.dll"
334
  Delete "$INSTDIR\doc\plugins\README.attachment_tool.txt"
335
SectionEnd
336

    
337
SectionGroupEnd
338

    
339
Section "un.sylfilter" sec_un_sylfilter
340
  ; sylfilter components
341
  Delete "$INSTDIR\sylfilter.exe"
342
  Delete "$INSTDIR\sylfilter-cui.exe"
343
SectionEnd
344

    
345
Section "un.bsfilter" sec_un_bsfilter
346
  ; bsfilter components
347
  Delete "$INSTDIR\bsfilter"
348
  Delete "$INSTDIR\bsfilterw.exe"
349
SectionEnd
350

    
351
Section "un.$(desktop_shortcut)" sec_un_desktop_shortcut
352
  SetShellVarContext current
353
  Delete "$DESKTOP\Sylpheed.lnk"
354
SectionEnd
355

    
356
Section "un.$(quick_shortcut)" sec_un_quick_shortcut
357
  SetShellVarContext current
358
  Delete "$QUICKLAUNCH\Sylpheed.lnk"
359
SectionEnd
360

    
361
Section "-un.install"
362
  SetShellVarContext all
363
  RMDir "$SMPROGRAMS\Sylpheed"
364
  SetShellVarContext current
365

    
366
  ; remove plug-ins dir only when empty
367
  RMDir "$INSTDIR\plugins"
368
  RMDir "$INSTDIR"
369

    
370
  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
371
  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_DIR_REGKEY}"
372
  DeleteRegKey HKLM "Software\Classes\Sylpheed.EML"
373
  DeleteRegKey HKLM "Software\Classes\Sylpheed.Url.MailTo"
374
  DeleteRegKey HKLM "Software\Clients\Mail\Sylpheed"
375
  DeleteRegValue HKLM "Software\RegisteredApplications" "Sylpheed"
376
  DeleteRegKey HKCU "Software\Classes\Sylpheed.EML"
377
  DeleteRegKey HKCU "Software\Classes\Sylpheed.Url.MailTo"
378
  DeleteRegKey ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}"
379

    
380
  SetAutoClose true
381
SectionEnd
382

    
383
; Section descriptions
384
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
385
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_sylpheed} "$(sylpheed_description)"
386
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_plugins} "$(plugins_description)"
387
!ifdef SYLPHEED_PRO
388
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_sylpheed_pro} "$(sylpheed_pro_description)"
389
!endif
390
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_attachment_tool_plugin} "$(attachment_tool_plugin_description)"
391
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_sylfilter} "$(sylfilter_description)"
392
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_bsfilter} "$(bsfilter_description)"
393
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_desktop_shortcut} "$(desktop_shortcut_description)"
394
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_quick_shortcut} "$(quick_shortcut_description)"
395
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_handler} "$(handler_description)"
396
!insertmacro MUI_FUNCTION_DESCRIPTION_END
397
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
398
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_un_sylpheed} "$(un_sylpheed_description)"
399
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_un_plugins} "$(un_plugins_description)"
400
!ifdef SYLPHEED_PRO
401
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_un_sylpheed_pro} "$(un_sylpheed_pro_description)"
402
!endif
403
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_un_attachment_tool_plugin} "$(un_attachment_tool_plugin_description)"
404
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_un_sylfilter} "$(un_sylfilter_description)"
405
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_un_bsfilter} "$(un_bsfilter_description)"
406
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_un_desktop_shortcut} "$(un_desktop_shortcut_description)"
407
  !insertmacro MUI_DESCRIPTION_TEXT ${sec_un_quick_shortcut} "$(un_quick_shortcut_description)"
408
  ; handler is not uninstallable.
409
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END
410

    
411
Function .onInit
412
  ${MementoSectionRestore}
413

    
414
  StrCpy $1 ${sec_sylpheed}
415

    
416
; Prevent install while Sylpheed is running
417
check_app_running:
418
  ${nsProcess::FindProcess} "sylpheed.exe" $R0
419
  StrCmp $R0 "0" 0 +3
420
  MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(app_running)" IDOK check_app_running
421
  Abort
422

    
423
; Auto-uninstall old before installing new
424
; http://nsis.sourceforge.net/Auto-uninstall_old_before_installing_new
425
  ReadRegStr $R0 HKLM \
426
  "${PRODUCT_UNINST_KEY}" "UninstallString"
427
  StrCmp $R0 "" done_
428
 
429
  MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
430
  "$(delete_caution)" \
431
  /SD IDOK \
432
  IDOK uninst
433
  Abort
434
  
435
;Run the uninstaller
436
uninst:
437
  ClearErrors
438
  StrCpy $ISSILENT "/S"
439
  IfSilent +2
440
    StrCpy $ISSILENT ""
441
  ExecWait '$R0 $ISSILENT _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
442
 
443
  IfErrors no_remove_uninstaller done_
444
  no_remove_uninstaller:
445
  Abort
446
  
447
; label "done" used in MementoSectionRestore
448
done_:
449
FunctionEnd
450

    
451
Function .onInstSuccess
452
  ${MementoSectionSave}
453
FunctionEnd
454

    
455
Function .onSelChange
456
  !insertmacro StartRadioButtons $1
457
    !insertmacro RadioButton ${sec_sylpheed}
458
  !insertmacro EndRadioButtons
459
FunctionEnd
460

    
461
Function un.onInit
462
check_app_running:
463
  ; Prevent uninstall while Sylpheed is running
464
  ${nsProcess::FindProcess} "sylpheed.exe" $R0
465
  StrCmp $R0 "0" 0 +3
466
  MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(app_running_uninst)" IDOK check_app_running
467
  Abort
468

    
469
  ${nsProcess::KillProcess} "sylpheed.exe" $R0
470
  ${nsProcess::KillProcess} "dts-indexer.exe" $R0
471
  ${nsProcess::KillProcess} "postgres.exe" $R0
472

    
473
  SetShellVarContext current
474

    
475
  IfFileExists "$INSTDIR\sylpheed.exe" sylpheed_file_exists
476
  !insertmacro UnselectSection ${sec_un_sylpheed}
477
  sylpheed_file_exists:
478
  !insertmacro SetSectionFlag ${sec_un_sylpheed} ${SF_RO}
479

    
480
!ifdef SYLPHEED_PRO
481
  IfFileExists "$INSTDIR\plugins\dbimport.dll" sylpheed_pro_file_exists
482
  !insertmacro UnselectSection ${sec_un_sylpheed_pro}
483
  !insertmacro SetSectionFlag ${sec_un_sylpheed_pro} ${SF_RO}
484
  sylpheed_pro_file_exists:
485
!endif
486

    
487
  IfFileExists "$INSTDIR\plugins\attachment_tool.dll" attachment_tool_plugin_file_exists
488
  !insertmacro UnselectSection ${sec_un_attachment_tool_plugin}
489
  !insertmacro SetSectionFlag ${sec_un_attachment_tool_plugin} ${SF_RO}
490
  attachment_tool_plugin_file_exists:
491

    
492
  IfFileExists "$INSTDIR\sylfilter.exe" sylfilter_file_exists
493
  !insertmacro UnselectSection ${sec_un_sylfilter}
494
  !insertmacro SetSectionFlag ${sec_un_sylfilter} ${SF_RO}
495
  sylfilter_file_exists:
496

    
497
  IfFileExists "$INSTDIR\bsfilter" bsfilter_file_exists
498
  !insertmacro UnselectSection ${sec_un_bsfilter}
499
  !insertmacro SetSectionFlag ${sec_un_bsfilter} ${SF_RO}
500
  bsfilter_file_exists:
501

    
502
  SetShellVarContext current
503
  IfFileExists "$DESKTOP\Sylpheed.lnk" desktop_shortcut_file_exists
504
  !insertmacro UnselectSection ${sec_un_desktop_shortcut}
505
  !insertmacro SetSectionFlag ${sec_un_desktop_shortcut} ${SF_RO}
506
  desktop_shortcut_file_exists:
507

    
508
  SetShellVarContext current
509
  IfFileExists "$QUICKLAUNCH\Sylpheed.lnk" quick_shortcut_file_exists
510
  !insertmacro UnselectSection ${sec_un_quick_shortcut}
511
  !insertmacro SetSectionFlag ${sec_un_quick_shortcut} ${SF_RO}
512
  quick_shortcut_file_exists:
513
FunctionEnd
514

    
515
Function ShowReadme
516
  ExecShell open "$INSTDIR\README.txt"
517
!ifdef SYLPHEED_PRO
518
  ${If} $LANGUAGE = "${LANG_JAPANESE}"
519
    IfFileExists "$INSTDIR\doc\manual\sylpheed-pro\ja\search-plugin.html" 0 +2
520
      ExecShell open "$INSTDIR\doc\manual\sylpheed-pro\ja\search-plugin.html"
521
  ${EndIf}
522
!endif
523
FunctionEnd