File indexing completed on 2024-05-19 03:55:15

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 1998, 1999 Torben Weis <weis@kde.org>
0004     SPDX-FileCopyrightText: 2006 Daniel Teske <teske@squorn.de>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef KBOOKMARKCONTEXTMENU_H
0010 #define KBOOKMARKCONTEXTMENU_H
0011 
0012 #include <QMenu>
0013 
0014 #include "kbookmark.h"
0015 #include <kbookmarkswidgets_export.h>
0016 
0017 class KBookmarkManager;
0018 class KBookmarkOwner;
0019 
0020 /**
0021  * @class KBookmarkContextMenu kbookmarkcontextmenu.h KBookmarkContextMenu
0022  *
0023  * A context menu for a bookmark.
0024  */
0025 class KBOOKMARKSWIDGETS_EXPORT KBookmarkContextMenu : public QMenu
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     KBookmarkContextMenu(const KBookmark &bm, KBookmarkManager *manager, KBookmarkOwner *owner, QWidget *parent = nullptr);
0031     ~KBookmarkContextMenu() override;
0032     virtual void addActions();
0033 
0034     /**
0035      * Set this to true to make any "Edit Bookmarks" dialog
0036      * show UI elements that are specific to browsers.
0037      *
0038      * @since 6.0
0039      */
0040     void setBrowserMode(bool browserMode);
0041 
0042     /**
0043      * Whether any "Edit Bookmarks" dialog shows UI elements
0044      * that are specific to browsers.
0045      *
0046      * @since 6.0
0047      */
0048     bool browserMode() const;
0049 
0050 public Q_SLOTS:
0051     void slotEditAt();
0052     void slotProperties();
0053     void slotInsert();
0054     void slotRemove();
0055     void slotCopyLocation();
0056     void slotOpenFolderInTabs();
0057 
0058 protected:
0059     void addBookmark();
0060     void addFolderActions();
0061     void addProperties();
0062     void addBookmarkActions();
0063     void addOpenFolderInTabs();
0064 
0065     KBookmarkManager *manager() const;
0066     KBookmarkOwner *owner() const;
0067     KBookmark bookmark() const;
0068 
0069 private Q_SLOTS:
0070     KBOOKMARKS_NO_EXPORT void slotAboutToShow();
0071 
0072 private:
0073     // TODO KF6 dptr it
0074     const KBookmark bm;
0075     KBookmarkManager *const m_pManager;
0076     KBookmarkOwner *const m_pOwner;
0077     bool m_browserMode = false;
0078 };
0079 
0080 #endif