summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/application.cpp1
-rw-r--r--src/mainview.cpp1
-rw-r--r--src/mainwindow.cpp6
-rw-r--r--src/newtabpage.cpp (renamed from src/homepage.cpp)36
-rw-r--r--src/newtabpage.h (renamed from src/homepage.h)37
6 files changed, 44 insertions, 39 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5bd41b25..9c0ace58 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -6,7 +6,7 @@ ADD_SUBDIRECTORY( tests )
### ------- SETTING REKONQ FILES..
SET( rekonq_KDEINIT_SRCS
- homepage.cpp
+ newtabpage.cpp
previewimage.cpp
websnap.cpp
networkaccessmanager.cpp
diff --git a/src/application.cpp b/src/application.cpp
index 4b3d736d..869c23c8 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -42,7 +42,6 @@
#include "webview.h"
#include "urlbar.h"
#include "sessionmanager.h"
-#include "homepage.h"
// KDE Includes
#include <KCmdLineArgs>
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 2672216b..4b731fc8 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -40,7 +40,6 @@
#include "urlbar.h"
#include "webview.h"
#include "sessionmanager.h"
-#include "homepage.h"
// KDE Includes
#include <KUrl>
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 47d0b90d..28993fde 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -46,7 +46,7 @@
#include "sidepanel.h"
#include "urlbar.h"
#include "tabbar.h"
-#include "homepage.h"
+#include "newtabpage.h"
// Ui Includes
#include "ui_cleardata.h"
@@ -1122,8 +1122,8 @@ bool MainWindow::newTabPage(const KUrl &url)
{
kDebug() << "loading home: " << url;
WebView *w = currentTab();
- HomePage p;
- QString html = p.rekonqHomePage(url);
+ NewTabPage p;
+ QString html = p.newTabPageCode(url);
w->setHtml(html, url);
return true;
}
diff --git a/src/homepage.cpp b/src/newtabpage.cpp
index f3a987fe..f3656692 100644
--- a/src/homepage.cpp
+++ b/src/newtabpage.cpp
@@ -25,7 +25,7 @@
// Self Includes
-#include "homepage.h"
+#include "newtabpage.h"
// Auto Includes
#include "rekonq.h"
@@ -48,20 +48,20 @@
#include <QFile>
-HomePage::HomePage()
+NewTabPage::NewTabPage()
{
- m_homePagePath = KStandardDirs::locate("data", "rekonq/htmls/home.html");
+ m_htmlFilePath = KStandardDirs::locate("data", "rekonq/htmls/home.html");
}
-HomePage::~HomePage()
+NewTabPage::~NewTabPage()
{
}
-QString HomePage::rekonqHomePage(const KUrl &url)
+QString NewTabPage::newTabPageCode(const KUrl &url)
{
- QFile file(m_homePagePath);
+ QFile file(m_htmlFilePath);
bool isOpened = file.open(QIODevice::ReadOnly);
if (!isOpened)
{
@@ -69,28 +69,28 @@ QString HomePage::rekonqHomePage(const KUrl &url)
return QString("");
}
QString imagesPath = QString("file://") + KGlobal::dirs()->findResourceDir("data", "rekonq/pics/bg.png") + QString("rekonq/pics");
- QString menu = homePageMenu(url);
+ QString menu = browsingMenu(url);
QString speed;
QString title;
if(url == KUrl("rekonq:closedTabs"))
{
- speed = fillClosedTabs();
+ speed = closedTabsPage();
title = i18n("Closed Tabs");
}
if(url == KUrl("rekonq:history"))
{
- speed = fillHistory();
+ speed = historyPage();
title = i18n("History");
}
if(url == KUrl("rekonq:bookmarks"))
{
- speed = fillBookmarks();
+ speed = bookmarksPage();
title = i18n("Bookmarks");
}
if(url == KUrl("rekonq:home") || url == KUrl("rekonq:favorites"))
{
- speed = fillFavorites();
+ speed = favoritesPage();
title = i18n("Favorites");
}
@@ -105,7 +105,7 @@ QString HomePage::rekonqHomePage(const KUrl &url)
}
-QString HomePage::fillFavorites()
+QString NewTabPage::favoritesPage()
{
QStringList names = ReKonfig::previewNames();
QStringList urls = ReKonfig::previewUrls();
@@ -128,7 +128,7 @@ QString HomePage::fillFavorites()
// FIXME : port to new PreviewImage API to use...
-QString HomePage::lastVisitedSites()
+QString NewTabPage::lastVisitedPage()
{
QString last;
QList<HistoryItem> history = Application::historyManager()->history();
@@ -147,7 +147,7 @@ QString HomePage::lastVisitedSites()
}
-QString HomePage::homePageMenu(KUrl currentUrl)
+QString NewTabPage::browsingMenu(const KUrl &currentUrl)
{
QString menu;
@@ -189,7 +189,7 @@ QString HomePage::homePageMenu(KUrl currentUrl)
}
-QString HomePage::fillHistory()
+QString NewTabPage::historyPage()
{
HistoryTreeModel *model = Application::historyManager()->historyTreeModel();
@@ -220,7 +220,7 @@ QString HomePage::fillHistory()
}
-QString HomePage::fillBookmarks()
+QString NewTabPage::bookmarksPage()
{
KBookmarkGroup bookGroup = Application::bookmarkProvider()->rootGroup();
if (bookGroup.isNull())
@@ -239,7 +239,7 @@ QString HomePage::fillBookmarks()
}
-QString HomePage::createBookItem(const KBookmark &bookmark)
+QString NewTabPage::createBookItem(const KBookmark &bookmark)
{
if (bookmark.isGroup())
{
@@ -267,7 +267,7 @@ QString HomePage::createBookItem(const KBookmark &bookmark)
}
-QString HomePage::fillClosedTabs()
+QString NewTabPage::closedTabsPage()
{
QList<HistoryItem> links = Application::instance()->mainWindow()->mainView()->recentlyClosedTabs();
QString closed;
diff --git a/src/homepage.h b/src/newtabpage.h
index abc28de0..265518d2 100644
--- a/src/homepage.h
+++ b/src/newtabpage.h
@@ -24,8 +24,8 @@
* ============================================================ */
-#ifndef REKONQ_HOME_PAGE
-#define REKONQ_HOME_PAGE
+#ifndef REKONQ_NEW_TAB_PAGE
+#define REKONQ_NEW_TAB_PAGE
// KDE Includes
@@ -39,27 +39,34 @@
class KBookmark;
-class HomePage
+class NewTabPage
{
public:
- HomePage();
- ~HomePage();
+ NewTabPage();
+ ~NewTabPage();
- QString rekonqHomePage(const KUrl &url = KUrl("rekonq:home"));
+ /**
+ * This is the unique NewTabPage public method. It takes an
+ * about: url and loads the corresponding part of the
+ * new tab page
+ */
+ QString newTabPageCode(const KUrl &url = KUrl("rekonq:home"));
-private:
- QString homePageMenu(KUrl currentUrl);
+protected: // these are the function to build the new tab page
+
+ QString browsingMenu(const KUrl &currentUrl);
- QString fillFavorites();
- QString lastVisitedSites();
- QString fillHistory();
- QString fillBookmarks();
- QString fillClosedTabs();
+ QString favoritesPage();
+ QString lastVisitedPage();
+ QString historyPage();
+ QString bookmarksPage();
+ QString closedTabsPage();
+private:
QString createBookItem(const KBookmark &bookmark);
- QString m_homePagePath;
+ QString m_htmlFilePath;
};
-#endif // REKONQ_HOME_PAGE
+#endif // REKONQ_NEW_TAB_PAGE