]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/places/placespanel.h
Build with QT_NO_KEYWORDS
[dolphin.git] / src / panels / places / placespanel.h
1 /*
2 * SPDX-FileCopyrightText: 2008-2012 Peter Penz <peter.penz19@gmail.com>
3 * SPDX-FileCopyrightText: 2010 Christian Muehlhaeuser <muesli@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8 #ifndef PLACESPANEL_H
9 #define PLACESPANEL_H
10
11 #include "panels/panel.h"
12
13 #include <QUrl>
14 #include <QTimer>
15
16 class KItemListController;
17 class PlacesItemModel;
18 class PlacesView;
19 class QGraphicsSceneDragDropEvent;
20 class QMenu;
21 class QMimeData;
22 /**
23 * @brief Combines bookmarks and mounted devices as list.
24 */
25 class PlacesPanel : public Panel
26 {
27 Q_OBJECT
28
29 public:
30 explicit PlacesPanel(QWidget* parent);
31 ~PlacesPanel() override;
32 void proceedWithTearDown();
33
34 bool eventFilter(QObject *obj, QEvent *event) override;
35
36 Q_SIGNALS:
37 void placeActivated(const QUrl& url);
38 void placeMiddleClicked(const QUrl& url);
39 void errorMessage(const QString& error);
40 void storageTearDownRequested(const QString& mountPath);
41 void storageTearDownExternallyRequested(const QString& mountPath);
42 void showHiddenEntriesChanged(bool shown);
43 void storageTearDownSuccessful();
44
45 protected:
46 bool urlChanged() override;
47 void showEvent(QShowEvent* event) override;
48
49 public Q_SLOTS:
50 void readSettings() override;
51 void showHiddenEntries(bool shown);
52 int hiddenListCount();
53
54 private Q_SLOTS:
55 void slotItemActivated(int index);
56 void slotItemMiddleClicked(int index);
57 void slotItemContextMenuRequested(int index, const QPointF& pos);
58 void slotViewContextMenuRequested(const QPointF& pos);
59 void slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event);
60 void slotItemDropEventStorageSetupDone(int index, bool success);
61 void slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event);
62 void slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* parent);
63 void slotStorageSetupDone(int index, bool success);
64 void slotShowTooltip();
65
66 private:
67 void addEntry();
68 void editEntry(int index);
69
70 /**
71 * Selects the item that matches the URL set
72 * for the panel (see Panel::setUrl()).
73 */
74 void selectItem();
75
76 void triggerItem(int index, Qt::MouseButton button);
77
78 QAction* buildGroupContextMenu(QMenu* menu, int index);
79
80 private:
81 KItemListController* m_controller;
82 PlacesItemModel* m_model;
83 PlacesView* m_view;
84
85 QUrl m_storageSetupFailedUrl;
86 Qt::MouseButton m_triggerStorageSetupButton;
87
88 int m_itemDropEventIndex;
89 QMimeData* m_itemDropEventMimeData;
90 QDropEvent* m_itemDropEvent;
91 QTimer m_tooltipTimer;
92 int m_hoveredIndex;
93 QPoint m_hoverPos;
94 };
95
96 #endif // PLACESPANEL_H