summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llpanelme.cpp47
-rw-r--r--indra/newview/llpanelme.h1
-rw-r--r--indra/newview/llpanelpeople.cpp27
-rw-r--r--indra/newview/llpanelpeople.h4
-rw-r--r--indra/newview/llpanelprofile.cpp18
-rw-r--r--indra/newview/llpanelprofile.h2
-rw-r--r--indra/newview/llpanelprofileview.cpp4
-rw-r--r--indra/newview/llpanelprofileview.h2
-rw-r--r--indra/newview/llsidetray.cpp39
9 files changed, 90 insertions, 54 deletions
diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp
index e12da97f3b..046118cf75 100644
--- a/indra/newview/llpanelme.cpp
+++ b/indra/newview/llpanelme.cpp
@@ -38,6 +38,7 @@
#include "llagent.h"
#include "llagentwearables.h"
#include "lliconctrl.h"
+#include "llsidetray.h"
#include "lltabcontainer.h"
#include "lltexturectrl.h"
@@ -70,6 +71,45 @@ void LLPanelMe::onOpen(const LLSD& key)
LLPanelProfile::onOpen(key);
}
+void LLPanelMe::notifyChildren(const LLSD& info)
+{
+ if (info.has("task-panel-action") && info["task-panel-action"].asString() == "handle-tri-state")
+ {
+ // Implement task panel tri-state behavior.
+ //
+ // When the button of an active open task panel is clicked, side tray
+ // calls notifyChildren() on the panel, passing task-panel-action=>handle-tri-state as an argument.
+ // The task panel is supposed to handle this by reverting to the default view,
+ // i.e. closing any dependent panels like "pick info" or "profile edit".
+
+ bool on_default_view = true;
+
+ const LLRect& task_panel_rect = getRect();
+ for (LLView* child = getFirstChild(); child; child = findNextSibling(child))
+ {
+ LLPanel* panel = dynamic_cast<LLPanel*>(child);
+ if (!panel)
+ continue;
+
+ // *HACK: implement panel stack instead (e.g. me->pick_info->pick_edit).
+ if (panel->getRect().getWidth() == task_panel_rect.getWidth() &&
+ panel->getRect().getHeight() == task_panel_rect.getHeight() &&
+ panel->getVisible())
+ {
+ panel->setVisible(FALSE);
+ on_default_view = false;
+ }
+ }
+
+ if (on_default_view)
+ LLSideTray::getInstance()->collapseSideBar();
+
+ return; // this notification is only supposed to be handled by task panels
+ }
+
+ LLPanel::notifyChildren(info);
+}
+
void LLPanelMe::buildEditPanel()
{
if (NULL == mEditPanel)
@@ -84,8 +124,7 @@ void LLPanelMe::buildEditPanel()
void LLPanelMe::onEditProfileClicked()
{
buildEditPanel();
- togglePanel(mEditPanel);
- mEditPanel->onOpen(getAvatarId());
+ togglePanel(mEditPanel, getAvatarId()); // open
}
void LLPanelMe::onEditAppearanceClicked()
@@ -108,13 +147,13 @@ void LLPanelMe::onSaveChangesClicked()
data.allow_publish = mEditPanel->childGetValue("show_in_search_checkbox");
LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate(&data);
- togglePanel(mEditPanel);
+ togglePanel(mEditPanel); // close
onOpen(getAvatarId());
}
void LLPanelMe::onCancelClicked()
{
- togglePanel(mEditPanel);
+ togglePanel(mEditPanel); // close
}
//////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llpanelme.h b/indra/newview/llpanelme.h
index e16532a445..17d367132e 100644
--- a/indra/newview/llpanelme.h
+++ b/indra/newview/llpanelme.h
@@ -54,6 +54,7 @@ public:
LLPanelMe();
/*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void notifyChildren(const LLSD& info);
/*virtual*/ BOOL postBuild();
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 4dc8872557..2ccd10a065 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -56,6 +56,8 @@
#include "llgrouplist.h"
#include "llinventoryobserver.h"
#include "llpanelpeoplemenus.h"
+#include "llsidetray.h"
+#include "llsidetraypanelcontainer.h"
#include "llrecentpeople.h"
#include "llviewercontrol.h" // for gSavedSettings
#include "llviewermenu.h" // for gMenuHolder
@@ -1263,6 +1265,31 @@ void LLPanelPeople::onOpen(const LLSD& key)
reSelectedCurrentTab();
}
+void LLPanelPeople::notifyChildren(const LLSD& info)
+{
+ if (info.has("task-panel-action") && info["task-panel-action"].asString() == "handle-tri-state")
+ {
+ LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(getParent());
+ if (!container)
+ {
+ llwarns << "Cannot find People panel container" << llendl;
+ return;
+ }
+
+ if (container->getCurrentPanelIndex() > 0)
+ {
+ // if not on the default panel, switch to it
+ container->onOpen(LLSD().insert(LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME, getName()));
+ }
+ else
+ LLSideTray::getInstance()->collapseSideBar();
+
+ return; // this notification is only supposed to be handled by task panels
+ }
+
+ LLPanel::notifyChildren(info);
+}
+
void LLPanelPeople::showAccordion(const std::string name, bool show)
{
if(name.empty())
diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h
index a369bcd3e2..d9dd76f3ac 100644
--- a/indra/newview/llpanelpeople.h
+++ b/indra/newview/llpanelpeople.h
@@ -50,8 +50,8 @@ public:
virtual ~LLPanelPeople();
/*virtual*/ BOOL postBuild();
-
- virtual void onOpen(const LLSD& key);
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void notifyChildren(const LLSD& info);
// internals
class Updater;
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 02f45c1b48..4d152a13f3 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -158,28 +158,14 @@ void LLPanelProfile::onOpen(const LLSD& key)
}
//*TODO redo panel toggling
-void LLPanelProfile::togglePanel(LLPanel* panel)
+void LLPanelProfile::togglePanel(LLPanel* panel, const LLSD& key)
{
// TRUE - we need to open/expand "panel"
bool expand = getChildList()->front() != panel; // mTabCtrl->getVisible();
if (expand)
{
- if (panel->getParent() != this)
- {
- addChild(panel);
- }
- else
- {
- sendChildToFront(panel);
- }
-
- panel->setVisible(TRUE);
-
- LLRect new_rect = getRect();
- panel->reshape(new_rect.getWidth(), new_rect.getHeight());
- new_rect.setLeftTopAndSize(0, new_rect.getHeight(), new_rect.getWidth(), new_rect.getHeight());
- panel->setRect(new_rect);
+ openPanel(panel, key);
}
else
{
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index e216eb70f2..067beb248b 100644
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -51,7 +51,7 @@ public:
/*virtual*/ void onOpen(const LLSD& key);
- virtual void togglePanel(LLPanel*);
+ virtual void togglePanel(LLPanel*, const LLSD& key = LLSD());
virtual void openPanel(LLPanel* panel, const LLSD& params);
diff --git a/indra/newview/llpanelprofileview.cpp b/indra/newview/llpanelprofileview.cpp
index d4ab5013f9..08aea8cfd8 100644
--- a/indra/newview/llpanelprofileview.cpp
+++ b/indra/newview/llpanelprofileview.cpp
@@ -193,8 +193,10 @@ void LLPanelProfileView::onAvatarNameCached(const LLUUID& id, const std::string&
getChild<LLTextBox>("user_name", FALSE)->setValue(first_name + " " + last_name);
}
-void LLPanelProfileView::togglePanel(LLPanel* panel)
+void LLPanelProfileView::togglePanel(LLPanel* panel, const LLSD& key)
{
+ // *TODO: unused method?
+
LLPanelProfile::togglePanel(panel);
if(FALSE == panel->getVisible())
{
diff --git a/indra/newview/llpanelprofileview.h b/indra/newview/llpanelprofileview.h
index 45c2fc116e..5dc617d4a0 100644
--- a/indra/newview/llpanelprofileview.h
+++ b/indra/newview/llpanelprofileview.h
@@ -64,7 +64,7 @@ public:
/*virtual*/ BOOL postBuild();
- /*virtual*/ void togglePanel(LLPanel* panel);
+ /*virtual*/ void togglePanel(LLPanel* panel, const LLSD& key = LLSD());
BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
BOOL drop, EDragAndDropType cargo_type,
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp
index 7711f3c733..0b832a8239 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -435,35 +435,16 @@ void LLSideTray::processTriState ()
expandSideBar();
else
{
- //!!!!!!!!!!!!!!!!!
- //** HARDCODED!!!!!
- //!!!!!!!!!!!!!!!!!
-
- //there is no common way to determine "default" panel for tab
- //so default panels for now will be hardcoded
-
- //hardcoded for people tab and profile tab
-
- /*if(mActiveTab == getTab("sidebar_people"))
- {
- LLSideTrayPanelContainer* container = findChild<LLSideTrayPanelContainer>("panel_container");
- if(container && container->getCurrentPanelIndex()>0)
- {
- container->onOpen(LLSD().insert("sub_panel_name","panel_people"));
- }
- else
- collapseSideBar();
- }
- else if(mActiveTab == getTab("sidebar_me"))
- {
- LLTabContainer* tab_container = findChild<LLTabContainer>("tabs");
- if(tab_container && tab_container->getCurrentPanelIndex()>0)
- tab_container->selectFirstTab();
- else
- collapseSideBar();
- }
- else*/
- collapseSideBar();
+#if 0 // *TODO: EXT-2092
+
+ // Tell the active task panel to switch to its default view
+ // or collapse side tray if already on the default view.
+ LLSD info;
+ info["task-panel-action"] = "handle-tri-state";
+ mActiveTab->notifyChildren(info);
+#else
+ collapseSideBar();
+#endif
}
}