From ce28e056c20bf2723f565bbf464b87781ec248a2 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:42 -0500 Subject: Second Life viewer sources 1.20.2 --- linden/indra/newview/llpanelgroupinvite.cpp | 81 ++++++++++++++++++++++------- 1 file changed, 61 insertions(+), 20 deletions(-) (limited to 'linden/indra/newview/llpanelgroupinvite.cpp') diff --git a/linden/indra/newview/llpanelgroupinvite.cpp b/linden/indra/newview/llpanelgroupinvite.cpp index c393854..e051bb6 100644 --- a/linden/indra/newview/llpanelgroupinvite.cpp +++ b/linden/indra/newview/llpanelgroupinvite.cpp @@ -42,7 +42,8 @@ #include "lltextbox.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" -#include "llvieweruictrlfactory.h" +#include "lluictrlfactory.h" +#include "llviewerwindow.h" class LLPanelGroupInvite::impl { @@ -65,6 +66,7 @@ public: static void callbackAddUsers(const std::vector& names, const std::vector& agent_ids, void* user_data); + static void inviteOwnerCallback(S32 option, void* userdata); public: LLUUID mGroupID; @@ -75,6 +77,8 @@ public: LLButton *mOKButton; LLButton *mRemoveButton; LLTextBox *mGroupName; + LLString mOwnerWarning; + bool mConfirmedOwnerInvite; void (*mCloseCallback)(void* data); @@ -82,16 +86,18 @@ public: }; -LLPanelGroupInvite::impl::impl(const LLUUID& group_id) +LLPanelGroupInvite::impl::impl(const LLUUID& group_id): + mGroupID( group_id ), + mLoadingText (), + mInvitees ( NULL ), + mRoleNames( NULL ), + mOKButton ( NULL ), + mRemoveButton( NULL ), + mGroupName( NULL ), + mConfirmedOwnerInvite( false ), + mCloseCallback( NULL ), + mCloseCallbackUserData( NULL ) { - mGroupID = group_id; - - mInvitees = NULL; - mRoleNames = NULL; - mRemoveButton = NULL; - - mCloseCallback = NULL; - mCloseCallbackUserData = NULL; } LLPanelGroupInvite::impl::~impl() @@ -140,12 +146,23 @@ void LLPanelGroupInvite::impl::submitInvitations() { std::map role_member_pairs; + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); + // Default to everyone role. LLUUID role_id = LLUUID::null; if (mRoleNames) { role_id = mRoleNames->getCurrentID(); + + // owner role: display confirmation and wait for callback + if ((role_id == gdatap->mOwnerRole) && (!mConfirmedOwnerInvite)) + { + LLString::format_map_t args; + args["[MESSAGE]"] = mOwnerWarning; + gViewerWindow->alertXml("GenericAlertYesCancel", args, inviteOwnerCallback, this); + return; // we'll be called again if user confirms + } } //loop over the users @@ -157,12 +174,34 @@ void LLPanelGroupInvite::impl::submitInvitations() role_member_pairs[item->getUUID()] = role_id; } - gGroupMgr->sendGroupMemberInvites(mGroupID, role_member_pairs); + LLGroupMgr::getInstance()->sendGroupMemberInvites(mGroupID, role_member_pairs); //then close (*mCloseCallback)(mCloseCallbackUserData); } +//static +void LLPanelGroupInvite::impl::inviteOwnerCallback(S32 option, void* userdata) +{ + LLPanelGroupInvite::impl* self = (LLPanelGroupInvite::impl*)userdata; + if (!self) return; + + switch(option) + { + case 0: + // user confirmed that they really want a new group owner + self->mConfirmedOwnerInvite = true; + self->submitInvitations(); + break; + case 1: + // fall through + default: + break; + } +} + + + void LLPanelGroupInvite::impl::addRoleNames(LLGroupMgrGroupData* gdatap) { LLGroupMgrGroupData::member_list_t::iterator agent_iter = @@ -323,7 +362,7 @@ LLPanelGroupInvite::LLPanelGroupInvite(const std::string& name, std::string panel_def_file; // Pass on construction of this panel to the control factory. - gUICtrlFactory->buildPanel(this, "panel_group_invite.xml", &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group_invite.xml", &getFactoryMap()); } LLPanelGroupInvite::~LLPanelGroupInvite() @@ -412,8 +451,8 @@ void LLPanelGroupInvite::update() void LLPanelGroupInvite::updateLists() { - LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mImplementation->mGroupID); - BOOL waiting = FALSE; + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID); + bool waiting = false; if (gdatap) { @@ -426,7 +465,7 @@ void LLPanelGroupInvite::updateLists() } else { - waiting = TRUE; + waiting = true; } if (gdatap->isRoleDataComplete() && gdatap->isMemberDataComplete()) { @@ -442,21 +481,21 @@ void LLPanelGroupInvite::updateLists() } else { - waiting = TRUE; + waiting = true; } } else { - waiting = TRUE; + waiting = true; } if (waiting) { if (!mPendingUpdate) { - gGroupMgr->sendGroupPropertiesRequest(mImplementation->mGroupID); - gGroupMgr->sendGroupMembersRequest(mImplementation->mGroupID); - gGroupMgr->sendGroupRoleDataRequest(mImplementation->mGroupID); + LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mImplementation->mGroupID); + LLGroupMgr::getInstance()->sendGroupMembersRequest(mImplementation->mGroupID); + LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mImplementation->mGroupID); } mPendingUpdate = TRUE; } @@ -523,6 +562,8 @@ BOOL LLPanelGroupInvite::postBuild() button->setCallbackUserData(mImplementation); } + mImplementation->mOwnerWarning = getString("confirm_invite_owner_str"); + update(); return (mImplementation->mRoleNames && -- cgit v1.1