dolphin/keditbookmarks/bookmarklistview.h
Stephen Kelly ed2872074e Simplify some Qt module style includes.
This is the easiest way to transition to Qt5.
2012-04-10 00:20:22 +02:00

77 lines
2.6 KiB
C++

/* This file is part of the KDE project
Copyright (C) 2005 Daniel Teske <teske@squorn.de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __bookmarklistview_h
#define __bookmarklistview_h
#include <QTreeView>
#include <QSortFilterProxyModel>
#include "kbookmarkmodel/view.h"
class KBookmarkModel;
class BookmarkListView;
class BookmarkFolderViewFilterModel;
class BookmarkFolderView : public KBookmarkView
{
Q_OBJECT
public:
explicit BookmarkFolderView( BookmarkListView * view, QWidget * parent = 0 );
virtual ~BookmarkFolderView();
virtual void selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected );
virtual KBookmark bookmarkForIndex(const QModelIndex & idx) const;
private Q_SLOTS:
void slotReset();
private:
BookmarkListView * mview;
BookmarkFolderViewFilterModel * mmodel;
};
class BookmarkListView : public KBookmarkView
{
Q_OBJECT
public:
BookmarkListView( QWidget * parent = 0 );
virtual ~BookmarkListView();
void loadColumnSetting();
void saveColumnSetting();
virtual void setModel(QAbstractItemModel * model);
virtual KBookmark bookmarkForIndex(const QModelIndex & idx) const;
KBookmarkModel * bookmarkModel() const;
protected:
virtual void contextMenuEvent ( QContextMenuEvent * e );
};
class BookmarkFolderViewFilterModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
BookmarkFolderViewFilterModel(QObject * parent = 0);
virtual ~BookmarkFolderViewFilterModel();
virtual QStringList mimeTypes() const;
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
protected:
bool filterAcceptsColumn ( int source_column, const QModelIndex & source_parent ) const;
bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const;
//FIXME check
virtual Qt::DropActions supportedDropActions() const
{ return sourceModel()->supportedDropActions(); }
};
#endif