[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/runtime/plasma/scriptengines/javascript
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2010-08-31 20:47:06
Message-ID: 20100831204706.400FEAC871 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1170430 by aseigo:
themed colors
M +12 -0 plasmoid/appletinterface.h
M +20 -0 simplebindings/color.cpp
--- trunk/KDE/kdebase/runtime/plasma/scriptengines/javascript/plasmoid/appletinterface.h \
#1170429:1170430 @@ -29,6 +29,7 @@
#include <Plasma/Applet>
#include <Plasma/PopupApplet>
#include <Plasma/DataEngine>
+#include <Plasma/Theme>
#include "simplejavascriptapplet.h"
@@ -60,6 +61,7 @@
Q_ENUMS(QtMouseButton)
Q_ENUMS(AnimationDirection)
Q_ENUMS(IntervalAlignment)
+ Q_ENUMS(ThemeColors)
Q_PROPERTY(AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE \
setAspectRatioMode) Q_PROPERTY(FormFactor formFactor READ formFactor)
Q_PROPERTY(Location location READ location)
@@ -172,6 +174,16 @@
DefaultBackground = Plasma::Applet::DefaultBackground
};
+enum ThemeColors {
+ TextColor = Plasma::Theme::TextColor,
+ HighlightColor = Plasma::Theme::HighlightColor,
+ BackgroundColor = Plasma::Theme::BackgroundColor,
+ ButtonTextColor = Plasma::Theme::ButtonTextColor,
+ ButtonBackgroundColor = Plasma::Theme::ButtonBackgroundColor,
+ LinkColor = Plasma::Theme::LinkColor,
+ VisitedLinkColor = Plasma::Theme::VisitedLinkColor
+};
+
enum QtAlignment {
QtAlignLeft = 0x0001,
QtAlignRight = 0x0002,
--- trunk/KDE/kdebase/runtime/plasma/scriptengines/javascript/simplebindings/color.cpp \
#1170429:1170430 @@ -20,6 +20,9 @@
#include <QtScript/QScriptEngine>
#include <QtScript/QScriptContext>
#include <QtGui/QColor>
+
+#include <Plasma/Theme>
+
#include "backportglobal.h"
Q_DECLARE_METATYPE(QColor*)
@@ -106,6 +109,22 @@
return QScriptValue(eng, self->isValid());
}
+static QScriptValue setThemeColor(QScriptContext *ctx, QScriptEngine *)
+{
+ DECLARE_SELF(QColor, themeColor);
+
+ if (ctx->argumentCount() > 0) {
+ const qint32 arg = ctx->argument(0).toInt32();
+ if (arg >= 0 && arg <= Plasma::Theme::VisitedLinkColor) {
+ kDebug() << "setting to: " << \
static_cast<Plasma::Theme::ColorRole>(arg); + kDebug() << "color is: " << \
Plasma::Theme::defaultTheme()->color(static_cast<Plasma::Theme::ColorRole>(arg)); + \
self->setRgba(Plasma::Theme::defaultTheme()->color(static_cast<Plasma::Theme::ColorRole>(arg)).rgba());
+ }
+ }
+
+ return ctx->thisObject();//.property("themeColor");
+}
+
QScriptValue constructColorClass(QScriptEngine *eng)
{
QScriptValue proto = qScriptValueFromValue(eng, QColor());
@@ -116,6 +135,7 @@
proto.setProperty("blue", eng->newFunction(blue), getter | setter);
proto.setProperty("alpha", eng->newFunction(alpha), getter | setter);
proto.setProperty("valid", eng->newFunction(valid), getter);
+ ADD_METHOD(proto, setThemeColor);
eng->setDefaultPrototype(qMetaTypeId<QColor>(), proto);
eng->setDefaultPrototype(qMetaTypeId<QColor*>(), proto);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic