QTfrontend/chatwidget.cpp
changeset 4892 b0610081ee95
parent 4884 b2006a9f0fbc
child 4897 11598e7aa7e6
equal deleted inserted replaced
4891:43706c0392e7 4892:b0610081ee95
   160     connect(acIgnore, SIGNAL(triggered(bool)), this, SLOT(onIgnore()));
   160     connect(acIgnore, SIGNAL(triggered(bool)), this, SLOT(onIgnore()));
   161     acFriend = new QAction(QAction::tr("Add friend"), chatNicks);
   161     acFriend = new QAction(QAction::tr("Add friend"), chatNicks);
   162     acFriend->setIcon(QIcon(":/res/addfriend.png"));
   162     acFriend->setIcon(QIcon(":/res/addfriend.png"));
   163     connect(acFriend, SIGNAL(triggered(bool)), this, SLOT(onFriend()));
   163     connect(acFriend, SIGNAL(triggered(bool)), this, SLOT(onFriend()));
   164 
   164 
       
   165     chatNicks->insertAction(0, acFriend);
   165     chatNicks->insertAction(0, acInfo);
   166     chatNicks->insertAction(0, acInfo);
   166     chatNicks->insertAction(0, acFollow);
       
   167     chatNicks->insertAction(0, acIgnore);
   167     chatNicks->insertAction(0, acIgnore);
   168     chatNicks->insertAction(0, acFriend);
       
   169 
   168 
   170     showReady = false;
   169     showReady = false;
       
   170     setShowFollow(true);
       
   171 }
       
   172 
       
   173 void HWChatWidget::setShowFollow(bool enabled)
       
   174 {
       
   175     if (enabled) {
       
   176         if (!(chatNicks->actions().contains(acFollow)))
       
   177             chatNicks->insertAction(acFriend, acFollow);
       
   178     }
       
   179     else {
       
   180         if (chatNicks->actions().contains(acFollow))
       
   181             chatNicks->removeAction(acFollow);
       
   182     }
   171 }
   183 }
   172 
   184 
   173 void HWChatWidget::loadList(QStringList & list, const QString & file)
   185 void HWChatWidget::loadList(QStringList & list, const QString & file)
   174 {
   186 {
   175     list.clear();
   187     list.clear();
   418     chatNickSelected(0); // update context menu
   430     chatNickSelected(0); // update context menu
   419 }
   431 }
   420 
   432 
   421 void HWChatWidget::chatNickDoubleClicked(QListWidgetItem * item)
   433 void HWChatWidget::chatNickDoubleClicked(QListWidgetItem * item)
   422 {
   434 {
   423     if (item) onFollow();
   435     QList<QAction *> actions = chatNicks->actions();
       
   436     actions.first()->activate(QAction::Trigger);
   424 }
   437 }
   425 
   438 
   426 void HWChatWidget::chatNickSelected(int index)
   439 void HWChatWidget::chatNickSelected(int index)
   427 {
   440 {
   428     Q_UNUSED(index);
   441     Q_UNUSED(index);