Statistics
| Revision:

root / nsis / sylpheed.nsi @ 3209

History | View | Annotate | Download (21.7 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

    
91
  ${If} $LANGUAGE = "${LANG_JAPANESE}"
92
    CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\$(sylpheed_manual_lnk).lnk" "$INSTDIR\doc\manual\ja\Sylpheed.html"
93
    CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\README.lnk" "$INSTDIR\README-win32-ja.txt"
94
    File /oname=README.txt "Sylpheed\README-win32-ja.txt"
95
  ${ElseIf} $LANGUAGE = "${LANG_SPANISH}"
96
    CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\$(sylpheed_manual_lnk).lnk" "$INSTDIR\doc\manual\en\Sylpheed.html"
97
    CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\README.lnk" "$INSTDIR\README-win32-es.txt"
98
    File /oname=README.txt "Sylpheed\README-win32-es.txt"
99
  ${Else}
100
    CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\$(sylpheed_manual_lnk).lnk" "$INSTDIR\doc\manual\en\Sylpheed.html"
101
    CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\README.lnk" "$INSTDIR\README-win32.txt"
102
    File /oname=README.txt "Sylpheed\README-win32.txt"
103
  ${EndIf}
104

    
105
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed.lnk" "$INSTDIR\sylpheed.exe"
106
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\$(sylpheed_debug_mode_lnk).lnk" "$INSTDIR\sylpheed.exe" "--debug"
107
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\$(sylpheed_safe_mode_lnk).lnk" "$INSTDIR\sylpheed.exe" "--safe-mode"
108
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\$(sylpheed_all_quit_lnk).lnk" "$INSTDIR\sylpheed.exe" "--exit"
109
  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${ORIG_WEB_SITE}"
110
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\$(sylpheed_homepage_lnk).lnk" "$INSTDIR\${PRODUCT_NAME}.url"
111
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\$(uninstall_lnk).lnk" "$INSTDIR\uninst.exe"
112
${MementoSectionEnd}
113

    
114
SectionGroup /e "$(plugins)" sec_plugins
115

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

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

    
134
SectionGroupEnd
135

    
136
${MementoSection} "sylfilter" sec_sylfilter
137
  SetOutPath "$INSTDIR"
138
  File /r "sylfilter\"
139
${MementoSectionEnd}
140

    
141
${MementoSection} "bsfilter" sec_bsfilter
142
  SetOutPath "$INSTDIR"
143
  File /r "bsfilter\"
144
${MementoSectionEnd}
145

    
146
${MementoSection} "$(desktop_shortcut)" sec_desktop_shortcut
147
  SetShellVarContext current
148
  CreateShortCut "$DESKTOP\Sylpheed.lnk" "$INSTDIR\sylpheed.exe"
149
${MementoSectionEnd}
150

    
151
${MementoUnselectedSection} "$(quick_shortcut)" sec_quick_shortcut
152
  SetShellVarContext current
153
  CreateShortCut "$QUICKLAUNCH\Sylpheed.lnk" "$INSTDIR\sylpheed.exe"
154
${MementoSectionEnd}
155

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

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

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

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

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

    
195
   WriteRegStr HKLM "Software\RegisteredApplications" "Sylpheed" "SOFTWARE\Clients\Mail\Sylpheed\Capabilities"
196

    
197
   ; HKCU
198
   WriteRegStr HKCU "Software\Clients\Mail" "" "Sylpheed"
199

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

    
204
   ; .eml
205
   WriteRegStr HKCU "Software\Classes\.eml" "" "Sylpheed.EML"
206

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

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

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

    
229
${MementoSectionDone}
230

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

    
242
Section "!un.Sylpheed" sec_un_sylpheed
243
  SetShellVarContext all
244
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\$(sylpheed_manual_lnk).lnk"
245
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\README.lnk"
246
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed.lnk"
247
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\$(sylpheed_debug_mode_lnk).lnk"
248
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\$(sylpheed_safe_mode_lnk).lnk"
249
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\$(sylpheed_all_quit_lnk).lnk"
250
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\$(sylpheed_homepage_lnk).lnk"
251
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\$(uninstall_lnk).lnk"
252
  SetShellVarContext current
253

    
254
  Delete "$INSTDIR\plugin-updater.exe"
255
  Delete "$INSTDIR\update-manager.exe"
256

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

    
308
SectionGroup /e "un.$(plugins)" sec_un_plugins
309

    
310
!ifdef SYLPHEED_PRO
311
Section "un.Sylpheed Pro" sec_un_sylpheed_pro
312
  SetShellVarContext all
313
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed Pro Homepage.lnk"
314
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Sylpheed Pro Manual.lnk"
315
  SetShellVarContext current
316

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

    
336
Section "un.$(attachment_tool_plugin)" sec_un_attachment_tool_plugin
337
  Delete "$INSTDIR\plugins\attachment_tool.dll"
338
  Delete "$INSTDIR\doc\plugins\README.attachment_tool.txt"
339
SectionEnd
340

    
341
SectionGroupEnd
342

    
343
Section "un.sylfilter" sec_un_sylfilter
344
  ; sylfilter components
345
  Delete "$INSTDIR\sylfilter.exe"
346
  Delete "$INSTDIR\sylfilter-cui.exe"
347
SectionEnd
348

    
349
Section "un.bsfilter" sec_un_bsfilter
350
  ; bsfilter components
351
  Delete "$INSTDIR\bsfilter"
352
  Delete "$INSTDIR\bsfilterw.exe"
353
SectionEnd
354

    
355
Section "un.$(desktop_shortcut)" sec_un_desktop_shortcut
356
  SetShellVarContext current
357
  Delete "$DESKTOP\Sylpheed.lnk"
358
SectionEnd
359

    
360
Section "un.$(quick_shortcut)" sec_un_quick_shortcut
361
  SetShellVarContext current
362
  Delete "$QUICKLAUNCH\Sylpheed.lnk"
363
SectionEnd
364

    
365
Section "-un.install"
366
  SetShellVarContext all
367
  RMDir "$SMPROGRAMS\Sylpheed"
368
  SetShellVarContext current
369

    
370
  ; remove plug-ins dir only when empty
371
  RMDir "$INSTDIR\plugins"
372
  RMDir "$INSTDIR"
373

    
374
  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
375
  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_DIR_REGKEY}"
