From 2f6ffe2183250f3f71a8d502eed9cf9df9ff8b16 Mon Sep 17 00:00:00 2001
From: Mnikolenko ProductEngine <mnikolenko@productengine.com>
Date: Mon, 4 Feb 2013 14:37:29 +0200
Subject: [PATCH] CHUI-721 FIXED Delete transcripts when performing Clear log
 action.

---
 indra/newview/llconversationlog.cpp   |  7 +++++++
 indra/newview/llconversationlog.h     |  1 +
 indra/newview/llfloaterpreference.cpp | 16 ++++++----------
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp
index 7bd6ef8cd7b..bfaffdd73b0 100644
--- a/indra/newview/llconversationlog.cpp
+++ b/indra/newview/llconversationlog.cpp
@@ -531,7 +531,14 @@ void LLConversationLog::onClearLogResponse(const LLSD& notification, const LLSD&
 {
 	if (0 == LLNotificationsUtil::getSelectedOption(notification, response))
 	{
+		deleteTranscripts();
 		mConversations.clear();
 		notifyObservers();
 	}
 }
+
+void LLConversationLog::deleteTranscripts()
+{
+	gDirUtilp->deleteFilesInDir(gDirUtilp->getPerAccountChatLogsDir(), "*." + LL_TRANSCRIPT_FILE_EXTENSION);
+	LLFloaterIMSessionTab::processChatHistoryStyleUpdate(true);
+}
diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h
index 65a18c02e5d..88df17a8f70 100644
--- a/indra/newview/llconversationlog.h
+++ b/indra/newview/llconversationlog.h
@@ -140,6 +140,7 @@ class LLConversationLog : public LLSingleton<LLConversationLog>, LLIMSessionObse
 
 	void onClearLog();
 	void onClearLogResponse(const LLSD& notification, const LLSD& response);
+	void deleteTranscripts();
 
 private:
 
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 7742e5b3c3b..4f86c26a674 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -460,9 +460,6 @@ BOOL LLFloaterPreference::postBuild()
 	// set 'enable' property for 'Clear log...' button
 	changed();
 
-	// set 'enable' property for 'Delete transcripts...' button
-	updateDeleteTranscriptsButton();
-
 	LLLogChat::setSaveHistorySignal(boost::bind(&LLFloaterPreference::onLogChatHistorySaved, this));
 
 	return TRUE;
@@ -1587,13 +1584,8 @@ void LLFloaterPreference::onDeleteTranscriptsResponse(const LLSD& notification,
 {
 	if (0 == LLNotificationsUtil::getSelectedOption(notification, response))
 	{
-		gDirUtilp->deleteFilesInDir(gDirUtilp->getPerAccountChatLogsDir(), "*." + LL_TRANSCRIPT_FILE_EXTENSION);
-
-		std::vector<std::string> list_of_transcriptions_file_names;
-		LLLogChat::getListOfTranscriptFiles(list_of_transcriptions_file_names);
-		getChild<LLButton>("delete_transcripts")->setEnabled(list_of_transcriptions_file_names.size() > 0);
-
-		LLFloaterIMSessionTab::processChatHistoryStyleUpdate(true);
+		LLConversationLog::instance().deleteTranscripts();
+		updateDeleteTranscriptsButton();
 	}
 }
 
@@ -1668,6 +1660,10 @@ void LLFloaterPreference::selectChatPanel()
 void LLFloaterPreference::changed()
 {
 	getChild<LLButton>("clear_log")->setEnabled(LLConversationLog::instance().getConversations().size() > 0);
+
+	// set 'enable' property for 'Delete transcripts...' button
+	updateDeleteTranscriptsButton();
+
 }
 
 //------------------------------Updater---------------------------------------
-- 
GitLab