mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05:00
Added sources to RS link download (now works for copy links from browsable only files). Removed unused optional list of sources from RetroShareLink::process()
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3539 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
55a45dacd3
commit
b0f0e4c380
@ -1741,7 +1741,7 @@ void ForumsDialog::anchorClicked (const QUrl& link )
|
||||
std::cerr << "ForumsDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl;
|
||||
#endif
|
||||
|
||||
RetroShareLink::processUrl(link, NULL, RSLINK_PROCESS_NOTIFY_ALL);
|
||||
RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL);
|
||||
}
|
||||
|
||||
void ForumsDialog::filterRegExpChanged()
|
||||
|
@ -1863,7 +1863,7 @@ void MessagesDialog::anchorClicked (const QUrl& link )
|
||||
{
|
||||
std::cerr << "MessagesDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl;
|
||||
|
||||
RetroShareLink::processUrl(link, NULL, RSLINK_PROCESS_NOTIFY_ALL);
|
||||
RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL);
|
||||
}
|
||||
|
||||
bool MessagesDialog::fileSave()
|
||||
|
@ -1829,7 +1829,7 @@ void PeersDialog::anchorClicked (const QUrl& link )
|
||||
std::cerr << "PeersDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl;
|
||||
#endif
|
||||
|
||||
RetroShareLink::processUrl(link, NULL, RSLINK_PROCESS_NOTIFY_ALL);
|
||||
RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL);
|
||||
}
|
||||
|
||||
void PeersDialog::dropEvent(QDropEvent *event)
|
||||
|
@ -239,7 +239,7 @@ bool RetroShareLink::checkHash(const QString& hash)
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool RetroShareLink::process(std::list<std::string> *psrcIds, int flag)
|
||||
bool RetroShareLink::process(int flag)
|
||||
{
|
||||
if (valid() == false) {
|
||||
std::cerr << " RetroShareLink::process invalid request" << std::endl;
|
||||
@ -254,12 +254,18 @@ bool RetroShareLink::process(std::list<std::string> *psrcIds, int flag)
|
||||
{
|
||||
std::cerr << " RetroShareLink::process FileRequest : fileName : " << name().toUtf8().constData() << ". fileHash : " << hash().toStdString() << ". fileSize : " << size() << std::endl;
|
||||
|
||||
std::list<std::string> srcIds;
|
||||
if (psrcIds) {
|
||||
srcIds = *psrcIds;
|
||||
}
|
||||
// Get a list of available direct sources, in case the file is browsable only.
|
||||
std::list<std::string> srcIds;
|
||||
FileInfo finfo ;
|
||||
rsFiles->FileDetails(hash().toStdString(), RS_FILE_HINTS_REMOTE,finfo) ;
|
||||
|
||||
if (rsFiles->FileRequest(name().toUtf8().constData(), hash().toStdString(), size(), "", RS_FILE_HINTS_NETWORK_WIDE, srcIds)) {
|
||||
for(std::list<TransferInfo>::const_iterator it(finfo.peers.begin());it!=finfo.peers.end();++it)
|
||||
{
|
||||
std::cerr << " adding peerid " << (*it).peerId << std::endl ;
|
||||
srcIds.push_back((*it).peerId) ;
|
||||
}
|
||||
|
||||
if (rsFiles->FileRequest(name().toUtf8().constData(), hash().toStdString(), size(), "", RS_FILE_HINTS_NETWORK_WIDE, srcIds)) {
|
||||
if (flag & RSLINK_PROCESS_NOTIFY_SUCCESS) {
|
||||
QMessageBox mb(QObject::tr("File Request Confirmation"), QObject::tr("The file has been added to your download list."),QMessageBox::Information,QMessageBox::Ok,0,0);
|
||||
mb.setButtonText( QMessageBox::Ok, "OK" );
|
||||
@ -340,7 +346,7 @@ bool RetroShareLink::process(std::list<std::string> *psrcIds, int flag)
|
||||
return false;
|
||||
}
|
||||
|
||||
/*static*/ bool RetroShareLink::processUrl(const QUrl &url, std::list<std::string> *psrcIds, int flag)
|
||||
/*static*/ bool RetroShareLink::processUrl(const QUrl &url, int flag)
|
||||
{
|
||||
if (url.scheme() == "http") {
|
||||
QDesktopServices::openUrl(url);
|
||||
@ -359,7 +365,7 @@ bool RetroShareLink::process(std::list<std::string> *psrcIds, int flag)
|
||||
// RetroShareLink link(url);
|
||||
//
|
||||
// if (link.valid()) {
|
||||
// return link.process(psrcId, flag);
|
||||
// return link.process(flag);
|
||||
// }
|
||||
//
|
||||
// if (flag & RSLINK_PROCESS_NOTIFY_ERROR) {
|
||||
@ -502,7 +508,7 @@ bool RSLinkClipboard::empty(RetroShareLink::enumType type /*= RetroShareLink::TY
|
||||
|
||||
for (uint32_t i = 0; i < links.size(); i++) {
|
||||
if (links[i].valid() && (type == RetroShareLink::TYPE_UNKNOWN || links[i].type() == type)) {
|
||||
if (links[i].process(NULL, flag)) {
|
||||
if (links[i].process(flag)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@ -81,8 +81,8 @@ class RetroShareLink
|
||||
|
||||
bool operator==(const RetroShareLink& l) const { return _type == l._type && _hash == l._hash ; }
|
||||
|
||||
bool process(std::list<std::string> *psrcIds, int flag);
|
||||
static bool processUrl(const QUrl &url, std::list<std::string> *psrcIds, int flag);
|
||||
bool process(int flag);
|
||||
static bool processUrl(const QUrl &url, int flag);
|
||||
|
||||
private:
|
||||
void fromString(const QString &url);
|
||||
|
@ -994,8 +994,7 @@ void PopupChatDialog::anchorClicked (const QUrl& link )
|
||||
#endif
|
||||
|
||||
std::list<std::string> srcIds;
|
||||
srcIds.push_back(dialogId);
|
||||
RetroShareLink::processUrl(link, &srcIds, RSLINK_PROCESS_NOTIFY_ALL);
|
||||
RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL);
|
||||
}
|
||||
|
||||
void PopupChatDialog::dropEvent(QDropEvent *event)
|
||||
|
Loading…
Reference in New Issue
Block a user