File indexing completed on 2024-05-12 16:59:36
0001 /* 0002 * SPDX-FileCopyrightText: 2014 David Edmundson <david@davidedmundson.co.uk> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-or-later 0005 * 0006 */ 0007 0008 #ifndef NOTEMANAGER_H 0009 #define NOTEMANAGER_H 0010 0011 #include <QObject> 0012 #include <QPointer> 0013 #include <QSharedPointer> 0014 0015 #include "abstractnoteloader.h" 0016 class Note; 0017 0018 class NoteManager : public QObject 0019 { 0020 Q_OBJECT 0021 0022 public: 0023 explicit NoteManager(QObject *parent = nullptr); 0024 0025 /** 0026 * Loads the note for the ID given 0027 * Ownership is passed to the QML context 0028 */ 0029 Q_INVOKABLE Note *loadNote(const QString &id); 0030 0031 /** 0032 * Remove any resources associated with the note ID 0033 */ 0034 Q_INVOKABLE void deleteNoteResources(const QString &id); 0035 0036 // LATER QAbstractListModel* notesModel(); //list of all notes 0037 0038 private: 0039 // ref count backends so that we only have for all notes 0040 static QSharedPointer<AbstractNoteLoader> loadBackend(); 0041 0042 QSharedPointer<AbstractNoteLoader> m_backend; 0043 QWeakPointer<Note> m_lastNote; 0044 }; 0045 0046 #endif // NOTEMANAGER_H