not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / plasma / applets / webbrowser / webbrowser.h
blobde108e2d772b6df6a4546c94cec1c9a8905ab181
1 /***************************************************************************
2 * Copyright (C) 2008 by Marco Martin <notmart@gmail.com> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
18 ***************************************************************************/
20 #ifndef WEBBROWSER_H
21 #define WEBBROWSER_H
23 #include <Plasma/PopupApplet>
24 #include <Plasma/DataEngine>
26 #include "ui_webbrowserconfig.h"
28 class QGraphicsLinearLayout;
29 class QStandardItemModel;
30 class QStandardItem;
31 class QTimer;
32 class KUrlPixmapProvider;
33 class KUrl;
34 class KCompletion;
35 class KBookmarkManager;
36 class KBookmarkGroup;
37 class QModelIndex;
38 class QAction;
39 class BookmarksDelegate;
40 class BookmarkItem;
42 namespace Plasma
44 class IconWidget;
45 class Meter;
46 class HistoryComboBox;
47 class WebView;
48 class TreeView;
49 class Slider;
52 class WebBrowser : public Plasma::PopupApplet
54 Q_OBJECT
55 public:
56 WebBrowser(QObject *parent, const QVariantList &args);
57 ~WebBrowser();
59 QGraphicsWidget *graphicsWidget();
61 //TODO: put in a separate file
62 enum BookmarkRoles
64 UrlRole = Qt::UserRole+1,
65 BookmarkRole = Qt::UserRole+2
68 public Q_SLOTS:
69 void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data);
71 protected:
72 void saveState(KConfigGroup &cg) const;
73 Plasma::IconWidget *addTool(const QString &iconString, QGraphicsLinearLayout *layout);
74 void createConfigurationInterface(KConfigDialog *parent);
76 protected Q_SLOTS:
77 void back();
78 void forward();
79 void reload();
80 void returnPressed();
81 void urlChanged(const QUrl &url);
82 void comboTextChanged(const QString &string);
83 void addBookmark();
84 void removeBookmark(const QModelIndex &index);
85 void removeBookmark();
86 void bookmarksToggle();
87 void bookmarkClicked(const QModelIndex &index);
88 void zoom(int value);
89 void loadProgress(int progress);
90 void bookmarksModelInit();
91 void configAccepted();
93 private:
94 void fillGroup(BookmarkItem *parentItem, const KBookmarkGroup &group);
96 QGraphicsLinearLayout *m_layout;
97 QGraphicsLinearLayout *m_toolbarLayout;
98 QGraphicsLinearLayout *m_statusbarLayout;
99 Plasma::WebView *m_browser;
100 KUrl m_url;
101 int m_verticalScrollValue;
102 int m_horizontalScrollValue;
103 KUrlPixmapProvider *m_pixmapProvider;
104 KCompletion *m_completion;
105 KBookmarkManager *m_bookmarkManager;
106 QStandardItemModel *m_bookmarkModel;
107 Plasma::TreeView *m_bookmarksView;
109 QTimer *m_autoRefreshTimer;
110 bool m_autoRefresh;
111 int m_autoRefreshInterval;
113 QGraphicsWidget *m_graphicsWidget;
115 Plasma::HistoryComboBox *m_historyCombo;
116 BookmarksDelegate *m_bookmarksDelegate;
118 Plasma::IconWidget *m_back;
119 Plasma::IconWidget *m_forward;
121 Plasma::IconWidget *m_go;
122 QAction *m_goAction;
123 QAction *m_reloadAction;
125 Plasma::IconWidget *m_addBookmark;
126 QAction *m_addBookmarkAction;
127 QAction *m_removeBookmarkAction;
129 Plasma::IconWidget *m_organizeBookmarks;
130 Plasma::IconWidget *m_stop;
131 Plasma::Meter *m_progress;
132 Plasma::Slider *m_zoom;
134 Ui::WebBrowserConfig ui;
137 K_EXPORT_PLASMA_APPLET(webbrowser, WebBrowser)
139 #endif