File indexing completed on 2024-04-21 15:03:15

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 1999 Waldo Bastian <bastian@kde.org>
0004     SPDX-FileCopyrightText: 2009 David Faure <faure@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-only
0007 */
0008 
0009 #include <QCoreApplication>
0010 #include <QDebug>
0011 #include <ktoolinvocation.h>
0012 
0013 int main(int argc, char *argv[])
0014 {
0015     QCoreApplication a(argc, argv);
0016 
0017     QString serviceId = QStringLiteral("kwrite.desktop");
0018     if (argc > 1) {
0019         serviceId = QString::fromLocal8Bit(argv[1]);
0020     }
0021     QString url;
0022     if (argc > 2) {
0023         url = QString::fromLocal8Bit(argv[2]);
0024     }
0025 
0026     QString error;
0027     QString dbusService;
0028     int pid;
0029     KToolInvocation::startServiceByDesktopPath(serviceId, url, &error, &dbusService, &pid);
0030     qDebug() << "Started. error=" << error << " dbusService=" << dbusService << " pid=" << pid;
0031 
0032     return 0;
0033 }