/*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
 /*
  * Define Host machine
  *
- *  Version $Id$
- *
  */
 
 #define HOST_OS  "@host@@post_host@"
 #define BACULA   "@BACULA@"
 #define DISTNAME "@DISTNAME@"
 #define DISTVER  "@DISTVER@"
+#ifdef HAVE_WIN32
+#define HELPDIR   "c://Program Files//Bacula//help"
+#else
 #define HELPDIR  "@htmldir@"
+#endif
 
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
  *
  *   Kern Sibbald, May MMVII
  *
- *  $Id$
  */ 
 
 #include "bat.h"
 #include "help.h"
 
+/*
+ * Note: HELPDIR is defined in src/host.h
+ */
+
 Help::Help(const QString &path, const QString &file, QWidget *parent) :
         QWidget(parent)
 {
 
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
 */
 
 /*
- *   Version $Id$
  *
  *  Main Window control for bat (qt-console)
  *
 
    cp -f debug/bat.exe ../win32/release32
    cp -f ${DEPKGS}/depkgs-mingw32/lib/qt/QtGui4.dll ../win32/release32
    cp -f ${DEPKGS}/depkgs-mingw32/lib/qt/QtCore4.dll ../win32/release32
+   rm -rf ../win32/release32/help
+   mkdir ../win32/release32/help
+   cp -f help/*.html ../win32/release32/help/
+   cp -f images/status.png ../win32/release32/help/
+   cp -f images/mail-message-new.png ../win32/release32/help/
 fi
 
 
 #undef  VERSION
-#define VERSION "5.0.0"
-#define BDATE   "28 January 2010"
-#define LSMDATE "28Jan10"
+#define VERSION "5.0.1"
+#define BDATE   "06 February 2010"
+#define LSMDATE "06Feb10"
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2010 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2010"       /* year for copyright messages in progs */
 
        docs/manuals/en/problems/problems.pdf \
        docs/manuals/en/utility/utility.pdf
 
+HELP_FILES := help/*
+
 ##########################################################################
 
 # Targets
 
 $(foreach file,$(DOC_FILES),$(eval $(call Copy_Docs,$(file))))
 
+
+
 $(INSTALL_EXE): winbacula.nsi $(addprefix release32/,$(BACULA_BINARIES) $(SCRIPT_FILES) $(CAT_FILES) $(DEPKGS_BINARIES) $(NONGCC_BINARIES) $(NONGCC_LIBRARIES) $(MINGW_BINARIES) $(SSL_FILES) $(DIRD_FILES) $(DOC_FILES))
+       rm -rf release32/help
+       mkdir release32/help
+       cp -f $(BINDIR)/$(HELP_FILES) release32/help/
        NSISDIR=$(NSIS_DIR) \
        $(NSIS_DIR)/makensis -V3 $(DEFINES) winbacula.nsi
 
 
 
   FileClose $R1
 
+  ${If} ${FileExists} "$OldInstallDir\bacula-fd.exe"
+    nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /kill'     ; Shutdown any bacula that could be running
+    Sleep 3000
+    nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /remove'   ; Remove existing service
+  ${EndIf}
+
 SectionEnd
 
+
 SectionGroup "Client" SecGroupClient
 
 Section "File Service" SecFileDaemon
   StrCpy $1 bat.conf
   Call ConfigEditAndCopy
 
+  File "${SRC_DIR}\help\*"
+   
+
   ; Create Start Menu entry
   CreateShortCut "$SMPROGRAMS\Bacula\Bat.lnk" "$INSTDIR\bat.exe" '-c "$INSTDIR\bat.conf"' "$INSTDIR\bat.exe" 0
   CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Bat Configuration.lnk" "write.exe" '"$INSTDIR\bat.conf"'
 Section "Uninstall"
   ; Shutdown any baculum that could be running
   nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /kill'
-  Sleep 5000
+  Sleep 3000
 
 ; ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-fd"
   ; Remove bacula service
 
 
   FileClose $R1
 
+  ${If} ${FileExists} "$OldInstallDir\bacula-fd.exe"
+    nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /kill'     ; Shutdown any bacula that could be running
+    Sleep 3000
+    nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /remove'   ; Remove existing service
+  ${EndIf}
+
 SectionEnd
 
 SectionGroup "Client" SecGroupClient
   StrCpy $1 bat.conf
   Call ConfigEditAndCopy
 
+  File "${SRC_DIR}\help\*"
+
+
   ; Create Start Menu entry
   CreateShortCut "$SMPROGRAMS\Bacula\Bat.lnk" "$INSTDIR\bin32\bat.exe" '-c "$INSTDIR\bin32\bat.conf"' "$INSTDIR\bin32\bat.exe" 0
   CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Bat Configuration.lnk" "write.exe" '"$INSTDIR\bin32\bat.conf"'