File indexing completed on 2024-04-28 05:46:32

0001 /*
0002     SPDX-FileCopyrightText: 2009-2010 Volker Lanz <vl@fidra.de>
0003     SPDX-FileCopyrightText: 2014-2017 Andrius Štikonas <andrius@stikonas.eu>
0004     SPDX-FileCopyrightText: 2019 Yuri Chornoivan <yurchor@ukr.net>
0005 
0006     SPDX-License-Identifier: GPL-3.0-or-later
0007 */
0008 
0009 
0010 #if !defined(LISTOPERATIONS_H)
0011 
0012 #define LISTOPERATIONS_H
0013 
0014 #include <core/operationstack.h>
0015 
0016 #include "ui_listoperationsbase.h"
0017 
0018 #include <QWidget>
0019 
0020 class Operation;
0021 class QPoint;
0022 class KActionCollection;
0023 
0024 /** A list of pending operations.
0025 
0026     @author Volker Lanz <vl@fidra.de>
0027 */
0028 class ListOperations : public QWidget, public Ui::ListOperationsBase
0029 {
0030     Q_DISABLE_COPY(ListOperations)
0031 
0032 public:
0033     explicit ListOperations(QWidget* parent = nullptr);
0034 
0035 public:
0036     void setActionCollection(KActionCollection* coll) {
0037         m_ActionCollection = coll;
0038     }
0039 
0040     void updateOperations(const OperationStack::Operations& ops);
0041 
0042     QListWidget& listOperations() {
0043         Q_ASSERT(m_ListOperations);
0044         return *m_ListOperations;
0045     }
0046 
0047 protected:
0048     KActionCollection* actionCollection() {
0049         return m_ActionCollection;
0050     }
0051 
0052     const QListWidget& listOperations() const {
0053         Q_ASSERT(m_ListOperations);
0054         return *m_ListOperations;
0055     }
0056 
0057     void customContextMenuRequested(const QPoint& pos);
0058 
0059 private:
0060     KActionCollection* m_ActionCollection;
0061 };
0062 
0063 #endif
0064