MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / openUrl

Method openUrl

src/utils/DesktopServices.cpp:7–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <QMessageBox>
6
7bool 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}

Callers

nothing calls this directly

Calls 1

QStringClass · 0.50

Tested by

no test coverage detected