2020-08-25 17:07:38 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2013 Dawit Alemayehu <adawit@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2017 Elvis Angelaccio <elvis.angelaccio@kde.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2013-02-09 20:56:51 +00:00
|
|
|
|
|
|
|
#ifndef DOLPHINREMOVEACTION_H
|
|
|
|
#define DOLPHINREMOVEACTION_H
|
|
|
|
|
2015-02-25 11:12:55 +00:00
|
|
|
#include "dolphin_export.h"
|
2013-02-09 20:56:51 +00:00
|
|
|
|
2018-03-04 13:38:16 +00:00
|
|
|
#include <KActionCollection>
|
|
|
|
|
2013-02-09 20:56:51 +00:00
|
|
|
#include <QAction>
|
|
|
|
#include <QPointer>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A QAction that manages the delete based on the current state of
|
|
|
|
* the Shift key or the parameter passed to update.
|
|
|
|
*
|
2017-07-18 22:00:37 +00:00
|
|
|
* This class expects the presence of both the KStandardAction::MoveToTrash and
|
2017-03-10 18:31:33 +00:00
|
|
|
* KStandardAction::DeleteFile actions in @ref collection.
|
2013-02-09 20:56:51 +00:00
|
|
|
*/
|
2015-02-25 11:12:55 +00:00
|
|
|
class DOLPHIN_EXPORT DolphinRemoveAction : public QAction
|
2013-02-09 20:56:51 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-08-24 16:33:27 +00:00
|
|
|
|
|
|
|
enum class ShiftState {
|
|
|
|
Unknown,
|
|
|
|
Pressed,
|
|
|
|
Released
|
|
|
|
};
|
|
|
|
|
2013-02-09 20:56:51 +00:00
|
|
|
DolphinRemoveAction(QObject* parent, KActionCollection* collection);
|
2017-08-24 16:33:27 +00:00
|
|
|
|
2013-02-09 20:56:51 +00:00
|
|
|
/**
|
2017-08-24 16:33:27 +00:00
|
|
|
* Updates this action key based on @p shiftState.
|
|
|
|
* Default value is QueryShiftState, meaning it will query QGuiApplication::modifiers().
|
2013-02-09 20:56:51 +00:00
|
|
|
*/
|
2017-08-24 16:33:27 +00:00
|
|
|
void update(ShiftState shiftState = ShiftState::Unknown);
|
2013-02-09 20:56:51 +00:00
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void slotRemoveActionTriggered();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QPointer<KActionCollection> m_collection;
|
|
|
|
QPointer<QAction> m_action;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|