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

Rename Conversation::model to Conversation::messages

And remove useless commented out code.
parent 606ff2fe
......@@ -27,9 +27,8 @@
class Conversation::ConversationPrivate
{
public:
MessagesModel *model;
MessagesModel *messages;
ConversationTarget *target;
// Tp::AccountPtr account;
};
Conversation::Conversation(const Tp::TextChannelPtr& channel, const Tp::AccountPtr& account, QObject *parent) :
......@@ -38,13 +37,10 @@ Conversation::Conversation(const Tp::TextChannelPtr& channel, const Tp::AccountP
{
kDebug();
d->model = new MessagesModel(this);
d->model->setTextChannel(channel);
d->messages = new MessagesModel(this);
d->messages->setTextChannel(channel);
d->target = new ConversationTarget(channel->targetContact(), this);
// connect(model(), SIGNAL(unreadCountChanged(int)), SLOT(onUnreadMessagesChanged()));
// d->account = account;
}
Conversation::Conversation(QObject *parent) : QObject(parent)
......@@ -53,26 +49,16 @@ Conversation::Conversation(QObject *parent) : QObject(parent)
Q_ASSERT(false);
}
MessagesModel *Conversation::model() const
MessagesModel* Conversation::messages() const
{
return d->model;
return d->messages;
}
ConversationTarget *Conversation::target() const
ConversationTarget* Conversation::target() const
{
return d->target;
}
// void Conversation::onUnreadMessagesChanged()
// {
// enqueSelf();
// }
//
// void Conversation::selfDequed()
// {
// Q_EMIT popoutRequested();
// }
Conversation::~Conversation()
{
kDebug();
......
......@@ -37,9 +37,9 @@ 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(ConversationTarget* target READ target CONSTANT);
//TODO: rename this to messages
Q_PROPERTY(MessagesModel *model READ model CONSTANT);
Q_PROPERTY(MessagesModel* messages READ messages CONSTANT);
public:
Conversation(const Tp::TextChannelPtr &channel, const Tp::AccountPtr &account, QObject *parent = 0);
......@@ -47,7 +47,7 @@ public:
virtual ~Conversation();
//FIXME: rename model to messages
MessagesModel* model() const;
MessagesModel* messages() const;
ConversationTarget* target() const;
private:
......
......@@ -62,15 +62,15 @@ void ConversationsModel::onInconmingConversation(Conversation *newConvo)
{
//check if conversation's channel is already being handled, if so replace it
bool handled = false;
Tp::TextChannelPtr newChannel = newConvo->model()->textChannel();
Tp::TextChannelPtr newChannel = newConvo->messages()->textChannel();
if (!newChannel->targetHandleType() == Tp::HandleTypeNone) {
//loop through all conversations checking for matches
Q_FOREACH(Conversation *convo, d->conversations) {
if (convo->target()->id() == newChannel->targetId() &&
convo->model()->textChannel()->targetHandleType() == newChannel->targetHandleType()) {
convo->messages()->textChannel()->targetHandleType() == newChannel->targetHandleType()) {
convo->model()->setTextChannel(newChannel);
convo->messages()->setTextChannel(newChannel);
newConvo->deleteLater();
handled = true;
break;
......
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