2 Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
3 Author: Stephen Kelly <stephen@kdab.com>
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 #ifndef CALENDARSUPPORT_INCIDENCEATTACHMENTMODEL_H
22 #define CALENDARSUPPORT_INCIDENCEATTACHMENTMODEL_H
24 #include "calendarsupport_export.h"
26 #include <Akonadi/Attribute>
27 #include <Akonadi/Item>
29 #include <KCalCore/Incidence>
31 #include <QtCore/QAbstractListModel>
33 class QAbstractItemModel
;
39 namespace CalendarSupport
41 class IncidenceAttachmentModelPrivate
;
43 class CALENDARSUPPORT_EXPORT IncidenceAttachmentModel
: public QAbstractListModel
46 Q_PROPERTY( int attachmentCount READ rowCount NOTIFY rowCountChanged
)
50 AttachmentDataRole
= Qt::UserRole
,
55 UserRole
= Qt::UserRole
+ 100
58 explicit IncidenceAttachmentModel( const QPersistentModelIndex
&modelIndex
,
59 QObject
*parent
= 0 );
61 explicit IncidenceAttachmentModel( const Akonadi::Item
&item
, QObject
*parent
= 0 );
63 IncidenceAttachmentModel( QObject
*parent
= 0 );
65 ~IncidenceAttachmentModel();
67 KCalCore::Incidence::Ptr
incidence() const;
69 void setItem( const Akonadi::Item
&item
);
70 void setIndex( const QPersistentModelIndex
&modelIndex
);
73 int rowCount( const QModelIndex
&parent
= QModelIndex() ) const;
76 QVariant
data( const QModelIndex
&index
, int role
= Qt::DisplayRole
) const;
79 QVariant
headerData( int section
, Qt::Orientation orientation
,
80 int role
= Qt::DisplayRole
) const;
83 void rowCountChanged();
86 Q_DECLARE_PRIVATE( IncidenceAttachmentModel
)
87 IncidenceAttachmentModelPrivate
*const d_ptr
;
89 Q_PRIVATE_SLOT( d_func(), void resetModel() )
90 Q_PRIVATE_SLOT( d_func(), void itemFetched(Akonadi::Item::List
) )