Exemplo n.º 1
0
/**
 * Constructs a Channel proxy and begins making it ready.
 *
 * If a valid proxy already exists in the factory cache for the given combination of \a busName and
 * \a objectPath, it is returned instead. All newly created proxies are automatically cached until
 * they're either DBusProxy::invalidated() or the last reference to them outside the factory has
 * been dropped.
 *
 * The proxy can be accessed immediately after this function returns using PendingReady::proxy().
 *
 * \param connection Proxy for the owning connection of the channel.
 * \param channelPath The object path of the channel.
 * \param immutableProperties The immutable properties of the channel.
 * \return A PendingReady operation with the proxy in PendingReady::proxy().
 */
PendingReady *ChannelFactory::proxy(const ConnectionPtr &connection, const QString &channelPath,
        const QVariantMap &immutableProperties) const
{
    DBusProxyPtr proxy = cachedProxy(connection->busName(), channelPath);
    if (proxy.isNull()) {
        proxy = constructorFor(ChannelClassSpec(immutableProperties))->construct(connection,
                channelPath, immutableProperties);
    }

    return nowHaveProxy(proxy);
}
/**
 * Constructs an Account proxy and begins making it ready.
 *
 * If a valid proxy already exists in the factory cache for the given combination of \a busName and
 * \a objectPath, it is returned instead. All newly created proxies are automatically cached until
 * they're either DBusProxy::invalidated() or the last reference to them outside the factory has
 * been dropped.
 *
 * The proxy can be accessed immediately after this function returns using PendingReady::proxy().
 * The ready operation only finishes, however, when the features specified by features(), if any,
 * are made ready as much as possible. If the service doesn't support a given feature, they won't
 * obviously be ready even if the operation finished successfully, as is the case for
 * Account::becomeReady().
 *
 * \param busName The bus/service name of the D-Bus account object the proxy is constructed for.
 * (Usually #TP_QT4_ACCOUNT_MANAGER_BUS_NAME).
 * \param objectPath The object path of the account.
 * \param connFactory The connection factory to use for the Account.
 * \param chanFactory The channel factory to use for the Account.
 * \param contactFactory The channel factory to use for the Account.
 * \return A PendingReady operation with the proxy in PendingReady::proxy().
 */
PendingReady *AccountFactory::proxy(const QString &busName, const QString &objectPath,
                                    const ConnectionFactoryConstPtr &connFactory,
                                    const ChannelFactoryConstPtr &chanFactory,
                                    const ContactFactoryConstPtr &contactFactory) const
{
    DBusProxyPtr proxy = cachedProxy(busName, objectPath);
    if (proxy.isNull()) {
        proxy = construct(busName, objectPath, connFactory, chanFactory, contactFactory);
    }

    return nowHaveProxy(proxy);
}