diff options
Diffstat (limited to 'linden/indra/newview/llpanelgroupgeneral.cpp')
-rw-r--r-- | linden/indra/newview/llpanelgroupgeneral.cpp | 118 |
1 files changed, 61 insertions, 57 deletions
diff --git a/linden/indra/newview/llpanelgroupgeneral.cpp b/linden/indra/newview/llpanelgroupgeneral.cpp index 86cce51..cbf4a87 100644 --- a/linden/indra/newview/llpanelgroupgeneral.cpp +++ b/linden/indra/newview/llpanelgroupgeneral.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -194,6 +195,7 @@ BOOL LLPanelGroupGeneral::postBuild() | |||
194 | mSpinEnrollmentFee->setCommitCallback(onCommitAny); | 195 | mSpinEnrollmentFee->setCommitCallback(onCommitAny); |
195 | mSpinEnrollmentFee->setCallbackUserData(this); | 196 | mSpinEnrollmentFee->setCallbackUserData(this); |
196 | mSpinEnrollmentFee->setPrecision(0); | 197 | mSpinEnrollmentFee->setPrecision(0); |
198 | mSpinEnrollmentFee->resetDirty(); | ||
197 | } | 199 | } |
198 | 200 | ||
199 | BOOL accept_notices = FALSE; | 201 | BOOL accept_notices = FALSE; |
@@ -220,6 +222,7 @@ BOOL LLPanelGroupGeneral::postBuild() | |||
220 | mCtrlListGroup->setCallbackUserData(this); | 222 | mCtrlListGroup->setCallbackUserData(this); |
221 | mCtrlListGroup->set(list_in_profile); | 223 | mCtrlListGroup->set(list_in_profile); |
222 | mCtrlListGroup->setEnabled(data.mID.notNull()); | 224 | mCtrlListGroup->setEnabled(data.mID.notNull()); |
225 | mCtrlListGroup->resetDirty(); | ||
223 | } | 226 | } |
224 | 227 | ||
225 | mActiveTitleLabel = getChild<LLTextBox>("active_title_label", recurse); | 228 | mActiveTitleLabel = getChild<LLTextBox>("active_title_label", recurse); |
@@ -229,6 +232,7 @@ BOOL LLPanelGroupGeneral::postBuild() | |||
229 | { | 232 | { |
230 | mComboActiveTitle->setCommitCallback(onCommitTitle); | 233 | mComboActiveTitle->setCommitCallback(onCommitTitle); |
231 | mComboActiveTitle->setCallbackUserData(this); | 234 | mComboActiveTitle->setCallbackUserData(this); |
235 | mComboActiveTitle->resetDirty(); | ||
232 | } | 236 | } |
233 | 237 | ||
234 | mIncompleteMemberDataStr = getString("incomplete_member_data_str"); | 238 | mIncompleteMemberDataStr = getString("incomplete_member_data_str"); |
@@ -258,7 +262,7 @@ BOOL LLPanelGroupGeneral::postBuild() | |||
258 | void LLPanelGroupGeneral::onFocusEdit(LLFocusableElement* ctrl, void* data) | 262 | void LLPanelGroupGeneral::onFocusEdit(LLFocusableElement* ctrl, void* data) |
259 | { | 263 | { |
260 | LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; | 264 | LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; |
261 | self->mChanged = TRUE; | 265 | self->updateChanged(); |
262 | self->notifyObservers(); | 266 | self->notifyObservers(); |
263 | } | 267 | } |
264 | 268 | ||
@@ -316,6 +320,7 @@ void LLPanelGroupGeneral::onCommitTitle(LLUICtrl* ctrl, void* data) | |||
316 | if (self->mGroupID.isNull() || !self->mAllowEdit) return; | 320 | if (self->mGroupID.isNull() || !self->mAllowEdit) return; |
317 | LLGroupMgr::getInstance()->sendGroupTitleUpdate(self->mGroupID,self->mComboActiveTitle->getCurrentID()); | 321 | LLGroupMgr::getInstance()->sendGroupTitleUpdate(self->mGroupID,self->mComboActiveTitle->getCurrentID()); |
318 | self->update(GC_TITLES); | 322 | self->update(GC_TITLES); |
323 | self->mComboActiveTitle->resetDirty(); | ||
319 | } | 324 | } |
320 | 325 | ||
321 | // static | 326 | // static |
@@ -344,18 +349,18 @@ void LLPanelGroupGeneral::onClickJoin(void *userdata) | |||
344 | if (gdatap) | 349 | if (gdatap) |
345 | { | 350 | { |
346 | S32 cost = gdatap->mMembershipFee; | 351 | S32 cost = gdatap->mMembershipFee; |
347 | LLStringUtil::format_map_t args; | 352 | LLSD args; |
348 | args["[COST]"] = llformat("%d", cost); | 353 | args["COST"] = llformat("%d", cost); |
349 | 354 | LLSD payload; | |
355 | payload["group_id"] = self->mGroupID; | ||
356 | |||
350 | if (can_afford_transaction(cost)) | 357 | if (can_afford_transaction(cost)) |
351 | { | 358 | { |
352 | gViewerWindow->alertXml("JoinGroupCanAfford", args, | 359 | LLNotifications::instance().add("JoinGroupCanAfford", args, payload, LLPanelGroupGeneral::joinDlgCB); |
353 | LLPanelGroupGeneral::joinDlgCB, | ||
354 | self); | ||
355 | } | 360 | } |
356 | else | 361 | else |
357 | { | 362 | { |
358 | gViewerWindow->alertXml("JoinGroupCannotAfford", args); | 363 | LLNotifications::instance().add("JoinGroupCannotAfford", args, payload); |
359 | } | 364 | } |
360 | } | 365 | } |
361 | else | 366 | else |
@@ -366,17 +371,18 @@ void LLPanelGroupGeneral::onClickJoin(void *userdata) | |||
366 | } | 371 | } |
367 | 372 | ||
368 | // static | 373 | // static |
369 | void LLPanelGroupGeneral::joinDlgCB(S32 which, void *userdata) | 374 | bool LLPanelGroupGeneral::joinDlgCB(const LLSD& notification, const LLSD& response) |
370 | { | 375 | { |
371 | LLPanelGroupGeneral* self = (LLPanelGroupGeneral*) userdata; | 376 | S32 option = LLNotification::getSelectedOption(notification, response); |
372 | 377 | ||
373 | if (which == 1 || !self) | 378 | if (option == 1) |
374 | { | 379 | { |
375 | // user clicked cancel | 380 | // user clicked cancel |
376 | return; | 381 | return false; |
377 | } | 382 | } |
378 | 383 | ||
379 | LLGroupMgr::getInstance()->sendGroupMemberJoin(self->mGroupID); | 384 | LLGroupMgr::getInstance()->sendGroupMemberJoin(notification["payload"]["group_id"].asUUID()); |
385 | return false; | ||
380 | } | 386 | } |
381 | 387 | ||
382 | // static | 388 | // static |
@@ -396,6 +402,7 @@ void LLPanelGroupGeneral::openProfile(void* data) | |||
396 | 402 | ||
397 | bool LLPanelGroupGeneral::needsApply(std::string& mesg) | 403 | bool LLPanelGroupGeneral::needsApply(std::string& mesg) |
398 | { | 404 | { |
405 | updateChanged(); | ||
399 | mesg = getString("group_info_unchanged"); | 406 | mesg = getString("group_info_unchanged"); |
400 | return mChanged || mGroupID.isNull(); | 407 | return mChanged || mGroupID.isNull(); |
401 | } | 408 | } |
@@ -444,9 +451,8 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) | |||
444 | if(mComboMature && | 451 | if(mComboMature && |
445 | mComboMature->getCurrentIndex() == DECLINE_TO_STATE) | 452 | mComboMature->getCurrentIndex() == DECLINE_TO_STATE) |
446 | { | 453 | { |
447 | LLStringUtil::format_map_t args; | 454 | LLNotifications::instance().add("SetGroupMature", LLSD(), LLSD(), |
448 | gViewerWindow->alertXml("SetGroupMature", &callbackConfirmMatureApply, | 455 | boost::bind(&LLPanelGroupGeneral::confirmMatureApply, this, _1, _2)); |
449 | new LLHandle<LLPanel>(getHandle())); | ||
450 | return false; | 456 | return false; |
451 | } | 457 | } |
452 | 458 | ||
@@ -464,10 +470,9 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) | |||
464 | return false; | 470 | return false; |
465 | } | 471 | } |
466 | 472 | ||
467 | LLStringUtil::format_map_t args; | 473 | LLSD args; |
468 | args["[MESSAGE]"] = mConfirmGroupCreateStr; | 474 | args["MESSAGE"] = mConfirmGroupCreateStr; |
469 | gViewerWindow->alertXml("GenericAlertYesCancel", args, | 475 | LLNotifications::instance().add("GenericAlertYesCancel", args, LLSD(), boost::bind(&LLPanelGroupGeneral::createGroupCallback, this, _1, _2)); |
470 | createGroupCallback, new LLHandle<LLPanel>(getHandle()) ); | ||
471 | 476 | ||
472 | return false; | 477 | return false; |
473 | } | 478 | } |
@@ -545,22 +550,10 @@ void LLPanelGroupGeneral::cancel() | |||
545 | notifyObservers(); | 550 | notifyObservers(); |
546 | } | 551 | } |
547 | 552 | ||
548 | |||
549 | // static | ||
550 | void LLPanelGroupGeneral::callbackConfirmMatureApply(S32 option, void* data) | ||
551 | { | ||
552 | LLHandle<LLPanel>* handlep = (LLHandle<LLPanel>*)data; | ||
553 | LLPanelGroupGeneral* self = dynamic_cast<LLPanelGroupGeneral*>(handlep->get()); | ||
554 | delete handlep; | ||
555 | if (self) | ||
556 | { | ||
557 | self->confirmMatureApply(option); | ||
558 | } | ||
559 | } | ||
560 | |||
561 | // invoked from callbackConfirmMature | 553 | // invoked from callbackConfirmMature |
562 | void LLPanelGroupGeneral::confirmMatureApply(S32 option) | 554 | bool LLPanelGroupGeneral::confirmMatureApply(const LLSD& notification, const LLSD& response) |
563 | { | 555 | { |
556 | S32 option = LLNotification::getSelectedOption(notification, response); | ||
564 | // 0 == Yes | 557 | // 0 == Yes |
565 | // 1 == No | 558 | // 1 == No |
566 | // 2 == Cancel | 559 | // 2 == Cancel |
@@ -573,39 +566,35 @@ void LLPanelGroupGeneral::confirmMatureApply(S32 option) | |||
573 | mComboMature->setCurrentByIndex(NON_MATURE_CONTENT); | 566 | mComboMature->setCurrentByIndex(NON_MATURE_CONTENT); |
574 | break; | 567 | break; |
575 | default: | 568 | default: |
576 | return; | 569 | return false; |
577 | } | 570 | } |
578 | 571 | ||
579 | // If we got here it means they set a valid value | 572 | // If we got here it means they set a valid value |
580 | std::string mesg = ""; | 573 | std::string mesg = ""; |
581 | apply(mesg); | 574 | apply(mesg); |
575 | return false; | ||
582 | } | 576 | } |
583 | 577 | ||
584 | // static | 578 | // static |
585 | void LLPanelGroupGeneral::createGroupCallback(S32 option, void* userdata) | 579 | bool LLPanelGroupGeneral::createGroupCallback(const LLSD& notification, const LLSD& response) |
586 | { | 580 | { |
587 | LLHandle<LLPanel> panel_handle = *(LLHandle<LLPanel>*)userdata; | 581 | S32 option = LLNotification::getSelectedOption(notification, response); |
588 | delete (LLHandle<LLPanel>*)userdata; | ||
589 | |||
590 | LLPanelGroupGeneral* self = dynamic_cast<LLPanelGroupGeneral*>(panel_handle.get()); | ||
591 | if (!self) return; | ||
592 | |||
593 | switch(option) | 582 | switch(option) |
594 | { | 583 | { |
595 | case 0: | 584 | case 0: |
596 | { | 585 | { |
597 | // Yay! We are making a new group! | 586 | // Yay! We are making a new group! |
598 | U32 enrollment_fee = (self->mCtrlEnrollmentFee->get() ? | 587 | U32 enrollment_fee = (mCtrlEnrollmentFee->get() ? |
599 | (U32) self->mSpinEnrollmentFee->get() : 0); | 588 | (U32) mSpinEnrollmentFee->get() : 0); |
600 | 589 | ||
601 | LLGroupMgr::getInstance()->sendCreateGroupRequest(self->mGroupNameEditor->getText(), | 590 | LLGroupMgr::getInstance()->sendCreateGroupRequest(mGroupNameEditor->getText(), |
602 | self->mEditCharter->getText(), | 591 | mEditCharter->getText(), |
603 | self->mCtrlShowInGroupList->get(), | 592 | mCtrlShowInGroupList->get(), |
604 | self->mInsignia->getImageAssetID(), | 593 | mInsignia->getImageAssetID(), |
605 | enrollment_fee, | 594 | enrollment_fee, |
606 | self->mCtrlOpenEnrollment->get(), | 595 | mCtrlOpenEnrollment->get(), |
607 | false, | 596 | false, |
608 | self->mComboMature->getCurrentIndex() == MATURE_CONTENT); | 597 | mComboMature->getCurrentIndex() == MATURE_CONTENT); |
609 | 598 | ||
610 | } | 599 | } |
611 | break; | 600 | break; |
@@ -613,6 +602,7 @@ void LLPanelGroupGeneral::createGroupCallback(S32 option, void* userdata) | |||
613 | default: | 602 | default: |
614 | break; | 603 | break; |
615 | } | 604 | } |
605 | return false; | ||
616 | } | 606 | } |
617 | 607 | ||
618 | static F32 sSDTime = 0.0f; | 608 | static F32 sSDTime = 0.0f; |
@@ -675,6 +665,8 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) | |||
675 | mComboActiveTitle->setCurrentByID(LLUUID::null); | 665 | mComboActiveTitle->setCurrentByID(LLUUID::null); |
676 | } | 666 | } |
677 | } | 667 | } |
668 | |||
669 | mComboActiveTitle->resetDirty(); | ||
678 | } | 670 | } |
679 | 671 | ||
680 | // If this was just a titles update, we are done. | 672 | // If this was just a titles update, we are done. |
@@ -689,6 +681,8 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) | |||
689 | { | 681 | { |
690 | mCtrlShowInGroupList->set(gdatap->mShowInList); | 682 | mCtrlShowInGroupList->set(gdatap->mShowInList); |
691 | mCtrlShowInGroupList->setEnabled(mAllowEdit && can_change_ident); | 683 | mCtrlShowInGroupList->setEnabled(mAllowEdit && can_change_ident); |
684 | mCtrlShowInGroupList->resetDirty(); | ||
685 | |||
692 | } | 686 | } |
693 | if (mComboMature) | 687 | if (mComboMature) |
694 | { | 688 | { |
@@ -702,24 +696,29 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) | |||
702 | } | 696 | } |
703 | mComboMature->setEnabled(mAllowEdit && can_change_ident); | 697 | mComboMature->setEnabled(mAllowEdit && can_change_ident); |
704 | mComboMature->setVisible( !gAgent.isTeen() ); | 698 | mComboMature->setVisible( !gAgent.isTeen() ); |
699 | mComboMature->resetDirty(); | ||
705 | } | 700 | } |
706 | if (mCtrlOpenEnrollment) | 701 | if (mCtrlOpenEnrollment) |
707 | { | 702 | { |
708 | mCtrlOpenEnrollment->set(gdatap->mOpenEnrollment); | 703 | mCtrlOpenEnrollment->set(gdatap->mOpenEnrollment); |
709 | mCtrlOpenEnrollment->setEnabled(mAllowEdit && can_change_member_opts); | 704 | mCtrlOpenEnrollment->setEnabled(mAllowEdit && can_change_member_opts); |
705 | mCtrlOpenEnrollment->resetDirty(); | ||
710 | } | 706 | } |
711 | if (mCtrlEnrollmentFee) | 707 | if (mCtrlEnrollmentFee) |
712 | { | 708 | { |
713 | mCtrlEnrollmentFee->set(gdatap->mMembershipFee > 0); | 709 | mCtrlEnrollmentFee->set(gdatap->mMembershipFee > 0); |
714 | mCtrlEnrollmentFee->setEnabled(mAllowEdit && can_change_member_opts); | 710 | mCtrlEnrollmentFee->setEnabled(mAllowEdit && can_change_member_opts); |
711 | mCtrlEnrollmentFee->resetDirty(); | ||
715 | } | 712 | } |
716 | 713 | ||
717 | if (mSpinEnrollmentFee) | 714 | if (mSpinEnrollmentFee) |
718 | { | 715 | { |
719 | S32 fee = gdatap->mMembershipFee; | 716 | S32 fee = gdatap->mMembershipFee; |
720 | mSpinEnrollmentFee->set((F32)fee); | 717 | mSpinEnrollmentFee->set((F32)fee); |
721 | mSpinEnrollmentFee->setEnabled( mAllowEdit | 718 | mSpinEnrollmentFee->setEnabled( mAllowEdit && |
722 | && (fee > 0) && can_change_member_opts); | 719 | (fee > 0) && |
720 | can_change_member_opts); | ||
721 | mSpinEnrollmentFee->resetDirty(); | ||
723 | } | 722 | } |
724 | if ( mBtnJoinGroup ) | 723 | if ( mBtnJoinGroup ) |
725 | { | 724 | { |
@@ -748,8 +747,9 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) | |||
748 | { | 747 | { |
749 | mCtrlReceiveNotices->setEnabled(mAllowEdit); | 748 | mCtrlReceiveNotices->setEnabled(mAllowEdit); |
750 | } | 749 | } |
750 | mCtrlReceiveNotices->resetDirty(); | ||
751 | } | 751 | } |
752 | 752 | ||
753 | 753 | ||
754 | if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident); | 754 | if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident); |
755 | if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident); | 755 | if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident); |
@@ -765,11 +765,15 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) | |||
765 | } | 765 | } |
766 | else | 766 | else |
767 | { | 767 | { |
768 | |||
769 | mInsignia->setImageAssetID(mDefaultIconID); | 768 | mInsignia->setImageAssetID(mDefaultIconID); |
770 | } | 769 | } |
771 | } | 770 | } |
772 | if (mEditCharter) mEditCharter->setText(gdatap->mCharter); | 771 | |
772 | if (mEditCharter) | ||
773 | { | ||
774 | mEditCharter->setText(gdatap->mCharter); | ||
775 | mEditCharter->resetDirty(); | ||
776 | } | ||
773 | 777 | ||
774 | if (mListVisibleMembers) | 778 | if (mListVisibleMembers) |
775 | { | 779 | { |
@@ -897,7 +901,7 @@ void LLPanelGroupGeneral::updateChanged() | |||
897 | 901 | ||
898 | mChanged = FALSE; | 902 | mChanged = FALSE; |
899 | 903 | ||
900 | for( int i= 0; i< sizeof(check_list)/sizeof(*check_list); i++ ) | 904 | for( int i= 0; i< LL_ARRAY_SIZE(check_list); i++ ) |
901 | { | 905 | { |
902 | if( check_list[i] && check_list[i]->isDirty() ) | 906 | if( check_list[i] && check_list[i]->isDirty() ) |
903 | { | 907 | { |