version number

svn path=/trunk/KDE/kdebase/runtime/; revision=1048837
This commit is contained in:
Aaron J. Seigo 2009-11-14 00:24:14 +00:00
parent cb34ebdf8f
commit 782ecaac2b
3 changed files with 18 additions and 1 deletions

View File

@ -23,7 +23,9 @@
#include <QFile> #include <QFile>
#include <QSignalMapper> #include <QSignalMapper>
#include <KDE/KIcon> #include <KIcon>
#include <KService>
#include <KServiceTypeTrader>
#include <Plasma/Plasma> #include <Plasma/Plasma>
#include <Plasma/Applet> #include <Plasma/Applet>
@ -303,4 +305,15 @@ bool AppletInterface::immutable() const
return applet()->immutability() != Plasma::Mutable; return applet()->immutability() != Plasma::Mutable;
} }
int AppletInterface::apiVersion() const
{
const QString constraint("[X-Plasma-API] == 'javascript' and 'Applet' in [X-Plasma-ComponentTypes]");
KService::List offers = KServiceTypeTrader::self()->query("Plasma/ScriptEngine", constraint);
if (offers.isEmpty()) {
return -1;
}
return offers.first()->property("X-KDE-PluginInfo-Version", QVariant::Int).toInt();
}
#include "appletinterface.moc" #include "appletinterface.moc"

View File

@ -63,6 +63,8 @@ class AppletInterface : public QObject
Q_PROPERTY(BackgroundHints backgroundHints WRITE setBackgroundHints READ backgroundHints) Q_PROPERTY(BackgroundHints backgroundHints WRITE setBackgroundHints READ backgroundHints)
Q_PROPERTY(QGraphicsLayout *layout WRITE setLayout READ layout) Q_PROPERTY(QGraphicsLayout *layout WRITE setLayout READ layout)
Q_PROPERTY(bool immutable READ immutable) Q_PROPERTY(bool immutable READ immutable)
Q_PROPERTY(int apiVersion READ apiVersion)
Q_PROPERTY(QObject *sender READ sender)
public: public:
AppletInterface(SimpleJavaScriptApplet *parent); AppletInterface(SimpleJavaScriptApplet *parent);
@ -219,6 +221,7 @@ enum QtAlignment {
QGraphicsLayout *layout() const; QGraphicsLayout *layout() const;
void setLayout(QGraphicsLayout *); void setLayout(QGraphicsLayout *);
bool immutable() const; bool immutable() const;
int apiVersion() const;
inline Plasma::Applet *applet() const { return m_appletScriptEngine->applet(); } inline Plasma::Applet *applet() const { return m_appletScriptEngine->applet(); }

View File

@ -133,3 +133,4 @@ Icon=text-x-script
X-KDE-Library=plasma_appletscript_simple_javascript X-KDE-Library=plasma_appletscript_simple_javascript
X-Plasma-API=javascript X-Plasma-API=javascript
X-Plasma-ComponentTypes=Applet X-Plasma-ComponentTypes=Applet
X-KDE-PluginInfo-Version=1