summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-03-09 09:04:16 +0100
committerAndrea Diamantini <adjam7@gmail.com>2013-03-09 09:04:16 +0100
commit3cbf37bf33a4c3087ac12353eeb4af80fc1c463d (patch)
tree71bf83e36f9fdb9f00c3064f5748517c00d3447f
parentRespect hovering settings (diff)
downloadrekonq-3cbf37bf33a4c3087ac12353eeb4af80fc1c463d.tar.xz
Add toggle ability to bk folder in bk page
BUG: 270191
-rw-r--r--src/data/home.html18
-rw-r--r--src/rekonqpage/newtabpage.cpp24
2 files changed, 36 insertions, 6 deletions
diff --git a/src/data/home.html b/src/data/home.html
index 8bcbdf26..4f4eb7ba 100644
--- a/src/data/home.html
+++ b/src/data/home.html
@@ -320,6 +320,24 @@ input {
</style>
+
+<script type="text/javascript">
+function toggleChildren(id) {
+
+ var elem = document.getElementById(id);
+ if(elem)
+ {
+
+ if(elem.style.display != "none")
+ elem.style.display = "none";
+
+ else
+ elem.style.display = "block";
+ }
+}
+</script>
+
+
</head>
<body>
diff --git a/src/rekonqpage/newtabpage.cpp b/src/rekonqpage/newtabpage.cpp
index 547fcdf9..c1a1f248 100644
--- a/src/rekonqpage/newtabpage.cpp
+++ b/src/rekonqpage/newtabpage.cpp
@@ -542,12 +542,18 @@ void NewTabPage::bookmarksPage()
m_root.appendInside(markup(QL1S(".bookmarkfolder")));
QWebElement rootFolder = m_root.lastChild();
- rootFolder.appendInside(markup(QL1S("h4")));
- rootFolder.lastChild().setPlainText(i18n("Unsorted"));
+ rootFolder.appendInside(markup(QL1S("a")));
+ rootFolder.lastChild().setAttribute(QL1S("href"), QL1S("javascript: toggleChildren(\'Unsorted\')"));
+ QWebElement titleElement = rootFolder.lastChild();
+ titleElement.appendInside(markup(QL1S("h4")));
+ titleElement.lastChild().setPlainText(i18n("Unsorted"));
+
+ rootFolder.appendInside(markup(QL1S("div")));
+ rootFolder.lastChild().setAttribute(QL1S("id"), QL1S("Unsorted"));
while (!bookmark.isNull())
{
- createBookmarkItem(bookmark, rootFolder);
+ createBookmarkItem(bookmark, rootFolder.lastChild());
bookmark = bookGroup.next(bookmark);
}
}
@@ -906,12 +912,18 @@ void NewTabPage::createBookmarkGroup(const KBookmark &bookmark, QWebElement pare
parent.appendInside(markup(QL1S(".bookmarkfolder")));
QWebElement folder = parent.lastChild();
- folder.appendInside(markup(QL1S("h4")));
- folder.lastChild().setPlainText(group.fullText());
+ folder.appendInside(markup(QL1S("a")));
+ folder.lastChild().setAttribute(QL1S("href"), QL1S("javascript: toggleChildren(\'") + group.fullText() + QL1S("\')"));
+ QWebElement titleElement = folder.lastChild();
+ titleElement.appendInside(markup(QL1S("h4")));
+ titleElement.lastChild().setPlainText(group.fullText());
+
+ folder.appendInside(markup(QL1S("div")));
+ folder.lastChild().setAttribute(QL1S("id"), group.fullText());
while (!bm.isNull())
{
- createBookmarkItem(bm, folder);
+ createBookmarkItem(bm, folder.lastChild());
bm = group.next(bm);
}
}