summaryrefslogtreecommitdiff
path: root/src/rekonqpage/newtabpage.h
diff options
context:
space:
mode:
authormatgic78 <matgic78@gmail.com>2009-12-09 17:12:38 +0100
committermatgic78 <matgic78@gmail.com>2009-12-09 17:12:38 +0100
commit66836b1ca6d8d5dfcdf4d48dabc51b7709d6e456 (patch)
tree7d827b6b90920d92bb2b618af8acc9541208da94 /src/rekonqpage/newtabpage.h
parentrekonq 0.3.19 (diff)
downloadrekonq-66836b1ca6d8d5dfcdf4d48dabc51b7709d6e456.tar.xz
Rewrite NewTabPage to use QWebElement for page generation
Diffstat (limited to 'src/rekonqpage/newtabpage.h')
-rw-r--r--src/rekonqpage/newtabpage.h36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/rekonqpage/newtabpage.h b/src/rekonqpage/newtabpage.h
index 2d8d50bd..62baf79e 100644
--- a/src/rekonqpage/newtabpage.h
+++ b/src/rekonqpage/newtabpage.h
@@ -28,12 +28,16 @@
#define REKONQ_NEW_TAB_PAGE
+// rekonq Includes
+#include <webpage.h>
+
// KDE Includes
#include <KUrl>
// Qt Includes
#include <QtCore/QObject>
#include <QtCore/QString>
+#include <QWebElement>
// Forward Includes
class KBookmark;
@@ -43,7 +47,7 @@ class NewTabPage
{
public:
- NewTabPage();
+ NewTabPage(WebPage *page);
~NewTabPage();
/**
@@ -51,22 +55,32 @@ public:
* about: url and loads the corresponding part of the
* new tab page
*/
- QString newTabPageCode(const KUrl &url = KUrl("about:home"));
+ void generate(const KUrl &url = KUrl("about:home"));
protected: // these are the function to build the new tab page
-
- QString browsingMenu(const KUrl &currentUrl);
+ void browsingMenu(const KUrl &currentUrl);
- QString favoritesPage();
- QString lastVisitedPage();
- QString historyPage();
- QString bookmarksPage();
- QString closedTabsPage();
+ void favoritesPage();
+ //QString lastVisitedPage();
+ void historyPage();
+ void bookmarksPage();
+ void closedTabsPage();
private:
- QString createBookItem(const KBookmark &bookmark);
+ void createBookItem(const KBookmark &bookmark, QWebElement parent);
+
+ /** This function helps to get faster a new markup of one type,it isn't easy to create one with QWebElement.
+ It gets it in the #models div of home.html.
+ It works for all elements defined here.
+ */
+ inline QWebElement markup(QString selector)
+ {
+ return m_root.document().findFirst("#models > " + selector).clone();
+ }
- QString m_htmlFilePath;
+ QString m_html;
+
+ QWebElement m_root;
};
#endif // REKONQ_NEW_TAB_PAGE