]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/places/placespanel.h
Merge branch 'release/21.12'
[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 * SPDX-FileCopyrightText: 2021 Kai Uwe Broulik <kde@broulik.de>
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9 #ifndef PLACESPANEL_H
10 #define PLACESPANEL_H
11
12 #include "panels/panel.h"
13
14 #include <QUrl>
15 #include <KFilePlacesView>
16
17 #include <Solid/SolidNamespace> // Solid::ErrorType
18
19 class QTimer;
20 namespace Solid
21 {
22 class StorageAccess;
23 }
24
25 /**
26 * @brief Combines bookmarks and mounted devices as list.
27 */
28 class PlacesPanel : public KFilePlacesView
29 {
30 Q_OBJECT
31
32 public:
33 explicit PlacesPanel(QWidget* parent);
34 ~PlacesPanel() override;
35
36 void setUrl(const QUrl &url); // override
37
38 // for compatibility with Panel, actions that are shown
39 // on the view's context menu
40 QList<QAction*> customContextMenuActions() const;
41 void setCustomContextMenuActions(const QList<QAction*>& actions);
42
43 void requestTearDown();
44 void proceedWithTearDown();
45
46 public Q_SLOTS:
47 void readSettings();
48
49 Q_SIGNALS:
50 void errorMessage(const QString& error);
51 void storageTearDownRequested(const QString& mountPath);
52 void storageTearDownExternallyRequested(const QString& mountPath);
53 void storageTearDownSuccessful();
54
55 protected:
56 void showEvent(QShowEvent* event) override;
57
58 private Q_SLOTS:
59 void slotConfigureTrash();
60 void slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* parent);
61 void slotContextMenuAboutToShow(const QModelIndex &index, QMenu *menu);
62 void slotTearDownRequested(const QModelIndex &index);
63 void slotTearDownRequestedExternally(const QString &udi);
64 void slotTearDownDone(Solid::ErrorType error, const QVariant& errorData);
65 void slotRowsInserted(const QModelIndex &parent, int first, int last);
66 void slotRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
67
68 private:
69 void connectDeviceSignals(const QModelIndex &idx);
70
71 QUrl m_url; // only used for initial setUrl
72 QList<QAction*> m_customContextMenuActions;
73
74 Solid::StorageAccess *m_deviceToTearDown = nullptr;
75
76 QAction *m_configureTrashAction;
77 QAction *m_lockPanelsAction;
78 };
79
80 #endif // PLACESPANEL_H