File indexing completed on 2025-01-26 05:24:16

0001 /*
0002     This file is part of the Kasten Framework, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 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_VERSIONCONTROLLER_HPP
0010 #define KASTEN_VERSIONCONTROLLER_HPP
0011 
0012 // Kasten gui
0013 #include <Kasten/AbstractXmlGuiController>
0014 
0015 class KXMLGUIClient;
0016 class KToolBarPopupAction;
0017 class QAction;
0018 
0019 namespace Kasten {
0020 
0021 namespace If {
0022 class Versionable;
0023 }
0024 
0025 class VersionController : public AbstractXmlGuiController
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     explicit VersionController(KXMLGUIClient* guiClient);
0031 
0032 public: // AbstractXmlGuiController API
0033     void setTargetModel(AbstractModel* model) override;
0034 
0035 private Q_SLOTS: // action slots
0036     void onSetToOlderVersionTriggered();
0037     void onSetToNewerVersionTriggered();
0038     void onOlderVersionMenuAboutToShow();
0039     void onNewerVersionMenuAboutToShow();
0040     void onOlderVersionMenuTriggered(QAction* action);
0041     void onNewerVersionMenuTriggered(QAction* action);
0042 
0043     void onVersionIndexChanged(int versionIndex);
0044     void onReadOnlyChanged(bool isReadOnly);
0045 
0046 private:
0047     AbstractModel* mModel = nullptr;
0048     If::Versionable* mVersionControl = nullptr;
0049 
0050     KToolBarPopupAction* mSetToOlderVersionAction;
0051     KToolBarPopupAction* mSetToNewerVersionAction;
0052 };
0053 
0054 }
0055 
0056 #endif