~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/generic/scriptengines/webkit/plasmawebapplet.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (c) 2007 Zack Rusin <zack@kde.org>
 
3
Copyright (c) 2008 Petri Damstén <damu@iki.fi>
 
4
 
 
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:
 
11
 
 
12
The above copyright notice and this permission notice shall be included in
 
13
all copies or substantial portions of the Software.
 
14
 
 
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.
 
22
*/
 
23
 
 
24
#ifndef PLASMAWEBAPPLET_H
 
25
#define PLASMAWEBAPPLET_H
 
26
 
 
27
#include "webapplet.h"
 
28
#include "plasmajs.h"
 
29
 
 
30
#include <KTemporaryFile>
 
31
 
 
32
class PlasmaWebApplet : public WebApplet
 
33
{
 
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
 
 
43
public:
 
44
    PlasmaWebApplet(QObject *parent, const QVariantList &args);
 
45
    virtual ~PlasmaWebApplet();
 
46
 
 
47
    virtual bool init();
 
48
 
 
49
    QString name() const;
 
50
    uint id() const;
 
51
    QString pluginName() const;
 
52
    QString icon() const;
 
53
    QString category() const;
 
54
    bool shouldConserveResources() const;
 
55
    int formFactor() const;
 
56
    int location() const;
 
57
 
 
58
public slots:
 
59
    QStringList listAllDataEngines();
 
60
    QObject* dataEngine(const QString& name);
 
61
    QObject* config();
 
62
    QObject* globalConfig();
 
63
    void setScrollBarPolicy(int orientation, int policy);
 
64
    QVariantList screenRect();
 
65
    void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
 
66
    QVariantList getContentsMargins();
 
67
    void resize(qreal w, qreal h);
 
68
    QVariantList size();
 
69
    void setBackgroundHints(int hints);
 
70
    int backgroundHints();
 
71
    void setAspectRatioMode(int mode);
 
72
    int aspectRatioMode();
 
73
    void setMaximumSize(qreal w, qreal h);
 
74
    QVariantList maximumSize();
 
75
    void setMinimumSize(qreal w, qreal h);
 
76
    QVariantList minimumSize();
 
77
    void setPreferredSize(qreal w, qreal h);
 
78
    QVariantList preferredSize();
 
79
    void setGeometry(qreal x, qreal y, qreal w, qreal h);
 
80
    QVariantList geometry();
 
81
    void setPos(qreal x, qreal y);
 
82
    QVariantList pos();
 
83
    void setFailedToLaunch(bool failed, const QString &reason = QString());
 
84
    void update();
 
85
    bool isBusy() const;
 
86
    void setBusy(bool busy);
 
87
 
 
88
    QVariant arg(int index) const;
 
89
    QObject* objArg(int index) const;
 
90
    void dataUpdated(const QString& source, const Plasma::DataEngine::Data &data);
 
91
    void configChanged();
 
92
    void themeChanged();
 
93
    void makeStylesheet();
 
94
 
 
95
protected:
 
96
    QVariant callJsFunction(const QString &func, const QVariantList &args = QVariantList());
 
97
    void constraintsEvent(Plasma::Constraints constraints);
 
98
 
 
99
protected slots:
 
100
    virtual void loadFinished(bool success);
 
101
    virtual void initJsObjects();
 
102
 
 
103
private:
 
104
    QVariantList m_args;
 
105
    DataEngineDataWrapper m_dataEngineData;
 
106
    ConfigGroupWrapper m_config;
 
107
    ConfigGroupWrapper m_globalConfig;
 
108
    KTemporaryFile m_styleSheetFile;
 
109
    static QString s_jsConstants;
 
110
};
 
111
 
 
112
#endif