Ejemplo n.º 1
0
void DashboardWebApp::attach(SysMgrWebBridge* page)
{
	WindowedWebApp::attach(page);

	const StringVariantMap& stageArgs = page->stageArguments();

	StringVariantMap::const_iterator it = stageArgs.find("icon");
	if (it != stageArgs.end()) {

		m_channel->sendAsyncMessage(new ViewHost_Dashboard_SetIcon(routingId(), it.value().toString().toStdString()));
	}

	it = stageArgs.find("clickablewhenlocked");
	if (it == stageArgs.end())
		it = stageArgs.find("clickableWhenLocked");

	if (it != stageArgs.end()) {

		QVariant v = it.value();
		if (v.type() == QVariant::Bool)
			m_channel->sendAsyncMessage(new ViewHost_Dashboard_SetClickableWhenLocked(routingId(), v.toBool()));
		else if (v.type() == QVariant::String)
			m_channel->sendAsyncMessage(new ViewHost_Dashboard_SetClickableWhenLocked(routingId(), stringIsTrue(v.toString().toStdString())));
	}

	// Restricted to systemui
	if (page->appId() == "com.palm.systemui") {

		it = stageArgs.find("persistent");
		if (it != stageArgs.end()) {

			QVariant v = it.value();
			if (v.type() == QVariant::Bool)
				m_channel->sendAsyncMessage(new ViewHost_Dashboard_SetPersistent(routingId(), v.toBool()));	
			else if (v.type() == QVariant::String)
				m_channel->sendAsyncMessage(new ViewHost_Dashboard_SetPersistent(routingId(), stringIsTrue(v.toString().toStdString())));	
		}
	}

	it = stageArgs.find("webosdragmode");
	if (it != stageArgs.end()) {

		QVariant v = it.value();
		if (v.type() == QVariant::String && v.toString() == "manual") {
			WindowProperties prop;
			prop.setDashboardManualDragMode(true);
			setWindowProperties(prop);
		}
	}
}
Ejemplo n.º 2
0
void DashboardWebApp::attach(WebPage* page)
{
	WindowProperties prop;
	WindowedWebApp::attach(page);

	const StringVariantMap& stageArgs = page->stageArguments();

	StringVariantMap::const_iterator it = stageArgs.find("icon");
	if (it != stageArgs.end()) {

		m_channel->sendAsyncMessage(new ViewHost_Dashboard_SetIcon(routingId(), it->second.toString().toStdString()));
	}

	it = stageArgs.find("clickablewhenlocked");
	if (it == stageArgs.end())
		it = stageArgs.find("clickableWhenLocked");

	if (it != stageArgs.end()) {

		QVariant v = it->second;
		if (v.type() == QVariant::Bool)
			m_channel->sendAsyncMessage(new ViewHost_Dashboard_SetClickableWhenLocked(routingId(), v.toBool()));
		else if (v.type() == QVariant::String)
			m_channel->sendAsyncMessage(new ViewHost_Dashboard_SetClickableWhenLocked(routingId(), stringIsTrue(v.toString().toStdString())));
	}

	// Restricted to systemui
	if (page->appId() == "com.palm.systemui") {

		it = stageArgs.find("persistent");
		if (it != stageArgs.end()) {

			QVariant v = it->second;
			if (v.type() == QVariant::Bool)
				m_channel->sendAsyncMessage(new ViewHost_Dashboard_SetPersistent(routingId(), v.toBool()));	
			else if (v.type() == QVariant::String)
				m_channel->sendAsyncMessage(new ViewHost_Dashboard_SetPersistent(routingId(), stringIsTrue(v.toString().toStdString())));	
		}
	}

	it = stageArgs.find("webosdragmode");
	if (it != stageArgs.end()) {

		QVariant v = it->second;
		if (v.type() == QVariant::String && v.toString() == "manual") {
			prop.setDashboardManualDragMode(true);
		}
	}

	it = stageArgs.find("dashheight");
	if (it != stageArgs.end()) {
		g_warning("found dashheight argument");
		QVariant v = it->second;
		if(v.type() == QVariant::Int) {
			g_warning("dashheight is unsigned int");
			if(v.toUInt()) {
				g_warning("read successful, setting variables");
				if(v.toUInt() <= 320) {
					prop.setDashHeight(v.toUInt());
					resizeEvent(WebAppManager::instance()->currentUiWidth(), v.toUInt(), false);
				}
				else {
					prop.setDashHeight(320);
					resizeEvent(WebAppManager::instance()->currentUiWidth(), 320, false);
				}
			}
			else {
				g_warning("dashheight not unsigned int, default height");
				prop.setDashHeight(kDashboardWindowHeight);
			}
		}
	}
	
	g_warning("setting window properties");
	setWindowProperties(prop);
}