mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #993 from PhenomRetroShare/Fix_OpenMessageForAllFile
Add "No to All" for RSLink Open message.
This commit is contained in:
commit
106f03d42b
@ -1141,6 +1141,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;
|
||||||
@ -1306,20 +1307,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user