From d4e5a2ea8387489471428ea6272c1d0f0f292dbf Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 14 Dec 2020 22:10:55 +0100 Subject: [PATCH] added warnign when channel post shares files from extra list --- .../gui/gxschannels/CreateGxsChannelMsg.cpp | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp index d5c13b384..44cc87c8c 100644 --- a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp +++ b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp @@ -730,6 +730,7 @@ void CreateGxsChannelMsg::sendMsg() std::list files; std::list missing_files; + std::list files_only_extra; for(auto fit :mAttachments) if (!fit->isHidden()) @@ -745,7 +746,14 @@ void CreateGxsChannelMsg::sendMsg() if (!fit->done() && fit->ready()) // Skips unhashed files. missing_files.push_back(fi); - } + + FileInfo finfo; + bool extra = rsFiles->FileDetails(fi.mHash, RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_SPEC_ONLY, finfo ); + bool local = rsFiles->FileDetails(fi.mHash, RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_SPEC_ONLY, finfo ); + + if(extra && !local) + files_only_extra.push_back(fi); + } if(!missing_files.empty()) { @@ -758,6 +766,18 @@ void CreateGxsChannelMsg::sendMsg() tr("This post contains files that you are currently not sharing. Do you still want to post?")+filesstr,QMessageBox::Ok,QMessageBox::Cancel)) return; } + if(!files_only_extra.empty()) + { + QString filesstr = "
"; + + for(auto& file: files_only_extra) + filesstr += "
" /*+QString::fromStdString(file.mHash.toStdString()) + " "*/ + QString::fromStdString(file.mName) ; + + QMessageBox::information(nullptr, + tr("Post refers to temporary shared files"), + tr("The following files will only shared until you restart Retroshare. Think about adding them to a shared directory.") + +filesstr); + } sendMessage(subject, msg, files); }