mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-15 01:17:16 -05:00
Added share button for copy retroshare message link
This commit is contained in:
parent
7cf17569c5
commit
4f3920a33a
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -499,6 +499,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="shareButton">
|
||||
<property name="text">
|
||||
<string>Share</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/share.png</normaloff>:/images/share.png</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -17,5 +17,6 @@
|
||||
<file>images/up-arrow.png</file>
|
||||
<file>images/comments.png</file>
|
||||
<file>images/thumb-default.png</file>
|
||||
<file>images/share.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
retroshare-gui/src/gui/Posted/images/share.png
Normal file
BIN
retroshare-gui/src/gui/Posted/images/share.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
@ -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;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user