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


C++ QDBusPendingCallWatcher::isFinished方法代码示例

本文整理汇总了C++中QDBusPendingCallWatcher::isFinished方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusPendingCallWatcher::isFinished方法的具体用法?C++ QDBusPendingCallWatcher::isFinished怎么用?C++ QDBusPendingCallWatcher::isFinished使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDBusPendingCallWatcher的用法示例。


在下文中一共展示了QDBusPendingCallWatcher::isFinished方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PendingOperation

/**
 * Construct a new PendingChannelRequest object.
 *
 * \param account Account to use.
 * \param requestedProperties A dictionary containing the desirable properties.
 * \param userActionTime The time at which user action occurred, or QDateTime()
 *                       if this channel request is for some reason not
 *                       involving user action.
 * \param preferredHandler Either the well-known bus name (starting with
 *                         org.freedesktop.Telepathy.Client.) of the preferred
 *                         handler for this channel, or an empty string to
 *                         indicate that any handler would be acceptable.
 * \param create Whether createChannel or ensureChannel should be called.
 * \param account The account the request was made through.
 */
PendingChannelRequest::PendingChannelRequest(const AccountPtr &account,
        const QVariantMap &requestedProperties, const QDateTime &userActionTime,
        const QString &preferredHandler, bool create, const ChannelRequestHints &hints)
    : PendingOperation(account),
      mPriv(new Private(account->dbusConnection()))
{
    QString channelDispatcherObjectPath =
        QString(QLatin1String("/%1")).arg(TP_QT_IFACE_CHANNEL_DISPATCHER);
    channelDispatcherObjectPath.replace(QLatin1String("."), QLatin1String("/"));
    Client::ChannelDispatcherInterface *channelDispatcherInterface =
        account->dispatcherInterface();

    QDBusPendingCallWatcher *watcher = 0;
    if (create) {
        if (hints.isValid()) {
            if (account->supportsRequestHints()) {
                watcher = new QDBusPendingCallWatcher(
                    channelDispatcherInterface->CreateChannelWithHints(
                        QDBusObjectPath(account->objectPath()),
                        requestedProperties,
                        userActionTime.isNull() ? 0 : userActionTime.toTime_t(),
                        preferredHandler, hints.allHints()), this);
            } else {
                warning() << "Hints passed to channel request won't have an effect"
                    << "because the Channel Dispatcher service in use is too old";
            }
        }

        if (!watcher) {
            watcher = new QDBusPendingCallWatcher(
                    channelDispatcherInterface->CreateChannel(
                        QDBusObjectPath(account->objectPath()),
                        requestedProperties,
                        userActionTime.isNull() ? 0 : userActionTime.toTime_t(),
                        preferredHandler), this);
        }
    } else {
        if (hints.isValid()) {
            if (account->supportsRequestHints()) {
                watcher = new QDBusPendingCallWatcher(
                    channelDispatcherInterface->EnsureChannelWithHints(
                        QDBusObjectPath(account->objectPath()),
                        requestedProperties,
                        userActionTime.isNull() ? 0 : userActionTime.toTime_t(),
                        preferredHandler, hints.allHints()), this);
            } else {
                warning() << "Hints passed to channel request won't have an effect"
                    << "because the Channel Dispatcher service in use is too old";
            }
        }

        if (!watcher) {
            watcher = new QDBusPendingCallWatcher(
                    channelDispatcherInterface->EnsureChannel(
                        QDBusObjectPath(account->objectPath()),
                        requestedProperties,
                        userActionTime.isNull() ? 0 : userActionTime.toTime_t(),
                        preferredHandler), this);
        }
    }

    // TODO: This is a Qt bug fixed upstream, should be in the next Qt release.
    //       We should not need to check watcher->isFinished() here, remove the
    //       check when we depend on the fixed Qt version.
    if (watcher->isFinished()) {
        onWatcherFinished(watcher);
    } else {
        connect(watcher,
                SIGNAL(finished(QDBusPendingCallWatcher*)),
                SLOT(onWatcherFinished(QDBusPendingCallWatcher*)));
    }
}
开发者ID:Ziemin,项目名称:telepathy-qt,代码行数:87,代码来源:pending-channel-request.cpp


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