[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:08:12 UTC 2016


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

The following commit has been merged in the master branch:
commit 2ddc4985289430917fce86d3633ebf7c3a9699af
Author: Aleix Pol <aleixpol at kde.org>
Date:   Mon Apr 14 01:16:24 2014 +0200

    Add functionality in the TelepathyManager to be able to implement Presence actions
    
    Reviewed by Martin Klapetek and David Edmundson
---
 KTp/Declarative/CMakeLists.txt        |  1 +
 KTp/Declarative/telepathy-manager.cpp | 81 +++++++++++++++++++++++++++++++++++
 KTp/Declarative/telepathy-manager.h   | 31 ++++++++++++++
 3 files changed, 113 insertions(+)

diff --git a/KTp/Declarative/CMakeLists.txt b/KTp/Declarative/CMakeLists.txt
index 5702553..e6f2b50 100644
--- a/KTp/Declarative/CMakeLists.txt
+++ b/KTp/Declarative/CMakeLists.txt
@@ -27,6 +27,7 @@ target_link_libraries (ktpqmlplugin
     ktpcommoninternalsprivate
     ktploggerprivate
     ktpmodelsprivate
+    ktpwidgetsprivate
 )
 
 install (TARGETS ktpqmlplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/telepathy)
diff --git a/KTp/Declarative/telepathy-manager.cpp b/KTp/Declarative/telepathy-manager.cpp
index 940dc62..bd93b1f 100644
--- a/KTp/Declarative/telepathy-manager.cpp
+++ b/KTp/Declarative/telepathy-manager.cpp
@@ -18,13 +18,19 @@
 */
 
 #include "telepathy-manager.h"
+#include <Widgets/join-chat-room-dialog.h>
+#include <Widgets/add-contact-dialog.h>
+#include <Widgets/settings-kcm-dialog.h>
 #include <KTp/actions.h>
+#include <kstandarddirs.h>
+#include <KToolInvocation>
 
 #include <TelepathyQt/Account>
 #include <TelepathyQt/AccountManager>
 #include <TelepathyQt/ClientRegistrar>
 #include <TelepathyQt/AbstractClient>
 #include <TelepathyQt/TextChannel>
+#include <TelepathyQt/PendingChannelRequest>
 
 #include <QDeclarativeEngine>
 
@@ -156,6 +162,81 @@ Tp::PendingOperation* TelepathyManager::startFileTransfer(const Tp::AccountPtr &
     return KTp::Actions::startFileTransfer(account, contact, url);
 }
 
+bool TelepathyManager::canDial() const
+{
+    return !KStandardDirs::findExe(QLatin1String("ktp-dialout-ui")).isEmpty();
+}
+
+bool TelepathyManager::canSendFiles() const
+{
+    return !KStandardDirs::findExe(QLatin1String("ktp-send-file")).isEmpty();
+}
+
+void TelepathyManager::openDialUi() const
+{
+    KToolInvocation::kdeinitExec(QLatin1String("ktp-dialout-ui"));
+}
+
+void TelepathyManager::openSendFileUi() const
+{
+    KToolInvocation::kdeinitExec(QLatin1String("ktp-send-file"));
+}
+
+void TelepathyManager::addContact()
+{
+    KTp::AddContactDialog *dialog = new KTp::AddContactDialog(m_accountManager);
+    dialog->setAttribute(Qt::WA_DeleteOnClose);
+    dialog->show();
+}
+
+void TelepathyManager::joinChatRoom()
+{
+    KTp::JoinChatRoomDialog *dialog = new KTp::JoinChatRoomDialog(m_accountManager);
+    connect(dialog, SIGNAL(accepted()), this, SLOT(onJoinChatRoomSelected()));
+    dialog->setAttribute(Qt::WA_DeleteOnClose);
+    dialog->show();
+}
+
+void TelepathyManager::onJoinChatRoomSelected()
+{
+    KTp::JoinChatRoomDialog *dialog = qobject_cast<KTp::JoinChatRoomDialog*>(sender());
+    if (!dialog) {
+        return;
+    }
 
+    Tp::AccountPtr account = dialog->selectedAccount();
+    // check account validity. Should NEVER be invalid
+    if (!account.isNull()) {
+        Tp::PendingChannelRequest *channelRequest = KTp::Actions::startGroupChat(account, dialog->selectedChatRoom());
 
+        connect(channelRequest, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onGenericOperationFinished(Tp::PendingOperation*)));
+    }
+}
 
