From 10dfe2d53413d2522038e79d4921a2305762dd63 Mon Sep 17 00:00:00 2001
From: Gilbert Gonzales <gilbert@lindenlab.com>
Date: Wed, 20 Feb 2013 15:51:44 -0800
Subject: CHUI-778: Minor changes, prior commit was not changing the file path
 correctly due to logic error. Also clicking the 'Cancel' in preferences would
 still cause the file location to be saved instead of ignore the save.

---
 indra/newview/llfloaterpreference.cpp | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index b3e3a0678b..e5444583d6 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -646,13 +646,6 @@ void LLFloaterPreference::cancel()
 		LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get();
 		pPathfindingConsole->onRegionBoundaryCross();
 	}
-
-	if(mInstantMessageLogPathChanged)
-	{
-		std::string dir_name(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
-		updateLogLocation(dir_name);
-		mInstantMessageLogPathChanged = false;
-	}
 }
 
 void LLFloaterPreference::onOpen(const LLSD& key)
@@ -802,6 +795,14 @@ void LLFloaterPreference::onBtnOK()
 		apply();
 		closeFloater(false);
 
+		//Conversation transcript and log path changed so reload conversations based on new location
+		if(mInstantMessageLogPathChanged)
+		{
+			std::string dir_name(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
+			updateLogLocation(dir_name);
+			mInstantMessageLogPathChanged = false;
+		}
+
 		LLUIColorTable::instance().saveUserSettings();
 		gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
 	}
@@ -1440,8 +1441,7 @@ void LLFloaterPreference::setAllIgnored()
 
 void LLFloaterPreference::onClickLogPath()
 {
-	std::string original_name(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
-	std::string proposed_name(original_name);	 
+	std::string proposed_name(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
 	mInstantMessageLogPathChanged = false;
 	
 	LLDirPicker& picker = LLDirPicker::instance();
@@ -1451,10 +1451,12 @@ void LLFloaterPreference::onClickLogPath()
 		return; //Canceled!
 	}
 
+	//Gets the path from the directory picker
+	std::string dir_name = picker.getDirName();
+
 	//Path changed
-	if(original_name != proposed_name)
+	if(proposed_name != dir_name)
 	{
-		std::string dir_name = picker.getDirName();
 		gSavedPerAccountSettings.setString("InstantMessageLogPath", dir_name);
 		mInstantMessageLogPathChanged = true;
 
-- 
cgit v1.2.3