Пример #1
0
void PgcRouterApp::handleInvoke(const InvokeRequest& request) {
	// Copy data from incoming invocation request to properties
	m_source =
			QString::fromLatin1("%1 (%2)").arg(request.source().installId()).arg(
					request.source().groupId());
	m_target = request.target();
	m_action = request.action();
	m_mimeType = request.mimeType();
	m_uri = request.uri().toString();
	m_data = QString::fromUtf8(request.data());

	QUrl uri = request.uri();

	QFile file(uri.toLocalFile());

	if (m_target == "com.destinywireless.app.pgcrouter") {

	} else if (m_target == "com.destinywireless.app.pgcsender") {

	} else if (m_target == "com.destinywireless.card.formeditor") {

	} else if (m_target == "com.destinywireless.card.formviewer") {

	} else if (m_target == "com.destinywireless.card.attachphoto") {

	}

	// Signal that the properties have changed
	emit requestChanged();
}
// triggered if Application was invoked by a client
void OpenDataSpace::handleInvoke(const InvokeRequest& request) {
	// TODO
	qDebug() << "Invoke Request";
	qDebug() << "Invoke Request Action:" << request.action();
	qDebug() << "Invoke Request Mime:" << request.mimeType();
	qDebug() << "Invoke Request URI:" << request.uri();
	qDebug() << "Invoke Request Data:" << request.data();
	m_invokationTarget = request.target();
	m_invokationSource = QString::fromLatin1("%1 (%2)").arg(
			request.source().installId()).arg(request.source().groupId());
	qDebug() << "Invoke Target ID: " << m_invokationTarget << " from Source: "
			<< m_invokationSource;
	// Invoked as Application
	if (m_invokationTarget == "io.ods.bb10.invoke") {
		m_isCard = false;
		qDebug() << "Invoked";
	}
	// invoked as embedded Card (Previewer) from OPEN or SHARE
	else if (m_invokationTarget == "io.ods.bb10.card.upload.previewer") {
		m_isCard = true;
		qDebug() << "Invoked for UploadCard as Previewer";
	}
	// invoked as embedded Card (Composer) from OPEN
	else if (m_invokationTarget == "io.ods.bb10.upload.composer") {
		m_isCard = true;
		qDebug() << "Invoked for UploadCard as Composer";
	}
	// do some preparing-stuff for a invoked Card
	// reset values (can come from pool)
	// set some infos
	// tell the Card that its a new invocation
	if (m_isCard) {
		AbstractPane *p = Application::instance()->scene();
		bool ok = false;
		// if there's a URI we take the URI
		// else we take the data
		if (request.uri().isEmpty()) {
			ok = p->setProperty("filePath", request.data());
		} else {
			ok = p->setProperty("filePath", request.uri());
		}
		if (!ok) {
			qDebug() << "Cannot set filePath";
		}
		// start a new Card Game ;-)
		// setting newCard true causes testing if LogIn was needed before upload files
		ok = p->setProperty("newCard", true);
		if (ok) {
			qDebug() << "set newCard to true";
		} else {
			qDebug() << "cannot set newCard";
		}
	} else {
		// do what needed if Invoked, per ex. switch to Upload TAB
	}
}
Пример #3
0
//! [1]
void App::handleInvoke(const InvokeRequest& request)
{
    // Copy data from incoming invocation request to properties
    m_source = QString::fromLatin1("%1 (%2)").arg(request.source().installId()).arg(request.source().groupId());
    m_target = request.target();
    m_action = request.action();
    m_mimeType = request.mimeType();
    m_uri = request.uri().toString();
    m_data = QString::fromUtf8(request.data());

    m_backButtonVisible = false;

    if (m_target == "com.example.bb10samples.invocation.openimage1") {
        m_title = tr("Open Image 1");
    } else if (m_target == "com.example.bb10samples.invocation.openimage2") {
        m_title = tr("Open Image 2");
    } else if (m_target == "com.example.bb10samples.invocation.card.previewer") {
        m_title = tr("Previewer");
        m_backButtonVisible = true;
    } else if (m_target == "com.example.bb10samples.invocation.card.composer") {
        m_title = tr("Composer");
    } else if (m_target == "com.example.bb10samples.invocation.card.picker") {
        m_title = tr("Picker");
    }

    // Signal that the properties have changed
    emit requestChanged();
}
/**
 * uses Invokation Framework to View the file from URI
 *
 */
void OpenDataSpace::showInView(QString uri) {
	qDebug() << "showInView called: " << uri;
	InvokeRequest invokeRequest;
	invokeRequest.setAction("bb.action.VIEW");
	invokeRequest.setUri(uri);
	qDebug() << "showInView URI: " << invokeRequest.uri();
	m_invokeManager->invoke(invokeRequest);
}
/**
 * uses Invokation Framework to View the file from URI
 * for a specific target like "sys.pictures.app"
 *
 */
void ApplicationUI::showInTarget(QString uri, QString target) {
	qDebug() << "showInTarget called: " << uri;
	InvokeRequest invokeRequest;
	invokeRequest.setAction("bb.action.VIEW");
	invokeRequest.setUri(uri);
	invokeRequest.setTarget(target);
	qDebug() << "showInTarget URI: " << invokeRequest.uri();
	mInvokeManager->invoke(invokeRequest);
}
/**
 * uses Invokation Framework to View the file from URI
 * for a specific MimeType
 *
 */
void ApplicationUI::showInViewForMimeType(QString uri, QString mimeType) {
	qDebug() << "showInViewForMimeType called: " << uri;
	InvokeRequest invokeRequest;
	invokeRequest.setAction("bb.action.VIEW");
	invokeRequest.setUri(uri);
	invokeRequest.setMimeType(mimeType);
	qDebug() << "showInViewForMimeType URI: " << invokeRequest.uri() << " Mime:"
			<< mimeType;
	mInvokeManager->invoke(invokeRequest);
}
/**
 * uses Invokation Framework to View the file from URI
 * for a specific MimeType
 * and for a specific target like "sys.pictures.app"
 *
 */
void OpenDataSpace::showInTargetForMimeType(QString uri, QString mimeType,
		QString target) {
	qDebug() << "showInTargetForMimeType called: " << uri;
	InvokeRequest invokeRequest;
	invokeRequest.setAction("bb.action.VIEW");
	invokeRequest.setUri(uri);
	invokeRequest.setTarget(target);
	invokeRequest.setMimeType(mimeType);
	qDebug() << "showInTargetForMimeType URI: " << invokeRequest.uri()
			<< " MimeType:" << mimeType;
	m_invokeManager->invoke(invokeRequest);
}
/**
 * uses Invokation Framework to View the file from URI
 *
 */
void ApplicationUI::showInView(QString uri) {
	qDebug() << "showInView called: " << uri;
	if (uri.endsWith(".ogg")) {
		invokeBoundMediaPlayer(uri);
		return;
	}
	if (uri.endsWith(".svg")) {
		invokeBrowser(uri);
		return;
	}
	InvokeRequest invokeRequest;
	invokeRequest.setAction("bb.action.VIEW");
	invokeRequest.setUri(uri);
	qDebug() << "showInView URI: " << invokeRequest.uri();
	mInvokeManager->invoke(invokeRequest);
}