+void TelepathyManager::toggleContactList()
+{
+    //contact list is registered, call toggleWindowVisibility in contact list
+    QDBusMessage methodCall = QDBusMessage::createMethodCall(QLatin1String("org.kde.ktp-contactlist"),
+                                                             QLatin1String("/ktp_contactlist/MainWindow"),
+                                                             QLatin1String("org.kde.KTp.ContactList"),
+                                                             QLatin1String("toggleWindowVisibility"));
+
+    QDBusPendingCall call = QDBusConnection::sessionBus().asyncCall(methodCall);
+    QDBusPendingCallWatcher* watch = new QDBusPendingCallWatcher(call, this);
+    connect(watch, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(contactlistDBusAccessed(QDBusPendingCallWatcher*)));
+    connect(watch, SIGNAL(finished(QDBusPendingCallWatcher*)), watch, SLOT(deleteLater()));
+}
+
+void TelepathyManager::contactlistDBusAccessed(QDBusPendingCallWatcher* w)
+{
+    if(w->isError())
+        KToolInvocation::startServiceByDesktopName(QLatin1String("ktp-contactlist"));
+}
+
+void TelepathyManager::showSettingsKCM()
+{
+    KTp::SettingsKcmDialog *dialog = new KTp::SettingsKcmDialog();
+    dialog->addGeneralSettingsModule();
+    dialog->addNotificationsModule();
+    dialog->show();
+}
diff --git a/KTp/Declarative/telepathy-manager.h b/KTp/Declarative/telepathy-manager.h
index d229fdf..9e1a9a8 100644
--- a/KTp/Declarative/telepathy-manager.h
+++ b/KTp/Declarative/telepathy-manager.h
@@ -38,6 +38,12 @@ class TelepathyManager : public QObject
     Q_OBJECT
     Q_PROPERTY(Tp::AccountManagerPtr accountManager READ accountManager CONSTANT)
 
+    /** @returns whether there's a ktp-dialout-ui executable */
+    Q_PROPERTY(bool canDial READ canDial)
+
+    /** @returns whether there's a ktp-send-file executable */
+    Q_PROPERTY(bool canSendFiles READ canSendFiles)
+
 public:
     TelepathyManager(QObject *parent=0);
     virtual ~TelepathyManager();
@@ -79,6 +85,27 @@ public:
 
     Q_INVOKABLE bool unregisterClient(QObject* client);
 
+    bool canDial() const;
+    bool canSendFiles() const;
+
+    /** Opens UI to start an audio call */
+    Q_INVOKABLE void openDialUi() const;
+
+    /** Opens UI to send a file */
+    Q_INVOKABLE void openSendFileUi() const;
+
+    /** Opens UI to add a new contact */
+    Q_INVOKABLE void addContact();
+
+    /** Opens UI to join a chat room */
+    Q_INVOKABLE void joinChatRoom();
+
+    /** Opens UI to show the KDE Telepathy settings module */
+    Q_INVOKABLE void showSettingsKCM();
+
+    /** Toggles the visibility of the ktp-contact-list program */
+    Q_INVOKABLE void toggleContactList();
+
 public Q_SLOTS:
     /** Start a text chat using the default KTp text application
         @arg account the account to start the channel from
@@ -126,6 +153,10 @@ public Q_SLOTS:
     */
     void openLogViewer(const Tp::AccountPtr &account, const KTp::ContactPtr &contact);
 
+private Q_SLOTS:
+    void onJoinChatRoomSelected();
+    void contactlistDBusAccessed(QDBusPendingCallWatcher*);
+
 private:
     Tp::AccountManagerPtr m_accountManager;
     Tp::ClientRegistrarPtr m_clientRegistrar;

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list