summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterperms.cpp
diff options
context:
space:
mode:
authorJonathan Yap <none@none>2012-06-08 13:49:02 -0400
committerJonathan Yap <none@none>2012-06-08 13:49:02 -0400
commitfbb4e5fb0f7bba935ec9d0d466be12a346a6b149 (patch)
tree40b938b298efb8635a47297844d4c64719c13c52 /indra/newview/llfloaterperms.cpp
parenta519e34f02b4b2663fe082ba9ad12f1b423669cb (diff)
STORM-68 As a Builder, I want that ability to set default permissions on creation of objects, clothing, scripts, notecards, etc.
First pass at implementation, debuggins lines still need to be removed and there is one known bug to be resolved.
Diffstat (limited to 'indra/newview/llfloaterperms.cpp')
-rw-r--r--indra/newview/llfloaterperms.cpp153
1 files changed, 98 insertions, 55 deletions
diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp
index 80b55c3cbb..3853dd0ef6 100644
--- a/indra/newview/llfloaterperms.cpp
+++ b/indra/newview/llfloaterperms.cpp
@@ -37,96 +37,139 @@
LLFloaterPerms::LLFloaterPerms(const LLSD& seed)
: LLFloater(seed)
{
- mCommitCallbackRegistrar.add("Perms.Copy", boost::bind(&LLFloaterPerms::onCommitCopy, this));
- mCommitCallbackRegistrar.add("Perms.OK", boost::bind(&LLFloaterPerms::onClickOK, this));
- mCommitCallbackRegistrar.add("Perms.Cancel", boost::bind(&LLFloaterPerms::onClickCancel, this));
-
}
BOOL LLFloaterPerms::postBuild()
{
- mCloseSignal.connect(boost::bind(&LLFloaterPerms::cancel, this));
-
- refresh();
-
- return TRUE;
+ return true;
}
-void LLFloaterPerms::onClickOK()
-{
- ok();
- closeFloater();
+//static
+U32 LLFloaterPerms::getGroupPerms(std::string prefix)
+{
+ return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY : PERM_NONE;
}
-void LLFloaterPerms::onClickCancel()
+//static
+U32 LLFloaterPerms::getEveryonePerms(std::string prefix)
{
- cancel();
- closeFloater();
+ return gSavedSettings.getBOOL(prefix+"EveryoneCopy") ? PERM_COPY : PERM_NONE;
}
-void LLFloaterPerms::onCommitCopy()
+//static
+U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix)
{
- // Implements fair use
- BOOL copyable = gSavedSettings.getBOOL("NextOwnerCopy");
- if(!copyable)
+ U32 flags = PERM_MOVE;
+ if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") )
{
- gSavedSettings.setBOOL("NextOwnerTransfer", TRUE);
+ flags |= PERM_COPY;
}
- LLCheckBoxCtrl* xfer = getChild<LLCheckBoxCtrl>("next_owner_transfer");
- xfer->setEnabled(copyable);
+ if ( gSavedSettings.getBOOL(prefix+"NextOwnerModify") )
+ {
+ flags |= PERM_MODIFY;
+ }
+ if ( gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") )
+ {
+ flags |= PERM_TRANSFER;
+ }
+ return flags;
}
-void LLFloaterPerms::ok()
+//static
+U32 LLFloaterPerms::getNextOwnerPermsInverted(std::string prefix)
{
- refresh(); // Changes were already applied to saved settings. Refreshing internal values makes it official.
+ // Sets bits for permissions that are off
+ U32 flags = PERM_MOVE;
+ if ( !gSavedSettings.getBOOL(prefix+"NextOwnerCopy") )
+ {
+ flags |= PERM_COPY;
+ }
+ if ( !gSavedSettings.getBOOL(prefix+"NextOwnerModify") )
+ {
+ flags |= PERM_MODIFY;
+ }
+ if ( !gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") )
+ {
+ flags |= PERM_TRANSFER;
+ }
+ return flags;
}
-void LLFloaterPerms::cancel()
+LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed)
+: LLFloater(seed)
{
- gSavedSettings.setBOOL("ShareWithGroup", mShareWithGroup);
- gSavedSettings.setBOOL("EveryoneCopy", mEveryoneCopy);
- gSavedSettings.setBOOL("NextOwnerCopy", mNextOwnerCopy);
- gSavedSettings.setBOOL("NextOwnerModify", mNextOwnerModify);
- gSavedSettings.setBOOL("NextOwnerTransfer", mNextOwnerTransfer);
+ mCommitCallbackRegistrar.add("PermsDefault.Copy", boost::bind(&LLFloaterPermsDefault::onCommitCopy, this, _2));
+ mCommitCallbackRegistrar.add("PermsDefault.OK", boost::bind(&LLFloaterPermsDefault::onClickOK, this));
+ mCommitCallbackRegistrar.add("PermsDefault.Cancel", boost::bind(&LLFloaterPermsDefault::onClickCancel, this));
}
-void LLFloaterPerms::refresh()
+BOOL LLFloaterPermsDefault::postBuild()
{
- mShareWithGroup = gSavedSettings.getBOOL("ShareWithGroup");
- mEveryoneCopy = gSavedSettings.getBOOL("EveryoneCopy");
- mNextOwnerCopy = gSavedSettings.getBOOL("NextOwnerCopy");
- mNextOwnerModify = gSavedSettings.getBOOL("NextOwnerModify");
- mNextOwnerTransfer = gSavedSettings.getBOOL("NextOwnerTransfer");
+ mCloseSignal.connect(boost::bind(&LLFloaterPermsDefault::cancel, this));
+
+ category_names[CAT_OBJECTS] = "Objects";
+ category_names[CAT_UPLOADS] = "Uploads";
+ category_names[CAT_SCRIPTS] = "Scripts";
+ category_names[CAT_NOTECARDS] = "Notecards";
+ category_names[CAT_GESTURES] = "Gestures";
+ category_names[CAT_WEARABLES] = "Wearables";
+
+ refresh();
+
+ return true;
}
-//static
-U32 LLFloaterPerms::getGroupPerms(std::string prefix)
-{
- return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY : PERM_NONE;
+void LLFloaterPermsDefault::onClickOK()
+{
+ ok();
+ closeFloater();
}
-//static
-U32 LLFloaterPerms::getEveryonePerms(std::string prefix)
+void LLFloaterPermsDefault::onClickCancel()
{
- return gSavedSettings.getBOOL(prefix+"EveryoneCopy") ? PERM_COPY : PERM_NONE;
+ cancel();
+ closeFloater();
}
-//static
-U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix)
+void LLFloaterPermsDefault::onCommitCopy(const LLSD& user_data)
{
- U32 flags = PERM_MOVE;
- if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") )
+ // Implements fair use
+ std::string prefix = user_data.asString();
+
+ BOOL copyable = gSavedSettings.getBOOL(prefix+"NextOwnerCopy");
+ if(!copyable)
{
- flags |= PERM_COPY;
+ gSavedSettings.setBOOL(prefix+"NextOwnerTransfer", TRUE);
}
- if ( gSavedSettings.getBOOL(prefix+"NextOwnerModify") )
+ LLCheckBoxCtrl* xfer = getChild<LLCheckBoxCtrl>(prefix+"_transfer");
+ xfer->setEnabled(copyable);
+}
+
+void LLFloaterPermsDefault::ok()
+{
+ refresh(); // Changes were already applied to saved settings. Refreshing internal values makes it official.
+}
+
+void LLFloaterPermsDefault::cancel()
+{
+ for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++)
{
- flags |= PERM_MODIFY;
+ gSavedSettings.setBOOL(category_names[iter]+"NextOwnerCopy", mNextOwnerCopy[iter]);
+ gSavedSettings.setBOOL(category_names[iter]+"NextOwnerModify", mNextOwnerModify[iter]);
+ gSavedSettings.setBOOL(category_names[iter]+"NextOwnerTransfer", mNextOwnerTransfer[iter]);
+ gSavedSettings.setBOOL(category_names[iter]+"ShareWithGroup", mShareWithGroup[iter]);
+ gSavedSettings.setBOOL(category_names[iter]+"EveryoneCopy", mEveryoneCopy[iter]);
}
- if ( gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") )
+}
+
+void LLFloaterPermsDefault::refresh()
+{
+ for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++)
{
- flags |= PERM_TRANSFER;
+ mShareWithGroup[iter] = gSavedSettings.getBOOL(category_names[iter]+"ShareWithGroup");
+ mEveryoneCopy[iter] = gSavedSettings.getBOOL(category_names[iter]+"EveryoneCopy");
+ mNextOwnerCopy[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerCopy");
+ mNextOwnerModify[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerModify");
+ mNextOwnerTransfer[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerTransfer");
}
- return flags;
}
-