Splitted queue of chat messages in chat service into public and private queue.

Reworked the interface of the chat service. So full recomile is needed.
With disabled flags for private chat (RS_CHAT_OPEN_NEW and RS_CHAT_REOPEN), the incoming private chat messages are queued (only for the runtime) until the user shows the private chat dialog.
When a new chat message is available, the icon of the gpg and ssl contact changed in MessengerWindow and PeersDialog and a new tray icon is shown.
Fixed compiler warning.


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3421 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-09-01 17:56:15 +00:00
parent 7dd99a0c35
commit 7f837e9778
17 changed files with 597 additions and 329 deletions

View file

@ -50,6 +50,7 @@
#include "ChannelFeed.h"
#include "bwgraph/bwgraph.h"
#include "help/browser/helpbrowser.h"
#include "chat/PopupChatDialog.h"
#ifdef UNFINISHED
#include "unfinished/ApplicationWindow.h"
@ -67,6 +68,7 @@
#include <retroshare/rspeers.h>
#include <retroshare/rsfiles.h>
#include <retroshare/rsforums.h>
#include <retroshare/rsnotify.h>
#include "gui/connect/ConnectFriendWizard.h"
#include "util/rsversion.h"
@ -398,6 +400,11 @@ void MainWindow::createTrayIcon()
trayIconForums = new QSystemTrayIcon(this);
trayIconForums->setIcon(QIcon(":/images/konversation16.png"));
connect(trayIconForums, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconForumsClicked(QSystemTrayIcon::ActivationReason)));
// Create the tray icon for chat
trayIconChat = new QSystemTrayIcon(this);
trayIconChat->setIcon(QIcon(":/images/chat.png"));
connect(trayIconChat, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconChatClicked(QSystemTrayIcon::ActivationReason)));
}
/*static*/ void MainWindow::installGroupChatNotifier()
@ -503,6 +510,21 @@ void MainWindow::updateStatus()
}
}
void MainWindow::privateChatChanged(int type)
{
/* first process the chat messages */
PopupChatDialog::privateChatChanged();
/* than count the chat messages */
int chatCount = rsMsgs->getChatQueueCount(true);
if (chatCount) {
trayIconChat->show();
} else {
trayIconChat->hide();
}
}
void MainWindow::updateHashingInfo(const QString& s)
{
if(s == "")
@ -766,7 +788,6 @@ void MainWindow::closeEvent(QCloseEvent *e)
}
void MainWindow::updateMenu()
{
toggleVisibilityAction->setText(isVisible() ? tr("Hide") : tr("Show"));
@ -806,6 +827,21 @@ void MainWindow::trayIconForumsClicked(QSystemTrayIcon::ActivationReason e)
}
}
void MainWindow::trayIconChatClicked(QSystemTrayIcon::ActivationReason e)
{
if(e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {
PopupChatDialog *pcd = NULL;
std::list<std::string> ids;
if (rsMsgs->getPrivateChatQueueIds(ids) && ids.size()) {
pcd = PopupChatDialog::getPrivateChat(ids.front(), RS_CHAT_OPEN_NEW | RS_CHAT_REOPEN | RS_CHAT_FOCUS);
}
if (pcd == NULL) {
showWindow(MainWindow::Friends);
}
}
}
void MainWindow::toggleVisibilitycontextmenu()
{
if (isVisible())