diff --git a/retroshare-gui/src/gui/ChatLobbyWidget.cpp b/retroshare-gui/src/gui/ChatLobbyWidget.cpp index 1ec3d39f0..37c630e1e 100644 --- a/retroshare-gui/src/gui/ChatLobbyWidget.cpp +++ b/retroshare-gui/src/gui/ChatLobbyWidget.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -325,6 +326,9 @@ void ChatLobbyWidget::lobbyTreeWidgetCustomPopupMenu(QPoint) contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Add Auto Subscribe"), this, SLOT(autoSubscribeItem())); contextMnu.addAction(QIcon(IMAGE_COPYRSLINK), tr("Copy RetroShare Link"), this, SLOT(copyItemLink())); + + if(!item->text(COLUMN_NAME).isEmpty()) + contextMnu.addAction(QIcon(IMAGE_COPYRSLINK), tr("Copy name to clipboard"), this, SLOT(copyLobbyNameToClipboard())); } contextMnu.addSeparator();//------------------------------------------------------------------- @@ -898,9 +902,8 @@ void ChatLobbyWidget::autoSubscribeItem() void ChatLobbyWidget::copyItemLink() { QTreeWidgetItem *item = ui.lobbyTreeWidget->currentItem(); - if (item == NULL || item->type() != TYPE_LOBBY) { + if (item == NULL) //this is always lobby, do not need to check twice return; - } ChatLobbyId id = item->data(COLUMN_DATA, ROLE_ID).toULongLong(); QString name = item->text(COLUMN_NAME); @@ -913,6 +916,18 @@ void ChatLobbyWidget::copyItemLink() } } + +void ChatLobbyWidget::copyLobbyNameToClipboard() +{ + QTreeWidgetItem *item = ui.lobbyTreeWidget->currentItem(); + if (item == NULL) + return; + + QClipboard *clipboard = QGuiApplication::clipboard(); + clipboard->setText(item->text(COLUMN_NAME)); +} + + QTreeWidgetItem *ChatLobbyWidget::getTreeWidgetItem(ChatLobbyId id) { for(int p=0;p<4;++p) diff --git a/retroshare-gui/src/gui/ChatLobbyWidget.h b/retroshare-gui/src/gui/ChatLobbyWidget.h index cc3c26af3..86dadb7f0 100644 --- a/retroshare-gui/src/gui/ChatLobbyWidget.h +++ b/retroshare-gui/src/gui/ChatLobbyWidget.h @@ -79,6 +79,7 @@ protected slots: void updatePeerLeaving(ChatLobbyId); void autoSubscribeItem(); void copyItemLink(); + void copyLobbyNameToClipboard(); private slots: void filterColumnChanged(int);