comparison pidgin/win32/nsis/pidgin-installer.nsi @ 29933:daa02d44df13

Finish up win32 gtkspell 2.0.16 / enchant support (mostly in the installer)
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 05 Mar 2010 03:53:52 +0000
parents c65c406d0d8d
children 0d42077e36cf
comparison
equal deleted inserted replaced
29932:406c2e1ef7ce 29933:daa02d44df13
52 52
53 ;-------------------------------- 53 ;--------------------------------
54 ;Defines 54 ;Defines
55 55
56 !define PIDGIN_NSIS_INCLUDE_PATH "." 56 !define PIDGIN_NSIS_INCLUDE_PATH "."
57 !define PIDGIN_INSTALLER_DEPS "..\..\..\..\win32-dev\pidgin-inst-deps-20100223"
58 57
59 ; Remove these and the stuff that uses them at some point 58 ; Remove these and the stuff that uses them at some point
60 !define OLD_GAIM_REG_KEY "SOFTWARE\gaim" 59 !define OLD_GAIM_REG_KEY "SOFTWARE\gaim"
61 !define OLD_GAIM_UNINSTALL_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Gaim" 60 !define OLD_GAIM_UNINSTALL_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Gaim"
62 !define OLD_GAIM_UNINST_EXE "gaim-uninst.exe" 61 !define OLD_GAIM_UNINST_EXE "gaim-uninst.exe"
70 69
71 !define GTK_MIN_VERSION "2.14.0" 70 !define GTK_MIN_VERSION "2.14.0"
72 !define PERL_REG_KEY "SOFTWARE\Perl" 71 !define PERL_REG_KEY "SOFTWARE\Perl"
73 !define PERL_DLL "perl510.dll" 72 !define PERL_DLL "perl510.dll"
74 73
75 !define ASPELL_REG_KEY "SOFTWARE\Aspell"
76 !define DOWNLOADER_URL "http://pidgin.im/win32/download_redir.php" 74 !define DOWNLOADER_URL "http://pidgin.im/win32/download_redir.php"
75 !define SPELL_DOWNLOAD_URL "http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries"
77 76
78 !define MEMENTO_REGISTRY_ROOT HKLM 77 !define MEMENTO_REGISTRY_ROOT HKLM
79 !define MEMENTO_REGISTRY_KEY "${PIDGIN_UNINSTALL_KEY}" 78 !define MEMENTO_REGISTRY_KEY "${PIDGIN_UNINSTALL_KEY}"
80 79
81 ;-------------------------------- 80 ;--------------------------------
301 CopyFiles /SILENT $R3 "$TEMP\$R6" 300 CopyFiles /SILENT $R3 "$TEMP\$R6"
302 SetOverwrite off 301 SetOverwrite off
303 IfErrors uninstall_problem 302 IfErrors uninstall_problem
304 ; Ready to uninstall.. 303 ; Ready to uninstall..
305 ClearErrors 304 ClearErrors
306 ExecWait '"$TEMP\$R6" /S /KEEPGTK=1 _?=$R1' 305 ExecWait '"$TEMP\$R6" /S /UPGRADE=1 _?=$R1'
307 IfErrors exec_error 306 IfErrors exec_error
308 Delete "$TEMP\$R6" 307 Delete "$TEMP\$R6"
309 Goto done 308 Goto done
310 309
311 exec_error: 310 exec_error:
416 ;Delete old liboscar and libjabber since they tend to be problematic 415 ;Delete old liboscar and libjabber since they tend to be problematic
417 Delete "$INSTDIR\plugins\liboscar.dll" 416 Delete "$INSTDIR\plugins\liboscar.dll"
418 Delete "$INSTDIR\plugins\libjabber.dll" 417 Delete "$INSTDIR\plugins\libjabber.dll"
419 418
420 File /r /x locale ..\..\..\${PIDGIN_INSTALL_DIR}\*.* 419 File /r /x locale ..\..\..\${PIDGIN_INSTALL_DIR}\*.*
421 File "${PIDGIN_INSTALLER_DEPS}\exchndl.dll"
422 420
423 ; Check if Perl is installed, if so add it to the AppPaths 421 ; Check if Perl is installed, if so add it to the AppPaths
424 ReadRegStr $R2 HKLM ${PERL_REG_KEY} "" 422 ReadRegStr $R2 HKLM ${PERL_REG_KEY} ""
425 StrCmp $R2 "" 0 perl_exists 423 StrCmp $R2 "" 0 perl_exists
426 ReadRegStr $R2 HKCU ${PERL_REG_KEY} "" 424 ReadRegStr $R2 HKCU ${PERL_REG_KEY} ""
506 ;Translations 504 ;Translations
507 505
508 !macro LANG_SECTION lang 506 !macro LANG_SECTION lang
509 ${MementoUnselectedSection} "${lang}" SecLang_${lang} 507 ${MementoUnselectedSection} "${lang}" SecLang_${lang}
510 SetOutPath "$INSTDIR\locale\${lang}\LC_MESSAGES" 508 SetOutPath "$INSTDIR\locale\${lang}\LC_MESSAGES"
511 File /oname=pidgin.mo "..\..\..\${PIDGIN_INSTALL_DIR}\locale\${lang}\LC_MESSAGES\pidgin.mo" 509 File "..\..\..\${PIDGIN_INSTALL_DIR}\locale\${lang}\LC_MESSAGES\*.mo"
512 SetOutPath "$INSTDIR" 510 SetOutPath "$INSTDIR"
513 ${MementoSectionEnd} 511 ${MementoSectionEnd}
514 !macroend 512 !macroend
515 SectionGroup $(TRANSLATIONS_SECTION_TITLE) SecTranslations 513 SectionGroup $(TRANSLATIONS_SECTION_TITLE) SecTranslations
516 # pidgin-translations is generated based on the contents of the locale directory 514 # pidgin-translations is generated based on the contents of the locale directory
519 ${MementoSectionDone} 517 ${MementoSectionDone}
520 518
521 ;-------------------------------- 519 ;--------------------------------
522 ;Spell Checking 520 ;Spell Checking
523 521
524 SectionGroup /e $(PIDGIN_SPELLCHECK_SECTION_TITLE) SecSpellCheck 522 !macro SPELLCHECK_SECTION lang lang_name lang_file
525 Section /o $(PIDGIN_SPELLCHECK_BRETON) SecSpellCheckBreton 523 Section /o "${lang_name}" SecSpell_${lang}
526 Push ${SecSpellCheckBreton} 524 Push ${lang_file}
527 Call InstallAspellAndDict 525 Push ${lang}
526 Call InstallDict
528 SectionEnd 527 SectionEnd
529 Section /o $(PIDGIN_SPELLCHECK_CATALAN) SecSpellCheckCatalan 528 !macroend
530 Push ${SecSpellCheckCatalan} 529 SectionGroup $(PIDGIN_SPELLCHECK_SECTION_TITLE) SecSpellCheck
531 Call InstallAspellAndDict 530 !include "pidgin-spellcheck.nsh"
532 SectionEnd
533 Section /o $(PIDGIN_SPELLCHECK_CZECH) SecSpellCheckCzech
534 Push ${SecSpellCheckCzech}
535 Call InstallAspellAndDict
536 SectionEnd
537 Section /o $(PIDGIN_SPELLCHECK_WELSH) SecSpellCheckWelsh
538 Push ${SecSpellCheckWelsh}
539 Call InstallAspellAndDict
540 SectionEnd
541 Section /o $(PIDGIN_SPELLCHECK_DANISH) SecSpellCheckDanish
542 Push ${SecSpellCheckDanish}
543 Call InstallAspellAndDict
544 SectionEnd
545 Section /o $(PIDGIN_SPELLCHECK_GERMAN) SecSpellCheckGerman
546 Push ${SecSpellCheckGerman}
547 Call InstallAspellAndDict
548 SectionEnd
549 Section /o $(PIDGIN_SPELLCHECK_GREEK) SecSpellCheckGreek
550 Push ${SecSpellCheckGreek}
551 Call InstallAspellAndDict
552 SectionEnd
553 Section /o $(PIDGIN_SPELLCHECK_ENGLISH) SecSpellCheckEnglish
554 Push ${SecSpellCheckEnglish}
555 Call InstallAspellAndDict
556 SectionEnd
557 Section /o $(PIDGIN_SPELLCHECK_ESPERANTO) SecSpellCheckEsperanto
558 Push ${SecSpellCheckEsperanto}
559 Call InstallAspellAndDict
560 SectionEnd
561 Section /o $(PIDGIN_SPELLCHECK_SPANISH) SecSpellCheckSpanish
562 Push ${SecSpellCheckSpanish}
563 Call InstallAspellAndDict
564 SectionEnd
565 Section /o $(PIDGIN_SPELLCHECK_FAROESE) SecSpellCheckFaroese
566 Push ${SecSpellCheckFaroese}
567 Call InstallAspellAndDict
568 SectionEnd
569 Section /o $(PIDGIN_SPELLCHECK_FRENCH) SecSpellCheckFrench
570 Push ${SecSpellCheckFrench}
571 Call InstallAspellAndDict
572 SectionEnd
573 Section /o $(PIDGIN_SPELLCHECK_ITALIAN) SecSpellCheckItalian
574 Push ${SecSpellCheckItalian}
575 Call InstallAspellAndDict
576 SectionEnd
577 Section /o $(PIDGIN_SPELLCHECK_DUTCH) SecSpellCheckDutch
578 Push ${SecSpellCheckDutch}
579 Call InstallAspellAndDict
580 SectionEnd
581 Section /o $(PIDGIN_SPELLCHECK_NORWEGIAN) SecSpellCheckNorwegian
582 Push ${SecSpellCheckNorwegian}
583 Call InstallAspellAndDict
584 SectionEnd
585 Section /o $(PIDGIN_SPELLCHECK_POLISH) SecSpellCheckPolish
586 Push ${SecSpellCheckPolish}
587 Call InstallAspellAndDict
588 SectionEnd
589 Section /o $(PIDGIN_SPELLCHECK_PORTUGUESE) SecSpellCheckPortuguese
590 Push ${SecSpellCheckPortuguese}
591 Call InstallAspellAndDict
592 SectionEnd
593 Section /o $(PIDGIN_SPELLCHECK_ROMANIAN) SecSpellCheckRomanian
594 Push ${SecSpellCheckRomanian}
595 Call InstallAspellAndDict
596 SectionEnd
597 Section /o $(PIDGIN_SPELLCHECK_RUSSIAN) SecSpellCheckRussian
598 Push ${SecSpellCheckRussian}
599 Call InstallAspellAndDict
600 SectionEnd
601 Section /o $(PIDGIN_SPELLCHECK_SLOVAK) SecSpellCheckSlovak
602 Push ${SecSpellCheckSlovak}
603 Call InstallAspellAndDict
604 SectionEnd
605 Section /o $(PIDGIN_SPELLCHECK_SWEDISH) SecSpellCheckSwedish
606 Push ${SecSpellCheckSwedish}
607 Call InstallAspellAndDict
608 SectionEnd
609 Section /o $(PIDGIN_SPELLCHECK_UKRAINIAN) SecSpellCheckUkrainian
610 Push ${SecSpellCheckUkrainian}
611 Call InstallAspellAndDict
612 SectionEnd
613 SectionGroupEnd 531 SectionGroupEnd
614 532
615 Section /o $(DEBUG_SYMBOLS_SECTION_TITLE) SecDebugSymbols 533 Section /o $(DEBUG_SYMBOLS_SECTION_TITLE) SecDebugSymbols
616 534
617 InitPluginsDir 535 InitPluginsDir
771 Delete "$INSTDIR\sounds\purple\logout.wav" 689 Delete "$INSTDIR\sounds\purple\logout.wav"
772 Delete "$INSTDIR\sounds\purple\receive.wav" 690 Delete "$INSTDIR\sounds\purple\receive.wav"
773 Delete "$INSTDIR\sounds\purple\send.wav" 691 Delete "$INSTDIR\sounds\purple\send.wav"
774 RMDir "$INSTDIR\sounds\purple" 692 RMDir "$INSTDIR\sounds\purple"
775 RMDir "$INSTDIR\sounds" 693 RMDir "$INSTDIR\sounds"
694 Delete "$INSTDIR\spellcheck\libenchant.dll"
695 Delete "$INSTDIR\spellcheck\libgtkspell-0.dll"
696 Delete "$INSTDIR\spellcheck\lib\enchant\libenchant_aspell.dll"
697 Delete "$INSTDIR\spellcheck\lib\enchant\libenchant_ispell.dll"
698 Delete "$INSTDIR\spellcheck\lib\enchant\libenchant_myspell.dll"
699 RMDir "$INSTDIR\spellcheck\lib\enchant"
700 RMDir "$INSTDIR\spellcheck\lib"
701 RMDir "$INSTDIR\spellcheck"
776 Delete "$INSTDIR\freebl3.dll" 702 Delete "$INSTDIR\freebl3.dll"
777 Delete "$INSTDIR\idletrack.dll" 703 Delete "$INSTDIR\idletrack.dll"
778 Delete "$INSTDIR\libgtkspell.dll"
779 Delete "$INSTDIR\libjabber.dll" 704 Delete "$INSTDIR\libjabber.dll"
780 Delete "$INSTDIR\libnspr4.dll" 705 Delete "$INSTDIR\libnspr4.dll"
781 Delete "$INSTDIR\libmeanwhile-1.dll" 706 Delete "$INSTDIR\libmeanwhile-1.dll"
782 Delete "$INSTDIR\liboscar.dll" 707 Delete "$INSTDIR\liboscar.dll"
783 Delete "$INSTDIR\libplc4.dll" 708 Delete "$INSTDIR\libplc4.dll"
805 RMDir /r "$INSTDIR\pidgin-${PIDGIN_VERSION}-dbgsym" 730 RMDir /r "$INSTDIR\pidgin-${PIDGIN_VERSION}-dbgsym"
806 731
807 ; Remove the local GTK+ copy (if we're not just upgrading) 732 ; Remove the local GTK+ copy (if we're not just upgrading)
808 ${GetParameters} $R0 733 ${GetParameters} $R0
809 ClearErrors 734 ClearErrors
810 ${GetOptions} "$R0" "/KEEPGTK=" $R1 735 ${GetOptions} "$R0" "/UPGRADE=" $R1
811 IfErrors +2 736 IfErrors +2
812 StrCmp $R1 "1" +2 737 StrCmp $R1 "1" upgrade_done
813 RMDir /r "$INSTDIR\Gtk" 738 RMDir /r "$INSTDIR\Gtk"
739 ; Remove the downloaded spellcheck dictionaries (if we're not just upgrading)
740 RMDir /r "$INSTDIR\spellcheck"
741 upgrade_done:
814 742
815 ;Try to remove Pidgin install dir (only if empty) 743 ;Try to remove Pidgin install dir (only if empty)
816 RMDir "$INSTDIR" 744 RMDir "$INSTDIR"
817 745
818 ; Shortcuts.. 746 ; Shortcuts..
847 !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenuShortcut} \ 775 !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenuShortcut} \
848 $(PIDGIN_STARTMENU_SHORTCUT_DESC) 776 $(PIDGIN_STARTMENU_SHORTCUT_DESC)
849 777
850 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheck} \ 778 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheck} \
851 $(PIDGIN_SPELLCHECK_SECTION_DESCRIPTION) 779 $(PIDGIN_SPELLCHECK_SECTION_DESCRIPTION)
852 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckBreton} \ 780
853 "$(PIDGIN_SPELLCHECK_BRETON) (862kb)"
854 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckCatalan} \
855 "$(PIDGIN_SPELLCHECK_CATALAN) (3.9Mb)"
856 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckCzech} \
857 "$(PIDGIN_SPELLCHECK_CZECH) (17Mb)"
858 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckWelsh} \
859 "$(PIDGIN_SPELLCHECK_WELSH) (4.2Mb)"
860 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckDanish} \
861 "$(PIDGIN_SPELLCHECK_DANISH) (6.9Mb)"
862 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckGerman} \
863 "$(PIDGIN_SPELLCHECK_GERMAN) (5.4Mb)"
864 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckGreek} \
865 "$(PIDGIN_SPELLCHECK_GREEK) (7.1Mb)"
866 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckEnglish} \
867 "$(PIDGIN_SPELLCHECK_ENGLISH) (2.3Mb)"
868 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckEsperanto} \
869 "$(PIDGIN_SPELLCHECK_ESPERANTO) (5.7Mb)"
870 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckSpanish} \
871 "$(PIDGIN_SPELLCHECK_SPANISH) (7.0Mb)"
872 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckFaroese} \
873 "$(PIDGIN_SPELLCHECK_FAROESE) (913kb)"
874 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckFrench} \
875 "$(PIDGIN_SPELLCHECK_FRENCH) (9.3Mb)"
876 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckItalian} \
877 "$(PIDGIN_SPELLCHECK_ITALIAN) (770kb)"
878 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckDutch} \
879 "$(PIDGIN_SPELLCHECK_DUTCH) (3.7Mb)"
880 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckNorwegian} \
881 "$(PIDGIN_SPELLCHECK_NORWEGIAN) (3.2Mb)"
882 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckPolish} \
883 "$(PIDGIN_SPELLCHECK_POLISH) (9.3Mb)"
884 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckPortuguese} \
885 "$(PIDGIN_SPELLCHECK_PORTUGUESE) (5.5Mb)"
886 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckRomanian} \
887 "$(PIDGIN_SPELLCHECK_ROMANIAN) (906kb)"
888 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckRussian} \
889 "$(PIDGIN_SPELLCHECK_RUSSIAN) (11Mb)"
890 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckSlovak} \
891 "$(PIDGIN_SPELLCHECK_SLOVAK) (8.0Mb)"
892 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckSwedish} \
893 "$(PIDGIN_SPELLCHECK_SWEDISH) (2.2Mb)"
894 !insertmacro MUI_DESCRIPTION_TEXT ${SecSpellCheckUkrainian} \
895 "$(PIDGIN_SPELLCHECK_UKRAINIAN) (12Mb)"
896 !insertmacro MUI_FUNCTION_DESCRIPTION_END 781 !insertmacro MUI_FUNCTION_DESCRIPTION_END
897 782
898 ;-------------------------------- 783 ;--------------------------------
899 ;Functions 784 ;Functions
900 785
1236 IfErrors +3 1121 IfErrors +3
1237 DeleteRegValue HKCU "${OLD_GAIM_REG_KEY}" "Installer Language" 1122 DeleteRegValue HKCU "${OLD_GAIM_REG_KEY}" "Installer Language"
1238 WriteRegStr HKCU "${PIDGIN_REG_KEY}" "Installer Language" "$R0" 1123 WriteRegStr HKCU "${PIDGIN_REG_KEY}" "Installer Language" "$R0"
1239 1124
1240 ${MementoSectionRestore} 1125 ${MementoSectionRestore}
1241
1242 !insertmacro SetSectionFlag ${SecSpellCheck} ${SF_RO}
1243 !insertmacro UnselectSection ${SecSpellCheck}
1244
1245 ;Mark the dictionaries that are already installed as readonly
1246 Call SelectAndDisableInstalledDictionaries
1247 1126
1248 ;Preselect the URI handlers as appropriate 1127 ;Preselect the URI handlers as appropriate
1249 Call SelectURIHandlerSelections 1128 Call SelectURIHandlerSelections
1250 1129
1251 ;Preselect the "shortcuts" checkboxes according to the previous installation 1130 ;Preselect the "shortcuts" checkboxes according to the previous installation
1341 ${GetParent} $SMPROGRAMS $R2 1220 ${GetParent} $SMPROGRAMS $R2
1342 ${GetParent} $R2 $R2 1221 ${GetParent} $R2 $R2
1343 StrCpy $INSTDIR "$R2\Pidgin" 1222 StrCpy $INSTDIR "$R2\Pidgin"
1344 1223
1345 instdir_done: 1224 instdir_done:
1225
1226 ;Mark the dictionaries that are already installed as readonly
1227 Call SelectAndDisableInstalledDictionaries
1228
1346 ;LogSet on 1229 ;LogSet on
1347 Pop $R3 1230 Pop $R3
1348 Pop $R2 1231 Pop $R2
1349 Pop $R1 1232 Pop $R1
1350 Pop $R0 1233 Pop $R0
1397 ;------------------------------- 1280 ;-------------------------------
1398 1281
1399 ; Convert the a Section index to the language code 1282 ; Convert the a Section index to the language code
1400 ; Push the section index onto the stack and pop off the language code after the call 1283 ; Push the section index onto the stack and pop off the language code after the call
1401 ; This will set the error code, if no match is found 1284 ; This will set the error code, if no match is found
1402 Function GetLangCodeForSection
1403 ClearErrors
1404 Push $R0
1405 Exch
1406 Pop $R0 ;This is the section index
1407
1408 IntCmp $R0 ${SecSpellCheckBreton} 0 +3 +3
1409 StrCpy $R0 "br"
1410 Goto done
1411 IntCmp $R0 ${SecSpellCheckCatalan} 0 +3 +3
1412 StrCpy $R0 "ca"
1413 Goto done
1414 IntCmp $R0 ${SecSpellCheckCzech} 0 +3 +3
1415 StrCpy $R0 "cs"
1416 Goto done
1417 IntCmp $R0 ${SecSpellCheckWelsh} 0 +3 +3
1418 StrCpy $R0 "cy"
1419 Goto done
1420 IntCmp $R0 ${SecSpellCheckDanish} 0 +3 +3
1421 StrCpy $R0 "da"
1422 Goto done
1423 IntCmp $R0 ${SecSpellCheckGerman} 0 +3 +3
1424 StrCpy $R0 "de"
1425 Goto done
1426 IntCmp $R0 ${SecSpellCheckGreek} 0 +3 +3
1427 StrCpy $R0 "el"
1428 Goto done
1429 IntCmp $R0 ${SecSpellCheckEnglish} 0 +3 +3
1430 StrCpy $R0 "en"
1431 Goto done
1432 IntCmp $R0 ${SecSpellCheckEsperanto} 0 +3 +3
1433 StrCpy $R0 "eo"
1434 Goto done
1435 IntCmp $R0 ${SecSpellCheckSpanish} 0 +3 +3
1436 StrCpy $R0 "es"
1437 Goto done
1438 IntCmp $R0 ${SecSpellCheckFaroese} 0 +3 +3
1439 StrCpy $R0 "fo"
1440 Goto done
1441 IntCmp $R0 ${SecSpellCheckFrench} 0 +3 +3
1442 StrCpy $R0 "fr"
1443 Goto done
1444 IntCmp $R0 ${SecSpellCheckItalian} 0 +3 +3
1445 StrCpy $R0 "it"
1446 Goto done
1447 IntCmp $R0 ${SecSpellCheckDutch} 0 +3 +3
1448 StrCpy $R0 "nl"
1449 Goto done
1450 IntCmp $R0 ${SecSpellCheckNorwegian} 0 +3 +3
1451 StrCpy $R0 "no"
1452 Goto done
1453 IntCmp $R0 ${SecSpellCheckPolish} 0 +3 +3
1454 StrCpy $R0 "pl"
1455 Goto done
1456 IntCmp $R0 ${SecSpellCheckPortuguese} 0 +3 +3
1457 StrCpy $R0 "pt"
1458 Goto done
1459 IntCmp $R0 ${SecSpellCheckRomanian} 0 +3 +3
1460 StrCpy $R0 "ro"
1461 Goto done
1462 IntCmp $R0 ${SecSpellCheckRussian} 0 +3 +3
1463 StrCpy $R0 "ru"
1464 Goto done
1465 IntCmp $R0 ${SecSpellCheckSlovak} 0 +3 +3
1466 StrCpy $R0 "sk"
1467 Goto done
1468 IntCmp $R0 ${SecSpellCheckSwedish} 0 +3 +3
1469 StrCpy $R0 "sv"
1470 Goto done
1471 IntCmp $R0 ${SecSpellCheckUkrainian} 0 +3 +3
1472 StrCpy $R0 "uk"
1473 Goto done
1474
1475 SetErrors
1476
1477 done:
1478 Exch $R0
1479 FunctionEnd ;GetLangCodeForSection
1480 1285
1481 ; Select and Disable any Sections that have currently installed dictionaries 1286 ; Select and Disable any Sections that have currently installed dictionaries
1287 !macro CHECK_SPELLCHECK_SECTION lang
1288 ;Advance to the next (correct) section index
1289 IntOp $R0 $R0 + 1
1290 IfFileExists "$INSTDIR\spellcheck\share\enchant\myspell\${lang}.dic" 0 done_${lang}
1291 SectionGetFlags $R0 $R1
1292 IntOp $R1 $R1 | ${SF_RO} ; Mark Readonly
1293 IntOp $R1 $R1 | ${SF_SELECTED} ; Select
1294 SectionSetFlags $R0 $R1
1295 done_${lang}:
1296 !macroend
1482 Function SelectAndDisableInstalledDictionaries 1297 Function SelectAndDisableInstalledDictionaries
1483 Push $R0 1298 Push $R0
1484 Push $R1 1299 Push $R1
1485 Push $R2 1300
1486 1301 !insertmacro SetSectionFlag ${SecSpellCheck} ${SF_RO}
1487 ; Start with the first language dictionary 1302 !insertmacro UnselectSection ${SecSpellCheck}
1488 IntOp $R0 ${SecSpellCheck} + 1 1303
1489 1304 IntOp $R0 ${SecSpellCheck} + 0
1490 start: 1305 !include "pidgin-spellcheck-preselect.nsh"
1491 ; If it is the end of the section group, stop 1306
1492 SectionGetFlags $R0 $R1
1493 IntOp $R2 $R1 & ${SF_SECGRPEND}
1494 IntCmp $R2 ${SF_SECGRPEND} done
1495
1496 Push $R0
1497 Call GetLangCodeForSection
1498 Pop $R2
1499 IfErrors end_loop
1500 ReadRegStr $R2 HKLM "${ASPELL_REG_KEY}-$R2" "" ; Check that the dictionary is installed
1501 StrCmp $R2 "" end_loop ; If it isn't installed, skip to the next item
1502 IntOp $R1 $R1 | ${SF_RO} ; Mark Readonly
1503 IntOp $R1 $R1 | ${SF_SELECTED} ; Select
1504 SectionSetFlags $R0 $R1
1505
1506 end_loop:
1507 IntOp $R0 $R0 + 1 ;Advance to the next section
1508 Goto start
1509
1510 done:
1511 Pop $R2
1512 Pop $R1 1307 Pop $R1
1513 Pop $R0 1308 Pop $R0
1514 FunctionEnd 1309 FunctionEnd
1515 1310
1516 Function InstallAspellAndDict 1311 Function InstallDict
1517 Push $R0
1518 Exch
1519 Call GetLangCodeForSection
1520 Pop $R0 ;This is the language code
1521 Push $R1
1522
1523 InitPluginsDir
1524
1525 IfErrors done ; We weren't able to convert the section to lang code
1526
1527 retry:
1528 Call InstallAspell
1529 Pop $R1
1530 StrCmp $R1 "" +3
1531 StrCmp $R1 "cancel" done
1532 MessageBox MB_RETRYCANCEL "$(PIDGIN_SPELLCHECK_ERROR) : $R1" /SD IDCANCEL IDRETRY retry IDCANCEL done
1533
1534 retry_dict:
1535 Push $R0
1536 Call InstallAspellDictionary
1537 Pop $R1
1538 StrCmp $R1 "" +3
1539 StrCmp $R1 "cancel" done
1540 MessageBox MB_RETRYCANCEL "$(PIDGIN_SPELLCHECK_DICT_ERROR) : $R1" /SD IDCANCEL IDRETRY retry_dict
1541
1542 done:
1543
1544 Pop $R1
1545 Pop $R0
1546 FunctionEnd
1547
1548 Function InstallAspell
1549 Push $R0
1550 Push $R1
1551 Push $R2
1552
1553 check:
1554 ClearErrors
1555 ReadRegDWORD $R0 HKLM ${ASPELL_REG_KEY} "AspellVersion"
1556 IntCmp $R0 15 installed
1557
1558 ; If this is the check after installation, don't infinite loop on failure
1559 StrCmp $R1 "$PLUGINSDIR\aspell_installer.exe" 0 +3
1560 StrCpy $R0 $(ASPELL_INSTALL_FAILED)
1561 Goto done
1562
1563 ; We need to download and install aspell
1564 StrCpy $R1 "$PLUGINSDIR\aspell_installer.exe"
1565 StrCpy $R2 "${DOWNLOADER_URL}?version=${PIDGIN_VERSION}&dl_pkg=aspell_core"
1566 DetailPrint "Downloading Aspell... ($R2)"
1567 NSISdl::download /TIMEOUT=10000 $R2 $R1
1568 Pop $R0
1569 StrCmp $R0 "success" +2
1570 Goto done
1571 ExecWait '"$R1"'
1572 Delete $R1
1573 Goto check ; Check that it is now installed correctly
1574
1575 installed: ;Aspell is currently installed, no error message
1576 DetailPrint "Aspell is installed"
1577 StrCpy $R0 ''
1578
1579 done:
1580 Pop $R2
1581 Pop $R1
1582 Exch $R0
1583 FunctionEnd
1584
1585 Function InstallAspellDictionary
1586 Push $R0 1312 Push $R0
1587 Exch 1313 Exch
1588 Pop $R0 ;This is the language code 1314 Pop $R0 ;This is the language code
1589 Push $R1 1315 Push $R1
1316 Exch 2
1317 Pop $R1 ;This is the language file
1590 Push $R2 1318 Push $R2
1591 Push $R3 1319 Push $R3
1592 Push $R4 1320
1593 1321 ClearErrors
1594 check: 1322 IfFileExists "$INSTDIR\spellcheck\share\enchant\myspell\$R0.dic" installed
1595 ClearErrors 1323
1596 ReadRegStr $R2 HKLM "${ASPELL_REG_KEY}-$R0" "" 1324 InitPluginsDir
1597 StrCmp $R2 "" 0 installed 1325
1598 1326 ; We need to download and install dictionary
1599 ; If this is the check after installation, don't infinite loop on failure 1327 StrCpy $R2 "$PLUGINSDIR\$R1"
1600 StrCmp $R1 "$PLUGINSDIR\aspell_dict-$R0.exe" 0 +3 1328 StrCpy $R3 "${SPELL_DOWNLOAD_URL}/$R1"
1601 StrCpy $R0 $(ASPELL_INSTALL_FAILED) 1329 DetailPrint "Downloading the $R0 Dictionary... ($R3)"
1330 retry:
1331 NSISdl::download /TIMEOUT=10000 "$R3" "$R2"
1332 Pop $R3
1333 StrCmp $R3 "cancel" done
1334 StrCmp $R3 "success" +3
1335 MessageBox MB_RETRYCANCEL "$(PIDGIN_SPELLCHECK_ERROR) : $R3" /SD IDCANCEL IDRETRY retry IDCANCEL done
1602 Goto done 1336 Goto done
1603 1337 SetOutPath "$INSTDIR\spellcheck\share\enchant\myspell"
1604 ; We need to download and install aspell 1338 nsisunz::UnzipToLog "$R2" "$OUTDIR"
1605 StrCpy $R1 "$PLUGINSDIR\aspell_dict-$R0.exe" 1339 SetOutPath "$INSTDIR"
1606 StrCpy $R3 "${DOWNLOADER_URL}?version=${PIDGIN_VERSION}&dl_pkg=lang_$R0"
1607 DetailPrint "Downloading the Aspell $R0 Dictionary... ($R3)"
1608 NSISdl::download /TIMEOUT=10000 $R3 $R1
1609 Pop $R3 1340 Pop $R3
1610 StrCmp $R3 "success" +3 1341 StrCmp $R3 "success" installed
1611 StrCpy $R0 $R3 1342 DetailPrint "$R3" ;print error message to log
1612 Goto done 1343 Goto done
1613 ; Use a specific temporary $OUTDIR for each dictionary because the installer doesn't clean up after itself
1614 StrCpy $R4 "$OUTDIR"
1615 SetOutPath "$PLUGINSDIR\aspell_dict-$R0"
1616 ExecWait '"$R1"'
1617 SetOutPath "$R4"
1618 RMDir /r "$PLUGINSDIR\aspell_dict-$R0"
1619 Delete $R1
1620 Goto check ; Check that it is now installed correctly
1621 1344
1622 installed: ;The dictionary is currently installed, no error message 1345 installed: ;The dictionary is currently installed, no error message
1623 DetailPrint "Aspell $R0 Dictionary is installed" 1346 DetailPrint "$R0 Dictionary is installed"
1624 StrCpy $R0 ''
1625 1347
1626 done: 1348 done:
1627 Pop $R4
1628 Pop $R3 1349 Pop $R3
1629 Pop $R2 1350 Pop $R2
1630 Pop $R1 1351 Pop $R0
1631 Exch $R0 1352 Exch $R1
1632 FunctionEnd 1353 FunctionEnd