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
24 #ifndef PLASMAWEBAPPLET_H
25 #define PLASMAWEBAPPLET_H
27 #include "webapplet.h"
30 #include <KTemporaryFile>
32 class PlasmaWebApplet
: public WebApplet
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
)
43 PlasmaWebApplet(QObject
*parent
, const QVariantList
&args
);
44 virtual ~PlasmaWebApplet();
50 QString
pluginName() const;
52 QString
category() const;
53 bool shouldConserveResources() const;
54 int formFactor() const;
58 QObject
* dataEngine(const QString
& name
);
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
);
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
);
83 QVariant
arg(int index
) const;
84 QObject
* objArg(int index
) const;
85 void dataUpdated(const QString
& source
, const Plasma::DataEngine::Data
&data
);
88 void makeStylesheet();
91 QVariant
callJsFunction(const QString
&func
, const QVariantList
&args
= QVariantList());
92 void constraintsEvent(Plasma::Constraints constraints
);
95 virtual void loadFinished(bool success
);
96 virtual void initJsObjects();
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
;