version read only property

svn path=/trunk/KDE/kdebase/workspace/; revision=1119867
This commit is contained in:
Aaron J. Seigo 2010-04-27 21:07:50 +00:00 committed by Marco Martin
parent ae70c2fce5
commit 1d60579972
4 changed files with 24 additions and 0 deletions

View File

@ -22,6 +22,9 @@
#include <QAction>
#include <QGraphicsLinearLayout>
#include <KService>
#include <KServiceTypeTrader>
#include <Plasma/Applet>
#include <Plasma/Containment>
#include <Plasma/Corona>
@ -190,6 +193,23 @@ void Applet::reloadConfig()
}
}
QString Applet::version() const
{
Plasma::Applet *app = applet();
if (!app) {
return QString();
}
QString type = app->pluginName();
KService::List services = KServiceTypeTrader::self()->query("Plasma/Applet", "[X-KDE-PluginInfo-Name] == '" + type + "'");
if (services.isEmpty()) {
return QString();
}
KPluginInfo info(services.first());
return info.version();
}
Plasma::Applet *Applet::applet() const
{
return 0;

View File

@ -52,6 +52,8 @@ public:
void setCurrentGlobalConfigGroup(const QStringList &groupNames);
QStringList currentGlobalConfigGroup() const;
QString version() const;
virtual Plasma::Applet *applet() const;
public Q_SLOTS:

View File

@ -39,6 +39,7 @@ class PanelView;
class PLASMAGENERICSHELL_EXPORT Containment : public Applet
{
Q_OBJECT
Q_PROPERTY(QString version READ version)
Q_PROPERTY(QStringList configKeys READ configKeys)
Q_PROPERTY(QStringList configGroups READ configGroups)
Q_PROPERTY(QStringList globalConfigKeys READ globalConfigKeys)

View File

@ -35,6 +35,7 @@ class PLASMAGENERICSHELL_EXPORT Widget : public Applet
{
Q_OBJECT
Q_PROPERTY(QString type READ type)
Q_PROPERTY(QString version READ version)
Q_PROPERTY(int id READ id)
Q_PROPERTY(QStringList configKeys READ configKeys)
Q_PROPERTY(QStringList configGroups READ configGroups)