Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / keditbookmarks / bookmarklistview.h
blob8f896e7ee5ef4877d6e1318cd22d65fe14d04004
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
6 License version 2 as published by the Free Software Foundation.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; see the file COPYING. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #ifndef __bookmarklistview_h
20 #define __bookmarklistview_h
22 #include <QtGui/QTreeView>
23 #include <QSortFilterProxyModel>
25 class KBookmarkModel;
26 class KBookmark;
27 class BookmarkListView;
28 class BookmarkFolderViewFilterModel;
30 class BookmarkView : public QTreeView
32 Q_OBJECT
33 public:
34 BookmarkView( QWidget * parent = 0 );
35 virtual ~BookmarkView();
36 virtual KBookmark bookmarkForIndex(const QModelIndex & idx) const = 0;
39 class BookmarkFolderView : public BookmarkView
41 Q_OBJECT
42 public:
43 explicit BookmarkFolderView( BookmarkListView * view, QWidget * parent = 0 );
44 virtual ~BookmarkFolderView();
45 virtual void selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected );
46 virtual KBookmark bookmarkForIndex(const QModelIndex & idx) const;
47 private Q_SLOTS:
48 void slotReset();
49 private:
50 BookmarkListView * mview;
51 BookmarkFolderViewFilterModel * mmodel;
54 class BookmarkListView : public BookmarkView
56 Q_OBJECT
57 public:
58 BookmarkListView( QWidget * parent = 0 );
59 virtual ~BookmarkListView();
60 void loadColumnSetting();
61 void saveColumnSetting ();
62 virtual void setModel(QAbstractItemModel * model);
63 virtual KBookmark bookmarkForIndex(const QModelIndex & idx) const;
64 KBookmarkModel * bookmarkModel() const;
65 protected:
66 virtual void contextMenuEvent ( QContextMenuEvent * e );
70 class BookmarkFolderViewFilterModel : public QSortFilterProxyModel
72 Q_OBJECT
73 public:
74 BookmarkFolderViewFilterModel(QObject * parent = 0);
75 virtual ~BookmarkFolderViewFilterModel();
76 virtual QStringList mimeTypes() const;
77 virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
78 protected:
79 bool filterAcceptsColumn ( int source_column, const QModelIndex & source_parent ) const;
80 bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const;
81 //FIXME check
82 virtual Qt::DropActions supportedDropActions() const
83 { return sourceModel()->supportedDropActions(); }
85 #endif