2 Copyright (c) 2008 Beat Wolf <asraniel@fryx.ch>
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 #include "dashboardjs.h"
27 #include <KConfigGroup>
30 #include <QStyleOptionGraphicsItem>
33 #include <QGraphicsItem>
35 #include <QGraphicsScene>
37 DashboardJs::DashboardJs(QWebFrame
*frame
, QObject
*parent
, Plasma::Applet
*applet
)
44 DashboardJs::~DashboardJs()
47 kDebug() << "deconstructor calles javascript: " << m_onremove
;
48 m_frame
->evaluateJavaScript(m_onremove
);
52 void DashboardJs::openApplication(QString name
)
55 kDebug() << "not implemented: open application" << name
;
57 //WARNING: this might be dangerous and exploited (or not)
58 /* create list of applications:
60 * com.RealNetworks.RealPlayer
64 void DashboardJs::openURL(QString name
)
66 //TODO: this could be dangerous(really?). filter valid urls
70 QVariant
DashboardJs::preferenceForKey(QString key
)
72 KConfigGroup conf
= m_applet
->config();
74 if (!conf
.hasKey(key
)) {
78 return conf
.readEntry(key
,"");
81 void DashboardJs::prepareForTransition(QString transition
)
84 kDebug() << "not implemented: transition with name" << transition
;
85 //TODO:freeze widget drawing. possible?
86 //not really needed for things to work, but would be prettier
89 void DashboardJs::performTransition()
92 //TODO: enable widget drawing again, perform nice animation.
93 kDebug() << "not implemented: perform transition";
94 //not really needed for things to work, but would be prettier
97 void DashboardJs::setCloseBoxOffset(int x
, int y
)
99 //STUB, not needed, plasma has its own close box
100 kDebug() << "not implemented: close box offset" << x
<< y
;
103 void DashboardJs::setPreferenceForKey(QString value
, QString key
)
105 kDebug() << "save key" << key
<< value
;
106 KConfigGroup conf
= m_applet
->config();
107 conf
.writeEntry(key
, value
);
110 void DashboardJs::system(QString command
, QString handler
)
112 //WARNING: this might be dangerous and exploited.
114 kDebug() << "not implemented: system command:" << command
<< handler
;
117 //Property sets and gets
118 QString
DashboardJs::identifier() const
120 return QString::number(m_applet
->id());
123 QString
DashboardJs::onshow() const
128 void DashboardJs::setOnshow(const QString
&value
)
133 QString
DashboardJs::onhide() const
138 void DashboardJs::setOnhide(const QString
&value
)
143 QString
DashboardJs::onremove() const
148 void DashboardJs::setOnremove(const QString
&value
)
154 QString
DashboardJs::ondragstart() const
156 return m_ondragstart
;
159 void DashboardJs::setOndragstart(const QString
&value
)
161 m_ondragstart
= value
;
164 QString
DashboardJs::ondragstop() const
169 void DashboardJs::setOndragstop(const QString
&value
)
171 m_ondragstop
= value
;
173 //only for testing purpose
174 //TODO: remove when not needed anymore
175 void DashboardJs::hello(int test
)
177 kDebug() << "hello world" << test
;