chatlobby id menu - add open people tab for id

This commit is contained in:
unknown 2017-01-09 18:22:47 +03:00
parent cc3b8bde52
commit c2214c8cfa
2 changed files with 53 additions and 27 deletions

View File

@ -48,6 +48,7 @@
#include "gui/gxs/GxsIdDetails.h"
#include "util/HandleRichText.h"
#include "gui/SoundManager.h"
#include "gui/Identity/IdDialog.h"
#include <retroshare/rsnotify.h>
@ -92,6 +93,7 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
votePositiveAct = new QAction(QIcon(":/icons/png/thumbs-up.png"), tr("Give positive opinion"), this);
distantChatAct = new QAction(QIcon(":/images/chat_24.png"), tr("Start private chat"), this);
sendMessageAct = new QAction(QIcon(":/images/mail_new.png"), tr("Send Message"), this);
showinpeopleAct = new QAction(QIcon(), tr("Show author in people tab"), this);
QActionGroup *sortgrp = new QActionGroup(this);
actionSortByName = new QAction(QIcon(), tr("Sort by Name"), this);
@ -111,6 +113,7 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
connect(votePositiveAct, SIGNAL(triggered()), this, SLOT(voteParticipant(1)));
connect(voteNeutralAct, SIGNAL(triggered()), this, SLOT(voteParticipant(0)));
connect(banAct, SIGNAL(triggered()), this, SLOT(voteParticipant(-1)));
connect(showinpeopleAct, SIGNAL(triggered()), this, SLOT(showInPeopleTab()));
connect(actionSortByName, SIGNAL(triggered()), this, SLOT(sortParcipants()));
connect(actionSortByActivity, SIGNAL(triggered()), this, SLOT(sortParcipants()));
@ -228,6 +231,7 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
contextMnu.addAction(votePositiveAct);
contextMnu.addAction(voteNeutralAct);
contextMnu.addAction(banAct);
contextMnu.addAction(showinpeopleAct);
muteAct->setCheckable(true);
muteAct->setEnabled(false);
@ -235,6 +239,7 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
votePositiveAct->setEnabled(false);
voteNeutralAct->setEnabled(false);
banAct->setEnabled(false);
showinpeopleAct->setEnabled(false);
if (selectedItems.size())
{
@ -247,6 +252,7 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
votePositiveAct->setEnabled(true);
voteNeutralAct->setEnabled(true);
banAct->setEnabled(true);
showinpeopleAct->setEnabled(true);
QList<QTreeWidgetItem*>::iterator item;
for (item = selectedItems.begin(); item != selectedItems.end(); ++item) {
@ -301,6 +307,24 @@ void ChatLobbyDialog::voteParticipant(int vote)
}
}
void ChatLobbyDialog::showInPeopleTab()
{
QList<QTreeWidgetItem*> selectedItems = ui.participantsList->selectedItems();
if (selectedItems.count()!=1)
return;
QList<QTreeWidgetItem*>::iterator item;
RsGxsId nickname;
for (item = selectedItems.begin(); item != selectedItems.end(); ++item)
{
dynamic_cast<GxsIdRSTreeWidgetItem*>(*item)->getId(nickname) ;
}
IdDialog *idDialog = dynamic_cast<IdDialog*>(MainWindow::getPage(MainWindow::People));
if (!idDialog)
return ;
MainWindow::showWindow(MainWindow::People);
idDialog->navigate(nickname);
}
void ChatLobbyDialog::init()
{
ChatLobbyInfo linfo ;

View File

@ -54,6 +54,7 @@ private slots:
void inviteFriends() ;
void leaveLobby() ;
void filterChanged(const QString &text);
void showInPeopleTab();
signals:
void lobbyLeave(ChatLobbyId) ;
@ -116,6 +117,7 @@ private:
QAction *actionSortByActivity;
QWidgetAction *checkableAction;
QAction *sendMessageAct;
QAction *showinpeopleAct;
GxsIdChooser *ownIdChooser ;
};