File indexing completed on 2024-09-22 05:16:05

0001 /*
0002     This file is part of the Kasten Framework, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2006-2008 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef KASTEN_CLIPBOARDCONTROLLER_HPP
0010 #define KASTEN_CLIPBOARDCONTROLLER_HPP
0011 
0012 // Kasten gui
0013 #include <Kasten/AbstractXmlGuiController>
0014 
0015 class KXMLGUIClient;
0016 class QAction;
0017 
0018 namespace Kasten {
0019 
0020 namespace If {
0021 class DataSelectable;
0022 class SelectedDataWriteable;
0023 }
0024 
0025 class ClipboardController : public AbstractXmlGuiController
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     explicit ClipboardController(KXMLGUIClient* guiClient);
0031 
0032 public: // AbstractXmlGuiController API
0033     void setTargetModel(AbstractModel* model) override;
0034 
0035 private Q_SLOTS: // action slots
0036     void cut();
0037     void copy();
0038     void paste();
0039 
0040 private Q_SLOTS:
0041     void onHasSelectedDataChanged(bool hasSelectedData);
0042     void onCanCutSelectedDataChanged(bool canCutSelectedData);
0043     void onReadOnlyChanged(bool isReadOnly);
0044     void onClipboardDataChanged();
0045 
0046 private:
0047     AbstractModel* mModel = nullptr;
0048     If::DataSelectable* mSelectionControl = nullptr;
0049     If::SelectedDataWriteable* mMimeDataControl = nullptr;
0050 
0051     QAction* mCutAction;
0052     QAction* mCopyAction;
0053     QAction* mPasteAction;
0054 };
0055 
0056 }
0057 
0058 #endif