diff options
author | aqua <aqua@iserlohn-fortress.net> | 2022-08-15 14:25:29 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2022-09-14 08:51:09 +0300 |
commit | d9802226e443ecd7a7062fd7a0fb320a183e341f (patch) | |
tree | 1cfd97905fa7ba4de4beca9802ba749d62b5cc4e /src/bookmarks/bookmarkmanager.hpp | |
parent | Import BookmarkModel from poi (diff) | |
download | rekonq-d9802226e443ecd7a7062fd7a0fb320a183e341f.tar.xz |
Migrate BookmarkManager
Diffstat (limited to 'src/bookmarks/bookmarkmanager.hpp')
-rw-r--r-- | src/bookmarks/bookmarkmanager.hpp | 107 |
1 files changed, 40 insertions, 67 deletions
diff --git a/src/bookmarks/bookmarkmanager.hpp b/src/bookmarks/bookmarkmanager.hpp index 417eb83d..f76b8b3f 100644 --- a/src/bookmarks/bookmarkmanager.hpp +++ b/src/bookmarks/bookmarkmanager.hpp @@ -14,82 +14,60 @@ #pragma once +#include "bookmark.hpp" #include "bookmarkstreemodel.hpp" #include "rekonq.hpp" #include <QObject> -class BookmarkToolBar; -class QAction; +class QToolBar; /** - * This class represent the interface to rekonq bookmarks system. - * All rekonq needs (Bookmarks Menu, Bookmarks Toolbar) is provided - * from this class. - * So it implements code to have each one. + * This class represent the interface to the rekonq bookmarks system. It provides bookmarks access to the + * Bookmarks Menu and Bookmarks Toolbar. */ -class BookmarkManager : public QObject { +class BookmarkManager final : public QObject { Q_OBJECT public: /** - * Entry point. - * Access to BookmarkManager class by using - * BookmarkManager::self()->thePublicMethodYouNeed() - */ - static BookmarkManager *self(); - - ~BookmarkManager(); - - /** - * @short set the Bookmarks Toolbar Action + * @short Class constructor. + * Connect BookmarksProvider with bookmarks source + * (actually konqueror's bookmarks). + * @param parent The WebWindow to provide bookmarks objects. */ - void registerBookmarkBar(BookmarkToolBar *toolbar); - void removeBookmarkBar(BookmarkToolBar *toolbar); + explicit BookmarkManager(const QString &bookmarksFile, QObject *parent = nullptr); + ~BookmarkManager() override; /** - * @short Get action by name - * This method returns poiner bookmark action of given name. - * @pre m_actionCollection != NULL - * @param name Name of action you want to get - * @return It returns actions if one exists or empty object + * Return a list of errors + * @return A copy of the error list */ - QAction *actionByName(const QString &name); + auto errors() + { + auto e = m_errors; + m_errors.clear(); + return e; + } /** - * returns Bookmark Manager root group - * - * @return the root bookmark group + * @short set the Bookmarks Toolbar Action */ - KBookmarkGroup rootGroup(); - - inline KBookmarkManager *manager() { return m_manager; } - - inline BookmarkOwner *owner() { return m_owner; } - - QList<KBookmark> find(const QString &text); + void registerBookmarkBar(QToolBar *toolbar) + { + if (!m_bookmarkToolBars.contains(toolbar)) m_bookmarkToolBars.append(toolbar); + } + void removeBookmarkBar(QToolBar *toolbar) { m_bookmarkToolBars.removeOne(toolbar); } - KBookmark bookmarkForUrl(const KUrl &url); + // QList<Bookmark> find(const QString &text); + // QList<Bookmark> findByUrl(const QUrl &url); - KBookmark findByAddress(const QString &); + // Bookmark bookmarkForUrl(const QUrl &url); - void openFolderinTabs(const KBookmarkGroup &bm); + // void openFolderInTabs(const BookmarkGroup &group); - void emitChanged(); + // QMenu *bookmarkActionMenu(QWidget *parent); - static inline QString bookmark_mime_type() { return QL1S("application/x-rekonq-bookmark"); } - - KActionMenu *bookmarkActionMenu(QWidget *parent); - -private: - /** - * @short Class constructor. - * Connect BookmarksProvider with bookmarks source - * (actually konqueror's bookmarks). - * @param parent The WebWindow to provide bookmarks objects. - */ - explicit BookmarkManager(QObject *parent = nullptr); - -public Q_SLOTS: +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 @@ -98,26 +76,21 @@ public Q_SLOTS: * @param caller caller that modified the bookmarks * @see KBookmarkManager::changed */ - void slotBookmarksChanged(); - void fillBookmarkBar(BookmarkToolBar *toolBar); + // void slotBookmarksChanged(); + // void fillBookmarkBar(QToolBar *toolBar); - void slotEditBookmarks(); + // void slotEditBookmarks(); - KBookmark bookmarkCurrentPage(const KBookmark &bookmark = KBookmark()); + // Bookmark bookmarkCurrentPage(const Bookmark &bookmark = Bookmark()); -Q_SIGNALS: +signals: /** - * @short This signal is emitted when an url has to be loaded + * @short This signal is emitted when a URL has to be loaded */ - void openUrl(const KUrl &, const Rekonq::OpenType &); - - void bookmarksUpdated(); + void openUrl(const QUrl &, rekonq::OpenType); private: - void find(QList<KBookmark> *list, const KBookmark &bookmark, const QString &text); - KBookmark bookmarkForUrl(const KBookmark &bookmark, const KUrl &url); - void copyBookmarkGroup(const KBookmarkGroup &groupToCopy, KBookmarkGroup destGroup); - - QList<BookmarkToolBar *> m_bookmarkToolBars; + QList<QString> m_errors; + QList<QToolBar *> m_bookmarkToolBars; BookmarkModel *m_model; }; |