diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp index 3b92883e8..0138e16f4 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "ChatLobbyDialog.h" @@ -98,6 +99,7 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi distantChatAct = new QAction(FilesDefs::getIconFromQtResourcePath(":/icons/png/chats.png"), tr("Start private chat"), this); sendMessageAct = new QAction(FilesDefs::getIconFromQtResourcePath(":/icons/mail/write-mail.png"), tr("Send Message"), this); showInPeopleAct = new QAction(QIcon(), tr("Show author in people tab"), this); + copyIdAct = new QAction(QIcon(), tr("Copy ID to clipboard"), this); QActionGroup *sortgrp = new QActionGroup(this); actionSortByName = new QAction(QIcon(), tr("Sort by Name"), this); @@ -118,6 +120,7 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi connect(voteNeutralAct, SIGNAL(triggered()), this, SLOT(voteParticipant())); connect(voteNegativeAct, SIGNAL(triggered()), this, SLOT(voteParticipant())); connect(showInPeopleAct, SIGNAL(triggered()), this, SLOT(showInPeopleTab())); + connect(copyIdAct, SIGNAL(triggered()), this, SLOT(copyId())); connect(actionSortByName, SIGNAL(triggered()), this, SLOT(sortParcipants())); connect(actionSortByActivity, SIGNAL(triggered()), this, SLOT(sortParcipants())); @@ -290,6 +293,7 @@ void ChatLobbyDialog::initParticipantsContextMenu(QMenu *contextMnu, QListaddAction(voteNeutralAct); contextMnu->addAction(voteNegativeAct); contextMnu->addAction(showInPeopleAct); + contextMnu->addAction(copyIdAct); distantChatAct->setEnabled(false); sendMessageAct->setEnabled(false); @@ -300,6 +304,7 @@ void ChatLobbyDialog::initParticipantsContextMenu(QMenu *contextMnu, QListsetEnabled(false); voteNegativeAct->setEnabled(false); showInPeopleAct->setEnabled(idList.count() == 1); + copyIdAct->setEnabled(idList.count() == 1); distantChatAct->setData(QVariant::fromValue(idList)); sendMessageAct->setData(QVariant::fromValue(idList)); @@ -311,6 +316,9 @@ void ChatLobbyDialog::initParticipantsContextMenu(QMenu *contextMnu, QListsetData(QString::fromStdString(gxsid.toStdString())); + if(!gxsid.isNull() && !rsIdentity->isOwnId(gxsid)) { distantChatAct->setEnabled(true); @@ -379,6 +387,13 @@ void ChatLobbyDialog::showInPeopleTab() idDialog->navigate(nickname); } +void ChatLobbyDialog::copyId() +{ + QAction* the_action = qobject_cast(sender()); + if (the_action) + QApplication::clipboard()->setText(the_action->data().toString()) ; +} + void ChatLobbyDialog::init(const ChatId &/*id*/, const QString &/*title*/) { ChatLobbyInfo linfo ; diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h index 429a5bfb4..2f3ca0340 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h @@ -62,6 +62,7 @@ private slots: void inviteFriends() ; void filterChanged(const QString &text); void showInPeopleTab(); + void copyId(); void toggleWindowed(){setWindowed(!isWindowed());} void setWindowed(bool windowed); @@ -131,6 +132,7 @@ private: QWidgetAction *checkableAction; QAction *sendMessageAct; QAction *showInPeopleAct; + QAction *copyIdAct; GxsIdChooser *ownIdChooser ; //icons cache