1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2007 Daniel Teske <teske@squorn.de> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-only |
6 | */ |
7 | #ifndef __kbookmarkdialog_h |
8 | #define __kbookmarkdialog_h |
9 | |
10 | #include "kbookmark.h" |
11 | #include "kbookmarkowner.h" |
12 | #include <kbookmarkswidgets_export.h> |
13 | |
14 | #include <QDialog> |
15 | #include <memory> |
16 | |
17 | class KBookmarkManager; |
18 | class KBookmarkDialogPrivate; |
19 | |
20 | /*! |
21 | * \class KBookmarkDialog |
22 | * \inmodule KBookmarksWidgets |
23 | * |
24 | * \brief This class provides a Dialog for editing properties, adding Bookmarks and creating new folders. |
25 | * |
26 | * It can be used to show dialogs for common tasks with bookmarks. |
27 | * |
28 | * It is used by KBookmarkMenu to show a dialog for "Properties", "Add Bookmark" and "Create New Folder". |
29 | * If you want to customize those dialogs, derive from KBookmarkOwner and reimplement bookmarkDialog(), |
30 | * return a KBookmarkDialog subclass and reimplement initLayout(), aboutToShow() and save(). |
31 | */ |
32 | class KBOOKMARKSWIDGETS_EXPORT KBookmarkDialog : public QDialog |
33 | { |
34 | Q_OBJECT |
35 | |
36 | public: |
37 | /*! |
38 | * Creates a KBookmarkDialog instance |
39 | */ |
40 | KBookmarkDialog(KBookmarkManager *manager, QWidget *parent = nullptr); |
41 | /*! |
42 | * Shows a properties dialog |
43 | * \note this updates the bookmark and calls KBookmarkManager::emitChanged |
44 | */ |
45 | KBookmark editBookmark(const KBookmark &bm); |
46 | /*! |
47 | * Shows a "Add Bookmark" dialog |
48 | * \note this updates the bookmark and calls KBookmarkManager::emitChanged |
49 | */ |
50 | KBookmark addBookmark(const QString &title, const QUrl &url, const QString &icon, KBookmark parent = KBookmark()); |
51 | /*! |
52 | * Creates a folder from a list of bookmarks |
53 | * \note this updates the bookmark and calls KBookmarkManager::emitChanged |
54 | */ |
55 | KBookmarkGroup addBookmarks(const QList<KBookmarkOwner::FutureBookmark> &list, const QString &name = QString(), KBookmarkGroup parent = KBookmarkGroup()); |
56 | /*! |
57 | * Shows a dialog to create a new folder. |
58 | */ |
59 | KBookmarkGroup createNewFolder(const QString &name, KBookmark parent = KBookmark()); |
60 | /*! |
61 | * Shows a dialog to select a folder. |
62 | */ |
63 | KBookmarkGroup selectFolder(KBookmark start = KBookmark()); |
64 | |
65 | ~KBookmarkDialog() override; |
66 | |
67 | protected: |
68 | void accept() override; |
69 | |
70 | protected Q_SLOTS: |
71 | /*! |
72 | */ |
73 | void newFolderButton(); |
74 | |
75 | private: |
76 | std::unique_ptr<KBookmarkDialogPrivate> const d; |
77 | friend class KBookmarkDialogPrivate; |
78 | }; |
79 | |
80 | #endif |
81 | |