diff options
-rw-r--r-- | indra/newview/llviewermenu.cpp | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 1bff04352c..fe82da960c 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3369,10 +3369,52 @@ class LLShowPanelPeopleTab : public view_listener_t { bool handleEvent(const LLSD& userdata) { + std::string panel_name = userdata.asString(); + // Open tab of the "People" panel in side tray. LLSD param; - param["people_panel_tab_name"] = userdata.asString(); - LLSideTray::getInstance()->showPanel("panel_people", param); + param["people_panel_tab_name"] = panel_name; + + static LLPanel* friends_panel = NULL; + static LLPanel* groups_panel = NULL; + static LLPanel* nearby_panel = NULL; + + if (panel_name == "friends_panel") + { + return togglePanel(friends_panel, param); + } + else if (panel_name == "groups_panel") + { + return togglePanel(groups_panel, param); + } + else if (panel_name == "nearby_panel") + { + return togglePanel(nearby_panel, param); + } + else + { + return false; + } + } + + static bool togglePanel(LLPanel* &panel, const LLSD& param) + { + if(!panel) + { + panel = LLSideTray::getInstance()->findChild<LLPanel>(param["people_panel_tab_name"].asString()); + if(!panel) + return false; + } + + if (panel->isInVisibleChain()) + { + LLSideTray::getInstance()->collapseSideBar(); + } + else + { + LLSideTray::getInstance()->showPanel("panel_people", param); + } + return true; } }; |