[SCM] ktp-contact-applet packaging branch, master, updated. debian/15.12.1-1-966-gde83ac5

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:15:14 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-desktop-applets.git;a=commitdiff;h=be470c3

The following commit has been merged in the master branch:
commit be470c3f79fe22475c43be22f18ca07ddcebb6c4
Author: Othmane Moustaouda <othmane.moustaouda at gmail.com>
Date:   Sat Sep 8 21:57:14 2012 +0100

    Added "Join Chat Room" button
    
    REVIEW: 104535
---
 presence/src/presence-applet.cpp | 34 +++++++++++++++++++++++++++++++++-
 presence/src/presence-applet.h   |  1 +
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/presence/src/presence-applet.cpp b/presence/src/presence-applet.cpp
index 736d953..aa843c9 100644
--- a/presence/src/presence-applet.cpp
+++ b/presence/src/presence-applet.cpp
@@ -34,14 +34,18 @@
 #include <KTp/global-presence.h>
 #include <KTp/Models/accounts-model.h>
 #include <KTp/Widgets/add-contact-dialog.h>
+#include <KTp/Widgets/join-chat-room-dialog.h>
 
 #include <Plasma/ToolTipManager>
 
 #include <TelepathyQt/PendingOperation>
 #include <TelepathyQt/PendingContacts>
 #include <TelepathyQt/PendingReady>
+#include <TelepathyQt/PendingChannelRequest>
 #include <TelepathyQt/Account>
 
+#define PREFERRED_TEXTCHAT_HANDLER "org.freedesktop.Telepathy.Client.KDE.TextUi"
+
 TelepathyPresenceApplet::TelepathyPresenceApplet(QObject *parent, const QVariantList &args)
     : Plasma::Applet(parent, args),
       m_globalPresence(new KTp::GlobalPresence(this))
@@ -125,6 +129,7 @@ void TelepathyPresenceApplet::setupContextMenuActions()
     KAction *goExtendedAwayAction = new KAction(KIcon("user-away-extended"), i18n("Not Available"), this);
     KAction *goHiddenAction = new KAction(KIcon("user-invisible"), i18n("Invisible"), this);
     KAction *goOfflineAction = new KAction(KIcon("user-offline"), i18n("Offline"), this);
+    KAction *joinChatroomAction = new KAction(KIcon("user-group-new"), i18n("Join Chat Room"), this);
 
     goOnlineAction->setData(QVariant::fromValue(KTp::Presence(Tp::Presence::available())));
     goBusyAction->setData(QVariant::fromValue(KTp::Presence(Tp::Presence::busy())));
@@ -152,7 +157,8 @@ void TelepathyPresenceApplet::setupContextMenuActions()
 
     connect(showAccountManagerAction, SIGNAL(triggered()), this, SLOT(startAccountManager()));
     connect(showContactListAction, SIGNAL(triggered()), this, SLOT(startContactList()));
-    connect(addContactAction, SIGNAL(triggered()),this, SLOT(onAddContactRequest()));
+    connect(addContactAction, SIGNAL(triggered()), this, SLOT(onAddContactRequest()));
+    connect(joinChatroomAction, SIGNAL(triggered()), this, SLOT(onJoinChatRoomRequest()));
     if (makeCallAction) {
         connect(makeCallAction, SIGNAL(triggered()), this, SLOT(onMakeCallRequest()));
     }
@@ -170,6 +176,7 @@ void TelepathyPresenceApplet::setupContextMenuActions()
 
     m_contextActions.append(moreMenu->addSeparator());
     m_contextActions.append(addContactAction);
+    m_contextActions.append(joinChatroomAction);
     if (makeCallAction) {
         m_contextActions.append(makeCallAction);
     }
@@ -209,6 +216,31 @@ void TelepathyPresenceApplet::onAddContactRequest()
     dialog->show();
 }
 
+void TelepathyPresenceApplet::onJoinChatRoomRequest()
+{
+    QWeakPointer<KTp::JoinChatRoomDialog> dialog = new KTp::JoinChatRoomDialog(m_accountManager);
+
+    if (dialog.data()->exec() == QDialog::Accepted) {
+        Tp::AccountPtr account = dialog.data()->selectedAccount();
+
+        // check account validity. Should NEVER be invalid
+        if (!account.isNull()) {
+            // ensure chat room
+            Tp::ChannelRequestHints hints;
+            hints.setHint("org.kde.telepathy","forceRaiseWindow", QVariant(true));
+
+            Tp::PendingChannelRequest *channelRequest = account->ensureTextChatroom(dialog.data()->selectedChatRoom(),
+                                                                                    QDateTime::currentDateTime(),
+                                                                                    PREFERRED_TEXTCHAT_HANDLER,
+                                                                                    hints);
+
+            connect(channelRequest, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onGenericOperationFinished(Tp::PendingOperation*)));
+        }
+    }
+
+    delete dialog.data();
+}
+
 void TelepathyPresenceApplet::onMakeCallRequest()
 {
     KToolInvocation::kdeinitExec(QLatin1String("ktp-dialout-ui"));
diff --git a/presence/src/presence-applet.h b/presence/src/presence-applet.h
index 4359fd3..2de67ac 100644
--- a/presence/src/presence-applet.h
+++ b/presence/src/presence-applet.h
@@ -59,6 +59,7 @@ private Q_SLOTS:
 
     void onPresenceChanged(KTp::Presence presence);
     void onPresenceActionClicked();
+    void onJoinChatRoomRequest();
     void toolTipAboutToShow();
     void toolTipHidden();
 

-- 
ktp-contact-applet packaging



More information about the pkg-kde-commits mailing list