mirror of
https://git.wownero.com/wowlet/wowlet.git
synced 2024-08-15 01:03:14 +00:00
Merge pull request 'External link warning: add copy link button' (#298) from tobtoht/feather:link_warning_copy into master
Reviewed-on: https://git.wownero.com/feather/feather/pulls/298
This commit is contained in:
commit
a736f5f5c6
1 changed files with 17 additions and 8 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QtWidgets/QStyle>
|
#include <QtWidgets/QStyle>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "utils/config.h"
|
#include "utils/config.h"
|
||||||
|
@ -212,17 +213,25 @@ void Utils::externalLinkWarning(QWidget *parent, const QString &url){
|
||||||
}
|
}
|
||||||
|
|
||||||
QString body = "You are about to open the following link:\n\n";
|
QString body = "You are about to open the following link:\n\n";
|
||||||
body += QString("%1\n\n").arg(url);
|
body += QString("%1").arg(url);
|
||||||
|
|
||||||
if (!(TailsOS::detect() || WhonixOS::detect()))
|
if (!(TailsOS::detect() || WhonixOS::detect()))
|
||||||
body += "You will NOT be using Tor.";
|
body += "\n\nYou will NOT be using Tor.";
|
||||||
|
|
||||||
switch (QMessageBox::warning(parent, "External link warning", body, QMessageBox::Cancel|QMessageBox::Ok)) {
|
|
||||||
case QMessageBox::Cancel:
|
QMessageBox linkWarning;
|
||||||
break;
|
linkWarning.setWindowTitle("External link warning");
|
||||||
default:
|
linkWarning.setText(body);
|
||||||
QDesktopServices::openUrl(QUrl(url));
|
QPushButton *copy = linkWarning.addButton("Copy link", QMessageBox::HelpRole);
|
||||||
break;
|
linkWarning.addButton(QMessageBox::Cancel);
|
||||||
|
linkWarning.addButton(QMessageBox::Ok);
|
||||||
|
|
||||||
|
linkWarning.exec();
|
||||||
|
|
||||||
|
if (linkWarning.clickedButton() == copy) {
|
||||||
|
Utils::copyToClipboard(url);
|
||||||
|
} else if (linkWarning.result() == QMessageBox::Ok) {
|
||||||
|
QDesktopServices::openUrl(QUrl(url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue