Update/cleanup llpanelpermissions

This commit is contained in:
Lirusaito
2013-07-02 19:05:53 -04:00
parent 92633b8c65
commit 27145699bf
2 changed files with 42 additions and 64 deletions

View File

@@ -5,10 +5,9 @@
* viewing/editing object names, owners, permissions, etc. * viewing/editing object names, owners, permissions, etc.
* *
* $LicenseInfo:firstyear=2002&license=viewergpl$ * $LicenseInfo:firstyear=2002&license=viewergpl$
* * Second Life Viewer Source Code
* Copyright (c) 2002-2009, Linden Research, Inc. * Copyright (c) 2002-2009, Linden Research, Inc.
* *
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0 * to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement * ("GPL"), unless you have obtained a separate licensing agreement
@@ -36,6 +35,7 @@
#include "llpanelpermissions.h" #include "llpanelpermissions.h"
// library includes
#include "llpermissions.h" #include "llpermissions.h"
#include "llclickaction.h" #include "llclickaction.h"
#include "llfocusmgr.h" #include "llfocusmgr.h"
@@ -43,6 +43,7 @@
#include "lltrans.h" #include "lltrans.h"
#include "llwindow.h" #include "llwindow.h"
// project includes
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "llresmgr.h" #include "llresmgr.h"
#include "lltextbox.h" #include "lltextbox.h"
@@ -117,32 +118,30 @@ BOOL LLPanelPermissions::postBuild()
getChild<LLLineEditor>("Object Description")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); getChild<LLLineEditor>("Object Description")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe);
childSetAction("button owner profile",LLPanelPermissions::onClickOwner,this); getChild<LLUICtrl>("button owner profile")->setCommitCallback(boost::bind(&LLPanelPermissions::onClickOwner,this));
childSetAction("button last owner profile",LLPanelPermissions::onClickLastOwner,this); getChild<LLUICtrl>("button last owner profile")->setCommitCallback(boost::bind(&LLPanelPermissions::onClickLastOwner,this));
childSetAction("button creator profile",LLPanelPermissions::onClickCreator,this); getChild<LLUICtrl>("button creator profile")->setCommitCallback(boost::bind(&LLPanelPermissions::onClickCreator,this));
childSetAction("button set group",LLPanelPermissions::onClickGroup,this); getChild<LLUICtrl>("button set group")->setCommitCallback(boost::bind(&LLPanelPermissions::onClickGroup,this));
childSetAction("button open group",LLPanelPermissions::onClickOpenGroup,this); getChild<LLUICtrl>("button open group")->setCommitCallback(boost::bind(LLPanelPermissions::onClickOpenGroup));
childSetCommitCallback("checkbox share with group",LLPanelPermissions::onCommitGroupShare,this); childSetCommitCallback("checkbox share with group",LLPanelPermissions::onCommitGroupShare,this);
childSetAction("button deed",LLPanelPermissions::onClickDeedToGroup,this); childSetAction("button deed",LLPanelPermissions::onClickDeedToGroup,this);
childSetAction("button cpy_key",LLPanelPermissions::onClickCopyObjKey,this); getChild<LLUICtrl>("button cpy_key")->setCommitCallback(boost::bind(LLPanelPermissions::onClickCopyObjKey));
childSetCommitCallback("checkbox allow everyone move",LLPanelPermissions::onCommitEveryoneMove,this); childSetCommitCallback("checkbox allow everyone move",LLPanelPermissions::onCommitEveryoneMove,this);
childSetCommitCallback("checkbox allow everyone copy",LLPanelPermissions::onCommitEveryoneCopy,this); childSetCommitCallback("checkbox allow everyone copy",LLPanelPermissions::onCommitEveryoneCopy,this);
getChild<LLUICtrl>("checkbox allow export")->setCommitCallback(boost::bind(&LLPanelPermissions::onCommitExport, this, _2));
childSetCommitCallback("checkbox for sale",LLPanelPermissions::onCommitSaleInfo,this); childSetCommitCallback("checkbox for sale",LLPanelPermissions::onCommitSaleInfo,this);
childSetCommitCallback("sale type",LLPanelPermissions::onCommitSaleType,this);
childSetCommitCallback("Edit Cost",LLPanelPermissions::onCommitSaleInfo,this); childSetCommitCallback("Edit Cost",LLPanelPermissions::onCommitSaleInfo,this);
getChild<LLLineEditor>("Edit Cost")->setPrevalidate(&LLLineEditor::prevalidateNonNegativeS32); getChild<LLLineEditor>("Edit Cost")->setPrevalidate(&LLLineEditor::prevalidateNonNegativeS32);
childSetCommitCallback("sale type",LLPanelPermissions::onCommitSaleType,this);
childSetCommitCallback("checkbox next owner can modify",LLPanelPermissions::onCommitNextOwnerModify,this); childSetCommitCallback("checkbox next owner can modify",LLPanelPermissions::onCommitNextOwnerModify,this);
childSetCommitCallback("checkbox next owner can copy",LLPanelPermissions::onCommitNextOwnerCopy,this); childSetCommitCallback("checkbox next owner can copy",LLPanelPermissions::onCommitNextOwnerCopy,this);
childSetCommitCallback("checkbox next owner can transfer",LLPanelPermissions::onCommitNextOwnerTransfer,this); childSetCommitCallback("checkbox next owner can transfer",LLPanelPermissions::onCommitNextOwnerTransfer,this);
@@ -152,7 +151,10 @@ BOOL LLPanelPermissions::postBuild()
mLabelGroupName = getChild<LLNameBox>("Group Name Proxy"); mLabelGroupName = getChild<LLNameBox>("Group Name Proxy");
if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) if (!gHippoGridManager->getCurrentGrid()->isSecondLife())
{
getChild<LLUICtrl>("checkbox allow export")->setCommitCallback(boost::bind(&LLPanelPermissions::onCommitExport, this, _2));
LFSimFeatureHandler::instance().setSupportsExportCallback(boost::bind(&LLPanelPermissions::refresh, this)); LFSimFeatureHandler::instance().setSupportsExportCallback(boost::bind(&LLPanelPermissions::refresh, this));
}
return TRUE; return TRUE;
} }
@@ -195,16 +197,16 @@ void LLPanelPermissions::disableAll()
getChildView("button last owner profile")->setEnabled(FALSE); getChildView("button last owner profile")->setEnabled(FALSE);
getChildView("Group:")->setEnabled(FALSE); getChildView("Group:")->setEnabled(FALSE);
getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null); getChild<LLUICtrl>("Group Name Proxy")->setValue(LLStringUtil::null);
getChildView("Group Name")->setEnabled(FALSE); getChildView("Group Name Proxy")->setEnabled(FALSE);
getChildView("button set group")->setEnabled(FALSE); getChildView("button set group")->setEnabled(FALSE);
getChildView("button open group")->setEnabled(FALSE); getChildView("button open group")->setEnabled(FALSE);
getChild<LLUICtrl>("Object Name")->setValue(LLStringUtil::null); getChild<LLUICtrl>("Object Name")->setValue(LLStringUtil::null);
getChildView("Object Name")->setEnabled(FALSE); getChildView("Object Name")->setEnabled(FALSE);
getChildView("Name:")->setEnabled(FALSE); getChildView("Name:")->setEnabled(FALSE);
getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null); //getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null);
getChildView("Group Name")->setEnabled(FALSE); //getChildView("Group Name")->setEnabled(FALSE);
getChildView("Description:")->setEnabled(FALSE); getChildView("Description:")->setEnabled(FALSE);
getChild<LLUICtrl>("Object Description")->setValue(LLStringUtil::null); getChild<LLUICtrl>("Object Description")->setValue(LLStringUtil::null);
getChildView("Object Description")->setEnabled(FALSE); getChildView("Object Description")->setEnabled(FALSE);
@@ -310,9 +312,8 @@ void LLPanelPermissions::refresh()
return; return;
} }
// figure out a few variables // figure out a few variables
BOOL is_one_object = (object_count == 1); const BOOL is_one_object = (object_count == 1);
// BUG: fails if a root and non-root are both single-selected. // BUG: fails if a root and non-root are both single-selected.
BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode()
@@ -446,7 +447,7 @@ void LLPanelPermissions::refresh()
// update group text field // update group text field
getChildView("Group:")->setEnabled(TRUE); getChildView("Group:")->setEnabled(TRUE);
getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null); //getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null);
LLUUID group_id; LLUUID group_id;
BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id);
if (groups_identical) if (groups_identical)
@@ -996,19 +997,13 @@ void LLPanelPermissions::onClickRelease(void*)
LLSelectMgr::getInstance()->sendOwner(LLUUID::null, LLUUID::null); LLSelectMgr::getInstance()->sendOwner(LLUUID::null, LLUUID::null);
} }
// static void LLPanelPermissions::onClickCreator()
void LLPanelPermissions::onClickCreator(void *data)
{ {
LLPanelPermissions *self = (LLPanelPermissions *)data; LLAvatarActions::showProfile(mCreatorID);
LLAvatarActions::showProfile(self->mCreatorID);
} }
// static void LLPanelPermissions::onClickOwner()
void LLPanelPermissions::onClickOwner(void *data)
{ {
LLPanelPermissions *self = (LLPanelPermissions *)data;
if (LLSelectMgr::getInstance()->selectIsGroupOwned()) if (LLSelectMgr::getInstance()->selectIsGroupOwned())
{ {
LLUUID group_id; LLUUID group_id;
@@ -1020,26 +1015,24 @@ void LLPanelPermissions::onClickOwner(void *data)
// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e)
if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
{ {
LLAvatarActions::showProfile(self->mOwnerID); LLAvatarActions::showProfile(mOwnerID);
} }
// [/RLVa:KB] // [/RLVa:KB]
// LLAvatarActions::showProfile(self->mOwnerID); // LLAvatarActions::showProfile(mOwnerID);
} }
} }
void LLPanelPermissions::onClickLastOwner(void *data) void LLPanelPermissions::onClickLastOwner()
{ {
LLPanelPermissions *self = (LLPanelPermissions *)data; LLAvatarActions::showProfile(mLastOwnerID);
LLAvatarActions::showProfile(self->mLastOwnerID);
} }
void LLPanelPermissions::onClickGroup(void* data) void LLPanelPermissions::onClickGroup()
{ {
LLPanelPermissions* panelp = (LLPanelPermissions*)data;
LLUUID owner_id; LLUUID owner_id;
std::string name; std::string name;
BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name); BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name);
LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); LLFloater* parent_floater = gFloaterView->getParentFloater(this);
if(owners_identical && (owner_id == gAgent.getID())) if(owners_identical && (owner_id == gAgent.getID()))
{ {
@@ -1047,7 +1040,7 @@ void LLPanelPermissions::onClickGroup(void* data)
if (fg) if (fg)
{ {
fg->setSelectCallback( cbGroupID, data ); fg->setSelectCallback( cbGroupID, this );
if (parent_floater) if (parent_floater)
{ {
@@ -1059,11 +1052,10 @@ void LLPanelPermissions::onClickGroup(void* data)
} }
} }
void LLPanelPermissions::onClickOpenGroup(void* data) void LLPanelPermissions::onClickOpenGroup()
{ {
LLUUID group_id; LLUUID group_id;
LLSelectMgr::getInstance()->selectGetGroup(group_id); LLSelectMgr::getInstance()->selectGetGroup(group_id);
LLGroupActions::show(group_id); LLGroupActions::show(group_id);
} }
@@ -1099,7 +1091,7 @@ void LLPanelPermissions::onClickDeedToGroup(void* data)
LLNotificationsUtil::add( "DeedObjectToGroup", LLSD(), LLSD(), callback_deed_to_group); LLNotificationsUtil::add( "DeedObjectToGroup", LLSD(), LLSD(), callback_deed_to_group);
} }
void LLPanelPermissions::onClickCopyObjKey(void* data) void LLPanelPermissions::onClickCopyObjKey()
{ {
//NAMESHORT - Was requested on the forums, was going to integrate a textbox with the ID, but due to lack of room on the floater, //NAMESHORT - Was requested on the forums, was going to integrate a textbox with the ID, but due to lack of room on the floater,
//We now have a copy button :> //We now have a copy button :>

View File

@@ -3,10 +3,9 @@
* @brief LLPanelPermissions class header file * @brief LLPanelPermissions class header file
* *
* $LicenseInfo:firstyear=2002&license=viewergpl$ * $LicenseInfo:firstyear=2002&license=viewergpl$
* * Second Life Viewer Source Code
* Copyright (c) 2002-2009, Linden Research, Inc. * Copyright (c) 2002-2009, Linden Research, Inc.
* *
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0 * to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement * ("GPL"), unless you have obtained a separate licensing agreement
@@ -42,12 +41,6 @@
// Panel for permissions of an object. // Panel for permissions of an object.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLCheckBoxCtrl;
class LLTextBox;
class LLButton;
class LLLineEditor;
class LLRadioGroup;
class LLComboBox;
class LLNameBox; class LLNameBox;
class LLPanelPermissions : public LLPanel class LLPanelPermissions : public LLPanel
@@ -56,26 +49,23 @@ public:
LLPanelPermissions(const std::string& title); LLPanelPermissions(const std::string& title);
virtual ~LLPanelPermissions(); virtual ~LLPanelPermissions();
virtual BOOL postBuild(); /*virtual*/ BOOL postBuild();
virtual void handleVisibilityChange(BOOL new_visibility); /*virtual*/ void handleVisibilityChange(BOOL new_visibility);
// MANIPULATORS
void refresh(); // refresh all labels as needed void refresh(); // refresh all labels as needed
// void setPermCheckboxes(U32 mask_on, U32 mask_off,
// LLCheckBoxCtrl* move, LLCheckboxCtrl* edit,
// LLCheckBoxCtrl* copy);
protected: protected:
// statics // statics
static void onClickClaim(void*); static void onClickClaim(void*);
static void onClickRelease(void*); static void onClickRelease(void*);
static void onClickCreator(void*); void onClickCreator();
static void onClickOwner(void*); void onClickOwner();
static void onClickLastOwner(void*); void onClickLastOwner();
static void onClickGroup(void*); void onClickGroup();
static void onClickOpenGroup(void*); static void onClickOpenGroup();
static void cbGroupID(LLUUID group_id, void* userdata); static void cbGroupID(LLUUID group_id, void* userdata);
static void onClickDeedToGroup(void*); static void onClickDeedToGroup(void*);
static void onClickCopyObjKey(void*); static void onClickCopyObjKey();
static void onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm); static void onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm);
@@ -109,10 +99,6 @@ protected:
private: private:
LLNameBox* mLabelGroupName; // group name LLNameBox* mLabelGroupName; // group name
//LLTextBox* mBuyerLabel;
//LLCheckBoxCtrl* mCheckBuyerModify;
//LLCheckBoxCtrl* mCheckBuyerCopy;
LLUUID mCreatorID; LLUUID mCreatorID;
LLUUID mOwnerID; LLUUID mOwnerID;
LLUUID mLastOwnerID; LLUUID mLastOwnerID;