v0.4.1 — Uninstaller: Datenbank-Löschung mit Nachfrage

- Deinstallation fragt ob Daten gelöscht werden sollen
- Ja → speiseplan.db wird entfernt
- Nein → Daten bleiben für Neuinstallation erhalten
This commit is contained in:
clawd
2026-02-20 10:50:48 +00:00
parent 08e6197187
commit 7b202c92c7
3 changed files with 83 additions and 0 deletions

BIN
build/appicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

BIN
build/windows/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -0,0 +1,83 @@
!include "MUI2.nsh"
; Allgemein
Name "Speiseplan"
OutFile "Speiseplan-Setup.exe"
InstallDir "$PROGRAMFILES\Speiseplan"
InstallDirRegKey HKLM "Software\Speiseplan" "Install_Dir"
RequestExecutionLevel admin
; UI
!define MUI_ICON "icon.ico"
!define MUI_UNICON "icon.ico"
!define MUI_ABORTWARNING
!define MUI_WELCOMEPAGE_TITLE "Speiseplan Setup"
!define MUI_WELCOMEPAGE_TEXT "Dieses Programm installiert den Kita-Wochenspeiseplan auf Ihrem Computer.$\r$\n$\r$\nKlicken Sie auf Weiter, um fortzufahren."
; Seiten
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
; Deinstallation
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
; Sprache
!insertmacro MUI_LANGUAGE "German"
; Hauptinstallation
Section "Speiseplan (erforderlich)" SecMain
SectionIn RO
SetOutPath $INSTDIR
File "..\..\build\bin\speiseplan.exe"
File "icon.ico"
; Registry
WriteRegStr HKLM "Software\Speiseplan" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Speiseplan" "DisplayName" "Speiseplan"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Speiseplan" "DisplayIcon" "$INSTDIR\icon.ico"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Speiseplan" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Speiseplan" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Speiseplan" "NoRepair" 1
WriteUninstaller "$INSTDIR\uninstall.exe"
; Startmenü
CreateDirectory "$SMPROGRAMS\Speiseplan"
CreateShortCut "$SMPROGRAMS\Speiseplan\Speiseplan.lnk" "$INSTDIR\speiseplan.exe" "" "$INSTDIR\icon.ico"
CreateShortCut "$SMPROGRAMS\Speiseplan\Deinstallieren.lnk" "$INSTDIR\uninstall.exe"
SectionEnd
; Desktop-Verknüpfung (optional)
Section "Desktop-Verknüpfung" SecDesktop
CreateShortCut "$DESKTOP\Speiseplan.lnk" "$INSTDIR\speiseplan.exe" "" "$INSTDIR\icon.ico"
SectionEnd
; Komponentenbeschreibungen
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecMain} "Das Speiseplan-Programm (erforderlich)."
!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "Erstellt eine Verknüpfung auf dem Desktop."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
; Deinstallation
Section "Uninstall"
Delete "$INSTDIR\speiseplan.exe"
Delete "$INSTDIR\icon.ico"
Delete "$INSTDIR\uninstall.exe"
RMDir "$INSTDIR"
Delete "$SMPROGRAMS\Speiseplan\*.*"
RMDir "$SMPROGRAMS\Speiseplan"
Delete "$DESKTOP\Speiseplan.lnk"
; Datenbank löschen
MessageBox MB_YESNO "Sollen die gespeicherten Daten (Speisepläne, Produkte) ebenfalls gelöscht werden?" IDYES deletedata IDNO skipdata
deletedata:
Delete "$PROFILE\speiseplan.db"
skipdata:
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Speiseplan"
DeleteRegKey HKLM "Software\Speiseplan"
SectionEnd