29 QmlHistoryItem *historyItem = QmlStaticData::instance().getHistoryItem(entry);
30 Q_EMIT visited(historyItem);
34 QmlHistoryItem *historyItem = QmlStaticData::instance().getHistoryItem(entry);
35 Q_EMIT visitRemoved(historyItem);
42 const QList<HistoryEntry> result =
mApp->history()->searchHistoryEntry(text);
43 list.reserve(result.size());
59 if (!map.contains(
QSL(
"title")) || !map.contains(
QSL(
"url"))) {
60 qWarning() <<
"Error:" <<
"wrong arguments passed to" << __FUNCTION__;
63 QString title = map.value(
QSL(
"title")).toString();
64 const QString url = map.value(
QSL(
"url")).toString();
66 title = title.isEmpty() ? url : title;
68 mApp->history()->addHistoryEntry(QUrl::fromEncoded(url.toUtf8()), title);
73 mApp->history()->deleteHistoryEntry(url);
78 if (!map.contains(
QSL(
"startTime")) || !map.contains(
QSL(
"endTime"))) {
79 qWarning() <<
"Error:" <<
"wrong arguments passed to" << __FUNCTION__;
82 const qlonglong startTime = map.value(
QSL(
"startTime")).toLongLong();
83 const qlonglong endTime = map.value(
QSL(
"endTime")).toLongLong();
85 const QList<int> entries =
mApp->history()->indexesFromTimeRange(startTime, endTime);
86 for (
int index : entries) {
87 mApp->history()->deleteHistoryEntry(index);
93 mApp->history()->clearHistory();
void historyEntryDeleted(const HistoryEntry &entry)
void historyEntryAdded(const HistoryEntry &entry)
Q_INVOKABLE void deleteAll()
Clears all the history.
Q_INVOKABLE void addUrl(const QVariantMap &map)
Add url to the history.
Q_INVOKABLE void deleteUrl(const QString &url)
Deletes a url from the history.
Q_INVOKABLE void deleteRange(const QVariantMap &map)
Deletes history entries within the given range.
QmlHistory(QObject *parent=nullptr)
Q_INVOKABLE QList< QObject * > search(const QString &text)
Searches History Entries against a search query.
Q_INVOKABLE int getVisits(const QString &url)
Get the visit count of a url.
QmlHistoryItem * getHistoryItem(const HistoryEntry &entry)
static QmlStaticData & instance()