Plasma
dashboardjs.h
Go to the documentation of this file.00001 /* 00002 Copyright (c) 2008 Beat Wolf <asraniel@fryx.ch> 00003 00004 Permission is hereby granted, free of charge, to any person obtaining a copy 00005 of this software and associated documentation files (the "Software"), to deal 00006 in the Software without restriction, including without limitation the rights 00007 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00008 copies of the Software, and to permit persons to whom the Software is 00009 furnished to do so, subject to the following conditions: 00010 00011 The above copyright notice and this permission notice shall be included in 00012 all copies or substantial portions of the Software. 00013 00014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00017 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00018 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00019 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00020 THE SOFTWARE. 00021 */ 00022 00023 #ifndef DASHBOARDJS_H 00024 #define DASHBOARDJS_H 00025 00026 #include <QObject> 00027 #include <QVariant> 00028 #include <QGraphicsItem> 00029 00030 #include <QWebFrame> 00031 00032 #include <Plasma/Applet> 00033 00039 class DashboardJs : public QObject 00040 { 00041 Q_OBJECT 00042 Q_PROPERTY(QString identifier READ identifier) 00043 00044 Q_PROPERTY(QString onshow READ onshow WRITE setOnshow) 00045 Q_PROPERTY(QString onhide READ onhide WRITE setOnhide) 00046 Q_PROPERTY(QString onremove READ onremove WRITE setOnremove) 00047 Q_PROPERTY(QString ondragstart READ ondragstart WRITE setOndragstart) 00048 Q_PROPERTY(QString ondragstop READ ondragstop WRITE setOndragstop) 00049 00050 public: 00051 DashboardJs(QWebFrame *frame, QObject *parent= 0, Plasma::Applet *applet = 0); 00052 ~DashboardJs(); 00053 00054 QString identifier() const; 00055 00056 QString onshow() const; 00057 void setOnshow(const QString &onshow); 00058 00059 QString onhide() const; 00060 void setOnhide(const QString &onhide); 00061 00062 QString onremove() const; 00063 void setOnremove(const QString &onremove); 00064 00065 QString ondragstart() const; 00066 void setOndragstart(const QString &ondragstart); 00067 00068 QString ondragstop() const; 00069 void setOndragstop(const QString &ondragstop); 00070 00071 public slots: 00072 void hello(int test); 00073 00077 void openApplication(QString name); 00078 00083 void openURL(QString name); //ok 00084 00088 QVariant preferenceForKey(QString key); //ok 00089 00090 void prepareForTransition(QString transition); 00091 00092 void performTransition(); 00093 00094 void setCloseBoxOffset(int x, int y); //not needed 00095 00099 void setPreferenceForKey(QString value, QString key); //ok 00100 00101 void system(QString command, QString handler); //cannot really be implemented 00102 private: 00103 //TODO: execute when needed 00104 QString m_onshow; //has no equivalent in plasma, because always shown 00105 QString m_onhide; //has no equivalent in plasma, because always shown 00106 QString m_onremove; //ok 00107 00108 QString m_ondragstart; 00109 QString m_ondragstop; 00110 00111 //my private stuff 00112 Plasma::Applet *m_applet; 00113 QWebFrame *m_frame; 00114 }; 00115 00116 #endif