File indexing completed on 2023-09-24 05:08:23
0001 /* 0002 KDE integration module for Telepathy 0003 Copyright (C) 2011 Martin Klapetek <martin.klapetek@gmail.com> 0004 Copyright (C) 2014 David Edmundson <kde@davidedmundson.co.uk> 0005 0006 This library is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU Lesser General Public 0008 License as published by the Free Software Foundation; either 0009 version 2.1 of the License, or (at your option) any later version. 0010 0011 This library is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 Lesser General Public License for more details. 0015 0016 You should have received a copy of the GNU Lesser General Public 0017 License along with this library; if not, write to the Free Software 0018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 0019 */ 0020 0021 #include "telepathy-module.h" 0022 0023 #include "contact-cache.h" 0024 #include "contact-request-handler.h" 0025 #include "contactnotify.h" 0026 #include "error-handler.h" 0027 #include "status-handler.h" 0028 0029 #include <KTp/contact-factory.h> 0030 #include <KTp/core.h> 0031 0032 #include <TelepathyQt/AccountFactory> 0033 #include <TelepathyQt/PendingReady> 0034 #include <TelepathyQt/Debug> 0035 0036 #include <KConfigGroup> 0037 #include <KPluginFactory> 0038 0039 K_PLUGIN_CLASS_WITH_JSON(TelepathyModule, "ktp_integration_module.json") 0040 0041 TelepathyModule::TelepathyModule(QObject *parent, const QList<QVariant> &args) 0042 : KDEDModule(parent), 0043 m_statusHandler( 0 ), 0044 m_contactHandler( 0 ), 0045 m_contactNotify( 0 ), 0046 m_errorHandler( 0 ) 0047 { 0048 Q_UNUSED(args) 0049 0050 Tp::registerTypes(); 0051 Tp::enableDebug(false); 0052 Tp::enableWarnings(false); 0053 0054 connect(KTp::accountManager()->becomeReady(), SIGNAL(finished(Tp::PendingOperation*)), SLOT(onAccountManagerReady(Tp::PendingOperation*))); 0055 } 0056 0057 TelepathyModule::~TelepathyModule() 0058 { 0059 } 0060 0061 void TelepathyModule::onAccountManagerReady(Tp::PendingOperation *op) 0062 { 0063 if (op->isError()) { 0064 return; 0065 } 0066 0067 m_errorHandler = new ErrorHandler(this); 0068 m_contactHandler = new ContactRequestHandler(this); 0069 m_contactNotify = new ContactNotify(this); 0070 m_statusHandler = new StatusHandler(this); 0071 new ContactCache(this); 0072 0073 QDBusConnection::sessionBus().registerService(QLatin1String("org.freedesktop.Telepathy.Client.KTp.KdedIntegrationModule")); 0074 } 0075 0076 0077 #include "telepathy-module.moc"