diff --git a/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp index f071c3a66..b5d82ad4f 100644 --- a/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp @@ -517,7 +517,7 @@ void RemoteSharedFilesDialog::spawnCustomPopupMenu( QPoint point ) contextMnu.addAction( copylinkAct) ; contextMnu.addAction( sendlinkAct) ; contextMnu.addSeparator() ;//------------------------------------ - contextMnu.addAction(QIcon(IMAGE_MSG), tr("Recommend in a message to"), this, SLOT(recommendFilesToMsg())) ; + contextMnu.addAction(QIcon(IMAGE_MSG), tr("Recommend in a message to..."), this, SLOT(recommendFilesToMsg())) ; } contextMnu.addSeparator() ;//------------------------------------ @@ -578,7 +578,9 @@ void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote) std::cerr << "Created collection file tree:" << std::endl; ft->print(); - RetroShareLink link = RetroShareLink::createCollection(QString::fromUtf8(details.name.c_str()),ft->mTotalSize,ft->mTotalFiles,QString::fromStdString(ft->toRadix64())) ; + QString dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName(); + + RetroShareLink link = RetroShareLink::createCollection(dir_name,ft->mTotalSize,ft->mTotalFiles,QString::fromStdString(ft->toRadix64())) ; if(link.valid()) urls.push_back(link) ; @@ -1027,12 +1029,12 @@ void LocalSharedFilesDialog::spawnCustomPopupMenu( QPoint point ) contextMnu.addSeparator() ;//------------------------------------ contextMnu.addMenu(&collectionMenu) ; contextMnu.addSeparator() ;//------------------------------------ - contextMnu.addAction(QIcon(IMAGE_MSG), tr("Recommend in a message to"), this, SLOT(recommendFilesToMsg())) ; + contextMnu.addAction(QIcon(IMAGE_MSG), tr("Recommend in a message to..."), this, SLOT(recommendFilesToMsg())) ; break ; default : return ; - }//switch (type) + } contextMnu.exec(QCursor::pos()) ; } diff --git a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp index d2194ebec..ca4cf5cfa 100644 --- a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp @@ -652,7 +652,8 @@ void TransfersDialog::downloadListCustomPopupMenu( QPoint /*point*/ ) QMenu contextMnu( this ); - if(!RSLinkClipboard::empty(RetroShareLink::TYPE_FILE)) add_PasteLink=true; + if(!RSLinkClipboard::empty(RetroShareLink::TYPE_FILE)) add_PasteLink=true; + if(!RSLinkClipboard::empty(RetroShareLink::TYPE_FILE_TREE)) add_PasteLink=true; if(!items.empty()) { @@ -1640,6 +1641,7 @@ void TransfersDialog::updateDetailsDialog() void TransfersDialog::pasteLink() { RSLinkClipboard::process(RetroShareLink::TYPE_FILE); + RSLinkClipboard::process(RetroShareLink::TYPE_FILE_TREE); } void TransfersDialog::getDLSelectedItems(std::set *ids, std::set *rows) diff --git a/retroshare-gui/src/gui/RetroShareLink.cpp b/retroshare-gui/src/gui/RetroShareLink.cpp index 7a1e32aae..769a6321f 100644 --- a/retroshare-gui/src/gui/RetroShareLink.cpp +++ b/retroshare-gui/src/gui/RetroShareLink.cpp @@ -336,7 +336,7 @@ void RetroShareLink::fromUrl(const QUrl& url) if (url.host() == HOST_COLLECTION) { bool ok; - _type = TYPE_COLLECTION; + _type = TYPE_FILE_TREE; _radix = decodedQueryItemValue(urlQuery, COLLECTION_DATA); _name = decodedQueryItemValue(urlQuery, COLLECTION_NAME); _size = urlQuery.queryItemValue(COLLECTION_SIZE).toULongLong(&ok); @@ -429,7 +429,7 @@ RetroShareLink RetroShareLink::createCollection(const QString& name, uint64_t si link._count = count; link._size = size; link._radix = radix_data ; - link._type = TYPE_COLLECTION; + link._type = TYPE_FILE_TREE; link.check(); @@ -643,7 +643,7 @@ void RetroShareLink::check() if(!checkSSLId(_SSLid)) _valid = false; // no break! We also test file stuff below. /* fallthrough */ - case TYPE_COLLECTION: + case TYPE_FILE_TREE: case TYPE_FILE: if(_size > (((uint64_t)1)<<40)) // 1TB. Who has such large files? @@ -754,7 +754,7 @@ QString RetroShareLink::title() const rsPeers->getGPGDetails(RsPgpId(_GPGid.toStdString()), detail) ; return QObject::tr("Click to send a private message to %1 (%2).").arg(QString::fromUtf8(detail.name.c_str())).arg(_GPGid) ; } - case TYPE_COLLECTION: + case TYPE_FILE_TREE: return QObject::tr("Click to browse/download this file collection"); case TYPE_EXTRAFILE: return QObject::tr("%1 (%2, Extra - Source included)").arg(hash()).arg(misc::friendlyUnit(size())); @@ -899,7 +899,7 @@ QString RetroShareLink::toString() const break; - case TYPE_COLLECTION: + case TYPE_FILE_TREE: url.setScheme(RSLINK_SCHEME); url.setHost(HOST_COLLECTION) ; urlQuery.addQueryItem(COLLECTION_NAME, encodeItem(_name)); @@ -930,13 +930,13 @@ QString RetroShareLink::niceName() const if (type() == TYPE_PERSON) return PeerDefs::rsid(name().toUtf8().constData(), RsPgpId(hash().toStdString())); - if(type() == TYPE_COLLECTION) + if(type() == TYPE_FILE_TREE) return QObject::tr("%1 (%2 files, %3)").arg(_name).arg(_count).arg(misc::friendlyUnit(_size)); if(type() == TYPE_IDENTITY) return QObject::tr("Identity link (name=%1, ID=%2)").arg(_name).arg(_hash) ; - if(type() == TYPE_COLLECTION) + if(type() == TYPE_FILE_TREE) return QObject::tr("File directory (Total %s) Click to browse/download this file collection").arg(misc::friendlyUnit(_size)); if(type() == TYPE_PUBLIC_MSG) { @@ -1149,7 +1149,7 @@ static void processList(const QStringList &list, const QString &textSingular, co case TYPE_SEARCH: case TYPE_MESSAGE: case TYPE_IDENTITY: - case TYPE_COLLECTION: + case TYPE_FILE_TREE: case TYPE_CERTIFICATE: case TYPE_PUBLIC_MSG: case TYPE_PRIVATE_CHAT: @@ -1391,7 +1391,7 @@ static void processList(const QStringList &list, const QString &textSingular, co } break; - case TYPE_COLLECTION: + case TYPE_FILE_TREE: { FileTree *ft = FileTree::create(link.radix().toStdString()) ; diff --git a/retroshare-gui/src/gui/RetroShareLink.h b/retroshare-gui/src/gui/RetroShareLink.h index 2576b880c..11b25b419 100644 --- a/retroshare-gui/src/gui/RetroShareLink.h +++ b/retroshare-gui/src/gui/RetroShareLink.h @@ -70,7 +70,7 @@ class RetroShareLink TYPE_PUBLIC_MSG = 0x0a, TYPE_POSTED = 0x0b, TYPE_IDENTITY = 0x0c, - TYPE_COLLECTION = 0x0d + TYPE_FILE_TREE = 0x0d }; public: diff --git a/retroshare-gui/src/util/HandleRichText.cpp b/retroshare-gui/src/util/HandleRichText.cpp index 91f3e13ab..743a2fcc1 100644 --- a/retroshare-gui/src/util/HandleRichText.cpp +++ b/retroshare-gui/src/util/HandleRichText.cpp @@ -227,7 +227,7 @@ bool RsHtml::canReplaceAnchor(QDomDocument &/*doc*/, QDomElement &/*element*/, c switch (link.type()) { case RetroShareLink::TYPE_UNKNOWN: case RetroShareLink::TYPE_FILE: - case RetroShareLink::TYPE_COLLECTION: + case RetroShareLink::TYPE_FILE_TREE: case RetroShareLink::TYPE_PERSON: case RetroShareLink::TYPE_FORUM: case RetroShareLink::TYPE_CHANNEL: @@ -258,7 +258,7 @@ void RsHtml::anchorStylesheetForImg(QDomDocument &/*doc*/, QDomElement &/*elemen switch (link.type()) { case RetroShareLink::TYPE_UNKNOWN: case RetroShareLink::TYPE_FILE: - case RetroShareLink::TYPE_COLLECTION: + case RetroShareLink::TYPE_FILE_TREE: case RetroShareLink::TYPE_PERSON: case RetroShareLink::TYPE_FORUM: case RetroShareLink::TYPE_CHANNEL: