add more spacing
[personal-kdebase.git] / workspace / plasma / scriptengines / webkit / plasmawebapplet.h
blobd5ced4a09837b27356be21e105747b5fc1dc4c46
1 /*
2 Copyright (c) 2007 Zack Rusin <zack@kde.org>
3 Copyright (c) 2008 Petri Damstén <damu@iki.fi>
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 THE SOFTWARE.
24 #ifndef PLASMAWEBAPPLET_H
25 #define PLASMAWEBAPPLET_H
27 #include "webapplet.h"
28 #include "plasmajs.h"
30 #include <KTemporaryFile>
32 class PlasmaWebApplet : public WebApplet
34 Q_OBJECT
35 Q_PROPERTY(QString name READ name)
36 Q_PROPERTY(uint id READ id)
37 Q_PROPERTY(QString pluginName READ pluginName)
38 Q_PROPERTY(QString icon READ icon)
39 Q_PROPERTY(QString category READ category)
40 Q_PROPERTY(int formFactor READ formFactor)
41 Q_PROPERTY(int location READ location)
42 public:
43 PlasmaWebApplet(QObject *parent, const QVariantList &args);
44 virtual ~PlasmaWebApplet();
46 virtual bool init();
48 QString name() const;
49 uint id() const;
50 QString pluginName() const;
51 QString icon() const;
52 QString category() const;
53 bool shouldConserveResources() const;
54 int formFactor() const;
55 int location() const;
57 public slots:
58 QObject* dataEngine(const QString& name);
59 QObject* config();
60 QObject* globalConfig();
61 void setScrollBarPolicy(int orientation, int policy);
62 void setDefaultSize(qreal w, qreal h);
63 QVariantList screenRect();
64 void setConfigurationRequired(bool needsConfiguring);
65 QVariantList getContentsMargins();
66 void resize(qreal w, qreal h);
67 QVariantList size();
68 void setBackgroundHints(int hints);
69 int backgroundHints();
70 void setAspectRatioMode(int mode);
71 int aspectRatioMode();
72 void setMaximumSize(qreal w, qreal h);
73 QVariantList maximumSize();
74 void setMinimumSize(qreal w, qreal h);
75 QVariantList minimumSize();
76 void setPreferredSize(qreal w, qreal h);
77 QVariantList preferredSize();
78 void setGeometry(qreal x, qreal y, qreal w, qreal h);
79 QVariantList geometry();
80 void setPos(qreal x, qreal y);
81 QVariantList pos();
83 QVariant arg(int index) const;
84 QObject* objArg(int index) const;
85 void dataUpdated(const QString& source, const Plasma::DataEngine::Data &data);
86 void configChanged();
87 void themeChanged();
88 void makeStylesheet();
90 protected:
91 QVariant callJsFunction(const QString &func, const QVariantList &args = QVariantList());
92 void constraintsEvent(Plasma::Constraints constraints);
94 protected slots:
95 virtual void loadFinished(bool success);
96 virtual void initJsObjects();
98 private:
99 QVariantList m_args;
100 DataEngineDataWrapper m_dataEngineData;
101 ConfigGroupWrapper m_config;
102 ConfigGroupWrapper m_globalConfig;
103 KTemporaryFile m_temp;
104 bool m_useDefaultSize;
105 static QString m_jsConstants;
108 #endif