Hid the chat window rather than close it in order to preserve sent

messages.
This commit is contained in:
Dimitar Dobrev 2014-03-13 14:07:21 +02:00
parent 727903b216
commit 442ca145da
5 changed files with 17 additions and 6 deletions

View file

@ -45,7 +45,7 @@
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="110"/>
<location filename="src/ui/ChatWindow.cpp" line="115"/>
<source>day</source>
<translation>
<numerusform>%n day</numerusform>
@ -53,7 +53,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="110"/>
<location filename="src/ui/ChatWindow.cpp" line="115"/>
<source>hour</source>
<translation>
<numerusform>%n hour</numerusform>
@ -61,7 +61,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="110"/>
<location filename="src/ui/ChatWindow.cpp" line="115"/>
<source>minute</source>
<translation>
<numerusform>%n minute</numerusform>
@ -76,7 +76,7 @@
</translation>
</message>
<message>
<location filename="src/ui/ChatWindow.cpp" line="163"/>
<location filename="src/ui/ChatWindow.cpp" line="170"/>
<source>%1 online now:</source>
<translation type="unfinished"></translation>
</message>

View file

@ -1043,6 +1043,8 @@ void Menu::showChat() {
mainWindow->geometry().y(),
_chatWindow->width(),
mainWindow->height());
}
if (!_chatWindow->isVisible()) {
_chatWindow->show();
}
_chatWindow->raise();

View file

@ -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()));

View file

@ -33,6 +33,8 @@ public:
ChatWindow();
~ChatWindow();
virtual void reject();
protected:
bool eventFilter(QObject* sender, QEvent* event);

View file

@ -185,10 +185,10 @@
<sender>closeButton</sender>
<signal>clicked()</signal>
<receiver>ChatWindow</receiver>
<slot>accept()</slot>
<slot>hide()</slot>
<hints>
<hint type="sourcelabel">
<x>342</x>
<x>390</x>
<y>42</y>
</hint>
<hint type="destinationlabel">