diff --git a/retroshare-gui/src/gui/Posted/PostedItem.cpp b/retroshare-gui/src/gui/Posted/PostedItem.cpp index 79db72b32..f1fe30cfa 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.cpp +++ b/retroshare-gui/src/gui/Posted/PostedItem.cpp @@ -19,6 +19,7 @@ *******************************************************************************/ #include +#include #include #include "rshare.h" @@ -48,6 +49,9 @@ PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsPostedGr GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsPosted, autoUpdate) { setup(); + + mMessageId = post.mMeta.mMsgId; + setGroup(group, false); setPost(post); @@ -100,6 +104,13 @@ void PostedItem::setup() connect(ui->expandButton, SIGNAL(clicked()), this, SLOT( toggle())); connect(ui->readButton, SIGNAL(toggled(bool)), this, SLOT(readToggled(bool))); + + QAction *CopyLinkAction = new QAction(QIcon(""),tr("Copy RetroShare Link"), this); + connect(CopyLinkAction, SIGNAL(triggered()), this, SLOT(copyMessageLink())); + + QMenu *menu = new QMenu(); + menu->addAction(CopyLinkAction); + ui->shareButton->setMenu(menu); ui->clearButton->hide(); ui->readAndClearButton->hide(); @@ -502,3 +513,18 @@ void PostedItem::doExpand(bool open) emit sizeChanged(this); } + +void PostedItem::copyMessageLink() +{ + if (groupId().isNull() || mMessageId.isNull()) { + return; + } + + RetroShareLink link = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_POSTED, groupId(), mMessageId, messageName()); + + if (link.valid()) { + QList urls; + urls.push_back(link); + RSLinkClipboard::copyLinks(urls); + } +} diff --git a/retroshare-gui/src/gui/Posted/PostedItem.h b/retroshare-gui/src/gui/Posted/PostedItem.h index 7329e3a2e..1ef11de3c 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.h +++ b/retroshare-gui/src/gui/Posted/PostedItem.h @@ -30,6 +30,7 @@ namespace Ui { class PostedItem; } +class FeedHolder; class RsPostedPost; class PostedItem : public GxsFeedItem @@ -59,6 +60,7 @@ private slots: void readToggled(bool checked); void readAndClearItem(); void toggle(); + void copyMessageLink(); signals: void vote(const RsGxsGrpMsgIdPair& msgId, bool up); @@ -84,6 +86,7 @@ private: RsPostedGroup mGroup; RsPostedPost mPost; + RsGxsMessageId mMessageId; /** Qt Designer generated object */ Ui::PostedItem *ui; diff --git a/retroshare-gui/src/gui/Posted/PostedItem.ui b/retroshare-gui/src/gui/Posted/PostedItem.ui index aa19e37f5..389f659c8 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.ui +++ b/retroshare-gui/src/gui/Posted/PostedItem.ui @@ -499,6 +499,20 @@ + + + + Share + + + + :/images/share.png:/images/share.png + + + true + + + diff --git a/retroshare-gui/src/gui/Posted/Posted_images.qrc b/retroshare-gui/src/gui/Posted/Posted_images.qrc index ae7cf9e3b..0ea4455cf 100644 --- a/retroshare-gui/src/gui/Posted/Posted_images.qrc +++ b/retroshare-gui/src/gui/Posted/Posted_images.qrc @@ -17,5 +17,6 @@ images/up-arrow.png images/comments.png images/thumb-default.png + images/share.png diff --git a/retroshare-gui/src/gui/Posted/images/share.png b/retroshare-gui/src/gui/Posted/images/share.png new file mode 100644 index 000000000..2a8d87e26 Binary files /dev/null and b/retroshare-gui/src/gui/Posted/images/share.png differ diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss index e7f489980..6efecbf5c 100644 --- a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss +++ b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss @@ -905,9 +905,9 @@ PostedItem QLabel#fromBoldLabel, QLabel#fromLabel, QLabel#dateLabel, QLabel#site color: #787c7e; } -PostedItem QToolButton#commentButton{ +PostedItem QToolButton#commentButton, QPushButton#shareButton{ font-size: 12px; color: #878a8c; - font-weight: bold; + font-weight: bold; }