[Merge] lp:~phablet-team/messaging-framework/destroyable_channels into lp:messaging-framework
Roberto Mier Escandón
roberto.escandon at canonical.com
Wed Jun 8 12:51:13 UTC 2016
Diff comments:
>
> === added directory 'src/messaging/qt/tp/interfaces'
> === added file 'src/messaging/qt/tp/interfaces/base_channel_destroyable.cpp'
> --- src/messaging/qt/tp/interfaces/base_channel_destroyable.cpp 1970-01-01 00:00:00 +0000
> +++ src/messaging/qt/tp/interfaces/base_channel_destroyable.cpp 2016-06-07 23:31:48 +0000
> @@ -0,0 +1,105 @@
> +/*
> + * Copyright © 2016 Canonical Ltd.
> + *
> + * This program is free software: you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License version 3,
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public License
> + * along with this program. If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <TelepathyQt/DBusObject>
> +#include <messaging/qt/tp/interfaces/base_channel_destroyable.h>
> +#include "base_channel_destroyable_internal.h"
is it possible including this using complete path?
#include <messaging/qt/tp/interfaces/base_channel_destroyable_internal.h>
> +
> +// Chan.I.Destroyable
> +BaseChannelDestroyableInterface::Adaptee::Adaptee(BaseChannelDestroyableInterface *interface)
> + : QObject(interface),
> + mInterface(interface)
> +{
> +}
> +
> +BaseChannelDestroyableInterface::Adaptee::~Adaptee()
> +{
> +}
> +
> +struct TP_QT_NO_EXPORT BaseChannelDestroyableInterface::Private {
> + Private(BaseChannelDestroyableInterface *parent)
> + :adaptee(new BaseChannelDestroyableInterface::Adaptee(parent)) {
> + }
> +
> + DestroyCallback destroyCB;
> + BaseChannelDestroyableInterface::Adaptee *adaptee;
> +};
> +
> +void BaseChannelDestroyableInterface::Adaptee::destroy(const Tp::Service::ChannelInterfaceDestroyableAdaptor::DestroyContextPtr &context)
> +{
> + if (!mInterface->mPriv->destroyCB.isValid()) {
> + context->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
> + return;
> + }
> +
> + Tp::DBusError error;
> + mInterface->mPriv->destroyCB(&error);
> + if (error.isValid()) {
> + context->setFinishedWithError(error.name(), error.message());
> + return;
> + }
> + context->setFinished();
> +}
> +
> +/**
> + * \class BaseChannelDestroyableInterface
> + *
> + * \brief Base class for implementations of Channel.Interface.Destroyable
> + *
> + */
> +
> +/**
> + * Class constructor.
> + */
> +BaseChannelDestroyableInterface::BaseChannelDestroyableInterface()
> + : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_INTERFACE_DESTROYABLE),
> + mPriv(new Private(this))
> +{
> +}
> +
> +void BaseChannelDestroyableInterface::setDestroyCallback(const DestroyCallback &cb)
> +{
> + mPriv->destroyCB = cb;
> +}
> +
> +/**
> + * Class destructor.
> + */
> +BaseChannelDestroyableInterface::~BaseChannelDestroyableInterface()
> +{
> + delete mPriv;
> +}
> +
> +/**
> + * Return the immutable properties of this interface.
> + *
> + * Immutable properties cannot change after the interface has been registered
> + * on a service on the bus with registerInterface().
> + *
> + * \return The immutable properties of this interface.
> + */
> +QVariantMap BaseChannelDestroyableInterface::immutableProperties() const
> +{
> + QVariantMap map;
> + return map;
> +}
> +
> +void BaseChannelDestroyableInterface::createAdaptor()
> +{
> + (void) new Tp::Service::ChannelInterfaceDestroyableAdaptor(dbusObject()->dbusConnection(),
> + mPriv->adaptee, dbusObject());
> +}
> +
--
https://code.launchpad.net/~phablet-team/messaging-framework/destroyable_channels/+merge/296745
Your team Ubuntu Phablet Team is subscribed to branch lp:messaging-framework.
More information about the Ubuntu-reviews
mailing list