Added the hability to create and handle collection files. A collection file contains a directory structure

and files that RS can DL seamlessly in the DL directory. Collection files are created from shared files
and can be handled by righ-clicking on them in Transfers and Shared files. Handling is based on the extension,
that must be "rscollection".


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4664 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-11-07 23:07:25 +00:00
parent ded1707151
commit 50d5c1159d
10 changed files with 385 additions and 8 deletions

View file

@ -21,12 +21,14 @@
#include <QFileInfo>
#include <QDir>
#include <QDesktopServices>
#include <QUrl>
#include <QMimeData>
#include <QTimer>
#include <QFileDialog>
#include <gui/RsAutoUpdatePage.h>
#include <gui/common/RsCollectionFile.h>
#include <gui/common/RsUrlHandler.h>
#include "RemoteDirModel.h"
#include <retroshare/rsfiles.h>
#include <retroshare/rstypes.h>
@ -904,6 +906,26 @@ bool RetroshareDirModel::requestDirDetails(void *ref,DirDetails& details,uint32_
return rsFiles->RequestDirDetails(ref, details, flags) ;
}
void RetroshareDirModel::createCollectionFile(const QModelIndexList &list)
{
if(RemoteMode)
{
std::cerr << "Cannot create a collection file from remote" << std::endl;
return ;
}
QString filename = QFileDialog::getSaveFileName(NULL,tr("Create selection file"),".",tr("Collection files")+" (*.rsCollection)") ;
if(filename.isNull())
return ;
std::cerr << "Got file name: "<< filename.toStdString() << std::endl;
std::vector <DirDetails> dirVec;
getDirDetailsFromSelect(list, dirVec);
RsCollectionFile(dirVec).save(filename) ;
}
void RetroshareDirModel::downloadSelected(const QModelIndexList &list)
{
if (!RemoteMode)
@ -911,6 +933,7 @@ void RetroshareDirModel::downloadSelected(const QModelIndexList &list)
#ifdef RDM_DEBUG
std::cerr << "Cannot download from local" << std::endl;
#endif
return ;
}
/* so for all the selected .... get the name out,
@ -1119,7 +1142,7 @@ void RetroshareDirModel::openSelected(const QModelIndexList &qmil)
std::cerr << "Opening this file: " << dest.toStdString() << std::endl ;
QDesktopServices::openUrl(QUrl::fromLocalFile(dest));
RsUrlHandler::openUrl(QUrl::fromLocalFile(dest));
}
#ifdef RDM_DEBUG