added systray notification for group chat

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1367 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2009-07-13 14:01:49 +00:00
parent a2c29ba507
commit 72112fb54c
5 changed files with 24 additions and 0 deletions

View File

@ -340,6 +340,11 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
timer->start(1000);
}
void MainWindow::displaySystrayMsg(const QString& title,const QString& msg)
{
trayIcon->showMessage(title, msg, QSystemTrayIcon::Information, 1000);
}
void MainWindow::updateStatus()
{

View File

@ -139,6 +139,7 @@ private slots:
void showsmplayer();
void showabout();
void openShareManager();
void displaySystrayMsg(const QString&,const QString&) ;
/** Displays the help browser and displays the most recently viewed help
* topic. */

View File

@ -707,6 +707,20 @@ void PeersDialog::insertChat()
extraTxt += QString::fromStdWString(it->msg);
// notify with a systray icon msg
if(it->rsid != rsPeers->getOwnId())
{
QTextEdit editor ;
editor.setHtml(QString::fromStdWString(it->msg));
QString notifyMsg(QString::fromStdString(it->name)+": "+editor.toPlainText()) ;
if(notifyMsg.length() > 30)
emit notifyGroupChat(QString("New group chat"), notifyMsg.left(30)+QString("..."));
else
emit notifyGroupChat(QString("New group chat"), notifyMsg);
}
/* add it everytime */
currenttxt += extraTxt;

View File

@ -106,6 +106,7 @@ private slots:
signals:
void friendsUpdated() ;
void notifyGroupChat(const QString&,const QString&) ;
private:

View File

@ -177,6 +177,9 @@ int main(int argc, char *argv[])
QObject::connect(ConfCertDialog::instance(),SIGNAL(configChanged()),w->networkDialog,SLOT(insertConnect())) ;
QObject::connect(w->peersDialog,SIGNAL(friendsUpdated()),w->networkDialog,SLOT(insertConnect())) ;
QObject::connect(w->peersDialog,SIGNAL(notifyGroupChat(const QString&,const QString&)),w,SLOT(displaySystrayMsg(const QString&,const QString&))) ;
/* only show window, if not startMinimized */
RshareSettings *_settings = new RshareSettings();