Applet::pluginName() -> Applet::pluginInfo()

Applet doesn't need to wrap every single methos of KPluginInfo, it can just make copies of its KPluginInfo accessible to everybody
This commit is contained in:
Marco Martin 2013-02-12 11:46:26 +01:00
parent 39151c048f
commit 70abf37a52
4 changed files with 12 additions and 29 deletions

View File

@ -212,7 +212,7 @@ void Applet::save(KConfigGroup &g) const
// we call the dptr member directly for locked since isImmutable()
// also checks kiosk and parent containers
group.writeEntry("immutability", (int)d->immutability);
group.writeEntry("plugin", pluginName());
group.writeEntry("plugin", d->appletDescription.pluginName());
if (!d->started) {
return;
@ -423,13 +423,9 @@ QString Applet::icon() const
return d->appletDescription.icon();
}
QString Applet::pluginName() const
KPluginInfo Applet::pluginInfo() const
{
if (!d->appletDescription.isValid()) {
return d->mainConfigGroup()->readEntry("plugin", QString());
}
return d->appletDescription.pluginName();
return d->appletDescription;
}
bool Applet::shouldConserveResources() const
@ -441,15 +437,6 @@ bool Applet::shouldConserveResources() const
#endif
}
QString Applet::category() const
{
if (!d->appletDescription.isValid()) {
return i18nc("misc category", "Miscellaneous");
}
return d->appletDescription.category();
}
QString Applet::category(const KPluginInfo &applet)
{
return applet.property("X-KDE-PluginInfo-Category").toString();

View File

@ -234,6 +234,13 @@ class PLASMA_EXPORT Applet : public QObject
//METADATA
/**
* @return metadata information about this plugin
* @see KPluginInfo
* @since 5.0
*/
KPluginInfo pluginInfo() const;
/**
* Returns the user-visible title for the applet, as specified in the
* Name field of the .desktop file. Can be changed with @see setTitle
@ -346,22 +353,11 @@ class PLASMA_EXPORT Applet : public QObject
*/
static QString category(const QString &appletName);
/**
* Returns the plugin name for the applet
*/
QString pluginName() const;
/**
* Returns the icon related to this applet
**/
QString icon() const;
/**
* Returns the category the applet is in, as specified in the
* .desktop file.
*/
QString category() const;
/**
* Whether the applet should conserve resources. If true, try to avoid doing stuff which
* is computationally heavy. Try to conserve power and resources.

View File

@ -129,7 +129,7 @@ Storage::Storage(QObject* parent)
while ((parentObject = parentObject->parent())) {
Plasma::Applet *applet = qobject_cast<Plasma::Applet *>(parentObject);
if (applet) {
m_clientName = applet->pluginName();
m_clientName = applet->pluginInfo().pluginName();
break;
}

View File

@ -353,7 +353,7 @@ QString AppletInterface::downloadPath(const QString &file)
QStringList AppletInterface::downloadedFiles() const
{
const QString downloadDir = KGlobalSettings::downloadPath() + "/Plasma/" + applet()->pluginName();
const QString downloadDir = KGlobalSettings::downloadPath() + "/Plasma/" + applet()->pluginInfo().pluginName();
QDir dir(downloadDir);
return dir.entryList(QDir::Files | QDir::NoSymLinks | QDir::Readable);
}