Applets
webbrowser.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 2008 by Marco Martin <notmart@gmail.com> * 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License as published by * 00006 * the Free Software Foundation; either version 2 of the License, or * 00007 * (at your option) any later version. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU General Public License * 00015 * along with this program; if not, write to the * 00016 * Free Software Foundation, Inc., * 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 00018 ***************************************************************************/ 00019 00020 #ifndef WEBBROWSER_H 00021 #define WEBBROWSER_H 00022 00023 #include <Plasma/PopupApplet> 00024 #include <Plasma/DataEngine> 00025 00026 #include "ui_webbrowserconfig.h" 00027 00028 class QGraphicsLinearLayout; 00029 class QStandardItemModel; 00030 class QStandardItem; 00031 class QTimer; 00032 class KUrlPixmapProvider; 00033 class KUrl; 00034 class KCompletion; 00035 class KBookmarkManager; 00036 class KBookmarkGroup; 00037 class QModelIndex; 00038 class QAction; 00039 class BookmarksDelegate; 00040 class BookmarkItem; 00041 00042 namespace Plasma 00043 { 00044 class IconWidget; 00045 class Meter; 00046 class HistoryComboBox; 00047 class WebView; 00048 class TreeView; 00049 class Slider; 00050 } 00051 00052 class WebBrowser : public Plasma::PopupApplet 00053 { 00054 Q_OBJECT 00055 public: 00056 WebBrowser(QObject *parent, const QVariantList &args); 00057 ~WebBrowser(); 00058 00059 QGraphicsWidget *graphicsWidget(); 00060 00061 //TODO: put in a separate file 00062 enum BookmarkRoles 00063 { 00064 UrlRole = Qt::UserRole+1, 00065 BookmarkRole = Qt::UserRole+2 00066 }; 00067 00068 public Q_SLOTS: 00069 void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data); 00070 00071 protected: 00072 void saveState(KConfigGroup &cg) const; 00073 Plasma::IconWidget *addTool(const QString &iconString, QGraphicsLinearLayout *layout); 00074 void createConfigurationInterface(KConfigDialog *parent); 00075 00076 protected Q_SLOTS: 00077 void back(); 00078 void forward(); 00079 void reload(); 00080 void returnPressed(); 00081 void urlChanged(const QUrl &url); 00082 void comboTextChanged(const QString &string); 00083 void addBookmark(); 00084 void removeBookmark(const QModelIndex &index); 00085 void removeBookmark(); 00086 void bookmarksToggle(); 00087 void bookmarkClicked(const QModelIndex &index); 00088 void zoom(int value); 00089 void loadProgress(int progress); 00090 void bookmarksModelInit(); 00091 void configAccepted(); 00092 00093 private: 00094 void fillGroup(BookmarkItem *parentItem, const KBookmarkGroup &group); 00095 00096 QGraphicsLinearLayout *m_layout; 00097 QGraphicsLinearLayout *m_toolbarLayout; 00098 QGraphicsLinearLayout *m_statusbarLayout; 00099 Plasma::WebView *m_browser; 00100 KUrl m_url; 00101 int m_verticalScrollValue; 00102 int m_horizontalScrollValue; 00103 KUrlPixmapProvider *m_pixmapProvider; 00104 KCompletion *m_completion; 00105 KBookmarkManager *m_bookmarkManager; 00106 QStandardItemModel *m_bookmarkModel; 00107 Plasma::TreeView *m_bookmarksView; 00108 00109 QTimer *m_autoRefreshTimer; 00110 bool m_autoRefresh; 00111 int m_autoRefreshInterval; 00112 00113 QGraphicsWidget *m_graphicsWidget; 00114 00115 Plasma::HistoryComboBox *m_historyCombo; 00116 BookmarksDelegate *m_bookmarksDelegate; 00117 00118 Plasma::IconWidget *m_back; 00119 Plasma::IconWidget *m_forward; 00120 00121 Plasma::IconWidget *m_go; 00122 QAction *m_goAction; 00123 QAction *m_reloadAction; 00124 00125 Plasma::IconWidget *m_addBookmark; 00126 QAction *m_addBookmarkAction; 00127 QAction *m_removeBookmarkAction; 00128 00129 Plasma::IconWidget *m_organizeBookmarks; 00130 Plasma::IconWidget *m_stop; 00131 Plasma::Meter *m_progress; 00132 Plasma::Slider *m_zoom; 00133 00134 Ui::WebBrowserConfig ui; 00135 }; 00136 00137 K_EXPORT_PLASMA_APPLET(webbrowser, WebBrowser) 00138 00139 #endif