2023-05-18 22:59:10 +00:00
|
|
|
#ifndef LOCALDOCS_H
|
|
|
|
#define LOCALDOCS_H
|
|
|
|
|
2023-05-23 02:13:42 +00:00
|
|
|
#include "localdocsmodel.h"
|
|
|
|
#include "database.h"
|
2023-05-18 22:59:10 +00:00
|
|
|
|
2023-05-23 02:13:42 +00:00
|
|
|
#include <QObject>
|
2023-05-18 22:59:10 +00:00
|
|
|
|
|
|
|
class LocalDocs : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2023-05-23 02:13:42 +00:00
|
|
|
Q_PROPERTY(LocalDocsModel *localDocsModel READ localDocsModel NOTIFY localDocsModelChanged)
|
2023-05-18 22:59:10 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
static LocalDocs *globalInstance();
|
|
|
|
|
2023-05-23 02:13:42 +00:00
|
|
|
LocalDocsModel *localDocsModel() const { return m_localDocsModel; }
|
2023-05-21 19:13:28 +00:00
|
|
|
|
2023-05-23 02:13:42 +00:00
|
|
|
Q_INVOKABLE void addFolder(const QString &collection, const QString &path);
|
|
|
|
Q_INVOKABLE void removeFolder(const QString &collection, const QString &path);
|
2023-05-18 22:59:10 +00:00
|
|
|
|
|
|
|
QList<QString> result() const { return m_retrieveResult; }
|
|
|
|
void requestRetrieve(const QList<QString> &collections, const QString &text);
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void requestAddFolder(const QString &collection, const QString &path);
|
|
|
|
void requestRemoveFolder(const QString &collection, const QString &path);
|
|
|
|
void requestRetrieveFromDB(const QList<QString> &collections, const QString &text);
|
|
|
|
void receivedResult();
|
2023-05-23 02:13:42 +00:00
|
|
|
void localDocsModelChanged();
|
2023-05-18 22:59:10 +00:00
|
|
|
|
|
|
|
private Q_SLOTS:
|
2023-05-21 19:13:28 +00:00
|
|
|
void handleRetrieveResult(const QList<QString> &result);
|
2023-05-18 22:59:10 +00:00
|
|
|
|
|
|
|
private:
|
2023-05-23 02:13:42 +00:00
|
|
|
LocalDocsModel *m_localDocsModel;
|
2023-05-18 22:59:10 +00:00
|
|
|
Database *m_database;
|
|
|
|
QList<QString> m_retrieveResult;
|
|
|
|
|
|
|
|
private:
|
|
|
|
explicit LocalDocs();
|
|
|
|
~LocalDocs() {}
|
|
|
|
friend class MyLocalDocs;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LOCALDOCS_H
|