diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llpanelgrouproles.cpp | 63 | ||||
| -rw-r--r-- | indra/newview/llpanelgrouproles.h | 3 | 
2 files changed, 22 insertions, 44 deletions
| diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index a77ba0c69c..93fbecfd3f 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -118,8 +118,7 @@ LLPanelGroupRoles::LLPanelGroupRoles()  	mCurrentTab(NULL),  	mRequestedTab( NULL ),  	mSubTabContainer( NULL ), -	mFirstUse( TRUE ), -	mIgnoreTransition( FALSE ) +	mFirstUse( TRUE )  {  } @@ -153,8 +152,8 @@ BOOL LLPanelGroupRoles::postBuild()  		//subtabp->addObserver(this);  	} -	// Add click callbacks to all the tabs. -	mSubTabContainer->setCommitCallback(boost::bind(&LLPanelGroupRoles::handleClickSubTab, this)); +	// Add click callbacks to tab switching. +	mSubTabContainer->setValidateBeforeCommit(boost::bind(&LLPanelGroupRoles::handleSubTabSwitch, this, _1));  	// Set the current tab to whatever is currently being shown.  	mCurrentTab = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel(); @@ -196,30 +195,20 @@ BOOL LLPanelGroupRoles::isVisibleByAgent(LLAgent* agentp)  } -void LLPanelGroupRoles::handleClickSubTab() +bool LLPanelGroupRoles::handleSubTabSwitch(const LLSD& data)  { -	// If we are already handling a transition, -	// ignore this. -	if (mIgnoreTransition) -	{ -		return; -	} - -	mRequestedTab = (LLPanelGroupTab*) mSubTabContainer->getCurrentPanel(); +	std::string panel_name = data.asString(); +	 +	LLPanelGroupTab* activating_tab = static_cast<LLPanelGroupTab*>(mSubTabContainer->getPanelByName(panel_name)); -	// Make sure they aren't just clicking the same tab... -	if (mRequestedTab == mCurrentTab) +	if(activating_tab == mCurrentTab +		|| activating_tab == mRequestedTab)  	{ -		return; +		return true;  	} -	// Try to switch from the current panel to the panel the user selected. -	attemptTransition(); -} - -BOOL LLPanelGroupRoles::attemptTransition() -{ -	// Check if the current tab needs to be applied. +	mRequestedTab = activating_tab; +	  	std::string mesg;  	if (mCurrentTab && mCurrentTab->needsApply(mesg))  	{ @@ -235,16 +224,10 @@ BOOL LLPanelGroupRoles::attemptTransition()  		LLNotificationsUtil::add("PanelGroupApply", args, LLSD(),  			boost::bind(&LLPanelGroupRoles::handleNotifyCallback, this, _1, _2));  		mHasModal = TRUE; -		// We need to reselect the current tab, since it isn't finished. -		if (mSubTabContainer) -		{ -			mIgnoreTransition = TRUE; -			mSubTabContainer->selectTabPanel( mCurrentTab ); -			mIgnoreTransition = FALSE; -		} +		  		// Returning FALSE will block a close action from finishing until  		// we get a response back from the user. -		return FALSE; +		return false;  	}  	else  	{ @@ -253,7 +236,7 @@ BOOL LLPanelGroupRoles::attemptTransition()  		{  			transitionToTab();  		} -		return TRUE; +		return true;  	}  } @@ -271,6 +254,7 @@ void LLPanelGroupRoles::transitionToTab()  		// This is now the current tab;  		mCurrentTab = mRequestedTab;  		mCurrentTab->activate(); +		mRequestedTab = 0;  	}  } @@ -278,6 +262,7 @@ bool LLPanelGroupRoles::handleNotifyCallback(const LLSD& notification, const LLS  {  	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);  	mHasModal = FALSE; +	LLPanelGroupTab* transition_tab = mRequestedTab;  	switch (option)  	{  	case 0: // "Apply Changes" @@ -297,26 +282,20 @@ bool LLPanelGroupRoles::handleNotifyCallback(const LLSD& notification, const LLS  			// Skip switching tabs.  			break;  		} - -		// This panel's info successfully applied. -		// Switch to the next panel. -		// No break!  Continue into 'Ignore Changes' which just switches tabs. -		mIgnoreTransition = TRUE; -		mSubTabContainer->selectTabPanel( mRequestedTab ); -		mIgnoreTransition = FALSE;  		transitionToTab(); +		mSubTabContainer->selectTabPanel( transition_tab ); +		  		break;  	}  	case 1: // "Ignore Changes"  		// Switch to the requested panel without applying changes  		cancel(); -		mIgnoreTransition = TRUE; -		mSubTabContainer->selectTabPanel( mRequestedTab ); -		mIgnoreTransition = FALSE;  		transitionToTab(); +		mSubTabContainer->selectTabPanel( transition_tab );  		break;  	case 2: // "Cancel"  	default: +		mRequestedTab = NULL;  		// Do nothing.  The user is canceling the action.  		break;  	} diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h index 98cebe9882..a877402041 100644 --- a/indra/newview/llpanelgrouproles.h +++ b/indra/newview/llpanelgrouproles.h @@ -65,7 +65,7 @@ public:  	virtual BOOL isVisibleByAgent(LLAgent* agentp); -	void handleClickSubTab(); +	bool handleSubTabSwitch(const LLSD& data);  	// Checks if the current tab needs to be applied, and tries to switch to the requested tab.  	BOOL attemptTransition(); @@ -93,7 +93,6 @@ protected:  	LLPanelGroupTab*		mRequestedTab;  	LLTabContainer*	mSubTabContainer;  	BOOL					mFirstUse; -	BOOL					mIgnoreTransition;  	std::string				mDefaultNeedsApplyMesg;  	std::string				mWantApplyMesg; | 
