示例#1
0
// static
void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p)
{
	lldebugs << "url = " << p.url() << ", target = " << p.target() << ", uuid = " << p.id() << llendl;

	if (!p.id.isProvided())
	{
		p.id = LLUUID::generateNewID().asString();
	}

	if(p.target().empty() || p.target() == "_blank")
	{
		p.target = p.id();
	}

	S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
	if(browser_window_limit != 0)
	{
		// showInstance will open a new window.  Figure out how many web browsers are already open,
		// and close the least recently opened one if this will put us over the limit.

		LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList(p.window_class);
		lldebugs << "total instance count is " << instances.size() << llendl;

		for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++)
		{
			lldebugs << "    " << (*iter)->getKey()["target"] << llendl;
		}

		if(instances.size() >= (size_t)browser_window_limit)
		{
			// Destroy the least recently opened instance
			(*instances.begin())->closeFloater();
		}
	}
}
static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarName& av_name, bool web)
{
	if (gSavedSettings.getString("WebProfileURL").empty() || !(web || gSavedSettings.getBOOL("UseWebProfiles")))
	{
		LLFloaterAvatarInfo* floater = LLFloaterAvatarInfo::getInstance(agent_id);
		if(!floater)
		{
			floater = new LLFloaterAvatarInfo(av_name.getCompleteName()+" - "+LLTrans::getString("Command_Profile_Label"), agent_id);
			floater->center();
		}

		// ...bring that window to front
		floater->open();	/*Flawfinder: ignore*/
	}
	else
	{
		std::string username = av_name.mUsername;
		if (username.empty())
		{
			username = LLCacheName::buildUsername(av_name.mDisplayName);
		}

		llinfos << "opening web profile for " << username << llendl;
		std::string url = getProfileURL(username);

		// PROFILES: open in webkit window
		LLFloaterWebContent::Params p;
		p.url(url).
			id(agent_id.asString());
		LLFloaterWebProfile::showInstance(get_profile_floater_name(agent_id), p);
	}
}
示例#3
0
static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarName& av_name)
{
	std::string url = getProfileURL(av_name.getAccountName());

	// PROFILES: open in webkit window
	LLFloaterWebContent::Params p;
	p.url(url).id(agent_id.asString());
	LLFloaterReg::showInstance(get_profile_floater_name(agent_id), p);
}
示例#4
0
void show_log_browser(const std::string& name, const std::string& id)
{
#if LL_WINDOWS // Singu TODO: Other platforms?
	if (gSavedSettings.getBOOL("LiruLegacyLogLaunch"))
	{
		gViewerWindow->getWindow()->ShellEx("\"" + LLLogChat::makeLogFileName(name) + "\"");
		return;
	}
#endif
	LLFloaterWebContent::Params p;
	p.url("file:///" + LLLogChat::makeLogFileName(name));
	p.id(id);
	p.show_chrome(false);
	p.trusted_content(true);
	LLFloaterWebContent::showInstance("log", p); // If we passed id instead of "log", there would be no control over how many log browsers opened at once.
}
// static
void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p)
{
    LL_DEBUGS() << "url = " << p.url() << ", target = " << p.target() << ", uuid = " << p.id() << LL_ENDL;

    if (!p.id.isProvided())
    {
        p.id = LLUUID::generateNewID().asString();
    }

    if(p.target().empty() || p.target() == "_blank")
    {
        p.target = p.id();
    }

    S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
    if(browser_window_limit != 0)
    {
        // showInstance will open a new window.  Figure out how many web browsers are already open,
        // and close the least recently opened one if this will put us over the limit.

        std::vector<LLFloaterWebContent*> instances;
        instances.reserve(instanceCount());
        for(instance_iter it(beginInstances()), it_end(endInstances()); it != it_end; ++it)
        {
            if(it->mKey["window_class"].asString() == p.window_class.getValue())
                instances.push_back(&*it);
        }

        std::sort(instances.begin(), instances.end(), CompareAgeDescending());

        //LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList(p.window_class);
        LL_DEBUGS() << "total instance count is " << instances.size() << LL_ENDL;

        for(std::vector<LLFloaterWebContent*>::const_iterator iter = instances.begin(); iter != instances.end(); iter++)
        {
            LL_DEBUGS() << "    " << (*iter)->mKey["target"] << LL_ENDL;
        }

        if(instances.size() >= (size_t)browser_window_limit)
        {
            // Destroy the least recently opened instance
            (*instances.begin())->close();
        }
    }
}
void show_log_browser(const std::string& name, const std::string& id)
{
	const std::string file(LLLogChat::makeLogFileName(name));
	if (gSavedSettings.getBOOL("LiruLegacyLogLaunch"))
	{
#if LL_WINDOWS || LL_DARWIN
		gViewerWindow->getWindow()->ShellEx(file);
#elif LL_LINUX
		// xdg-open might not actually be installed on all distros, but it's our best bet.
		if (!std::system(("/usr/bin/xdg-open \"" + file +'"').c_str())) // 0 = success, otherwise fallback on internal browser.
#endif
		return;
	}
	LLFloaterWebContent::Params p;
	p.url("file:///" + file);
	p.id(id);
	p.show_chrome(false);
	p.trusted_content(true);
	LLFloaterWebContent::showInstance("log", p); // If we passed id instead of "log", there would be no control over how many log browsers opened at once.
}
static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarName& av_name, bool web)
{
	static LLCachedControl<std::string> web_profile_url("WebProfileURL");
	static LLCachedControl<bool> use_web_profiles("UseWebProfiles");

	std::string wpu = web_profile_url;
	if (wpu.empty() || !(web || use_web_profiles))
	{
		LLFloaterAvatarInfo* floater = LLFloaterAvatarInfo::getInstance(agent_id);
		if(!floater)
		{
			floater = new LLFloaterAvatarInfo(av_name.getCompleteName()+" - "+LLTrans::getString("Command_Profile_Label"), agent_id);

			// I'd rather have it remember its position ...
			static LLCachedControl<bool> floater_centers("RtyFloaterProfileCenters");
			if(floater_centers)
			{
				floater->center();
			}
			else
			{
				floater->center_right();
			}
		}

		// ...bring that window to front
		floater->open();	/*Flawfinder: ignore*/
	}
	else
	{
		std::string url = getProfileURL(av_name.getAccountName());

		// PROFILES: open in webkit window
		LLFloaterWebContent::Params p;
		p.url(url).id(agent_id.asString());
		LLFloaterWebProfile::showInstance(get_profile_floater_name(agent_id), p);
	}
}
示例#8
0
// static
// Explicitly open a Web URL using the Web content floater
void LLWeb::loadURLInternal(const std::string &url, const std::string& target, const std::string& uuid)
{
	LLFloaterWebContent::Params p;
	p.url(url).target(target).id(uuid);
	LLFloaterReg::showInstance("web_content", p);
}