Statistics
| Revision:

root / nsis / sylpheed.nsi @ 3168

History | View | Annotate | Download (21.3 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 HKCU "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\shell\open\command" "" "$\"$INSTDIR\sylpheed.exe$\" --compose $\"%1$\""
168

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

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

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

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

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

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

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

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

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

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

    
225
${MementoSectionDone}
226

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

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

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

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

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

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

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

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

    
335
SectionGroupEnd
336

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

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

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

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

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

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

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

    
378
  SetAutoClose true
379
SectionEnd
380

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

    
409
Function .onInit
410
  ${MementoSectionRestore}
411

    
412
  StrCpy $1 ${sec_sylpheed}
413

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

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

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

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

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

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

    
471
  SetShellVarContext current
472

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

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

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

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

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

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

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

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