Falkon Develop
Cross-platform Qt-based web browser
qmlbookmarks.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2018 Anmol Gautam <tarptaeya@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#pragma once
19
20#include "qmlbookmarktreenode.h"
21#include "mainapplication.h"
22
23#include <QObject>
24
28class QmlBookmarks : public QObject
29{
30 Q_OBJECT
31
32public:
33 explicit QmlBookmarks(QObject *parent = nullptr);
34
40 Q_INVOKABLE bool isBookmarked(const QString &url) const;
45 Q_INVOKABLE QmlBookmarkTreeNode *rootItem() const;
50 Q_INVOKABLE QmlBookmarkTreeNode *toolbarFolder() const;
55 Q_INVOKABLE QmlBookmarkTreeNode *menuFolder() const;
60 Q_INVOKABLE QmlBookmarkTreeNode *unsortedFolder() const;
65 Q_INVOKABLE QmlBookmarkTreeNode *lastUsedFolder() const;
85 Q_INVOKABLE bool create(const QVariantMap &map) const;
92 Q_INVOKABLE bool remove(QmlBookmarkTreeNode *treeNode) const;
103 Q_INVOKABLE QList<QObject*> search(const QVariantMap &map) const;
117 Q_INVOKABLE bool update(QObject *object, const QVariantMap &changes) const;
124 Q_INVOKABLE QmlBookmarkTreeNode *get(const QString &string) const;
131 Q_INVOKABLE QList<QObject*> getChildren(QObject *object) const;
132
133Q_SIGNALS:
139
145
151
152private:
153 BookmarkItem *getBookmarkItem(QmlBookmarkTreeNode *treeNode) const;
154 BookmarkItem *getBookmarkItem(QObject *object) const;
155};
The class exposing the bookmark item to QML.
The class exposing the Bookmarks API to QML.
Definition: qmlbookmarks.h:29
void changed(QmlBookmarkTreeNode *treeNode)
This signal is emitted when a bookmark item is edited.
Q_INVOKABLE QmlBookmarkTreeNode * lastUsedFolder() const
Get the last used bookmarks folder.
void created(QmlBookmarkTreeNode *treeNode)
This signal is emitted when a new bookmark item is created.
Q_INVOKABLE bool create(const QVariantMap &map) const
Creates a bookmark item.
Q_INVOKABLE QList< QObject * > search(const QVariantMap &map) const
QmlBookmarks::search.
void removed(QmlBookmarkTreeNode *treeNode)
This signal is emitted when a bookmark item is removed.
QmlBookmarks(QObject *parent=nullptr)
Q_INVOKABLE QmlBookmarkTreeNode * get(const QString &string) const
Get the first matched bookmark item.
Q_INVOKABLE QmlBookmarkTreeNode * menuFolder() const
Get the bookmarks menu folder.
Q_INVOKABLE bool remove(QmlBookmarkTreeNode *treeNode) const
Removes a bookmark item.
Q_INVOKABLE QmlBookmarkTreeNode * toolbarFolder() const
Get the bookmarks toolbar.
Q_INVOKABLE bool update(QObject *object, const QVariantMap &changes) const
Updates a bookmark item.
Q_INVOKABLE QmlBookmarkTreeNode * rootItem() const
Get the root bookmark item.
Q_INVOKABLE bool isBookmarked(const QString &url) const
Checks if the url is bookmarked.
Q_INVOKABLE QList< QObject * > getChildren(QObject *object) const
Get children of the bookmark item.
Q_INVOKABLE QmlBookmarkTreeNode * unsortedFolder() const
Get the unsorted bookmarks folder.