summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-01-22 23:37:27 +0100
committerAndrea Diamantini <adjam7@gmail.com>2013-01-22 23:37:27 +0100
commitf610d888cc1738ed94cc6286db65b6b40e8e1c4e (patch)
tree9a4d895e74507099443e4a5d3799fe69b63c3272 /src
parentSet non null border in the rekonq pages (diff)
downloadrekonq-f610d888cc1738ed94cc6286db65b6b40e8e1c4e.tar.xz
History page, added ability to remove items from
Diffstat (limited to 'src')
-rw-r--r--src/data/home.html41
-rw-r--r--src/history/historymanager.cpp12
-rw-r--r--src/history/historymanager.h1
-rw-r--r--src/rekonqpage/newtabpage.cpp42
4 files changed, 83 insertions, 13 deletions
diff --git a/src/data/home.html b/src/data/home.html
index e8bcd768..8bcbdf26 100644
--- a/src/data/home.html
+++ b/src/data/home.html
@@ -191,7 +191,7 @@ input {
}
.button img {
- display: inline-block;
+ display: inline;
width: 16px;
height: 16px;
opacity: 0;
@@ -277,11 +277,38 @@ input {
padding: 5px 10px;
}
+
+.greytext {
+ color: gray;
+ display: inline;
+}
+
.historyfolder {
margin-left: 4em;
margin-bottom: 1em;
}
+.historyitem {
+ display: inline;
+}
+
+.historyitem .button img:hover {
+ opacity: 1;
+}
+
+.historyitem:hover .preview {
+ opacity: 0.6;
+}
+
+.historyitem:hover .button img {
+ opacity: 0.4;
+ -webkit-transition: opacity 0.8s ease-out;
+}
+
+.historyitem .button img:hover {
+ opacity: 1;
+}
+
/* -------------------------------------------------------- */
/* Empty pages : in the end : need to overwrite */
@@ -319,6 +346,8 @@ elements creation, cloning one of these.
<span></span>
</a>
</div>
+
+<!-- The thumbnail class, used in the favorites page -->
<div class="thumbnail">
<div class ="thumb-inner">
<a>
@@ -333,6 +362,16 @@ elements creation, cloning one of these.
</div>
</div>
</div>
+
+<!-- An history item -->
+ <div class="historyitem">
+ <div class="greytext"></div>
+ &nbsp;&nbsp;<img />
+ &nbsp;&nbsp;<a></a>
+ <a class="button"><img /></a>
+ </div>
+
+<!-- some spare elements -->
<h3></h3>
<h4></h4>
<a></a>
diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp
index 2b84ddc8..2fab9cf1 100644
--- a/src/history/historymanager.cpp
+++ b/src/history/historymanager.cpp
@@ -244,6 +244,18 @@ void HistoryManager::removeHistoryEntry(const KUrl &url, const QString &title)
}
+void HistoryManager::removeHistoryLocationEntry(int value)
+{
+ if (value < 0)
+ return;
+
+ HistoryItem item = m_history.at(value);
+ m_lastSavedUrl.clear();
+ m_history.removeOne(item);
+ emit entryRemoved(item);
+}
+
+
QList<HistoryItem> HistoryManager::find(const QString &text)
{
QList<HistoryItem> list;
diff --git a/src/history/historymanager.h b/src/history/historymanager.h
index c1e9f1cd..a618c672 100644
--- a/src/history/historymanager.h
+++ b/src/history/historymanager.h
@@ -123,6 +123,7 @@ public:
bool historyContains(const QString &url) const;
void addHistoryEntry(const KUrl &url, const QString &title);
void removeHistoryEntry(const KUrl &url, const QString &title = QString());
+ void removeHistoryLocationEntry(int value);
QList<HistoryItem> find(const QString &text);
diff --git a/src/rekonqpage/newtabpage.cpp b/src/rekonqpage/newtabpage.cpp
index fa8020fe..5de1a6e4 100644
--- a/src/rekonqpage/newtabpage.cpp
+++ b/src/rekonqpage/newtabpage.cpp
@@ -239,6 +239,13 @@ void NewTabPage::generate(const KUrl &url)
return;
}
+ if (url.fileName() == QL1S("remove"))
+ {
+ int value = url.queryItemValue(QL1S("location")).toInt();
+ HistoryManager::self()->removeHistoryLocationEntry(value);
+ loadPageForUrl(KUrl("about:history"));
+ return;
+ }
}
// about:downloads links
@@ -499,31 +506,42 @@ void NewTabPage::historyPage(const QString & filter)
m_root.lastChild().setPlainText(index.data().toString());
m_root.appendInside(markup(QL1S(".historyfolder")));
- QWebElement little = m_root.lastChild();
+ QWebElement historyFolderElement = m_root.lastChild();
for (int j = 0; j < proxy->rowCount(index); ++j)
{
QModelIndex son = proxy->index(j, 0, index);
KUrl u = son.data(HistoryModel::UrlStringRole).toUrl();
- little.appendInside(son.data(HistoryModel::DateTimeRole).toDateTime().toString("hh:mm"));
- little.appendInside(QL1S("&nbsp;&nbsp;"));
- little.appendInside(markup(QL1S("img")));
- little.lastChild().setAttribute(QL1S("src"), IconManager::self()->iconPathForUrl(u));
- little.lastChild().setAttribute(QL1S("width"), QL1S("16"));
- little.lastChild().setAttribute(QL1S("height"), QL1S("16"));
- little.appendInside(QL1S("&nbsp;&nbsp;"));
- little.appendInside(markup(QL1S("a")));
- little.lastChild().setAttribute(QL1S("href") , u.url());
+ historyFolderElement.appendInside(markup(QL1S(".historyitem")));
+ QWebElement item = historyFolderElement.lastChild();
+
+ item.findFirst(QL1S(".greytext")).setPlainText( son.data(HistoryModel::DateTimeRole).toDateTime().toString("hh:mm") );
+ QWebElement iconElement = item.findFirst(QL1S("img"));
+ iconElement.setAttribute(QL1S("src"), IconManager::self()->iconPathForUrl(u));
+ iconElement.setAttribute(QL1S("width"), QL1S("16"));
+ iconElement.setAttribute(QL1S("height"), QL1S("16"));
+
+ QWebElement linkElement = item.findFirst(QL1S("a"));
+ linkElement.setAttribute(QL1S("href") , u.url());
QString shownUrl = son.data().toString();
if (shownUrl.length() > maxTextSize)
{
shownUrl.truncate(truncateSize);
shownUrl += QL1S("...");
}
- little.lastChild().appendInside(shownUrl);
+ linkElement.appendInside(shownUrl);
+
+ QWebElement removeElement = item.findFirst(QL1S(".button img"));
+ removeElement.setAttribute(QL1S("src"), QL1S("file:///") +
+ KIconLoader::global()->iconPath("edit-delete", KIconLoader::DefaultState));
+
+ QWebElement removeLinkElement = item.findFirst(QL1S(".button"));
+
+ int histLoc = HistoryManager::self()->historyFilterModel()->historyLocation(u.url());
+ removeLinkElement.setAttribute(QL1S("href"), QL1S("about:history/remove?location=") + QString::number(histLoc));
- little.appendInside(QL1S("<br />"));
+ historyFolderElement.appendInside(QL1S("<br />"));
}
}
i++;