separate concept of Category from Type and get it right in the file written out!

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=828243
This commit is contained in:
Aaron J. Seigo 2008-07-05 05:21:07 +00:00
parent 1e35b37d5c
commit 6a912784f2
3 changed files with 27 additions and 3 deletions

View File

@ -344,7 +344,8 @@ bool Package::registerPackage(const PackageMetadata &data, const QString &iconPa
KDesktopFile config(service);
KConfigGroup cg = config.desktopGroup();
cg.writeEntry("Type", "Service");
const QString type = data.type().isEmpty() ? "Service" : data.type();
cg.writeEntry("Type", type);
const QString serviceTypes = data.serviceType().isNull() ? "Plasma/Applet,Plasma/Containment" : data.serviceType();
cg.writeEntry("X-KDE-ServiceTypes", serviceTypes);
cg.writeEntry("X-KDE-PluginInfo-EnabledByDefault", true);

View File

@ -30,6 +30,11 @@ namespace Plasma
class PackageMetadataPrivate
{
public:
PackageMetadataPrivate()
: type("Service")
{
}
QString name;
QString description;
QString author;
@ -38,6 +43,7 @@ class PackageMetadataPrivate
QString website;
QString license;
QString app;
QString category;
QString requiredVersion;
QString pluginName;
QString type;
@ -86,7 +92,7 @@ void PackageMetadata::write(const QString &filename) const
config.writeEntry("X-KDE-PluginInfo-Version", d->version);
config.writeEntry("X-KDE-PluginInfo-Website", d->website);
config.writeEntry("X-KDE-PluginInfo-License", d->license);
config.writeEntry("X-KDE-PluginInfo-Category", d->type);
config.writeEntry("X-KDE-PluginInfo-Category", d->category);
config.writeEntry("X-Plasma-API", d->api);
config.writeEntry("X-KDE-Plasmagik-ApplicationName", d->app);
config.writeEntry("X-KDE-Plasmagik-RequiredVersion", d->requiredVersion);
@ -106,7 +112,8 @@ void PackageMetadata::read(const QString& filename)
d->version = config.readEntry("X-KDE-PluginInfo-Version", d->version);
d->website = config.readEntry("X-KDE-PluginInfo-Website", d->website);
d->license = config.readEntry("X-KDE-PluginInfo-License", d->license);
d->type = config.readEntry("X-KDE-PluginInfo-Category", d->type);
d->type = config.readEntry("Type", d->type);
d->category = config.readEntry("X-KDE-PluginInfo-Category", d->category);
d->app = config.readEntry("X-KDE-Plasmagik-ApplicationName", d->app);
d->requiredVersion = config.readEntry("X-KDE-Plasmagik-RequiredVersion", d->requiredVersion);
}
@ -156,6 +163,11 @@ QString PackageMetadata::application() const
return d->app;
}
QString PackageMetadata::category() const
{
return d->category;
}
QString PackageMetadata::requiredVersion() const
{
return d->requiredVersion;
@ -231,6 +243,11 @@ void PackageMetadata::setApplication(const QString &application)
d->app = application;
}
void PackageMetadata::setCategory(const QString &category)
{
d->category = category;
}
void PackageMetadata::setRequiredVersion(const QString &requiredVersion)
{
d->requiredVersion = requiredVersion;

View File

@ -76,6 +76,7 @@ public:
QString website() const;
QString license() const;
QString application() const;
QString category() const;
QString requiredVersion() const;
QString pluginName() const;
QString implementationApi() const;
@ -136,6 +137,11 @@ public:
*/
void setApplication(const QString &);
/**
* Sets the category this package belongs in
*/
void setCategory(const QString &);
/**
* Set the required version. See also the setVersion()
* method.