Merge remote-tracking branch 'melanie_t/master'

This commit is contained in:
Latif Khalifa
2013-04-16 12:53:37 +02:00
16 changed files with 408 additions and 38 deletions

View File

@@ -1022,6 +1022,16 @@ void mask_to_string(U32 mask, char* str)
{
*str = ' ';
}
str++;
if (mask & PERM_EXPORT)
{
*str = 'E';
}
else
{
*str = ' ';
}
str++;
*str = '\0';
}

View File

@@ -52,6 +52,9 @@ const PermissionBit PERM_MODIFY = (1 << 14); // 0x00004000
// objects, allow copy
const PermissionBit PERM_COPY = (1 << 15); // 0x00008000
// objects, allow exporting
const PermissionBit PERM_EXPORT = (1 << 16); // 0x00010000
// parcels, allow entry, deprecated
//const PermissionBit PERM_ENTER = (1 << 16); // 0x00010000

View File

@@ -97,6 +97,7 @@ set(viewer_SOURCE_FILES
hippopanelgrids.cpp
importtracker.cpp
jcfloaterareasearch.cpp
lfsimfeaturehandler.cpp
lggdicdownload.cpp
lgghunspell_wrapper.cpp
llaccountingcostmanager.cpp
@@ -597,6 +598,7 @@ set(viewer_HEADER_FILES
hippopanelgrids.h
importtracker.h
jcfloaterareasearch.h
lfsimfeaturehandler.h
lggdicdownload.h
lgghunspell_wrapper.h
llaccountingcostmanager.h

View File

@@ -314,6 +314,17 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>EveryoneExport</key>
<map>
<key>Comment</key>
<string>Whether content you upload has exportability permission by default</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>RLVaLoginLastLocation</key>
<map>
<key>Comment</key>

View File

@@ -0,0 +1,66 @@
/* Copyright (C) 2013 Liru Færs
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA */
#include "llviewerprecompiledheaders.h"
#include "lfsimfeaturehandler.h"
#include "llagent.h"
#include "llenvmanager.h"
#include "llviewerregion.h"
#include "hippogridmanager.h"
LFSimFeatureHandler::LFSimFeatureHandler()
: mSupportsExport(false)
{
if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) // Remove this line if we ever handle SecondLife sim features
LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LFSimFeatureHandler::handleRegionChange, this));
}
void LFSimFeatureHandler::handleRegionChange()
{
if (LLViewerRegion* region = gAgent.getRegion())
{
if (region->getFeaturesReceived())
{
setSupportedFeatures();
}
else
{
region->setFeaturesReceivedCallback(boost::bind(&LFSimFeatureHandler::setSupportedFeatures, this));
}
}
}
void LFSimFeatureHandler::setSupportedFeatures()
{
if (LLViewerRegion* region = gAgent.getRegion())
{
LLSD info;
region->getSimulatorFeatures(info);
//if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) // Non-SL specific sim features
{
mSupportsExport = info.has("ExportSupported");
}
}
}
boost::signals2::connection LFSimFeatureHandler::setSupportsExportCallback(const boost::signals2::signal<void()>::slot_type& slot)
{
return mSupportsExport.connect(slot);
}

View File

@@ -0,0 +1,70 @@
/* Copyright (C) 2013 Liru Færs
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA */
#ifndef LFSIMFEATUREHANDLER_H
#define LFSIMFEATUREHANDLER_H
#include "llsingleton.h"
template<typename Type>
class SignaledType
{
public:
SignaledType(Type b) : mValue(b) {}
template<typename Slot>
boost::signals2::connection connect(Slot slot) { return mSignal.connect(slot); }
SignaledType& operator =(Type val)
{
if (val != mValue)
{
mValue = val;
mSignal();
}
return *this;
}
operator Type() const { return mValue; }
private:
boost::signals2::signal<void()> mSignal;
Type mValue;
};
class LFSimFeatureHandler : public LLSingleton<LFSimFeatureHandler>
{
protected:
friend class LLSingleton<LFSimFeatureHandler>;
LFSimFeatureHandler();
public:
void handleRegionChange();
void setSupportedFeatures();
// Connection setters
boost::signals2::connection setSupportsExportCallback(const boost::signals2::signal<void()>::slot_type& slot);
// Accessors
bool simSupportsExport() const { return mSupportsExport; }
private:
// SignaledTypes
SignaledType<bool> mSupportsExport;
};
#endif //LFSIMFEATUREHANDLER_H

