Advance Wayland and KDE package bring-up

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-14 10:51:06 +01:00
parent 51f3c21121
commit cf12defd28
15214 changed files with 20594243 additions and 269 deletions
@@ -0,0 +1,31 @@
include(ECMMarkAsTest)
find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Test)
macro(kservice_executable_tests)
foreach(_testname ${ARGN})
add_executable(${_testname} ${_testname}.cpp)
target_link_libraries(${_testname} KF6::Service)
ecm_mark_as_test(${_testname})
endforeach(_testname)
endmacro()
kservice_executable_tests(
kservicegroup_dumper
findservice
)
add_executable(kmimeassociations_dumper)
ecm_mark_as_test(kmimeassociations_dumper)
ecm_qt_declare_logging_category(kmimeassociations_dumper
HEADER sycocadebug.h
IDENTIFIER SYCOCA
CATEGORY_NAME kf.service.sycoca
)
target_sources(kmimeassociations_dumper PRIVATE
kmimeassociations_dumper.cpp
../src/sycoca/kmimeassociations.cpp
)
target_link_libraries(kmimeassociations_dumper KF6::Service KF6::CoreAddons KF6::ConfigCore)
@@ -0,0 +1,72 @@
/*
SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include <stdio.h>
#include <QCommandLineOption>
#include <QCommandLineParser>
#include <QCoreApplication>
#include <QTextStream>
#include <KService>
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
QCoreApplication::setApplicationName(QStringLiteral("findservice"));
QCoreApplication::setApplicationVersion(QStringLiteral("1.0.0.0"));
QCommandLineParser parser;
parser.setApplicationDescription(QStringLiteral("Finds a service using KService"));
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument(QStringLiteral("id"), QStringLiteral("service identifier"));
QCommandLineOption desktopName(QStringList() << QStringLiteral("n") << QStringLiteral("desktop-name"),
QStringLiteral("Find the service by its desktop name (default)"));
parser.addOption(desktopName);
QCommandLineOption desktopPath(QStringList() << QStringLiteral("p") << QStringLiteral("desktop-path"),
QStringLiteral("Find the service by its desktop path"));
parser.addOption(desktopPath);
QCommandLineOption menuId(QStringList() << QStringLiteral("m") << QStringLiteral("menu-id"), QStringLiteral("Find the service by its menu id"));
parser.addOption(menuId);
QCommandLineOption storageId(QStringList() << QStringLiteral("s") << QStringLiteral("storage-id"), QStringLiteral("Find the service by its storage id"));
parser.addOption(storageId);
parser.process(app);
if (parser.positionalArguments().count() != 1) {
QTextStream(stderr) << "Exactly one identifier required\n";
parser.showHelp(1);
}
const QString id = parser.positionalArguments().at(0);
KService::Ptr service;
if (parser.isSet(menuId)) {
service = KService::serviceByMenuId(id);
} else if (parser.isSet(storageId)) {
service = KService::serviceByStorageId(id);
} else if (parser.isSet(desktopPath)) {
service = KService::serviceByDesktopPath(id);
} else {
service = KService::serviceByDesktopName(id);
}
if (service) {
QTextStream(stdout) << "Found \"" << service->entryPath() << "\"\n";
QTextStream(stdout) << "Desktop name: \"" << service->desktopEntryName() << "\"\n";
QTextStream(stdout) << "Menu ID: \"" << service->menuId() << "\"\n";
QTextStream(stdout) << "Storage ID: \"" << service->storageId() << "\"\n";
QTextStream(stdout) << "MIME types: \"" << service->mimeTypes().join(QLatin1Char(' ')) << "\"\n";
QTextStream(stdout) << "Supported protocols: \"" << service->supportedProtocols().join(QLatin1Char(' ')) << "\"\n";
} else {
QTextStream(stdout) << "Not found\n";
return 2;
}
return 0;
}
@@ -0,0 +1,52 @@
/*
SPDX-FileCopyrightText: 2016 David Faure <faure@kde.org>
SPDX-License-Identifier: LGPL-2.0-only
*/
#include <QCommandLineParser>
#include <QCoreApplication>
#include <QTextStream>
#include <kmimeassociations_p.h>
#include <kservice.h>
#include <ksycoca_p.h>
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QCommandLineParser parser;
parser.setApplicationDescription(QStringLiteral("Parses mimeapps.list files and reports results for a mimetype"));
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument(QStringLiteral("mime"), QStringLiteral("mimetype name"));
parser.process(app);
if (parser.positionalArguments().count() != 1) {
QTextStream(stderr) << "Exactly one mimetype required\n";
parser.showHelp(1);
}
const QString mime = parser.positionalArguments().at(0);
// To see which files are being parsed, run this command:
// strace -e file ./kmimeassociations_dumper inode/directory |& grep mimeapps
// It should be the same as the output of these commands (assuming $XDG_CURRENT_DESKTOP=KDE)
// qtpaths --locate-files GenericConfigLocation kde-mimeapps.list
// qtpaths --locate-files GenericConfigLocation mimeapps.list
// qtpaths --locate-files ApplicationsLocation kde-mimeapps.list
// qtpaths --locate-files ApplicationsLocation mimeapps.list
KOfferHash offers;
KMimeAssociations mimeAppsParser(offers, KSycocaPrivate::self()->serviceFactory());
mimeAppsParser.parseAllMimeAppsList();
QTextStream output(stdout);
const auto list = offers.offersFor(mime);
for (const KServiceOffer &offer : list) {
output << offer.service()->desktopEntryName() << " " << offer.service()->entryPath() << "\n";
}
return 0;
}
@@ -0,0 +1,55 @@
/*
SPDX-FileCopyrightText: 2002-2006 David Faure <faure@kde.org>
SPDX-License-Identifier: LGPL-2.0-only
*/
#include <QCoreApplication>
#include <QDebug>
#include <kservice.h>
#include <kservicegroup.h>
int main(int argc, char *argv[])
{
QCoreApplication k(argc, argv);
KServiceGroup::Ptr root = KServiceGroup::root();
KServiceGroup::List list = root->entries();
KServiceGroup::Ptr first;
qDebug("Found %" PRIdQSIZETYPE " entries", list.count());
for (const KSycocaEntry::Ptr &p : std::as_const(list)) {
if (p->isType(KST_KService)) {
KService::Ptr service(static_cast<KService *>(p.data()));
qDebug("%s", qPrintable(service->name()));
qDebug("%s", qPrintable(service->entryPath()));
} else if (p->isType(KST_KServiceGroup)) {
KServiceGroup::Ptr serviceGroup(static_cast<KServiceGroup *>(p.data()));
qDebug(" %s -->", qPrintable(serviceGroup->caption()));
if (!first) {
first = serviceGroup;
}
} else {
qDebug("KServiceGroup: Unexpected object in list!");
}
}
if (first) {
list = first->entries();
qDebug("Found %" PRIdQSIZETYPE " entries", list.count());
for (const KSycocaEntry::Ptr &p : std::as_const(list)) {
if (p->isType(KST_KService)) {
KService::Ptr service(static_cast<KService *>(p.data()));
qDebug(" %s", qPrintable(service->name()));
} else if (p->isType(KST_KServiceGroup)) {
KServiceGroup::Ptr serviceGroup(static_cast<KServiceGroup *>(p.data()));
qDebug(" %s -->", qPrintable(serviceGroup->caption()));
} else {
qDebug("KServiceGroup: Unexpected object in list!");
}
}
}
return 0;
}