File indexing completed on 2024-06-23 05:49:19

0001 /*
0002     This file is part of the Kasten Framework, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2007-2009, 2012 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_ABSTRACTDOCUMENT_HPP
0010 #define KASTEN_ABSTRACTDOCUMENT_HPP
0011 
0012 // lib
0013 #include "kastencore_export.hpp"
0014 #include "kastencore.hpp"
0015 #include "abstractmodel.hpp"
0016 
0017 namespace Kasten {
0018 class AbstractModelSynchronizer;
0019 class AbstractDocumentPrivate;
0020 
0021 // TODO: store creation time? And time of last modification or access?
0022 // last both might be too much overhead, unless modification and access are grained enough
0023 // in multiuser environment also author/creator and group/identity
0024 // we would end with a in-memory file/document system, why not?
0025 class KASTENCORE_EXPORT AbstractDocument : public AbstractModel
0026 {
0027     Q_OBJECT
0028 
0029     friend class AbstractModelSynchronizer;
0030     friend class DocumentManagerPrivate;
0031 
0032 protected:
0033     AbstractDocument();
0034 
0035 public:
0036     ~AbstractDocument() override;
0037 
0038 public: // API to be implemented
0039     // TODO: what about plurals?
0040     virtual QString typeName() const = 0;
0041     virtual QString mimeType() const = 0;
0042     virtual ContentFlags contentFlags() const = 0;
0043 
0044 public:
0045     void setSynchronizer(AbstractModelSynchronizer* synchronizer);
0046 
0047 public: // helper or basic?
0048     AbstractModelSynchronizer* synchronizer() const;
0049     QString id() const;
0050 
0051 Q_SIGNALS:
0052     void synchronizerChanged(Kasten::AbstractModelSynchronizer* newSynchronizer);
0053     void contentFlagsChanged(Kasten::ContentFlags contentFlags);
0054 
0055 protected:
0056     void setId(const QString& id);
0057 
0058 private:
0059     Q_DECLARE_PRIVATE(AbstractDocument)
0060 };
0061 
0062 }
0063 
0064 #endif