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();
}
Пример #2
0
void ApplicationUI::invoke(const QString& platform, const QString& data) {
    // Some invoke only works in C++, that's why all my invoke are done in C++
    qDebug() << "ApplicationUI::invoke()" << platform << data;

    // Load from previous saved information
    const QString jsonPathFile = QDir::currentPath() + "/app/native/assets/InvokeTargets.json";
    QVariantMap invokeTargets = jda.load(jsonPathFile).toMap()[platform].toMap();
    qDebug() << "invokeTargets:" << invokeTargets;

    // Create a new invocation request
    InvokeRequest request;
    if (!invokeTargets["target"].isNull())
        request.setTarget(invokeTargets["target"].toString());

    if (!invokeTargets["action"].isNull())
        request.setAction(invokeTargets["action"].toString());

    if (!invokeTargets["mimeType"].isNull())
        request.setMimeType(invokeTargets["mimeType"].toString());

    if (!invokeTargets["uri"].isNull())
        request.setUri(invokeTargets["uri"].toString() + data);

    request.setData(data.toUtf8());

    // Start the invocation
    m_invokeManager->invoke(request);
    connect(m_invokeManager, SIGNAL(childCardDone(const bb::system::CardDoneMessage&)), this, SLOT(invokeNext()));
}
Пример #3
0
void ApplicationUI::stopLocking()
{
    InvokeRequest request;
    request.setTarget(SERVICE_APP_TARGET);
    request.setAction(SERVICE_STOP_LOCKING_ACTION);
    m_invokeManager->invoke(request);
}
//! [1]
void SocialInvocation::invoke(const QString &target, const QString &action,
		const QString &mimetype, const QString &uri) {
	// Create a new invocation request
	InvokeRequest request;

	request.setTarget(target);
	request.setAction(action);

	if (target == QLatin1String("com.rim.bb.app.facebook")) {
		QVariantMap payload;

		if (!uri.isEmpty()) {
			payload["object_type"] = mimetype;
			payload["object_id"] = uri;
		} else {
			// Open the BlackBerry North America page by default
			payload["object_type"] = "page";
			payload["object_id"] = "328506290597521";
		}

		request.setMetadata(payload);
	} else {
		request.setUri(uri);
	}

	m_invokeManager->invoke(request);
}
Пример #5
0
void ApplicationUI::loadEvent(int id, int account, QDateTime start)
{
	QString startString = start.toString("yyyy-MM-dd hh:mm:ss");
	qDebug() << "FMI ######### received event " << id << " account " << account << " beginning " << startString;

	InvokeRequest invokeRequest;
	invokeRequest.setAction("bb.calendar.OPEN");
	invokeRequest.setTarget("sys.pim.calendar.viewer.ics");
	invokeRequest.setMimeType("text/calendar");
	QVariantMap data;
	data.insert("accountId", account);
	data.insert("eventId", id);
	data.insert("type", "event");
	data.insert("start", startString);
//	data.insert("start", "2013-12-07 11:00:00");

	//invokeRequest.setData(bb::PpsObject::encode(data, NULL));
	bool ok;
	QByteArray encData = bb::PpsObject::encode(data, &ok);
	if (ok) {
		invokeRequest.setData(encData);
		// Start the invocation
		const InvokeReply *reply = m_invokeManager->invoke(invokeRequest);
	//	reply->setParent(this);

		connect(reply, SIGNAL(finished()), this, SLOT(processInvokeReply()));

		connectResult = connect(m_invokeManager, SIGNAL(childCardDone(const bb::system::CardDoneMessage&)), this, SLOT(childCardDone(const bb::system::CardDoneMessage&)));
	}
}
Пример #6
0
void BarcodeInvoker::onInvokeButtonClicked() {
	qDebug() << "+++++++ Invoke button clicked" << endl;
	InvokeRequest invokeRequest;
	invokeRequest.setTarget("com.example.BarcodeScanner");
	invokeRequest.setAction("community.action.SCANBARCODE");
	InvokeTargetReply *invokeReply = _invokeManager->invoke(invokeRequest);
}
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);
}
// The Foursquare invocation calls are based on the sample available here:
// https://github.com/kylefowler/foursquare-bb10-sdk
//
// Launches a native Foursquare venue search in your app.
// This card will call back to your childCardDone slot with the appropriate
// response for the actions taken by the user.
//
// URI Params:
// query: (optional) prime the venue search with a query
// client_id: (required) the client id from your oauth consumer
// client_secret: (required) the client secret from your oauth consumer
// oauth_token: (required if no client_id/client_secret) pass this if you
//              already have an authenticated user token, this way venue
//              search results will be fitted to the user requesting them
//              for a higher quality queryless search
//
// Response:
// When the user selects a venue, you will get the venue information in
// JSON format back through the childCardDone slot in the data object.
// The venue format will match what is listed here in the core venue fields:
// https://developer.foursquare.com/docs/responses/venue
//
// If the user cancels the search without any action: the reason message will be "canceled"
// If any of the parameters are missing you will get a reason message of "invalid_credentials"
void SocialInvocation::invokeFoursquareVenueCard(const QString &venue) {
	InvokeRequest cardRequest;
	cardRequest.setTarget("com.foursquare.blackberry.venuesearch.card");
	cardRequest.setAction("bb.action.VIEW");
	cardRequest.setMimeType("venuesearch/foursquare");

	// The client_id and client_secret are the Foursquare API credentials
	// that you receive when registering your app with Foursquare.
	//
	// You can register your app with Foursquare here:
	// https://foursquare.com/developers/apps
	//
	// For more information on Foursquare API credentials, see here:
	// https://developer.foursquare.com/overview/auth

	QUrl uri = QUrl("foursquare://venues/search");

	// Replace the following values with your app's client ID and secret
	uri.addQueryItem("client_id", "UFVANV2FBBFRPXSBXHCCKECVUDANDKP5KQFKICRCA1VAFV4V");
	uri.addQueryItem("client_secret","11AY4DWL0A2CV1NXPKDMS2PJTEACRZJP0BMFXORNCKBSNVMH");

	uri.addQueryItem("query", venue);
	cardRequest.setUri(uri);

	m_invokeManager->invoke(cardRequest);
}
void ApplicationUI::inviteBBM() {
	InvokeRequest bbmRequest;
	bbmRequest.setTarget("sys.bbm.invitehandler");
	bbmRequest.setAction("bb.action.INVITEBBM");
	qDebug() << "invite to BBM";
	mInvokeManager->invoke(bbmRequest);
}
void ApplicationUI::resendNotification() {
	InvokeRequest request;
	request.setTarget("com.example.bb_france2UpFrontService");
	request.setAction("com.example.bb_france2UpFrontService.RESET");
	m_invokeManager->invoke(request);
	Application::instance()->minimize();
}
Пример #12
0
void ApplicationUI::startHeadless()
{
    InvokeRequest request;
    request.setTarget("com.RogerLeblanc.callerService");
    request.setAction("com.RogerLeblanc.callerService.START");
    m_invokeManager->invoke(request);
}
void ApplicationUIBase::invoke_browser(QString url)
{
    InvokeRequest request;
    request.setTarget("sys.browser");
    request.setAction("bb.action.OPEN");
    request.setUri(url);
    _invoke_manager->invoke(request);
}
void ApplicationUI::resendNotification()
{
    InvokeRequest request;
    request.setTarget(WAKEME_INVOKE_HEADLESS_SERVICE);
    request.setAction(WAKEME_INVOKE_ACTION_RESET);
    _invokeManager->invoke(request);
    Application::instance()->minimize();
}
Пример #15
0
void ApplicationUI::sendToHL(const QString& command, QString data) {
    InvokeRequest request;
    request.setTarget(SERVICE_APP_TARGET);
    request.setAction(QString(SERVICE_APP_TARGET) + "." + command.toUpper());
    if (!data.isEmpty())
        request.setData(data.toUtf8());
    m_invokeManager->invoke(request);
}
void ApplicationUIBase::invoke_media_player(QString uri)
{
    InvokeRequest request;
    request.setTarget("sys.mediaplayer.previewer");
    request.setAction("bb.action.OPEN");
    request.setUri(uri);
    _invoke_manager->invoke(request);
}
void ApplicationUI::startChat(const QString& text) {
	InvokeRequest bbmRequest;
	bbmRequest.setTarget("sys.bbm.chathandler");
	bbmRequest.setAction("bb.action.BBMCHAT");
	bbmRequest.setData(text.toUtf8());
	qDebug() << "start chat with BBM: " << text;
	mInvokeManager->invoke(bbmRequest);
}
void ApplicationUI::onRemoveScanRequest(const QString &address) {
    QByteArray data(address.toAscii().data());
    InvokeRequest request;
    request.setTarget(WAKEME_INVOKE_HEADLESS_SERVICE);
    request.setAction(WAKEME_INVOKE_ACTION_REMOVESCAN);
    request.setData(data);
    _invokeManager->invoke(request);
}
/**
 * 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);
}
void ApplicationUI::shareTextWithMail(const QString& text) {
	InvokeRequest mailRequest;
	mailRequest.setTarget("sys.pim.uib.email.hybridcomposer");
	mailRequest.setAction("bb.action.SENDEMAIL");
	mailRequest.setMimeType("settings/view");
	mailRequest.setUri("mailto:?subject=" + text);
	qDebug() << "share with Mail: " << text;
	mInvokeManager->invoke(mailRequest);
}
void ApplicationUI::onStartHeadlessService()
{
    InvokeRequest request;
    request.setTarget(WAKEME_INVOKE_HEADLESS_SERVICE);
    request.setAction(WAKEME_INVOKE_ACTION_STARTSERVICE);
    _invokeManager->invoke(request);

    connectToHeadless();
}
void ApplicationUI::shareTextWithBBM(const QString& text) {
	InvokeRequest bbmRequest;
	bbmRequest.setTarget("sys.bbm.sharehandler");
	bbmRequest.setAction("bb.action.SHARE");
	bbmRequest.setData(text.toUtf8());
	qDebug() << "share with BBM: " << text;
	mInvokeManager->invoke(bbmRequest);
	// TODO listen to InvokeTargetReply *reply to see if invocation was successfull
	// https://developer.blackberry.com/cascades/documentation/device_platform/invocation/sending_invocation.html
}
Пример #23
0
void ApplicationUI::lockThisApp(const QString& app)
{
    InvokeRequest request;
    request.setTarget(SERVICE_APP_TARGET);
    request.setAction(SERVICE_LOCK_THIS_APP_ACTION);
    request.setData(app.toUtf8());
    m_invokeManager->invoke(request);

    bb::Application::instance()->requestExit();
}
void ApplicationUI::saveValueFor(const QString key, const QString value) {
	qDebug() << key << value;
	settings.setValue(key, value);
	settings.sync();

	// Update UpFront every time a settings change to reflect the new settings
	InvokeRequest request;
	request.setTarget("com.example.bb_france2UpFrontService");
	request.setAction("com.example.bb_france2UpFrontService.UPDATEUPFRONT");
	m_invokeManager->invoke(request);
}
void ApplicationUI::sendMail(const QString title) {
	qDebug() << "invoke sendMail";
	InvokeRequest request;
	request.setAction("bb.action.SENDEMAIL");
	request.setTarget("sys.pim.uib.email.hybridcomposer");
	request.setMimeType("settings/view");
	request.setUri(
			"mailto:" + mOdsData->supportMail() + "?subject="
					+ mOdsData->applicationName() + "%20" + title);
	mInvokeManager->invoke(request);
}
// handles SLOT from feedbackItem
void ApplicationUI::feedbackTriggered() {
	qDebug() << "invoke sendFeedback";
	InvokeRequest request;
	request.setAction("bb.action.SENDEMAIL");
	request.setTarget("sys.pim.uib.email.hybridcomposer");
	request.setMimeType("settings/view");
	request.setUri(
			"mailto:" + mOdsData->feedbackMail() + "?subject=Feedback%20"
					+ mOdsData->applicationName());
	mInvokeManager->invoke(request);
}
Пример #27
0
//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);
}
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();
}
Пример #29
0
void ApplicationUI::viewimage(QString path)
{
    // invoke the system image viewer
    InvokeRequest request;
    // Set the URI
    request.setUri(path);
    request.setTarget("sys.pictures.card.previewer");
    request.setAction("bb.action.VIEW");
    // Send the invocation request
    InvokeTargetReply *cardreply = m_pInvokeManager->invoke(request);
    Q_UNUSED(cardreply);
}
/**
 * uses Invokation Framework to View the file from URI
 * for a specific MimeType
 * and for a specific target like "sys.pictures.app"
 *
 */
void ApplicationUI::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;
	mInvokeManager->invoke(invokeRequest);
}