mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-21 04:18:23 -04:00
fixed a few compilation errors in RsCollection handling
This commit is contained in:
parent
258fe58547
commit
206da93d99
6 changed files with 181 additions and 121 deletions
|
@ -597,32 +597,35 @@ void SearchDialog::collOpen()
|
||||||
|
|
||||||
if (rsFiles->FileDetails(hash, RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL
|
if (rsFiles->FileDetails(hash, RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL
|
||||||
| RS_FILE_HINTS_BROWSABLE | RS_FILE_HINTS_NETWORK_WIDE
|
| RS_FILE_HINTS_BROWSABLE | RS_FILE_HINTS_NETWORK_WIDE
|
||||||
| RS_FILE_HINTS_SPEC_ONLY, info)) {
|
| RS_FILE_HINTS_SPEC_ONLY, info))
|
||||||
|
{
|
||||||
/* make path for downloaded files */
|
/* make path for downloaded files */
|
||||||
std::string path;
|
std::string path;
|
||||||
path = info.path;
|
path = info.path;
|
||||||
|
|
||||||
/* open file with a suitable application */
|
/* open file with a suitable application */
|
||||||
QFileInfo qinfo;
|
QFileInfo qinfo;
|
||||||
|
RsCollection::RsCollectionErrorCode err;
|
||||||
qinfo.setFile(QString::fromUtf8(path.c_str()));
|
qinfo.setFile(QString::fromUtf8(path.c_str()));
|
||||||
if (qinfo.exists()) {
|
if (qinfo.exists() && qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString))
|
||||||
if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
|
RsCollection(qinfo.absoluteFilePath(),err).downloadFiles();
|
||||||
RsCollection collection;
|
|
||||||
if (collection.load(qinfo.absoluteFilePath())) {
|
|
||||||
collection.downloadFiles();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RsCollection collection;
|
QString fileName;
|
||||||
if (collection.load(this)) {
|
if (!misc::getOpenFileName(nullptr, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Open collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollection::ExtensionString + ")", fileName))
|
||||||
collection.downloadFiles();
|
return ;
|
||||||
}//if (collection.load(this))
|
|
||||||
|
std::cerr << "Got file name: " << fileName.toStdString() << std::endl;
|
||||||
|
|
||||||
|
RsCollection::RsCollectionErrorCode err;
|
||||||
|
RsCollection collection(fileName, err);
|
||||||
|
|
||||||
|
if(err == RsCollection::RsCollectionErrorCode::NO_ERROR)
|
||||||
|
collection.downloadFiles();
|
||||||
|
else
|
||||||
|
QMessageBox::information(nullptr,tr("Error open RsCollection file"),RsCollection::errorString(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchDialog::downloadDirectory(const QTreeWidgetItem *item, const QString &base)
|
void SearchDialog::downloadDirectory(const QTreeWidgetItem *item, const QString &base)
|
||||||
|
|
|
@ -652,7 +652,7 @@ void SharedFilesDialog::copyLinks(const QModelIndexList& lst, bool remote,QList<
|
||||||
|
|
||||||
QString dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName();
|
QString dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName();
|
||||||
|
|
||||||
RetroShareLink link = RetroShareLink::createFileTree(dir_name,ft->mTotalSize,ft->mTotalFiles,QString::fromStdString(ft->toRadix64())) ;
|
RetroShareLink link = RetroShareLink::createFileTree(dir_name,ft->totalFileSize(),ft->numFiles(),QString::fromStdString(ft->toRadix64())) ;
|
||||||
|
|
||||||
if(link.valid())
|
if(link.valid())
|
||||||
urls.push_back(link) ;
|
urls.push_back(link) ;
|
||||||
|
@ -821,8 +821,12 @@ void SharedFilesDialog::collOpen()
|
||||||
qinfo.setFile(QString::fromUtf8(path.c_str()));
|
qinfo.setFile(QString::fromUtf8(path.c_str()));
|
||||||
if (qinfo.exists()) {
|
if (qinfo.exists()) {
|
||||||
if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
|
if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
|
||||||
RsCollection collection;
|
|
||||||
if (collection.load(qinfo.absoluteFilePath())) {
|
RsCollection::RsCollectionErrorCode err;
|
||||||
|
RsCollection collection(qinfo.absoluteFilePath(),err);
|
||||||
|
|
||||||
|
if(err == RsCollection::RsCollectionErrorCode::NO_ERROR)
|
||||||
|
{
|
||||||
collection.downloadFiles();
|
collection.downloadFiles();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -831,10 +835,17 @@ void SharedFilesDialog::collOpen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RsCollection collection;
|
QString fileName;
|
||||||
if (collection.load(this)) {
|
if (!misc::getOpenFileName(nullptr, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Open collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollection::ExtensionString + ")", fileName))
|
||||||
|
return ;
|
||||||
|
|
||||||
|
std::cerr << "Got file name: " << fileName.toStdString() << std::endl;
|
||||||
|
|
||||||
|
RsCollection::RsCollectionErrorCode err;
|
||||||
|
RsCollection collection(fileName,err);
|
||||||
|
|
||||||
|
if(err == RsCollection::RsCollectionErrorCode::NO_ERROR)
|
||||||
collection.downloadFiles();
|
collection.downloadFiles();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalSharedFilesDialog::playselectedfiles()
|
void LocalSharedFilesDialog::playselectedfiles()
|
||||||
|
|
|
@ -2564,23 +2564,29 @@ void TransfersDialog::collOpen()
|
||||||
/* open file with a suitable application */
|
/* open file with a suitable application */
|
||||||
QFileInfo qinfo;
|
QFileInfo qinfo;
|
||||||
qinfo.setFile(QString::fromUtf8(path.c_str()));
|
qinfo.setFile(QString::fromUtf8(path.c_str()));
|
||||||
if (qinfo.exists()) {
|
if (qinfo.exists() && qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString))
|
||||||
if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
|
{
|
||||||
RsCollection collection;
|
RsCollection::RsCollectionErrorCode code;
|
||||||
if (collection.load(qinfo.absoluteFilePath())) {
|
RsCollection(qinfo.absoluteFilePath(),code).downloadFiles();
|
||||||
collection.downloadFiles();
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RsCollection collection;
|
QString fileName;
|
||||||
if (collection.load(this)) {
|
if (!misc::getOpenFileName(nullptr, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Open collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollection::ExtensionString + ")", fileName))
|
||||||
|
return ;
|
||||||
|
|
||||||
|
std::cerr << "Got file name: " << fileName.toStdString() << std::endl;
|
||||||
|
|
||||||
|
RsCollection::RsCollectionErrorCode code;
|
||||||
|
RsCollection collection(fileName,code);
|
||||||
|
|
||||||
|
if(code == RsCollection::RsCollectionErrorCode::NO_ERROR)
|
||||||
collection.downloadFiles();
|
collection.downloadFiles();
|
||||||
}
|
else
|
||||||
|
QMessageBox::information(nullptr,tr("Error openning collection file"),RsCollection::errorString(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransfersDialog::collAutoOpen(const QString &fileHash)
|
void TransfersDialog::collAutoOpen(const QString &fileHash)
|
||||||
|
@ -2592,21 +2598,18 @@ void TransfersDialog::collAutoOpen(const QString &fileHash)
|
||||||
if (rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, info)) {
|
if (rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, info)) {
|
||||||
|
|
||||||
/* make path for downloaded files */
|
/* make path for downloaded files */
|
||||||
if (info.downloadStatus == FT_STATE_COMPLETE) {
|
if (info.downloadStatus == FT_STATE_COMPLETE)
|
||||||
|
{
|
||||||
std::string path;
|
std::string path;
|
||||||
path = info.path + "/" + info.fname;
|
path = info.path + "/" + info.fname;
|
||||||
|
|
||||||
/* open file with a suitable application */
|
/* open file with a suitable application */
|
||||||
QFileInfo qinfo;
|
QFileInfo qinfo;
|
||||||
qinfo.setFile(QString::fromUtf8(path.c_str()));
|
qinfo.setFile(QString::fromUtf8(path.c_str()));
|
||||||
if (qinfo.exists()) {
|
RsCollection::RsCollectionErrorCode err;
|
||||||
if (qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString)) {
|
|
||||||
RsCollection collection;
|
if (qinfo.exists() && qinfo.absoluteFilePath().endsWith(RsCollection::ExtensionString))
|
||||||
if (collection.load(qinfo.absoluteFilePath(), false)) {
|
RsCollection(qinfo.absoluteFilePath(),err).autoDownloadFiles();
|
||||||
collection.autoDownloadFiles();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1143,11 +1143,13 @@ QString RetroShareLink::toHtmlSize() const
|
||||||
|
|
||||||
if (type() == TYPE_FILE && RsCollection::isCollectionFile(name())) {
|
if (type() == TYPE_FILE && RsCollection::isCollectionFile(name())) {
|
||||||
FileInfo finfo;
|
FileInfo finfo;
|
||||||
if (rsFiles->FileDetails(RsFileHash(hash().toStdString()), RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL, finfo)) {
|
if (rsFiles->FileDetails(RsFileHash(hash().toStdString()), RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL, finfo))
|
||||||
RsCollection collection;
|
{
|
||||||
if (collection.load(QString::fromUtf8(finfo.path.c_str()), false)) {
|
RsCollection::RsCollectionErrorCode code;
|
||||||
|
RsCollection collection(QString::fromUtf8(finfo.path.c_str()), code) ;
|
||||||
|
|
||||||
|
if(code == RsCollection::RsCollectionErrorCode::NO_ERROR)
|
||||||
size += QString(" [%1]").arg(misc::friendlyUnit(collection.size()));
|
size += QString(" [%1]").arg(misc::friendlyUnit(collection.size()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString link = QString("<a href=\"%1\">%2</a> <font color=\"blue\">%3</font>").arg(toString()).arg(name()).arg(size);
|
QString link = QString("<a href=\"%1\">%2</a> <font color=\"blue\">%3</font>").arg(toString()).arg(name()).arg(size);
|
||||||
|
|
|
@ -330,97 +330,128 @@ static void showErrorBox(const QString& fileName, const QString& error)
|
||||||
mb.exec();
|
mb.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsCollection::load(const QString& fileName, bool showError /* = true*/)
|
QString RsCollection::errorString(RsCollectionErrorCode code)
|
||||||
{
|
{
|
||||||
|
switch(code)
|
||||||
|
{
|
||||||
|
default: [[fallthrough]] ;
|
||||||
|
case RsCollectionErrorCode::UNKNOWN_ERROR: return tr("Unknown error");
|
||||||
|
case RsCollectionErrorCode::NO_ERROR: return tr("No error");
|
||||||
|
case RsCollectionErrorCode::FILE_READ_ERROR: return tr("Error while openning file");
|
||||||
|
case RsCollectionErrorCode::FILE_CONTAINS_HARMFUL_STRINGS: return tr("Collection file contains potentially harmful code");
|
||||||
|
case RsCollectionErrorCode::INVALID_ROOT_NODE: return tr("Invalid root node. RsCollection node was expected.");
|
||||||
|
case RsCollectionErrorCode::XML_PARSING_ERROR: return tr("XML parsing error in collection file");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!checkFile(fileName,showError)) return false;
|
RsCollection::RsCollection(const QString& fileName, RsCollectionErrorCode& error)
|
||||||
QFile file(fileName);
|
{
|
||||||
|
if (!checkFile(fileName,error))
|
||||||
|
return ;
|
||||||
|
|
||||||
if (!file.open(QIODevice::ReadOnly))
|
QFile file(fileName);
|
||||||
{
|
|
||||||
std::cerr << "Cannot open file " << fileName.toStdString() << " !!" << std::endl;
|
if (!file.open(QIODevice::ReadOnly))
|
||||||
if (showError) {
|
{
|
||||||
showErrorBox(fileName, QApplication::translate("RsCollectionFile", "Cannot open file %1").arg(fileName));
|
std::cerr << "Cannot open file " << fileName.toStdString() << " !!" << std::endl;
|
||||||
}
|
error = RsCollectionErrorCode::FILE_READ_ERROR;
|
||||||
return false;
|
//showErrorBox(fileName, QApplication::translate("RsCollectionFile", "Cannot open file %1").arg(fileName));
|
||||||
}
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
QDomDocument xml_doc;
|
QDomDocument xml_doc;
|
||||||
bool ok = xml_doc.setContent(&file) ;
|
bool ok = xml_doc.setContent(&file) ;
|
||||||
file.close();
|
|
||||||
|
|
||||||
|
if(!ok)
|
||||||
|
{
|
||||||
|
error = RsCollectionErrorCode::XML_PARSING_ERROR;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
QDomNode root = xml_doc.elementsByTagName("RsCollection").at(0).toElement();
|
||||||
|
|
||||||
return ok;
|
if(root.isNull())
|
||||||
|
{
|
||||||
|
error = RsCollectionErrorCode::INVALID_ROOT_NODE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
recursParseXml(xml_doc,root,0);
|
||||||
|
error = RsCollectionErrorCode::NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check that the file is a valid rscollection file, and not a lol bomb or some shit like this
|
// check that the file is a valid rscollection file, and not a lol bomb or some shit like this
|
||||||
bool RsCollection::checkFile(const QString& fileName, bool showError)
|
|
||||||
|
bool RsCollection::checkFile(const QString& fileName, RsCollectionErrorCode& error)
|
||||||
{
|
{
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
|
error = RsCollectionErrorCode::NO_ERROR;
|
||||||
|
|
||||||
if (!file.open(QIODevice::ReadOnly))
|
if (!file.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
std::cerr << "Cannot open file " << fileName.toStdString() << " !!" << std::endl;
|
std::cerr << "Cannot open file " << fileName.toStdString() << " !!" << std::endl;
|
||||||
if (showError) {
|
error = RsCollectionErrorCode::FILE_READ_ERROR;
|
||||||
showErrorBox(fileName, QApplication::translate("RsCollectionFile", "Cannot open file %1").arg(fileName));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (file.reset()){
|
|
||||||
std::cerr << "Checking this file for bomb elements and various wrong stuff" << std::endl;
|
|
||||||
char c ;
|
|
||||||
|
|
||||||
std::vector<std::string> bad_strings ;
|
//showErrorBox(fileName, QApplication::translate("RsCollectionFile", "Cannot open file %1").arg(fileName));
|
||||||
bad_strings.push_back(std::string("<!entity ")) ;
|
return false;
|
||||||
static const int max_size = 12 ; // should be as large as the largest element in bad_strings
|
}
|
||||||
char current[max_size] = { 0,0,0,0,0,0,0,0,0,0,0,0 } ;
|
if (file.reset()){
|
||||||
int n=0 ;
|
std::cerr << "Checking this file for bomb elements and various wrong stuff" << std::endl;
|
||||||
|
char c ;
|
||||||
|
|
||||||
while( !file.atEnd() || n >= 0)
|
std::vector<std::string> bad_strings ;
|
||||||
{
|
bad_strings.push_back(std::string("<!entity ")) ;
|
||||||
if (!file.atEnd())
|
static const int max_size = 12 ; // should be as large as the largest element in bad_strings
|
||||||
file.getChar(&c);
|
char current[max_size] = { 0,0,0,0,0,0,0,0,0,0,0,0 } ;
|
||||||
else
|
int n=0 ;
|
||||||
c=0;
|
|
||||||
|
|
||||||
if(c == '\t' || c == '\n' || c == '\b' || c == '\r')
|
while( !file.atEnd() || n >= 0)
|
||||||
continue ;
|
{
|
||||||
|
if (!file.atEnd())
|
||||||
|
file.getChar(&c);
|
||||||
|
else
|
||||||
|
c=0;
|
||||||
|
|
||||||
if (n == max_size || file.atEnd())
|
if(c == '\t' || c == '\n' || c == '\b' || c == '\r')
|
||||||
for(int i=0;i<n-1;++i)
|
continue ;
|
||||||
current[i] = current[i+1] ;
|
|
||||||
|
|
||||||
if(n == max_size)
|
if (n == max_size || file.atEnd())
|
||||||
--n ;
|
for(int i=0;i<n-1;++i)
|
||||||
|
current[i] = current[i+1] ;
|
||||||
|
|
||||||
if(c >= 'A' && c <= 'Z') c += 'a' - 'A' ;
|
if(n == max_size)
|
||||||
|
--n ;
|
||||||
|
|
||||||
if(!file.atEnd())
|
if(c >= 'A' && c <= 'Z') c += 'a' - 'A' ;
|
||||||
current[n] = c ;
|
|
||||||
else
|
|
||||||
current[n] = 0 ;
|
|
||||||
|
|
||||||
//std::cerr << "n==" << n <<" Checking string " << std::string(current,n+1) << " c = " << std::hex << (int)c << std::dec << std::endl;
|
if(!file.atEnd())
|
||||||
|
current[n] = c ;
|
||||||
|
else
|
||||||
|
current[n] = 0 ;
|
||||||
|
|
||||||
for(uint i=0;i<bad_strings.size();++i)
|
//std::cerr << "n==" << n <<" Checking string " << std::string(current,n+1) << " c = " << std::hex << (int)c << std::dec << std::endl;
|
||||||
if(std::string(current,bad_strings[i].length()) == bad_strings[i])
|
|
||||||
{
|
|
||||||
showErrorBox(file.fileName(), QApplication::translate("RsCollectionFile", "This file contains the string \"%1\" and is therefore an invalid collection file. \n\nIf you believe it is correct, remove the corresponding line from the file and re-open it with Retroshare.").arg(bad_strings[i].c_str()));
|
|
||||||
file.close();
|
|
||||||
return false ;
|
|
||||||
//std::cerr << "Bad string detected" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(file.atEnd())
|
for(uint i=0;i<bad_strings.size();++i)
|
||||||
n-- ;
|
if(std::string(current,bad_strings[i].length()) == bad_strings[i])
|
||||||
else if(n < max_size)
|
{
|
||||||
++n ;
|
//showErrorBox(file.fileName(), QApplication::translate("RsCollectionFile", "This file contains the string \"%1\" and is therefore an invalid collection file. \n\nIf you believe it is correct, remove the corresponding line from the file and re-open it with Retroshare.").arg(bad_strings[i].c_str()));
|
||||||
}
|
error = RsCollectionErrorCode::FILE_CONTAINS_HARMFUL_STRINGS;
|
||||||
file.close();
|
file.close();
|
||||||
return true;
|
return false ;
|
||||||
}
|
//std::cerr << "Bad string detected" << std::endl;
|
||||||
return false;
|
}
|
||||||
|
|
||||||
|
if(file.atEnd())
|
||||||
|
n-- ;
|
||||||
|
else if(n < max_size)
|
||||||
|
++n ;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
error = RsCollectionErrorCode::UNKNOWN_ERROR;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TO_REMOVE
|
#ifdef TO_REMOVE
|
||||||
|
@ -467,7 +498,7 @@ bool RsCollection::save(const QString& fileName) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsCollection::recursParseXml(QDomDocument& doc,const QDomElement& e,const RsFileTree::DirIndex parent)
|
bool RsCollection::recursParseXml(QDomDocument& doc,const QDomNode& e,const RsFileTree::DirIndex parent)
|
||||||
{
|
{
|
||||||
QDomNode n = e.firstChild() ;
|
QDomNode n = e.firstChild() ;
|
||||||
#ifdef COLLECTION_DEBUG
|
#ifdef COLLECTION_DEBUG
|
||||||
|
|
|
@ -58,12 +58,24 @@ class RsCollection : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum class RsCollectionErrorCode:uint8_t {
|
||||||
|
NO_ERROR = 0x00,
|
||||||
|
UNKNOWN_ERROR = 0x01,
|
||||||
|
FILE_READ_ERROR = 0x02,
|
||||||
|
FILE_CONTAINS_HARMFUL_STRINGS = 0x03,
|
||||||
|
INVALID_ROOT_NODE = 0x04,
|
||||||
|
XML_PARSING_ERROR = 0x05,
|
||||||
|
};
|
||||||
|
|
||||||
RsCollection(QObject *parent = 0) ;
|
RsCollection(QObject *parent = 0) ;
|
||||||
// create from list of files and directories
|
// create from list of files and directories
|
||||||
RsCollection(const std::vector<DirDetails>& file_entries, FileSearchFlags flags, QObject *parent = 0) ;
|
RsCollection(const std::vector<DirDetails>& file_entries, FileSearchFlags flags, QObject *parent = 0) ;
|
||||||
RsCollection(const RsFileTree& ft);
|
RsCollection(const RsFileTree& ft);
|
||||||
virtual ~RsCollection() ;
|
RsCollection(const QString& filename,RsCollectionErrorCode& error_code);
|
||||||
|
|
||||||
|
static QString errorString(RsCollectionErrorCode code);
|
||||||
|
|
||||||
|
virtual ~RsCollection() ;
|
||||||
|
|
||||||
void merge_in(const QString& fname,uint64_t size,const RsFileHash& hash) ;
|
void merge_in(const QString& fname,uint64_t size,const RsFileHash& hash) ;
|
||||||
void merge_in(const RsFileTree& tree) ;
|
void merge_in(const RsFileTree& tree) ;
|
||||||
|
@ -74,9 +86,6 @@ public:
|
||||||
bool load(QWidget *parent);
|
bool load(QWidget *parent);
|
||||||
bool save(QWidget *parent) const ;
|
bool save(QWidget *parent) const ;
|
||||||
#endif
|
#endif
|
||||||
// Loads file from disk.
|
|
||||||
bool load(const QString& fileName, bool showError = true);
|
|
||||||
|
|
||||||
// Save to disk
|
// Save to disk
|
||||||
bool save(const QString& fileName) const ;
|
bool save(const QString& fileName) const ;
|
||||||
|
|
||||||
|
@ -100,7 +109,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool recursExportToXml(QDomDocument& doc,QDomElement& e,const RsFileTree::DirData& dd) const;
|
bool recursExportToXml(QDomDocument& doc,QDomElement& e,const RsFileTree::DirData& dd) const;
|
||||||
bool recursParseXml(QDomDocument& doc,const QDomElement& e,RsFileTree::DirIndex dd) ;
|
bool recursParseXml(QDomDocument& doc, const QDomNode &e, RsFileTree::DirIndex dd) ;
|
||||||
|
|
||||||
// This function is used to populate a RsCollection from locally or remotly shared files.
|
// This function is used to populate a RsCollection from locally or remotly shared files.
|
||||||
void recursAddElements(RsFileTree::DirIndex parent, const DirDetails& dd, FileSearchFlags flags) ;
|
void recursAddElements(RsFileTree::DirIndex parent, const DirDetails& dd, FileSearchFlags flags) ;
|
||||||
|
@ -118,7 +127,8 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check that the file is a valid rscollection file, and not a lol bomb or some shit like this
|
// check that the file is a valid rscollection file, and not a lol bomb or some shit like this
|
||||||
static bool checkFile(const QString &fileName, bool showError);
|
static bool checkFile(const QString &fileName, RsCollectionErrorCode &error);
|
||||||
|
|
||||||
// Auto Download recursively.
|
// Auto Download recursively.
|
||||||
void autoDownloadFiles(ColFileInfo colFileInfo, QString dlDir) const ;
|
void autoDownloadFiles(ColFileInfo colFileInfo, QString dlDir) const ;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue