Add "No to All" for RSLink Open message.

This commit is contained in:
Phenom 2017-08-12 15:10:07 +02:00
parent 03d675157f
commit 041447b2d7

View File

@ -1142,6 +1142,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
int countUnknown = 0; int countUnknown = 0;
int countFileOpened = 0; int countFileOpened = 0;
bool needNotifySuccess = false; bool needNotifySuccess = false;
bool dontOpenNextFile = false;
// file // file
QStringList fileAdded; QStringList fileAdded;
@ -1307,20 +1308,23 @@ static void processList(const QStringList &list, const QString &textSingular, co
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists() && qinfo.isFile()) { if (qinfo.exists() && qinfo.isFile() && !dontOpenNextFile) {
QString question = "<html><body>"; QString question = "<html><body>";
question += QObject::tr("Warning: Retroshare is about to ask your system to open this file. "); question += QObject::tr("Warning: Retroshare is about to ask your system to open this file. ");
question += QObject::tr("Before you do so, please make sure that this file does not contain malicious executable code."); question += QObject::tr("Before you do so, please make sure that this file does not contain malicious executable code.");
question += "<br><br>" + cleanname + "</body></html>"; question += "<br><br>" + cleanname + "</body></html>";
QMessageBox mb(QObject::tr("Confirmation"), question, QMessageBox::Warning, QMessageBox::Yes,QMessageBox::No, 0); QMessageBox mb(QObject::tr("Confirmation"), question, QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No, links.size()>1 ? QMessageBox::NoToAll : 0, 0);
if (mb.exec() == QMessageBox::Yes) { int ret = mb.exec();
if(ret == QMessageBox::Yes) {
++countFileOpened; ++countFileOpened;
bFileOpened = true; bFileOpened = true;
/* open file with a suitable application */ /* open file with a suitable application */
if (!RsUrlHandler::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()))) { if (!RsUrlHandler::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()))) {
std::cerr << "RetroShareLink::process(): can't open file " << path << std::endl; std::cerr << "RetroShareLink::process(): can't open file " << path << std::endl;
} }
} else if (ret == QMessageBox::NoToAll) {
dontOpenNextFile = true;
} }
} }
} }