2013-02-09 20:56:51 +00:00
|
|
|
/***************************************************************************
|
2017-08-24 16:33:27 +00:00
|
|
|
* Copyright (C) 2013 by Dawit Alemayehu <adawit@kde.org> *
|
|
|
|
* Copyright (C) 2017 by Elvis Angelaccio <elvis.angelaccio@kde.org> *
|
2013-02-09 20:56:51 +00:00
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
#include <QPointer>
|
|
|
|
|
|
|
|
#include <KActionCollection>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|