summaryrefslogtreecommitdiff
path: root/src/history
diff options
context:
space:
mode:
Diffstat (limited to 'src/history')
-rw-r--r--src/history/autosaver.cpp13
-rw-r--r--src/history/autosaver.h11
-rw-r--r--src/history/historymanager.cpp125
-rw-r--r--src/history/historymanager.h47
-rw-r--r--src/history/historymodels.cpp16
-rw-r--r--src/history/historymodels.h15
-rw-r--r--src/history/historypanel.cpp106
-rw-r--r--src/history/historypanel.h25
8 files changed, 280 insertions, 78 deletions
diff --git a/src/history/autosaver.cpp b/src/history/autosaver.cpp
index 236922b5..83b3f6b0 100644
--- a/src/history/autosaver.cpp
+++ b/src/history/autosaver.cpp
@@ -3,7 +3,7 @@
* This file is a part of the rekonq project
*
* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
-* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2008-2010 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -31,9 +31,6 @@
#include "autosaver.h"
#include "autosaver.moc"
-// KDE Includes
-#include <KDebug>
-
// Qt Includes
#include <QtCore/QMetaObject>
@@ -52,7 +49,7 @@ AutoSaver::~AutoSaver()
{
if (m_timer.isActive())
{
- kWarning() << "AutoSaver: still active when destroyed, changes not saved.";
+ kDebug() << "AutoSaver: still active when destroyed, changes not saved.";
}
}
@@ -94,7 +91,7 @@ void AutoSaver::saveIfNeccessary()
m_firstChange = QTime();
if (!QMetaObject::invokeMethod(parent(), "save", Qt::DirectConnection))
{
- kWarning() << "AutoSaver: error invoking slot save() on parent";
+ kDebug() << "AutoSaver: error invoking slot save() on parent";
}
}
diff --git a/src/history/autosaver.h b/src/history/autosaver.h
index 80583f9c..6927dbe8 100644
--- a/src/history/autosaver.h
+++ b/src/history/autosaver.h
@@ -3,7 +3,7 @@
* This file is a part of the rekonq project
*
* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
-* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2008-2010 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -29,6 +29,9 @@
#define AUTOSAVER_H
+// Rekonq Includes
+#include "rekonq_defines.h"
+
// Qt Includes
#include <QtCore/QObject>
#include <QtCore/QBasicTimer>
@@ -43,7 +46,7 @@
*
*/
-class AutoSaver : public QObject
+class REKONQ_TESTS_EXPORT AutoSaver : public QObject
{
Q_OBJECT
diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp
index 29bdb45b..8dc7e049 100644
--- a/src/history/historymanager.cpp
+++ b/src/history/historymanager.cpp
@@ -4,7 +4,7 @@
*
* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2008-2010 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or
@@ -12,9 +12,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -63,18 +63,17 @@ static const unsigned int HISTORY_VERSION = 23;
HistoryManager::HistoryManager(QObject *parent)
- : QWebHistoryInterface(parent)
- , m_saveTimer(new AutoSaver(this))
- , m_historyLimit(30)
- , m_historyModel(0)
- , m_historyFilterModel(0)
- , m_historyTreeModel(0)
- , m_completion(0)
+ : QWebHistoryInterface(parent)
+ , m_saveTimer(new AutoSaver(this))
+ , m_historyLimit(30)
+ , m_historyModel(0)
+ , m_historyFilterModel(0)
+ , m_historyTreeModel(0)
+ , m_completion(new KCompletion)
{
// take care of the completion object
- m_completion = new KCompletion;
- m_completion->setOrder( KCompletion::Weighted );
-
+ m_completion->setOrder(KCompletion::Weighted);
+
m_expiredTimer.setSingleShot(true);
connect(&m_expiredTimer, SIGNAL(timeout()), this, SLOT(checkForExpired()));
connect(this, SIGNAL(entryAdded(const HistoryItem &)), m_saveTimer, SLOT(changeOccurred()));
@@ -113,11 +112,11 @@ bool HistoryManager::historyContains(const QString &url) const
void HistoryManager::addHistoryEntry(const QString &url)
{
QUrl cleanUrl(url);
-
+
// don't store about: urls (home page related)
- if(cleanUrl.scheme() == QString("about"))
+ if (cleanUrl.scheme() == QString("about"))
return;
-
+
cleanUrl.setPassword(QString());
cleanUrl.setHost(cleanUrl.host().toLower());
HistoryItem item(cleanUrl.toString(), QDateTime::currentDateTime());
@@ -213,7 +212,7 @@ void HistoryManager::addHistoryEntry(const HistoryItem &item)
m_history.prepend(item);
emit entryAdded(item);
-
+
if (m_history.count() == 1)
checkForExpired();
}
@@ -255,7 +254,7 @@ void HistoryManager::removeHistoryEntry(const KUrl &url, const QString &title)
break;
}
}
-
+
// Remove item from completion object
QString _url = url.path();
_url.remove(QRegExp("^http://|/$"));
@@ -317,7 +316,7 @@ void HistoryManager::load()
return;
if (!historyFile.open(QFile::ReadOnly))
{
- kWarning() << "Unable to open history file" << historyFile.fileName();
+ kDebug() << "Unable to open history file" << historyFile.fileName();
return;
}
@@ -363,7 +362,7 @@ void HistoryManager::load()
// Add item to completion object
QString _url = item.url;
- _url.remove(QRegExp("^http://|/$"));
+ //_url.remove(QRegExp("^http://|/$"));
m_completion->addItem(_url);
}
if (needToSort)
@@ -417,7 +416,7 @@ void HistoryManager::save()
if (!open)
{
- kWarning() << "Unable to open history file for saving"
+ kDebug() << "Unable to open history file for saving"
<< (saveAll ? tempFile.fileName() : historyFile.fileName());
return;
}
@@ -437,11 +436,11 @@ void HistoryManager::save()
{
if (historyFile.exists() && !historyFile.remove())
{
- kWarning() << "History: error removing old history." << historyFile.errorString();
+ kDebug() << "History: error removing old history." << historyFile.errorString();
}
if (!tempFile.rename(historyFile.fileName()))
{
- kWarning() << "History: error moving new history over old." << tempFile.errorString() << historyFile.fileName();
+ kDebug() << "History: error moving new history over old." << tempFile.errorString() << historyFile.fileName();
}
}
m_lastSavedUrl = m_history.value(0).url;
@@ -452,3 +451,83 @@ KCompletion * HistoryManager::completionObject() const
{
return m_completion;
}
+
+
+void HistoryManager::addDownload(const QString &srcUrl, const QString &destUrl)
+{
+ QWebSettings *globalSettings = QWebSettings::globalSettings();
+ if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
+ return;
+ QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads");
+ QFile downloadFile(downloadFilePath);
+ if (!downloadFile.open(QFile::WriteOnly | QFile::Append))
+ {
+ kDebug() << "azz...";
+ return;
+ }
+ QDataStream out(&downloadFile);
+ out << srcUrl;
+ out << destUrl;
+ out << QDateTime::currentDateTime();
+ downloadFile.close();
+}
+
+
+DownloadList HistoryManager::downloads()
+{
+ DownloadList list;
+
+ QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads");
+ QFile downloadFile(downloadFilePath);
+ if (!downloadFile.open(QFile::ReadOnly))
+ {
+ kDebug() << "azz...";
+ return list;
+ }
+
+ QDataStream in(&downloadFile);
+ while (!in.atEnd())
+ {
+ QString srcUrl;
+ in >> srcUrl;
+ QString destUrl;
+ in >> destUrl;
+ QDateTime dt;
+ in >> dt;
+ DownloadItem item(srcUrl, destUrl, dt);
+ list << item;
+ }
+ return list;
+}
+
+
+bool HistoryManager::clearDownloadsHistory()
+{
+ QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads");
+ QFile downloadFile(downloadFilePath);
+ return downloadFile.remove();
+}
+
+
+QString HistoryManager::titleForHistoryUrl(QString url)
+{
+ QString title = "";
+
+ int i = 0;
+ while (i < history().count() && title.isEmpty())
+ {
+ if (history().at(i).url == url)
+ {
+ title = history().at(i).title;
+ }
+ i++;
+ }
+
+ if (title.isEmpty())
+ {
+ title = url;
+ }
+
+ return title;
+}
+
diff --git a/src/history/historymanager.h b/src/history/historymanager.h
index ff3b4381..0f131782 100644
--- a/src/history/historymanager.h
+++ b/src/history/historymanager.h
@@ -4,7 +4,7 @@
*
* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2008-2010 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or
@@ -12,9 +12,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -30,6 +30,9 @@
#define HISTORY_H
+// Rekonq Includes
+#include "rekonq_defines.h"
+
// KDE Includes
#include <KUrl>
@@ -51,10 +54,13 @@ class HistoryItem
public:
HistoryItem() {}
explicit HistoryItem(const QString &u,
- const QDateTime &d = QDateTime(),
+ const QDateTime &d = QDateTime(),
const QString &t = QString()
)
- : title(t), url(u), dateTime(d) {}
+ : title(t)
+ , url(u),
+ dateTime(d)
+ {}
inline bool operator==(const HistoryItem &other) const
{
@@ -74,6 +80,29 @@ public:
};
+// ---------------------------------------------------------------------------------------------------------------
+
+
+class DownloadItem
+{
+public:
+ DownloadItem() {}
+ explicit DownloadItem(const QString &srcUrl,
+ const QString &destUrl,
+ const QDateTime &d
+ )
+ : srcUrlString(srcUrl)
+ , destUrlString(destUrl)
+ , dateTime(d)
+ {}
+
+ QString srcUrlString;
+ QString destUrlString;
+ QDateTime dateTime;
+};
+
+
+typedef QList<DownloadItem> DownloadList;
// ---------------------------------------------------------------------------------------------------------------
@@ -92,7 +121,7 @@ class KCompletion;
* It manages rekonq history
*
*/
-class HistoryManager : public QWebHistoryInterface
+class REKONQ_TESTS_EXPORT HistoryManager : public QWebHistoryInterface
{
Q_OBJECT
Q_PROPERTY(int historyLimit READ historyLimit WRITE setHistoryLimit)
@@ -112,6 +141,8 @@ public:
void updateHistoryEntry(const KUrl &url, const QString &title);
void removeHistoryEntry(const KUrl &url, const QString &title = QString());
+ QString titleForHistoryUrl(QString url);
+
int historyLimit() const;
void setHistoryLimit(int limit);
@@ -128,6 +159,10 @@ public:
*/
KCompletion *completionObject() const;
+ void addDownload(const QString &srcUrl, const QString &destUrl);
+ DownloadList downloads();
+ bool clearDownloadsHistory();
+
public slots:
void clear();
void loadSettings();
diff --git a/src/history/historymodels.cpp b/src/history/historymodels.cpp
index cf8d1aed..e68eac42 100644
--- a/src/history/historymodels.cpp
+++ b/src/history/historymodels.cpp
@@ -4,7 +4,7 @@
*
* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2008-2010 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or
@@ -12,9 +12,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -118,6 +118,8 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const
return item.dateTime.date();
case UrlRole:
return QUrl(item.url);
+ case Qt::UserRole:
+ return KUrl(item.url);
case UrlStringRole:
return item.url;
case Qt::DisplayRole:
@@ -144,6 +146,12 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const
{
return Application::icon(item.url);
}
+ case Qt::ToolTipRole:
+ QString tooltip = "";
+ if (!item.title.isEmpty())
+ tooltip = item.title + '\n';
+ tooltip += item.dateTime.toString(Qt::SystemLocaleShortDate) + '\n' + item.url;
+ return tooltip;
}
return QVariant();
}
@@ -688,7 +696,7 @@ QVariant HistoryTreeModel::data(const QModelIndex &index, int role) const
QDate date = idx.data(HistoryModel::DateRole).toDate();
if (date == QDate::currentDate())
return i18n("Earlier Today");
- return date.toString(QLatin1String("dddd, MMMM d, yyyy"));
+ return date.toString(QL1S("dddd, MMMM d, yyyy"));
}
if (index.column() == 1)
{
diff --git a/src/history/historymodels.h b/src/history/historymodels.h
index 08f3f63e..78691694 100644
--- a/src/history/historymodels.h
+++ b/src/history/historymodels.h
@@ -4,7 +4,7 @@
*
* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2008-2010 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or
@@ -12,9 +12,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -30,6 +30,9 @@
#define HISTORYMODELS_H
+// Rekonq Includes
+#include "rekonq_defines.h"
+
// Local Includes
#include "historymanager.h"
@@ -37,15 +40,13 @@
#include <KUrl>
// Qt Includes
-#include <QDateTime>
#include <QHash>
#include <QObject>
-#include <QTimer>
#include <QSortFilterProxyModel>
#include <QWebHistoryInterface>
-class HistoryModel : public QAbstractTableModel
+class REKONQ_TESTS_EXPORT HistoryModel : public QAbstractTableModel
{
Q_OBJECT
@@ -85,7 +86,7 @@ private:
*
*/
-class HistoryFilterModel : public QAbstractProxyModel
+class REKONQ_TESTS_EXPORT HistoryFilterModel : public QAbstractProxyModel
{
Q_OBJECT
diff --git a/src/history/historypanel.cpp b/src/history/historypanel.cpp
index 08dc3800..4c4982e9 100644
--- a/src/history/historypanel.cpp
+++ b/src/history/historypanel.cpp
@@ -2,8 +2,8 @@
*
* This file is a part of the rekonq project
*
-* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot com>*
* Copyright (C) 2009 by Domrachev Alexandr <alexandr.domrachev@gmail.com>
+* Copyright (C) 2009-2010 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -46,10 +46,14 @@
// KDE Includes
#include <KLineEdit>
#include <KLocalizedString>
+#include <KMenu>
+#include <KAction>
+#include <KMessageBox>
HistoryPanel::HistoryPanel(const QString &title, QWidget *parent, Qt::WindowFlags flags)
- : QDockWidget(title, parent, flags)
+ : QDockWidget(title, parent, flags)
+ , m_treeView(new PanelTreeView(this))
{
setup();
setShown(ReKonfig::showHistoryPanel());
@@ -67,14 +71,14 @@ void HistoryPanel::setup()
{
setObjectName("historyPanel");
setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
-
+
QWidget *ui = new QWidget(this);
- QTreeView *historyTreeView = new QTreeView(this);
- historyTreeView->setUniformRowHeights(true);
- historyTreeView->setSelectionBehavior(QAbstractItemView::SelectRows);
- historyTreeView->setTextElideMode(Qt::ElideMiddle);
- historyTreeView->setAlternatingRowColors(true);
+ m_treeView->setUniformRowHeights(true);
+ m_treeView->setSelectionBehavior(QAbstractItemView::SelectRows);
+ m_treeView->setTextElideMode(Qt::ElideMiddle);
+ m_treeView->setAlternatingRowColors(true);
+ m_treeView->header()->hide();
// add search bar
QHBoxLayout *hBoxLayout = new QHBoxLayout;
@@ -91,7 +95,7 @@ void HistoryPanel::setup()
QVBoxLayout *vBoxLayout = new QVBoxLayout;
vBoxLayout->setContentsMargins(0, 0, 0, 0);
vBoxLayout->addWidget(searchBar);
- vBoxLayout->addWidget(historyTreeView);
+ vBoxLayout->addWidget(m_treeView);
// add it to the UI
ui->setLayout(vBoxLayout);
@@ -103,19 +107,83 @@ void HistoryPanel::setup()
TreeProxyModel *treeProxyModel = new TreeProxyModel(this);
treeProxyModel->setSourceModel(model);
- historyTreeView->setModel(treeProxyModel);
- historyTreeView->setExpanded(treeProxyModel->index(0, 0), true);
- historyTreeView->header()->hideSection(1);
+ m_treeView->setModel(treeProxyModel);
+ m_treeView->setExpanded(treeProxyModel->index(0, 0), true);
+ m_treeView->header()->hideSection(1);
QFontMetrics fm(font());
- int header = fm.width(QLatin1Char('m')) * 40;
- historyTreeView->header()->resizeSection(0, header);
+ int header = fm.width( QL1C('m') ) * 40;
+ m_treeView->header()->resizeSection(0, header);
connect(search, SIGNAL(textChanged(QString)), treeProxyModel, SLOT(setFilterFixedString(QString)));
- connect(historyTreeView, SIGNAL(activated(const QModelIndex &)), this, SLOT(itemActivated(const QModelIndex &)));
+ connect(m_treeView, SIGNAL(contextMenuItemRequested(const QPoint &)), this, SLOT(contextMenuItem(const QPoint &)));
+ connect(m_treeView, SIGNAL(contextMenuGroupRequested(const QPoint &)), this, SLOT(contextMenuGroup(const QPoint &)));
}
-void HistoryPanel::itemActivated(const QModelIndex &item)
+void HistoryPanel::contextMenuItem(const QPoint &pos)
{
- emit openUrl( item.data(HistoryModel::UrlRole).toUrl() );
+ KMenu *menu = new KMenu(this);
+ KAction* action;
+
+ action = new KAction(KIcon("tab-new"), i18n("Open"), this);
+ connect(action, SIGNAL(triggered()), m_treeView, SLOT(openInCurrentTab()));
+ menu->addAction(action);
+
+ action = new KAction(KIcon("tab-new"), i18n("Open in New Tab"), this);
+ connect(action, SIGNAL(triggered()), m_treeView, SLOT(openInNewTab()));
+ menu->addAction(action);
+
+ action = new KAction(KIcon("window-new"), i18n("Open in New Window"), this);
+ connect(action, SIGNAL(triggered()), m_treeView, SLOT(openInNewWindow()));
+ menu->addAction(action);
+
+ action = new KAction(KIcon("edit-copy"), i18n("Copy Link Address"), this);
+ connect(action, SIGNAL(triggered()), m_treeView, SLOT(copyToClipboard()));
+ menu->addAction(action);
+
+ if (!menu)
+ return;
+ menu->popup(m_treeView->mapToGlobal(pos));
}
+
+
+void HistoryPanel::contextMenuGroup(const QPoint &pos)
+{
+ KMenu *menu = new KMenu(this);
+ KAction* action;
+
+ action = new KAction(KIcon("tab-new"), i18n("Open Folder in Tabs"), this);
+ connect(action, SIGNAL(triggered()), this, SLOT(openAll()));
+
+ menu->addAction(action);
+
+ if (!menu)
+ return;
+ menu->popup(m_treeView->mapToGlobal(pos));
+}
+
+
+void HistoryPanel::openAll()
+{
+ QModelIndex index = m_treeView->currentIndex();
+ if (!index.isValid())
+ return;
+
+ QList<KUrl> allChild;
+
+ for (int i = 0; i < index.model()->rowCount(index); i++)
+ allChild << qVariantValue<KUrl>(index.child(i, 0).data(Qt::UserRole));
+
+ if (allChild.length() > 8)
+ {
+ if (!(KMessageBox::warningContinueCancel(this,
+ i18n("You are about to open %1 tabs.\nAre you sure ?",
+ QString::number(allChild.length()))) == KMessageBox::Continue)
+ )
+ return;
+ }
+
+ for (int i = 0; i < allChild.length(); i++)
+ emit openUrl(allChild.at(i).url(), Rekonq::SettingOpenTab);
+}
+
diff --git a/src/history/historypanel.h b/src/history/historypanel.h
index e07e2190..1c86cfee 100644
--- a/src/history/historypanel.h
+++ b/src/history/historypanel.h
@@ -2,8 +2,8 @@
*
* This file is a part of the rekonq project
*
-* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot com>*
* Copyright (C) 2009 by Domrachev Alexandr <alexandr.domrachev@gmail.com>
+* Copyright (C) 2009-2010 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -29,6 +29,13 @@
#define HISTORYPANEL_H
+// Rekonq Includes
+#include "rekonq_defines.h"
+
+// Local Includes
+#include "application.h"
+#include "paneltreeview.h"
+
// Qt Includes
#include <QDockWidget>
@@ -38,22 +45,26 @@ class QWidget;
class QModelIndex;
-class HistoryPanel : public QDockWidget
+class REKONQ_TESTS_EXPORT HistoryPanel : public QDockWidget
{
-Q_OBJECT
+ Q_OBJECT
public:
explicit HistoryPanel(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
~HistoryPanel();
signals:
- void openUrl(const KUrl &);
+ void openUrl(const KUrl &, const Rekonq::OpenType &);
+ void itemHovered(const QString &);
private slots:
- void itemActivated(const QModelIndex &);
+ void contextMenuItem(const QPoint &pos);
+ void contextMenuGroup(const QPoint &pos);
+ void openAll();
private:
void setup();
+ PanelTreeView *m_treeView;
};
#endif // HISTORYPANEL_H