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