Better wording
[kdepim.git] / calendarsupport / incidenceattachmentmodel.h
blob15338afe4615551ec93087670dc3cca6a1284fc8
1 /*
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
18 02110-1301, USA.
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;
35 namespace Akonadi {
36 class Item;
39 namespace CalendarSupport
41 class IncidenceAttachmentModelPrivate;
43 class CALENDARSUPPORT_EXPORT IncidenceAttachmentModel : public QAbstractListModel
45 Q_OBJECT
46 Q_PROPERTY( int attachmentCount READ rowCount NOTIFY rowCountChanged )
48 public:
49 enum Roles {
50 AttachmentDataRole = Qt::UserRole,
51 MimeTypeRole,
52 AttachmentUrl,
53 AttachmentCountRole,
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 );
72 /** @reimp */
73 int rowCount( const QModelIndex &parent = QModelIndex() ) const;
75 /** @reimp */
76 QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
78 /** @reimp */
79 QVariant headerData( int section, Qt::Orientation orientation,
80 int role = Qt::DisplayRole ) const;
82 signals:
83 void rowCountChanged();
85 private:
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) )
95 #endif