]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/places/placespanel.h
DragAndDropHelper::updateDropAction: use StatJob for remote URLs
[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 #include "views/draganddrophelper.h"
14
15 #include <KFilePlacesView>
16 #include <QUrl>
17
18 #include <Solid/SolidNamespace> // Solid::ErrorType
19
20 class QTimer;
21 namespace Solid
22 {
23 class StorageAccess;
24 }
25
26 /**
27 * @brief Combines bookmarks and mounted devices as list.
28 */
29 class PlacesPanel : public KFilePlacesView
30 {
31 Q_OBJECT
32
33 public:
34 explicit PlacesPanel(QWidget *parent);
35 ~PlacesPanel() override;
36
37 void setUrl(const QUrl &url); // override
38
39 // for compatibility with Panel, actions that are shown
40 // on the view's context menu
41 QList<QAction *> customContextMenuActions() const;
42 void setCustomContextMenuActions(const QList<QAction *> &actions);
43
44 void requestTearDown();
45 void proceedWithTearDown();
46
47 public Q_SLOTS:
48 void readSettings();
49
50 Q_SIGNALS:
51 void errorMessage(const QString &error);
52 void storageTearDownRequested(const QString &mountPath);
53 void storageTearDownExternallyRequested(const QString &mountPath);
54 void storageTearDownSuccessful();
55 void openInSplitViewRequested(const QUrl &url);
56
57 protected:
58 void showEvent(QShowEvent *event) override;
59 void dragMoveEvent(QDragMoveEvent *event) override;
60
61 private Q_SLOTS:
62 void slotConfigureTrash();
63 void slotUrlsDropped(const QUrl &dest, QDropEvent *event, QWidget *parent);
64 void slotContextMenuAboutToShow(const QModelIndex &index, QMenu *menu);
65 void slotTearDownRequested(const QModelIndex &index);
66 void slotTearDownRequestedExternally(const QString &udi);
67 void slotTearDownDone(const QModelIndex &index, Solid::ErrorType error, const QVariant &errorData);
68 void slotRowsInserted(const QModelIndex &parent, int first, int last);
69 void slotRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
70
71 private:
72 void connectDeviceSignals(const QModelIndex &idx);
73
74 QUrl m_url; // only used for initial setUrl
75 QList<QAction *> m_customContextMenuActions;
76
77 QPersistentModelIndex m_indexToTearDown;
78
79 QAction *m_configureTrashAction;
80 QAction *m_openInSplitView;
81 QAction *m_lockPanelsAction;
82
83 DragAndDropHelper m_dragAndDropHelper;
84 };
85
86 #endif // PLACESPANEL_H