1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
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 <QTextBrowser>
#include <QTimer>
#include <QTreeWidget>
+#include <QClipboard>
#include <algorithm>
#include <time.h>
@@ -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);
|