File indexing completed on 2025-01-19 03:58:03

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2017-05-15
0007  * Description : Managemenet dialogs for bookmarks
0008  *
0009  * SPDX-FileCopyrightText: 2017-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_BOOKMARKS_DLG_H
0016 #define DIGIKAM_BOOKMARKS_DLG_H
0017 
0018 // Qt includes
0019 
0020 #include <QDialog>
0021 #include <QTreeView>
0022 #include <QComboBox>
0023 #include <QAbstractItemModel>
0024 
0025 // Local includes
0026 
0027 #include "searchtextbar.h"
0028 #include "bookmarksmngr.h"
0029 #include "digikam_export.h"
0030 
0031 namespace Digikam
0032 {
0033 
0034 class DIGIKAM_EXPORT AddBookmarkDialog : public QDialog
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039 
0040     explicit AddBookmarkDialog(const QString& url,
0041                                const QString& title,
0042                                QWidget* const parent = nullptr,
0043                                BookmarksManager* const mngr = nullptr);
0044     ~AddBookmarkDialog() override;
0045 
0046 private Q_SLOTS:
0047 
0048     void accept()         override;
0049 
0050 private:
0051 
0052     class Private;
0053     Private* const d;
0054 };
0055 
0056 // --------------------------------------------------------------------
0057 
0058 class DIGIKAM_EXPORT BookmarksDialog : public QDialog
0059 {
0060     Q_OBJECT
0061 
0062 public:
0063 
0064     explicit BookmarksDialog(QWidget* const parent = nullptr, BookmarksManager* const mngr = nullptr);
0065     ~BookmarksDialog()              override;
0066 
0067 private Q_SLOTS:
0068 
0069     void slotCustomContextMenuRequested(const QPoint&);
0070     void accept() override;
0071     void slotOpenInMap(const QModelIndex&);
0072     void slotNewFolder();
0073     void slotRemoveOne();
0074 
0075 protected:
0076 
0077     void closeEvent(QCloseEvent*)   override;
0078 
0079 private:
0080 
0081     void expandNodes(BookmarkNode* const node);
0082     bool saveExpandedNodes(const QModelIndex& parent);
0083     void readSettings();
0084     void saveSettings();
0085 
0086 private:
0087 
0088     class Private;
0089     Private* const d;
0090 };
0091 
0092 } // namespace Digikam
0093 
0094 #endif // DIGIKAM_BOOKMARKS_DLG_H