Commit de1f5b85 authored by Lasath Fernando's avatar Lasath Fernando Committed by David Edmundson

Implemented a basic Conversation class.

Also changed MessageItem from a struct to a class.
parent 4810cdf8
/*
<one line to give the library's name and an idea of what it does.>
Copyright (C) 2011 Lasath Fernando <kde@lasath.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "conversation.h"
#include "conversation-model.h"
#include <TelepathyQt4/Account>
class Conversation::ConversationPrivate {
public:
ConversationModel* model;
Tp::AccountPtr account;
};
Conversation::Conversation(Tp::TextChannelPtr channel, Tp::AccountPtr account) :
d(new ConversationPrivate)
{
d->model = new ConversationModel();
d->model->setTextChannel(channel);
d->account = account;
}
const ConversationModel* Conversation::model() const
{
return d->model;
}
Conversation::~Conversation()
{
delete d->model;
}
/*
<one line to give the library's name and an idea of what it does.>
Copyright (C) 2011 Lasath Fernando <kde@lasath.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CONVERSATION_H
#define CONVERSATION_H
#include <QObject>
#include <TelepathyQt4/Types>
#include "conversation-model.h"
class ConversationModel;
class Conversation : public QObject
{
Q_OBJECT
Q_PROPERTY(const ConversationModel* model READ model NOTIFY modelChanged)
public:
Conversation(Tp::TextChannelPtr channel, Tp::AccountPtr account);
virtual ~Conversation();
const ConversationModel* model() const;
Q_SIGNALS:
void modelChanged(ConversationModel* newModel);
private:
class ConversationPrivate;
ConversationPrivate *d;
};
#endif // CONVERSATION_H
......@@ -23,7 +23,8 @@
#include <KDebug>
#include <TelepathyQt4/ReceivedMessage>
struct MessageItem {
class MessageItem {
public:
QString user;
QString text;
QDateTime time;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment