Warning, file /utilities/okteta/parts/kpart/part.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     This file is part of the Okteta KPart module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2003, 2007, 2009 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 OKTETAPART_HPP
0010 #define OKTETAPART_HPP
0011 
0012 // Kasten
0013 #include <Kasten/KastenCore>
0014 // KF
0015 #include <kparts_version.h>
0016 #include <KParts/ReadWritePart>
0017 // Qt
0018 #include <QVector>
0019 
0020 namespace Kasten {
0021 class ByteArrayViewProfileManager;
0022 class ByteArrayView;
0023 class ByteArrayDocument;
0024 class SingleViewArea;
0025 class ModelCodecViewManager;
0026 class ModelCodecManager;
0027 class AbstractXmlGuiController;
0028 class AbstractXmlGuiControllerFactory;
0029 class AbstractDocument;
0030 }
0031 #if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
0032 class KPluginMetaData;
0033 #else
0034 class KAboutData;
0035 #endif
0036 class QVBoxLayout;
0037 
0038 class OktetaPart : public KParts::ReadWritePart
0039 {
0040     Q_OBJECT
0041 
0042     friend class OktetaBrowserExtension;
0043 
0044 public:
0045     enum Modus
0046     {
0047         ReadOnly = 0,
0048         BrowserView = 1,
0049         ReadWrite = 2
0050     };
0051 
0052 public:
0053     OktetaPart(QObject* parent,
0054 #if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
0055                const KPluginMetaData& metaData,
0056 #else
0057                const KAboutData& componentData,
0058 #endif
0059                Modus modus,
0060                Kasten::ByteArrayViewProfileManager* viewProfileManager,
0061                Kasten::ModelCodecManager* modelCodecManager,
0062                Kasten::ModelCodecViewManager* modelCodecViewManager);
0063 
0064     ~OktetaPart() override;
0065 
0066 public: // KParts::ReadWritePart API
0067     void setReadWrite(bool readWrite = true) override;
0068 
0069 Q_SIGNALS:
0070     void hasSelectedDataChanged(bool hasSelectedData);
0071 
0072 protected: // KParts::ReadWritePart API
0073     bool saveFile() override;
0074 
0075 protected: // KParts::ReadOnlyPart API
0076     bool openFile() override;
0077 
0078 private:
0079     void setupActions(bool browserViewWanted);
0080     void addController(const Kasten::AbstractXmlGuiControllerFactory& factory);
0081 
0082 private:
0083     Kasten::ByteArrayView* byteArrayView() const;
0084 
0085 private Q_SLOTS:
0086     void onDocumentLoaded(Kasten::AbstractDocument* document);
0087     void onModified(Kasten::LocalSyncState state);
0088 
0089 private:
0090     const Modus mModus;
0091     QVBoxLayout* mLayout;
0092 
0093     Kasten::ByteArrayDocument* mDocument;
0094     Kasten::ByteArrayView* mByteArrayView;
0095 
0096     Kasten::SingleViewArea* mSingleViewArea;
0097     QVector<Kasten::AbstractXmlGuiController*> mControllers;
0098 
0099     Kasten::ByteArrayViewProfileManager* mViewProfileManager;
0100 };
0101 
0102 inline Kasten::ByteArrayView* OktetaPart::byteArrayView() const { return mByteArrayView; }
0103 
0104 #endif