[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=660964f
The following commit has been merged in the master branch:
commit 660964f634f0bb85bf166f5fa8579d83291db7a9
Author: Francesco Nwokeka <francesco.nwokeka at gmail.com>
Date: Sat Apr 30 04:24:56 2011 +0200
Re-establish chat after going offline and back online PART 2 of 3
If a textChannel is invaldiated by the user going offline and then, once back online, requests a chat with
the same person, the channel is re-established.
Reviewed by: David Edmundson
REVIEW: 101255
---
app/chat-window.cpp | 9 ++++++++-
lib/chat-widget.cpp | 36 +++++++++++++++++++++++++++---------
lib/chat-widget.h | 8 ++++++++
3 files changed, 43 insertions(+), 10 deletions(-)
diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 3d14909..7d82066 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -101,6 +101,13 @@ void ChatWindow::startChat(Tp::TextChannelPtr incomingTextChannel)
&& auxChatTab->textChannel()->targetHandleType() == incomingTextChannel->targetHandleType()) {
duplicateTab = true;
m_tabWidget->setCurrentIndex(index); // set focus on selected tab
+
+ // check if channel is invalid. Replace only if invalid
+ // You get this status if user goes offline and then back on without closing the chat
+ if (!auxChatTab->textChannel()->isValid()) {
+ auxChatTab->setTextChannel(incomingTextChannel); // replace with new one
+ auxChatTab->setChatEnabled(true); // re-enable chat
+ }
} else if (auxChatTab->textChannel()->targetId() == incomingTextChannel->targetId()
&& auxChatTab->textChannel()->targetHandleType() == Tp::HandleTypeContact) {
// got duplicate group chat. Wait for group handling to be sorted out
@@ -110,7 +117,7 @@ void ChatWindow::startChat(Tp::TextChannelPtr incomingTextChannel)
}
// got new chat, create it
- if(!duplicateTab) {
+ if (!duplicateTab) {
createNewChat(incomingTextChannel);
}
}
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index ef4927c..148f4e4 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -282,6 +282,32 @@ ChatSearchBar* ChatWidget::chatSearchBar() const
return d->ui.searchBar;
}
+void ChatWidget::setChatEnabled(bool enable)
+{
+ d->ui.sendMessageBox->setEnabled(enable);
+ d->ui.sendButton->setEnabled(enable);
+
+ // show a message informing the user
+ AdiumThemeStatusInfo statusMessage;
+
+ if (!enable) {
+ statusMessage.setMessage(i18n("Connection closed"));
+ } else {
+ statusMessage.setMessage(i18n("Connected"));
+ }
+ statusMessage.setService(d->channel->connection()->protocolName());
+ statusMessage.setTime(QDateTime::currentDateTime());
+ d->ui.chatArea->addStatusMessage(statusMessage);
+}
+
+void ChatWidget::setTextChannel(const Tp::TextChannelPtr &newTextChannelPtr)
+{
+ d->channel = newTextChannelPtr; // set the new channel
+
+ // connect signals for the new textchannel
+ setupChannelSignals();
+}
+
Tp::TextChannelPtr ChatWidget::textChannel() const
{
return d->channel;
@@ -697,15 +723,7 @@ void ChatWidget::onContactAliasChanged(const Tp::ContactPtr & contact, const QSt
void ChatWidget::onChannelInvalidated()
{
- d->ui.sendMessageBox->setDisabled(true);
- d->ui.sendButton->setDisabled(true);
-
- // show a message informing the user
- AdiumThemeStatusInfo statusMessage;
- statusMessage.setMessage(i18n("Connection closed"));
- statusMessage.setService(d->channel->connection()->protocolName());
- statusMessage.setTime(QDateTime::currentDateTime());
- d->ui.chatArea->addStatusMessage(statusMessage);
+ setChatEnabled(false);
}
void ChatWidget::onInputBoxChanged()
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index f7d08d3..0a4cb1a 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -50,6 +50,14 @@ public:
/** Returns a pointer to the Chatwidget's search bar */
ChatSearchBar *chatSearchBar() const;
+ /** invalidates the use of the chat.
+ * @param enable flag to validate/invalidate chatWidget
+ */
+ void setChatEnabled(bool enable);
+
+ /** Sets textchannel to given one */
+ void setTextChannel(const Tp::TextChannelPtr &newTextChannelPtr);
+
/** Returns the text channel pointer of the chatWidget */
Tp::TextChannelPtr textChannel() const;
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list