void LLPanelGroupLandMoney::impl::contributionCommitCallback(const LLSD& value) { int your_contribution = 0; int new_contribution = 0; new_contribution= value.asInteger(); your_contribution = getStoredContribution(); //reset their junk data to be "good" data to us setYourContributionTextField(new_contribution); //check to see if they're contribution text has changed mNeedsApply = new_contribution != your_contribution; mPanel.notifyObservers(); }
bool LLPanelGroupLandMoney::impl::applyContribution() { // calculate max donation, which is sum of available and current. S32 your_contribution = 0; S32 sqm_avail; your_contribution = getStoredContribution(); sqm_avail = your_contribution; if(gStatusBar) { sqm_avail += gStatusBar->getSquareMetersLeft(); } // get new contribution and compare to available S32 new_contribution = atoi(mYourContributionEditorp->getText().c_str()); if( new_contribution != your_contribution && new_contribution >= 0 && new_contribution <= sqm_avail ) { // update group info and server if(!gAgent.setGroupContribution(mPanel.mGroupID, new_contribution)) { // should never happen... llwarns << "Unable to set contribution." << llendl; return false; } } else { //TODO: throw up some error message here and return? right now we just //fail silently and force the previous value -jwolk new_contribution = your_contribution; } //set your contribution setYourContributionTextField(new_contribution); return true; }