added copy-rs-link to SubFileItem (Patch from Phenom)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6887 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-11-02 14:56:22 +00:00
parent e0863194a3
commit f3750d0d61
3 changed files with 50 additions and 7 deletions

View File

@ -29,6 +29,7 @@
#include <gui/common/RsUrlHandler.h>
#include <retroshare/rsfiles.h>
#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<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);
}
}

View File

@ -76,7 +76,8 @@ public:
public slots:
void download();
void play();
void mediatype();
void mediatype();
void copyLink();
private slots:
void toggle();

View File

@ -159,6 +159,32 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="copyLinkButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Copy RetroShare Link</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/copyrslink.png</normaloff>:/images/copyrslink.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="saveButton">
<property name="sizePolicy">