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
17class KBookmarkManager;
18class KBookmarkDialogPrivate;
19
20/**
21 * @class KBookmarkDialog kbookmarkdialog.h KBookmarkDialog
22 *
23 * This class provides a Dialog for editing properties, adding Bookmarks and creating new folders.
24 * It can be used to show dialogs for common tasks with bookmarks.
25 *
26 * It is used by KBookmarkMenu to show a dialog for "Properties", "Add Bookmark" and "Create New Folder".
27 * If you want to customize those dialogs, derive from KBookmarkOwner and reimplement bookmarkDialog(),
28 * return a KBookmarkDialog subclass and reimplement initLayout(), aboutToShow() and save().
29 */
30class KBOOKMARKSWIDGETS_EXPORT KBookmarkDialog : public QDialog
31{
32 Q_OBJECT
33
34public:
35 /**
36 * Creates a KBookmarkDialog instance
37 */
38 KBookmarkDialog(KBookmarkManager *manager, QWidget *parent = nullptr);
39 /**
40 * Shows a properties dialog
41 * Note: this updates the bookmark and calls KBookmarkManager::emitChanged
42 */
43 KBookmark editBookmark(const KBookmark &bm);
44 /**
45 * Shows a "Add Bookmark" dialog
46 * Note: this updates the bookmark and calls KBookmarkManager::emitChanged
47 */
48 KBookmark addBookmark(const QString &title, const QUrl &url, const QString &icon, KBookmark parent = KBookmark());
49 /**
50 * Creates a folder from a list of bookmarks
51 * Note: this updates the bookmark and calls KBookmarkManager::emitChanged
52 */
53 KBookmarkGroup addBookmarks(const QList<KBookmarkOwner::FutureBookmark> &list, const QString &name = QString(), KBookmarkGroup parent = KBookmarkGroup());
54 /**
55 * Shows a dialog to create a new folder.
56 */
57 KBookmarkGroup createNewFolder(const QString &name, KBookmark parent = KBookmark());
58 /**
59 * Shows a dialog to select a folder.
60 */
61 KBookmarkGroup selectFolder(KBookmark start = KBookmark());
62
63 ~KBookmarkDialog() override;
64
65protected:
66 void accept() override;
67
68protected Q_SLOTS:
69 void newFolderButton();
70
71private:
72 std::unique_ptr<KBookmarkDialogPrivate> const d;
73 friend class KBookmarkDialogPrivate;
74};
75
76#endif
77

source code of kbookmarks/src/widgets/kbookmarkdialog.h