1 /***************************************************************************
2 * Copyright (C) 2013 by Dawit Alemayehu <adawit@kde.org> *
3 * Copyright (C) 2017 by Elvis Angelaccio <elvis.angelaccio@kde.org> *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #ifndef DOLPHINREMOVEACTION_H
22 #define DOLPHINREMOVEACTION_H
24 #include "dolphin_export.h"
29 #include <KActionCollection>
32 * A QAction that manages the delete based on the current state of
33 * the Shift key or the parameter passed to update.
35 * This class expects the presence of both the KStandardAction::MoveToTrash and
36 * KStandardAction::DeleteFile actions in @ref collection.
38 class DOLPHIN_EXPORT DolphinRemoveAction
: public QAction
43 enum class ShiftState
{
49 DolphinRemoveAction(QObject
* parent
, KActionCollection
* collection
);
52 * Updates this action key based on @p shiftState.
53 * Default value is QueryShiftState, meaning it will query QGuiApplication::modifiers().
55 void update(ShiftState shiftState
= ShiftState::Unknown
);
58 void slotRemoveActionTriggered();
61 QPointer
<KActionCollection
> m_collection
;
62 QPointer
<QAction
> m_action
;