本文整理汇总了C++中InvokeRequest::setAction方法的典型用法代码示例。如果您正苦于以下问题:C++ InvokeRequest::setAction方法的具体用法?C++ InvokeRequest::setAction怎么用?C++ InvokeRequest::setAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InvokeRequest
的用法示例。
在下文中一共展示了InvokeRequest::setAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onStopHeadlessService
void ApplicationUI::onStopHeadlessService() {
InvokeRequest request;
request.setTarget(WAKEME_INVOKE_HEADLESS_SERVICE);
request.setAction(WAKEME_INVOKE_ACTION_STOPSERVICE);
_invokeManager->invoke(request);
}
示例2: pushNotificationHandler
void App::pushNotificationHandler(bb::network::PushPayload &pushPayload)
{
// Check for a duplicate push
PushHistoryItem pushHistoryItem(pushPayload.id());
if (m_pushNotificationService.checkForDuplicatePush(pushHistoryItem)) {
// A duplicate was found, stop processing. Silently discard this push from the user
qWarning() << QString("Duplicate push was found with ID: %0.").arg(pushPayload.id());
// Exit the application if it has not been brought to the foreground
if (!m_hasBeenInForeground) {
Application::instance()->requestExit();
}
return;
}
// Convert from PushPayload to Push so that it can be stored in the database
Push push(pushPayload);
// Save the push and set the sequence number (ID) of the push
push.setSeqNum(m_pushNotificationService.savePush(push));
// Create a notification for the push that will be added to the BlackBerry Hub
Notification *notification = new Notification(NOTIFICATION_PREFIX + QString::number(push.seqNum()),this);
notification->setTitle("Push Collector");
notification->setBody(QString("New %0 push received").arg(push.fileExtension()));
// Add an invoke request to the notification
// This invoke will contain the seqnum of the push.
// When the notification in the BlackBerry Hub is selected, this seqnum will be used to lookup the push in
// the database and display it
InvokeRequest invokeRequest;
invokeRequest.setTarget(INVOKE_TARGET_KEY_OPEN);
invokeRequest.setAction(BB_OPEN_INVOCATION_ACTION);
invokeRequest.setMimeType("text/plain");
invokeRequest.setData(QByteArray::number(push.seqNum()));
notification->setInvokeRequest(invokeRequest);
// Add the notification for the push to the BlackBerry Hub
// Calling this method will add a "splat" to the application icon, indicating that a new push has been received
notification->notify();
m_model->insert(push.toMap());
// If an acknowledgement of the push is required (that is, the push was sent as a confirmed push
// - which is equivalent terminology to the push being sent with application level reliability),
// then you must either accept the push or reject the push
if (pushPayload.isAckRequired()) {
// In our sample, we always accept the push, but situations might arise where an application
// might want to reject the push (for example, after looking at the headers that came with the push
// or the data of the push, we might decide that the push received did not match what we expected
// and so we might want to reject it)
m_pushNotificationService.acceptPush(pushPayload.id());
}
// If the "Launch Application on New Push" checkbox was checked in the config settings, then
// a new push will launch the app so that it's running in the background (if the app was not
// already running when the push came in)
// In this case, the push launched the app (not the user), so it makes sense
// once our processing of the push is done to just exit the app
// But, if the user has brought the app to the foreground at some point, then they know about the
// app running and so we leave the app running after we're done processing the push
if (!m_hasBeenInForeground) {
Application::instance()->requestExit();
}
}
示例3: onDisableScanInvokeRequest
void ApplicationUI::onDisableScanInvokeRequest() {
InvokeRequest request;
request.setTarget(WAKEME_INVOKE_HEADLESS_SERVICE);
request.setAction(WAKEME_INVOKE_ACTION_DISABLESCANINVOKE);
_invokeManager->invoke(request);
}