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);
		}
	}
}
Example #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);
}
Example #3
0
void IpcClientHost::onSetWindowProperties(int key, const std::string& winPropsStr)
{
	Window* win = findWindow(key);
	if (!win)
		return;

	if (winPropsStr.empty())
		return;

	json_object* json = 0;
	json_object* label = 0;
	WindowProperties winProps;

	json = json_tokener_parse(winPropsStr.c_str());
	if (!json || is_error(json))
		return;

	label = json_object_object_get(json, "blockScreenTimeout");
	if (label && json_object_is_type(label, json_type_boolean))
		winProps.setBlockScreenTimeout(json_object_get_boolean(label));

	label = json_object_object_get(json, "subtleLightbar");
	if (label && json_object_is_type(label, json_type_boolean))
		winProps.setSubtleLightbar(json_object_get_boolean(label));

	label = json_object_object_get(json, "fullScreen");
	if (label && json_object_is_type(label, json_type_boolean))
		winProps.setFullScreen(json_object_get_boolean(label));

	label = json_object_object_get(json, "activeTouchpanel");
	if (label && json_object_is_type(label, json_type_boolean))
		winProps.setActiveTouchpanel(json_object_get_boolean(label));

	label = json_object_object_get(json, "alsDisabled");
	if (label && json_object_is_type(label, json_type_boolean))
		winProps.setAlsDisabled(json_object_get_boolean(label));

	label = json_object_object_get(json, "enableCompass");
		if (label && json_object_is_type(label, json_type_boolean))
			winProps.setCompassEvents(json_object_get_boolean(label));

	label = json_object_object_get(json, "enableGyro");
			if (label && json_object_is_type(label, json_type_boolean))
				winProps.setAllowGyroEvents(json_object_get_boolean(label));

	label = json_object_object_get(json, "overlayNotificationsPosition");
	if (label && json_object_is_type(label, json_type_string)) {
		const char* str = json_object_get_string(label);
		if (str) {
			if (strcasecmp(str, "left") == 0)
				winProps.setOverlayNotificationsPosition(WindowProperties::OverlayNotificationsLeft);
			else if (strcasecmp(str, "right") == 0)
				winProps.setOverlayNotificationsPosition(WindowProperties::OverlayNotificationsRight);
			else if (strcasecmp(str, "top") == 0)
				winProps.setOverlayNotificationsPosition(WindowProperties::OverlayNotificationsTop);
			else
				winProps.setOverlayNotificationsPosition(WindowProperties::OverlayNotificationsBottom);
		}
	}

	label = json_object_object_get(json, "suppressBannerMessages");
	if (label && json_object_is_type(label, json_type_boolean))
		winProps.setSuppressBannerMessages(json_object_get_boolean(label));

	label = json_object_object_get(json, "hasPauseUi");
	if (label && json_object_is_type(label, json_type_boolean))
		winProps.setHasPauseUi(json_object_get_boolean(label));

	label = json_object_object_get(json, "suppressGestures");
	if (label && json_object_is_type(label, json_type_boolean))
		winProps.setSuppressGestures(json_object_get_boolean(label));

	label = json_object_object_get(json, "webosDragMode");
	if (label && json_object_is_type(label, json_type_boolean)) {
		winProps.setDashboardManualDragMode(json_object_get_boolean(label));
	}

	label = json_object_object_get(json, "statusBarColor");
	if (label && json_object_is_type(label, json_type_int))
		winProps.setStatusBarColor(json_object_get_int(label));

	label = json_object_object_get(json, "rotationLockMaximized");
	if (label && json_object_is_type(label, json_type_boolean)) {
		winProps.setRotationLockMaximized(json_object_get_boolean(label));
	}

	label = json_object_object_get(json, "allowResizeOnPositiveSpaceChange");
	if (label && json_object_is_type(label, json_type_boolean))
		winProps.setAllowResizeOnPositiveSpaceChange(json_object_get_boolean(label));

	/*label = json_object_object_get(json, "appId");
	if (label && json_object_is_type(label, json_type_string))
	{
		const char* str = json_object_get_string(label);
		if (str)
		{
			// only CardHostWindows get this property set
			CardHostWindow *chw = (CardHostWindow *)win;

			// tell ModalManager all about it
			//ModalManager::instance()->registerCard(chw, str);
		}
	}*/

	json_object_put(json);

	WindowServer::instance()->setWindowProperties(win, winProps);
}