1/***************************************************************************
2 * *
3 * Copyright 2011 Sebastian Kügler <sebas@kde.org> *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program 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 *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
19 ***************************************************************************/
20
21#include "activewebbrowser.h"
22
23
24#include <KAction>
25#include <KCmdLineArgs>
26#include <KIcon>
27#include <KRun>
28#include <KStandardAction>
29
30#include "activebrowserwindow.h"
31#include "kdeclarativewebview.h"
32#include "view.h"
33
34
35ActiveWebbrowser::ActiveWebbrowser(const KCmdLineArgs *args)
36 : KApplication()
37{
38 Q_UNUSED(args);
39 qmlRegisterType<KDeclarativeWebSettings>();
40 qmlRegisterType<KDeclarativeWebView>("org.kde.kdewebkit", 0, 1, "WebView");
41 setStartDragDistance(20);
42}
43
44ActiveWebbrowser::~ActiveWebbrowser()
45{
46}
47
48void ActiveWebbrowser::newWindow(const QString& url)
49{
50 ActiveBrowserWindow *browserWindow = new ActiveBrowserWindow(url);
51 browserWindow->setUseGL(m_useGL);
52 connect(browserWindow, SIGNAL(newWindow(QString)), SLOT(newWindow(QString)));
53 browserWindow->show();
54}
55
56void ActiveWebbrowser::setUseGL(const bool on)
57{
58 /* not switchable at runtime for now, if we want this, we can add
59 * some housekeeping for the windows, let's keep it KISS for now.
60 */
61 m_useGL = on;
62}
63
64bool ActiveWebbrowser::useGL() const
65{
66 return m_useGL;
67}
68
69#include "activewebbrowser.moc"
70