diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llfloaterpermissionsmgr.cpp | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloaterpermissionsmgr.cpp | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloaterpermissionsmgr.cpp b/linden/indra/newview/llfloaterpermissionsmgr.cpp new file mode 100644 index 0000000..05945d9 --- /dev/null +++ b/linden/indra/newview/llfloaterpermissionsmgr.cpp | |||
@@ -0,0 +1,168 @@ | |||
1 | /** | ||
2 | * @file llfloaterpermissionsmgr.cpp | ||
3 | * @brief for user control of script permissions | ||
4 | * | ||
5 | * Copyright (c) 2003-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #include "llviewerprecompiledheaders.h" | ||
29 | |||
30 | #include "llfloaterpermissionsmgr.h" | ||
31 | |||
32 | #include "llscrollcontainer.h" | ||
33 | #include "lltextbox.h" | ||
34 | #include "llbutton.h" | ||
35 | #include "llagent.h" | ||
36 | #include "llviewerobjectlist.h" | ||
37 | #include "llviewerregion.h" | ||
38 | #include "llstl.h" | ||
39 | |||
40 | // constants | ||
41 | const S32 MIN_PERM_MGR_WIDTH = 100; | ||
42 | const S32 MIN_PERM_MGR_HEIGHT = 100; | ||
43 | const S32 VPAD = 8; | ||
44 | const S32 HPAD = 8; | ||
45 | const S32 LINE = 16; | ||
46 | |||
47 | // statics | ||
48 | LLFloaterPermissionsMgr* LLFloaterPermissionsMgr::sInstance = NULL; | ||
49 | |||
50 | LLFloaterPermissionsMgr* LLFloaterPermissionsMgr::show() | ||
51 | { | ||
52 | if (!sInstance) | ||
53 | { | ||
54 | sInstance = new LLFloaterPermissionsMgr(); | ||
55 | |||
56 | sInstance->open(); | ||
57 | gFloaterView->adjustToFitScreen(sInstance, TRUE); | ||
58 | } | ||
59 | else | ||
60 | { | ||
61 | sInstance->open(); | ||
62 | } | ||
63 | |||
64 | return sInstance; | ||
65 | } | ||
66 | |||
67 | void LLFloaterPermissionsMgr::processPermissionsList(LLMessageSystem* msg, void**) | ||
68 | { | ||
69 | } | ||
70 | |||
71 | LLFloaterPermissionsMgr::LLFloaterPermissionsMgr() : LLFloater("floater_perm_mgr", "PermissionsManagerRect", "Permissions Manager", TRUE, MIN_PERM_MGR_WIDTH, | ||
72 | MIN_PERM_MGR_HEIGHT) | ||
73 | { | ||
74 | S32 y = mRect.getHeight() - VPAD - LINE; | ||
75 | LLRect scrollable_container_rect(0, y, mRect.getWidth(), 0); | ||
76 | LLRect permissions_rect(0, 0, mRect.getWidth() - HPAD - HPAD, 0); | ||
77 | mPermissions = new LLPermissionsView(permissions_rect); | ||
78 | mScroller = new LLScrollableContainerView( | ||
79 | "permissions container", | ||
80 | scrollable_container_rect, | ||
81 | mPermissions | ||
82 | ); | ||
83 | mScroller->setFollowsAll(); | ||
84 | mScroller->setReserveScrollCorner(TRUE); | ||
85 | addChild(mScroller); | ||
86 | } | ||
87 | |||
88 | LLFloaterPermissionsMgr::~LLFloaterPermissionsMgr() | ||
89 | { | ||
90 | } | ||
91 | |||
92 | |||
93 | // | ||
94 | // LLPermissionsView | ||
95 | // | ||
96 | |||
97 | LLPermissionsView::LLPermissionsView(const LLRect &rect) : LLView("permissions_view", rect, TRUE, FOLLOWS_NONE) | ||
98 | { | ||
99 | } | ||
100 | |||
101 | EWidgetType LLPermissionsView::getWidgetType() const | ||
102 | { | ||
103 | return WIDGET_TYPE_PERMISSIONS_VIEW; | ||
104 | } | ||
105 | |||
106 | LLString LLPermissionsView::getWidgetTag() const | ||
107 | { | ||
108 | return LL_PERMISSIONS_VIEW_TAG; | ||
109 | } | ||
110 | |||
111 | void LLPermissionsView::clearPermissionsData() | ||
112 | { | ||
113 | deleteAllChildren(); | ||
114 | std::for_each(mPermData.begin(), mPermData.end(), DeletePairedPointer()); | ||
115 | mPermData.clear(); | ||
116 | } | ||
117 | |||
118 | void LLPermissionsView::addPermissionsData(const LLString& object_name, const LLUUID& object_id, U32 permissions_flags) | ||
119 | { | ||
120 | // grow to make room for new element | ||
121 | LLPermissionsData* perm_datap = new LLPermissionsData(object_id, permissions_flags); | ||
122 | |||
123 | reshape(mRect.getWidth(), mRect.getHeight() + LINE + VPAD + BTN_HEIGHT + VPAD); | ||
124 | S32 y = mRect.getHeight() - LINE - VPAD; | ||
125 | LLRect label_rect(HPAD, y + LINE, mRect.getWidth(), y); | ||
126 | LLTextBox* text = new LLTextBox("perm_label", label_rect, object_name.c_str()); | ||
127 | text->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM); | ||
128 | addChild(text); | ||
129 | |||
130 | y -= LINE + VPAD; | ||
131 | |||
132 | LLRect btn_rect(HPAD, y + BTN_HEIGHT, 120, y); | ||
133 | LLButton* button = new LLButton("Revoke permissions", btn_rect, "", revokePermissions, (void*)perm_datap); | ||
134 | button->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM); | ||
135 | addChild(button); | ||
136 | |||
137 | btn_rect.set(HPAD + 120 + HPAD, y + BTN_HEIGHT, HPAD + 120 + HPAD + 120, y); | ||
138 | button = new LLButton("Find in world", btn_rect, "", findObject, (void*)perm_datap); | ||
139 | button->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM); | ||
140 | addChild(button); | ||
141 | |||
142 | mPermData.insert(std::make_pair(object_id, perm_datap)); | ||
143 | } | ||
144 | |||
145 | void LLPermissionsView::revokePermissions(void *userdata) | ||
146 | { | ||
147 | LLPermissionsData* perm_data = (LLPermissionsData*)userdata; | ||
148 | if (perm_data) | ||
149 | { | ||
150 | LLViewerObject* objectp = gObjectList.findObject(perm_data->mObjectID); | ||
151 | if (objectp) | ||
152 | { | ||
153 | LLMessageSystem* msg = gMessageSystem; | ||
154 | msg->newMessageFast(_PREHASH_RevokePermissions); | ||
155 | msg->nextBlockFast(_PREHASH_AgentData); | ||
156 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | ||
157 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | ||
158 | msg->nextBlockFast(_PREHASH_Data); | ||
159 | msg->addUUIDFast(_PREHASH_ObjectID, perm_data->mObjectID); | ||
160 | msg->addU32Fast(_PREHASH_ObjectPermissions, perm_data->mPermFlags); | ||
161 | msg->sendReliable(objectp->getRegion()->getHost()); | ||
162 | } | ||
163 | } | ||
164 | } | ||
165 | |||
166 | void LLPermissionsView::findObject(void *userdata) | ||
167 | { | ||
168 | } | ||