[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:06:05 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=cf28aa9

The following commit has been merged in the master branch:
commit cf28aa90295c16cd4dee4a57378364649554aae2
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Fri Dec 7 08:04:17 2012 -0800

    Add a ContactFactory and Contact class allowing the subclassing of Tp::Contact
---
 KTp/CMakeLists.txt                   |  4 ++
 KTp/{debug.h => contact-factory.cpp} | 32 ++++++------
 KTp/{debug.h => contact-factory.h}   | 32 ++++++------
 KTp/contact.cpp                      | 95 ++++++++++++++++++++++++++++++++++++
 KTp/contact.h                        | 60 +++++++++++++++++++++++
 5 files changed, 188 insertions(+), 35 deletions(-)

diff --git a/KTp/CMakeLists.txt b/KTp/CMakeLists.txt
index 86a9a59..cbdeb8d 100644
--- a/KTp/CMakeLists.txt
+++ b/KTp/CMakeLists.txt
@@ -5,6 +5,8 @@ set (ktp_common_internals_private_SRCS
      actions.cpp
      capabilities-hack-private.cpp
      circular-countdown.cpp
+     contact.cpp
+     contact-factory.cpp
      debug.cpp
      error-dictionary.cpp
      global-contact-manager.cpp
@@ -23,6 +25,8 @@ set (ktp_common_internals_private_SRCS
 set (ktp_common_internals_private_HDRS
      actions.h
      circular-countdown.h
+     contact.h
+     contact-factory.h
      debug.h
      error-dictionary.h
      global-contact-manager.h
diff --git a/KTp/debug.h b/KTp/contact-factory.cpp
similarity index 53%
copy from KTp/debug.h
copy to KTp/contact-factory.cpp
index 1c3970a..8a84eec 100644
--- a/KTp/debug.h
+++ b/KTp/contact-factory.cpp
@@ -1,5 +1,5 @@
 /*
-* Copyright (C) 2012 Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
+* Copyright (C) 2012 David Edmundson <kde at 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
@@ -16,24 +16,20 @@
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
-#ifndef KTP_DEBUG_H
-#define KTP_DEBUG_H
+#include "contact-factory.h"
+#include "contact.h"
 
-#include "ktp-export.h"
+Tp::ContactFactoryPtr KTp::ContactFactory::create(const Tp::Features &features) {
+    return Tp::ContactFactoryPtr(new KTp::ContactFactory(features));
+}
 
-namespace KTp {
-namespace Debug {
+KTp::ContactFactory::ContactFactory(const Tp::Features &features)
+    : Tp::ContactFactory(features)
+{
 
-    /**
-     * Installs Telepathy-Qt debug callback and enable/disable Telepathy-Qt
-     * debug and warning output
-     *
-     * @param debug If true enable Telepathy-Qt debug
-     * @param warning If true enable Telepathy-Qt warnings
-     */
-    KTP_EXPORT void installCallback(bool debug, bool warning = true);
+}
 
-} // namespace Debug
-} // namespace KTp
-
-#endif // KTP_DEBUG_H
+Tp::ContactPtr KTp::ContactFactory::construct(Tp::ContactManager *manager, const Tp::ReferencedHandles &handle, const Tp::Features &features, const QVariantMap &attributes) const
+{
+    return Tp::ContactPtr(new KTp::Contact(manager, handle, features, attributes));
+}
diff --git a/KTp/debug.h b/KTp/contact-factory.h
similarity index 55%
copy from KTp/debug.h
copy to KTp/contact-factory.h
index 1c3970a..203b761 100644
--- a/KTp/debug.h
+++ b/KTp/contact-factory.h
@@ -1,5 +1,5 @@
 /*
-* Copyright (C) 2012 Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
+* Copyright (C) 2012 David Edmundson <kde at 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
@@ -16,24 +16,22 @@
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
-#ifndef KTP_DEBUG_H
-#define KTP_DEBUG_H
+#ifndef KTP_CONTACT_FACTORY_H
+#define KTP_CONTACT_FACTORY_H
 
-#include "ktp-export.h"
+#include <TelepathyQt/ContactFactory>
+#include <TelepathyQt/Types>
 
 namespace KTp {
-namespace Debug {
+class ContactFactory : public Tp::ContactFactory
+{
+public:
+    static Tp::ContactFactoryPtr create(const Tp::Features &features=Tp::Features());
+protected:
+    ContactFactory(const Tp::Features &features);
+    virtual Tp::ContactPtr construct(Tp::ContactManager *manager, const Tp::ReferencedHandles &handle, const Tp::Features &features, const QVariantMap &attributes) const;
+};
+}
 
-    /**
-     * Installs Telepathy-Qt debug callback and enable/disable Telepathy-Qt
-     * debug and warning output
-     *
-     * @param debug If true enable Telepathy-Qt debug
-     * @param warning If true enable Telepathy-Qt warnings
-     */
-    KTP_EXPORT void installCallback(bool debug, bool warning = true);
 
-} // namespace Debug
-} // namespace KTp
-
-#endif // KTP_DEBUG_H
+#endif // CONTACTFACTORY_H
diff --git a/KTp/contact.cpp b/KTp/contact.cpp
new file mode 100644
index 0000000..7c88683
--- /dev/null
+++ b/KTp/contact.cpp
@@ -0,0 +1,95 @@
+/*
+* Copyright (C) 2012 David Edmundson <kde at 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#include "contact.h"
+
+#include <TelepathyQt/ContactManager>
+#include <TelepathyQt/Connection>
+#include <TelepathyQt/ContactCapabilities>
+
+#include "capabilities-hack-private.h"
+
+KTp::Contact::Contact(Tp::ContactManager *manager, const Tp::ReferencedHandles &handle, const Tp::Features &requestedFeatures, const QVariantMap &attributes)
+    : Tp::Contact(manager, handle, requestedFeatures, attributes)
+{
+    connect(manager->connection().data(), SIGNAL(invalidated(Tp::DBusProxy*,QString,QString)), SIGNAL(invalidated()));
+}
+
+KTp::Presence KTp::Contact::presence() const
+{
+    return KTp::Presence(Tp::Contact::presence());
+}
+
+bool KTp::Contact::audioCallCapability() const
+{
+    if (! manager()->connection()) {
+        return false;
+    }
+    Tp::ConnectionPtr connection = manager()->connection();
+    if (connection) {
+        bool contactCanStreamAudio = CapabilitiesHackPrivate::audioCalls(
+                    capabilities(), connection->cmName());
+        bool selfCanStreamAudio = CapabilitiesHackPrivate::audioCalls(
+                    connection->selfContact()->capabilities(), connection->cmName());
+        return contactCanStreamAudio && selfCanStreamAudio;
+    }
+    return false;
+}
+
+bool KTp::Contact::videoCallCapability() const
+{
+    if (! manager()->connection()) {
+        return false;
+    }
+    Tp::ConnectionPtr connection = manager()->connection();
+    if (connection) {
+        bool contactCanStreamVideo = CapabilitiesHackPrivate::videoCalls(
+                    capabilities(), connection->cmName());
+        bool selfCanStreamVideo = CapabilitiesHackPrivate::videoCalls(
+                    connection->selfContact()->capabilities(), connection->cmName());
+        return contactCanStreamVideo && selfCanStreamVideo;
+    }
+
+    return false;
+}
+
+bool KTp::Contact::fileTransferCapability()  const
+{
+    if (! manager()->connection()) {
+        return false;
+    }
+    if (manager()->connection()) {
+        bool contactCanHandleFiles = capabilities().fileTransfers();
+        bool selfCanHandleFiles = manager()->connection()->selfContact()->capabilities().fileTransfers();
+        return contactCanHandleFiles && selfCanHandleFiles;
+    }
+
+    return false;
+}
+
+QStringList KTp::Contact::clientTypes() const
+{
+    /* Temporary workaround for upstream bug https://bugs.freedesktop.org/show_bug.cgi?id=55883)
+     * Close https://bugs.kde.org/show_bug.cgi?id=308217 when fixed upstream */
+    if (Tp::Contact::presence().type() == Tp::ConnectionPresenceTypeOffline) {
+        return QStringList();
+    }
+
+    return Tp::Contact::clientTypes();
+}
+
diff --git a/KTp/contact.h b/KTp/contact.h
new file mode 100644
index 0000000..1763162
--- /dev/null
+++ b/KTp/contact.h
@@ -0,0 +1,60 @@
+/*
+* Copyright (C) 2012 David Edmundson <kde at 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef KTP_CONTACT_H
+#define KTP_CONTACT_H
+
+#include <QVariant>
+#include <TelepathyQt/Contact>
+#include <KTp/presence.h>
+
+//K_GLOBAL_STATIC_WITH_ARGS(KTp::ServiceAvailabilityChecker, s_krfbAvailableChecker,
+//                          (QLatin1String("org.freedesktop.Telepathy.Client.krfb_rfb_handler")));
+
+namespace KTp{
+class Contact : public Tp::Contact
+{
+    Q_OBJECT
+public:
+    explicit Contact(Tp::ContactManager *manager, const Tp::ReferencedHandles &handle, const Tp::Features &requestedFeatures, const QVariantMap &attributes);
+
+    KTp::Presence presence() const;
+
+
+     /** Returns true if audio calls can be started with this contact*/
+     bool audioCallCapability() const;
+     /** Returns true if video calls can be started with this contact*/
+     bool videoCallCapability() const;
+     /** Returns true if file transfers can be started with this contact*/
+     bool fileTransferCapability() const;
+
+     //Overridden as a workaround for upstream bug https://bugs.freedesktop.org/show_bug.cgi?id=55883
+     QStringList clientTypes() const;
+
+Q_SIGNALS:
+     void invalidated();
+};
+
+
+typedef Tp::SharedPtr<KTp::Contact> ContactPtr;
+
+}//namespace
+
+Q_DECLARE_METATYPE(KTp::ContactPtr)
+
+#endif // CONTACT_H

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list