Commit 7057ed17 authored by Lasath Fernando's avatar Lasath Fernando Committed by David Edmundson

Parented MessagesModel and ConversationTarget properly, so that Conversation...

Parented MessagesModel and ConversationTarget properly, so that Conversation doesn't have to explicitly delete them.
parent 0fdc1aed
......@@ -28,8 +28,9 @@ public:
Tp::ContactPtr contact;
};
ConversationTarget::ConversationTarget(Tp::ContactPtr contact) :
d(new ConversationTargetPrivate)
ConversationTarget::ConversationTarget(Tp::ContactPtr contact, QObject* parent) :
QObject(parent),
d(new ConversationTargetPrivate)
{
kDebug();
......
......@@ -39,7 +39,7 @@ class KDE_TELEPATHY_CHAT_EXPORT ConversationTarget : public QObject
Q_PROPERTY(QString id READ id)
public:
ConversationTarget(Tp::ContactPtr contact = Tp::ContactPtr());
ConversationTarget(Tp::ContactPtr contact, QObject* parent = 0);
virtual ~ConversationTarget();
QIcon avatar() const;
......
......@@ -32,15 +32,16 @@ public:
// Tp::AccountPtr account;
};
Conversation::Conversation(Tp::TextChannelPtr channel, Tp::AccountPtr account) :
Conversation::Conversation(Tp::TextChannelPtr channel, Tp::AccountPtr account, QObject* parent) :
QObject(parent),
d (new ConversationPrivate)
{
kDebug();
d->model = new MessagesModel();
d->model = new MessagesModel(this);
d->model->setTextChannel(channel);
d->target = new ConversationTarget(channel->targetContact());
d->target = new ConversationTarget(channel->targetContact(), this);
// connect(model(), SIGNAL(unreadCountChanged(int)), SLOT(onUnreadMessagesChanged()));
// d->account = account;
......@@ -75,7 +76,5 @@ ConversationTarget* Conversation::target() const
Conversation::~Conversation()
{
kDebug();
delete d->model;
delete d->target;
delete d;
}
......@@ -28,19 +28,21 @@
// #include "conversation-model.h"
#include <KIcon>
#include "conversation-que-manager.h"
#include "conversation-target.h"
class ConversationTarget;
// class ConversationTarget;
class MessagesModel;
class KDE_TELEPATHY_CHAT_EXPORT Conversation : public QObject
{
Q_OBJECT
Q_PROPERTY(ConversationTarget* target READ target CONSTANT);
// Q_PROPERTY(ConversationTarget* target READ target CONSTANT);
Q_PROPERTY(QObject* target READ target CONSTANT);
//TODO: rename this to messages
Q_PROPERTY(MessagesModel* model READ model CONSTANT);
public:
Conversation(Tp::TextChannelPtr channel, Tp::AccountPtr account);
Conversation(Tp::TextChannelPtr channel, Tp::AccountPtr account, QObject* parent = 0);
Conversation(QObject* parent = 0);
virtual ~Conversation();
......
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