[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:05:51 UTC 2016


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

The following commit has been merged in the master branch:
commit 79e43703dac07ed3e24f9a23d2b07a711d4a530b
Author: Dan Vrátil <dvratil at redhat.com>
Date:   Tue Nov 13 14:27:46 2012 +0100

    Add API to start chat, calls and open logviewer
    
    REVIEW: 107169
---
 KTp/CMakeLists.txt |   2 +
 KTp/actions.cpp    | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 KTp/actions.h      |  59 +++++++++++++++++++++++++++
 3 files changed, 176 insertions(+)

diff --git a/KTp/CMakeLists.txt b/KTp/CMakeLists.txt
index 0fd12f0..64a12b2 100644
--- a/KTp/CMakeLists.txt
+++ b/KTp/CMakeLists.txt
@@ -2,6 +2,7 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}
                      ${CMAKE_CURRENT_SOURCE_DIR})
 
 set (ktp_common_internals_private_SRCS
+     actions.cpp
      circular-countdown.cpp
      debug.cpp
      error-dictionary.cpp
@@ -19,6 +20,7 @@ set (ktp_common_internals_private_SRCS
 )
 
 set (ktp_common_internals_private_HDRS
+     actions.h
      circular-countdown.h
      debug.h
      error-dictionary.h
diff --git a/KTp/actions.cpp b/KTp/actions.cpp
new file mode 100644
index 0000000..695ad9c
--- /dev/null
+++ b/KTp/actions.cpp
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2012 Dan Vrátil <dvratil at redhat.com>
+ *
+ * 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 "actions.h"
+
+#include <TelepathyQt/Account>
+#include <TelepathyQt/ChannelRequestHints>
+#include <TelepathyQt/Contact>
+#include <TelepathyQt/PendingChannelRequest>
+
+#include <KMimeType>
+#include <KToolInvocation>
+#include <KDebug>
+
+#define PREFERRED_TEXT_CHAT_HANDLER QLatin1String("org.freedesktop.Telepathy.Client.KTp.TextUi")
+#define PREFERRED_FILE_TRANSFER_HANDLER QLatin1String("org.freedesktop.Telepathy.Client.KTp.FileTransfer")
+#define PREFERRED_AUDIO_VIDEO_HANDLER QLatin1String("org.freedesktop.Telepathy.Client.KTp.CallUi")
+#define PREFERRED_RFB_HANDLER QLatin1String("org.freedesktop.Telepathy.Client.krfb_rfb_handler")
+
+using namespace KTp;
+
+Tp::PendingChannelRequest* Actions::startChat(const Tp::AccountPtr& account,
+					       const Tp::ContactPtr& contact,
+					       bool delegateToPreferredHandler)
+{
+    kDebug() << "Requesting text channel for" << contact->id();
+
+    Tp::ChannelRequestHints hints;
+    if (delegateToPreferredHandler) {
+      hints.setHint(QLatin1String("org.freedesktop.Telepathy.ChannelRequest"),
+		    QLatin1String("DelegateToPreferredHandler"),
+		    QVariant(true));
+    }
+
+    return account->ensureTextChat(contact,
+				   QDateTime::currentDateTime(),
+				   PREFERRED_TEXT_CHAT_HANDLER,
+				   hints);
+}
+
+Tp::PendingChannelRequest* Actions::startAudioCall(const Tp::AccountPtr& account,
+						    const Tp::ContactPtr& contact)
+{
+    kDebug() << "Requesting audio channel for" << contact->id();
+
+    return account->ensureAudioCall(contact,
+				    QLatin1String("audio"),
+				    QDateTime::currentDateTime(),
+				    PREFERRED_AUDIO_VIDEO_HANDLER);
+}
+
+Tp::PendingChannelRequest* Actions::startAudioVideoCall(const Tp::AccountPtr& account,
+							 const Tp::ContactPtr& contact)
+{
+    kDebug() << "Requesting audio-video channel for" << contact->id();
+
+    return account->ensureAudioVideoCall(contact,
+					 QLatin1String("audio"),
+					 QLatin1String("video"),
+					 QDateTime::currentDateTime(),
+					 PREFERRED_AUDIO_VIDEO_HANDLER);
+}
+
+Tp::PendingChannelRequest* Actions::startDesktopSharing(const Tp::AccountPtr& account,
+							 const Tp::ContactPtr& contact)
+{
+    kDebug() << "Requesting stream tube for" << contact->id();
+
+    return account->createStreamTube(contact,
+				     QLatin1String("rfb"),
+				     QDateTime::currentDateTime(),
+				     PREFERRED_RFB_HANDLER);
+}
+
+Tp::PendingChannelRequest* Actions::startFileTransfer(const Tp::AccountPtr& account,
+						       const Tp::ContactPtr& contact,
+						       const QString& filePath)
+{
+    kDebug() << "Requesting file transfer of" << filePath << "to" << contact->id();
+
+    Tp::FileTransferChannelCreationProperties fileTransferProperties(
+		  filePath, KMimeType::findByFileContent(filePath)->name());
+
+    return account->createFileTransfer(contact,
+					fileTransferProperties,
+					QDateTime::currentDateTime(),
+					PREFERRED_FILE_TRANSFER_HANDLER);
+}
+
+void Actions::openLogViewer(const Tp::AccountPtr& account,
+			     const Tp::ContactPtr& contact)
+{
+    kDebug() << "Opening logviewer for" << contact->id();
+
+    QStringList arguments;
+    arguments << QLatin1String("--") << account->uniqueIdentifier() << contact->id();
+
+    /* Use "--" so that KCmdLineArgs does not parse UIDs starting with "-" as arguments */
+    KToolInvocation::kdeinitExec(QLatin1String("ktp-log-viewer"), arguments);
+}
diff --git a/KTp/actions.h b/KTp/actions.h
new file mode 100644
index 0000000..417383f
--- /dev/null
+++ b/KTp/actions.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2012 Dan Vrátil <dvratil at redhat.com>
+ *
+ * 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_ACTIONS_H
+#define KTP_ACTIONS_H
+
+#include <TelepathyQt/Types>
+
+#include <KTp/ktp-export.h>
+
+namespace Tp {
+class PendingChannelRequest;
+}
+
+namespace KTp {
+
+namespace Actions {
+
+  KTP_EXPORT Tp::PendingChannelRequest* startChat(const Tp::AccountPtr &account,
+						  const Tp::ContactPtr &contact,
+						  bool delegateToPreferredHandler = true);
+
+  KTP_EXPORT Tp::PendingChannelRequest* startAudioCall(const Tp::AccountPtr &account,
+						       const Tp::ContactPtr &contact);
+
+  KTP_EXPORT Tp::PendingChannelRequest* startAudioVideoCall(const Tp::AccountPtr &account,
+							    const Tp::ContactPtr &contact);
+
+  KTP_EXPORT Tp::PendingChannelRequest* startDesktopSharing(const Tp::AccountPtr &account,
+							    const Tp::ContactPtr &contact);
+
+  KTP_EXPORT Tp::PendingChannelRequest* startFileTransfer(const Tp::AccountPtr &account,
+							  const Tp::ContactPtr &contact,
+							  const QString &filePath);
+
+  KTP_EXPORT void openLogViewer(const Tp::AccountPtr &account,
+				const Tp::ContactPtr &contact);
+
+
+} /* namespace Actions */
+
+} /* namespace KTp */
+
+#endif // KTP_ACTIONS_H

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list