View File

@@ -188,9 +188,14 @@ void LLFloaterChat::handleVisibilityChange(BOOL new_visibility)
void LLFloaterChat::onFocusReceived()
{
LLView* chat_editor = getChildView("Chat Editor");
if (childIsVisible("Chat Editor"))
if (getVisible() && childIsVisible("Chat Editor"))
{
gFocusMgr.setKeyboardFocus(chat_editor);
LLUICtrl * ctrl = static_cast<LLUICtrl*>(chat_editor);
ctrl->setFocus(TRUE);
}
LLFloater::onFocusReceived();
}
@@ -747,9 +752,13 @@ void LLFloaterChat::hide(LLFloater* instance, const LLSD& key)
BOOL LLFloaterChat::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash )
{
LLView* chat_editor = getChildView("Chat Editor");
if (childIsVisible("Chat Editor"))
if (getVisible() && childIsVisible("Chat Editor"))
{
gFocusMgr.setKeyboardFocus(chat_editor);
LLUICtrl * ctrl = static_cast<LLUICtrl*>(chat_editor);
ctrl->setFocus(TRUE);
return TRUE;
}

View File

@@ -32,6 +32,7 @@
*/
#include "llviewerprecompiledheaders.h"
#include "lfsimfeaturehandler.h"
#include "llalertdialog.h"
#include "llcheckboxctrl.h"
#include "llfloaterperms.h"
@@ -40,7 +41,35 @@
#include "llviewerwindow.h"
#include "lluictrlfactory.h"
#include "llpermissions.h"
#include "hippogridmanager.h"
namespace
{
bool everyone_export;
void handle_checkboxes(LLUICtrl* ctrl, const LLSD& value)
{
LLPanel* view = static_cast<LLPanel*>(ctrl->getParent());
if (ctrl->getName() == "everyone_export")
{
view->childSetEnabled("next_owner_copy", !value);
view->childSetEnabled("next_owner_modify", !value);
view->childSetEnabled("next_owner_transfer", !value);
}
else
{
if (ctrl->getName() == "next_owner_copy")
{
if (!value) // Implements fair use
gSavedSettings.setBOOL("NextOwnerTransfer", true);
view->childSetEnabled("next_owner_transfer", value);
}
if (!value) // If any of these are unchecked, export can no longer be checked.
view->childSetEnabled("everyone_export", false);
else
view->childSetEnabled("everyone_export", LFSimFeatureHandler::instance().simSupportsExport() && (LLFloaterPerms::getNextOwnerPerms() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED);
}
}
}
LLFloaterPerms::LLFloaterPerms(const LLSD& seed)
{
@@ -49,11 +78,35 @@ LLFloaterPerms::LLFloaterPerms(const LLSD& seed)
BOOL LLFloaterPerms::postBuild()
{
childSetEnabled("next_owner_transfer", gSavedSettings.getBOOL("NextOwnerCopy"));
//handle_checkboxes
{
bool export_support = LFSimFeatureHandler::instance().simSupportsExport();
const U32 next_owner_perms = getNextOwnerPerms();
childSetEnabled("everyone_export", export_support && (next_owner_perms & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED);
if (!gHippoGridManager->getCurrentGrid()->isSecondLife())
childSetVisible("everyone_export", false);
if (!(next_owner_perms & PERM_COPY))
{
childSetEnabled("next_owner_transfer", false);
}
else if (export_support)
{
bool export_off = !gSavedPerAccountSettings.getBOOL("EveryoneExport");
childSetEnabled("next_owner_copy", export_off);
childSetEnabled("next_owner_modify", export_off);
childSetEnabled("next_owner_transfer", export_off);
}
else // Set EveryoneExport false, just in case.
gSavedPerAccountSettings.setBOOL("EveryoneExport", false);
}
childSetAction("help", onClickHelp, this);
childSetAction("ok", onClickOK, this);
childSetAction("cancel", onClickCancel, this);
childSetCommitCallback("next_owner_copy", &onCommitCopy, this);
getChild<LLUICtrl>("next_owner_copy")->setCommitCallback(handle_checkboxes);
getChild<LLUICtrl>("next_owner_modify")->setCommitCallback(handle_checkboxes);
getChild<LLUICtrl>("next_owner_transfer")->setCommitCallback(handle_checkboxes);
getChild<LLUICtrl>("everyone_export")->setCommitCallback(handle_checkboxes);
refresh();
@@ -76,20 +129,6 @@ void LLFloaterPerms::onClickCancel(void* data)
self->close();
}
//static
void LLFloaterPerms::onCommitCopy(LLUICtrl* ctrl, void* data)
{
LLFloaterPerms* self = static_cast<LLFloaterPerms*>(data);
// Implements fair use
BOOL copyable = gSavedSettings.getBOOL("NextOwnerCopy");
if(!copyable)
{
gSavedSettings.setBOOL("NextOwnerTransfer", TRUE);
}
LLCheckBoxCtrl* xfer = self->getChild<LLCheckBoxCtrl>("next_owner_transfer");
xfer->setEnabled(copyable);
}
void LLFloaterPerms::ok()
{
refresh(); // Changes were already applied to saved settings. Refreshing internal values makes it official.
@@ -102,6 +141,7 @@ void LLFloaterPerms::cancel()
gSavedSettings.setBOOL("NextOwnerCopy", mNextOwnerCopy);
gSavedSettings.setBOOL("NextOwnerModify", mNextOwnerModify);
gSavedSettings.setBOOL("NextOwnerTransfer", mNextOwnerTransfer);
gSavedPerAccountSettings.setBOOL("EveryoneExport", everyone_export);
}
void LLFloaterPerms::refresh()
@@ -111,6 +151,7 @@ void LLFloaterPerms::refresh()
mNextOwnerCopy = gSavedSettings.getBOOL("NextOwnerCopy");
mNextOwnerModify = gSavedSettings.getBOOL("NextOwnerModify");
mNextOwnerTransfer = gSavedSettings.getBOOL("NextOwnerTransfer");
everyone_export = gSavedPerAccountSettings.getBOOL("EveryoneExport");
}
void LLFloaterPerms::onClose(bool app_quitting)
@@ -130,7 +171,12 @@ U32 LLFloaterPerms::getGroupPerms(std::string prefix)
//static
U32 LLFloaterPerms::getEveryonePerms(std::string prefix)
{
return gSavedSettings.getBOOL(prefix+"EveryoneCopy") ? PERM_COPY : PERM_NONE;
U32 flags = PERM_NONE;
if (LFSimFeatureHandler::instance().simSupportsExport() && prefix.empty() && gSavedPerAccountSettings.getBOOL("EveryoneExport")) // TODO: Bulk enable export?
flags |= PERM_EXPORT;
if (gSavedSettings.getBOOL(prefix+"EveryoneCopy"))
flags |= PERM_COPY;
return flags;
}
//static

View File

@@ -47,7 +47,6 @@ public:
void cancel();
static void onClickOK(void*);
static void onClickCancel(void*);
static void onCommitCopy(LLUICtrl* ctrl, void* data);
// Convenience methods to get current permission preference bitfields from saved settings:
static U32 getEveryonePerms(std::string prefix=""); // prefix + "EveryoneCopy"
static U32 getGroupPerms(std::string prefix=""); // prefix + "ShareWithGroup"

View File

@@ -60,6 +60,7 @@
#include "lluictrlfactory.h"
#include "lfsimfeaturehandler.h"
#include "hippogridmanager.h"
@@ -67,6 +68,8 @@
#include "rlvhandler.h"
// [/RLVa:KB]
bool can_set_export(const U32& base, const U32& own, const U32& next);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLPropertiesObserver
//
@@ -197,6 +200,9 @@ LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect&
// everyone permissions
childSetCommitCallback("CheckEveryoneCopy",&onCommitPermissions, this);
childSetCommitCallback("CheckEveryoneMove",&onCommitPermissions, this);
childSetCommitCallback("CheckExport", &onCommitPermissions, this);
if (!gHippoGridManager->getCurrentGrid()->isSecondLife())
LFSimFeatureHandler::instance().setSupportsExportCallback(boost::bind(&LLFloaterProperties::refresh, this));
// next owner permissions
childSetCommitCallback("CheckNextOwnerModify",&onCommitPermissions, this);
childSetCommitCallback("CheckNextOwnerCopy",&onCommitPermissions, this);
@@ -251,11 +257,13 @@ void LLFloaterProperties::refresh()
"CheckOwnerModify",
"CheckOwnerCopy",
"CheckOwnerTransfer",
"CheckOwnerExport",
"CheckGroupCopy",
"CheckGroupMod",
"CheckGroupMove",
"CheckEveryoneCopy",
"CheckEveryoneMove",
"CheckExport",
"CheckNextOwnerModify",
"CheckNextOwnerCopy",
"CheckNextOwnerTransfer",
@@ -437,6 +445,12 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
childSetEnabled("CheckOwnerTransfer",FALSE);
childSetValue("CheckOwnerTransfer",LLSD((BOOL)(owner_mask & PERM_TRANSFER)));
bool supports_export = LFSimFeatureHandler::instance().simSupportsExport();
childSetEnabled("CheckOwnerExport",false);
childSetValue("CheckOwnerExport", supports_export && owner_mask & PERM_EXPORT);
if (!gHippoGridManager->getCurrentGrid()->isSecondLife())
childSetVisible("CheckOwnerExport", false);
///////////////////////
// DEBUG PERMISSIONS //
///////////////////////
@@ -459,11 +473,15 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
perm_string = "B: ";
perm_string += mask_to_string(base_mask);
if (!supports_export && base_mask & PERM_EXPORT) // Hide Export when not available
perm_string.erase(perm_string.find_last_of("E"));
childSetText("BaseMaskDebug",perm_string);
childSetVisible("BaseMaskDebug",TRUE);
perm_string = "O: ";
perm_string += mask_to_string(owner_mask);
if (!supports_export && owner_mask & PERM_EXPORT) // Hide Export when not available
perm_string.erase(perm_string.find_last_of("E"));
childSetText("OwnerMaskDebug",perm_string);
childSetVisible("OwnerMaskDebug",TRUE);
@@ -476,6 +494,8 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
perm_string = "E";
perm_string += overwrite_everyone ? "*: " : ": ";
perm_string += mask_to_string(everyone_mask);
if (!supports_export && everyone_mask & PERM_EXPORT) // Hide Export when not available
perm_string.erase(perm_string.find_last_of("E"));
childSetText("EveryoneMaskDebug",perm_string);
childSetVisible("EveryoneMaskDebug",TRUE);
@@ -519,6 +539,8 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
childSetEnabled("CheckEveryoneCopy",false);
childSetEnabled("CheckEveryoneMove",false);
}
childSetEnabled("CheckExport", supports_export && item->getType() != LLAssetType::AT_OBJECT && gAgentID == item->getCreatorUUID()
&& can_set_export(base_mask, owner_mask, next_owner_mask));
// Set values.
BOOL is_group_copy = (group_mask & PERM_COPY) ? TRUE : FALSE;
@@ -531,6 +553,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
childSetValue("CheckEveryoneCopy",LLSD((BOOL)(everyone_mask & PERM_COPY)));
childSetValue("CheckEveryoneMove",LLSD((BOOL)(everyone_mask & PERM_MOVE)));
childSetValue("CheckExport", supports_export && everyone_mask & PERM_EXPORT);
///////////////
// SALE INFO //
@@ -545,10 +568,11 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
childSetEnabled("SaleLabel",is_complete);
childSetEnabled("CheckPurchase",is_complete);
childSetEnabled("NextOwnerLabel",TRUE);
childSetEnabled("CheckNextOwnerModify",base_mask & PERM_MODIFY);
childSetEnabled("CheckNextOwnerCopy",base_mask & PERM_COPY);
childSetEnabled("CheckNextOwnerTransfer",next_owner_mask & PERM_COPY);
bool no_export = !(everyone_mask & PERM_EXPORT); // Next owner perms can't be changed if set
childSetEnabled("NextOwnerLabel", no_export);
childSetEnabled("CheckNextOwnerModify", no_export && base_mask & PERM_MODIFY);
childSetEnabled("CheckNextOwnerCopy", no_export && base_mask & PERM_COPY);
childSetEnabled("CheckNextOwnerTransfer", no_export && next_owner_mask & PERM_COPY);
childSetEnabled("RadioSaleType",is_complete && is_for_sale);
childSetEnabled("TextPrice",is_complete && is_for_sale);
@@ -750,6 +774,11 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data)
perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(),
CheckEveryoneCopy->get(), PERM_COPY);
}
LLCheckBoxCtrl* CheckExport = self->getChild<LLCheckBoxCtrl>("CheckExport");
if(CheckExport)
{
perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(), CheckExport->get(), PERM_EXPORT);
}
LLCheckBoxCtrl* CheckNextOwnerModify = self->getChild<LLCheckBoxCtrl>("CheckNextOwnerModify");
if(CheckNextOwnerModify)

