void ApplicationUI::onGetResponse(QString& response)
{
	m_pCardHolder->setProperty("visible", false);
	m_pResponseHolder->setProperty("visible", true);
	m_pResponseHolder->setProperty("text", response);

	QDir vcfPath;
	vcfPath.mkdir(QDir::tempPath()+"/data/");
	vcfPath.cd(QDir::tempPath()+"/data/");
	QFile vcfCard(QDir::tempPath()+"/data/readContact.vcf");
	if(!vcfCard.open(QIODevice::WriteOnly | QIODevice::Text))
	{
		showToast("Error Creating new file");
		return;
	}
	QTextStream out(&vcfCard);
	out << response;
	vcfCard.close();

	InvokeManager manager;
	InvokeRequest request;
	request.setTarget("sys.pim.contacts.card.viewer");
	request.setAction("bb.action.VIEW");
	request.setUri("file://" + QDir::tempPath()+"/data/readContact.vcf");
	manager.invoke(request);
}
void ApplicationUI::enableAutoStart()
{

    //Create the InvokeTargetFilter, which matches the filter that was
    //commented out from the bar-descriptor.xml.
InvokeTargetFilter autoStartFilter;
autoStartFilter.addAction("bb.action.system.STARTED");
autoStartFilter.addMimeType("application/vnd.blackberry.system.event.STARTED");
autoStartFilter.addUri("data://local");

    //Create the InvokeUpdateTargetFilterRequest and add the filter we just created.
InvokeUpdateTargetFiltersRequest updateRequest;
updateRequest.setTarget("com.example.DeferredAutoStartService");
QList<InvokeTargetFilter> filterList;
filterList.append(autoStartFilter);
updateRequest.setTargetFilters(filterList);

    //Use InvokeManager to update the filter.
InvokeManager manager;
manager.updateTargetFilters(updateRequest);


    //At this point the headless entry point of the application will auto run when the BlackBerry Smartphone
    //boots up.  However note that this does not start headless portion.  Left as is, it won't start
    //until next reboot.  The code below starts the headless application.

InvokeRequest request;
request.setTarget("com.example.DeferredAutoStartService");
request.setAction("bb.action.system.STARTED");
manager.invoke(request);
}
void ApplicationUI::invoke(QString platform)
{
    // Create a new invocation request
    InvokeRequest request;
    if (platform == "BBM") {
        request.setAction("bb.action.BBMCHAT");
        request.setUri("pin:2B1F7E7B");
        request.setTarget("sys.bbm.sharehandler");
    }
    if (platform == "EMAIL") {
        request.setAction("bb.action.COMPOSE");
        bb::Application* thisApp;
        const QString uri = "mailto:[email protected]?subject=" + thisApp->applicationName() + "%20version%20" + thisApp->applicationVersion();
        request.setUri(uri);
        request.setMimeType("text/plain");
        request.setData("Test");
        request.setTarget("sys.pim.uib.email.hybridcomposer");
    }
    if (platform == "TWITTER") {
        request.setAction("bb.action.VIEW");
        request.setUri("twitter:connect:RodgerLeblanc");
        request.setTarget("com.twitter.urihandler");
    }
    if (platform == "BBW") {
        request.setAction("bb.action.OPEN");
        request.setUri("appworld://vendor/70290");
        request.setTarget("sys.appworld");
    }
    // Start the invocation
    InvokeManager* invokeManager = new InvokeManager(this);
    invokeManager->invoke(request);
    invokeManager->deleteLater();
}
void ApplicationUI::sendEmail() {
	ApplicationInfo appInfo(this);
	InvokeManager *manager = new InvokeManager(this);
	InvokeRequest request;
	request.setTarget("sys.pim.uib.email.hybridcomposer");
	request.setAction("bb.action.COMPOSE");
	request.setMimeType("message/rfc822");
	QVariantMap contentMap;
	contentMap.insert("to", QVariantList() << "*****@*****.**");
	contentMap.insert("subject", "[DS Package Tracker] Support or suggestion");
	contentMap.insert("body", "App version: " + appInfo.version());
	QVariantMap data;
	data.insert("data", contentMap);
	bool ok;
	request.setData(bb::PpsObject::encode(data, &ok));
	manager->invoke(request);
//	InvokeTargetReply* reply =
	manager->invoke(request); // #include <bb/system/InvokeTargetReply>
}
void ApplicationUI::openThisAppInBBW(const QString bbwLink)
{
    InvokeRequest request;
    request.setAction("bb.action.OPEN");
    request.setUri(bbwLink);
    request.setTarget("sys.appworld");

    // Start the invocation
    InvokeManager* invokeManager = new InvokeManager(this);
    invokeManager->invoke(request);
    invokeManager->deleteLater();
}
//invoke Enterprise Instant Messenger
void ApplicationUI::invokeEIM() {
	InvokeManager invokeManager;
	InvokeRequest request;

	// Who do we want to send the invoke request to?
	request.setTarget("com.rim.bb.app.eimclient");

	// What do we want the target application to do with it?
	request.setAction("bb.action.VIEW");

	InvokeTargetReply *reply = invokeManager.invoke(request);
}
Beispiel #7
0
void Mail::openHereMap(const QVariantMap& data)
{
    if(data["latitude"].value<QString>() != "" && data["longitude"].value<QString>() != "") {
        InvokeManager invManager;
        QString gMapString = "https://www.here.com/?map="+data["latitude"].value<QString>()+","+data["longitude"].value<QString>()+",17";
        QString noteText = data["note"].value<QString>() + "\n\n" + gMapString;
        QByteArray sendData;
        sendData.append(noteText);
        qDebug() << sendData;
        invReq.setData(sendData);
        invManager.invoke(invReq);
    }
}
Beispiel #8
0
void Mail::openOpenMap(const QVariantMap& data)
{
    if(data["latitude"].value<QString>() != "" && data["longitude"].value<QString>() != "") {
        InvokeManager invManager;
        QString gMapString = "http://www.openstreetmap.org/#map=16/"+data["latitude"].value<QString>()+"/"+data["longitude"].value<QString>()+"&layers=standard";
        QString noteText = data["note"].value<QString>() + "\n\n" + gMapString;
        QByteArray sendData;
        sendData.append(noteText);
        qDebug() << sendData;
        invReq.setData(sendData);
        invManager.invoke(invReq);
    }
}
Beispiel #9
0
void Mail::openBing(const QVariantMap& data)
{
    if(data["latitude"].value<QString>() != "" && data["longitude"].value<QString>() != "") {
        InvokeManager invManager;
        QString gMapString = "http://www.bing.com/maps/?cp="+data["latitude"].value<QString>()+"~"+data["longitude"].value<QString>()+"&lvl=16&sty=r";
        QString noteText = data["note"].value<QString>() + "\n\n" + gMapString;
        QByteArray sendData;
        sendData.append(noteText);
        qDebug() << sendData;
        invReq.setData(sendData);
        invManager.invoke(invReq);
    }
}
//! [1]
void BarcodeInvoker::onInvokeButtonClicked() const
{
    InvokeManager* imanager = qobject_cast<InvokeManager*>(sender());

    InvokeRequest invokeRequest;
    invokeRequest.setTarget("com.example.CustomBarcodeScanner");
    invokeRequest.setAction("community.action.SCANBARCODE");

    const InvokeTargetReply *invokeReply = imanager->invoke(invokeRequest);

    if (!invokeReply)
        qWarning() << "failed to sent invoke request message";
}
void ApplicationUI::InvokeSmsComposer(QString PhoneNumber) {
	InvokeRequest cardrequest;
	//cardrequest.setTarget("sys.pim.text_messaging.composer"); - not working on WorkSpace perimeter
	//cross-perimeter invoke
	cardrequest.setTarget("sys.pim.text_messaging.smsuri");
	cardrequest.setAction("bb.action.SENDTEXT");
	cardrequest.setUri("tel:" + PhoneNumber);
	InvokeManager invokemanager;
	InvokeTargetReply *reply = invokemanager.invoke(cardrequest);
	if (reply) {
		connect(reply, SIGNAL(finished()), this, SLOT(OnInvokeFinished()));
	} else {
		qDebug() << "Invocation Connecting Failed!!";
	}
}
Beispiel #12
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);
	}
}
//invoke the blakcberry browser
void ApplicationUI::invokeBrowser() {
	InvokeManager invokeManager;
	InvokeRequest request;
	QString uri = "http://bizblog.blackberry.com";

	cout << "uri for browser = $" << uri.toStdString() << endl;


	// Target ID for app we're invoking
	request.setTarget("sys.browser");

	// Action we want target application to perform
	request.setAction("bb.action.OPEN");

	// The actual data
	request.setUri(uri);

	InvokeTargetReply *reply = invokeManager.invoke(request);
}
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);
	}
}
//invoke adobe reader application as a card
void ApplicationUI::invokeAdobe() {
	InvokeManager invokeManager;
	InvokeRequest request;

	QString uri = "file:" + QDir::currentPath() + "/app/native/assets/docs/panther.pdf";

	// Target ID for app we're invoking
	request.setTarget("com.rim.bb.app.adobeReader.viewer");

	// Action we want target application to perform
	request.setAction("bb.action.VIEW");

	// Type of data we're sending
	request.setMimeType("application/pdf");

	// The actual data
	request.setUri(uri);

	InvokeTargetReply *reply = invokeManager.invoke(request);
}
//invoke the phone with a number prepoulated
void ApplicationUI::invokePhone() {
	InvokeManager invokeManager;
	InvokeRequest request;

	// What do we want the target application to do with it?
	request.setAction("bb.action.DIAL");

	// What are we sending?
	request.setMimeType("application/vnd.blackberry.phone.startcall");

    // Where is the data?
    QVariantMap map;
    map.insert("number", "15559223145"); // required
    map.insert("line_id", "cellular"); // optional
    QByteArray requestData = bb::PpsObject::encode(map, NULL);
    request.setData(requestData);

    InvokeTargetReply *reply = invokeManager.invoke(request);

}