KBookmarks

kbookmarkdialog.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2007 Daniel Teske <[email protected]>
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 
13 #include <QDialog>
14 #include <memory>
15 
16 class KBookmarkManager;
17 class KBookmarkDialogPrivate;
18 
19 /**
20  * @class KBookmarkDialog kbookmarkdialog.h KBookmarkDialog
21  *
22  * This class provides a Dialog for editing properties, adding Bookmarks and creating new folders.
23  * It can be used to show dialogs for common tasks with bookmarks.
24  *
25  * It is used by KBookmarkMenu to show a dialog for "Properties", "Add Bookmark" and "Create New Folder".
26  * If you want to customize those dialogs, derive from KBookmarkOwner and reimplement bookmarkDialog(),
27  * return a KBookmarkDialog subclass and reimplement initLayout(), aboutToShow() and save().
28  */
29 class KBOOKMARKS_EXPORT KBookmarkDialog : public QDialog
30 {
31  Q_OBJECT
32 
33 public:
34  /**
35  * Creates a KBookmarkDialog instance
36  */
37  KBookmarkDialog(KBookmarkManager *manager, QWidget *parent = nullptr);
38  /**
39  * Shows a properties dialog
40  * Note: this updates the bookmark and calls KBookmarkManager::emitChanged
41  */
42  KBookmark editBookmark(const KBookmark &bm);
43  /**
44  * Shows a "Add Bookmark" dialog
45  * Note: this updates the bookmark and calls KBookmarkManager::emitChanged
46  */
47  KBookmark addBookmark(const QString &title, const QUrl &url, const QString &icon, KBookmark parent = KBookmark());
48  /**
49  * Creates a folder from a list of bookmarks
50  * Note: this updates the bookmark and calls KBookmarkManager::emitChanged
51  */
52  KBookmarkGroup addBookmarks(const QList<KBookmarkOwner::FutureBookmark> &list, const QString &name = QString(), KBookmarkGroup parent = KBookmarkGroup());
53  /**
54  * Shows a dialog to create a new folder.
55  */
56  KBookmarkGroup createNewFolder(const QString &name, KBookmark parent = KBookmark());
57  /**
58  * Shows a dialog to select a folder.
59  */
60  KBookmarkGroup selectFolder(KBookmark start = KBookmark());
61 
62  ~KBookmarkDialog() override;
63 
64 protected:
65  void accept() override;
66 
67 protected Q_SLOTS:
68  void newFolderButton();
69 
70 private:
71  std::unique_ptr<KBookmarkDialogPrivate> const d;
72  friend class KBookmarkDialogPrivate;
73 };
74 
75 #endif
Q_SLOTSQ_SLOTS
Q_SCRIPTABLE Q_NOREPLY void start()
virtual void accept()
A group of bookmarks.
Definition: kbookmark.h:322
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Dec 5 2023 04:00:22 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.