diff --git a/retroshare-gui/src/gui/feeds/SubFileItem.cpp b/retroshare-gui/src/gui/feeds/SubFileItem.cpp index 8480d395f..47389ac6d 100644 --- a/retroshare-gui/src/gui/feeds/SubFileItem.cpp +++ b/retroshare-gui/src/gui/feeds/SubFileItem.cpp @@ -29,6 +29,7 @@ #include #include #include "util/misc.h" +#include "gui/RetroShareLink.h" /**** @@ -98,6 +99,7 @@ void SubFileItem::Setup() connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) ); connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) ); connect( cancelButton, SIGNAL( clicked( void ) ), this, SLOT( cancel ( void ) ) ); + connect( copyLinkButton, SIGNAL( clicked( void ) ), this, SLOT( copyLink ( void ) ) ); connect( saveButton, SIGNAL( clicked( void ) ), this, SLOT( save ( void ) ) ); /* once off check - if remote, check if we have it @@ -686,9 +688,23 @@ bool SubFileItem::isPlayable(bool &startable) return visible; } -void SubFileItem::mediatype() -{ - /* check if the file is not a media file and change text */ - playButton->setText(tr("Open")); - playButton->setToolTip(tr("Open File")); -} +void SubFileItem::mediatype() +{ + /* check if the file is not a media file and change text */ + playButton->setText(tr("Open")); + playButton->setToolTip(tr("Open File")); +} + +void SubFileItem::copyLink() +{ + if (mFileName.empty() || mFileHash.empty()) { + return; + } + + RetroShareLink link; + if (link.createFile(QString::fromUtf8(mFileName.c_str()), mFileSize, QString::fromStdString(mFileHash))) { + QList urls; + urls.push_back(link); + RSLinkClipboard::copyLinks(urls); + } +} diff --git a/retroshare-gui/src/gui/feeds/SubFileItem.h b/retroshare-gui/src/gui/feeds/SubFileItem.h index a92e2a219..c15d731ca 100644 --- a/retroshare-gui/src/gui/feeds/SubFileItem.h +++ b/retroshare-gui/src/gui/feeds/SubFileItem.h @@ -76,7 +76,8 @@ public: public slots: void download(); void play(); - void mediatype(); + void mediatype(); + void copyLink(); private slots: void toggle(); diff --git a/retroshare-gui/src/gui/feeds/SubFileItem.ui b/retroshare-gui/src/gui/feeds/SubFileItem.ui index 005ee3332..e05b122b1 100644 --- a/retroshare-gui/src/gui/feeds/SubFileItem.ui +++ b/retroshare-gui/src/gui/feeds/SubFileItem.ui @@ -159,6 +159,32 @@ + + + + + 0 + 0 + + + + + 24 + 16777215 + + + + Qt::NoFocus + + + Copy RetroShare Link + + + + :/images/copyrslink.png:/images/copyrslink.png + + +