]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinremoveaction.h
GIT_SILENT Sync po/docbooks with svn
[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 enum class ShiftState { Unknown, Pressed, Released };
30
31 DolphinRemoveAction(QObject *parent, KActionCollection *collection);
32
33 /**
34 * Updates this action key based on @p shiftState.
35 * Default value is QueryShiftState, meaning it will query QGuiApplication::modifiers().
36 */
37 void update(ShiftState shiftState = ShiftState::Unknown);
38
39 private Q_SLOTS:
40 void slotRemoveActionTriggered();
41
42 private:
43 QPointer<KActionCollection> m_collection;
44 QPointer<QAction> m_action;
45 };
46
47 #endif