From 7f5321462a87329b0429b1c34274bef40eef510b Mon Sep 17 00:00:00 2001 From: matgic78 Date: Mon, 5 Apr 2010 11:26:02 +0200 Subject: NewTabPage : add buttons in #actions : "Clear Private Data" for history and bookmarks, "Edit Downloads" --- src/data/home.html | 4 ++-- src/newtabpage.cpp | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/data/home.html b/src/data/home.html index 4afbf2ed..97bec22d 100644 --- a/src/data/home.html +++ b/src/data/home.html @@ -62,12 +62,12 @@ border-width: 5px; #navigation { -webkit-border-image: url(%2/bg2.png) 12 12 12 12 stretch stretch; -max-width: 75%; +max-width: 55%; } #actions, #balance { margin-top: 12px; -width: 10%; +width: 20%; } #actions { diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp index 3e21d0fe..e2837f94 100644 --- a/src/newtabpage.cpp +++ b/src/newtabpage.cpp @@ -115,6 +115,17 @@ void NewTabPage::generate(const KUrl &url) return; } } + if(url.fileName() == QString("clear")) + { + Application::instance()->mainWindow()->actionByName("clear_private_data")->trigger(); + generate(QString("about:" + url.directory())); + return; + } + if(url == KUrl("about:bookmarks/edit")) + { + Application::bookmarkProvider()->bookmarkManager()->slotEditBookmarks(); + return; + } QWebPage *page = m_root.webFrame()->page(); page->mainFrame()->setHtml(m_html); @@ -369,6 +380,13 @@ void NewTabPage::historyPage() { m_root.addClass("history"); + QWebElement clearData = markup(".link"); + clearData.findFirst("a").setAttribute("href", "about:history/clear"); + QString iconPath = QString("file:///" + KIconLoader::global()->iconPath("edit-clear", KIconLoader::SizeSmall || KIconLoader::Small)); + clearData.findFirst("img").setAttribute("src" , iconPath ); + clearData.findFirst("span").appendInside(i18n("Clear Private Data")); + m_root.document().findFirst("#actions").appendInside(clearData); + HistoryTreeModel *model = Application::historyManager()->historyTreeModel(); int i = 0; @@ -401,6 +419,13 @@ void NewTabPage::bookmarksPage() { m_root.addClass("bookmarks"); + QWebElement editBookmarks = markup(".link"); + editBookmarks.findFirst("a").setAttribute("href", "about:bookmarks/edit"); + QString iconPath = QString("file:///" + KIconLoader::global()->iconPath("bookmarks-organize", KIconLoader::SizeSmall || KIconLoader::Small)); + editBookmarks.findFirst("img").setAttribute("src" , iconPath); + editBookmarks.findFirst("span").appendInside(i18n("Edit Bookmarks")); + m_root.document().findFirst("#actions").appendInside(editBookmarks); + KBookmarkGroup bookGroup = Application::bookmarkProvider()->rootGroup(); if (bookGroup.isNull()) { @@ -485,6 +510,13 @@ QString NewTabPage::checkTitle(const QString &title) void NewTabPage::downloadsPage() { m_root.addClass("downloads"); + + QWebElement clearData = markup(".link"); + clearData.findFirst("a").setAttribute("href", "about:downloads/clear"); + QString iconPath = QString("file:///" + KIconLoader::global()->iconPath("edit-clear", KIconLoader::SizeSmall || KIconLoader::Small)); + clearData.findFirst("img").setAttribute("src" , iconPath ); + clearData.findFirst("span").appendInside(i18n("Clear Private Data")); + m_root.document().findFirst("#actions").appendInside(clearData); DownloadList list = Application::historyManager()->downloads(); -- cgit v1.2.1