1// -*- c-basic-offset:4; indent-tabs-mode:nil -*-
2// vim: set ts=4 sts=4 sw=4 et:
3/* This file is part of the KDE project
4 Copyright (C) 1999 Kurt Granroth <granroth@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21#ifndef KONQBOOKMARKBAR_H
22#define KONQBOOKMARKBAR_H
23
24#include <QtCore/QObject>
25#include <QtCore/QPointer>
26#include <QtCore/QList>
27#include <kbookmark.h>
28#include <kaction.h>
29
30class KToolBar;
31class KBookmarkMenu;
32class KonqBookmarkOwner;
33class KActionCollection;
34class KAction;
35class KBookmarkBarPrivate;
36
37/**
38 * This class provides a bookmark toolbar. Using this class is nearly
39 * identical to using KBookmarkMenu so follow the directions
40 * there.
41 */
42//FIXME rename KonqBookmarkBar
43class KBookmarkBar : public QObject
44{
45 Q_OBJECT
46public:
47 /**
48 * Fills a bookmark toolbar
49 *
50 * @param manager the bookmark manager
51 * @param owner implementation of the KonqBookmarkOwner interface (callbacks)
52 * @param toolBar toolbar to fill
53 *
54 * The KActionCollection pointer argument is now obsolete.
55 *
56 * @param parent the parent widget for the bookmark toolbar
57 */
58 KBookmarkBar( KBookmarkManager* manager,
59 KonqBookmarkOwner *owner, KToolBar *toolBar,
60 QObject *parent = 0);
61
62 virtual ~KBookmarkBar();
63
64 QString parentAddress();
65
66public Q_SLOTS:
67 void clear();
68 void contextMenu( const QPoint & );
69
70 void slotBookmarksChanged( const QString & );
71 void slotConfigChanged();
72
73protected:
74 void fillBookmarkBar( const KBookmarkGroup & parent );
75 virtual bool eventFilter( QObject *o, QEvent *e );
76
77private:
78 KBookmarkGroup getToolbar();
79 void removeTempSep();
80 bool handleToolbarDragMoveEvent(const QPoint& pos, const QList<KAction *>& actions, const QString &text);
81
82 KonqBookmarkOwner *m_pOwner;
83 QPointer<KToolBar> m_toolBar;
84 KActionCollection *m_actionCollection;
85 KBookmarkManager *m_pManager;
86 QList<KBookmarkMenu *> m_lstSubMenus;
87 QAction* m_toolBarSeparator;
88
89 KBookmarkBarPrivate * const d;
90};
91
92#endif // KONQBOOKMARKBAR_H
93