void ApplicationUI::OnInvokeFinished() {
	InvokeTargetReply *reply = qobject_cast<InvokeTargetReply*>(sender());
	if (reply->error()) {
		qDebug() << "Invoke Failed - Do something";
	}
	reply->deleteLater();
}
Esempio n. 2
0
void TCUFPE::showCamera() {
	InvokeRequest cardRequest;
	cardRequest.setTarget("sys.camera.card");
	cardRequest.setAction("bb.action.CAPTURE");
	cardRequest.setData("photo");
	InvokeTargetReply* reply = m_iManager->invoke(cardRequest);
	reply->setParent(this);

	connect(m_iManager,
			SIGNAL(childCardDone(const bb::system::CardDoneMessage &)), this,
			SLOT(onCameraCardDone(const bb::system::CardDoneMessage &)));
	qDebug() << "waiting for you";
}
Esempio n. 3
0
void ApplicationUI::invokeEmail(QString email)
{
	InvokeManager manager;
	InvokeRequest request;

	// Setup what to show and in what target.
	request.setTarget("sys.pim.uib.email.hybridcomposer");
	request.setAction("bb.action.OPEN, bb.action.SENDEMAIL");
	request.setUri("mailto:"+email);
	InvokeTargetReply *targetReply = manager.invoke(request);
	//setting the parent to "this" will make the manager live on after this function is destroyed
	manager.setParent(this);

	if (targetReply == NULL) {
		qDebug() << "InvokeTargetReply is NULL: targetReply = " << targetReply;
	} else {
		targetReply->setParent(this);
	}
}
Esempio n. 4
0
void
NSRFileSharer::invokeUri (const QString& uri, const QString& target, const QString& action)
{
	InvokeManager		invokeManager;
	InvokeRequest		invokeRequest;
	InvokeTargetReply	*invokeReply;

	invokeRequest.setUri (QUrl (uri));
	invokeRequest.setAction (action);
	invokeRequest.setTarget (target);

	invokeReply = invokeManager.invoke (invokeRequest);

	if (invokeReply != NULL) {
		invokeReply->setParent (this);
		bool ok = connect (invokeReply, SIGNAL (finished ()), invokeReply, SLOT (deleteLater ()));
		Q_UNUSED (ok);
		Q_ASSERT (ok);
	}
}
void PhotoBomberApp::showPhotoInCard(const QString fileName)
{
    // Create InvokeManager and InvokeRequest objects to able to invoke a card with a viewer that will show the
    // latest bomber photo.
    bb::system::InvokeManager manager;
    bb::system::InvokeRequest request;

    // Setup what to show and in what target.
    request.setUri(QUrl::fromLocalFile(fileName));
    request.setTarget("sys.pictures.card.previewer");
    request.setAction("bb.action.VIEW");
    InvokeTargetReply *targetReply = manager.invoke(request);
    //setting the parent to "this" will make the manager live on after this function is destroyed
    manager.setParent(this);

    if (targetReply == NULL) {
        qDebug() << "InvokeTargetReply is NULL: targetReply = " << targetReply;
    } else {
        targetReply->setParent(this);
    }
}
Esempio n. 6
0
void Card::on_invoked(const bb::system::InvokeRequest& request)
{
    qDebug() << "==== Card::onInvoked() START ====";

    emit load_configuration();

    QVariantMap metadata    = request.metadata();
    QString source          = request.source().installId() + " - " + request.source().groupId();
    QString listId          = QString::number(request.listId());
    QString action          = request.action();
    QString target          = request.target();
    QString uri             = request.uri().toString();
    QString data            = QString::fromUtf8(request.data());

    qDebug() << "==== Card::onInvoked(): action: " << action << data << ", uri: " << uri;

    if(action == "bb.action.VIEW")
    {
        JsonDataAccess jda;
        QVariantMap objectMap   = (jda.loadFromBuffer(data)).toMap();
        QVariantMap itemMap     = objectMap["attributes"].toMap();
        QString messageID1      = itemMap["messageid"].toString();
        QString sourceID1       = itemMap["sourceId"].toString();

        QString itemsFromJSON   = Utilities::get_string_from_file("data/hub_items.json");

        QVariantList itemsFromJSONList = jda.loadFromBuffer(itemsFromJSON).toList();

        qDebug() << "**** Card::onInvoked: itemsFromJSONList: " << itemsFromJSONList.size() << ", sourceId1: " << sourceID1 << ", messageID1: " << messageID1;

        for(int index = 0; index < itemsFromJSONList.size(); index++)
        {
            QVariantMap attributes    = itemsFromJSONList.at(index).toMap();
            QString pageName          = attributes["thePage"].toString();
            QString theData           = attributes["theData"].toString();
            QString sourceID2         = attributes["sourceId"].toString();

            qDebug() << "**** Card::onInvoked: thePage" << pageName << ", theData: " << theData << ", sourceId2: " << sourceID2;

            if (sourceID2 == messageID1 || sourceID2 == sourceID1)
            {
                InvokeRequest request2;
                request2.setTarget("com.nemory.Insta10HeadlessService");
                request2.setAction("bb.action.MARKREAD");
                request2.setMimeType("hub/item");
                request2.setUri(QUrl("pim:"));

                QByteArray bytes;
                jda.saveToBuffer(objectMap, &bytes);
                request2.setData(bytes);

                InvokeTargetReply *reply = _invoke_manager->invoke(request2);

                if (!reply)
                {
                    qDebug() << "**** FAILED Card::onInvoked: " << reply->errorCode();
                    reply->deleteLater();
                }

                QmlDocument *pageDocument  = QmlDocument::create("asset:///pages/" + pageName).parent(this);
                _page = pageDocument->createRootObject<Page>();
                _page->setProperty("is_card", true);
                //_page->setActionBarVisibility((getSetting("backButton", "false") == "false") ? ChromeVisibility::Hidden : ChromeVisibility::Default);
                _navigation_pane->push(_page);
                Application::instance()->setScene(_navigation_pane);

                emit initialize_card();

                emit opened_item(attributes, theData);

                break;
            }
        }

        jda.deleteLater();
    }
    else if(action == "bb.action.COMPOSE")
    {

    }
    else if(action == "bb.action.SHARE")
    {

        startHeadless();
    }
    else
    {
        startHeadless();
    }
}