From 8f107cca31bc64625dff3d70e5258cdef9c7fb87 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 19 May 2018 16:37:29 +0200 Subject: [PATCH] Add Never Ask Me For External Link Activated Need to remove [General] NeverAskMeForExternalLinkActivated key in RetroShare.conf to revert. --- retroshare-gui/src/gui/MainWindow.cpp | 34 +++++++++++++++++---------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 116b9637f..e00417080 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -733,16 +733,16 @@ void MainWindow::updateStatus() if (ratesstatus) ratesstatus->getRatesStatus(downKb, upKb); - if(torstatus) - torstatus->getTorStatus(); + if(torstatus) + torstatus->getTorStatus(); if(!hiddenmode) { - if (natstatus) - natstatus->getNATStatus(); - - if (dhtstatus) - dhtstatus->getDHTStatus(); + if (natstatus) + natstatus->getNATStatus(); + + if (dhtstatus) + dhtstatus->getDHTStatus(); } if (discstatus) { @@ -1434,27 +1434,37 @@ void MainWindow::settingsChanged() void MainWindow::externalLinkActivated(const QUrl &url) { static bool already_warned = false ; + bool never_ask_me = Settings->value("NeverAskMeForExternalLinkActivated",false).toBool(); - if(!already_warned) + if(!already_warned && !never_ask_me) { QMessageBox mb(QObject::tr("Confirmation"), QObject::tr("Do you want this link to be handled by your system?")+"

"+ url.toString()+"

"+tr("Make sure this link has not been forged to drag you to a malicious website."), QMessageBox::Question, QMessageBox::Yes,QMessageBox::No, 0); - QCheckBox *checkbox = new QCheckBox(tr("Don't ask me again")) ; + QCheckBox *dontAsk_CB = new QCheckBox(tr("Don't ask me again")); + QCheckBox *neverAsk_CB = new QCheckBox(tr("Never ask me again")); + dontAsk_CB->setToolTip(tr("This will be saved only for this session.")); + neverAsk_CB->setToolTip(tr("This will be saved permanently. You'll need to clean RetroShare.conf to revert.")); QGridLayout* layout = qobject_cast(mb.layout()); if (layout) { - layout->addWidget(checkbox,layout->rowCount(),0,1, layout->columnCount(), Qt::AlignLeft); + layout->addWidget(dontAsk_CB,layout->rowCount(),0,1, layout->columnCount(), Qt::AlignLeft); + layout->addWidget(neverAsk_CB,layout->rowCount(),0,1, layout->columnCount(), Qt::AlignLeft); } else { //Not QGridLayout so add at end - mb.layout()->addWidget(checkbox) ; + mb.layout()->addWidget(dontAsk_CB); + mb.layout()->addWidget(neverAsk_CB); } int res = mb.exec() ; if (res == QMessageBox::No) return ; - else if(checkbox->isChecked()) + + if(dontAsk_CB->isChecked()) already_warned = true ; + + if(neverAsk_CB->isChecked()) + Settings->setValue("NeverAskMeForExternalLinkActivated",true); } QDesktopServices::openUrl(url) ;