Changed some internals in the chat dialog handling (private chat and lobby).

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4855 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-01-27 14:49:48 +00:00
parent 44ff9fe4f7
commit 2aa1ede192
7 changed files with 62 additions and 8 deletions

View file

@ -21,6 +21,7 @@
****************************************************************/
#include <QPixmap>
#include <QCloseEvent>
#include "PopupChatWindow.h"
#include "ChatDialog.h"
@ -137,6 +138,27 @@ void PopupChatWindow::showEvent(QShowEvent */*event*/)
}
}
void PopupChatWindow::closeEvent(QCloseEvent *event)
{
if (tabbedWindow) {
for (int index = ui.tabWidget->count() - 1; index >= 0; --index) {
ChatDialog *dialog = dynamic_cast<ChatDialog*>(ui.tabWidget->widget(0));
if (dialog == NULL) {
continue;
}
if (!dialog->close()) {
event->ignore();
break;
}
}
} else {
if (chatDialog && !chatDialog->close()) {
event->ignore();
}
}
}
ChatDialog *PopupChatWindow::getCurrentDialog()
{
if (tabbedWindow) {
@ -160,6 +182,8 @@ void PopupChatWindow::addDialog(ChatDialog *dialog)
/* signal toggled is called */
ui.actionSetOnTop->setChecked(PeerSettings->getPrivateChatOnTop(peerId));
QObject::connect(dialog, SIGNAL(dialogClose(ChatDialog*)), this, SLOT(dialogClose(ChatDialog*)));
}
QObject::connect(dialog, SIGNAL(infoChanged(ChatDialog*)), this, SLOT(tabInfoChanged(ChatDialog*)));
@ -178,6 +202,8 @@ void PopupChatWindow::removeDialog(ChatDialog *dialog)
deleteLater();
}
} else {
QObject::disconnect(dialog, SIGNAL(dialogClose(ChatDialog*)), this, SLOT(dialogClose(ChatDialog*)));
if (chatDialog == dialog) {
saveSettings();
dialog->removeFromParent(this);
@ -280,6 +306,13 @@ void PopupChatWindow::tabClosed(ChatDialog *dialog)
}
}
void PopupChatWindow::dialogClose(ChatDialog *dialog)
{
if (!tabbedWindow) {
removeDialog(dialog);
}
}
void PopupChatWindow::tabChanged(ChatDialog *dialog)
{
calculateStyle(dialog);