From 5bc071b03c134dadeb2b9f7e27906d1efac3d5bf Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 24 Feb 2024 20:27:18 +0100 Subject: [PATCH] fixed compilation --- .../src/gui/FileTransfer/SearchDialog.cpp | 18 ++++++------- .../gui/FileTransfer/SharedFilesDialog.cpp | 19 +++++++++++++- retroshare-gui/src/gui/RemoteDirModel.cpp | 25 ------------------- retroshare-gui/src/gui/RemoteDirModel.h | 2 -- retroshare-gui/src/gui/common/RsCollection.h | 3 --- .../src/gui/common/RsCollectionDialog.cpp | 3 ++- 6 files changed, 28 insertions(+), 42 deletions(-) diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp index a2be7bc07..33646816a 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp @@ -497,25 +497,23 @@ void SearchDialog::collCreate() int selectedCount = selectedItems.size() ; QTreeWidgetItem * item ; - for (int i = 0; i < selectedCount; ++i) { + RsFileTree tree; + + for (int i = 0; i < selectedCount; ++i) + { item = selectedItems.at(i) ; - if (!item->text(SR_HASH_COL).isEmpty()) { + if (!item->text(SR_HASH_COL).isEmpty()) + { std::string name = item->text(SR_NAME_COL).toUtf8().constData(); RsFileHash hash( item->text(SR_HASH_COL).toStdString() ); uint64_t count = item->text(SR_SIZE_COL).toULongLong(); - DirDetails details; - details.name = name; - details.hash = hash; - details.size = count; - details.type = DIR_TYPE_FILE; - - dirVec.push_back(details); + tree.addFile(tree.root(),name,hash,count); } } - RsCollection(dirVec,RS_FILE_HINTS_LOCAL).openNewColl(this); + RsCollectionDialog::openNewCollection(tree); } void SearchDialog::collModif() diff --git a/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp index 2cd2437be..7321486fe 100644 --- a/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp @@ -733,8 +733,25 @@ void SharedFilesDialog::sendLinkTo() void SharedFilesDialog::collCreate() { +#ifdef TODO QModelIndexList lst = getSelected(); - model->createCollectionFile(this, lst); + + std::vector dirVec; + model->getDirDetailsFromSelect(lst, dirVec); + + FileSearchFlags f = RemoteMode?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL ; + + QString dir_name; + if(!RemoteMode) + { + if(!dirVec.empty()) + { + const DirDetails& details = dirVec[0]; + dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName(); + } + } + RsCollection(dirVec,f).openNewColl(parent,dir_name); +#endif } void SharedFilesDialog::collModif() diff --git a/retroshare-gui/src/gui/RemoteDirModel.cpp b/retroshare-gui/src/gui/RemoteDirModel.cpp index 05e19857f..87f70c06c 100644 --- a/retroshare-gui/src/gui/RemoteDirModel.cpp +++ b/retroshare-gui/src/gui/RemoteDirModel.cpp @@ -1233,31 +1233,6 @@ bool RetroshareDirModel::requestDirDetails(void *ref, bool remote,DirDetails& d) return false ; } -void RetroshareDirModel::createCollectionFile(QWidget *parent, const QModelIndexList &list) -{ -/* if(RemoteMode) - { - std::cerr << "Cannot create a collection file from remote" << std::endl; - return ; - }*/ - - std::vector dirVec; - getDirDetailsFromSelect(list, dirVec); - - FileSearchFlags f = RemoteMode?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL ; - - QString dir_name; - if(!RemoteMode) - { - if(!dirVec.empty()) - { - const DirDetails& details = dirVec[0]; - dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName(); - } - } - RsCollection(dirVec,f).openNewColl(parent,dir_name); -} - void RetroshareDirModel::downloadSelected(const QModelIndexList &list,bool interactive) { if (!RemoteMode) diff --git a/retroshare-gui/src/gui/RemoteDirModel.h b/retroshare-gui/src/gui/RemoteDirModel.h index 83028dd48..b7811533e 100644 --- a/retroshare-gui/src/gui/RemoteDirModel.h +++ b/retroshare-gui/src/gui/RemoteDirModel.h @@ -68,8 +68,6 @@ class RetroshareDirModel : public QAbstractItemModel /* Callback from GUI */ void downloadSelected(const QModelIndexList &list, bool interactive); - void createCollectionFile(QWidget *parent, const QModelIndexList &list); - void getDirDetailsFromSelect (const QModelIndexList &list, std::vector & dirVec); int getType ( const QModelIndex & index ) const ; diff --git a/retroshare-gui/src/gui/common/RsCollection.h b/retroshare-gui/src/gui/common/RsCollection.h index 32863be80..ecc5aa6fc 100644 --- a/retroshare-gui/src/gui/common/RsCollection.h +++ b/retroshare-gui/src/gui/common/RsCollection.h @@ -101,9 +101,6 @@ public: static bool isCollectionFile(const QString& fileName); -private slots: - void saveColl(std::vector colFileInfos, const QString& fileName); - private: bool recursExportToXml(QDomDocument& doc,QDomElement& e,const RsFileTree::DirData& dd) const; diff --git a/retroshare-gui/src/gui/common/RsCollectionDialog.cpp b/retroshare-gui/src/gui/common/RsCollectionDialog.cpp index 240bae85c..c7a9ef7bb 100644 --- a/retroshare-gui/src/gui/common/RsCollectionDialog.cpp +++ b/retroshare-gui/src/gui/common/RsCollectionDialog.cpp @@ -1411,8 +1411,9 @@ void RsCollectionDialog::save() QTreeWidgetItem* root = getRootItem(); if (root) { saveChild(root); - +#ifdef TODO_COLLECTION emit saveColl(_newColFileInfos, _fileName); +#endif } close(); }