View File

@@ -2609,9 +2609,13 @@ const bool LLFloaterIMPanel::isModerator(const LLUUID& speaker_id)
BOOL LLFloaterIMPanel::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash )
{
LLView* chat_editor = getChildView("chat_editor");
if (childIsVisible("chat_editor"))
if (getVisible() && childIsVisible("chat_editor"))
{
gFocusMgr.setKeyboardFocus(chat_editor);
LLUICtrl * ctrl = static_cast<LLUICtrl*>(chat_editor);
ctrl->setFocus(TRUE);
return TRUE;
}
@@ -2621,8 +2625,13 @@ BOOL LLFloaterIMPanel::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash
void LLFloaterIMPanel::onFocusReceived()
{
LLView* chat_editor = getChildView("chat_editor");
if (childIsVisible("chat_editor"))
if (getVisible() && childIsVisible("chat_editor"))
{
gFocusMgr.setKeyboardFocus(chat_editor);
LLUICtrl * ctrl = static_cast<LLUICtrl*>(chat_editor);
ctrl->setFocus(TRUE);
}
LLFloater::onFocusReceived();
}

View File

@@ -67,7 +67,9 @@
#include "lluictrlfactory.h"
#include "roles_constants.h"
#include "lltrans.h"
#include "llinventoryfunctions.h"
#include "lfsimfeaturehandler.h"
#include "hippogridmanager.h"
@@ -76,6 +78,32 @@
#include "rlvhandler.h"
// [/RLVa:KB]
// base and own must have EXPORT, next owner must be UNRESTRICTED
bool can_set_export(const U32& base, const U32& own, const U32& next)
{
return base & PERM_EXPORT && own & PERM_EXPORT && (next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED;
}
bool perms_allow_export(const LLPermissions& perms)
{
return perms.getMaskBase() & PERM_EXPORT && perms.getMaskEveryone() & PERM_EXPORT;
}
bool is_asset_exportable(const LLUUID& asset_id)
{
if (asset_id.isNull()) return true; // Don't permission-check null textures
LLViewerInventoryCategory::cat_array_t cats;
LLViewerInventoryItem::item_array_t items;
LLAssetIDMatches asset_id_matches(asset_id);
gInventory.collectDescendentsIf(LLUUID::null, cats, items, true, asset_id_matches, false);
for (int i = 0; i < items.count(); ++i)
{
if (perms_allow_export(items[i]->getPermissions())) return true;
}
return false;
}
///----------------------------------------------------------------------------
/// Class llpanelpermissions
///----------------------------------------------------------------------------
@@ -112,6 +140,8 @@ BOOL LLPanelPermissions::postBuild()
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("Edit Cost",LLPanelPermissions::onCommitSaleInfo,this);
@@ -136,6 +166,9 @@ BOOL LLPanelPermissions::postBuild()
mLabelGroupName = NULL;
}
if (!gHippoGridManager->getCurrentGrid()->isSecondLife())
LFSimFeatureHandler::instance().setSupportsExportCallback(boost::bind(&LLPanelPermissions::refresh, this));
return TRUE;
}
@@ -145,6 +178,14 @@ LLPanelPermissions::~LLPanelPermissions()
// base class will take care of everything
}
// virtual
void LLPanelPermissions::handleVisibilityChange(BOOL new_visibility)
{
llwarns << "Hey, does this warning show whenever you switch to this tab?" << llendl; // Find out if the addition of this function is actually worthwhile.
if (new_visibility)
refresh();
LLPanel::handleVisibilityChange(new_visibility);
}
void LLPanelPermissions::refresh()
{
@@ -223,10 +264,13 @@ void LLPanelPermissions::refresh()
childSetEnabled("checkbox share with group",false);
childSetEnabled("button deed",false);
childSetEnabled("text anyone can", false);
childSetValue("checkbox allow everyone move",FALSE);
childSetEnabled("checkbox allow everyone move",false);
childSetValue("checkbox allow everyone copy",FALSE);
childSetEnabled("checkbox allow everyone copy",false);
childSetValue("checkbox allow export", false);
childSetEnabled("checkbox allow export", false);
//Next owner can:
childSetEnabled("Next owner can:",false);
@@ -601,6 +645,7 @@ void LLPanelPermissions::refresh()
&next_owner_mask_on,
&next_owner_mask_off);
bool supports_export = LFSimFeatureHandler::instance().simSupportsExport();
if( gSavedSettings.getBOOL("DebugPermissions") )
{
@@ -610,6 +655,8 @@ void LLPanelPermissions::refresh()
{
perm_string = "B: ";
perm_string += mask_to_string(base_mask_on);
if (!supports_export && base_mask_on & PERM_EXPORT) // Hide Export when not available
perm_string.erase(perm_string.find_last_of("E"));
if (U32 diff_mask = base_mask_on ^ owner_mask_on) // When different, show the user's potential permissions lowercase.
{
if (diff_mask & PERM_MOVE)
@@ -620,12 +667,16 @@ void LLPanelPermissions::refresh()
LLStringUtil::replaceChar(perm_string, 'C', 'c');
if (diff_mask & PERM_TRANSFER)
LLStringUtil::replaceChar(perm_string, 'T', 't');
if (diff_mask & PERM_EXPORT)
LLStringUtil::replaceChar(perm_string, 'E', 'e');
}
childSetText("B:",perm_string);
childSetVisible("B:",true);
perm_string = "O: ";
perm_string += mask_to_string(owner_mask_on);
if (!supports_export && owner_mask_on & PERM_EXPORT) // Hide Export when not available
perm_string.erase(perm_string.find_last_of("E"));
childSetText("O:",perm_string);
childSetVisible("O:",true);
@@ -636,6 +687,8 @@ void LLPanelPermissions::refresh()
perm_string = "E: ";
perm_string += mask_to_string(everyone_mask_on);
if (!supports_export && everyone_mask_on & PERM_EXPORT) // Hide Export when not available
perm_string.erase(perm_string.find_last_of("E"));
childSetText("E:",perm_string);
childSetVisible("E:",true);
@@ -688,16 +741,41 @@ void LLPanelPermissions::refresh()
if (has_change_perm_ability)
{
childSetEnabled("checkbox share with group",true);
childSetEnabled("text anyone can", true);
childSetEnabled("checkbox allow everyone move",owner_mask_on & PERM_MOVE);
childSetEnabled("checkbox allow everyone copy",owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER);
}
else
{
childSetEnabled("checkbox share with group", FALSE);
childSetEnabled("text anyone can", false);
childSetEnabled("checkbox allow everyone move", FALSE);
childSetEnabled("checkbox allow everyone copy", FALSE);
}
// Is this user allowed to toggle export on this object?
if (supports_export && self_owned && mCreatorID == mOwnerID && can_set_export(base_mask_on, owner_mask_on, next_owner_mask_on))
{
bool can_export = true;
LLInventoryObject::object_list_t objects;
objectp->getInventoryContents(objects);
for (LLInventoryObject::object_list_t::iterator i = objects.begin(); can_export && i != objects.end() ; ++i) //The object's inventory must have EXPORT.
{
LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(i->get()); //getInventoryContents() filters out categories, static_cast.
can_export = perms_allow_export(item->getPermissions());
}
for (U8 i = 0; can_export && i < objectp->getNumTEs(); ++i) // Can the textures be exported?
if (LLTextureEntry* texture = objectp->getTE(i))
can_export = is_asset_exportable(texture->getID());
childSetEnabled("checkbox allow export", can_export);
}
else
{
childSetEnabled("checkbox allow export", false);
if (!gHippoGridManager->getCurrentGrid()->isSecondLife())
childSetVisible("checkbox allow export", false);
}
if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER))
{
childSetEnabled("checkbox for sale", can_transfer || (!can_transfer && num_for_sale));
@@ -706,10 +784,11 @@ void LLPanelPermissions::refresh()
childSetTentative("checkbox for sale", is_for_sale_mixed);
childSetEnabled("sale type",num_for_sale && can_transfer && !is_sale_price_mixed);
childSetEnabled("Next owner can:", TRUE);
childSetEnabled("checkbox next owner can modify",base_mask_on & PERM_MODIFY);
childSetEnabled("checkbox next owner can copy",base_mask_on & PERM_COPY);
childSetEnabled("checkbox next owner can transfer",next_owner_mask_on & PERM_COPY);
bool no_export = everyone_mask_off & PERM_EXPORT; // Next owner perms can't be changed if set
childSetEnabled("Next owner can:", no_export);
childSetEnabled("checkbox next owner can modify", no_export && base_mask_on & PERM_MODIFY);
childSetEnabled("checkbox next owner can copy", no_export && base_mask_on & PERM_COPY);
childSetEnabled("checkbox next owner can transfer", no_export && next_owner_mask_on & PERM_COPY);
}
else
{
@@ -779,6 +858,31 @@ void LLPanelPermissions::refresh()
childSetValue("checkbox allow everyone copy",TRUE);
childSetTentative("checkbox allow everyone copy",true);
}
// Export
if (supports_export)
{
if(everyone_mask_on & PERM_EXPORT)
{
childSetValue("checkbox allow export", true);
childSetTentative("checkbox allow export", false);
}
else if(everyone_mask_off & PERM_EXPORT)
{
childSetValue("checkbox allow export", false);
childSetTentative("checkbox allow export", false);
}
else
{
childSetValue("checkbox allow export", true);
childSetTentative("checkbox allow export", true);
}
}
else
{
childSetValue("checkbox allow export", false);
childSetTentative("checkbox allow export", false);
}
}
if(valid_next_perms)
@@ -1064,6 +1168,11 @@ void LLPanelPermissions::onCommitEveryoneCopy(LLUICtrl *ctrl, void *data)
onCommitPerm(ctrl, data, PERM_EVERYONE, PERM_COPY);
}
void LLPanelPermissions::onCommitExport(const LLSD& param)
{
LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_EVERYONE, param, PERM_EXPORT);
}
// static
void LLPanelPermissions::onCommitNextOwnerModify(LLUICtrl* ctrl, void* data)
{

View File

@@ -57,6 +57,7 @@ public:
virtual ~LLPanelPermissions();
virtual BOOL postBuild();
virtual void handleVisibilityChange(BOOL new_visibility);
// MANIPULATORS
void refresh(); // refresh all labels as needed
@@ -86,6 +87,7 @@ protected:
static void onCommitEveryoneMove(LLUICtrl *ctrl, void *data);
static void onCommitEveryoneCopy(LLUICtrl *ctrl, void *data);
//static void onCommitEveryoneModify(LLUICtrl *ctrl, void *data);
void onCommitExport(const LLSD& param);
static void onCommitNextOwnerModify(LLUICtrl* ctrl, void* data);
static void onCommitNextOwnerCopy(LLUICtrl* ctrl, void* data);

View File

@@ -80,9 +80,10 @@
initial_value="false" label="Copy" left_delta="78" mouse_opaque="true"
name="CheckOwnerCopy" radio_style="false" width="88" />
<check_box bottom="-155" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Resell/Give away" left_delta="88"
initial_value="false" label="Transfer" left_delta="88"
mouse_opaque="true" name="CheckOwnerTransfer" radio_style="false"
width="106" />
<check_box name="CheckOwnerExport" label="Export" bottom_delta="0" follows="left|top" left_delta="88" enabled="false"/>
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-165" drop_shadow_visible="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="left" height="10" left="10"
@@ -140,6 +141,7 @@
<check_box bottom_delta="0" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Move" left_delta="88" mouse_opaque="true"
name="CheckEveryoneMove" radio_style="false" width="88" />
<check_box name="CheckExport" label="Export" bottom_delta="0" follows="left|top" left_delta="88"/>
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom_delta="-13" drop_shadow_visible="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="left" height="10" left="10"
@@ -153,7 +155,7 @@
initial_value="false" label="Copy" left_delta="78" mouse_opaque="true"
name="CheckNextOwnerCopy" radio_style="false" width="88" />
<check_box bottom_delta="0" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Resell/Give away" left_delta="88"
initial_value="false" label="Transfer" left_delta="88"
mouse_opaque="true" name="CheckNextOwnerTransfer" radio_style="false"
width="106" />
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"

View File

@@ -3,8 +3,9 @@
<panel label="Permissions" name="permissions" width="292" height="120" left="10" border="true" bottom="-140">
<button name="help" label="?" label_selected="?" bottom_delta="-25" height="18" width="22" left="260"/>
<check_box bottom_delta="0" width="106" height="16" left="10" initial_value="false" label="Share with group" name="share_with_group" control_name="ShareWithGroup"/>
<check_box bottom_delta="-32" width="130" height="16" initial_value="false" label="Allow anyone to copy" name="everyone_copy" control_name="EveryoneCopy"/>
<text bottom_delta="-26" name="NextOwnerLabel" height="10">Next owner can:</text>
<check_box bottom_delta="-20" width="130" height="16" initial_value="false" label="Allow anyone to copy" name="everyone_copy" control_name="EveryoneCopy"/>
<check_box bottom_delta="-20" label="Allow exportation" name="everyone_export" control_name="EveryoneExport"/>
<text bottom_delta="-18" name="NextOwnerLabel" height="10">Next owner can:</text>
<check_box bottom_delta="-30" width="78" height="16" initial_value="false" label="Modify" name="next_owner_modify" control_name="NextOwnerModify"/>
<check_box bottom_delta="0" width="88" height="16" left_delta="78" initial_value="false" label="Copy" name="next_owner_copy" control_name="NextOwnerCopy"/>
<check_box bottom_delta="0" width="106" height="16" left_delta="88" initial_value="true" label="Resell/Give away" name="next_owner_transfer" control_name="NextOwnerTransfer"/>

View File

@@ -429,12 +429,14 @@
mouse_opaque="true" name="button deed" scale_image="TRUE"
tool_tip="Group shared objects can be deeded by a group officer."
width="78" />
<check_box bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Allow anyone to move" left="10"
<text name="text anyone can" bottom_delta="-12" left="10" follows="left|top">Anyone can:</text>
<check_box bottom_delta="-24" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Move"
mouse_opaque="true" name="checkbox allow everyone move" width="142" />
<check_box bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Allow anyone to copy" left="10"
<check_box bottom_delta="0" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Copy" left_delta="60"
mouse_opaque="true" name="checkbox allow everyone copy" width="141" />
<check_box name="checkbox allow export" label="Export" bottom_delta="0" left_delta="60" follows="left|top"/>
<check_box bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Show in search" left="10" name="search_check"
tool_tip="Let people see this object in search results" width="78" />