summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrew Dyukov <adyukov@productengine.com>2010-06-08 23:30:56 +0300
committerAndrew Dyukov <adyukov@productengine.com>2010-06-08 23:30:56 +0300
commitae43801f44d6c1c23bb6aea17452c7ddcdec65a3 (patch)
tree01903b18173c2dd878d60509019cffe34a364677 /indra
parent9382433931a9266bafa8dcd797d6f98cb80a7eaf (diff)
EXT-6655 Fixed Made the default busy message repsonse localizable with already existing account settings
- The root of busy response problem is that this text is located in non-localizable xml and, to make things worse, may be changed by user. So usual translation approach is little help here. So busy response was set the following way(EXT-5885)- on first run, string was written there from strings xml and was never changed later without direct user actions. So after changin locale message always remained the same. - To make this string localize each time locale is changed and if it is the same as default message, new setting was added- BusyResponseChanged which is TRUE if user's busy message differ's from default. If it is true, we do nothing when locale changes, otherwise we set default message from current locale as user's busy message. - Old transitional code from DEV-24146 was removed in this diff including unnecessary "BusyModeResponse2" setting(it is not needed because we'll anyway have to set busy message to default after first run of viewer after this fix and now busy response will be stored in "BusyModeResponse"). Warning! If user modified busy response message before this fix, it will be reset to default after first postfix run. Reviewed by Richard Linden at https://codereview.productengine.com/secondlife/r/350/ --HG-- branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/settings_per_account.xml14
-rw-r--r--indra/newview/llfloaterpreference.cpp57
-rw-r--r--indra/newview/llfloaterpreference.h7
-rw-r--r--indra/newview/llstartup.cpp3
-rw-r--r--indra/newview/llviewermessage.cpp4
-rw-r--r--indra/newview/llviewerwindow.cpp3
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_general.xml2
7 files changed, 64 insertions, 26 deletions
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index d4000e9253..dc76a4e518 100644
--- a/indra/newview/app_settings/settings_per_account.xml
+++ b/indra/newview/app_settings/settings_per_account.xml
@@ -1,26 +1,26 @@
<llsd>
<map>
- <key>BusyModeResponse</key>
+ <key>BusyResponseChanged</key>
<map>
<key>Comment</key>
- <string>Auto response to instant messages while in busy mode.</string>
+ <string>Does user's busy mode message differ from default?</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>String</string>
+ <string>Boolean</string>
<key>Value</key>
- <string>The Resident you messaged is in &apos;busy mode&apos; which means they have requested not to be disturbed. Your message will still be shown in their IM panel for later viewing.</string>
+ <integer>0</integer>
</map>
- <key>BusyModeResponse2</key>
+ <key>BusyModeResponse</key>
<map>
<key>Comment</key>
- <string>Auto response to instant messages while in busy mode, clean (unencoded) version of BusyModeResponse</string>
+ <string>Auto response to instant messages while in busy mode.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
- <string>|TOKEN COPY BusyModeResponse|</string>
+ <string>The Resident you messaged is in &apos;busy mode&apos; which means they have requested not to be disturbed. Your message will still be shown in their IM panel for later viewing.</string>
</map>
<key>InstantMessageLogPath</key>
<map>
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 5fbbb2c1a8..2299cd719c 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -330,9 +330,28 @@ BOOL LLFloaterPreference::postBuild()
std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
childSetText("cache_location", cache_location);
+ // if floater is opened before login set default localized busy message
+ if (LLStartUp::getStartupState() < STATE_STARTED)
+ {
+ gSavedPerAccountSettings.setString("BusyModeResponse", LLTrans::getString("BusyModeResponseDefault"));
+ }
+
return TRUE;
}
+void LLFloaterPreference::onBusyResponseChanged()
+{
+ // set "BusyResponseChanged" TRUE if user edited message differs from default, FALSE otherwise
+ if(LLTrans::getString("BusyModeResponseDefault") != getChild<LLUICtrl>("busy_response")->getValue().asString())
+ {
+ gSavedPerAccountSettings.setBOOL("BusyResponseChanged", TRUE );
+ }
+ else
+ {
+ gSavedPerAccountSettings.setBOOL("BusyResponseChanged", FALSE );
+ }
+}
+
LLFloaterPreference::~LLFloaterPreference()
{
// clean up user data
@@ -487,6 +506,22 @@ void LLFloaterPreference::cancel()
void LLFloaterPreference::onOpen(const LLSD& key)
{
+ // this variable and if that follows it are used to properly handle busy mode response message
+ static bool initialized = FALSE;
+ // if user is logged in and we haven't initialized busy_response yet, do it
+ if (!initialized && LLStartUp::getStartupState() == STATE_STARTED)
+ {
+ // Special approach is used for busy response localization, because "BusyModeResponse" is
+ // in non-localizable xml, and also because it may be changed by user and in this case it shouldn't be localized.
+ // To keep track of whether busy response is default or changed by user additional setting BusyResponseChanged
+ // was added into per account settings.
+
+ // initialization should happen once,so setting variable to TRUE
+ initialized = TRUE;
+ // this connection is needed to properly set "BusyResponseChanged" setting when user makes changes in
+ // busy response message.
+ gSavedPerAccountSettings.getControl("BusyModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onBusyResponseChanged, this));
+ }
gAgent.sendAgentUserInfoRequest();
/////////////////////////// From LLPanelGeneral //////////////////////////
@@ -540,6 +575,16 @@ void LLFloaterPreference::onVertexShaderEnable()
refreshEnabledGraphics();
}
+//static
+void LLFloaterPreference::initBusyResponse()
+ {
+ if (!gSavedPerAccountSettings.getBOOL("BusyResponseChanged"))
+ {
+ //LLTrans::getString("BusyModeResponseDefault") is used here for localization (EXT-5885)
+ gSavedPerAccountSettings.setString("BusyModeResponse", LLTrans::getString("BusyModeResponseDefault"));
+ }
+ }
+
void LLFloaterPreference::setHardwareDefaults()
{
LLFeatureManager::getInstance()->applyRecommendedSettings();
@@ -960,18 +1005,6 @@ void LLFloaterPreference::onChangeQuality(const LLSD& data)
refresh();
}
-// static
-// DEV-24146 - needs to be removed at a later date. jan-2009
-void LLFloaterPreference::cleanupBadSetting()
-{
- if (gSavedPerAccountSettings.getString("BusyModeResponse2") == "|TOKEN COPY BusyModeResponse|")
- {
- llinfos << "cleaning old BusyModeResponse" << llendl;
- //LLTrans::getString("BusyModeResponseDefault") is used here for localization (EXT-5885)
- gSavedPerAccountSettings.setString("BusyModeResponse2", LLTrans::getString("BusyModeResponseDefault"));
- }
-}
-
void LLFloaterPreference::onClickSetKey()
{
LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance<LLVoiceSetKeyDialog>("voice_set_key", LLSD(), TRUE);
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 71aa5d3189..b45e09db7d 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -80,6 +80,9 @@ public:
// refresh all the graphics preferences menus
static void refreshEnabledGraphics();
+ // translate user's busy response message according to current locale if message is default, otherwise do nothing
+ static void initBusyResponse();
+
protected:
void onBtnOK();
void onBtnCancel();
@@ -87,6 +90,9 @@ protected:
void onClickBrowserClearCache();
+ // set value of "BusyResponseChanged" in account settings depending on whether busy response
+ // string differs from default after user changes.
+ void onBusyResponseChanged();
// if the custom settings box is clicked
void onChangeCustom();
void updateMeterText(LLUICtrl* ctrl);
@@ -140,7 +146,6 @@ public:
void buildPopupLists();
static void refreshSkin(void* data);
- static void cleanupBadSetting();
private:
static std::string sSkin;
bool mGotPersonalInfo;
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index e51e6363dd..fff80e57dc 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -781,9 +781,6 @@ bool idle_startup()
gViewerWindow->getWindow()->show();
display_startup();
- //DEV-10530. do cleanup. remove at some later date. jan-2009
- LLFloaterPreference::cleanupBadSetting();
-
// DEV-16927. The following code removes errant keystrokes that happen while the window is being
// first made visible.
#ifdef _WIN32
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 5836aff4e7..b00fa39815 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2063,7 +2063,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
// initiated by the other party) then...
std::string my_name;
LLAgentUI::buildFullname(my_name);
- std::string response = gSavedPerAccountSettings.getString("BusyModeResponse2");
+ std::string response = gSavedPerAccountSettings.getString("BusyModeResponse");
pack_instant_message(
gMessageSystem,
gAgent.getID(),
@@ -2736,7 +2736,7 @@ void busy_message (LLMessageSystem* msg, LLUUID from_id)
{
std::string my_name;
LLAgentUI::buildFullname(my_name);
- std::string response = gSavedPerAccountSettings.getString("BusyModeResponse2");
+ std::string response = gSavedPerAccountSettings.getString("BusyModeResponse");
pack_instant_message(
gMessageSystem,
gAgent.getID(),
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 83556452c0..0a65cb7330 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1591,6 +1591,9 @@ void LLViewerWindow::initBase()
gDebugView->init();
gToolTipView = getRootView()->getChild<LLToolTipView>("tooltip view");
+ // Initialize busy response message when logged in
+ LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLFloaterPreference::initBusyResponse));
+
// Add the progress bar view (startup view), which overrides everything
mProgressView = getRootView()->getChild<LLProgressView>("progress_view");
setShowProgress(FALSE);
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml
index 1c68d59993..a69e8d29b0 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml
@@ -348,7 +348,7 @@
Busy mode response:
</text>
<text_editor
- control_name="BusyModeResponse2"
+ control_name="BusyModeResponse"
text_readonly_color="LabelDisabledColor"
bg_writeable_color="LtGray"
use_ellipses="false"