aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--linden/indra/newview/llfloaterpreference.cpp14
-rw-r--r--linden/indra/newview/llfloaterpreference.h3
-rw-r--r--linden/indra/newview/llprefsim.cpp166
-rw-r--r--linden/indra/newview/llprefsim.h1
-rw-r--r--linden/indra/newview/llstartup.cpp3
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_preferences_im.xml3
6 files changed, 117 insertions, 73 deletions
diff --git a/linden/indra/newview/llfloaterpreference.cpp b/linden/indra/newview/llfloaterpreference.cpp
index 2fe4b4d..0f81be6 100644
--- a/linden/indra/newview/llfloaterpreference.cpp
+++ b/linden/indra/newview/llfloaterpreference.cpp
@@ -362,6 +362,11 @@ void LLPreferenceCore::setPersonalInfo(const std::string& visibility, bool im_vi
362 mPrefsIM->setPersonalInfo(visibility, im_via_email, email); 362 mPrefsIM->setPersonalInfo(visibility, im_via_email, email);
363} 363}
364 364
365void LLPreferenceCore::updateIsLoggedIn(bool enable)
366{
367 mPrefsIM->preparePerAccountPrefs(enable);
368}
369
365void LLPreferenceCore::refreshEnabledGraphics() 370void LLPreferenceCore::refreshEnabledGraphics()
366{ 371{
367 LLFloaterHardwareSettings::instance()->refreshEnabledState(); 372 LLFloaterHardwareSettings::instance()->refreshEnabledState();
@@ -537,6 +542,15 @@ void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_
537 } 542 }
538} 543}
539 544
545// static
546void LLFloaterPreference::updateIsLoggedIn(bool enable)
547{
548 if(sInstance && sInstance->mPreferenceCore)
549 {
550 sInstance->mPreferenceCore->updateIsLoggedIn(enable);
551 }
552}
553
540void LLFloaterPreference::refreshEnabledGraphics() 554void LLFloaterPreference::refreshEnabledGraphics()
541{ 555{
542 sInstance->mPreferenceCore->refreshEnabledGraphics(); 556 sInstance->mPreferenceCore->refreshEnabledGraphics();
diff --git a/linden/indra/newview/llfloaterpreference.h b/linden/indra/newview/llfloaterpreference.h
index c52f541..931c8b6 100644
--- a/linden/indra/newview/llfloaterpreference.h
+++ b/linden/indra/newview/llfloaterpreference.h
@@ -73,6 +73,7 @@ public:
73 LLTabContainer* getTabContainer() { return mTabContainer; } 73 LLTabContainer* getTabContainer() { return mTabContainer; }
74 74
75 void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email); 75 void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email);
76 void updateIsLoggedIn(bool enable);
76 77
77 static void onTabChanged(void* user_data, bool from_click); 78 static void onTabChanged(void* user_data, bool from_click);
78 79
@@ -113,6 +114,8 @@ public:
113 114
114 // static data update, called from message handler 115 // static data update, called from message handler
115 static void updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email); 116 static void updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email);
117 // static data update, called after login
118 static void updateIsLoggedIn(bool enable);
116 119
117 // refresh all the graphics preferences menus 120 // refresh all the graphics preferences menus
118 static void refreshEnabledGraphics(); 121 static void refreshEnabledGraphics();
diff --git a/linden/indra/newview/llprefsim.cpp b/linden/indra/newview/llprefsim.cpp
index 9e86cd3..5ac2bb2 100644
--- a/linden/indra/newview/llprefsim.cpp
+++ b/linden/indra/newview/llprefsim.cpp
@@ -66,6 +66,7 @@ public:
66 void apply(); 66 void apply();
67 void cancel(); 67 void cancel();
68 void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email); 68 void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email);
69 void preparePerAccountPrefs(bool enable);
69 void enableHistory(); 70 void enableHistory();
70 71
71 static void onClickLogPath(void* user_data); 72 static void onClickLogPath(void* user_data);
@@ -76,6 +77,7 @@ public:
76protected: 77protected:
77 78
78 bool mGotPersonalInfo; 79 bool mGotPersonalInfo;
80 bool mGotPerAccountSettings;
79 bool mOriginalIMViaEmail; 81 bool mOriginalIMViaEmail;
80 82
81 bool mOriginalHideOnlineStatus; 83 bool mOriginalHideOnlineStatus;
@@ -86,7 +88,9 @@ protected:
86LLPrefsIMImpl::LLPrefsIMImpl() 88LLPrefsIMImpl::LLPrefsIMImpl()
87 : LLPanel(std::string("IM Prefs Panel")), 89 : LLPanel(std::string("IM Prefs Panel")),
88 mGotPersonalInfo(false), 90 mGotPersonalInfo(false),
89 mOriginalIMViaEmail(false) 91 mGotPerAccountSettings(false),
92 mOriginalIMViaEmail(false),
93 mOriginalHideOnlineStatus(false)
90{ 94{
91 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_im.xml"); 95 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_im.xml");
92} 96}
@@ -106,55 +110,38 @@ BOOL LLPrefsIMImpl::postBuild()
106 110
107 childSetLabelArg("send_im_to_email", "[EMAIL]", getString("log_in_to_change")); 111 childSetLabelArg("send_im_to_email", "[EMAIL]", getString("log_in_to_change"));
108 112
109 // Don't enable this until we get personal data 113 // Don't enable these until we get personal data
110 // Unless we're already logged in. Some non-SL grids won't send us the data we need -- MC 114 childSetEnabled("online_visibility", false);
111 childSetEnabled("include_im_in_chat_console", LLStartUp::isLoggedIn()); 115 childSetEnabled("send_im_to_email", false);
112 childSetEnabled("include_im_in_chat_history", LLStartUp::isLoggedIn());
113 childSetEnabled("show_timestamps_check", LLStartUp::isLoggedIn());
114 childSetEnabled("friends_online_notify_checkbox", LLStartUp::isLoggedIn());
115
116 childSetEnabled("online_visibility", LLStartUp::isLoggedIn());
117 childSetEnabled("send_im_to_email", LLStartUp::isLoggedIn());
118 childSetEnabled("log_instant_messages", LLStartUp::isLoggedIn());
119 childSetEnabled("log_chat", LLStartUp::isLoggedIn());
120 childSetEnabled("log_show_history", LLStartUp::isLoggedIn());
121 childSetEnabled("log_path_button", LLStartUp::isLoggedIn());
122 childSetEnabled("busy_response", LLStartUp::isLoggedIn());
123 childSetEnabled("log_instant_messages_timestamp", LLStartUp::isLoggedIn());
124 childSetEnabled("log_chat_timestamp", LLStartUp::isLoggedIn());
125 childSetEnabled("log_chat_IM", LLStartUp::isLoggedIn());
126 childSetEnabled("log_date_timestamp", LLStartUp::isLoggedIn());
127
128 childSetText("busy_response", getString("log_in_to_change"));
129 116
117 // These are safe to enable
118 childSetEnabled("include_im_in_chat_console", true);
119 childSetEnabled("include_im_in_chat_history", true);
120 childSetEnabled("show_timestamps_check", true);
121 childSetEnabled("friends_online_notify_checkbox", true);
122 childSetEnabled("vertical-imtabs-toggle", true);
130 childSetValue("include_im_in_chat_console", gSavedSettings.getBOOL("IMInChatConsole")); 123 childSetValue("include_im_in_chat_console", gSavedSettings.getBOOL("IMInChatConsole"));
131 childSetValue("include_im_in_chat_history", gSavedSettings.getBOOL("IMInChatHistory")); 124 childSetValue("include_im_in_chat_history", gSavedSettings.getBOOL("IMInChatHistory"));
132 childSetValue("show_timestamps_check", gSavedSettings.getBOOL("IMShowTimestamps")); 125 childSetValue("show_timestamps_check", gSavedSettings.getBOOL("IMShowTimestamps"));
133 childSetValue("friends_online_notify_checkbox", gSavedSettings.getBOOL("ChatOnlineNotification")); 126 childSetValue("friends_online_notify_checkbox", gSavedSettings.getBOOL("ChatOnlineNotification"));
134 childSetValue("vertical-imtabs-toggle", gSavedSettings.getBOOL("VerticalIMTabs")); 127 childSetValue("vertical-imtabs-toggle", gSavedSettings.getBOOL("VerticalIMTabs"));
135 128
136 childSetText("log_path_string", gSavedPerAccountSettings.getString("InstantMessageLogPath"));
137 childSetValue("log_instant_messages", gSavedPerAccountSettings.getBOOL("LogInstantMessages"));
138 childSetValue("log_chat", gSavedPerAccountSettings.getBOOL("LogChat"));
139 childSetValue("log_show_history", gSavedPerAccountSettings.getBOOL("LogShowHistory"));
140 childSetValue("log_instant_messages_timestamp", gSavedPerAccountSettings.getBOOL("IMLogTimestamp"));
141 childSetValue("log_chat_timestamp", gSavedPerAccountSettings.getBOOL("LogChatTimestamp"));
142 childSetValue("log_chat_IM", gSavedPerAccountSettings.getBOOL("LogChatIM"));
143 childSetValue("log_date_timestamp", gSavedPerAccountSettings.getBOOL("LogTimestampDate"));
144
145 childSetAction("log_path_button", onClickLogPath, this); 129 childSetAction("log_path_button", onClickLogPath, this);
146 childSetCommitCallback("log_chat",onCommitLogging,this); 130 childSetCommitCallback("log_chat",onCommitLogging,this);
147 childSetCommitCallback("log_instant_messages",onCommitLogging,this); 131 childSetCommitCallback("log_instant_messages",onCommitLogging,this);
148 132
149 childSetAction("busy_adv_btn", onClickBusyAdvanced, this); 133 childSetAction("busy_adv_btn", onClickBusyAdvanced, this);
150 134
135 preparePerAccountPrefs(LLStartUp::isLoggedIn());
136
151 return TRUE; 137 return TRUE;
152} 138}
153 139
154void LLPrefsIMImpl::enableHistory() 140void LLPrefsIMImpl::enableHistory()
155{ 141{
156 142
157 if (childGetValue("log_instant_messages").asBoolean() || childGetValue("log_chat").asBoolean()) 143 if (mGotPerAccountSettings &&
144 (childGetValue("log_instant_messages").asBoolean() || childGetValue("log_chat").asBoolean()))
158 { 145 {
159 childEnable("log_show_history"); 146 childEnable("log_show_history");
160 childEnable("log_path_button"); 147 childEnable("log_path_button");
@@ -168,23 +155,16 @@ void LLPrefsIMImpl::enableHistory()
168 155
169void LLPrefsIMImpl::apply() 156void LLPrefsIMImpl::apply()
170{ 157{
171 LLTextEditor* busy = getChild<LLTextEditor>("busy_response"); 158 if (mGotPerAccountSettings)
172 LLWString busy_response;
173 if (busy) busy_response = busy->getWText();
174 LLWStringUtil::replaceTabsWithSpaces(busy_response, 4);
175 LLWStringUtil::replaceChar(busy_response, '\n', '^');
176 LLWStringUtil::replaceChar(busy_response, ' ', '%');
177
178 if(mGotPersonalInfo)
179 { 159 {
180 160 LLTextEditor* busy = getChild<LLTextEditor>("busy_response");
161 LLWString busy_response;
162 if (busy) busy_response = busy->getWText();
163 LLWStringUtil::replaceTabsWithSpaces(busy_response, 4);
164 LLWStringUtil::replaceChar(busy_response, '\n', '^');
165 LLWStringUtil::replaceChar(busy_response, ' ', '%');
181 gSavedPerAccountSettings.setString("BusyModeResponse", std::string(wstring_to_utf8str(busy_response))); 166 gSavedPerAccountSettings.setString("BusyModeResponse", std::string(wstring_to_utf8str(busy_response)));
182 167
183 gSavedSettings.setBOOL("IMInChatConsole", childGetValue("include_im_in_chat_console").asBoolean());
184 gSavedSettings.setBOOL("IMInChatHistory", childGetValue("include_im_in_chat_history").asBoolean());
185 gSavedSettings.setBOOL("IMShowTimestamps", childGetValue("show_timestamps_check").asBoolean());
186 gSavedSettings.setBOOL("ChatOnlineNotification", childGetValue("friends_online_notify_checkbox").asBoolean());
187
188 gSavedPerAccountSettings.setString("InstantMessageLogPath", childGetText("log_path_string")); 168 gSavedPerAccountSettings.setString("InstantMessageLogPath", childGetText("log_path_string"));
189 gSavedPerAccountSettings.setBOOL("LogInstantMessages",childGetValue("log_instant_messages").asBoolean()); 169 gSavedPerAccountSettings.setBOOL("LogInstantMessages",childGetValue("log_instant_messages").asBoolean());
190 gSavedPerAccountSettings.setBOOL("LogChat",childGetValue("log_chat").asBoolean()); 170 gSavedPerAccountSettings.setBOOL("LogChat",childGetValue("log_chat").asBoolean());
@@ -207,7 +187,10 @@ void LLPrefsIMImpl::apply()
207 gSavedSettings.getString("FirstName"), gSavedSettings.getString("LastName") ); 187 gSavedSettings.getString("FirstName"), gSavedSettings.getString("LastName") );
208 } 188 }
209 LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir()); 189 LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir());
210 190 }
191
192 if (mGotPersonalInfo)
193 {
211 bool new_im_via_email = childGetValue("send_im_to_email").asBoolean(); 194 bool new_im_via_email = childGetValue("send_im_to_email").asBoolean();
212 bool new_hide_online = childGetValue("online_visibility").asBoolean(); 195 bool new_hide_online = childGetValue("online_visibility").asBoolean();
213 196
@@ -237,9 +220,15 @@ void LLPrefsIMImpl::apply()
237 gAgent.sendReliableMessage(); 220 gAgent.sendReliableMessage();
238 } 221 }
239 } 222 }
223
240 gSavedSettings.setBOOL("VerticalIMTabs", childGetValue("vertical-imtabs-toggle").asBoolean()); 224 gSavedSettings.setBOOL("VerticalIMTabs", childGetValue("vertical-imtabs-toggle").asBoolean());
225 gSavedSettings.setBOOL("IMInChatConsole", childGetValue("include_im_in_chat_console").asBoolean());
226 gSavedSettings.setBOOL("IMInChatHistory", childGetValue("include_im_in_chat_history").asBoolean());
227 gSavedSettings.setBOOL("IMShowTimestamps", childGetValue("show_timestamps_check").asBoolean());
228 gSavedSettings.setBOOL("ChatOnlineNotification", childGetValue("friends_online_notify_checkbox").asBoolean());
241} 229}
242 230
231// Enable and set the value of settings recieved from the sim in AgentInfoReply
243void LLPrefsIMImpl::setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email) 232void LLPrefsIMImpl::setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email)
244{ 233{
245 mGotPersonalInfo = true; 234 mGotPersonalInfo = true;
@@ -261,36 +250,10 @@ void LLPrefsIMImpl::setPersonalInfo(const std::string& visibility, bool im_via_e
261 mOriginalHideOnlineStatus = true; 250 mOriginalHideOnlineStatus = true;
262 } 251 }
263 252
264 childEnable("include_im_in_chat_console");
265 childEnable("include_im_in_chat_history");
266 childEnable("show_timestamps_check");
267 childEnable("friends_online_notify_checkbox");
268
269 childSetValue("online_visibility", mOriginalHideOnlineStatus); 253 childSetValue("online_visibility", mOriginalHideOnlineStatus);
270 childSetLabelArg("online_visibility", "[DIR_VIS]", mDirectoryVisibility); 254 childSetLabelArg("online_visibility", "[DIR_VIS]", mDirectoryVisibility);
271 childEnable("send_im_to_email"); 255 childEnable("send_im_to_email");
272 childSetValue("send_im_to_email", im_via_email); 256 childSetValue("send_im_to_email", im_via_email);
273 childEnable("log_instant_messages");
274 childEnable("log_chat");
275 childEnable("busy_response");
276 childEnable("log_instant_messages_timestamp");
277 childEnable("log_chat_timestamp");
278 childEnable("log_chat_IM");
279 childEnable("log_date_timestamp");
280
281 //RN: get wide string so replace char can work (requires fixed-width encoding)
282 LLWString busy_response = utf8str_to_wstring( gSavedPerAccountSettings.getString("BusyModeResponse") );
283 LLWStringUtil::replaceChar(busy_response, '^', '\n');
284 LLWStringUtil::replaceChar(busy_response, '%', ' ');
285 childSetText("busy_response", wstring_to_utf8str(busy_response));
286// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
287 if (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM))
288 {
289 childDisable("busy_response");
290 }
291// [/RLVa:KB]
292
293 enableHistory();
294 257
295 // Truncate the e-mail address if it's too long (to prevent going off 258 // Truncate the e-mail address if it's too long (to prevent going off
296 // the edge of the dialog). 259 // the edge of the dialog).
@@ -300,10 +263,62 @@ void LLPrefsIMImpl::setPersonalInfo(const std::string& visibility, bool im_via_e
300 display_email.resize(30); 263 display_email.resize(30);
301 display_email += "..."; 264 display_email += "...";
302 } 265 }
303 266 else if (display_email.empty())
267 {
268 display_email = getString("default_email_used");
269 }
304 childSetLabelArg("send_im_to_email", "[EMAIL]", display_email); 270 childSetLabelArg("send_im_to_email", "[EMAIL]", display_email);
305} 271}
306 272
273// Enable and set the value of settings that need an account name
274void LLPrefsIMImpl::preparePerAccountPrefs(bool enable)
275{
276 if (mGotPerAccountSettings && enable)
277 {
278 return; // prevent overwriting unsaved changes.
279 }
280 mGotPerAccountSettings = enable;
281
282 childSetEnabled("log_chat", enable);
283 childSetEnabled("log_chat_timestamp", enable);
284 childSetEnabled("log_chat_IM", enable);
285 childSetEnabled("log_instant_messages_timestamp", enable);
286 childSetEnabled("log_instant_messages", enable);
287 childSetEnabled("log_date_timestamp", enable);
288
289 childSetValue("log_chat", gSavedPerAccountSettings.getBOOL("LogChat"));
290 childSetValue("log_chat_timestamp", gSavedPerAccountSettings.getBOOL("LogChatTimestamp"));
291 childSetValue("log_chat_IM", gSavedPerAccountSettings.getBOOL("LogChatIM"));
292 childSetValue("log_instant_messages_timestamp", gSavedPerAccountSettings.getBOOL("IMLogTimestamp"));
293 childSetValue("log_instant_messages", gSavedPerAccountSettings.getBOOL("LogInstantMessages"));
294 childSetValue("log_date_timestamp", gSavedPerAccountSettings.getBOOL("LogTimestampDate"));
295
296 childSetValue("log_show_history", gSavedPerAccountSettings.getBOOL("LogShowHistory"));
297 enableHistory();
298 childSetText("log_path_string", gSavedPerAccountSettings.getString("InstantMessageLogPath"));
299
300 childSetEnabled("busy_response", enable);
301 if (enable)
302 {
303 //RN: get wide string so replace char can work (requires fixed-width encoding)
304 LLWString busy_response = utf8str_to_wstring( gSavedPerAccountSettings.getString("BusyModeResponse") );
305 LLWStringUtil::replaceChar(busy_response, '^', '\n');
306 LLWStringUtil::replaceChar(busy_response, '%', ' ');
307 childSetText("busy_response", wstring_to_utf8str(busy_response));
308 }
309 else
310 {
311 childSetText("busy_response", getString("log_in_to_change"));
312 }
313// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
314 if (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM))
315 {
316 childDisable("busy_response");
317 }
318// [/RLVa:KB]
319
320 childSetEnabled("busy_adv_btn", enable);
321}
307 322
308// static 323// static
309void LLPrefsIMImpl::onClickBusyAdvanced(void* user_data) 324void LLPrefsIMImpl::onClickBusyAdvanced(void* user_data)
@@ -363,6 +378,11 @@ void LLPrefsIM::setPersonalInfo(const std::string& visibility, bool im_via_email
363 impl.setPersonalInfo(visibility, im_via_email, email); 378 impl.setPersonalInfo(visibility, im_via_email, email);
364} 379}
365 380
381void LLPrefsIM::preparePerAccountPrefs(bool enable)
382{
383 impl.preparePerAccountPrefs(enable);
384}
385
366LLPanel* LLPrefsIM::getPanel() 386LLPanel* LLPrefsIM::getPanel()
367{ 387{
368 return &impl; 388 return &impl;
diff --git a/linden/indra/newview/llprefsim.h b/linden/indra/newview/llprefsim.h
index 90bf465..acf9b0f 100644
--- a/linden/indra/newview/llprefsim.h
+++ b/linden/indra/newview/llprefsim.h
@@ -46,6 +46,7 @@ public:
46 void apply(); 46 void apply();
47 void cancel(); 47 void cancel();
48 void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email); 48 void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email);
49 void preparePerAccountPrefs(bool enable);
49 50
50 LLPanel* getPanel(); 51 LLPanel* getPanel();
51 52
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index b744961..aba9bb6 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -101,6 +101,7 @@
101#include "llfloatergesture.h" 101#include "llfloatergesture.h"
102#include "llfloaterhud.h" 102#include "llfloaterhud.h"
103#include "llfloaterland.h" 103#include "llfloaterland.h"
104#include "llfloaterpreference.h"
104#include "llfloaterteleporthistory.h" 105#include "llfloaterteleporthistory.h"
105#include "llfloatertopobjects.h" 106#include "llfloatertopobjects.h"
106#include "llfloatertos.h" 107#include "llfloatertos.h"
@@ -2876,6 +2877,8 @@ bool idle_startup()
2876 gDebugView->mFastTimerView->setVisible(TRUE); 2877 gDebugView->mFastTimerView->setVisible(TRUE);
2877#endif 2878#endif
2878 2879
2880 LLFloaterPreference::updateIsLoggedIn(true);
2881
2879 return TRUE; 2882 return TRUE;
2880 } 2883 }
2881 2884
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_im.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_im.xml
index e64f6c7..fe17e7a 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_im.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_im.xml
@@ -22,6 +22,9 @@
22 <string name="log_in_to_change"> 22 <string name="log_in_to_change">
23 log in to change 23 log in to change
24 </string> 24 </string>
25 <string name="default_email_used">
26 using default address
27 </string>
25 <check_box bottom="-45" enabled="true" follows="left|top" font="SansSerifSmall" 28 <check_box bottom="-45" enabled="true" follows="left|top" font="SansSerifSmall"
26 height="16" initial_value="false" label="Send IM to email ([EMAIL])" 29 height="16" initial_value="false" label="Send IM to email ([EMAIL])"
27 left="148" mouse_opaque="true" name="send_im_to_email" radio_style="false" 30 left="148" mouse_opaque="true" name="send_im_to_email" radio_style="false"