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-2009, 2011 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_CLOSECONTROLLER_HPP
0010 #define KASTEN_CLOSECONTROLLER_HPP
0011 
0012 // Kasten gui
0013 #include <Kasten/AbstractXmlGuiController>
0014 
0015 class QAction;
0016 class KXMLGUIClient;
0017 
0018 namespace Kasten {
0019 
0020 class AbstractDocumentStrategy;
0021 class AbstractDocument;
0022 
0023 class CloseController : public AbstractXmlGuiController
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     CloseController(AbstractDocumentStrategy* documentStrategy,
0029                     KXMLGUIClient* guiClient,
0030                     bool supportMultiple = true);
0031     ~CloseController() override;
0032 
0033 public: // AbstractXmlGuiController API
0034     void setTargetModel(AbstractModel* model) override;
0035 
0036 private Q_SLOTS:
0037     void close();
0038     void closeAll();
0039     void closeAllOther();
0040 
0041     void onDocumentsChanged();
0042 
0043 private:
0044     AbstractDocumentStrategy* mDocumentStrategy;
0045 
0046     AbstractDocument* mDocument = nullptr;
0047     QAction* mCloseAction;
0048     QAction* mCloseAllAction;
0049     QAction* mCloseAllOtherAction;
0050 };
0051 
0052 }
0053 
0054 #endif