Falkon Develop
Cross-platform Qt-based web browser
history.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#ifndef HISTORY_H
19#define HISTORY_H
20
21#include <QObject>
22#include <QList>
23#include <QDateTime>
24#include <QUrl>
25
26#include "qzcommon.h"
27
28class QIcon;
29
30class WebView;
31class HistoryModel;
32
33class FALKON_EXPORT History : public QObject
34{
35 Q_OBJECT
36public:
37 History(QObject* parent);
38
39 struct HistoryEntry {
40 int id;
41 int count;
42 QDateTime date;
43 QUrl url;
44 QString urlString;
45 QString title;
46 };
47
48 static QString titleCaseLocalizedMonth(int month);
49
50 HistoryModel* model();
51
52 void addHistoryEntry(WebView* view);
53 void addHistoryEntry(const QUrl &url, QString title);
54
55 void deleteHistoryEntry(int index);
56 void deleteHistoryEntry(const QList<int> &list);
57 void deleteHistoryEntry(const QString &url);
58 void deleteHistoryEntry(const QString &url, const QString &title);
59
60 QList<int> indexesFromTimeRange(qint64 start, qint64 end);
61
62 QVector<HistoryEntry> mostVisited(int count);
63
64 void clearHistory();
65 bool isSaving();
66 void setSaving(bool state);
67
68 void loadSettings();
69
70 QList<HistoryEntry> searchHistoryEntry(const QString &text);
71 HistoryEntry getHistoryEntry(const QString &text);
72
73Q_SIGNALS:
74 void historyEntryAdded(const HistoryEntry &entry);
76 void historyEntryEdited(const HistoryEntry &before, const HistoryEntry &after);
77
79
80private:
81 bool m_isSaving;
82 HistoryModel* m_model;
83};
84
86
87// Hint to QVector to use std::realloc on item moving
89
90#endif // HISTORY_H
void historyEntryDeleted(const HistoryEntry &entry)
void historyEntryEdited(const HistoryEntry &before, const HistoryEntry &after)
void resetHistory()
void historyEntryAdded(const HistoryEntry &entry)
Q_DECLARE_TYPEINFO(HistoryEntry, Q_MOVABLE_TYPE)
History::HistoryEntry HistoryEntry
Definition: history.h:85
State state
#define FALKON_EXPORT
Definition: qzcommon.h:28
Definition: history.h:39
QDateTime date
Definition: history.h:42
QString title
Definition: history.h:45
int id
Definition: history.h:40
QUrl url
Definition: history.h:43
QString urlString
Definition: history.h:44
int count
Definition: history.h:41