File indexing completed on 2024-05-05 04:47:28
0001 /**************************************************************************************** 0002 * Copyright (c) 2007 Alexandre Pereira de Oliveira <aleprj@gmail.com> * 0003 * Copyright (c) 2007-2009 Maximilian Kossick <maximilian.kossick@googlemail.com> * 0004 * Copyright (c) 2007 Nikolaj Hald Nielsen <nhn@kde.org> * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify it under * 0007 * the terms of the GNU General Public License as published by the Free Software * 0008 * Foundation; either version 2 of the License, or (at your option) any later * 0009 * version. * 0010 * * 0011 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0012 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0013 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License along with * 0016 * this program. If not, see <http://www.gnu.org/licenses/>. * 0017 ****************************************************************************************/ 0018 0019 #ifndef COLLECTIONTREEITEMMODEL_H 0020 #define COLLECTIONTREEITEMMODEL_H 0021 0022 #include "CollectionTreeItemModelBase.h" 0023 #include "core/meta/forward_declarations.h" 0024 0025 #include "core/collections/Collection.h" 0026 0027 #include <QMap> 0028 #include <QPair> 0029 0030 class CollectionTreeItem; 0031 0032 class CollectionTreeItemModel: public CollectionTreeItemModelBase 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 explicit CollectionTreeItemModel( const QList<CategoryId::CatMenuId> &levelType ); 0038 0039 /* QAbstractItemModel methods */ 0040 Qt::ItemFlags flags( const QModelIndex &index ) const override; 0041 QVariant data( const QModelIndex &index, int role ) const override; 0042 bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, 0043 int column, const QModelIndex &parent ) override; 0044 bool canFetchMore( const QModelIndex &parent ) const override; 0045 void fetchMore( const QModelIndex &parent ) override; 0046 Qt::DropActions supportedDropActions() const override; 0047 0048 public Q_SLOTS: 0049 virtual void collectionAdded( Collections::Collection *newCollection ); 0050 virtual void collectionRemoved( const QString &collectionId ); 0051 0052 protected: 0053 void filterChildren() override; 0054 int levelModifier() const override { return 0; } 0055 0056 private Q_SLOTS: 0057 void requestCollectionsExpansion(); 0058 }; 0059 0060 #endif