From 442ca145da90a46620eb3495afc541b2aff382e8 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Thu, 13 Mar 2014 14:07:21 +0200 Subject: [PATCH] Hid the chat window rather than close it in order to preserve sent messages. --- interface/interface_en.ts | 8 ++++---- interface/src/Menu.cpp | 2 ++ interface/src/ui/ChatWindow.cpp | 7 +++++++ interface/src/ui/ChatWindow.h | 2 ++ interface/ui/chatWindow.ui | 4 ++-- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/interface/interface_en.ts b/interface/interface_en.ts index 72e5ee3d3e..1d962393d7 100644 --- a/interface/interface_en.ts +++ b/interface/interface_en.ts @@ -45,7 +45,7 @@ - + day %n day @@ -53,7 +53,7 @@ - + hour %n hour @@ -61,7 +61,7 @@ - + minute %n minute @@ -76,7 +76,7 @@ - + %1 online now: diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 95b94bdcbf..00ae0a3772 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -1043,6 +1043,8 @@ void Menu::showChat() { mainWindow->geometry().y(), _chatWindow->width(), mainWindow->height()); + } + if (!_chatWindow->isVisible()) { _chatWindow->show(); } _chatWindow->raise(); diff --git a/interface/src/ui/ChatWindow.cpp b/interface/src/ui/ChatWindow.cpp index 3a1c26ee35..d4f257c0f7 100644 --- a/interface/src/ui/ChatWindow.cpp +++ b/interface/src/ui/ChatWindow.cpp @@ -50,6 +50,7 @@ ChatWindow::ChatWindow() : startTimerForTimeStamps(); } else { ui->numOnlineLabel->hide(); + ui->closeButton->hide(); ui->usersWidget->hide(); ui->messagesScrollArea->hide(); ui->messagePlainTextEdit->hide(); @@ -71,6 +72,10 @@ ChatWindow::~ChatWindow() { delete ui; } +void ChatWindow::reject() { + hide(); +} + bool ChatWindow::eventFilter(QObject* sender, QEvent* event) { Q_UNUSED(sender); @@ -136,9 +141,11 @@ void ChatWindow::startTimerForTimeStamps() { void ChatWindow::connected() { ui->connectingToXMPPLabel->hide(); ui->numOnlineLabel->show(); + ui->closeButton->show(); ui->usersWidget->show(); ui->messagesScrollArea->show(); ui->messagePlainTextEdit->show(); + ui->messagePlainTextEdit->setFocus(); #ifdef HAVE_QXMPP const QXmppMucRoom* publicChatRoom = XmppClient::getInstance().getPublicChatRoom(); connect(publicChatRoom, SIGNAL(participantsChanged()), this, SLOT(participantsChanged())); diff --git a/interface/src/ui/ChatWindow.h b/interface/src/ui/ChatWindow.h index 9250da8933..57da4da45d 100644 --- a/interface/src/ui/ChatWindow.h +++ b/interface/src/ui/ChatWindow.h @@ -33,6 +33,8 @@ public: ChatWindow(); ~ChatWindow(); + virtual void reject(); + protected: bool eventFilter(QObject* sender, QEvent* event); diff --git a/interface/ui/chatWindow.ui b/interface/ui/chatWindow.ui index 9959c638b2..ecb4d79c41 100644 --- a/interface/ui/chatWindow.ui +++ b/interface/ui/chatWindow.ui @@ -185,10 +185,10 @@ closeButton clicked() ChatWindow - accept() + hide() - 342 + 390 42