QTfrontend/chatwidget.cpp
changeset 2847 cde320fd3122
parent 2846 1cb8b4c425ed
child 2948 3f21a9dc93d0
--- a/QTfrontend/chatwidget.cpp	Mon Feb 22 23:03:50 2010 +0000
+++ b/QTfrontend/chatwidget.cpp	Tue Feb 23 00:18:57 2010 +0000
@@ -78,8 +78,8 @@
 	chatNicks->setContextMenuPolicy(Qt::ActionsContextMenu);
 	connect(chatNicks, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
 		this, SLOT(chatNickDoubleClicked(QListWidgetItem *)));
-	connect(chatNicks, SIGNAL(itemClicked(QListWidgetItem *)),
-		this, SLOT(chatNickClicked(QListWidgetItem *)));
+	connect(chatNicks, SIGNAL(currentRowChanged(int)),
+		this, SLOT(chatNickSelected(int)));
 
 	mainLayout.addWidget(chatNicks, 0, 1);
 
@@ -303,7 +303,8 @@
 		ignoreList << curritem->text().toLower();
 		onChatString(HWChatWidget::tr("%1 *** %2 has been added to your ignore list").arg('\x03').arg(curritem->text()));
 	}
-	updateIcon(curritem);
+	updateIcon(curritem); // update icon
+	chatNickSelected(0); // update context menu
 }
 
 void HWChatWidget::onFriend()
@@ -322,7 +323,8 @@
 		friendsList << curritem->text().toLower();
 		onChatString(HWChatWidget::tr("%1 *** %2 has been added to your friends list").arg('\x03').arg(curritem->text()));
 	}
-	updateIcon(curritem);
+	updateIcon(curritem); // update icon
+	chatNickSelected(0); // update context menu
 }
 
 void HWChatWidget::chatNickDoubleClicked(QListWidgetItem * item)
@@ -330,8 +332,9 @@
 	if (item) onFollow();
 }
 
-void HWChatWidget::chatNickClicked(QListWidgetItem * item)
+void HWChatWidget::chatNickSelected(int index)
 {
+	QListWidgetItem* item = chatNicks->currentItem();
 	if (!item)
 		return;