File indexing completed on 2024-04-28 08:50:37

0001 //  -*- c-basic-offset:4; indent-tabs-mode:nil -*-
0002 /* This file is part of the KDE project
0003    SPDX-FileCopyrightText: 1999 Kurt Granroth <granroth@kde.org>
0004 
0005    SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 #ifndef KONQBOOKMARKBAR_H
0008 #define KONQBOOKMARKBAR_H
0009 
0010 #include <QObject>
0011 #include <QPointer>
0012 #include <QList>
0013 #include <kbookmark.h>
0014 #include <kactioncollection.h>
0015 
0016 class KToolBar;
0017 class KBookmarkMenu;
0018 class KBookmarkOwner;
0019 class KBookmarkBarPrivate;
0020 class KBookmarkManager;
0021 
0022 /**
0023  * This class provides a bookmark toolbar.  Using this class is nearly
0024  * identical to using KBookmarkMenu so follow the directions
0025  * there.
0026  */
0027 //FIXME rename KonqBookmarkBar
0028 class KBookmarkBar : public QObject
0029 {
0030     Q_OBJECT
0031 public:
0032     /**
0033      * Fills a bookmark toolbar
0034      *
0035      * @param manager the bookmark manager
0036      * @param owner implementation of the KBookmarkOwner interface (callbacks)
0037      * @param toolBar toolbar to fill
0038      *
0039      * The KActionCollection pointer argument is now obsolete.
0040      *
0041      * @param parent the parent widget for the bookmark toolbar
0042      */
0043     KBookmarkBar(KBookmarkManager *manager,
0044                  KBookmarkOwner *owner, KToolBar *toolBar,
0045                  QObject *parent = nullptr);
0046 
0047     ~KBookmarkBar() override;
0048 
0049     QString parentAddress();
0050 
0051 public Q_SLOTS:
0052     void clear();
0053     void contextMenu(const QPoint &);
0054 
0055     void slotBookmarksChanged(const QString &);
0056     void slotConfigChanged();
0057 
0058 protected:
0059     void fillBookmarkBar(const KBookmarkGroup &parent);
0060     bool eventFilter(QObject *o, QEvent *e) override;
0061 
0062 private:
0063     KBookmarkGroup getToolbar();
0064     void removeTempSep();
0065     bool handleToolbarDragMoveEvent(const QPoint &pos, const QList<QAction *> &actions, const QString &text);
0066 
0067     KBookmarkOwner *m_pOwner;
0068     QPointer<KToolBar> m_toolBar;
0069     KActionCollection *m_actionCollection;
0070     KBookmarkManager *m_pManager;
0071     QList<KBookmarkMenu *> m_lstSubMenus;
0072     QAction *m_toolBarSeparator;
0073 
0074     KBookmarkBarPrivate *const d;
0075 };
0076 
0077 #endif // KONQBOOKMARKBAR_H