aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelweb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llpanelweb.cpp')
-rw-r--r--linden/indra/newview/llpanelweb.cpp234
1 files changed, 0 insertions, 234 deletions
diff --git a/linden/indra/newview/llpanelweb.cpp b/linden/indra/newview/llpanelweb.cpp
deleted file mode 100644
index 93441dd..0000000
--- a/linden/indra/newview/llpanelweb.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
1/**
2 * @file LLPanelWeb.cpp
3 * @brief Network preferences panel
4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 *
7 * Copyright (c) 2001-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "llviewerprecompiledheaders.h"
34
35// file include
36#include "llpanelweb.h"
37
38// project includes
39#include "llcheckboxctrl.h"
40#include "hippogridmanager.h"
41#include "lluictrlfactory.h"
42#include "llviewercontrol.h"
43#include "llviewermedia.h"
44#include "llviewerwindow.h"
45#include "llpluginclassmedia.h"
46
47// helper functions for getting/freeing the web browser media
48// if creating/destroying these is too slow, we'll need to create
49// a static member and update all our static callbacks
50viewer_media_t get_web_media()
51{
52
53 viewer_media_t media_source = LLViewerMedia::newMediaImpl("", LLUUID::null, 0, 0, 0, 0, "text/html");
54
55 return media_source;
56}
57
58LLPanelWeb::LLPanelWeb()
59{
60 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_web.xml");
61}
62
63BOOL LLPanelWeb::postBuild()
64{
65 childSetAction("clear_cache", onClickClearCache, this);
66 childSetCommitCallback("web_proxy_enabled", onCommitWebProxyEnabled, this);
67
68 std::string value = gSavedSettings.getBOOL("UseExternalBrowser") ? "external" : "internal";
69 childSetValue("use_external_browser", value);
70
71 childSetValue("cookies_enabled", gSavedSettings.getBOOL("BrowserCookiesEnabled"));
72 childSetAction("clear_cookies", onClickClearCookies,this);
73
74 childSetValue("web_proxy_enabled", gSavedSettings.getBOOL("BrowserProxyEnabled"));
75 childSetValue("web_proxy_editor", gSavedSettings.getString("BrowserProxyAddress"));
76 childSetValue("web_proxy_port", gSavedSettings.getS32("BrowserProxyPort"));
77
78 if (gHippoGridManager->getConnectedGrid()->isSecondLife())
79 {
80 childSetValue("world_search_editor", gSavedSettings.getString("SearchURLQuery")) ;
81 }
82 else
83 {
84 childSetValue("world_search_editor", gSavedSettings.getString("SearchURLQueryOpenSim")) ;
85 }
86 childSetAction("world_search_reset_default", onClickDefault, this);
87 childSetAction("world_search_clear", onClickClear, this);
88
89 childSetEnabled("proxy_text_label", gSavedSettings.getBOOL("BrowserProxyEnabled"));
90 childSetEnabled("web_proxy_editor", gSavedSettings.getBOOL("BrowserProxyEnabled"));
91 childSetEnabled("web_proxy_port", gSavedSettings.getBOOL("BrowserProxyEnabled"));
92
93 return TRUE;
94}
95
96
97
98LLPanelWeb::~LLPanelWeb()
99{
100 // Children all cleaned up by default view destructor.
101}
102
103void LLPanelWeb::apply()
104{
105 gSavedSettings.setBOOL("BrowserCookiesEnabled", childGetValue("cookies_enabled"));
106
107 bool proxy_enable = childGetValue("web_proxy_enabled");
108 std::string proxy_address = childGetValue("web_proxy_editor");
109 int proxy_port = childGetValue("web_proxy_port");
110 gSavedSettings.setBOOL("BrowserProxyEnabled", proxy_enable);
111 gSavedSettings.setString("BrowserProxyAddress", proxy_address);
112 gSavedSettings.setS32("BrowserProxyPort", proxy_port);
113 LLViewerMedia::setProxyConfig(proxy_enable, proxy_address, proxy_port);
114
115 if (gHippoGridManager->getConnectedGrid()->isSecondLife())
116 {
117 gSavedSettings.setString("SearchURLQuery", childGetValue("world_search_editor"));
118 }
119 else
120 {
121 gSavedSettings.setString("SearchURLQueryOpenSim", childGetValue("world_search_editor"));
122 }
123
124 bool value = childGetValue("use_external_browser").asString() == "external" ? true : false;
125 gSavedSettings.setBOOL("UseExternalBrowser", value);
126
127 viewer_media_t media_source = get_web_media();
128 if (media_source && media_source->hasMedia())
129 {
130 media_source->getMediaPlugin()->enable_cookies(childGetValue("cookies_enabled"));
131
132 bool proxy_enable = childGetValue("web_proxy_enabled");
133 std::string proxy_address = childGetValue("web_proxy_editor");
134 int proxy_port = childGetValue("web_proxy_port");
135 media_source->getMediaPlugin()->proxy_setup(proxy_enable, proxy_address, proxy_port);
136 }
137}
138
139void LLPanelWeb::cancel()
140{
141}
142
143// static
144void LLPanelWeb::onClickClearCache(void*)
145{
146 LLNotifications::instance().add("ConfirmClearBrowserCache", LLSD(), LLSD(), callback_clear_browser_cache);
147}
148
149//static
150bool LLPanelWeb::callback_clear_browser_cache(const LLSD& notification, const LLSD& response)
151{
152 S32 option = LLNotification::getSelectedOption(notification, response);
153 if ( option == 0 ) // YES
154 {
155 viewer_media_t media_source = get_web_media();
156 if (media_source && media_source->hasMedia())
157 media_source->getMediaPlugin()->clear_cache();
158 }
159 return false;
160}
161
162// static
163void LLPanelWeb::onClickClearCookies(void*)
164{
165 LLNotifications::instance().add("ConfirmClearCookies", LLSD(), LLSD(), callback_clear_cookies);
166}
167
168//static
169bool LLPanelWeb::callback_clear_cookies(const LLSD& notification, const LLSD& response)
170{
171 S32 option = LLNotification::getSelectedOption(notification, response);
172 if ( option == 0 ) // YES
173 {
174 viewer_media_t media_source = get_web_media();
175 if (media_source && media_source->hasMedia())
176 media_source->getMediaPlugin()->clear_cookies();
177 }
178 return false;
179}
180
181// static
182void LLPanelWeb::onCommitCookies(LLUICtrl* ctrl, void* data)
183{
184 LLPanelWeb* self = (LLPanelWeb*)data;
185 LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl;
186
187 if (!self || !check) return;
188
189 viewer_media_t media_source = get_web_media();
190 if (media_source && media_source->hasMedia())
191 media_source->getMediaPlugin()->enable_cookies(check->get());
192}
193// static
194void LLPanelWeb::onCommitWebProxyEnabled(LLUICtrl* ctrl, void* data)
195{
196 LLPanelWeb* self = (LLPanelWeb*)data;
197 LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl;
198
199 if (!self || !check) return;
200 self->childSetEnabled("web_proxy_editor", check->get());
201 self->childSetEnabled("web_proxy_port", check->get());
202 self->childSetEnabled("proxy_text_label", check->get());
203
204
205}
206
207// static
208void LLPanelWeb::onClickDefault(void* user_data)
209{
210 LLPanelWeb* self = (LLPanelWeb*)user_data;
211 LLControlVariable* controlp =
212 (gHippoGridManager->getConnectedGrid()->isSecondLife())
213 ?
214 gSavedSettings.getControl("SearchURLQuery")
215 :
216 gSavedSettings.getControl("SearchURLQueryOpenSim");
217
218 if (controlp)
219 {
220 self->childSetValue("world_search_editor",controlp->getDefault().asString()) ;
221 }
222 else
223 {
224 llwarns << "SearchURLQuery or SearchURLQueryOpenSim missing from settings.xml - thats bad!" << llendl;
225 }
226
227}
228
229// static
230void LLPanelWeb::onClickClear(void* user_data)
231{
232 LLPanelWeb* self = (LLPanelWeb*)user_data;
233 self->childSetValue("world_search_editor","") ;
234}