summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/application.cpp2
-rw-r--r--src/homepage.cpp35
-rw-r--r--src/homepage.h3
-rw-r--r--src/mainview.cpp9
-rw-r--r--src/mainview.h3
5 files changed, 45 insertions, 7 deletions
diff --git a/src/application.cpp b/src/application.cpp
index f16b831d..6719d456 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -433,7 +433,7 @@ MainWindowList Application::mainWindowList()
bool Application::homePage(const KUrl &url)
{
- if ( url == KUrl("rekonq:lastSites")
+ if ( url == KUrl("rekonq:closedTabs")
|| url == KUrl("rekonq:history")
|| url == KUrl("rekonq:bookmarks")
|| url == KUrl("rekonq:favorites")
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;
+}
diff --git a/src/homepage.h b/src/homepage.h
index 73bb5859..7d62f50a 100644
--- a/src/homepage.h
+++ b/src/homepage.h
@@ -55,7 +55,8 @@ private:
QString lastVisitedSites();
QString fillHistory();
QString fillBookmarks();
-
+ QString fillRecentlyClosedTabs();
+
QString createBookItem(const KBookmark &bookmark);
QString m_homePagePath;
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 0abf6996..3c78a0f6 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -179,6 +179,8 @@ void MainView::clear()
// What exactly do we need to clear here?
m_urlBar->clearHistory();
m_urlBar->clear();
+
+ m_recentlyClosedTabs.clear();
}
@@ -411,6 +413,7 @@ void MainView::slotCloseTab(int index)
return;
}
hasFocus = tab->hasFocus();
+ m_recentlyClosedTabs.prepend(tab->url());
}
QWidget *webView = widget(index);
@@ -569,3 +572,9 @@ QLabel *MainView::animatedLoading(int index, bool addMovie)
m_tabBar->setTabButton(index, QTabBar::LeftSide, label);
return label;
}
+
+
+KUrl::List MainView::recentlyClosedTabs()
+{
+ return m_recentlyClosedTabs;
+}
diff --git a/src/mainview.h b/src/mainview.h
index 48e0b58b..96710919 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -89,6 +89,7 @@ public:
*/
WebView *newWebView(bool focused = true, bool nearParent = false);
+ KUrl::List recentlyClosedTabs();
signals:
// tab widget signals
@@ -155,6 +156,8 @@ private:
QString m_loadingGitPath;
int m_currentTabIndex;
+
+ KUrl::List m_recentlyClosedTabs;
};
#endif // MAINVIEW_H