~ubuntu-branches/ubuntu/oneiric/koffice/oneiric-updates

« back to all changes in this revision

Viewing changes to kexi/widget/KexiProjectModel.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
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.
 
5
 
 
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.
 
10
 
 
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.
 
15
*/
 
16
 
 
17
#ifndef KEXIPROJECTMODEL_H
 
18
#define KEXIPROJECTMODEL_H
 
19
 
 
20
#include <QModelIndex>
 
21
#include <kexipart.h>
 
22
#include <QAbstractItemModel>
 
23
 
 
24
class KexiProjectModelItem;
 
25
class KexiProject;
 
26
 
 
27
class KEXIEXTWIDGETS_EXPORT KexiProjectModel : public QAbstractItemModel
 
28
{
 
29
    Q_OBJECT
 
30
public:
 
31
    KexiProjectModel(QObject* parent = 0);
 
32
    virtual ~KexiProjectModel();
 
33
    
 
34
    void setProject(KexiProject* prj, const QString& itemsPartClass, QString* partManagerErrorMessages);
 
35
    QString itemsPartClass() const;
 
36
    
 
37
    
 
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;
 
46
 
 
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;
 
51
    
 
52
public slots:
 
53
    void slotAddItem(KexiPart::Item& item);
 
54
    void slotRemoveItem(const KexiPart::Item &item);
 
55
    
 
56
private:
 
57
    void clear();
 
58
    
 
59
    //!Part class to display
 
60
    QString m_itemsPartClass;
 
61
 
 
62
    KexiProjectModelItem* addGroup(KexiPart::Info& info, KexiProjectModelItem*) const;
 
63
    KexiProjectModelItem* addItem(KexiPart::Item& item, KexiPart::Info& info, KexiProjectModelItem*) const;
 
64
 
 
65
    KexiProjectModelItem *m_rootItem;
 
66
 
 
67
signals:
 
68
    void renameItem(KexiPart::Item *item, const QString& _newName, bool &succes);
 
69
    
 
70
};
 
71
 
 
72
#endif // KEXIPROJECTMODEL_H