Commit 17d53930 authored by David Edmundson's avatar David Edmundson Committed by David Edmundson
Browse files

Move AdiumContentInfo to be internal to AdiumThemeView

AdiumThemeView now takes a KTp::Message which contains all the information needed to present information in the view.
/me messages are passed as KTp::Messages, in future status messages will be too.

I also had to fix entity model to take KTp::ContactPtr because of a conflict in Qt MetaTypes after including KTp code.

REVIEW: 109835
parent 53f8fd7a
......@@ -172,7 +172,7 @@ void AppearanceConfigTab::sendDemoMessages()
message.setSenderScreenName(i18nc("Example name", "Larry Demo"));
message.setService(i18nc("XMPP Protocol name" , "Jabber"));
message.setTime(QDateTime::currentDateTime());
ui->chatView->addContentMessage(message);
ui->chatView->addAdiumContentMessage(message);
message = AdiumThemeContentInfo(AdiumThemeMessageInfo::HistoryRemoteToLocal);
message.setMessage(i18nc("Example message in preview conversation","Bye Bye"));
......@@ -180,7 +180,7 @@ void AppearanceConfigTab::sendDemoMessages()
message.setSenderScreenName(i18nc("Example name", "Larry Demo"));
message.setService(i18n("Jabber"));
message.setTime(QDateTime::currentDateTime());
ui->chatView->addContentMessage(message);
ui->chatView->addAdiumContentMessage(message);
message = AdiumThemeContentInfo(AdiumThemeMessageInfo::HistoryLocalToRemote);
message.setMessage(i18nc("Example message in preview conversation","Have fun!"));
......@@ -188,7 +188,7 @@ void AppearanceConfigTab::sendDemoMessages()
message.setSenderScreenName(i18nc("Example name", "Ted Example"));
message.setService(i18n("Jabber"));
message.setTime(QDateTime::currentDateTime());
ui->chatView->addContentMessage(message);
ui->chatView->addAdiumContentMessage(message);
message = AdiumThemeContentInfo(AdiumThemeMessageInfo::HistoryLocalToRemote);
message.setMessage(i18nc("Example message in preview conversation","cya"));
......@@ -196,20 +196,20 @@ void AppearanceConfigTab::sendDemoMessages()
message.setSenderScreenName(i18nc("Example name", "Ted Example"));
message.setService(i18n("Jabber"));
message.setTime(QDateTime::currentDateTime());
ui->chatView->addContentMessage(message);
ui->chatView->addAdiumContentMessage(message);
AdiumThemeStatusInfo statusMessage(true);
statusMessage.setMessage(i18nc("Example message", "Ted Example waves."));
statusMessage.setTime(QDateTime::currentDateTime());
statusMessage.setService(i18n("Jabber"));
ui->chatView->addStatusMessage(statusMessage);
ui->chatView->addAdiumStatusMessage(statusMessage);
statusMessage = AdiumThemeStatusInfo(true);
statusMessage.setMessage(i18nc("Example message in preview conversation","Ted Example has left the chat.")); //FIXME sync this with chat text logic.
statusMessage.setTime(QDateTime::currentDateTime());
statusMessage.setService(i18n("Jabber"));
statusMessage.setStatus(QLatin1String("away"));
ui->chatView->addStatusMessage(statusMessage);
ui->chatView->addAdiumStatusMessage(statusMessage);
message = AdiumThemeContentInfo(AdiumThemeMessageInfo::RemoteToLocal);
message.setMessage(i18nc("Example message in preview conversation","Hello Ted"));
......@@ -218,7 +218,7 @@ void AppearanceConfigTab::sendDemoMessages()
message.setService(i18n("Jabber"));
message.appendMessageClass(QLatin1String("mention"));
message.setTime(QDateTime::currentDateTime());
ui->chatView->addContentMessage(message);
ui->chatView->addAdiumContentMessage(message);
message = AdiumThemeContentInfo(AdiumThemeMessageInfo::RemoteToLocal);
message.setMessage(i18nc("Example message in preview conversation","What's up?"));
......@@ -226,7 +226,7 @@ void AppearanceConfigTab::sendDemoMessages()
message.setSenderScreenName(i18nc("Example name", "Larry Demo"));
message.setService(i18n("Jabber"));
message.setTime(QDateTime::currentDateTime());
ui->chatView->addContentMessage(message);
ui->chatView->addAdiumContentMessage(message);
message = AdiumThemeContentInfo(AdiumThemeMessageInfo::LocalToRemote);
message.setMessage(i18nc("Example message in preview conversation","Check out which cool adium themes work "
......@@ -236,7 +236,7 @@ void AppearanceConfigTab::sendDemoMessages()
message.setSenderScreenName(i18nc("Example name", "Ted Example"));
message.setService(i18n("Jabber"));
message.setTime(QDateTime::currentDateTime());
ui->chatView->addContentMessage(message);
ui->chatView->addAdiumContentMessage(message);
if ( m_groupChat == true) {
message = AdiumThemeContentInfo(AdiumThemeMessageInfo::RemoteToLocal);
......@@ -245,7 +245,7 @@ void AppearanceConfigTab::sendDemoMessages()
message.setSenderScreenName(i18nc("Example name", "Bob Example"));
message.setService(i18n("Jabber"));
message.setTime(QDateTime::currentDateTime());
ui->chatView->addContentMessage(message);
ui->chatView->addAdiumContentMessage(message);
}
message = AdiumThemeContentInfo(AdiumThemeMessageInfo::LocalToRemote);
......@@ -254,7 +254,7 @@ void AppearanceConfigTab::sendDemoMessages()
message.setSenderScreenName(i18nc("Example name", "Ted Example"));
message.setService(i18n("Jabber"));
message.setTime(QDateTime::currentDateTime());
ui->chatView->addContentMessage(message);
ui->chatView->addAdiumContentMessage(message);
if (ui->chatView->showPresenceChanges()) {
statusMessage = AdiumThemeStatusInfo();
......@@ -262,14 +262,14 @@ void AppearanceConfigTab::sendDemoMessages()
statusMessage.setTime(QDateTime::currentDateTime());
statusMessage.setService(i18n("Jabber"));
statusMessage.setStatus(QLatin1String("away"));
ui->chatView->addStatusMessage(statusMessage);
ui->chatView->addAdiumStatusMessage(statusMessage);
statusMessage = AdiumThemeStatusInfo();
statusMessage.setMessage(i18nc("Example message in preview conversations","Ted Example has left the chat.")); //FIXME sync this with chat text logic.
statusMessage.setTime(QDateTime::currentDateTime());
statusMessage.setService(i18n("Jabber"));
statusMessage.setStatus(QLatin1String("away"));
ui->chatView->addStatusMessage(statusMessage);
ui->chatView->addAdiumStatusMessage(statusMessage);
}
}
......
......@@ -354,7 +354,46 @@ void AdiumThemeView::clear()
}
}
void AdiumThemeView::addContentMessage(const AdiumThemeContentInfo &contentMessage)
void AdiumThemeView::addMessage(const KTp::Message &message)
{
if (message.type() == Tp::ChannelTextMessageTypeAction) {
addStatusMessage(QString::fromLatin1("%1 %2").arg(message.senderAlias(), message.mainMessagePart()));
} else {
AdiumThemeContentInfo messageInfo;
if (message.direction() == KTp::Message::RemoteToLocal) {
messageInfo = AdiumThemeContentInfo(AdiumThemeContentInfo::RemoteToLocal);
} else {
messageInfo = AdiumThemeContentInfo(AdiumThemeContentInfo::LocalToRemote);
}
messageInfo.setMessage(message.finalizedMessage());
messageInfo.setScript(message.finalizedScript());
messageInfo.setTime(message.time());
if (message.property("highlight").toBool()) {
messageInfo.appendMessageClass(QLatin1String("mention"));
}
messageInfo.setSenderDisplayName(message.senderAlias());
messageInfo.setSenderScreenName(message.senderId());
if (message.sender()) {
messageInfo.setUserIconPath(message.sender()->avatarData().fileName);
}
addAdiumContentMessage(messageInfo);
}
}
void AdiumThemeView::addStatusMessage(const QString &text, const QDateTime &time)
{
AdiumThemeStatusInfo messageInfo;
messageInfo.setMessage(text);
messageInfo.setTime(time);
// messageInfo.setStatus(QLatin1String("error")); //port this?
addAdiumStatusMessage(messageInfo);
}
void AdiumThemeView::addAdiumContentMessage(const AdiumThemeContentInfo &contentMessage)
{
QString styleHtml;
bool consecutiveMessage = false;
......@@ -422,7 +461,7 @@ void AdiumThemeView::addContentMessage(const AdiumThemeContentInfo &contentMessa
appendMessage(styleHtml, message.script(), mode);
}
void AdiumThemeView::addStatusMessage(const AdiumThemeStatusInfo& statusMessage)
void AdiumThemeView::addAdiumStatusMessage(const AdiumThemeStatusInfo& statusMessage)
{
QString styleHtml;
bool consecutiveMessage = false;
......@@ -713,3 +752,5 @@ const QString AdiumThemeView::variantPath() const
{
return m_variantPath;
}
......@@ -27,6 +27,8 @@
#include <KEmoticons>
#include <KTp/message.h>
#include "ktpchat_export.h"
class AdiumThemeContentInfo;
......@@ -92,11 +94,14 @@ public:
void clear();
public Q_SLOTS:
void addContentMessage(const AdiumThemeContentInfo&);
void addStatusMessage(const AdiumThemeStatusInfo&);
void addMessage(const KTp::Message &message);
void addStatusMessage(const QString &text, const QDateTime &time=QDateTime::currentDateTime());
void onOpenLinkActionTriggered();
virtual void onLinkClicked(const QUrl &);
void addAdiumContentMessage(const AdiumThemeContentInfo&);
void addAdiumStatusMessage(const AdiumThemeStatusInfo&);
protected:
virtual void contextMenuEvent(QContextMenuEvent *event);
virtual void wheelEvent(QWheelEvent *event);
......
......@@ -104,7 +104,7 @@ ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, const Tp::AccountPtr
d->channel = channel;
d->account = account;
d->logManager = new LogManager(this);
connect(d->logManager, SIGNAL(fetched(QList<AdiumThemeContentInfo>)), SLOT(onHistoryFetched(QList<AdiumThemeContentInfo>)));
connect(d->logManager, SIGNAL(fetched(QList<KTp::Message>)), SLOT(onHistoryFetched(QList<KTp::Message>)));
connect(d->account.data(), SIGNAL(currentPresenceChanged(Tp::Presence)),
this, SLOT(currentPresenceChanged(Tp::Presence)));
......@@ -466,15 +466,15 @@ void ChatWidget::setupContactModelSignals()
}
void ChatWidget::onHistoryFetched(const QList<AdiumThemeContentInfo> &messages)
void ChatWidget::onHistoryFetched(const QList<KTp::Message> &messages)
{
d->chatviewlInitialised = true;
kDebug() << "found" << messages.count() << "messages in history";
Q_FOREACH(const AdiumThemeContentInfo &message, messages) {
d->ui.chatArea->addContentMessage(message);
Q_FOREACH(const KTp::Message &message, messages) {
d->ui.chatArea->addMessage(message);
}
d->chatviewlInitialised = true;
//process any messages we've 'missed' whilst initialising.
Q_FOREACH(const Tp::ReceivedMessage &message, d->channel->messageQueue()) {
handleIncomingMessage(message, true);
......@@ -526,7 +526,6 @@ void ChatWidget::handleIncomingMessage(const Tp::ReceivedMessage &message, bool
if (message.isDeliveryReport()) {
QString text;
AdiumThemeStatusInfo messageInfo;
Tp::ReceivedMessage::DeliveryDetails reportDetails = message.deliveryDetails();
if (reportDetails.hasDebugMessage()) {
......@@ -603,61 +602,17 @@ void ChatWidget::handleIncomingMessage(const Tp::ReceivedMessage &message, bool
return;
}
messageInfo.setMessage(text);
messageInfo.setTime(message.received());
messageInfo.setStatus(QLatin1String("error"));
d->ui.chatArea->addStatusMessage(messageInfo);
} else if (message.messageType() == Tp::ChannelTextMessageTypeAction) {
//a "/me " message
AdiumThemeStatusInfo statusMessage;
statusMessage.setTime(message.received());
QString senderName;
if (message.sender().isNull()) {
senderName = message.senderNickname();
} else {
senderName = message.sender()->alias();
}
statusMessage.setMessage(QString::fromLatin1("%1 %2").arg(senderName, message.text()));
d->ui.chatArea->addStatusMessage(statusMessage);
d->ui.chatArea->addStatusMessage(text, message.received());
} else {
AdiumThemeContentInfo messageInfo(AdiumThemeMessageInfo::RemoteToLocal);
KTp::Message processedMessage(KTp::MessageProcessor::instance()->processIncomingMessage(message, d->account, d->channel));
// FIXME: eventually find a way to make MessageProcessor allow per
// instance filters.
if (!alreadyNotified) {
d->notifyFilter->filterMessage(processedMessage,
KTp::MessageContext(d->account, d->channel));
}
messageInfo.setMessage(processedMessage.finalizedMessage());
messageInfo.setScript(processedMessage.finalizedScript());
QDateTime time = message.sent();
if (!time.isValid()) {
time = message.received();
}
messageInfo.setTime(time);
if (processedMessage.property("highlight").toBool()) {
messageInfo.appendMessageClass(QLatin1String("mention"));
}
//sender can have just an ID or be a full contactPtr. Use full contact info if available.
if (message.sender().isNull()) {
messageInfo.setSenderDisplayName(message.senderNickname());
} else {
messageInfo.setUserIconPath(message.sender()->avatarData().fileName);
messageInfo.setSenderDisplayName(message.sender()->alias());
messageInfo.setSenderScreenName(message.sender()->id());
}
d->ui.chatArea->addContentMessage(messageInfo);
d->ui.chatArea->addMessage(processedMessage);
}
//if the window is on top, ack straight away. Otherwise they stay in the message queue for acking when activated..
......@@ -670,40 +625,12 @@ void ChatWidget::handleIncomingMessage(const Tp::ReceivedMessage &message, bool
}
void ChatWidget::handleMessageSent(const Tp::Message &message, Tp::MessageSendingFlags, const QString&) /*Not sure what these other args are for*/
void ChatWidget::handleMessageSent(const Tp::Message &message, Tp::MessageSendingFlags, const QString&)
{
Tp::ContactPtr sender = d->channel->groupSelfContact();
if (message.messageType() == Tp::ChannelTextMessageTypeAction) {
AdiumThemeStatusInfo statusMessage;
statusMessage.setTime(message.sent());
statusMessage.setMessage(QString::fromLatin1("%1 %2").arg(sender->alias(), message.text()));
d->ui.chatArea->addStatusMessage(statusMessage);
}
else {
AdiumThemeContentInfo messageInfo(AdiumThemeMessageInfo::LocalToRemote);
KTp::Message processedMessage(KTp::MessageProcessor::instance()->processIncomingMessage(message, d->account, d->channel));
messageInfo.setMessage(processedMessage.finalizedMessage());
messageInfo.setScript(processedMessage.finalizedScript());
messageInfo.setTime(message.sent());
messageInfo.setSenderDisplayName(sender->alias());
messageInfo.setSenderScreenName(sender->id());
messageInfo.setUserIconPath(sender->avatarData().fileName);
d->ui.chatArea->addContentMessage(messageInfo);
}
//send the notification that a message has been sent
KNotification *notification = new KNotification(QLatin1String("kde_telepathy_outgoing"), this);
notification->setComponentData(d->telepathyComponentData());
notification->setTitle(i18n("You have sent a message"));
QPixmap notificationPixmap;
if (notificationPixmap.load(sender->avatarData().fileName)) {
notification->setPixmap(notificationPixmap);
}
notification->setText(message.text());
notification->sendEvent();
KTp::Message processedMessage(KTp::MessageProcessor::instance()->processIncomingMessage(message, d->account, d->channel));
d->notifyFilter->filterMessage(processedMessage,
KTp::MessageContext(d->account, d->channel));
d->ui.chatArea->addMessage(processedMessage);
}
void ChatWidget::chatViewReady()
......@@ -744,12 +671,7 @@ void ChatWidget::onChatStatusChanged(const Tp::ContactPtr & contact, Tp::Channel
}
if (state == Tp::ChannelChatStateGone) {
AdiumThemeStatusInfo statusMessage;
statusMessage.setMessage(i18n("%1 has left the chat", contact->alias()));
statusMessage.setService(d->channel->connection()->protocolName());
statusMessage.setStatus(QLatin1String("away"));
statusMessage.setTime(QDateTime::currentDateTime());
d->ui.chatArea->addStatusMessage(statusMessage);
d->ui.chatArea->addStatusMessage(i18n("%1 has left the chat", contact->alias()));
}
if (d->isGroupChat) {
......@@ -803,11 +725,7 @@ void ChatWidget::onContactPresenceChange(const Tp::ContactPtr & contact, const K
if (!message.isNull()) {
if (d->ui.chatArea->showPresenceChanges()) {
AdiumThemeStatusInfo statusMessage;
statusMessage.setMessage(message);
statusMessage.setService(d->channel->connection()->protocolName());
statusMessage.setTime(QDateTime::currentDateTime());
d->ui.chatArea->addStatusMessage(statusMessage);
d->ui.chatArea->addStatusMessage(message);
}
}
......@@ -840,11 +758,7 @@ void ChatWidget::onContactAliasChanged(const Tp::ContactPtr & contact, const QSt
}
if (!message.isEmpty()) {
AdiumThemeStatusInfo statusMessage;
statusMessage.setMessage(message);
statusMessage.setService(d->channel->connection()->protocolName());
statusMessage.setTime(QDateTime::currentDateTime());
d->ui.chatArea->addStatusMessage(statusMessage);
d->ui.chatArea->addStatusMessage(i18n("%1 has left the chat", contact->alias()));
}
//if in a non-group chat situation, and the other contact has changed alias...
......@@ -862,11 +776,7 @@ void ChatWidget::onContactBlockStatusChanged(const Tp::ContactPtr &contact, bool
message = i18n("%1 is now unblocked.", contact->alias());
}
AdiumThemeStatusInfo statusMessage;
statusMessage.setMessage(message);
statusMessage.setService(d->channel->connection()->protocolName());
statusMessage.setTime(QDateTime::currentDateTime());
d->ui.chatArea->addStatusMessage(statusMessage);
d->ui.chatArea->addStatusMessage(message);
Q_EMIT contactBlockStatusChanged(blocked);
}
......@@ -1058,12 +968,7 @@ void ChatWidget::onChatPausedTimerExpired()
void ChatWidget::currentPresenceChanged(const Tp::Presence &presence)
{
if (presence == Tp::Presence::offline()) {
// show a message informing the user
AdiumThemeStatusInfo statusMessage;
statusMessage.setMessage(i18n("You are now offline"));
statusMessage.setService(d->channel->connection()->protocolName());
statusMessage.setTime(QDateTime::currentDateTime());
d->ui.chatArea->addStatusMessage(statusMessage);
d->ui.chatArea->addStatusMessage(i18n("You are now offline"));
Q_EMIT iconChanged(KTp::Presence(Tp::Presence::offline()).icon());
}
}
......
......@@ -34,8 +34,8 @@
#include <TelepathyQt/ReceivedMessage>
#include <KTp/presence.h>
#include <KTp/message.h>
class AdiumThemeContentInfo;
class ChatSearchBar;
class ChatWidgetPrivate;
class QShowEvent;
......@@ -180,7 +180,7 @@ private Q_SLOTS:
void findTextInChat(const QString &text, QWebPage::FindFlags flags);
void findNextTextInChat(const QString &text, QWebPage::FindFlags flags);
void findPreviousTextInChat(const QString &text, QWebPage::FindFlags flags);
void onHistoryFetched(const QList<AdiumThemeContentInfo> &messages);
void onHistoryFetched(const QList<KTp::Message> &messages);
void onChatPausedTimerExpired();
void currentPresenceChanged(const Tp::Presence &presence);
......
......@@ -97,7 +97,7 @@ void LogManager::fetchLast()
}
//in all other cases finish immediately.
QList<AdiumThemeContentInfo> messages;
QList<KTp::Message> messages;
Q_EMIT fetched(messages);
}
......@@ -120,7 +120,7 @@ void LogManager::onDatesFinished(Tpl::PendingOperation *po)
Tpl::PendingEvents *events = m_logManager->queryEvents( pd->account(), pd->entity(), Tpl::EventTypeMaskAny, date);
connect(events, SIGNAL(finished(Tpl::PendingOperation*)), SLOT(onEventsFinished(Tpl::PendingOperation*)));
} else {
QList<AdiumThemeContentInfo> messages;
QList<KTp::Message> messages;
Q_EMIT fetched(messages);
}
}
......@@ -156,45 +156,9 @@ void LogManager::onEventsFinished(Tpl::PendingOperation *po)
}
}
QList<AdiumThemeContentInfo> messages;
QList<KTp::Message> messages;
Q_FOREACH(const Tpl::TextEventPtr &event, events) {
AdiumThemeMessageInfo::MessageType type;
Tp::ContactPtr contact;
if (event->sender()->identifier() == m_account->normalizedName()) {
type = AdiumThemeMessageInfo::HistoryLocalToRemote;
if (m_account->connection()) {
contact = m_account->connection()->selfContact();
}
} else {
type = AdiumThemeMessageInfo::HistoryRemoteToLocal;
contact = m_textChannel->targetContact();
}
/* When connection is dropped (account goes offline), we get an invalid
* contact, so we can't correctly create the message. There's no point
* emitting fetched() with only partial list of messages, so let's
* just terminate here. */
if (!contact) {
return;
}
AdiumThemeContentInfo message(type);
KTp::Message processedEvent = KTp::MessageProcessor::instance()->processIncomingMessage(event, m_account, m_textChannel);
message.setMessage(processedEvent.finalizedMessage());
message.setScript(processedEvent.finalizedScript());
message.setService(m_account->serviceName());
message.setSenderDisplayName(event->sender()->alias());
message.setSenderScreenName(event->sender()->alias());
message.setTime(event->timestamp());
message.setUserIconPath(contact->avatarData().fileName);
kDebug() << event->timestamp()
<< "from" << event->sender()->identifier()
<< "to" << event->receiver()->identifier()
<< event->message();
KTp::Message message = KTp::MessageProcessor::instance()->processIncomingMessage(event, m_account, m_textChannel);
messages.append(message);
}
......
......@@ -29,6 +29,7 @@
#include <TelepathyQt/Account>
#include <TelepathyQt/Contact>
#include <KTp/message.h>
namespace Tpl {
class PendingOperation;
......@@ -50,7 +51,7 @@ public:
void fetchLast();
Q_SIGNALS:
void fetched(const QList<AdiumThemeContentInfo> &messages);
void fetched(const QList<KTp::Message> &messages);
private Q_SLOTS:
void onDatesFinished(Tpl::PendingOperation *po);
......
......@@ -116,7 +116,7 @@ void EntityModelItem::setData(const QVariant &data, int role)
m_account = data.value< Tp::AccountPtr >();
break;
case EntityModel::ContactRole:
m_contact = data.value< Tp::ContactPtr >();
m_contact = data.value< KTp::ContactPtr >();
break;
case EntityModel::EntityRole:
m_entity = data.value< Tpl::EntityPtr >();
......
......@@ -27,6 +27,8 @@
#include <TelepathyQt/Types>
#include <TelepathyLoggerQt4/Entity>
#include <KTp/contact.h>
class EntityModelItem
{
......@@ -53,7 +55,7 @@ private:
Tp::AccountPtr m_account;
Tpl::EntityPtr m_entity;
Tp::ContactPtr m_contact;
KTp::ContactPtr m_contact;
};
#endif // ENTITY_MODEL_ITEM_H
......@@ -32,6 +32,8 @@
#include <TelepathyQt/PendingOperation>
#include <TelepathyQt/PendingContacts>
#include <KTp/contact.h>
#include <QPixmap>
EntityModel::EntityModel(QObject *parent) :
......@@ -204,7 +206,7 @@ void EntityModel::onEntityContactRetrieved(Tp::PendingOperation *operation)
item = parent->item(itemRow);
if (item->data(EntityModel::IdRole).toString() == contact->id()) {
item->setData(QVariant::fromValue(contact), EntityModel::ContactRole);
item->setData(QVariant::fromValue(KTp::ContactPtr::qObjectCast(contact)), EntityModel::ContactRole);
break;
}
......
......@@ -27,7 +27,7 @@
#include <TelepathyLoggerQt4/Entity>
#include <TelepathyQt/Account>
#include <KTp/types.h>
/**
Lists all avilable entities.
......@@ -83,8 +83,5 @@ private:
};
Q_DECLARE_METATYPE(Tpl::EntityPtr);
Q_DECLARE_METATYPE(Tp::AccountPtr);
Q_DECLARE_METATYPE(Tp::ContactPtr);
#endif // ENTITYMODEL_H
......@@ -70,7 +70,7 @@ bool EntityProxyModel::filterAcceptsRow(int source_row, const QModelIndex &sourc
return matches_filter;
}
Tp::ContactPtr contact = index.data(EntityModel::ContactRole).value< Tp::ContactPtr >();
KTp::ContactPtr contact = index.data(EntityModel::ContactRole).value< KTp::ContactPtr >();
/* Check if contact's account name matches */
if (entity->alias().contains(term, Qt::CaseInsensitive) && matches_filter) {
......
......@@ -31,6 +31,7 @@
#include <TelepathyLoggerQt4/PendingSearch>
#include <KTp/logs-importer.h>
#include <KTp/contact.h>
#include <QSortFilterProxyModel>
#include <QWebFrame>
......@@ -198,7 +199,7 @@ void LogViewer::slotUpdateMainWindow()
nearestDates.second = m_nextConversationDate;
Tpl::EntityPtr entity = currentIndex.data(EntityModel::EntityRole).value<Tpl::EntityPtr>();
Tp::ContactPtr contact = currentIndex.data(EntityModel::ContactRole).value<Tp::ContactPtr>();
KTp::ContactPtr contact = currentIndex.data(EntityModel::ContactRole).value<KTp::ContactPtr>();
Tp::AccountPtr account = currentIndex.data(EntityModel::AccountRole).value<Tp::AccountPtr>();
ui->messageView->loadLog(account, entity, contact, date, nearestDates);
}
......
......@@ -27,6 +27,8 @@
#include <TelepathyQt/AccountManager>
#include <TelepathyLoggerQt4/Init>
#include <KTp/contact-factory.h>