// 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
	}
}
Ejemplo n.º 2
0
void App::onInvoked(const InvokeRequest &request)
{
    if (m_configurationService.hasConfiguration()) {
        // The underlying PushService instance might not have been
        // initialized when an invoke first comes in
        // Make sure that we initialize it here if it hasn't been already
        // It requires an application ID (for consumer applications) so we have to check
        // that configuration settings have already been stored
        m_pushNotificationService.initializePushService();

        if (request.action().compare(BB_PUSH_INVOCATION_ACTION) == 0) {
            qDebug() << "Received push action";
            // Received an incoming push
            // Extract it from the invoke request and then process it
            PushPayload payload(request);
            if (payload.isValid()) {
                pushNotificationHandler(payload);
            }
        } else if (request.action().compare(BB_OPEN_INVOCATION_ACTION) == 0){
            qDebug() << "Received open action";
            // Received an invoke request to open an existing push (ie. from a notification in the BlackBerry Hub)
            // The payload from the open invoke is the seqnum for the push in the database
            openPush(request.data().toInt());
        }
    }
}
Ejemplo n.º 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();
}
Ejemplo n.º 4
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();
}
Ejemplo n.º 5
0
void App::onInvoked(const InvokeRequest &request)
{
	if (request.action().compare(BB_OPEN_INVOCATION_ACTION) == 0){
		qDebug() << "Received open action";
		// Received an invoke request to open an existing push (ie. from a notification in the BlackBerry Hub)
		// The payload from the open invoke is the seqnum for the push in the database
		openPush(request.data().toInt());
	}
}