don't use ksycoca when it isn't availableto us
This commit is contained in:
parent
a4e9bb5f6c
commit
55fe4e9b55
@ -33,6 +33,7 @@
|
|||||||
#include <KServiceTypeTrader>
|
#include <KServiceTypeTrader>
|
||||||
#include <KShell>
|
#include <KShell>
|
||||||
#include <KStandardDirs>
|
#include <KStandardDirs>
|
||||||
|
#include <KSycoca>
|
||||||
|
|
||||||
#include <Plasma/PackageStructure>
|
#include <Plasma/PackageStructure>
|
||||||
#include <Plasma/Package>
|
#include <Plasma/Package>
|
||||||
@ -48,20 +49,24 @@ void output(const QString &msg)
|
|||||||
|
|
||||||
void runKbuildsycoca()
|
void runKbuildsycoca()
|
||||||
{
|
{
|
||||||
|
if (KSycoca::isAvailable()) {
|
||||||
QDBusInterface dbus("org.kde.kded", "/kbuildsycoca", "org.kde.kbuildsycoca");
|
QDBusInterface dbus("org.kde.kded", "/kbuildsycoca", "org.kde.kbuildsycoca");
|
||||||
dbus.call(QDBus::NoBlock, "recreate");
|
dbus.call(QDBus::NoBlock, "recreate");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList packages(const QStringList& types)
|
QStringList packages(const QStringList& types)
|
||||||
{
|
{
|
||||||
QStringList result;
|
QStringList result;
|
||||||
|
|
||||||
|
if (KSycoca::isAvailable()) {
|
||||||
foreach (const QString& type, types) {
|
foreach (const QString& type, types) {
|
||||||
const KService::List services = KServiceTypeTrader::self()->query(type);
|
const KService::List services = KServiceTypeTrader::self()->query(type);
|
||||||
foreach (const KService::Ptr &service, services) {
|
foreach (const KService::Ptr &service, services) {
|
||||||
result << service->property("X-KDE-PluginInfo-Name", QVariant::String).toString();
|
result << service->property("X-KDE-PluginInfo-Name", QVariant::String).toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -135,7 +140,11 @@ void listTypes()
|
|||||||
builtIns.insert(i18n("KWin Script"), QStringList() << "KWin/Script" << "kwin/scripts/");
|
builtIns.insert(i18n("KWin Script"), QStringList() << "KWin/Script" << "kwin/scripts/");
|
||||||
renderTypeTable(builtIns);
|
renderTypeTable(builtIns);
|
||||||
|
|
||||||
KService::List offers = KServiceTypeTrader::self()->query("Plasma/PackageStructure");
|
KService::List offers;
|
||||||
|
if (KSycoca::isAvailable()) {
|
||||||
|
offers = KServiceTypeTrader::self()->query("Plasma/PackageStructure");
|
||||||
|
}
|
||||||
|
|
||||||
if (!offers.isEmpty()) {
|
if (!offers.isEmpty()) {
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
output(i18n("Provided by plugins:"));
|
output(i18n("Provided by plugins:"));
|
||||||
@ -328,7 +337,7 @@ int main(int argc, char **argv)
|
|||||||
packageRoot = "kwin/scripts/";
|
packageRoot = "kwin/scripts/";
|
||||||
servicePrefix = "kwin-script-";
|
servicePrefix = "kwin-script-";
|
||||||
pluginTypes << "KWin/Script";
|
pluginTypes << "KWin/Script";
|
||||||
} else {
|
} else if (KSycoca::isAvailable()) {
|
||||||
const QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(type);
|
const QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(type);
|
||||||
KService::List offers = KServiceTypeTrader::self()->query("Plasma/PackageStructure", constraint);
|
KService::List offers = KServiceTypeTrader::self()->query("Plasma/PackageStructure", constraint);
|
||||||
if (offers.isEmpty()) {
|
if (offers.isEmpty()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user