1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
/*
KDE integration module for Telepathy
Copyright (C) 2011 Martin Klapetek <martin.klapetek@gmail.com>
Copyright (C) 2014 David Edmundson <kde@davidedmundson.co.uk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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 library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "telepathy-module.h"
#include "contact-cache.h"
#include "contact-request-handler.h"
#include "contactnotify.h"
#include "error-handler.h"
#include "status-handler.h"
#include <KTp/contact-factory.h>
#include <KTp/core.h>
#include <TelepathyQt/AccountFactory>
#include <TelepathyQt/PendingReady>
#include <TelepathyQt/Debug>
#include <KConfigGroup>
#include <KPluginFactory>
K_PLUGIN_CLASS_WITH_JSON(TelepathyModule, "ktp_integration_module.json")
TelepathyModule::TelepathyModule(QObject *parent, const QList<QVariant> &args)
: KDEDModule(parent),
m_statusHandler( 0 ),
m_contactHandler( 0 ),
m_contactNotify( 0 ),
m_errorHandler( 0 )
{
Q_UNUSED(args)
Tp::registerTypes();
Tp::enableDebug(false);
Tp::enableWarnings(false);
connect(KTp::accountManager()->becomeReady(), SIGNAL(finished(Tp::PendingOperation*)), SLOT(onAccountManagerReady(Tp::PendingOperation*)));
}
TelepathyModule::~TelepathyModule()
{
}
void TelepathyModule::onAccountManagerReady(Tp::PendingOperation *op)
{
if (op->isError()) {
return;
}
m_errorHandler = new ErrorHandler(this);
m_contactHandler = new ContactRequestHandler(this);
m_contactNotify = new ContactNotify(this);
m_statusHandler = new StatusHandler(this);
new ContactCache(this);
QDBusConnection::sessionBus().registerService(QLatin1String("org.freedesktop.Telepathy.Client.KTp.KdedIntegrationModule"));
}
#include "telepathy-module.moc"
|