File: openurltest.cpp

package info (click to toggle)
kguiaddons 5.103.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 868 kB
  • sloc: cpp: 4,913; xml: 358; sh: 13; makefile: 11
file content (23 lines) | stat: -rw-r--r-- 703 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*  This file is part of the KDE libraries
    SPDX-FileCopyrightText: 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com>

    SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/

#include <QDebug>
#include <QDesktopServices>
#include <QGuiApplication>
#include <QUrl>

int main(int argc, char **argv)
{
    QGuiApplication app(argc, argv);
    if (app.arguments().count() <= 1 || app.arguments().last() == QLatin1String("--help")) {
        qDebug() << "please use ./openurltest <url>";
        return 0;
    }
    QDesktopServices::openUrl(QUrl(app.arguments().last()));

    QMetaObject::invokeMethod(&app, "quit", Qt::QueuedConnection);
    return app.exec();
}