summaryrefslogtreecommitdiff
path: root/src/history/historypanel.cpp
diff options
context:
space:
mode:
authorYoann Laissus <yoann.laissus@gmail.com>2011-12-02 22:53:27 +0100
committerYoann Laissus <yoann.laissus@gmail.com>2011-12-02 22:53:27 +0100
commitfc9a06849a7d85dac87d1a42a3c328a1bc07ff57 (patch)
tree37b2cce3ae0eadcd6b07571c942864eea63ad27c /src/history/historypanel.cpp
parentrekonq 0.8.55 (diff)
downloadrekonq-fc9a06849a7d85dac87d1a42a3c328a1bc07ff57.tar.xz
GCI Task : Add some actions to forget history entries in the panel
Patch by Hüseyin Zengin. Thanks ! REVIEW: 103255
Diffstat (limited to 'src/history/historypanel.cpp')
-rw-r--r--src/history/historypanel.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/history/historypanel.cpp b/src/history/historypanel.cpp
index 8ba963e7..45e57312 100644
--- a/src/history/historypanel.cpp
+++ b/src/history/historypanel.cpp
@@ -83,6 +83,14 @@ void HistoryPanel::contextMenuItem(const QPoint &pos)
connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(copyToClipboard()));
menu.addAction(action);
+ action = new KAction(KIcon("edit-clear"), i18n("Remove Entry"), this);
+ connect(action,SIGNAL(triggered()),this,SLOT(deleteEntry()));
+ menu.addAction(action);
+
+ action = new KAction(KIcon("edit-clear"), i18n("Remove all occurences"), this);
+ connect(action,SIGNAL(triggered()),this,SLOT(forgetSite()));
+ menu.addAction(action);
+
menu.exec(panelTreeView()->mapToGlobal(pos));
}
@@ -96,6 +104,10 @@ void HistoryPanel::contextMenuGroup(const QPoint &pos)
connect(action, SIGNAL(triggered()), this, SLOT(openAll()));
menu.addAction(action);
+ action = new KAction(KIcon("edit-clear"), i18n("Remove Folder"), this);
+ connect(action, SIGNAL(triggered()), this, SLOT(deleteGroup()));
+ menu.addAction(action);
+
menu.exec(panelTreeView()->mapToGlobal(pos));
}
@@ -131,6 +143,21 @@ void HistoryPanel::openAll()
emit openUrl(allChild.at(i).url(), Rekonq::NewTab);
}
+void HistoryPanel::deleteGroup()
+{
+ QModelIndex index = panelTreeView()->currentIndex();
+ if (!index.isValid())
+ return;
+
+ //Getting all URLs of sub items.
+ QList<KUrl> allChild;
+ for (int i = 0; i < index.model()->rowCount(index); i++)
+ allChild << qVariantValue<KUrl>(index.child(i, 0).data(Qt::UserRole));
+
+ for (int i = 0; i < allChild.length(); i++)
+ rApp->historyManager()->removeHistoryEntry(allChild.at(i));
+
+}
void HistoryPanel::setup()
{
@@ -142,6 +169,40 @@ void HistoryPanel::setup()
panelTreeView()->expand(proxy->index(0, 0));
}
+void HistoryPanel::deleteEntry()
+{
+ QModelIndex index = panelTreeView()->currentIndex();
+ if(!index.isValid())
+ return;
+ removedFolderIndex=index.parent().row();
+
+ rApp->historyManager()->removeHistoryEntry(qVariantValue< KUrl >(index.data(Qt::UserRole)));
+
+ QModelIndex expandItem = panelTreeView()->model()->index(removedFolderIndex, 0);
+ if (expandItem.isValid())
+ panelTreeView()->expand(expandItem);
+}
+
+void HistoryPanel::forgetSite()
+{
+ QModelIndex index = panelTreeView()->currentIndex();
+ if(!index.isValid())
+ return;
+ removedFolderIndex=index.row();
+
+ QString site = qVariantValue< KUrl >(index.data(Qt::UserRole)).host();
+ QList<HistoryItem> toRemove = rApp->historyManager()->find(site);
+ for(int i = 0; i < toRemove.length(); i++)
+ {
+ rApp->historyManager()->removeHistoryEntry(KUrl(toRemove.at(i).url));
+ }
+
+ QModelIndex expandItem = panelTreeView()->model()->index(removedFolderIndex, 0);
+ if (expandItem.isValid())
+ panelTreeView()->expand(expandItem);
+}
+
+
QAbstractItemModel* HistoryPanel::model()
{