summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelgroup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelgroup.cpp')
-rw-r--r--indra/newview/llpanelgroup.cpp660
1 files changed, 241 insertions, 419 deletions
diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp
index d9d796fd9e..4cbb018ce9 100644
--- a/indra/newview/llpanelgroup.cpp
+++ b/indra/newview/llpanelgroup.cpp
@@ -33,12 +33,7 @@
#include "llpanelgroup.h"
-#include "llagent.h"
#include "llbutton.h"
-#include "llpanelgroupgeneral.h"
-#include "llpanelgrouproles.h"
-#include "llpanelgrouplandmoney.h"
-#include "llpanelgroupnotices.h"
#include "lltabcontainer.h"
#include "lltextbox.h"
#include "llviewermessage.h"
@@ -46,17 +41,31 @@
#include "llviewerwindow.h"
#include "llappviewer.h"
#include "llnotifications.h"
+#include "llfloaterreg.h"
+#include "llfloater.h"
+
+#include "llsidetraypanelcontainer.h"
+
+#include "llpanelgroupnotices.h"
+#include "llpanelgroupgeneral.h"
+
+#include "llsidetray.h"
+#include "llaccordionctrltab.h"
-// static
-void* LLPanelGroupTab::createTab(void* data)
+static LLRegisterPanelClassWrapper<LLPanelGroup> t_panel_group("panel_group_info_sidetray");
+
+
+
+LLPanelGroupTab::LLPanelGroupTab()
+ : LLPanel(),
+ mAllowEdit(TRUE),
+ mHasModal(FALSE)
{
- LLUUID* group_id = static_cast<LLUUID*>(data);
- return new LLPanelGroupTab("panel group tab", *group_id);
+ mGroupID = LLUUID::null;
}
LLPanelGroupTab::~LLPanelGroupTab()
{
- mObservers.clear();
}
BOOL LLPanelGroupTab::isVisibleByAgent(LLAgent* agentp)
@@ -67,48 +76,10 @@ BOOL LLPanelGroupTab::isVisibleByAgent(LLAgent* agentp)
BOOL LLPanelGroupTab::postBuild()
{
- // Hook up the help button callback.
- LLButton* button = getChild<LLButton>("help_button");
- if (button)
- {
- button->setClickedCallback(onClickHelp);
- button->setCallbackUserData(this);
- }
-
- mHelpText = getString("help_text");
return TRUE;
}
-void LLPanelGroupTab::addObserver(LLPanelGroupTabObserver *obs)
-{
- mObservers.insert(obs);
-}
-void LLPanelGroupTab::removeObserver(LLPanelGroupTabObserver *obs)
-{
- mObservers.erase(obs);
-}
-
-void LLPanelGroupTab::notifyObservers()
-{
-
- for (observer_list_t::iterator iter = mObservers.begin();
- iter != mObservers.end(); )
- {
- LLPanelGroupTabObserver* observer = *iter;
- observer->tabChanged();
-
- // safe way to incrament since changed may delete entries! (@!##%@!@&*!)
- iter = mObservers.upper_bound(observer);
- }
-}
-
-// static
-void LLPanelGroupTab::onClickHelp(void* user_data)
-{
- LLPanelGroupTab* self = static_cast<LLPanelGroupTab*>(user_data);
- self->handleClickHelp();
-}
void LLPanelGroupTab::handleClickHelp()
{
@@ -125,450 +96,281 @@ void LLPanelGroupTab::handleClickHelp()
}
}
-LLPanelGroup::LLPanelGroup(const std::string& filename,
- const std::string& name,
- const LLUUID& group_id,
- const std::string& initial_tab_selected)
-: LLPanel(name, LLRect(), FALSE),
- LLGroupMgrObserver( group_id ),
- mCurrentTab( NULL ),
- mRequestedTab( NULL ),
- mTabContainer( NULL ),
- mIgnoreTransition( FALSE ),
- mForceClose( FALSE ),
- mInitialTab(initial_tab_selected),
- mAllowEdit( TRUE ),
- mShowingNotifyDialog( FALSE )
+LLPanelGroup::LLPanelGroup()
+: LLPanel()
+ ,LLGroupMgrObserver( LLUUID() )
+ ,mAllowEdit(TRUE)
{
// Set up the factory callbacks.
- mFactoryMap["general_tab"] = LLCallbackMap(LLPanelGroupGeneral::createTab,
- &mID);
- mFactoryMap["roles_tab"] = LLCallbackMap(LLPanelGroupRoles::createTab,
- &mID);
- mFactoryMap["notices_tab"] = LLCallbackMap(LLPanelGroupNotices::createTab,
- &mID);
- mFactoryMap["land_money_tab"]= LLCallbackMap(LLPanelGroupLandMoney::createTab,
- &mID);
// Roles sub tabs
- mFactoryMap["members_sub_tab"] = LLCallbackMap(LLPanelGroupMembersSubTab::createTab, &mID);
- mFactoryMap["roles_sub_tab"] = LLCallbackMap(LLPanelGroupRolesSubTab::createTab, &mID);
- mFactoryMap["actions_sub_tab"] = LLCallbackMap(LLPanelGroupActionsSubTab::createTab, &mID);
-
LLGroupMgr::getInstance()->addObserver(this);
- // Pass on construction of this panel to the control factory.
- LLUICtrlFactory::getInstance()->buildPanel(this, filename, &getFactoryMap());
- mFilename = filename;
}
+
LLPanelGroup::~LLPanelGroup()
{
LLGroupMgr::getInstance()->removeObserver(this);
-
- int i;
- int tab_count = mTabContainer->getTabCount();
-
- for (i = tab_count - 1; i >=0; --i)
- {
- LLPanelGroupTab* panelp =
- (LLPanelGroupTab*) mTabContainer->getPanelByIndex(i);
-
- if ( panelp ) panelp->removeObserver(this);
- }
}
-void LLPanelGroup::updateTabVisibility()
+void LLPanelGroup::onOpen(const LLSD& key)
{
- S32 i;
- S32 tab_count = mTabContainer->getTabCount();
-
- for (i = tab_count - 1; i >=0; --i)
+ if(!key.has("group_id"))
+ return;
+
+ LLUUID group_id = key["group_id"];
+ if(!key.has("action"))
{
- LLPanelGroupTab* panelp =
- (LLPanelGroupTab*) mTabContainer->getPanelByIndex(i);
+ setGroupID(group_id);
+ return;
+ }
- BOOL visible = panelp->isVisibleByAgent(&gAgent) || gAgent.isGodlike();
- mTabContainer->enableTabButton(i, visible);
+ std::string str_action = key["action"];
- if ( !visible && mCurrentTab == panelp )
- {
- //we are disabling the currently selected tab
- //select the previous one
- mTabContainer->selectPrevTab();
- mCurrentTab =
- (LLPanelGroupTab*) mTabContainer->getCurrentPanel();
- }
+ if(str_action == "refresh")
+ {
+ if(mID == group_id || group_id == LLUUID::null)
+ refreshData();
+ }
+ else if(str_action == "close")
+ {
+ onBackBtnClick();
+ }
+ else if(str_action == "create")
+ {
+ setGroupID(LLUUID::null);
+ }
+ else if(str_action == "refresh_notices")
+ {
+ LLPanelGroupNotices* panel_notices = findChild<LLPanelGroupNotices>("group_notices_tab_panel");
+ if(panel_notices)
+ panel_notices->refreshNotices();
}
-}
-
+}
BOOL LLPanelGroup::postBuild()
{
- mTabContainer = getChild<LLTabContainer>("group_tab_container");
+ mDefaultNeedsApplyMesg = getString("default_needs_apply_text");
+ mWantApplyMesg = getString("want_apply_text");
- if (mTabContainer)
- {
- // Select the initial tab specified via constructor
- const BOOL recurse = TRUE;
- LLPanelGroupTab* tabp =
- getChild<LLPanelGroupTab>(mInitialTab, recurse);
+ LLButton* button;
- if (!tabp)
- {
- //our initial tab selection was invalid, just select the
- //first tab then or default to selecting the initial
- //selected tab specified in the layout file
- tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel();
-
- //no tab was initially selected through constructor
- //or the XML, select the first tab
- if (!tabp)
- {
- mTabContainer->selectFirstTab();
- tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel();
- }
- }
- else
- {
- mTabContainer->selectTabPanel(tabp);
- }
-
- mCurrentTab = tabp;
+ button = getChild<LLButton>("btn_apply");
+ button->setClickedCallback(onBtnApply, this);
+ button->setVisible(true);
+ button->setEnabled(false);
- // Add click callbacks.
- S32 i;
- S32 tab_count = mTabContainer->getTabCount();
- for (i = tab_count - 1; i >=0; --i)
- {
- LLPanel* tab_panel = mTabContainer->getPanelByIndex(i);
- LLPanelGroupTab* panelp =(LLPanelGroupTab*)tab_panel; // bit of a hack
+ button = getChild<LLButton>("btn_refresh");
+ button->setClickedCallback(onBtnRefresh, this);
+ button->setVisible(mAllowEdit);
- // Pass on whether or not to allow edit to tabs.
- panelp->setAllowEdit(mAllowEdit);
- panelp->addObserver(this);
+ getChild<LLButton>("btn_create")->setVisible(false);
- mTabContainer->setTabChangeCallback(panelp, onClickTab);
- mTabContainer->setTabUserData(panelp, this);
- }
- updateTabVisibility();
+ childSetCommitCallback("btn_create",boost::bind(&LLPanelGroup::onBtnCreate,this),NULL);
+ childSetCommitCallback("back",boost::bind(&LLPanelGroup::onBackBtnClick,this),NULL);
- // Act as though this tab was just activated.
- mCurrentTab->activate();
- }
+ LLPanelGroupTab* panel_general = findChild<LLPanelGroupTab>("group_general_tab_panel");
+ LLPanelGroupTab* panel_roles = findChild<LLPanelGroupTab>("group_roles_tab_panel");
+ LLPanelGroupTab* panel_notices = findChild<LLPanelGroupTab>("group_notices_tab_panel");
+ LLPanelGroupTab* panel_land = findChild<LLPanelGroupTab>("group_land_tab_panel");
- mDefaultNeedsApplyMesg = getString("default_needs_apply_text");
- mWantApplyMesg = getString("want_apply_text");
+ if(panel_general) mTabs.push_back(panel_general);
+ if(panel_roles) mTabs.push_back(panel_roles);
+ if(panel_notices) mTabs.push_back(panel_notices);
+ if(panel_land) mTabs.push_back(panel_land);
- LLButton* button = getChild<LLButton>("btn_ok");
- if (button)
- {
- button->setClickedCallback(onBtnOK);
- button->setCallbackUserData(this);
- button->setVisible(mAllowEdit);
- }
+ panel_general->setupCtrls(this);
- button = getChild<LLButton>("btn_cancel");
- if (button)
+ return TRUE;
+}
+
+void LLPanelGroup::reshape(S32 width, S32 height, BOOL called_from_parent )
+{
+ LLPanel::reshape(width, height, called_from_parent );
+
+ LLRect btn_rect;
+
+ LLButton* button = findChild<LLButton>("btn_apply");
+ if(button)
{
- button->setClickedCallback(onBtnCancel);
- button->setCallbackUserData(this);
- button->setVisible(mAllowEdit);
+ btn_rect = button->getRect();
+ btn_rect.setLeftTopAndSize( btn_rect.mLeft, btn_rect.getHeight() + 2, btn_rect.getWidth(), btn_rect.getHeight());
+ button->setRect(btn_rect);
}
- button = getChild<LLButton>("btn_apply");
- if (button)
+ button = findChild<LLButton>("btn_create");
+ if(button)
{
- button->setClickedCallback(onBtnApply);
- button->setVisible(mAllowEdit);
- button->setEnabled(FALSE);
-
- mApplyBtn = button;
+ btn_rect = button->getRect();
+ btn_rect.setLeftTopAndSize( btn_rect.mLeft, btn_rect.getHeight() + 2, btn_rect.getWidth(), btn_rect.getHeight());
+ button->setRect(btn_rect);
}
- button = getChild<LLButton>("btn_refresh");
- if (button)
+
+ button = findChild<LLButton>("btn_refresh");
+ if(button)
{
- button->setClickedCallback(onBtnRefresh);
- button->setCallbackUserData(this);
- button->setVisible(mAllowEdit);
+ btn_rect = button->getRect();
+ btn_rect.setLeftTopAndSize( btn_rect.mLeft, btn_rect.getHeight() + 2, btn_rect.getWidth(), btn_rect.getHeight());
+ button->setRect(btn_rect);
}
-
- return TRUE;
}
-void LLPanelGroup::changed(LLGroupChange gc)
+void LLPanelGroup::onBackBtnClick()
{
- updateTabVisibility();
- // Notify the currently active panel that group manager information has changed.
- LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel();
-
- if (panelp)
+ LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent());
+ if(parent)
{
- panelp->update(gc);
+ parent->openPreviousPanel();
}
}
-// PanelGroupTab observer trigger
-void LLPanelGroup::tabChanged()
+void LLPanelGroup::onBtnCreate()
{
- //some tab information has changed,....enable/disable the apply button
- //based on if they need an apply
- if ( mApplyBtn )
- {
- std::string mesg;
- mApplyBtn->setEnabled(mCurrentTab->needsApply(mesg));
- }
+ LLPanelGroupGeneral* panel_general = findChild<LLPanelGroupGeneral>("group_general_tab_panel");
+ if(!panel_general)
+ return;
+ std::string apply_mesg;
+ panel_general->apply(apply_mesg);//yes yes you need to call apply to create...
}
-// static
-void LLPanelGroup::onClickTab(void* user_data, bool from_click)
+void LLPanelGroup::onBtnRefresh(void* user_data)
{
LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
- self->handleClickTab();
+ self->refreshData();
}
-void LLPanelGroup::handleClickTab()
+void LLPanelGroup::onBtnApply(void* user_data)
{
- // If we are already handling a transition,
- // ignore this.
- if (mIgnoreTransition)
- {
- return;
- }
+ LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
+ self->apply();
+}
- mRequestedTab = (LLPanelGroupTab*) mTabContainer->getCurrentPanel();
- // Make sure they aren't just clicking the same tab...
- if (mRequestedTab == mCurrentTab)
- {
- return;
- }
+void LLPanelGroup::changed(LLGroupChange gc)
+{
+ for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
+ (*it)->update(gc);
- // Try to switch from the current panel to the panel the user selected.
- attemptTransition();
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
+ if(gdatap)
+ childSetValue("group_name", gdatap->mName);
}
-void LLPanelGroup::setGroupID(const LLUUID& group_id)
+void LLPanelGroup::notifyObservers()
{
- LLRect rect(getRect());
+ for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
+ (*it)->update(GC_ALL);
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
+ if(gdatap)
+ childSetValue("group_name", gdatap->mName);
+
+}
+
+
+
+void LLPanelGroup::setGroupID(const LLUUID& group_id)
+{
LLGroupMgr::getInstance()->removeObserver(this);
mID = group_id;
LLGroupMgr::getInstance()->addObserver(this);
- //TODO: this is really bad, we should add a method
- // where the panels can just update themselves
- // on a group id change. Similar to update() but with a group
- // id change.
-
- // For now, rebuild panel
- //delete children and rebuild panel
- deleteAllChildren();
- LLUICtrlFactory::getInstance()->buildPanel(this, mFilename, &getFactoryMap());
-}
-void LLPanelGroup::selectTab(std::string tab_name)
-{
- const BOOL recurse = TRUE;
+ for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
+ (*it)->setGroupID(group_id);
- LLPanelGroupTab* tabp =
- getChild<LLPanelGroupTab>(tab_name, recurse);
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
+ if(gdatap)
+ childSetValue("group_name", gdatap->mName);
- if ( tabp && mTabContainer )
- {
- mTabContainer->selectTabPanel(tabp);
- onClickTab(this, false);
- }
-}
+ LLButton* button_apply = findChild<LLButton>("btn_apply");
+ LLButton* button_refresh = findChild<LLButton>("btn_refresh");
+ LLButton* button_create = findChild<LLButton>("btn_create");
-BOOL LLPanelGroup::canClose()
-{
- if (mShowingNotifyDialog) return FALSE;
- if (mCurrentTab && mCurrentTab->hasModal()) return FALSE;
- if (mForceClose || !mAllowEdit) return TRUE;
- // Try to switch from the current panel to nothing, indicating a close action.
- mRequestedTab = NULL;
- return attemptTransition();
-}
+ bool is_null_group_id = group_id == LLUUID::null;
+ if(button_apply)
+ button_apply->setVisible(!is_null_group_id);
+ if(button_refresh)
+ button_refresh->setVisible(!is_null_group_id);
+ if(button_create)
+ button_create->setVisible(is_null_group_id);
-BOOL LLPanelGroup::attemptTransition()
-{
- // Check if the current tab needs to be applied.
- std::string mesg;
- if (mCurrentTab && mCurrentTab->needsApply(mesg))
+ LLAccordionCtrlTab* tab_general = findChild<LLAccordionCtrlTab>("group_general_tab");
+ LLAccordionCtrlTab* tab_roles = findChild<LLAccordionCtrlTab>("group_roles_tab");
+ LLAccordionCtrlTab* tab_notices = findChild<LLAccordionCtrlTab>("group_notices_tab");
+ LLAccordionCtrlTab* tab_land = findChild<LLAccordionCtrlTab>("group_land_tab");
+
+ if(!tab_general || !tab_roles || !tab_notices || !tab_land)
+ return;
+
+ if(is_null_group_id)//creating new group
{
- // If no message was provided, give a generic one.
- if (mesg.empty())
- {
- mesg = mDefaultNeedsApplyMesg;
- }
- // Create a notify box, telling the user about the unapplied tab.
- LLSD args;
- args["NEEDS_APPLY_MESSAGE"] = mesg;
- args["WANT_APPLY_MESSAGE"] = mWantApplyMesg;
- LLNotifications::instance().add("PanelGroupApply", args, LLSD(),
- boost::bind(&LLPanelGroup::handleNotifyCallback, this, _1, _2));
- mShowingNotifyDialog = TRUE;
+ if(!tab_general->getDisplayChildren())
+ tab_general->changeOpenClose(tab_general->getDisplayChildren());
- // We need to reselect the current tab, since it isn't finished.
- if (mTabContainer)
- {
- // selectTabPanel is going to trigger another
- // click event. We want to ignore it so that
- // mRequestedTab is not updated.
- mIgnoreTransition = TRUE;
- mTabContainer->selectTabPanel( mCurrentTab );
- mIgnoreTransition = FALSE;
- }
- // Returning FALSE will block a close action from finishing until
- // we get a response back from the user.
- return FALSE;
+ if(tab_roles->getDisplayChildren())
+ tab_roles->changeOpenClose(tab_roles->getDisplayChildren());
+ if(tab_notices->getDisplayChildren())
+ tab_notices->changeOpenClose(tab_notices->getDisplayChildren());
+ if(tab_land->getDisplayChildren())
+ tab_land->changeOpenClose(tab_land->getDisplayChildren());
+
+ tab_roles->canOpenClose(false);
+ tab_notices->canOpenClose(false);
+ tab_land->canOpenClose(false);
}
else
{
- // The current panel didn't have anything it needed to apply.
- if ( mRequestedTab )
- {
- transitionToTab();
- }
- // Returning TRUE will allow any close action to proceed.
- return TRUE;
- }
-}
-
-void LLPanelGroup::transitionToTab()
-{
- // Tell the current panel that it is being deactivated.
- if (mCurrentTab)
- {
- mCurrentTab->deactivate();
- }
-
- // If the requested panel exists, activate it.
- if (mRequestedTab)
- {
- // This is now the current tab;
- mCurrentTab = mRequestedTab;
- mCurrentTab->activate();
- }
- else // NULL requested indicates a close action.
- {
- close();
- }
-}
-
-bool LLPanelGroup::handleNotifyCallback(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotification::getSelectedOption(notification, response);
- mShowingNotifyDialog = FALSE;
- switch (option)
- {
- case 0: // "Apply Changes"
- // Try to apply changes, and switch to the requested tab.
- if ( !apply() )
- {
- // There was a problem doing the apply.
- // Skip switching tabs.
- break;
- }
-
- // This panel's info successfully applied.
- // Switch to the next panel.
- mIgnoreTransition = TRUE;
- mTabContainer->selectTabPanel( mRequestedTab );
- mIgnoreTransition = FALSE;
- transitionToTab();
- break;
- case 1: // "Ignore Changes"
- // Switch to the requested panel without applying changes
- // (Changes may already have been applied in the previous block)
- mCurrentTab->cancel();
- mIgnoreTransition = TRUE;
- mTabContainer->selectTabPanel( mRequestedTab );
- mIgnoreTransition = FALSE;
- transitionToTab();
- break;
- case 2: // "Cancel"
- default:
- // Do nothing. The user is canceling the action.
- // If we were quitting, we didn't really mean it.
- LLAppViewer::instance()->abortQuit();
- break;
+ if(!tab_general->getDisplayChildren())
+ tab_general->changeOpenClose(tab_general->getDisplayChildren());
+ if(!tab_roles->getDisplayChildren())
+ tab_roles->changeOpenClose(tab_roles->getDisplayChildren());
+ if(!tab_notices->getDisplayChildren())
+ tab_notices->changeOpenClose(tab_notices->getDisplayChildren());
+ if(!tab_land->getDisplayChildren())
+ tab_land->changeOpenClose(tab_land->getDisplayChildren());
+
+ tab_roles->canOpenClose(true);
+ tab_notices->canOpenClose(true);
+ tab_land->canOpenClose(true);
}
- return false;
}
-// static
-void LLPanelGroup::onBtnOK(void* user_data)
+bool LLPanelGroup::apply(LLPanelGroupTab* tab)
{
- LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
- // If we are able to apply changes, then close.
- if(self->apply())
- {
- self->close();
- }
-}
+ if(!tab)
+ return false;
-// static
-void LLPanelGroup::onBtnCancel(void* user_data)
-{
- LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
- self->close();
-}
-
-// static
-void LLPanelGroup::onBtnApply(void* user_data)
-{
- LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
- self->apply();
-}
-
-bool LLPanelGroup::apply()
-{
- // Pass this along to the currently visible tab.
- if (!mTabContainer) return false;
-
- LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel();
- if (!panelp) return false;
-
std::string mesg;
- if ( !panelp->needsApply(mesg) )
- {
- // We don't need to apply anything.
- // We're done.
+ if ( !tab->needsApply(mesg) )
return true;
- }
-
- // Ignore the needs apply message.
- // Try to do the actual apply.
+
std::string apply_mesg;
- if ( panelp->apply( apply_mesg ) )
- {
- // Everything worked. We're done.
+ if(tab->apply( apply_mesg ) )
return true;
- }
-
- // There was a problem doing the actual apply.
- // Inform the user.
+
if ( !apply_mesg.empty() )
{
LLSD args;
args["MESSAGE"] = apply_mesg;
LLNotifications::instance().add("GenericAlert", args);
}
-
return false;
}
-// static
-void LLPanelGroup::onBtnRefresh(void* user_data)
+bool LLPanelGroup::apply()
{
- LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
- self->refreshData();
+ return apply(findChild<LLPanelGroupTab>("group_general_tab_panel"))
+ && apply(findChild<LLPanelGroupTab>("group_roles_tab_panel"))
+ && apply(findChild<LLPanelGroupTab>("group_notices_tab_panel"))
+ && apply(findChild<LLPanelGroupTab>("group_land_tab_panel"))
+ ;
}
+
// virtual
void LLPanelGroup::draw()
{
@@ -579,18 +381,22 @@ void LLPanelGroup::draw()
mRefreshTimer.stop();
childEnable("btn_refresh");
}
- if (mCurrentTab)
- {
- std::string mesg;
- childSetEnabled("btn_apply", mCurrentTab->needsApply(mesg));
- }
+ bool enable = false;
+ std::string mesg;
+ for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
+ enable = enable || (*it)->needsApply(mesg);
+
+ childSetEnabled("btn_apply", enable);
}
void LLPanelGroup::refreshData()
{
LLGroupMgr::getInstance()->clearGroupData(getID());
- mCurrentTab->activate();
+
+ for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
+ (*it)->activate();
+
// 5 second timeout
childDisable("btn_refresh");
@@ -598,20 +404,6 @@ void LLPanelGroup::refreshData()
mRefreshTimer.setTimerExpirySec(5);
}
-void LLPanelGroup::close()
-{
- // Pass this to the parent, if it is a floater.
- LLView* viewp = getParent();
- LLFloater* floaterp = dynamic_cast<LLFloater*>(viewp);
- if (floaterp)
- {
- // First, set the force close flag, since the floater
- // will be asking us whether it can close.
- mForceClose = TRUE;
- // Tell the parent floater to close.
- floaterp->close();
- }
-}
void LLPanelGroup::showNotice(const std::string& subject,
const std::string& message,
@@ -619,7 +411,8 @@ void LLPanelGroup::showNotice(const std::string& subject,
const std::string& inventory_name,
LLOfferInfo* inventory_offer)
{
- if (mCurrentTab->getName() != "notices_tab")
+ LLPanelGroupNotices* panel_notices = findChild<LLPanelGroupNotices>("group_notices_tab_panel");
+ if(!panel_notices)
{
// We need to clean up that inventory offer.
if (inventory_offer)
@@ -628,8 +421,37 @@ void LLPanelGroup::showNotice(const std::string& subject,
}
return;
}
+ panel_notices->showNotice(subject,message,has_inventory,inventory_name,inventory_offer);
+}
+
- LLPanelGroupNotices* notices = static_cast<LLPanelGroupNotices*>(mCurrentTab);
- notices->showNotice(subject,message,has_inventory,inventory_name,inventory_offer);
+
+//static
+void LLPanelGroup::refreshCreatedGroup(const LLUUID& group_id)
+{
+ LLPanelGroup* panel = LLSideTray::getInstance()->findChild<LLPanelGroup>("panel_group_info_sidetray");
+ if(!panel)
+ return;
+ panel->setGroupID(group_id);
+}
+
+//static
+
+void LLPanelGroup::showNotice(const std::string& subject,
+ const std::string& message,
+ const LLUUID& group_id,
+ const bool& has_inventory,
+ const std::string& inventory_name,
+ LLOfferInfo* inventory_offer)
+{
+ LLPanelGroup* panel = LLSideTray::getInstance()->findChild<LLPanelGroup>("panel_group_info_sidetray");
+ if(!panel)
+ return;
+
+ if(panel->getID() != group_id)//???? only for current group_id or switch panels? FIXME
+ return;
+ panel->showNotice(subject,message,has_inventory,inventory_name,inventory_offer);
+
}
+