File indexing completed on 2024-07-14 14:26:46

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 2003 Alexander Kellett <lypanov@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KONQBOOKMARKMENU_P_H
0009 #define KONQBOOKMARKMENU_P_H
0010 
0011 #include "kbookmarkimporter.h"
0012 #include "kbookmarkmenu.h"
0013 
0014 #include <KActionMenu>
0015 #include <QStack>
0016 
0017 class QString;
0018 class QMenu;
0019 class KBookmark;
0020 class KBookmarkOwner;
0021 
0022 #if KBOOKMARKS_BUILD_DEPRECATED_SINCE(5, 65)
0023 class KImportedBookmarkMenu : public KBookmarkMenu
0024 {
0025     friend class KBookmarkMenuImporter;
0026     Q_OBJECT
0027 public:
0028     // TODO simplfy
0029     KImportedBookmarkMenu(KBookmarkManager *mgr, KBookmarkOwner *owner, QMenu *parentMenu, const QString &type, const QString &location);
0030     KImportedBookmarkMenu(KBookmarkManager *mgr, KBookmarkOwner *owner, QMenu *parentMenu);
0031     ~KImportedBookmarkMenu() override;
0032     void clear() override;
0033     void refill() override;
0034 protected Q_SLOTS:
0035     void slotNSLoad();
0036 
0037 private:
0038     QString m_type;
0039     QString m_location;
0040 };
0041 
0042 /**
0043  * A class connected to KNSBookmarkImporter, to fill KActionMenus.
0044  */
0045 class KBookmarkMenuImporter : public QObject
0046 {
0047     Q_OBJECT
0048 public:
0049     KBookmarkMenuImporter(KBookmarkManager *mgr, KImportedBookmarkMenu *menu)
0050         : m_menu(menu)
0051         , m_pManager(mgr)
0052     {
0053     }
0054 
0055     void openBookmarks(const QString &location, const QString &type);
0056     void connectToImporter(const QObject &importer);
0057 
0058 protected Q_SLOTS:
0059     void newBookmark(const QString &text, const QString &url, const QString &);
0060     void newFolder(const QString &text, bool, const QString &);
0061     void newSeparator();
0062     void endFolder();
0063 
0064 protected:
0065     QStack<KImportedBookmarkMenu *> mstack;
0066     KImportedBookmarkMenu *m_menu;
0067     KBookmarkManager *m_pManager;
0068 };
0069 
0070 #include "kbookmarkactioninterface.h"
0071 
0072 class KImportedBookmarkActionMenu : public KActionMenu, public KBookmarkActionInterface
0073 {
0074     Q_OBJECT
0075 public:
0076     KImportedBookmarkActionMenu(const QIcon &icon, const QString &text, QObject *parent)
0077         : KActionMenu(icon, text, parent)
0078         , KBookmarkActionInterface(KBookmark())
0079     {
0080     }
0081     ~KImportedBookmarkActionMenu() override
0082     {
0083     }
0084 };
0085 
0086 #endif
0087 
0088 #endif