376
  DeleteRegKey HKLM "Software\Classes\Sylpheed.EML"
377
  DeleteRegKey HKLM "Software\Classes\Sylpheed.Url.MailTo"
378
  DeleteRegKey HKLM "Software\Clients\Mail\Sylpheed"
379
  DeleteRegValue HKLM "Software\RegisteredApplications" "Sylpheed"
380
  DeleteRegKey HKCU "Software\Classes\Sylpheed.EML"
381
  DeleteRegKey HKCU "Software\Classes\Sylpheed.Url.MailTo"
382
  DeleteRegKey ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}"
383

    
384
  SetAutoClose true
385
SectionEnd
386

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

    
415
Function .onInit
416
  ${MementoSectionRestore}
417

    
418
  StrCpy $1 ${sec_sylpheed}
419

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

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

    
455
Function .onInstSuccess
456
  ${MementoSectionSave}
457
FunctionEnd
458

    
459
Function .onSelChange
460
  !insertmacro StartRadioButtons $1
461
    !insertmacro RadioButton ${sec_sylpheed}
462
  !insertmacro EndRadioButtons
463
FunctionEnd
464

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

    
473
  ${nsProcess::KillProcess} "sylpheed.exe" $R0
474
  ${nsProcess::KillProcess} "dts-indexer.exe" $R0
475
  ${nsProcess::KillProcess} "postgres.exe" $R0
476

    
477
  SetShellVarContext current
478

    
479
  IfFileExists "$INSTDIR\sylpheed.exe" sylpheed_file_exists
480
  !insertmacro UnselectSection ${sec_un_sylpheed}
481
  sylpheed_file_exists:
482
  !insertmacro SetSectionFlag ${sec_un_sylpheed} ${SF_RO}
483

    
484
!ifdef SYLPHEED_PRO
485
  IfFileExists "$INSTDIR\plugins\dbimport.dll" sylpheed_pro_file_exists
486
  !insertmacro UnselectSection ${sec_un_sylpheed_pro}
487
  !insertmacro SetSectionFlag ${sec_un_sylpheed_pro} ${SF_RO}
488
  sylpheed_pro_file_exists:
489
!endif
490

    
491
  IfFileExists "$INSTDIR\plugins\attachment_tool.dll" attachment_tool_plugin_file_exists
492
  !insertmacro UnselectSection ${sec_un_attachment_tool_plugin}
493
  !insertmacro SetSectionFlag ${sec_un_attachment_tool_plugin} ${SF_RO}
494
  attachment_tool_plugin_file_exists:
495

    
496
  IfFileExists "$INSTDIR\sylfilter.exe" sylfilter_file_exists
497
  !insertmacro UnselectSection ${sec_un_sylfilter}
498
  !insertmacro SetSectionFlag ${sec_un_sylfilter} ${SF_RO}
499
  sylfilter_file_exists:
500

    
501
  IfFileExists "$INSTDIR\bsfilter" bsfilter_file_exists
502
  !insertmacro UnselectSection ${sec_un_bsfilter}
503
  !insertmacro SetSectionFlag ${sec_un_bsfilter} ${SF_RO}
504
  bsfilter_file_exists:
505

    
506
  SetShellVarContext current
507
  IfFileExists "$DESKTOP\Sylpheed.lnk" desktop_shortcut_file_exists
508
  !insertmacro UnselectSection ${sec_un_desktop_shortcut}
509
  !insertmacro SetSectionFlag ${sec_un_desktop_shortcut} ${SF_RO}
510
  desktop_shortcut_file_exists:
511

    
512
  SetShellVarContext current
513
  IfFileExists "$QUICKLAUNCH\Sylpheed.lnk" quick_shortcut_file_exists
514
  !insertmacro UnselectSection ${sec_un_quick_shortcut}
515
  !insertmacro SetSectionFlag ${sec_un_quick_shortcut} ${SF_RO}
516
  quick_shortcut_file_exists:
517
FunctionEnd
518

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