diff options
Diffstat (limited to 'linden/indra/newview/llprefsim.cpp')
-rw-r--r-- | linden/indra/newview/llprefsim.cpp | 105 |
1 files changed, 38 insertions, 67 deletions
diff --git a/linden/indra/newview/llprefsim.cpp b/linden/indra/newview/llprefsim.cpp index 5333df8..1af6e86 100644 --- a/linden/indra/newview/llprefsim.cpp +++ b/linden/indra/newview/llprefsim.cpp | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * $LicenseInfo:firstyear=2003&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2003&license=viewergpl$ |
7 | * | 7 | * |
8 | * Copyright (c) 2003-2008, Linden Research, Inc. | 8 | * Copyright (c) 2003-2009, Linden Research, Inc. |
9 | * | 9 | * |
10 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
11 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -55,73 +55,33 @@ public: | |||
55 | /*virtual*/ BOOL postBuild(); | 55 | /*virtual*/ BOOL postBuild(); |
56 | 56 | ||
57 | void apply(); | 57 | void apply(); |
58 | void refresh(); | ||
59 | void cancel(); | 58 | void cancel(); |
60 | void setPersonalInfo( | 59 | void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email); |
61 | const std::string& visibility, | ||
62 | bool im_via_email, | ||
63 | const std::string& email); | ||
64 | void enableHistory(); | 60 | void enableHistory(); |
61 | |||
65 | static void onClickLogPath(void* user_data); | 62 | static void onClickLogPath(void* user_data); |
66 | static void onCommitLogging( LLUICtrl* ctrl, void* user_data); | 63 | static void onCommitLogging(LLUICtrl* ctrl, void* user_data); |
67 | 64 | ||
68 | protected: | 65 | protected: |
69 | BOOL mIMInChatHistory; | 66 | |
70 | BOOL mLogInstantMessages; | ||
71 | BOOL mLogChat; | ||
72 | BOOL mLogShowHistory; | ||
73 | BOOL mShowTimestamps; | ||
74 | BOOL mIMLogTimestamp; | ||
75 | BOOL mLogChatTimestamp; | ||
76 | BOOL mLogIMChat; | ||
77 | BOOL mLogTimestampDate; | ||
78 | |||
79 | std::string mIMBusyResponse; | ||
80 | std::string mLogPath; | ||
81 | |||
82 | bool mGotPersonalInfo; | 67 | bool mGotPersonalInfo; |
83 | bool mOriginalIMViaEmail; | 68 | bool mOriginalIMViaEmail; |
84 | 69 | ||
85 | // online status info | ||
86 | bool mOriginalHideOnlineStatus; | 70 | bool mOriginalHideOnlineStatus; |
87 | std::string mDirectoryVisibility; | 71 | std::string mDirectoryVisibility; |
88 | }; | 72 | }; |
89 | 73 | ||
90 | 74 | ||
91 | LLPrefsIMImpl::LLPrefsIMImpl() | 75 | LLPrefsIMImpl::LLPrefsIMImpl() |
92 | : LLPanel(std::string("IM Prefs Panel")) | 76 | : LLPanel(std::string("IM Prefs Panel")), |
77 | mGotPersonalInfo(false), | ||
78 | mOriginalIMViaEmail(false) | ||
93 | { | 79 | { |
94 | LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_im.xml"); | 80 | LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_im.xml"); |
95 | } | 81 | } |
96 | 82 | ||
97 | void LLPrefsIMImpl::refresh() | ||
98 | { | ||
99 | mIMInChatHistory = gSavedSettings.getBOOL("IMInChatHistory"); | ||
100 | mShowTimestamps = gSavedSettings.getBOOL("IMShowTimestamps"); | ||
101 | mIMBusyResponse = gSavedPerAccountSettings.getString("BusyModeResponse"); | ||
102 | mLogPath = gSavedPerAccountSettings.getString("InstantMessageLogPath"); | ||
103 | mLogInstantMessages= gSavedPerAccountSettings.getBOOL("LogInstantMessages"); | ||
104 | mLogChat = gSavedPerAccountSettings.getBOOL("LogChat"); | ||
105 | mLogShowHistory = gSavedPerAccountSettings.getBOOL("LogShowHistory"); | ||
106 | mIMLogTimestamp = gSavedPerAccountSettings.getBOOL("IMLogTimestamp"); | ||
107 | mLogChatTimestamp = gSavedPerAccountSettings.getBOOL("LogChatTimestamp"); | ||
108 | mLogIMChat = gSavedPerAccountSettings.getBOOL("LogChatIM"); | ||
109 | mLogTimestampDate = gSavedPerAccountSettings.getBOOL("LogTimestampDate"); | ||
110 | } | ||
111 | |||
112 | void LLPrefsIMImpl::cancel() | 83 | void LLPrefsIMImpl::cancel() |
113 | { | 84 | { |
114 | gSavedSettings.setBOOL("IMInChatHistory", mIMInChatHistory); | ||
115 | gSavedSettings.setBOOL("IMShowTimestamps", mShowTimestamps); | ||
116 | gSavedPerAccountSettings.setString("BusyModeResponse", mIMBusyResponse); | ||
117 | gSavedPerAccountSettings.setString("InstantMessageLogPath",mLogPath); | ||
118 | gSavedPerAccountSettings.setBOOL("LogInstantMessages",mLogInstantMessages); | ||
119 | gSavedPerAccountSettings.setBOOL("LogChat",mLogChat); | ||
120 | gSavedPerAccountSettings.setBOOL("LogShowHistory",mLogShowHistory); | ||
121 | gSavedPerAccountSettings.setBOOL("IMLogTimestamp",mIMLogTimestamp); | ||
122 | gSavedPerAccountSettings.setBOOL("LogChatTimestamp",mLogChatTimestamp); | ||
123 | gSavedPerAccountSettings.setBOOL("LogChatIM",mLogIMChat); | ||
124 | gSavedPerAccountSettings.setBOOL("LogTimestampDate",mLogTimestampDate); | ||
125 | } | 85 | } |
126 | 86 | ||
127 | BOOL LLPrefsIMImpl::postBuild() | 87 | BOOL LLPrefsIMImpl::postBuild() |
@@ -133,12 +93,13 @@ BOOL LLPrefsIMImpl::postBuild() | |||
133 | return FALSE; | 93 | return FALSE; |
134 | } | 94 | } |
135 | 95 | ||
136 | mGotPersonalInfo = false; | ||
137 | mOriginalIMViaEmail = false; | ||
138 | mOriginalHideOnlineStatus = true; | ||
139 | childSetLabelArg("send_im_to_email", "[EMAIL]", getString("log_in_to_change")); | 96 | childSetLabelArg("send_im_to_email", "[EMAIL]", getString("log_in_to_change")); |
140 | 97 | ||
141 | // Don't enable this until we get personal data | 98 | // Don't enable this until we get personal data |
99 | childDisable("include_im_in_chat_history"); | ||
100 | childDisable("show_timestamps_check"); | ||
101 | childDisable("friends_online_notify_checkbox"); | ||
102 | |||
142 | childDisable("online_visibility"); | 103 | childDisable("online_visibility"); |
143 | childDisable("send_im_to_email"); | 104 | childDisable("send_im_to_email"); |
144 | childDisable("log_instant_messages"); | 105 | childDisable("log_instant_messages"); |
@@ -152,17 +113,20 @@ BOOL LLPrefsIMImpl::postBuild() | |||
152 | childDisable("log_date_timestamp"); | 113 | childDisable("log_date_timestamp"); |
153 | 114 | ||
154 | childSetText("busy_response", getString("log_in_to_change")); | 115 | childSetText("busy_response", getString("log_in_to_change")); |
155 | 116 | ||
156 | refresh(); | 117 | childSetValue("include_im_in_chat_history", gSavedSettings.getBOOL("IMInChatHistory")); |
157 | 118 | childSetValue("show_timestamps_check", gSavedSettings.getBOOL("IMShowTimestamps")); | |
158 | childSetText("log_path_string", mLogPath); | 119 | childSetValue("friends_online_notify_checkbox", gSavedSettings.getBOOL("ChatOnlineNotification")); |
159 | childSetValue("log_instant_messages", mLogInstantMessages); | 120 | |
160 | childSetValue("log_chat", mLogChat); | 121 | childSetText("log_path_string", gSavedPerAccountSettings.getString("InstantMessageLogPath")); |
161 | childSetValue("log_show_history", mLogShowHistory); | 122 | childSetValue("log_instant_messages", gSavedPerAccountSettings.getBOOL("LogInstantMessages")); |
162 | childSetValue("log_instant_messages_timestamp", mIMLogTimestamp); | 123 | childSetValue("log_chat", gSavedPerAccountSettings.getBOOL("LogChat")); |
163 | childSetValue("log_chat_timestamp", mLogChatTimestamp); | 124 | childSetValue("log_show_history", gSavedPerAccountSettings.getBOOL("LogShowHistory")); |
164 | childSetValue("log_chat_IM", mLogIMChat); | 125 | childSetValue("log_instant_messages_timestamp", gSavedPerAccountSettings.getBOOL("IMLogTimestamp")); |
165 | childSetValue("log_date_timestamp",mLogTimestampDate); | 126 | childSetValue("log_chat_timestamp", gSavedPerAccountSettings.getBOOL("LogChatTimestamp")); |
127 | childSetValue("log_chat_IM", gSavedPerAccountSettings.getBOOL("LogChatIM")); | ||
128 | childSetValue("log_date_timestamp", gSavedPerAccountSettings.getBOOL("LogTimestampDate")); | ||
129 | |||
166 | childSetAction("log_path_button", onClickLogPath, this); | 130 | childSetAction("log_path_button", onClickLogPath, this); |
167 | childSetCommitCallback("log_chat",onCommitLogging,this); | 131 | childSetCommitCallback("log_chat",onCommitLogging,this); |
168 | childSetCommitCallback("log_instant_messages",onCommitLogging,this); | 132 | childSetCommitCallback("log_instant_messages",onCommitLogging,this); |
@@ -199,6 +163,10 @@ void LLPrefsIMImpl::apply() | |||
199 | 163 | ||
200 | gSavedPerAccountSettings.setString("BusyModeResponse", std::string(wstring_to_utf8str(busy_response))); | 164 | gSavedPerAccountSettings.setString("BusyModeResponse", std::string(wstring_to_utf8str(busy_response))); |
201 | 165 | ||
166 | gSavedSettings.setBOOL("IMInChatHistory", childGetValue("include_im_in_chat_history").asBoolean()); | ||
167 | gSavedSettings.setBOOL("IMShowTimestamps", childGetValue("show_timestamps_check").asBoolean()); | ||
168 | gSavedSettings.setBOOL("ChatOnlineNotification", childGetValue("friends_online_notify_checkbox").asBoolean()); | ||
169 | |||
202 | gSavedPerAccountSettings.setString("InstantMessageLogPath", childGetText("log_path_string")); | 170 | gSavedPerAccountSettings.setString("InstantMessageLogPath", childGetText("log_path_string")); |
203 | gSavedPerAccountSettings.setBOOL("LogInstantMessages",childGetValue("log_instant_messages").asBoolean()); | 171 | gSavedPerAccountSettings.setBOOL("LogInstantMessages",childGetValue("log_instant_messages").asBoolean()); |
204 | gSavedPerAccountSettings.setBOOL("LogChat",childGetValue("log_chat").asBoolean()); | 172 | gSavedPerAccountSettings.setBOOL("LogChat",childGetValue("log_chat").asBoolean()); |
@@ -245,14 +213,12 @@ void LLPrefsIMImpl::apply() | |||
245 | } | 213 | } |
246 | } | 214 | } |
247 | 215 | ||
248 | void LLPrefsIMImpl::setPersonalInfo( | 216 | void LLPrefsIMImpl::setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email) |
249 | const std::string& visibility, | ||
250 | bool im_via_email, | ||
251 | const std::string& email) | ||
252 | { | 217 | { |
253 | mGotPersonalInfo = true; | 218 | mGotPersonalInfo = true; |
254 | mOriginalIMViaEmail = im_via_email; | 219 | mOriginalIMViaEmail = im_via_email; |
255 | mDirectoryVisibility = visibility; | 220 | mDirectoryVisibility = visibility; |
221 | |||
256 | if(visibility == VISIBILITY_DEFAULT) | 222 | if(visibility == VISIBILITY_DEFAULT) |
257 | { | 223 | { |
258 | mOriginalHideOnlineStatus = false; | 224 | mOriginalHideOnlineStatus = false; |
@@ -267,6 +233,11 @@ void LLPrefsIMImpl::setPersonalInfo( | |||
267 | { | 233 | { |
268 | mOriginalHideOnlineStatus = true; | 234 | mOriginalHideOnlineStatus = true; |
269 | } | 235 | } |
236 | |||
237 | childEnable("include_im_in_chat_history"); | ||
238 | childEnable("show_timestamps_check"); | ||
239 | childEnable("friends_online_notify_checkbox"); | ||
240 | |||
270 | childSetValue("online_visibility", mOriginalHideOnlineStatus); | 241 | childSetValue("online_visibility", mOriginalHideOnlineStatus); |
271 | childSetLabelArg("online_visibility", "[DIR_VIS]", mDirectoryVisibility); | 242 | childSetLabelArg("online_visibility", "[DIR_VIS]", mDirectoryVisibility); |
272 | childEnable("send_im_to_email"); | 243 | childEnable("send_im_to_email"); |
@@ -308,7 +279,7 @@ void LLPrefsIMImpl::onClickLogPath(void* user_data) | |||
308 | std::string proposed_name(self->childGetText("log_path_string")); | 279 | std::string proposed_name(self->childGetText("log_path_string")); |
309 | 280 | ||
310 | LLDirPicker& picker = LLDirPicker::instance(); | 281 | LLDirPicker& picker = LLDirPicker::instance(); |
311 | if (! picker.getDir(&proposed_name ) ) | 282 | if (!picker.getDir(&proposed_name ) ) |
312 | { | 283 | { |
313 | return; //Canceled! | 284 | return; //Canceled! |
314 | } | 285 | } |