aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llprefsim.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llprefsim.cpp')
-rw-r--r--linden/indra/newview/llprefsim.cpp166
1 files changed, 93 insertions, 73 deletions
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;