← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/windows-updates into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/windows-updates into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/windows-updates/+merge/48701
-- 
https://code.launchpad.net/~raoul-snyman/openlp/windows-updates/+merge/48701
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/windows-updates into lp:openlp.
=== modified file 'resources/windows/OpenLP-2.0.iss'
--- resources/windows/OpenLP-2.0.iss	2010-10-10 15:40:54 +0000
+++ resources/windows/OpenLP-2.0.iss	2011-02-05 18:23:54 +0000
@@ -86,3 +86,56 @@
 Root: HKCU; SubKey: Software\OpenLP\OpenLP\remotes; ValueType: dword; ValueName: status; ValueData: $00000001
 Root: HKCU; SubKey: Software\OpenLP\OpenLP\songs; ValueType: dword; ValueName: status; ValueData: $00000001
 Root: HKCU; SubKey: Software\OpenLP\OpenLP\songusage; ValueType: dword; ValueName: status; ValueData: $00000001
+
+
+[Code]
+function GetUninstallString(): String;
+var
+  sUnInstPath: String;
+  sUnInstallString: String;
+begin
+  sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
+  sUnInstallString := '';
+  if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
+    RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
+  Result := sUnInstallString;
+end;
+
+function IsUpgrade(): Boolean;
+begin
+  Result := (GetUninstallString() <> '');
+end;
+
+// Return Values:
+// 1 - uninstall string is empty
+// 2 - error executing the UnInstallString
+// 3 - successfully executed the UnInstallString
+function UnInstallOldVersion(): Integer;
+var
+  sUnInstallString: String;
+  iResultCode: Integer;
+begin
+  Result := 0;
+  sUnInstallString := GetUninstallString();
+  if sUnInstallString <> '' then
+  begin
+    sUnInstallString := RemoveQuotes(sUnInstallString);
+    if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
+      Result := 3
+    else
+      Result := 2;
+  end
+  else
+    Result := 1;
+end;
+
+procedure CurStepChanged(CurStep: TSetupStep);
+begin
+  if (CurStep=ssInstall) then
+  begin
+    if (IsUpgrade()) then
+    begin
+      UnInstallOldVersion();
+    end;
+  end;
+end;

=== modified file 'resources/windows/OpenLP.reg'
Binary files resources/windows/OpenLP.reg	2010-10-10 15:40:54 +0000 and resources/windows/OpenLP.reg	2011-02-05 18:23:54 +0000 differ

Follow ups