1 /* This file is part of the KDE project
2 Copyright (C) 2005 Daniel Teske <teske@squorn.de>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of
7 the License, or (at your option) version 3.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>
18 #ifndef __bookmarkmodel_h
19 #define __bookmarkmodel_h
21 #include <QtCore/QAbstractItemModel>
25 class KBookmarkModelRemoveSentry
;
26 class KBookmarkModelMoveSentry
;
27 class KBookmarkModelInsertSentry
;
29 class KBookmarkModel
: public QAbstractItemModel
34 // Those keditbookmarks classes need to access beginInsertRows etc.
35 friend class KBookmarkModelInsertSentry
;
36 friend class KBookmarkModelRemoveSentry
;
38 KBookmarkModel(const KBookmark
& root
);
39 void setRoot(const KBookmark
& root
);
41 virtual ~KBookmarkModel();
43 //reimplemented functions
44 virtual QVariant
data(const QModelIndex
&index
, int role
) const;
45 virtual Qt::ItemFlags
flags(const QModelIndex
&index
) const;
46 virtual QVariant
headerData(int section
, Qt::Orientation
, int role
= Qt::DisplayRole
) const;
47 virtual QModelIndex
index(int row
, int column
, const QModelIndex
&parent
= QModelIndex()) const;
48 virtual QModelIndex
parent(const QModelIndex
&index
) const;
49 virtual bool setData(const QModelIndex
&index
, const QVariant
&value
, int role
);
50 virtual int rowCount(const QModelIndex
&parent
= QModelIndex()) const;
51 virtual int columnCount(const QModelIndex
&parent
= QModelIndex()) const;
52 virtual void resetModel();
54 QModelIndex
indexForBookmark(const KBookmark
& bk
) const;
55 KBookmark
bookmarkForIndex(const QModelIndex
& index
) const;
56 void emitDataChanged(const KBookmark
& bk
);
59 virtual bool dropMimeData ( const QMimeData
* data
, Qt::DropAction action
, int row
, int column
, const QModelIndex
& parent
);
60 virtual QStringList
mimeTypes() const;
61 virtual QMimeData
* mimeData( const QModelIndexList
& indexes
) const;
62 virtual Qt::DropActions
supportedDropActions () const;