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
28 #include <QGraphicsItem>
32 #include <Plasma/Applet>
35 * Implements the Mac OS X Dashboard widget javascript functions.
36 * This document was used to create this class:
37 * http://developer.apple.com/documentation/AppleApplications/Reference/Dashboard_Ref/Dashboard_Ref.pdf
39 class DashboardJs
: public QObject
42 Q_PROPERTY(QString identifier READ identifier
)
44 Q_PROPERTY(QString onshow READ onshow WRITE setOnshow
)
45 Q_PROPERTY(QString onhide READ onhide WRITE setOnhide
)
46 Q_PROPERTY(QString onremove READ onremove WRITE setOnremove
)
47 Q_PROPERTY(QString ondragstart READ ondragstart WRITE setOndragstart
)
48 Q_PROPERTY(QString ondragstop READ ondragstop WRITE setOndragstop
)
51 DashboardJs(QWebFrame
*frame
, QObject
*parent
= 0, Plasma::Applet
*applet
= 0);
54 QString
identifier() const;
56 QString
onshow() const;
57 void setOnshow(const QString
&onshow
);
59 QString
onhide() const;
60 void setOnhide(const QString
&onhide
);
62 QString
onremove() const;
63 void setOnremove(const QString
&onremove
);
65 QString
ondragstart() const;
66 void setOndragstart(const QString
&ondragstart
);
68 QString
ondragstop() const;
69 void setOndragstop(const QString
&ondragstop
);
75 * opens a certain application
77 void openApplication(QString name
);
80 * opens a URL. Does not open file urls by default.
81 * TODO: find out what protocols dashboard widgets support. filter out the others
83 void openURL(QString name
); //ok
86 * Returns the value associated with a certain key
88 QVariant
preferenceForKey(QString key
); //ok
90 void prepareForTransition(QString transition
);
92 void performTransition();
94 void setCloseBoxOffset(int x
, int y
); //not needed
97 * Saves a value to a key
99 void setPreferenceForKey(QString value
, QString key
); //ok
101 void system(QString command
, QString handler
); //cannot really be implemented
103 //TODO: execute when needed
104 QString m_onshow
; //has no equivalent in plasma, because always shown
105 QString m_onhide
; //has no equivalent in plasma, because always shown
106 QString m_onremove
; //ok
108 QString m_ondragstart
;
109 QString m_ondragstop
;
112 Plasma::Applet
*m_applet
;