From 50d73127cbd17d76cbecb0afd9957e181510bef9 Mon Sep 17 00:00:00 2001
From: kervala <none@none>
Date: Sun, 19 Jun 2016 21:08:23 +0200
Subject: [PATCH] Changed: Update Add/Remove program

--HG--
branch : develop
---
 .../ryzom_installer/src/operationdialog.cpp   | 31 +++++++++++++++++++
 .../ryzom_installer/src/operationdialog.h     |  1 +
 2 files changed, 32 insertions(+)

diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp
index d3626fdd5..f858ec600 100644
--- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp
+++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp
@@ -975,6 +975,37 @@ bool COperationDialog::createAddRemoveEntry()
 	return true;
 }
 
+bool COperationDialog::updateAddRemoveEntry()
+{
+	CConfigFile *config = CConfigFile::getInstance();
+
+	const CServer &server = config->getServer();
+
+	QString oldInstallerFilename = server.clientFilenameOld;
+	QString newInstallerFilename = server.installerFilename;
+
+	if (!oldInstallerFilename.isEmpty() && !newInstallerFilename.isEmpty())
+	{
+		QString oldInstallerFullPath = config->getSrcServerDirectory() + "/" + oldInstallerFilename;
+		QString newInstallerFullPath = config->getInstallationDirectory() + "/" + newInstallerFilename;
+
+		if (QFile::exists(newInstallerFullPath))
+		{
+#ifdef Q_OS_WIN
+			QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Ryzom", QSettings::NativeFormat);
+			QStringList versionTokens = QApplication::applicationVersion().split('.');
+
+			settings.setValue("DisplayVersion", QApplication::applicationVersion());
+			settings.setValue("EstimatedSize", getDirectorySize(config->getInstallationDirectory()));
+			settings.setValue("MajorVersion", versionTokens[0].toInt());
+			settings.setValue("MinorVersion", versionTokens[1].toInt());
+#endif
+		}
+	}
+
+	return true;
+}
+
 bool COperationDialog::deleteAddRemoveEntry()
 {
 #ifdef Q_OS_WIN
diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h
index 34a322fff..bae2a8b7f 100644
--- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h
+++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h
@@ -107,6 +107,7 @@ protected:
 	bool createClientMenuShortcut(const QString &profileId);
 
 	bool createAddRemoveEntry();
+	bool updateAddRemoveEntry();
 	bool deleteAddRemoveEntry();
 
 	void addComponentsServers();