/* FIXME this is getting the wrong entry, like if I click on 0th, it takes * the 1st off */ void FriendsListDialog::slot_showPopupFriends(const QPoint & iPoint) { popup_item = friendsView->indexAt(iPoint); if (popup_item != QModelIndex()) { popup_playerlisting = friendsListModel->playerListingFromIndex(popup_item); if(popup_playerlisting->name == connection->getUsername()) return; QMenu menu(friendsView); menu.addAction(tr("Match"), this, SLOT(slot_popupMatch())); menu.addAction(tr("Talk"), this, SLOT(slot_popupTalk())); menu.addSeparator(); menu.addAction(tr("Remove from Friends"), this, SLOT(slot_removeFriend())); menu.addAction(tr("Add to Watches"), this, SLOT(slot_addWatch())); menu.addAction(tr("Block"), this, SLOT(slot_addBlock())); menu.exec(friendsView->mapToGlobal(iPoint)); } }
void Room::slot_showPopup(const QPoint & iPoint) { popup_item = playerView->indexAt(iPoint); if (popup_item != QModelIndex()) { /* If we have the listing now, we don't need to look it up * again later FIXME */ QModelIndex translated = popup_item; popup_playerlisting = playerListModel->playerListingFromIndex(translated); if(popup_playerlisting->name == connection->getUsername()) return; QMenu menu(playerView); menu.addAction(tr("Stats"), this, SLOT(slot_popupStats())); QAction * matchAct = new QAction(tr("Match"), 0); if(popup_playerlisting->info.contains("X")) matchAct->setEnabled(false); else connect(matchAct, SIGNAL(triggered()), this, SLOT(slot_popupMatch())); menu.addAction(matchAct); menu.addAction(tr("Talk"), this, SLOT(slot_popupTalk())); menu.addSeparator(); if(popup_playerlisting->friendWatchType == PlayerListing::friended) menu.addAction(tr("Remove from Friends"), this, SLOT(slot_removeFriend())); else menu.addAction(tr("Add to Friends"), this, SLOT(slot_addFriend())); if(popup_playerlisting->friendWatchType == PlayerListing::watched) menu.addAction(tr("Remove from Watches"), this, SLOT(slot_removeWatch())); else menu.addAction(tr("Add to Watches"), this, SLOT(slot_addWatch())); menu.addAction(tr("Block"), this, SLOT(slot_addBlock())); menu.exec(playerView->mapToGlobal(iPoint)); delete matchAct; } }