PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llfloaterwhitelistentry.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 91 lines | 41 code | 15 blank | 35 comment | 1 complexity | 94f43f6b2aeb4e0d68844ca569ba3096 MD5 | raw file
 1/**
 2 * @file llfloaterwhitelistentry.cpp
 3 * @brief LLFloaterWhistListEntry class implementation
 4 *
 5 * $LicenseInfo:firstyear=2007&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 */
26
27#include "llviewerprecompiledheaders.h"
28
29#include "llfloaterreg.h"
30#include "llfloatermediasettings.h"
31#include "llfloaterwhitelistentry.h"
32#include "llpanelmediasettingssecurity.h"
33#include "lluictrlfactory.h"
34#include "llwindow.h"
35#include "llviewerwindow.h"
36#include "lllineeditor.h"
37
38
39///////////////////////////////////////////////////////////////////////////////
40//
41LLFloaterWhiteListEntry::LLFloaterWhiteListEntry( const LLSD& key ) :
42	LLFloater(key)
43{
44}
45
46///////////////////////////////////////////////////////////////////////////////
47//
48LLFloaterWhiteListEntry::~LLFloaterWhiteListEntry()
49{
50}
51
52///////////////////////////////////////////////////////////////////////////////
53//
54BOOL LLFloaterWhiteListEntry::postBuild()
55{
56	mWhiteListEdit = getChild<LLLineEditor>("whitelist_entry");
57
58	childSetAction("cancel_btn", onBtnCancel, this);
59	childSetAction("ok_btn", onBtnOK, this);
60
61	setDefaultBtn("ok_btn");
62
63	return TRUE;
64}
65
66///////////////////////////////////////////////////////////////////////////////
67// static
68void LLFloaterWhiteListEntry::onBtnOK( void* userdata )
69{
70	LLFloaterWhiteListEntry *self =(LLFloaterWhiteListEntry *)userdata;
71
72	LLPanelMediaSettingsSecurity* panel = LLFloaterReg::getTypedInstance<LLFloaterMediaSettings>("media_settings")->getPanelSecurity();
73	if ( panel )
74	{
75		std::string white_list_item = self->mWhiteListEdit->getText();
76
77		panel->addWhiteListEntry( white_list_item );
78		panel->updateWhitelistEnableStatus();
79	};
80	
81	self->closeFloater();	
82}
83
84///////////////////////////////////////////////////////////////////////////////
85// static
86void LLFloaterWhiteListEntry::onBtnCancel( void* userdata )
87{
88	LLFloaterWhiteListEntry *self =(LLFloaterWhiteListEntry *)userdata;
89	
90	self->closeFloater();
91}