not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / plasma / scriptengines / webkit / dashboardjs.h
blob2376571db8ce568bbc681a0b0b9d760096b55688
1 /*
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
20 THE SOFTWARE.
21 */
23 #ifndef DASHBOARDJS_H
24 #define DASHBOARDJS_H
26 #include <QObject>
27 #include <QVariant>
28 #include <QGraphicsItem>
30 #include <QWebFrame>
32 #include <Plasma/Applet>
34 /**
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
41 Q_OBJECT
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)
50 public:
51 DashboardJs(QWebFrame *frame, QObject *parent= 0, Plasma::Applet *applet = 0);
52 ~DashboardJs();
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);
71 public slots:
72 void hello(int test);
74 /**
75 * opens a certain application
77 void openApplication(QString name);
79 /**
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
85 /**
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
96 /**
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
102 private:
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;
111 //my private stuff
112 Plasma::Applet *m_applet;
113 QWebFrame *m_frame;
116 #endif