Esempio n. 1
0
KDEConnectTelepathyProtocol::KDEConnectTelepathyProtocol(const QDBusConnection &dbusConnection, const QString &name)
    : BaseProtocol(dbusConnection, name)
{
    setParameters(Tp::ProtocolParameterList()
                    << Tp::ProtocolParameter(QLatin1String("device_id"), QLatin1String("s"), Tp::ConnMgrParamFlagRequired)
                    << Tp::ProtocolParameter(QLatin1String("self_name"), QLatin1String("s"), 0));

    setRequestableChannelClasses(Tp::RequestableChannelClassSpecList() << Tp::RequestableChannelClassSpec::textChat());

    // callbacks
    setCreateConnectionCallback(memFun(this, &KDEConnectTelepathyProtocol::createConnection));
    setIdentifyAccountCallback(memFun(this, &KDEConnectTelepathyProtocol::identifyAccount));
    setNormalizeContactCallback(memFun(this, &KDEConnectTelepathyProtocol::normalizeContact));

    addrIface = Tp::BaseProtocolAddressingInterface::create();
    addrIface->setAddressableVCardFields(QStringList() << QLatin1String("tel"));
    addrIface->setAddressableUriSchemes(QStringList() << QLatin1String("tel") << QLatin1String("sms"));
    addrIface->setNormalizeVCardAddressCallback(memFun(this, &KDEConnectTelepathyProtocol::normalizeVCardAddress));
    addrIface->setNormalizeContactUriCallback(memFun(this, &KDEConnectTelepathyProtocol::normalizeContactUri));
    plugInterface(Tp::AbstractProtocolInterfacePtr::dynamicCast(addrIface));


    presenceIface = Tp::BaseProtocolPresenceInterface::create();
    presenceIface->setStatuses(ConnectConnection::getSimpleStatusSpecMap());
    plugInterface(Tp::AbstractProtocolInterfacePtr::dynamicCast(presenceIface));

    auto bus = QDBusConnection::sessionBus();
    bus.registerObject("/kdeconnect", this, QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllSlots);

    Tp::DBusError err;
}
Esempio n. 2
0
KDEConnectTelepathyProtocol::KDEConnectTelepathyProtocol(const QDBusConnection &dbusConnection, const QString &name)
    : BaseProtocol(dbusConnection, name)
{
//     setParameters(Tp::ProtocolParameterList()
//                   << Tp::ProtocolParameter(QLatin1String("device_id"), QLatin1String("s"), Tp::ConnMgrParamFlagRequired)
//                   << Tp::ProtocolParameter(QLatin1String("self_name"), QLatin1String("s"), 0));

    setRequestableChannelClasses(Tp::RequestableChannelClassSpecList() << Tp::RequestableChannelClassSpec::textChat());

    // callbacks
    setCreateConnectionCallback(memFun(this, &KDEConnectTelepathyProtocol::createConnection));
    setIdentifyAccountCallback(memFun(this, &KDEConnectTelepathyProtocol::identifyAccount));
    setNormalizeContactCallback(memFun(this, &KDEConnectTelepathyProtocol::normalizeContact));

    addrIface = Tp::BaseProtocolAddressingInterface::create();
    addrIface->setAddressableVCardFields(QStringList() << QLatin1String("x-example-vcard-field"));
    addrIface->setAddressableUriSchemes(QStringList() << QLatin1String("example-uri-scheme"));
    addrIface->setNormalizeVCardAddressCallback(memFun(this, &KDEConnectTelepathyProtocol::normalizeVCardAddress));
    addrIface->setNormalizeContactUriCallback(memFun(this, &KDEConnectTelepathyProtocol::normalizeContactUri));
    plugInterface(Tp::AbstractProtocolInterfacePtr::dynamicCast(addrIface));
/*
    presenceIface = Tp::BaseProtocolPresenceInterface::create();
    presenceIface->setStatuses(Tp::PresenceSpecList(ConnectConnection::getConnectStatusSpecMap()));
    plugInterface(Tp::AbstractProtocolInterfacePtr::dynamicCast(presenceIface));*/

    Tp::DBusError err;
}