summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data/home.html25
-rw-r--r--src/newtabpage.cpp58
-rw-r--r--src/newtabpage.h4
3 files changed, 64 insertions, 23 deletions
diff --git a/src/data/home.html b/src/data/home.html
index 9cff45da..97398f9a 100644
--- a/src/data/home.html
+++ b/src/data/home.html
@@ -70,7 +70,7 @@ width: 95%;
display:table-cell;
}
-.topSide{
+.topSide {
width: 15%;
}
@@ -83,7 +83,7 @@ margin-right: auto;
}
-#actions{
+#actions {
display: table;
width:auto;
}
@@ -93,6 +93,7 @@ display: table-cell;
/*display:inline-block;*/
-webkit-transition: opacity 0.5s ease;
}
+
.link:not(.current):hover {
opacity: 0.6;
}
@@ -101,6 +102,7 @@ opacity: 0.6;
vertical-align: middle; display: inline-block;
margin:0 10px;
}
+
.link a, .link span {
color: black;
}
@@ -109,10 +111,11 @@ color: black;
margin-right: 3px; width: 16px;
}
-.current{
+.current {
border-width: 6px;
-webkit-border-image: url(%2/pics/button.png) 6 stretch stretch;
}
+
.link:not(.current){
margin: 0 10px;
padding:3px;
@@ -183,7 +186,7 @@ color:#3F7AB7;
/* -------------------------------------------------------- */
/* General */
-.folder{
+.folder {
margin-left: 2em;
margin-bottom: 0.5em;
}
@@ -191,20 +194,28 @@ margin-bottom: 0.5em;
/* -------------------------------------------------------- */
/* Downloads page */
-.download{
+.download {
margin: 1.5em 0;
}
-.download img{
+.download img {
float: left;
margin-right: 5px;
}
-.download a.greylink{
+.download a.greylink {
color:grey;
}
/* -------------------------------------------------------- */
+/* History page */
+
+.greybox {
+background: #CCC;
+padding: 5px 10px;
+}
+
+/* -------------------------------------------------------- */
/* Empty pages : in the end : need to overwrite */
#content.empty {
margin-top: 10%;
diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp
index 87d2ca5a..94a10845 100644
--- a/src/newtabpage.cpp
+++ b/src/newtabpage.cpp
@@ -62,6 +62,7 @@
NewTabPage::NewTabPage(QWebFrame *frame)
: QObject(frame)
, m_root(frame->documentElement())
+ , m_showFullHistory(false)
{
QString htmlFilePath = KStandardDirs::locate("data", "rekonq/htmls/home.html");
QString dataPath = QL1S("file://") + htmlFilePath;
@@ -100,10 +101,7 @@ void NewTabPage::generate(const KUrl &url)
ReKonfig::setPreviewNames(names);
ReKonfig::setPreviewUrls(urls);
- // Why doesn't it work well ?
- // m_root.appendInside(emptyPreview(names.length() - 1));
- // Replacing with this:
- generate(KUrl("about:favorites"));
+ loadPageForUrl(KUrl("about:favorites"));
rApp->mainWindow()->currentTab()->createPreviewSelectorBar(index);
return;
@@ -152,7 +150,7 @@ void NewTabPage::generate(const KUrl &url)
MainWindow *w = rApp->mainWindowList().at(winIndex).data();
w->mainView()->closeTab(tabIndex);
- generate(KUrl("about:tabs"));
+ loadPageForUrl(KUrl("about:tabs"));
return;
}
}
@@ -170,24 +168,43 @@ void NewTabPage::generate(const KUrl &url)
}
}
- if (url == KUrl("about:downloads/clear"))
+ // about:history links
+ if (KUrl("about:history").isParentOf(url))
{
- rApp->downloadManager()->clearDownloadsHistory();
- generate(KUrl("about:downloads"));
- return;
+ if (url.fileName() == QL1S("clear"))
+ {
+ rApp->historyManager()->clear();
+ loadPageForUrl(KUrl("about:history"));
+ return;
+ }
+
+ if (url.fileName() == QL1S("showAllItems"))
+ {
+ m_showFullHistory = true;
+ loadPageForUrl(KUrl("about:history"));
+ return;
+ }
}
- if (url == KUrl("about:history/clear"))
+
+ if (url == KUrl("about:downloads/clear"))
{
- rApp->historyManager()->clear();
- generate(KUrl("about:history"));
+ rApp->downloadManager()->clearDownloadsHistory();
+ loadPageForUrl(KUrl("about:downloads"));
return;
}
+
if (url == KUrl("about:bookmarks/edit"))
{
rApp->bookmarkManager()->slotEditBookmarks();
return;
}
+ loadPageForUrl(url);
+}
+
+
+void NewTabPage::loadPageForUrl(const KUrl &url)
+{
// webFrame can be null. See bug:282092
QWebFrame *parentFrame = qobject_cast<QWebFrame *>(parent());
if (!parentFrame)
@@ -199,8 +216,8 @@ void NewTabPage::generate(const KUrl &url)
parentFrame->setHtml(m_html);
m_root = parentFrame->documentElement().findFirst(QL1S("#content"));
-
- kDebug() << "is null? " << m_root.isNull();
+kDebug() << "IS NULL? " << m_root.isNull();
+kDebug() << "URL: " << url;
browsingMenu(url);
QString title;
@@ -243,7 +260,6 @@ void NewTabPage::generate(const KUrl &url)
}
m_root.document().findFirst(QL1S("title")).setPlainText(title);
- kDebug() << "is null find title? " << m_root.document().findFirst(QL1S("title")).isNull();
}
@@ -398,8 +414,18 @@ void NewTabPage::historyPage()
}
}
i++;
+ if (m_showFullHistory == false && (i == 2))
+ {
+ m_root.appendInside(markup(QL1S("a")));
+ m_root.lastChild().setAttribute(QL1S("class") , QL1S("greybox"));
+ m_root.lastChild().setAttribute(QL1S("href") , QL1S("about:history/showAllItems"));
+ m_root.lastChild().setPlainText(i18n("Show full History"));
+ return;
+ }
}
while (model->hasIndex(i , 0 , QModelIndex()));
+
+ m_showFullHistory = false;
}
@@ -755,7 +781,7 @@ void NewTabPage::removePreview(int index)
ReKonfig::setPreviewNames(names);
ReKonfig::setPreviewUrls(urls);
- generate(KUrl("about:favorites"));
+ loadPageForUrl(KUrl("about:favorites"));
ReKonfig::self()->writeConfig();
}
diff --git a/src/newtabpage.h b/src/newtabpage.h
index 887d3cd1..e2a86a70 100644
--- a/src/newtabpage.h
+++ b/src/newtabpage.h
@@ -71,6 +71,8 @@ private:
void downloadsPage();
void tabsPage();
+ void loadPageForUrl(const KUrl &url);
+
// --------------------------------------------------------------------------
// "low-level" functions
// we use these to create the pages over
@@ -117,6 +119,8 @@ private:
QString m_html;
QWebElement m_root;
+
+ bool m_showFullHistory;
};
#endif // REKONQ_NEW_TAB_PAGE