diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/data/home.html | 18 | ||||
-rw-r--r-- | src/rekonqpage/newtabpage.cpp | 24 |
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); } } |