]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinremoveaction.h
Output of licensedigger + manual cleanup afterwards.
[dolphin.git] / src / dolphinremoveaction.h
1 /*
2 * SPDX-FileCopyrightText: 2013 Dawit Alemayehu <adawit@kde.org>
3 * SPDX-FileCopyrightText: 2017 Elvis Angelaccio <elvis.angelaccio@kde.org>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8 #ifndef DOLPHINREMOVEACTION_H
9 #define DOLPHINREMOVEACTION_H
10
11 #include "dolphin_export.h"
12
13 #include <KActionCollection>
14
15 #include <QAction>
16 #include <QPointer>
17
18 /**
19 * A QAction that manages the delete based on the current state of
20 * the Shift key or the parameter passed to update.
21 *
22 * This class expects the presence of both the KStandardAction::MoveToTrash and
23 * KStandardAction::DeleteFile actions in @ref collection.
24 */
25 class DOLPHIN_EXPORT DolphinRemoveAction : public QAction
26 {
27 Q_OBJECT
28 public:
29
30 enum class ShiftState {
31 Unknown,
32 Pressed,
33 Released
34 };
35
36 DolphinRemoveAction(QObject* parent, KActionCollection* collection);
37
38 /**
39 * Updates this action key based on @p shiftState.
40 * Default value is QueryShiftState, meaning it will query QGuiApplication::modifiers().
41 */
42 void update(ShiftState shiftState = ShiftState::Unknown);
43
44 private Q_SLOTS:
45 void slotRemoveActionTriggered();
46
47 private:
48 QPointer<KActionCollection> m_collection;
49 QPointer<QAction> m_action;
50 };
51
52 #endif