diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2011-12-12 18:25:18 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-12-12 18:25:18 +0100 |
commit | 6885b2d1a51dff26fd4286d01fa71d5c39ed7eb9 (patch) | |
tree | 028551c5a06945113c66774e064801f5e389cc50 | |
parent | Option to open links from external apps in new window (diff) | |
download | rekonq-6885b2d1a51dff26fd4286d01fa71d5c39ed7eb9.tar.xz |
Small cleanup in history pages
- created a "general" folder css class
- truncated links titles longer than 100 chars
- improved upper margin in titles
-rw-r--r-- | src/data/home.html | 8 | ||||
-rw-r--r-- | src/newtabpage.cpp | 38 |
2 files changed, 29 insertions, 17 deletions
diff --git a/src/data/home.html b/src/data/home.html index df8f4092..13607fb4 100644 --- a/src/data/home.html +++ b/src/data/home.html @@ -33,7 +33,7 @@ margin: 0 1% 2% 1%; h3 { border-bottom-width: 1px; -webkit-border-image: url(%2/category.png) 1 1 1 1 stretch stretch; -padding: 0.2em; margin: 0.5em 0; +padding: 0.2em; margin: 1.5em 0 0.5em; font: normal bold 1em; } @@ -169,9 +169,9 @@ color:#3F7AB7; } /* -------------------------------------------------------- */ -/* Bookmarks page */ +/* General */ -.bookfolder{ +.folder{ margin-left: 2em; margin-bottom: 0.5em; } @@ -241,7 +241,7 @@ text-align: center; <a></a> <br /> <img /> - <p class="bookfolder"></p> + <p class="folder"></p> </div> </body> diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp index 52b83bbd..f8d8976d 100644 --- a/src/newtabpage.cpp +++ b/src/newtabpage.cpp @@ -418,6 +418,8 @@ void NewTabPage::historyPage() int i = 0; QString faviconsDir = KStandardDirs::locateLocal("cache" , "favicons/" , true); QString icon = QL1S("file://") + KGlobal::dirs()->findResource("icon", "oxygen/16x16/mimetypes/text-html.png"); + const int maxTextSize = 103; + const int truncateSize = 100; do { QModelIndex index = model->index(i, 0, QModelIndex()); @@ -426,6 +428,8 @@ void NewTabPage::historyPage() m_root.appendInside(markup(QL1S("h3"))); m_root.lastChild().setPlainText(index.data().toString()); + m_root.appendInside(markup(QL1S(".folder"))); + QWebElement little = m_root.lastChild(); for (int j = 0; j < model->rowCount(index); ++j) { QModelIndex son = model->index(j, 0, index); @@ -435,17 +439,25 @@ void NewTabPage::historyPage() if (QFile::exists(b)) icon = QL1S("file://") + b; - m_root.appendInside(son.data(HistoryModel::DateTimeRole).toDateTime().toString("hh:mm")); - m_root.appendInside(QL1S(" ")); - m_root.appendInside(markup(QL1S("img"))); - m_root.lastChild().setAttribute(QL1S("src"), icon); - m_root.lastChild().setAttribute(QL1S("width"), QL1S("16")); - m_root.lastChild().setAttribute(QL1S("height"), QL1S("16")); - m_root.appendInside(QL1S(" ")); - m_root.appendInside(markup(QL1S("a"))); - m_root.lastChild().setAttribute(QL1S("href") , u.url()); - m_root.lastChild().appendInside(son.data().toString()); - m_root.appendInside(QL1S("<br />")); + little.appendInside(son.data(HistoryModel::DateTimeRole).toDateTime().toString("hh:mm")); + little.appendInside(QL1S(" ")); + little.appendInside(markup(QL1S("img"))); + little.lastChild().setAttribute(QL1S("src"), icon); + little.lastChild().setAttribute(QL1S("width"), QL1S("16")); + little.lastChild().setAttribute(QL1S("height"), QL1S("16")); + little.appendInside(QL1S(" ")); + little.appendInside(markup(QL1S("a"))); + little.lastChild().setAttribute(QL1S("href") , u.url()); + + QString shownUrl = son.data().toString(); + if (shownUrl.length() > maxTextSize) + { + shownUrl.truncate(truncateSize); + shownUrl += QL1S("..."); + } + little.lastChild().appendInside(shownUrl); + + little.appendInside(QL1S("<br />")); } } i++; @@ -491,10 +503,10 @@ void NewTabPage::createBookItem(const KBookmark &bookmark, QWebElement parent) KBookmark bm = group.first(); parent.appendInside(markup(QL1S("h3"))); parent.lastChild().setPlainText(group.fullText()); - parent.appendInside(markup(QL1S(".bookfolder"))); + parent.appendInside(markup(QL1S(".folder"))); while (!bm.isNull()) { - createBookItem(bm, parent.lastChild()); // it is .bookfolder + createBookItem(bm, parent.lastChild()); // it is .folder bm = group.next(bm); } } |