File indexing completed on 2024-05-12 17:00:08

0001 /*
0002     SPDX-FileCopyrightText: 2014-2016 Sebastian Kügler <sebas@kde.org>
0003     SPDX-FileCopyrightText: 2022 David Redondo <kde@david-redondo.de>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #include "../../common/osdaction.h"
0009 #include "osdservice_interface.h"
0010 
0011 #include <QCoreApplication>
0012 #include <QDBusConnection>
0013 
0014 int main(int argc, char **argv)
0015 {
0016     QCoreApplication app(argc, argv);
0017 
0018     const QString name = QStringLiteral("org.kde.kscreen.osdService");
0019     const QString path = QStringLiteral("/org/kde/kscreen/osdService");
0020     auto osdService = new OrgKdeKscreenOsdServiceInterface(name, path, QDBusConnection::sessionBus());
0021 
0022     QDBusReply<int> reply = osdService->showActionSelector();
0023 
0024     if (!reply.isValid()) {
0025         qDebug() << "Error calling osdService:";
0026         qDebug() << reply.error();
0027         return 1;
0028     }
0029 
0030     auto actionEnum = QMetaEnum::fromType<KScreen::OsdAction::Action>();
0031     const char *value = actionEnum.valueToKey(reply.value());
0032     if (!value) {
0033         qDebug() << "Got invalid action" << reply.value();
0034         return 1;
0035     }
0036     qDebug() << "Selected Action" << value;
0037     return 0;
0038 }