get the share button usable for copy the rs link

This commit is contained in:
defnax 2020-01-14 23:22:01 +01:00
parent ca60e1d094
commit c1efdac7f6
4 changed files with 48 additions and 4 deletions

View File

@ -25,7 +25,10 @@
#include <QMessageBox>
#include "gui/gxs/GxsIdDetails.h"
#include "gui/RetroShareLink.h"
#include <retroshare/rsidentity.h>
#include <retroshare/rsposted.h>
/** Constructor */
PhotoView::PhotoView(QWidget *parent)
@ -36,8 +39,8 @@ PhotoView::PhotoView(QWidget *parent)
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
ui->shareButton->hide();
connect(ui->shareButton, SIGNAL(clicked()), this, SLOT(copyMessageLink()));
}
/** Destructor */
@ -78,3 +81,23 @@ void PhotoView::setTime(const QString& text)
ui->timeLabel->setText(text);
}
void PhotoView::setGroupId(const RsGxsGroupId &groupId)
{
mGroupId = groupId;
}
void PhotoView::setMessageId(const RsGxsMessageId& messageId)
{
mMessageId = messageId ;
}
void PhotoView::copyMessageLink()
{
RetroShareLink link = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_POSTED, mGroupId, mMessageId, ui->titleLabel->text());
if (link.valid()) {
QList<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);
}
}

View File

@ -46,12 +46,15 @@ public slots:
void setTitle (const QString &text);
void setName(const RsGxsId& authorID);
void setTime(const QString& text);
void setGroupId(const RsGxsGroupId &groupId);
void setMessageId(const RsGxsMessageId& messageId);
private slots:
void copyMessageLink();
private:
RsGxsMessageId mMessageId;
RsGxsGroupId mGroupId;
/** Qt Designer generated object */
Ui::PhotoView *ui;

View File

@ -145,6 +145,19 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="agoLabel">
<property name="font">
<font>
<family>MS Sans Serif</family>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>ago</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
@ -160,6 +173,9 @@
</item>
<item>
<widget class="QToolButton" name="shareButton">
<property name="toolTip">
<string>Copy RetroShare link</string>
</property>
<property name="text">
<string>Share</string>
</property>

View File

@ -605,6 +605,8 @@ void PostedItem::viewPicture()
PView->setTitle(messageName());
PView->setName(authorID);
PView->setTime(timestamp);
PView->setGroupId(groupId());
PView->setMessageId(mMessageId);
PView->show();