| 5 | #include <QMessageBox> |
| 6 | |
| 7 | bool DesktopServices::openUrl(const QString &url, QWidget* parent) |
| 8 | { |
| 9 | // QDesktopServices::openUrl broken on some KDE systems with Qt 5.15 |
| 10 | if(system(QString("xdg-open %1").arg(url).toStdString().c_str()) > 0) |
| 11 | { |
| 12 | Log::warning("xdg-open failed. Trying gio instead."); |
| 13 | if(system(QString("gio open %1").arg(url).toStdString().c_str()) > 0) |
| 14 | { |
| 15 | Log::warning("gio failed. Trying kde-open5 instead."); |
| 16 | if(system(QString("kde-open5 %1").arg(url).toStdString().c_str()) > 0) |
| 17 | { |
| 18 | if(parent != nullptr) |
| 19 | { |
| 20 | QMessageBox::critical(parent, QObject::tr("Something went wrong"), |
| 21 | QObject::tr("Failed to open URL with default browser.\n Please copy this URL manually: ") + url); |
| 22 | } |
| 23 | return false; |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | return true; |
| 29 | } |