File indexing completed on 2023-11-26 04:55:45
0001 /* 0002 * Copyright (C) 2013 David Edmundson <kde@davidedmundson.co.uk> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public 0015 * License along with this library; if not, write to the Free Software 0016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 0017 */ 0018 0019 #include "account-factory_p.h" 0020 0021 KTp::AccountFactory::AccountFactory(const QDBusConnection &bus, const Tp::Features &features): 0022 Tp::AccountFactory::AccountFactory(bus, features) 0023 { 0024 } 0025 0026 Tp::AccountFactoryPtr KTp::AccountFactory::create(const QDBusConnection &bus, const Tp::Features &features) { 0027 return Tp::AccountFactoryPtr(new KTp::AccountFactory(bus, features)); 0028 } 0029 0030 Tp::AccountPtr KTp::AccountFactory::construct(const QString &busName, const QString &objectPath, const Tp::ConnectionFactoryConstPtr &connFactory, const Tp::ChannelFactoryConstPtr &chanFactory, const Tp::ContactFactoryConstPtr &contactFactory) const 0031 { 0032 return KTp::Account::create(QDBusConnection::sessionBus(), busName, objectPath, connFactory, chanFactory, contactFactory); 0033 } 0034 0035 0036 0037 //account 0038 0039 0040 0041 Tp::AccountPtr KTp::Account::create(const QDBusConnection &bus, const QString &busName, const QString &objectPath, const Tp::ConnectionFactoryConstPtr &connectionFactory, const Tp::ChannelFactoryConstPtr &channelFactory, const Tp::ContactFactoryConstPtr &contactFactory) 0042 { 0043 return Tp::AccountPtr(new KTp::Account(bus, busName, objectPath, connectionFactory, channelFactory, contactFactory, Tp::Account::FeatureCore)); 0044 } 0045 0046 KTp::Account::Account(const QDBusConnection &bus, const QString &busName, const QString &objectPath, const Tp::ConnectionFactoryConstPtr &connectionFactory, const Tp::ChannelFactoryConstPtr &channelFactory, const Tp::ContactFactoryConstPtr &contactFactory, const Tp::Feature &coreFeature): 0047 Tp::Account(bus, busName, objectPath, connectionFactory, channelFactory, contactFactory, coreFeature) 0048 { 0049 connect(this, SIGNAL(connectionChanged(Tp::ConnectionPtr)), SLOT(onConnectionChanged(Tp::ConnectionPtr))); 0050 } 0051 0052 void KTp::Account::onConnectionChanged(const Tp::ConnectionPtr &connection) 0053 { 0054 if (connection) { 0055 connection->setProperty("accountUID", uniqueIdentifier()); 0056 } 0057 }