当前位置: 首页>>代码示例>>C++>>正文


C++ InvokeRequest::setAction方法代码示例

本文整理汇总了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);
}
开发者ID:YusufGandhi,项目名称:Cascades-Community-Samples,代码行数:6,代码来源:applicationui.cpp

示例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();
    }
}
开发者ID:13natty,项目名称:Cascades-Samples,代码行数:67,代码来源:app.cpp

示例3: onDisableScanInvokeRequest

void ApplicationUI::onDisableScanInvokeRequest() {
    InvokeRequest request;
    request.setTarget(WAKEME_INVOKE_HEADLESS_SERVICE);
    request.setAction(WAKEME_INVOKE_ACTION_DISABLESCANINVOKE);
    _invokeManager->invoke(request);
}
开发者ID:YusufGandhi,项目名称:Cascades-Community-Samples,代码行数:6,代码来源:applicationui.cpp


注:本文中的InvokeRequest::setAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。