[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:19:18 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=aaed121

The following commit has been merged in the master branch:
commit aaed121605dc91aef945d7852575765c0a1b33f5
Author: Francesco Nwokeka <francesco.nwokeka at gmail.com>
Date:   Sat Apr 30 20:04:28 2011 +0200

    Re-establish chat after going offline and back online PART 3 of 3
    
    Final part of bug 270725: An existing chat window/tab stops working when going offline and back online. When
    user goes offline, the chat is invalidated. If the user comes back online, and the previous chat window is
    still open, the chat with that contact is re-established.
    
    BUG: 270725
    REVIEW: 101260
    Reviewed by: David Edmundson
---
 app/chat-tab.cpp          | 20 +++++++++++++++++---
 app/chat-tab.h            |  7 ++++++-
 app/chat-window.cpp       | 11 ++++++-----
 app/chat-window.h         |  4 ++--
 app/telepathy-chat-ui.cpp |  4 +---
 lib/chat-widget.cpp       | 10 +++++++++-
 lib/chat-widget.h         |  5 ++++-
 7 files changed, 45 insertions(+), 16 deletions(-)

diff --git a/app/chat-tab.cpp b/app/chat-tab.cpp
index 8f5226e..23c912e 100644
--- a/app/chat-tab.cpp
+++ b/app/chat-tab.cpp
@@ -26,11 +26,17 @@
 #include <QStackedWidget>
 #include <KDE/KColorScheme>
 
-ChatTab::ChatTab(const Tp::TextChannelPtr & channel, QWidget *parent)
-    : ChatWidget(channel, parent),
-      m_tabWidget(0)
+#include <TelepathyQt4/Account>
+#include <TelepathyQt4/TextChannel>
+
+ChatTab::ChatTab(const Tp::TextChannelPtr& channel, const Tp::AccountPtr& account, QWidget* parent)
+    : ChatWidget(channel, account, parent)
+    , m_tabWidget(0)
 {
     connect(this, SIGNAL(notificationClicked()), SLOT(showOnTop()));
+
+    // connect account connection status
+    connect(account.data(), SIGNAL(connectionStatusChanged(Tp::ConnectionStatus)), this, SLOT(onConnectionStatusChanged(Tp::ConnectionStatus)));
 }
 
 ChatTab::~ChatTab()
@@ -56,3 +62,11 @@ void ChatTab::showOnTop()
 
     activateWindow();
 }
+
+void ChatTab::onConnectionStatusChanged(Tp::ConnectionStatus status)
+{
+    // request a new text channel for the chat
+    if (status == Tp::ConnectionStatusConnected) {
+        account()->ensureTextChat(textChannel()->targetId());
+    }
+}
diff --git a/app/chat-tab.h b/app/chat-tab.h
index 17924cc..2175fe2 100644
--- a/app/chat-tab.h
+++ b/app/chat-tab.h
@@ -37,7 +37,7 @@ class ChatTab : public ChatWidget
     Q_OBJECT
 
 public:
-    explicit ChatTab(const Tp::TextChannelPtr & channel, QWidget *parent = 0);
+    explicit ChatTab(const Tp::TextChannelPtr &channel, const Tp::AccountPtr &account, QWidget *parent = 0);
     virtual ~ChatTab();
 
     void setTabWidget(KTabWidget *tabWidget);
@@ -46,6 +46,11 @@ public:
 public slots:
     void showOnTop();
 
+private slots:
+    /** connect account's connection status.
+     * This re-enables open chats if user goes offline and then back online */
+    void onConnectionStatusChanged(Tp::ConnectionStatus);
+
 private:
     KTabWidget *m_tabWidget;
 };
diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 7d82066..a456e44 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -37,6 +37,7 @@
 #include <KMenuBar>
 #include <KLineEdit>
 
+#include <TelepathyQt4/Account>
 #include <TelepathyQt4/TextChannel>
 
 ChatWindow::ChatWindow()
@@ -74,12 +75,12 @@ ChatWindow::~ChatWindow()
 {
 }
 
-void ChatWindow::startChat(Tp::TextChannelPtr incomingTextChannel)
+void ChatWindow::startChat(const Tp::TextChannelPtr &incomingTextChannel, const Tp::AccountPtr &account)
 {
     // if targetHandle is None, targetId is also "", so create new chat
     if (incomingTextChannel->targetHandleType() == Tp::HandleTypeNone) {
         kDebug() << "ChatWindow::startChat target handle type is HandleTypeNone";
-        createNewChat(incomingTextChannel);
+        createNewChat(incomingTextChannel, account);
         return;
     }
 
@@ -118,7 +119,7 @@ void ChatWindow::startChat(Tp::TextChannelPtr incomingTextChannel)
 
     // got new chat, create it
     if (!duplicateTab) {
-        createNewChat(incomingTextChannel);
+        createNewChat(incomingTextChannel, account);
     }
 }
 
