summaryrefslogtreecommitdiff
path: root/src/homepage.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-10-11 11:57:33 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-10-11 11:57:33 +0200
commitf0b55360c6ba8da48098362aa85ca88fa293b5a1 (patch)
treec3e8b480be8d7dae5731c0acc064845a413c651f /src/homepage.cpp
parentMerge commit 'refs/merge-requests/1750' of git://gitorious.org/rekonq/mainlin... (diff)
downloadrekonq-f0b55360c6ba8da48098362aa85ca88fa293b5a1.tar.xz
Restored recently closed tabs
I'm not a big fan of this implementation, but modifying history for this is impossible (no sense) and storing it somewhere.. don't know Perhaps someone has some better ideas here :)
Diffstat (limited to 'src/homepage.cpp')
-rw-r--r--src/homepage.cpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/homepage.cpp b/src/homepage.cpp
index 3cc908a9..398308be 100644
--- a/src/homepage.cpp
+++ b/src/homepage.cpp
@@ -75,9 +75,9 @@ QString HomePage::rekonqHomePage(const KUrl &url)
QString menu = homePageMenu(url);
QString speed;
- if(url == KUrl("rekonq:lastSites"))
+ if(url == KUrl("rekonq:closedTabs"))
{
- speed = lastVisitedSites();
+ speed = fillRecentlyClosedTabs();
}
if(url == KUrl("rekonq:history"))
{
@@ -182,11 +182,11 @@ QString HomePage::homePageMenu(KUrl currentUrl)
menu += "Favorites</a></div>";
menu += "<div class=\"link";
- if(currentUrl == "rekonq:lastSites")
+ if(currentUrl == "rekonq:closedTabs")
menu += " current";
- menu += "\"><a href=\"rekonq:lastSites\">";
+ menu += "\"><a href=\"rekonq:closedTabs\">";
menu += "<img src=\"file:///" + loader->iconPath("edit-undo", KIconLoader::Desktop) + "\" />";
- menu += "Last Visited</a></div>";
+ menu += "Closed Tabs</a></div>";
menu += "<div class=\"link";
if(currentUrl == "rekonq:bookmarks")
@@ -284,3 +284,28 @@ QString HomePage::createBookItem(const KBookmark &bookmark)
books += "<a href=\"" + bookmark.url().prettyUrl() + "\">" + bookmark.text() + "</a><br />";
return books;
}
+
+
+QString HomePage::fillRecentlyClosedTabs()
+{
+ KUrl::List links = Application::instance()->mainWindow()->mainView()->recentlyClosedTabs();
+ QString closed;
+
+ Q_FOREACH( const KUrl &url, links)
+ {
+ QString text = url.prettyUrl();
+ if(text.length() > 20)
+ {
+ text.truncate(17);
+ text += "...";
+ }
+ closed += "<div class=\"thumbnail\">";
+ closed += "<object type=\"application/image-preview\" data=\"";
+ closed += url.path() + "\" width=\"200\">";
+ closed += "</object>";
+ closed += "<br />";
+ closed += "<a href=\"" + url.path() + "\">" + text + "</a></div>";
+ }
+
+ return closed;
+}