aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterperms.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llfloaterperms.cpp')
-rw-r--r--linden/indra/newview/llfloaterperms.cpp159
1 files changed, 159 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloaterperms.cpp b/linden/indra/newview/llfloaterperms.cpp
new file mode 100644
index 0000000..52fba0a
--- /dev/null
+++ b/linden/indra/newview/llfloaterperms.cpp
@@ -0,0 +1,159 @@
1/**
2 * @file llfloaterperms.cpp
3 * @brief Asset creation permission preferences.
4 * @author Coco
5 *
6 * $LicenseInfo:firstyear=2001&license=viewergpl$
7 *
8 * Copyright (c) 2001-2009, Linden Research, Inc.
9 *
10 * Second Life Viewer Source Code
11 * The source code in this file ("Source Code") is provided by Linden Lab
12 * to you under the terms of the GNU General Public License, version 2.0
13 * ("GPL"), unless you have obtained a separate licensing agreement
14 * ("Other License"), formally executed by you and Linden Lab. Terms of
15 * the GPL can be found in doc/GPL-license.txt in this distribution, or
16 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
17 *
18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 *
24 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above,
26 * and agree to abide by those obligations.
27 *
28 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
29 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
30 * COMPLETENESS OR PERFORMANCE.
31 * $/LicenseInfo$
32 */
33
34#include "llviewerprecompiledheaders.h"
35#include "llalertdialog.h"
36#include "llcheckboxctrl.h"
37#include "llfloaterperms.h"
38#include "llviewercontrol.h"
39#include "llviewerwindow.h"
40#include "lluictrlfactory.h"
41#include "llpermissions.h"
42
43
44LLFloaterPerms::LLFloaterPerms(const LLSD& seed)
45{
46 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_perm_prefs.xml");
47}
48
49BOOL LLFloaterPerms::postBuild()
50{
51 childSetEnabled("next_owner_transfer", gSavedSettings.getBOOL("NextOwnerCopy"));
52 childSetAction("help", onClickHelp, this);
53 childSetAction("ok", onClickOK, this);
54 childSetAction("cancel", onClickCancel, this);
55 childSetCommitCallback("next_owner_copy", &onCommitCopy, this);
56
57 refresh();
58
59 return TRUE;
60}
61
62//static
63void LLFloaterPerms::onClickOK(void* data)
64{
65 LLFloaterPerms* self = static_cast<LLFloaterPerms*>(data);
66 self->ok();
67 self->close();
68}
69
70//static
71void LLFloaterPerms::onClickCancel(void* data)
72{
73 LLFloaterPerms* self = static_cast<LLFloaterPerms*>(data);
74 self->cancel();
75 self->close();
76}
77
78//static
79void LLFloaterPerms::onCommitCopy(LLUICtrl* ctrl, void* data)
80{
81 LLFloaterPerms* self = static_cast<LLFloaterPerms*>(data);
82 // Implements fair use
83 BOOL copyable = gSavedSettings.getBOOL("NextOwnerCopy");
84 if(!copyable)
85 {
86 gSavedSettings.setBOOL("NextOwnerTransfer", TRUE);
87 }
88 LLCheckBoxCtrl* xfer = self->getChild<LLCheckBoxCtrl>("next_owner_transfer");
89 xfer->setEnabled(copyable);
90}
91
92void LLFloaterPerms::ok()
93{
94 refresh(); // Changes were already applied to saved settings. Refreshing internal values makes it official.
95}
96
97void LLFloaterPerms::cancel()
98{
99 gSavedSettings.setBOOL("ShareWithGroup", mShareWithGroup);
100 gSavedSettings.setBOOL("EveryoneCopy", mEveryoneCopy);
101 gSavedSettings.setBOOL("NextOwnerCopy", mNextOwnerCopy);
102 gSavedSettings.setBOOL("NextOwnerModify", mNextOwnerModify);
103 gSavedSettings.setBOOL("NextOwnerTransfer", mNextOwnerTransfer);
104}
105
106void LLFloaterPerms::refresh()
107{
108 mShareWithGroup = gSavedSettings.getBOOL("ShareWithGroup");
109 mEveryoneCopy = gSavedSettings.getBOOL("EveryoneCopy");
110 mNextOwnerCopy = gSavedSettings.getBOOL("NextOwnerCopy");
111 mNextOwnerModify = gSavedSettings.getBOOL("NextOwnerModify");
112 mNextOwnerTransfer = gSavedSettings.getBOOL("NextOwnerTransfer");
113}
114
115void LLFloaterPerms::onClose(bool app_quitting)
116{
117 // Cancel any unsaved changes before closing.
118 // Note: when closed due to the OK button this amounts to a no-op.
119 cancel();
120 LLFloater::onClose(app_quitting);
121}
122
123//static
124U32 LLFloaterPerms::getGroupPerms(std::string prefix)
125{
126 return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY : PERM_NONE;
127}
128
129//static
130U32 LLFloaterPerms::getEveryonePerms(std::string prefix)
131{
132 return gSavedSettings.getBOOL(prefix+"EveryoneCopy") ? PERM_COPY : PERM_NONE;
133}
134
135//static
136U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix)
137{
138 U32 flags = 0;
139 if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") )
140 {
141 flags |= PERM_COPY;
142 }
143 if ( gSavedSettings.getBOOL(prefix+"NextOwnerModify") )
144 {
145 flags |= PERM_MODIFY;
146 }
147 if ( gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") )
148 {
149 flags |= PERM_TRANSFER;
150 }
151 return flags;
152}
153
154
155//static
156void LLFloaterPerms::onClickHelp(void* data)
157{
158 LLNotifications::instance().add("ClickUploadHelpPermissions");
159}