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

session-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_session_conversation_model_h_HEADER_GUARD_
00022 #define _TelepathyQt4Yell_Models_session_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 #include <TelepathyQt4Yell/Models/AbstractConversationModel>
00033 
00034 #include <QAbstractListModel>
00035 
00036 namespace Tpy
00037 {
00038 
00039 class EventItem;
00040 
00041 class TELEPATHY_QT4_YELL_MODELS_EXPORT SessionConversationModel : public AbstractConversationModel
00042 {
00043     Q_OBJECT
00044     Q_DISABLE_COPY(SessionConversationModel)
00045     Q_PROPERTY(int numPendingMessages READ numPendingMessages NOTIFY numPendingMessagesChanged)
00046 
00047 public:
00048     explicit SessionConversationModel(const Tp::ContactPtr &self, const Tp::TextChannelPtr &channel, QObject *parent = 0);
00049     virtual ~SessionConversationModel();
00050 
00051     Q_INVOKABLE void sendMessage(const QString &text);
00052     Q_INVOKABLE void disconnectChannelQueue();
00053     Q_INVOKABLE void connectChannelQueue();
00054     Q_INVOKABLE bool channelQueueConnected() const;
00055     int numPendingMessages() const;
00056 
00057     Tp::ContactPtr selfContact() const;
00058 
00059 Q_SIGNALS:
00060     void numPendingMessagesChanged();
00061 
00062 protected Q_SLOTS:
00063     virtual void onChatStateChanged(const Tp::ContactPtr &contact, Tp::ChannelChatState state);
00064 
00065 private Q_SLOTS:
00066     void onMessageReceived(const Tp::ReceivedMessage &message);
00067 
00068 private:
00069     struct Private;
00070     friend struct Private;
00071     Private *mPriv;
00072 };
00073 
00074 }
00075 
00076 #endif // _TelepathyQt4Yell_Models_session_conversation_model_h_HEADER_GUARD_


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