QTfrontend/chatwidget.cpp
changeset 2706 935b7d618cf0
parent 2428 6800f8aa0184
child 2773 e94f240a8a41
--- a/QTfrontend/chatwidget.cpp	Sun Jan 24 13:37:03 2010 +0000
+++ b/QTfrontend/chatwidget.cpp	Sun Jan 24 13:38:14 2010 +0000
@@ -18,7 +18,6 @@
  */
 
 #include <QTextBrowser>
-#include <QListWidget>
 #include <QLineEdit>
 #include <QAction>
 #include <QApplication>
@@ -55,6 +54,9 @@
 	chatNicks->setSortingEnabled(true);
 	chatNicks->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 	chatNicks->setContextMenuPolicy(Qt::ActionsContextMenu);
+	connect(chatNicks, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
+		this, SLOT(chatNickDoubleClicked(QListWidgetItem *)));
+
 	mainLayout.addWidget(chatNicks, 0, 1);
 
 	acInfo = new QAction(QAction::tr("Info"), chatNicks);
@@ -63,8 +65,11 @@
 	connect(acKick, SIGNAL(triggered(bool)), this, SLOT(onKick()));
 	acBan = new QAction(QAction::tr("Ban"), chatNicks);
 	connect(acBan, SIGNAL(triggered(bool)), this, SLOT(onBan()));
+	acFollow = new QAction(QAction::tr("Follow"), chatNicks);
+	connect(acFollow, SIGNAL(triggered(bool)), this, SLOT(onFollow()));
 
 	chatNicks->insertAction(0, acInfo);
+	chatNicks->insertAction(0, acFollow);
 }
 
 void HWChatWidget::returnPressed()
@@ -148,6 +153,18 @@
 		emit info(curritem->text());
 }
 
+void HWChatWidget::onFollow()
+{
+	QListWidgetItem * curritem = chatNicks->currentItem();
+	if (curritem)
+		emit follow(curritem->text());
+}
+
+void HWChatWidget::chatNickDoubleClicked(QListWidgetItem * item)
+{
+	if (item) onFollow();
+}
+
 void HWChatWidget::setReadyStatus(const QString & nick, bool isReady)
 {
 	QList<QListWidgetItem *> items = chatNicks->findItems(nick, Qt::MatchExactly);