blob: f76b8b3fc3476446bfc8ca4327890227ec91249e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/* ============================================================
* The rekonq project
* ============================================================
* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
* Copyright (C) 2009-2010 by Lionel Chauvin <megabigbug@yahoo.fr>
* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2022 aqua <aqua@iserlohn-fortress.net>
* ============================================================
* Description: rekonq bookmarks system interface
* ============================================================ */
#pragma once
#include "bookmark.hpp"
#include "bookmarkstreemodel.hpp"
#include "rekonq.hpp"
#include <QObject>
class QToolBar;
/**
* This class represent the interface to the rekonq bookmarks system. It provides bookmarks access to the
* Bookmarks Menu and Bookmarks Toolbar.
*/
class BookmarkManager final : public QObject {
Q_OBJECT
public:
/**
* @short Class constructor.
* Connect BookmarksProvider with bookmarks source
* (actually konqueror's bookmarks).
* @param parent The WebWindow to provide bookmarks objects.
*/
explicit BookmarkManager(const QString &bookmarksFile, QObject *parent = nullptr);
~BookmarkManager() override;
/**
* Return a list of errors
* @return A copy of the error list
*/
auto errors()
{
auto e = m_errors;
m_errors.clear();
return e;
}
/**
* @short set the Bookmarks Toolbar Action
*/
void registerBookmarkBar(QToolBar *toolbar)
{
if (!m_bookmarkToolBars.contains(toolbar)) m_bookmarkToolBars.append(toolbar);
}
void removeBookmarkBar(QToolBar *toolbar) { m_bookmarkToolBars.removeOne(toolbar); }
// QList<Bookmark> find(const QString &text);
// QList<Bookmark> findByUrl(const QUrl &url);
// Bookmark bookmarkForUrl(const QUrl &url);
// void openFolderInTabs(const BookmarkGroup &group);
// QMenu *bookmarkActionMenu(QWidget *parent);
public slots:
/**
* @short Waits for signal that the group with the address has been modified by the caller.
* Waits for signal that the group (or any of its children) with the address
* @p groupAddress (e.g. "/4/5") has been modified by the caller @p caller.
* @param groupAddress bookmark group address
* @param caller caller that modified the bookmarks
* @see KBookmarkManager::changed
*/
// void slotBookmarksChanged();
// void fillBookmarkBar(QToolBar *toolBar);
// void slotEditBookmarks();
// Bookmark bookmarkCurrentPage(const Bookmark &bookmark = Bookmark());
signals:
/**
* @short This signal is emitted when a URL has to be loaded
*/
void openUrl(const QUrl &, rekonq::OpenType);
private:
QList<QString> m_errors;
QList<QToolBar *> m_bookmarkToolBars;
BookmarkModel *m_model;
};
|