nicklist actions:
authorsheepluva
Mon, 31 Jan 2011 08:45:05 +0100
changeset 4892 b0610081ee95
parent 4891 43706c0392e7
child 4893 353781305c07
nicklist actions: * changed order * double-click will trigger the first action * "follow"-action not available in rooms
QTfrontend/chatwidget.cpp
QTfrontend/chatwidget.h
QTfrontend/pages.cpp
--- 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)
--- a/QTfrontend/chatwidget.h	Sun Jan 30 19:02:32 2011 -0500
+++ b/QTfrontend/chatwidget.h	Mon Jan 31 08:45:05 2011 +0100
@@ -58,6 +58,7 @@
   void loadLists(const QString & nick);
   void saveLists(const QString & nick);
   void setShowReady(bool s);
+  void setShowFollow(bool enabled);
 
 private:
   void loadList(QStringList & list, const QString & file);
--- a/QTfrontend/pages.cpp	Sun Jan 30 19:02:32 2011 -0500
+++ b/QTfrontend/pages.cpp	Mon Jan 31 08:45:05 2011 +0100
@@ -984,6 +984,7 @@
     // chatwidget
     pChatWidget = new HWChatWidget(this, gameSettings, sdli, true);
     pChatWidget->setShowReady(true); // show status bulbs by default
+    pChatWidget->setShowFollow(false); // don't show follow in nicks' context menus
     pageLayout->addWidget(pChatWidget, 2, 0, 1, 2);
     pageLayout->setRowStretch(1, 100);