]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/places/placespanel.h
PlacesItemListWidget: Use Solid to check if device is a network share
[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
15 class KItemListController;
16 class PlacesItemModel;
17 class PlacesView;
18 class QGraphicsSceneDragDropEvent;
19 class QMenu;
20 class QMimeData;
21 /**
22 * @brief Combines bookmarks and mounted devices as list.
23 */
24 class PlacesPanel : public Panel
25 {
26 Q_OBJECT
27
28 public:
29 explicit PlacesPanel(QWidget* parent);
30 ~PlacesPanel() override;
31 void proceedWithTearDown();
32
33 signals:
34 void placeActivated(const QUrl& url);
35 void placeMiddleClicked(const QUrl& url);
36 void errorMessage(const QString& error);
37 void storageTearDownRequested(const QString& mountPath);
38 void storageTearDownExternallyRequested(const QString& mountPath);
39 void showHiddenEntriesChanged(bool shown);
40 void storageTearDownSuccessful();
41
42 protected:
43 bool urlChanged() override;
44 void showEvent(QShowEvent* event) override;
45
46 public slots:
47 void readSettings() override;
48 void showHiddenEntries(bool shown);
49 int hiddenListCount();
50
51 private slots:
52 void slotItemActivated(int index);
53 void slotItemMiddleClicked(int index);
54 void slotItemContextMenuRequested(int index, const QPointF& pos);
55 void slotViewContextMenuRequested(const QPointF& pos);
56 void slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event);
57 void slotItemDropEventStorageSetupDone(int index, bool success);
58 void slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event);
59 void slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* parent);
60 void slotStorageSetupDone(int index, bool success);
61
62 private:
63 void addEntry();
64 void editEntry(int index);
65
66 /**
67 * Selects the item that has the closest URL for the URL set
68 * for the panel (see Panel::setUrl()).
69 */
70 void selectClosestItem();
71
72 void triggerItem(int index, Qt::MouseButton button);
73
74 QAction* buildGroupContextMenu(QMenu* menu, int index);
75
76 private:
77 KItemListController* m_controller;
78 PlacesItemModel* m_model;
79 PlacesView* m_view;
80
81 QUrl m_storageSetupFailedUrl;
82 Qt::MouseButton m_triggerStorageSetupButton;
83
84 int m_itemDropEventIndex;
85 QMimeData* m_itemDropEventMimeData;
86 QDropEvent* m_itemDropEvent;
87 };
88
89 #endif // PLACESPANEL_H