QTfrontend/chatwidget.cpp
changeset 4892 b0610081ee95
parent 4884 b2006a9f0fbc
child 4897 11598e7aa7e6
--- a/QTfrontend/chatwidget.cpp	Sun Jan 30 19:02:32 2011 -0500
+++ b/QTfrontend/chatwidget.cpp	Mon Jan 31 08:45:05 2011 +0100
@@ -162,12 +162,24 @@
     acFriend->setIcon(QIcon(":/res/addfriend.png"));
     connect(acFriend, SIGNAL(triggered(bool)), this, SLOT(onFriend()));
 
+    chatNicks->insertAction(0, acFriend);
     chatNicks->insertAction(0, acInfo);
-    chatNicks->insertAction(0, acFollow);
     chatNicks->insertAction(0, acIgnore);
-    chatNicks->insertAction(0, acFriend);
 
     showReady = false;
+    setShowFollow(true);
+}
+
+void HWChatWidget::setShowFollow(bool enabled)
+{
+    if (enabled) {
+        if (!(chatNicks->actions().contains(acFollow)))
+            chatNicks->insertAction(acFriend, acFollow);
+    }
+    else {
+        if (chatNicks->actions().contains(acFollow))
+            chatNicks->removeAction(acFollow);
+    }
 }
 
 void HWChatWidget::loadList(QStringList & list, const QString & file)
@@ -420,7 +432,8 @@
 
 void HWChatWidget::chatNickDoubleClicked(QListWidgetItem * item)
 {
-    if (item) onFollow();
+    QList<QAction *> actions = chatNicks->actions();
+    actions.first()->activate(QAction::Trigger);
 }
 
 void HWChatWidget::chatNickSelected(int index)