summaryrefslogtreecommitdiff
path: root/src/panels/bookmarkstoolbar.hpp
blob: 6aaa750ad38f148f162254e259f2a440194819ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* ============================================================
 *     The rekonq project
 * ============================================================
 * SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright (C) 2008-2013 by Andrea Diamantini <adjam7 at gmail dot com>
 * Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
 * SPDX-License-Identifier: GPL-3.0-only
 * Copyright (C) 2022 aqua <aqua@iserlohn-fortress.net>
 * ============================================================ */

#pragma once

#include "rekonq.hpp"
#include <QToolBar>

class BookmarksTreeModel;

/**
 * This class manage the bookmark toolbar.
 * Some events from the toolbar are handled to allow the drag and drop
 */
class BookmarkToolBar : public QToolBar {
  Q_OBJECT

public:
  explicit BookmarkToolBar(QWidget *parent = nullptr);
  ~BookmarkToolBar() override = default;

  void setModel(BookmarksTreeModel *ptr)
  {
    Q_CHECK_PTR(ptr);
    model = ptr;
  }

signals:
  void loadUrl(const QUrl &url, rekonq::OpenType type);

protected:
  void showEvent(QShowEvent *event) override;
  // bool eventFilter(QObject *watched, QEvent *event);

private slots:
  // void contextMenu(const QPoint &);
  // void menuDisplayed();
  // void menuHidden();
  // void hideMenu();
  // void dragDestroyed();

private:
  BookmarksTreeModel *model = nullptr;
  void startDrag();

  QPoint m_startDragPos;
  QAction *m_dragAction = nullptr;
  QAction *m_dropAction = nullptr;
  QAction *m_checkedAction = nullptr;
  bool m_filled = false;
};