2
<The basic code for the web widget in Kexi forms>
3
Copyright (C) 2011 Shreya Pandit <shreya@shreyapandit.com>
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Lesser General Public License for more details.
15
You should have received a copy of the GNU Lesser General Public
16
License along with this library; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
#include "WebBrowserFactory.h"
22
#include <formeditor/WidgetInfo.h>
23
#include <formeditor/formIO.h>
24
#include "kexidataawarewidgetinfo.h"
25
#include "WebBrowserWidget.h"
29
#include <KLocalizedString>
32
#include <QVariantList>
35
KEXI_PLUGIN_FACTORY(WebBrowserFactory, "kexiforms_webbrowserwidgetplugin.json")
37
WebBrowserFactory::WebBrowserFactory(QObject* parent, const QVariantList& args)
38
: KexiDBFactoryBase(parent)
41
KexiDataAwareWidgetInfo* webBrowser = new KexiDataAwareWidgetInfo(this);
42
webBrowser->setIconName(koIconName("web_browser"));
43
webBrowser->setClassName("WebBrowserWidget");
44
webBrowser->setName(xi18n("Web Browser"));
45
webBrowser->setNamePrefix(
46
xi18nc("A prefix for identifiers of web browser widgets. Based on that, identifiers such as "
47
"webBrowser1, webBrowser2 are generated. "
48
"This string can be used to refer the widget object as variables in programming "
49
"languages or macros so it must _not_ contain white spaces and non latin1 characters, "
50
"should start with lower case letter and if there are subsequent words, these should "
51
"start with upper case letter. Example: smallCamelCase. "
52
"Moreover, try to make this prefix as short as possible.",
54
webBrowser->setDescription(xi18n("Web widget with browsing features."));
55
webBrowser->setInlineEditingEnabledWhenDataSourceSet(false);
58
setPropertyDescription("textScale", xi18n("Text Scale"));
59
setPropertyDescription("zoomFactor", xi18n("Zoom Factor"));
60
setPropertyDescription("url", xi18n("Url"));
63
WebBrowserFactory::~WebBrowserFactory()
68
QWidget* WebBrowserFactory::createWidget(const QByteArray& classname,
71
KFormDesigner::Container* container,
72
KFormDesigner::WidgetFactory::CreateWidgetOptions options)
76
QString text(container->form()->library()->textForWidgetName(name, classname));
78
if (classname == "WebBrowserWidget")
79
w = new WebBrowserWidget(parent);
82
w->setObjectName(name);
83
qDebug() << w << w->objectName() << "created";
86
qWarning() << "w == 0";
90
bool WebBrowserFactory::createMenuActions(const QByteArray &classname, QWidget *w,
91
QMenu *menu, KFormDesigner::Container *container)
100
bool WebBrowserFactory::startInlineEditing(InlineEditorCreationArguments& args)
106
bool WebBrowserFactory::previewWidget(const QByteArray &classname,
107
QWidget *widget, KFormDesigner::Container *)
114
#include "WebBrowserFactory.moc"