-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackagemodel.h
53 lines (38 loc) · 1.25 KB
/
packagemodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef PACKAGEMODEL_H
#define PACKAGEMODEL_H
#include <QAbstractItemModel>
#include <Plasma/PackageStructure>
class KDirWatch;
namespace Plasma
{
class Package;
} // namespace Plasma
class PackageModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit PackageModel(QObject *parent = 0);
~PackageModel();
void setPackageType(const QString &type);
QString packageType() const;
void setPackage(const QString &path);
QString package() const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
int rowCount(const QModelIndex & parent = QModelIndex()) const;
private:
void loadPackage();
private Q_SLOTS:
void fileAddedOnDisk(const QString &path);
void fileDeletedOnDisk(const QString &path);
private:
KDirWatch *m_directory;
QVector<const char *> m_topEntries;
QHash<const char *, QStringList> m_files;
QHash<const char *, QList<const char *> > m_namedFiles;
Plasma::PackageStructure::Ptr m_structure;
Plasma::Package *m_package;
};
#endif