@@ -262,9 +263,9 @@ void ChatWindow::showNotificationsDialog()
     KNotifyConfigWidget::configure(this, "ktelepathy");
 }
 
-void ChatWindow::createNewChat(Tp::TextChannelPtr channelPtr)
+void ChatWindow::createNewChat(const Tp::TextChannelPtr &channelPtr, const Tp::AccountPtr &accountPtr)
 {
-    ChatTab *chatTab = new ChatTab(channelPtr, m_tabWidget);
+    ChatTab *chatTab = new ChatTab(channelPtr, accountPtr, m_tabWidget);
     setupChatTabSignals(chatTab);
     chatTab->setTabWidget(m_tabWidget);
     m_tabWidget->addTab(chatTab, chatTab->icon(), chatTab->title());
diff --git a/app/chat-window.h b/app/chat-window.h
index ebbcca9..62ccdd5 100644
--- a/app/chat-window.h
+++ b/app/chat-window.h
@@ -41,7 +41,7 @@ public:
      * chat doesn't already exist
      * @param incomingTextChannel new text channel
      */
-    void startChat(Tp::TextChannelPtr incomingTextChannel);
+    void startChat(const Tp::TextChannelPtr &incomingTextChannel, const Tp::AccountPtr &account);
     void removeTab(ChatTab *chatWidget);
     void setTabText(int index, const QString &newTitle);
     void setTabIcon(int index, const KIcon &newIcon);
@@ -68,7 +68,7 @@ private:
     /** creats a new chat and adds it to the tab widget
      * @param channelPtr pointer to textChannel to use
      */
-    void createNewChat(Tp::TextChannelPtr channelPtr);
+    void createNewChat(const Tp::TextChannelPtr &channelPtr, const Tp::AccountPtr &account);
 
     /** connects the neccessary chat tab signals with slots in chatwindow
      * @param chatTab chatTab object to connect
diff --git a/app/telepathy-chat-ui.cpp b/app/telepathy-chat-ui.cpp
index 5473394..1d013a4 100644
--- a/app/telepathy-chat-ui.cpp
+++ b/app/telepathy-chat-ui.cpp
@@ -54,8 +54,6 @@ void TelepathyChatUi::handleChannels(const Tp::MethodInvocationContextPtr<> & co
         const Tp::AbstractClientHandler::HandlerInfo & handlerInfo)
 {
     kDebug();
-
-    Q_UNUSED(account);
     Q_UNUSED(connection);
     Q_UNUSED(requestsSatisfied);
     Q_UNUSED(userActionTime);
@@ -72,7 +70,7 @@ void TelepathyChatUi::handleChannels(const Tp::MethodInvocationContextPtr<> & co
     Q_ASSERT(textChannel);
 
     // create new chat
-    m_chatWindow->startChat(textChannel);
+    m_chatWindow->startChat(textChannel, account);
     m_chatWindow->show();
     context->setFinished();
 }
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index 148f4e4..d8ff9c7 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -37,6 +37,7 @@
 #include <KColorScheme>
 #include <KLineEdit>
 
+#include <TelepathyQt4/Account>
 #include <TelepathyQt4/Message>
 #include <TelepathyQt4/Types>
 #include <TelepathyQt4/AvatarData>
@@ -106,6 +107,7 @@ public:
     int unreadMessages;
     QString title;
     Tp::TextChannelPtr channel;
+    Tp::AccountPtr account;
     Ui::ChatWidget ui;
     KIcon icon;
     ChannelContactModel *contactModel;
@@ -121,11 +123,12 @@ KComponentData ChatWidgetPrivate::telepathyComponentData()
     return KComponentData(telepathySharedAboutData);
 }
 
-ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, QWidget *parent)
+ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, const Tp::AccountPtr &account, QWidget *parent)
     : QWidget(parent),
       d(new ChatWidgetPrivate)
 {
     d->channel = channel;
+    d->account = account;
 
     d->chatviewlInitialised = false;
     d->showFormatToolbarAction = new QAction(i18n("Show format options"), this);
@@ -261,6 +264,11 @@ void ChatWidget::resizeEvent(QResizeEvent *e)
     QWidget::resizeEvent(e);
 }
 
+Tp::AccountPtr ChatWidget::account() const
+{
+    return d->account;
+}
+
 KIcon ChatWidget::icon() const
 {
     //normal chat - self and one other person.
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index 0a4cb1a..feacc7b 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -41,9 +41,12 @@ class KDE_TELEPATHY_CHAT_EXPORT ChatWidget : public QWidget
     Q_OBJECT
 
 public:
-    explicit ChatWidget(const Tp::TextChannelPtr & channel, QWidget *parent = 0);
+    explicit ChatWidget(const Tp::TextChannelPtr &channel, const Tp::AccountPtr &account, QWidget *parent = 0);
     virtual ~ChatWidget();
 
+    /** Returns pointer to account used for chat */
+    Tp::AccountPtr account() const;
+
     /** Returns the icon of this chat window */
     KIcon icon() const;
 

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list