summaryrefslogtreecommitdiff
path: root/net-p2p/retroshare/files/copy_lobby_name_to_clipboard.patch
diff options
context:
space:
mode:
Diffstat (limited to 'net-p2p/retroshare/files/copy_lobby_name_to_clipboard.patch')
-rw-r--r--net-p2p/retroshare/files/copy_lobby_name_to_clipboard.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/net-p2p/retroshare/files/copy_lobby_name_to_clipboard.patch b/net-p2p/retroshare/files/copy_lobby_name_to_clipboard.patch
new file mode 100644
index 0000000..a1efe6b
--- /dev/null
+++ b/net-p2p/retroshare/files/copy_lobby_name_to_clipboard.patch
@@ -0,0 +1,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);