Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / keditbookmarks / bookmarkmodel.h
blobeaf614cc88f54d944f251d104f41f09e1e73c3c4
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>
23 class KBookmark;
25 class KBookmarkModelRemoveSentry;
26 class KBookmarkModelMoveSentry;
27 class KBookmarkModelInsertSentry;
29 class KBookmarkModel : public QAbstractItemModel
31 Q_OBJECT
33 public:
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);
58 //drag and drop
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;
64 private:
65 class Private;
66 Private * const d;
69 #endif