1 | /* |
2 | * This file is part of the KDE project. |
3 | * |
4 | * Copyright (C) 2008 Michael Howell <mhowell123@gmail.com> |
5 | * Copyright (C) 2009 Dawit Alemayehu <adawit@kde.org> |
6 | * |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Library General Public |
9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. |
11 | * |
12 | * This library is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | * Library General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU Library General Public License |
18 | * along with this library; see the file COPYING.LIB. If not, write to |
19 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | * Boston, MA 02110-1301, USA. |
21 | * |
22 | */ |
23 | #ifndef KWEBPLUGINFACTORY_H |
24 | #define KWEBPLUGINFACTORY_H |
25 | |
26 | #include <kdewebkit_export.h> |
27 | |
28 | #include <QtWebKit/QWebPluginFactory> |
29 | |
30 | namespace KParts { |
31 | class ReadOnlyPart; |
32 | } |
33 | |
34 | /** |
35 | * @short A QWebPluginFactory with integration into the KDE environment. |
36 | * |
37 | * This class will attempt to find a KPart to satisfy a plugin request. |
38 | * |
39 | * @author Michael Howell <mhowell123@gmail.com> |
40 | * @author Dawit Alemayehu <adawit@kde.org> |
41 | * |
42 | * @see QWebPluginFactory |
43 | * @since 4.4 |
44 | */ |
45 | class KDEWEBKIT_EXPORT KWebPluginFactory : public QWebPluginFactory |
46 | { |
47 | Q_OBJECT |
48 | public: |
49 | /** |
50 | * Constructs a KWebPluginFactory with parent @p parent. |
51 | */ |
52 | KWebPluginFactory(QObject *parent); |
53 | |
54 | /** |
55 | * Destroys the KWebPage. |
56 | */ |
57 | ~KWebPluginFactory(); |
58 | |
59 | /** |
60 | * @reimp |
61 | * |
62 | * Reimplemented for internal reasons, the API is not affected. |
63 | * |
64 | * @see QWebPluginFactory::create |
65 | * @internal |
66 | */ |
67 | virtual QObject *create(const QString &mimeType, |
68 | const QUrl &url, |
69 | const QStringList &argumentNames, |
70 | const QStringList &argumentValues) const; |
71 | |
72 | /** |
73 | * @reimp |
74 | * |
75 | * Reimplemented for internal reasons, the API is not affected. |
76 | * |
77 | * @see QWebPluginFactory::plugins |
78 | * @internal |
79 | */ |
80 | virtual QList<Plugin> plugins() const; |
81 | |
82 | protected: |
83 | /** |
84 | * Sets @p mimeType to the content type guessed from @p url. |
85 | * |
86 | * Note that attempting to guess mime-type will not always produce the |
87 | * correct content-type. This is especially true for the HTTP protocol |
88 | * since the URL present might be for a cgi script URL instead of a static |
89 | * URL that directly points to the content. |
90 | * |
91 | * If @p mimeType is not NULL, this function will set it to the content |
92 | * type determined from @p url. |
93 | * |
94 | * @since 4.8.3 |
95 | */ |
96 | void (const QUrl& url, QString* mimeType) const; |
97 | |
98 | /** |
99 | * Returns true if the given mime-type is excluded from being used to create |
100 | * a web plugin using KDE's trader. |
101 | * |
102 | * Currently this function only returns true for mimetypes 'x-java', |
103 | * 'x-shockwave-flash', and 'futuresplash' in the 'application' category |
104 | * and everything under the 'inode' category. |
105 | * |
106 | * @since 4.8.3 |
107 | */ |
108 | bool excludedMimeType(const QString& mimeType) const; |
109 | |
110 | /** |
111 | * Returns an instance of the service associated with @p mimeType. |
112 | * |
113 | * This function uses KDE's trader to create an instance of the service |
114 | * associated with the given parameters. The parameters are the <param> |
115 | * tags of the HTML object. The name and the value attributes of these |
116 | * tags are specified by the @p argumentNames and @p argumentValues |
117 | * respectively. |
118 | * |
119 | * The @p parentWidget and @p parent parameters specify the widget to use |
120 | * as the parent of the newly created part and the parent for the part |
121 | * itself respectively. |
122 | * |
123 | * The parameters for this function mirror that of @ref QWebPluginFactory::create. |
124 | * |
125 | * @see QWebPluginFactory::create |
126 | * @since 4.8.3 |
127 | */ |
128 | KParts::ReadOnlyPart* createPartInstanceFrom(const QString& mimeType, |
129 | const QStringList &argumentNames, |
130 | const QStringList &argumentValues, |
131 | QWidget* parentWidget = 0, |
132 | QObject* parent = 0) const; |
133 | private: |
134 | class KWebPluginFactoryPrivate; |
135 | KWebPluginFactoryPrivate* const d; |
136 | }; |
137 | |
138 | #endif // KWEBPLUGINFACTORY_H |
139 | |