Home · All Classes · All Namespaces · Modules · Functions · Files

abstract-conversation-model.h

00001 /*
00002  * This file is part of TelepathyQt4Yell Models
00003  *
00004  * Copyright (C) 2010 Collabora Ltd. <http://www.collabora.co.uk/>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 #ifndef _TelepathyQt4Yell_Models_abstract_conversation_model_h_HEADER_GUARD_
00022 #define _TelepathyQt4Yell_Models_abstract_conversation_model_h_HEADER_GUARD_
00023 
00024 #ifndef IN_TELEPATHY_QT4_YELL_MODELS_HEADER
00025 #error IN_TELEPATHY_QT4_YELL_MODELS_HEADER
00026 #endif
00027 
00028 #include <TelepathyQt4Yell/Models/Global>
00029 
00030 #include <TelepathyQt4/TextChannel>
00031 #include <TelepathyQt4/Types>
00032 
00033 #include <QAbstractListModel>
00034 
00035 namespace Tpy
00036 {
00037 
00038 class EventItem;
00039 
00040 class TELEPATHY_QT4_YELL_MODELS_EXPORT AbstractConversationModel : public QAbstractListModel
00041 {
00042     Q_OBJECT
00043     Q_DISABLE_COPY(AbstractConversationModel)
00044 
00045 public:
00046     enum Role {
00047         EventTypeRole = Qt::UserRole,
00048         SenderRole,
00049         SenderAvatarRole,
00050         ReceiverRole,
00051         ReceiverAvatarRole,
00052         DateTimeRole,
00053         ItemRole,
00054         MessageTextRole,
00055         MessageTypeRole,
00056         CallDurationRole,
00057         CallEndActorRole,
00058         CallEndActorAvatarRole,
00059         CallEndReasonRole,
00060         CallDetailedEndReasonRole,
00061         MissedCallRole,
00062         RejectedCallRole,
00063         CustomEventTextRole,
00064         CustomEventTypeRole
00065     };
00066 
00067     explicit AbstractConversationModel(QObject *parent = 0);
00068     virtual ~AbstractConversationModel();
00069 
00070     virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
00071     virtual QVariant data(const QModelIndex &index, int role) const;
00072 
00073     virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
00074 
00075     void addItem(const EventItem *item);
00076     void insertItems(QList<const EventItem *> items, int index = 0);
00077     bool deleteItem(const EventItem *item);
00078 
00079     QModelIndex index(const EventItem *item) const;
00080 
00081 private:
00082     struct Private;
00083     friend struct Private;
00084     Private *mPriv;
00085 };
00086 
00087 }
00088 
00089 #endif // _TelepathyQt4Yell_Models_abstract_conversation_model_h_HEADER_GUARD_


Copyright © 2008-2010 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4-Yell 0.1.6