File indexing completed on 2024-10-13 12:09:30

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 __konqbookmarkmenu_h__
0010 #define __konqbookmarkmenu_h__
0011 
0012 #include "kbookmarkactionmenu.h"
0013 #include "kbookmarkcontextmenu.h"
0014 #include "kbookmarkmenu.h"
0015 
0016 #if KBOOKMARKS_ENABLE_DEPRECATED_SINCE(5, 0)
0017 #include "kbookmarkowner.h" // for SC reasons
0018 
0019 typedef KBookmarkOwner KonqBookmarkOwner; // KF5: KonqBookmarkOwner is deprecated, use KBookmarkOwner
0020 #endif
0021 
0022 #if KBOOKMARKS_ENABLE_DEPRECATED_SINCE(5, 65)
0023 /**
0024  * @class KonqBookmarkMenu konqbookmarkmenu.h KonqBookmarkMenu
0025  *
0026  * Bookmark menu with dynamic import features, only used by Konqueror
0027  * @deprecated since 5.65, this class has moved to Konqueror
0028  */
0029 class KBOOKMARKS_EXPORT KonqBookmarkMenu : public KBookmarkMenu
0030 {
0031     // friend class KBookmarkBar;
0032     Q_OBJECT
0033 public:
0034     /**
0035      * Fills a bookmark menu with konquerors bookmarks
0036      * (one instance of KonqBookmarkMenu is created for the toplevel menu,
0037      *  but also one per submenu).
0038      *
0039      * @param mgr The bookmark manager to use (i.e. for reading and writing)
0040      * @param owner implementation of the KBookmarkOwner callback interface.
0041      * Note: If you pass a null KBookmarkOwner to the constructor, the
0042      * URLs are opened by QDesktopServices::openUrl and "Add Bookmark" is disabled.
0043      * @param parentMenu menu to be filled
0044      * @param collec parent collection for the KActions.
0045      * @deprecated since 5.65 This class has moved to Konqueror
0046      */
0047     KBOOKMARKS_DEPRECATED_VERSION(5, 65, "This class has moved to Konqueror")
0048     KonqBookmarkMenu(KBookmarkManager *mgr, KBookmarkOwner *owner, KBookmarkActionMenu *parentMenu, KActionCollection *collec)
0049         : KBookmarkMenu(mgr, owner, parentMenu->menu(), collec)
0050     {
0051     }
0052     ~KonqBookmarkMenu() override
0053     {
0054     }
0055 
0056     /**
0057      * Creates a bookmark submenu.
0058      * Only used internally and for bookmark toolbar.
0059      * @deprecated since 5.65 This class has moved to Konqueror
0060      */
0061     KBOOKMARKS_DEPRECATED_VERSION(5, 65, "This class has moved to Konqueror")
0062     KonqBookmarkMenu(KBookmarkManager *mgr, KBookmarkOwner *owner, KBookmarkActionMenu *parentMenu, QString parentAddress)
0063         : KBookmarkMenu(mgr, owner, parentMenu->menu(), parentAddress)
0064     {
0065     }
0066 
0067 protected:
0068     /**
0069      * Structure used for storing information about
0070      * the dynamic menu setting
0071      */
0072     struct DynMenuInfo {
0073         bool show;
0074         QString location;
0075         QString type;
0076         QString name;
0077         class DynMenuInfoPrivate *d;
0078     };
0079 
0080     /**
0081      * @return dynmenu info block for the given dynmenu name
0082      */
0083     static DynMenuInfo showDynamicBookmarks(const QString &id);
0084 
0085     /**
0086      * Shows an extra menu for the given bookmarks file and type.
0087      * Upgrades from option inside XBEL to option in rc file
0088      * on first call of this function.
0089      * @param id the unique identification for the dynamic menu
0090      * @param info a DynMenuInfo struct containing the to be added/modified data
0091      */
0092     static void setDynamicBookmarks(const QString &id, const DynMenuInfo &info);
0093 
0094     /**
0095      * @return list of dynamic menu ids
0096      */
0097     static QStringList dynamicBookmarksList();
0098 
0099     void refill() override;
0100     QAction *actionForBookmark(const KBookmark &bm) override;
0101     QMenu *contextMenu(QAction *action) override;
0102     void fillDynamicBookmarks();
0103 };
0104 
0105 /**
0106  * Browser-specific context menu
0107  * @deprecated since 5.65, this class has moved to Konqueror
0108  */
0109 class KBOOKMARKS_EXPORT KonqBookmarkContextMenu : public KBookmarkContextMenu
0110 {
0111     Q_OBJECT
0112 public:
0113     /**
0114      * Browser-specific context menu
0115      * @deprecated since 5.65, this class has moved to Konqueror
0116      */
0117     KBOOKMARKS_DEPRECATED_VERSION(5, 65, "This class has moved to Konqueror")
0118     KonqBookmarkContextMenu(const KBookmark &bm, KBookmarkManager *mgr, KBookmarkOwner *owner);
0119     ~KonqBookmarkContextMenu() override;
0120     void addActions() override;
0121 
0122 public Q_SLOTS:
0123     void openInNewTab();
0124     void openInNewWindow();
0125     void toggleShowInToolbar();
0126 };
0127 
0128 #endif
0129 
0130 #endif