]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/places/placespanel.h
Add open in split view action
[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 <KFilePlacesView>
15 #include <QUrl>
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 void openInSplitViewRequested(const QUrl &url);
55
56 protected:
57 void showEvent(QShowEvent *event) override;
58 void dragMoveEvent(QDragMoveEvent *event) override;
59
60 private Q_SLOTS:
61 void slotConfigureTrash();
62 void slotUrlsDropped(const QUrl &dest, QDropEvent *event, QWidget *parent);
63 void slotContextMenuAboutToShow(const QModelIndex &index, QMenu *menu);
64 void slotTearDownRequested(const QModelIndex &index);
65 void slotTearDownRequestedExternally(const QString &udi);
66 void slotTearDownDone(const QModelIndex &index, Solid::ErrorType error, const QVariant &errorData);
67 void slotRowsInserted(const QModelIndex &parent, int first, int last);
68 void slotRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
69
70 private:
71 void connectDeviceSignals(const QModelIndex &idx);
72
73 QUrl m_url; // only used for initial setUrl
74 QList<QAction *> m_customContextMenuActions;
75
76 QPersistentModelIndex m_indexToTearDown;
77
78 QAction *m_configureTrashAction;
79 QAction *m_openInSplitView;
80 QAction *m_lockPanelsAction;
81 };
82
83 #endif // PLACESPANEL_H