2
This library is free software; you can redistribute it and/or
3
modify it under the terms of the GNU Library General Public
4
License version 2 as published by the Free Software Foundation.
6
This library is distributed in the hope that it will be useful,
7
but WITHOUT ANY WARRANTY; without even the implied warranty of
8
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9
Library General Public License for more details.
11
You should have received a copy of the GNU Library General Public License
12
along with this library; see the file COPYING.LIB. If not, write to
13
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
14
Boston, MA 02110-1301, USA.
17
#ifndef KEXIPROJECTMODEL_H
18
#define KEXIPROJECTMODEL_H
20
#include <QModelIndex>
22
#include <QAbstractItemModel>
24
class KexiProjectModelItem;
27
class KEXIEXTWIDGETS_EXPORT KexiProjectModel : public QAbstractItemModel
31
KexiProjectModel(QObject* parent = 0);
32
virtual ~KexiProjectModel();
34
void setProject(KexiProject* prj, const QString& itemsPartClass, QString* partManagerErrorMessages);
35
QString itemsPartClass() const;
38
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
39
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
40
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
41
virtual QModelIndex parent(const QModelIndex& child) const;
42
virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
43
virtual bool hasChildren(const QModelIndex& parent = QModelIndex()) const;
44
virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
45
virtual Qt::ItemFlags flags(const QModelIndex& index) const;
47
void updateItemName(KexiPart::Item& item, bool dirty);
48
QModelIndex indexFromItem(KexiProjectModelItem *item) const;
49
KexiProjectModelItem *modelItemFromItem(const KexiPart::Item &item) const;
50
KexiProjectModelItem *modelItemFromName(const QString &name) const;
53
void slotAddItem(KexiPart::Item& item);
54
void slotRemoveItem(const KexiPart::Item &item);
59
//!Part class to display
60
QString m_itemsPartClass;
62
KexiProjectModelItem* addGroup(KexiPart::Info& info, KexiProjectModelItem*) const;
63
KexiProjectModelItem* addItem(KexiPart::Item& item, KexiPart::Info& info, KexiProjectModelItem*) const;
65
KexiProjectModelItem *m_rootItem;
68
void renameItem(KexiPart::Item *item, const QString& _newName, bool &succes);
72
#endif // KEXIPROJECTMODEL_H