diff options
author | AlexanderP ProductEngine <apaschenko@productengine.com> | 2012-07-04 16:45:02 +0300 |
---|---|---|
committer | AlexanderP ProductEngine <apaschenko@productengine.com> | 2012-07-04 16:45:02 +0300 |
commit | 73ad740443e615467f7e14fe4fb3f04d8abe2f9c (patch) | |
tree | d3ddf32376a98163e88bf60a689501646b79ebab | |
parent | c76c73770bf1a4095100cdb79021826ebebbd2f0 (diff) |
CHUI-170 FIXED Save Torn off state of Nearby Chat between sessions
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | indra/newview/llimconversation.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llimconversation.h | 2 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llnearbychat.cpp | 27 | ||||
-rw-r--r-- | indra/newview/llnearbychat.h | 2 |
6 files changed, 41 insertions, 14 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4a586b02af..da3ff2d1ee 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1639,6 +1639,17 @@ <key>Value</key> <string /> </map> + <key>NearbyChatIsNotTornOff</key> + <map> + <key>Comment</key> + <string>saving torn-off state of the nearby chat between sessions</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>CloseChatOnReturn</key> <map> <key>Comment</key> diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index c855a844cf..3c6c5c3898 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -55,12 +55,6 @@ LLIMConversation::LLIMConversation(const LLUUID& session_id) { mCommitCallbackRegistrar.add("IMSession.Menu.Action", boost::bind(&LLIMConversation::onIMSessionMenuItemClicked, this, _2)); -// mCommitCallbackRegistrar.add("IMSession.ExpCollapseBtn.Click", -// boost::bind(&LLIMConversation::onSlide, this)); -// mCommitCallbackRegistrar.add("IMSession.CloseBtn.Click", -// boost::bind(&LLFloater::onClickClose, this)); - mCommitCallbackRegistrar.add("IMSession.TearOffBtn.Click", - boost::bind(&LLIMConversation::onTearOffClicked, this)); mEnableCallbackRegistrar.add("IMSession.Menu.CompactExpandedModes.CheckItem", boost::bind(&LLIMConversation::onIMCompactExpandedMenuItemCheck, this, _2)); mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.CheckItem", @@ -366,7 +360,7 @@ void LLIMConversation::onClose(bool app_quitting) void LLIMConversation::onTearOffClicked() { - onClickTearOff(this); + LLFloater::onClickTearOff(this); updateHeaderAndToolbar(); } diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index 50663137ac..682779a44b 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -78,7 +78,7 @@ protected: bool onIMShowModesMenuItemCheck(const LLSD& userdata); bool onIMShowModesMenuItemEnable(const LLSD& userdata); static void onSlide(LLIMConversation *self); - void onTearOffClicked(); + virtual void onTearOffClicked(); // refresh a visual state of the Call button void updateCallBtnState(bool callIsActive); diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 30a77bef98..546eccbd04 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -302,9 +302,8 @@ void LLIMFloaterContainer::setVisible(BOOL visible) if (visible) { // Make sure we have the Nearby Chat present when showing the conversation container - LLUUID nearbychat_uuid = LLUUID::null; // Hacky but true: the session id for nearby chat is always null - LLFloater* floaterp = findConversationItem(nearbychat_uuid); - if (floaterp == NULL) + LLFloater* nearby_chat = LLFloaterReg::findInstance("chat_bar"); + if (nearby_chat == NULL) { // If not found, force the creation of the nearby chat conversation panel // *TODO: find a way to move this to XML as a default panel or something like that diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 644304aff3..384762549a 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -345,15 +345,36 @@ void LLNearbyChat::enableDisableCallBtn() getChildView("voice_call_btn")->setEnabled(false /*btn_enabled*/); } +void LLNearbyChat::onTearOffClicked() +{ + LLIMConversation::onTearOffClicked(); + + LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); + + // see CHUI-170: Save torn-off state of the nearby chat between sessions + BOOL in_the_multifloater = (getHost() == im_box); + gSavedSettings.setBOOL("NearbyChatIsNotTornOff", in_the_multifloater); +} + void LLNearbyChat::addToHost() { - if (LLIMConversation::isChatMultiTab()) + if ( LLIMConversation::isChatMultiTab()) { LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); - if (im_box) { - im_box->addFloater(this, FALSE, LLTabContainer::END); + if (gSavedSettings.getBOOL("NearbyChatIsNotTornOff")) + { + im_box->addFloater(this, TRUE, LLTabContainer::END); + } + else + { + // setting of the "potential" host: this sequence sets + // LLFloater::mHostHandle = NULL (a current host), but + // LLFloater::mLastHostHandle = im_box (a "future" host) + setHost(im_box); + setHost(NULL); + } } } } diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 61404df942..90feb71488 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -101,6 +101,8 @@ protected: void onToggleNearbyChatPanel(); + /*virtual*/ void onTearOffClicked(); + static LLWString stripChannelNumber(const LLWString &mesg, S32* channel); EChatType processChatTypeTriggers(EChatType type, std::string &str); |