1 /* 2 This file is part of the Kasten Framework, made within the KDE community. 3 4 SPDX-FileCopyrightText: 2006-2008 Friedrich W. H. Kossebau <kossebau@kde.org> 5 6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 7 */ 8 9 #ifndef KASTEN_CLIPBOARDCONTROLLER_HPP 10 #define KASTEN_CLIPBOARDCONTROLLER_HPP 11 12 // Kasten gui 13 #include <Kasten/AbstractXmlGuiController> 14 15 class KXMLGUIClient; 16 class QAction; 17 18 namespace Kasten { 19 20 namespace If { 21 class DataSelectable; 22 class SelectedDataWriteable; 23 class SelectedDataCutable; 24 } 25 26 class ClipboardController : public AbstractXmlGuiController 27 { 28 Q_OBJECT 29 30 public: 31 explicit ClipboardController(KXMLGUIClient* guiClient); 32 33 public: // AbstractXmlGuiController API 34 void setTargetModel(AbstractModel* model) override; 35 36 private Q_SLOTS: // action slots 37 void cut(); 38 void copy(); 39 void paste(); 40 41 private Q_SLOTS: 42 void onHasSelectedDataChanged(bool hasSelectedData); 43 void onCanCutSelectedDataChanged(bool canCutSelectedData); 44 void onReadOnlyChanged(bool isReadOnly); 45 void onClipboardDataChanged(); 46 47 private: 48 AbstractModel* mModel = nullptr; 49 If::DataSelectable* mSelectionControl = nullptr; 50 If::SelectedDataWriteable* mMimeDataControl = nullptr; 51 If::SelectedDataCutable* mCutControl = nullptr; 52 53 QAction* mCutAction; 54 QAction* mCopyAction; 55 QAction* mPasteAction; 56 }; 57 58 } 59 60 #endif 61