Statistics
| Revision:

root / nsis / sylpheed.nsi @ 3173

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.reg"
290
  Delete "$INSTDIR\sylpheed.exe"
291
  Delete "$INSTDIR\sylpheed.png"
292
  Delete "$INSTDIR\${PRODUCT_NAME}.url"
293
  Delete "$INSTDIR\uninst.exe"
294
  Delete "$INSTDIR\wabread.exe"
295
  Delete "$INSTDIR\zlib1.dll"
296
  RMDir /r "$INSTDIR\doc"
297
  RMDir /r "$INSTDIR\etc"
298
  RMDir /r "$INSTDIR\lib"
299
  RMDir /r "$INSTDIR\share\themes"
300
  RMDir "$INSTDIR\share"
301
SectionEnd
302

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

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

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

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

    
336
SectionGroupEnd
337

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

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

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

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

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

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

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

    
379
  SetAutoClose true
380
SectionEnd
381

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

    
410
Function .onInit
411
  ${MementoSectionRestore}
412

    
413
  StrCpy $1 ${sec_sylpheed}
414

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

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

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

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

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

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

    
472
  SetShellVarContext current
473

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

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

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

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

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

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

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

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