1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-27 10:32:58 +02:00
joplin/QtClient/JoplinQtClient/models/foldercollection.h
2016-12-31 10:48:18 +01:00

51 lines
989 B
C++
Executable File

#ifndef FOLDERCOLLECTION_H
#define FOLDERCOLLECTION_H
#include <stable.h>
#include "database.h"
#include "models/note.h"
#include "models/folder.h"
#include "sparsevector.hpp"
#include "simpletypes.h"
namespace jop {
class FolderCollection : public QObject {
Q_OBJECT
public:
//FolderCollection();
FolderCollection(Database& db, const QString &parentId, const QString& orderBy);
Folder at(int index) const;
int count() const;
Folder byId(const QString &id) const;
int idToIndex(const QString& id) const;
QString indexToId(int index) const;
void update(const QString& id, QStringList fields, VariantVector values);
void add(QStringList fields, VariantVector values);
void remove(const QString &id);
private:
QString parentId_;
QString orderBy_;
Database db_;
mutable QVector<Folder> cache_;
signals:
void changed(int from, int to, const QStringList& fields);
public slots:
void dispatcher_folderCreated(const QString& id);
};
}
#endif // FOLDERCOLLECTION_H