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>
27 class BookmarkListView
;
28 class BookmarkFolderViewFilterModel
;
30 class BookmarkView
: public QTreeView
34 BookmarkView( QWidget
* parent
= 0 );
35 virtual ~BookmarkView();
36 virtual KBookmark
bookmarkForIndex(const QModelIndex
& idx
) const = 0;
39 class BookmarkFolderView
: public BookmarkView
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;
50 BookmarkListView
* mview
;
51 BookmarkFolderViewFilterModel
* mmodel
;
54 class BookmarkListView
: public BookmarkView
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;
66 virtual void contextMenuEvent ( QContextMenuEvent
* e
);
70 class BookmarkFolderViewFilterModel
: public QSortFilterProxyModel
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
);
79 bool filterAcceptsColumn ( int source_column
, const QModelIndex
& source_parent
) const;
80 bool filterAcceptsRow ( int source_row
, const QModelIndex
& source_parent
) const;
82 virtual Qt::DropActions
supportedDropActions() const
83 { return sourceModel()->supportedDropActions(); }