fix package root for wallpapers, makes it find the metadata, add debug

This commit is contained in:
Sebastian Kügler 2013-04-25 04:52:23 +02:00
parent 31e39640ce
commit a426264037
3 changed files with 13 additions and 22 deletions

View File

@ -204,6 +204,7 @@ void Package::setAllowExternalPaths(bool allow)
KPluginInfo Package::metadata() const
{
qDebug() << "metadata: " << d->path << filePath("metadata");
if (!d->metadata && !d->path.isEmpty()) {
const QString metadataPath = filePath("metadata");
if (!metadataPath.isEmpty()) {
@ -441,6 +442,7 @@ void Package::setPath(const QString &path)
paths << p;
}
}
qDebug() << "paths:" << p << paths << d->defaultPackageRoot;
} else {
const QDir dir(path);
if (QFile::exists(dir.canonicalPath())) {
@ -822,7 +824,7 @@ void PackagePrivate::createPackageMetadata(const QString &path)
QString metadataPath(path + "/metadata.desktop");
if (!QFile::exists(metadataPath)) {
kWarning() << "No metadata file in the package, expected it at:" << metadataPath;
qWarning() << "No metadata file in the package, expected it at:" << metadataPath;
metadataPath.clear();
}

View File

@ -210,14 +210,14 @@ bool PackageJobThread::installPackage(const QString& src, const QString &dest)
QString metadataPath = path + "metadata.desktop";
if (!QFile::exists(metadataPath)) {
kDebug() << "No metadata file in package" << src << metadataPath;
qDebug() << "No metadata file in package" << src << metadataPath;
d->errorMessage = i18n("No metadata file in package: %1", src);
return false;
}
KPluginInfo meta(metadataPath);
QString pluginName = meta.pluginName();
kDebug() << "pluginname: " << meta.pluginName();
qDebug() << "pluginname: " << meta.pluginName();
if (pluginName.isEmpty()) {
//kWarning() << "Package plugin name not specified";
d->errorMessage = i18n("Package plugin name not specified: %1", src);
@ -292,9 +292,10 @@ bool PackageJobThread::installPackage(const QString& src, const QString &dest)
}
QString service = localServiceDirectory + serviceName;
qDebug() << "-- Copying " << metaPath << service;
const bool ok = QFile::copy(metaPath, service);
if (ok) {
//kDebug() << "Copying metadata went ok.";
qDebug() << "Copying metadata went ok.";
// the icon in the installed file needs to point to the icon in the
// installation dir!
QString iconPath = targetName + '/' + cg.readEntry("Icon");

View File

@ -210,6 +210,7 @@ void PlasmaPkg::runMain()
d->pluginTypes << "Plasma/Wallpaper";
d->packageRoot = "plasma/wallpapers/";
d->servicePrefix = "plasma-wallpaper-";
qDebug() << "service type and root set " << d->servicePrefix << d->packageRoot << d->pluginTypes;
} else if (type.compare(i18nc("package type", "dataengine"), Qt::CaseInsensitive) == 0 ||
type.compare("dataengine", Qt::CaseInsensitive) == 0) {
d->packageRoot = "plasma/dataengines/";
@ -225,6 +226,7 @@ void PlasmaPkg::runMain()
d->packageRoot = "plasma/wallpapers/";
d->servicePrefix = "plasma-wallpaper-";
d->pluginTypes << "Plasma/Wallpaper";
qDebug() << "2service type and root set " << d->servicePrefix << d->packageRoot << d->pluginTypes;
} else if (type.compare(i18nc("package type", "layout-template"), Qt::CaseInsensitive) == 0 ||
type.compare("layout-template", Qt::CaseInsensitive) == 0) {
d->packageRoot = "plasma/layout-templates/";
@ -278,7 +280,7 @@ void PlasmaPkg::runMain()
if (!d->installer) {
d->installer = new Plasma::Package(new Plasma::PackageStructure());
//d->installer->setServicePrefix(d->servicePrefix);
d->installer->setServicePrefix(d->servicePrefix);
}
d->packageRoot = findPackageRoot(d->package, d->packageRoot);
@ -308,6 +310,7 @@ void PlasmaPkg::runMain()
_p.append('/');
}
_p.append(d->package);
d->installer->setDefaultPackageRoot(d->packageRoot);
d->installer->setPath(pkgPath);
QString pluginName;
if (d->installer->isValid()) {
@ -323,7 +326,6 @@ void PlasmaPkg::runMain()
}
}
QStringList installed = d->packages(d->pluginTypes);
//qDebug() << "installed wallpapers:" << installed << d->pluginTypes;
if (installed.contains(pluginName)) {
d->installer->setPath(pluginName);
KJob *uninstallJob = d->installer->uninstall(pluginName, d->packageRoot);
@ -366,24 +368,9 @@ void PlasmaPkgPrivate::runKbuildsycoca()
QStringList PlasmaPkgPrivate::packages(const QStringList& types)
{
QStringList result;
qDebug() << "listing " << types;
foreach (const QString& type, types) {
/*
if (type.compare("Plasma/Wallpaper", Qt::CaseInsensitive) == 0) {
const QStringList &wallies = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "plasma/wallpapers/", QStandardPaths::LocateDirectory);
foreach (const QString &wpath, wallies) {
const QDir cd(wpath);
const QStringList &entries = cd.entryList(QDir::Dirs);
foreach (const QString wallpap, entries) {
if ((wallpap != "." && wallpap != "..") &&
(QFile::exists(wpath+'/'+wallpap+"/metadata.desktop"))) {
result << wallpap;
}
}
}
}
*/
if (type.compare("Plasma/Generic", Qt::CaseInsensitive) == 0) {
const QStringList &packs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "plasma/packages/", QStandardPaths::LocateDirectory);
foreach (const QString &ppath, packs) {
@ -401,6 +388,7 @@ QStringList PlasmaPkgPrivate::packages(const QStringList& types)
const KService::List services = KServiceTypeTrader::self()->query(type);
foreach (const KService::Ptr &service, services) {
const QString _plugin = service->property("X-KDE-PluginInfo-Name", QVariant::String).toString();
//qDebug() << "Found plugin: " << _plugin;
if (!result.contains(_plugin)) {
result << _plugin;
}