mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-08 22:32:34 -04:00
Added share button for copy retroshare message link
This commit is contained in:
parent
7cf17569c5
commit
4f3920a33a
6 changed files with 46 additions and 2 deletions
|
@ -19,6 +19,7 @@
|
|||
*******************************************************************************/
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QMenu>
|
||||
#include <QStyle>
|
||||
|
||||
#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<RetroShareLink> urls;
|
||||
urls.push_back(link);
|
||||
RSLinkClipboard::copyLinks(urls);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue