Commit 51af0ee9 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Remove KDELibs4Support from KTp::Declarative

It was only being used by KDebug and some headers.
parent fdba2456
...@@ -13,6 +13,7 @@ set (ktp_qml_plugin_SRCS ...@@ -13,6 +13,7 @@ set (ktp_qml_plugin_SRCS
contact-pin.cpp contact-pin.cpp
telepathy-manager.cpp telepathy-manager.cpp
qml-plugins.cpp qml-plugins.cpp
debug.cpp
) )
add_library (ktpqmlplugin SHARED ${ktp_qml_plugin_SRCS}) add_library (ktpqmlplugin SHARED ${ktp_qml_plugin_SRCS})
...@@ -20,7 +21,8 @@ add_library (ktpqmlplugin SHARED ${ktp_qml_plugin_SRCS}) ...@@ -20,7 +21,8 @@ add_library (ktpqmlplugin SHARED ${ktp_qml_plugin_SRCS})
target_link_libraries (ktpqmlplugin target_link_libraries (ktpqmlplugin
Qt5::Qml Qt5::Qml
KF5::KDELibs4Support KF5::WindowSystem
KF5::I18n
KTp::CommonInternals KTp::CommonInternals
KTp::Logger KTp::Logger
KTp::Models KTp::Models
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <TelepathyQt/PendingChannelRequest> #include <TelepathyQt/PendingChannelRequest>
#include <TelepathyQt/PendingChannel> #include <TelepathyQt/PendingChannel>
#include <KDebug> #include "debug.h"
#include "channel-delegator.h" #include "channel-delegator.h"
...@@ -50,7 +50,7 @@ Conversation::Conversation(const Tp::TextChannelPtr &channel, ...@@ -50,7 +50,7 @@ Conversation::Conversation(const Tp::TextChannelPtr &channel,
QObject(parent), QObject(parent),
d (new ConversationPrivate) d (new ConversationPrivate)
{ {
kDebug(); qCDebug(KTP_DECLARATIVE);
d->account = account; d->account = account;
connect(d->account.data(), SIGNAL(connectionChanged(Tp::ConnectionPtr)), SLOT(onAccountConnectionChanged(Tp::ConnectionPtr))); connect(d->account.data(), SIGNAL(connectionChanged(Tp::ConnectionPtr)), SLOT(onAccountConnectionChanged(Tp::ConnectionPtr)));
...@@ -78,8 +78,7 @@ Conversation::Conversation(const Tp::TextChannelPtr &channel, ...@@ -78,8 +78,7 @@ Conversation::Conversation(const Tp::TextChannelPtr &channel,
Conversation::Conversation(QObject *parent) : QObject(parent) Conversation::Conversation(QObject *parent) : QObject(parent)
{ {
kError() << "Conversation should not be created directly. Use ConversationWatcher instead."; qCCritical(KTP_DECLARATIVE) << "Conversation should not be created directly. Use ConversationWatcher instead.";
Q_ASSERT(false);
} }
void Conversation::setTextChannel(const Tp::TextChannelPtr& channel) void Conversation::setTextChannel(const Tp::TextChannelPtr& channel)
...@@ -156,7 +155,7 @@ bool Conversation::isValid() ...@@ -156,7 +155,7 @@ bool Conversation::isValid()
void Conversation::onChannelInvalidated(Tp::DBusProxy *proxy, const QString &errorName, const QString &errorMessage) void Conversation::onChannelInvalidated(Tp::DBusProxy *proxy, const QString &errorName, const QString &errorMessage)
{ {
kDebug() << proxy << errorName << ":" << errorMessage; qCDebug(KTP_DECLARATIVE) << proxy << errorName << ":" << errorMessage;
d->valid = false; d->valid = false;
...@@ -198,7 +197,7 @@ void Conversation::delegateToProperClient() ...@@ -198,7 +197,7 @@ void Conversation::delegateToProperClient()
void Conversation::requestClose() void Conversation::requestClose()
{ {
kDebug(); qCDebug(KTP_DECLARATIVE);
//removing from the model will delete this object closing the channel //removing from the model will delete this object closing the channel
Q_EMIT conversationCloseRequested(); Q_EMIT conversationCloseRequested();
...@@ -230,7 +229,7 @@ void Conversation::onChatPausedTimerExpired() ...@@ -230,7 +229,7 @@ void Conversation::onChatPausedTimerExpired()
Conversation::~Conversation() Conversation::~Conversation()
{ {
kDebug(); qCDebug(KTP_DECLARATIVE);
//if we are not handling the channel do nothing. //if we are not handling the channel do nothing.
if (!d->delegated) { if (!d->delegated) {
d->messages->textChannel()->requestClose(); d->messages->textChannel()->requestClose();
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "conversation.h" #include "conversation.h"
#include "messages-model.h" #include "messages-model.h"
#include <KDebug> #include "debug.h"
#include <TelepathyQt/ChannelClassSpec> #include <TelepathyQt/ChannelClassSpec>
#include <TelepathyQt/TextChannel> #include <TelepathyQt/TextChannel>
...@@ -64,7 +64,7 @@ QVariant ConversationsModel::data(const QModelIndex &index, int role) const ...@@ -64,7 +64,7 @@ QVariant ConversationsModel::data(const QModelIndex &index, int role) const
if (index.isValid()) { if (index.isValid()) {
if (role == ConversationRole) { if (role == ConversationRole) {
result = QVariant::fromValue<Conversation*>(d->conversations[index.row()]); result = QVariant::fromValue<Conversation*>(d->conversations[index.row()]);
kDebug() << "returning value " << result; qCDebug(KTP_DECLARATIVE) << "returning value " << result;
} }
} }
return result; return result;
...@@ -104,7 +104,7 @@ void ConversationsModel::handleChannels(const Tp::MethodInvocationContextPtr<> & ...@@ -104,7 +104,7 @@ void ConversationsModel::handleChannels(const Tp::MethodInvocationContextPtr<> &
//find the relevant channelRequest //find the relevant channelRequest
Q_FOREACH(const Tp::ChannelRequestPtr channelRequest, channelRequests) { Q_FOREACH(const Tp::ChannelRequestPtr channelRequest, channelRequests) {
kDebug() << channelRequest->hints().allHints(); qCDebug(KTP_DECLARATIVE) << channelRequest->hints().allHints();
shouldDelegate = channelRequest->hints().hint(QLatin1String("org.freedesktop.Telepathy.ChannelRequest"), QLatin1String("DelegateToPreferredHandler")).toBool(); shouldDelegate = channelRequest->hints().hint(QLatin1String("org.freedesktop.Telepathy.ChannelRequest"), QLatin1String("DelegateToPreferredHandler")).toBool();
} }
...@@ -172,7 +172,7 @@ void ConversationsModel::removeConversation(Conversation* conv) ...@@ -172,7 +172,7 @@ void ConversationsModel::removeConversation(Conversation* conv)
conv->deleteLater(); conv->deleteLater();
endRemoveRows(); endRemoveRows();
} else { } else {
kError() << "attempting to delete non-existent conversation"; qWarning() << "attempting to delete non-existent conversation";
} }
} }
......
/*
* Copyright (C) 2014 Martin Klapetek <mklapetek@kde.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 St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "debug.h"
Q_LOGGING_CATEGORY(KTP_DECLARATIVE, "ktp-declarative")
/*
* Copyright (C) 2014 Martin Klapetek <mklapetek@kde.org>
* Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
*
* 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 St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef KTP_DECLARATIVE_DEBUG_H
#define KTP_DECLARATIVE_DEBUG_H
#include <QLoggingCategory>
// include the QDebug here so there doesn't have to
// be two debug includes in the files using qCDebug
#include <QDebug>
Q_DECLARE_LOGGING_CATEGORY(KTP_DECLARATIVE)
#endif
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <QPixmap> #include <QPixmap>
#include <KDebug> #include "debug.h"
#include <KLocalizedString> #include <KLocalizedString>
#include <KConfig> #include <KConfig>
...@@ -67,7 +67,7 @@ MessagesModel::MessagesModel(const Tp::AccountPtr &account, QObject *parent) : ...@@ -67,7 +67,7 @@ MessagesModel::MessagesModel(const Tp::AccountPtr &account, QObject *parent) :
QAbstractListModel(parent), QAbstractListModel(parent),
d(new MessagesModelPrivate) d(new MessagesModelPrivate)
{ {
kDebug(); qCDebug(KTP_DECLARATIVE);
QHash<int, QByteArray> roles; QHash<int, QByteArray> roles;
roles[TextRole] = "text"; roles[TextRole] = "text";
...@@ -103,7 +103,7 @@ bool MessagesModel::verifyPendingOperation(Tp::PendingOperation *op) ...@@ -103,7 +103,7 @@ bool MessagesModel::verifyPendingOperation(Tp::PendingOperation *op)
bool operationSucceeded = true; bool operationSucceeded = true;
if (op->isError()) { if (op->isError()) {
kWarning() << op->errorName() << "+" << op->errorMessage(); qCWarning(KTP_DECLARATIVE) << op->errorName() << "+" << op->errorMessage();
operationSucceeded = false; operationSucceeded = false;
} }
...@@ -126,7 +126,7 @@ void MessagesModel::setupChannelSignals(const Tp::TextChannelPtr &channel) ...@@ -126,7 +126,7 @@ void MessagesModel::setupChannelSignals(const Tp::TextChannelPtr &channel)
void MessagesModel::setTextChannel(const Tp::TextChannelPtr &channel) void MessagesModel::setTextChannel(const Tp::TextChannelPtr &channel)
{ {
Q_ASSERT(channel != d->textChannel); Q_ASSERT(channel != d->textChannel);
kDebug(); qCDebug(KTP_DECLARATIVE);
setupChannelSignals(channel); setupChannelSignals(channel);
if (d->textChannel) { if (d->textChannel) {
...@@ -161,7 +161,7 @@ void MessagesModel::setTextChannel(const Tp::TextChannelPtr &channel) ...@@ -161,7 +161,7 @@ void MessagesModel::setTextChannel(const Tp::TextChannelPtr &channel)
void MessagesModel::onHistoryFetched(const QList<KTp::Message> &messages) void MessagesModel::onHistoryFetched(const QList<KTp::Message> &messages)
{ {
kDebug() << "found" << messages.count() << "messages in history"; qCDebug(KTP_DECLARATIVE) << "found" << messages.count() << "messages in history";
if (!messages.isEmpty()) { if (!messages.isEmpty()) {
//Add all messages before the ones already present in the channel //Add all messages before the ones already present in the channel
beginInsertRows(QModelIndex(), 0, messages.count() - 1); beginInsertRows(QModelIndex(), 0, messages.count() - 1);
...@@ -176,21 +176,21 @@ void MessagesModel::onHistoryFetched(const QList<KTp::Message> &messages) ...@@ -176,21 +176,21 @@ void MessagesModel::onHistoryFetched(const QList<KTp::Message> &messages)
void MessagesModel::onMessageReceived(const Tp::ReceivedMessage &message) void MessagesModel::onMessageReceived(const Tp::ReceivedMessage &message)
{ {
int unreadCount = d->textChannel->messageQueue().size(); int unreadCount = d->textChannel->messageQueue().size();
kDebug() << "unreadMessagesCount =" << unreadCount; qCDebug(KTP_DECLARATIVE) << "unreadMessagesCount =" << unreadCount;
kDebug() << "text =" << message.text(); qCDebug(KTP_DECLARATIVE) << "text =" << message.text();
kDebug() << "messageType = " << message.messageType(); qCDebug(KTP_DECLARATIVE) << "messageType = " << message.messageType();
kDebug() << "messageToken =" << message.messageToken(); qCDebug(KTP_DECLARATIVE) << "messageToken =" << message.messageToken();
if (message.isDeliveryReport()) { if (message.isDeliveryReport()) {
d->textChannel->acknowledge(QList<Tp::ReceivedMessage>() << message); d->textChannel->acknowledge(QList<Tp::ReceivedMessage>() << message);
Tp::ReceivedMessage::DeliveryDetails deliveryDetails = message.deliveryDetails(); Tp::ReceivedMessage::DeliveryDetails deliveryDetails = message.deliveryDetails();
if(!deliveryDetails.hasOriginalToken()) { if(!deliveryDetails.hasOriginalToken()) {
kDebug() << "Delivery report without original message token received."; qCDebug(KTP_DECLARATIVE) << "Delivery report without original message token received.";
// Matching the delivery report to the original message is impossible without the token. // Matching the delivery report to the original message is impossible without the token.
return; return;
} }
kDebug() << "originalMessageToken =" << deliveryDetails.originalToken(); qCDebug(KTP_DECLARATIVE) << "originalMessageToken =" << deliveryDetails.originalToken();
QPersistentModelIndex originalMessageIndex = d->messagesByMessageToken.value( QPersistentModelIndex originalMessageIndex = d->messagesByMessageToken.value(
deliveryDetails.originalToken()); deliveryDetails.originalToken());
...@@ -200,7 +200,7 @@ void MessagesModel::onMessageReceived(const Tp::ReceivedMessage &message) ...@@ -200,7 +200,7 @@ void MessagesModel::onMessageReceived(const Tp::ReceivedMessage &message)
} }
MessagePrivate &originalMessage = d->messages[originalMessageIndex.row()]; MessagePrivate &originalMessage = d->messages[originalMessageIndex.row()];
kDebug() << "Got delivery status" << deliveryDetails.status() qCDebug(KTP_DECLARATIVE) << "Got delivery status" << deliveryDetails.status()
<< "for message with text" << originalMessage.message.mainMessagePart(); << "for message with text" << originalMessage.message.mainMessagePart();
originalMessage.deliveryReportReceiveTime = message.received(); originalMessage.deliveryReportReceiveTime = message.received();
switch(deliveryDetails.status()) { switch(deliveryDetails.status()) {
...@@ -208,7 +208,7 @@ void MessagesModel::onMessageReceived(const Tp::ReceivedMessage &message) ...@@ -208,7 +208,7 @@ void MessagesModel::onMessageReceived(const Tp::ReceivedMessage &message)
case Tp::DeliveryStatusTemporarilyFailed: case Tp::DeliveryStatusTemporarilyFailed:
originalMessage.deliveryStatus = DeliveryStatusFailed; originalMessage.deliveryStatus = DeliveryStatusFailed;
if (deliveryDetails.hasDebugMessage()) { if (deliveryDetails.hasDebugMessage()) {
kDebug() << "Delivery failure debug message:" << deliveryDetails.debugMessage(); qCDebug(KTP_DECLARATIVE) << "Delivery failure debug message:" << deliveryDetails.debugMessage();
} }
break; break;
case Tp::DeliveryStatusDelivered: case Tp::DeliveryStatusDelivered:
...@@ -245,7 +245,7 @@ void MessagesModel::onMessageSent(const Tp::Message &message, Tp::MessageSending ...@@ -245,7 +245,7 @@ void MessagesModel::onMessageSent(const Tp::Message &message, Tp::MessageSending
int length = rowCount(); int length = rowCount();
beginInsertRows(QModelIndex(), length, length); beginInsertRows(QModelIndex(), length, length);
kDebug() << "text =" << message.text(); qCDebug(KTP_DECLARATIVE) << "text =" << message.text();
const KTp::Message &newMessage = KTp::MessageProcessor::instance()->processIncomingMessage( const KTp::Message &newMessage = KTp::MessageProcessor::instance()->processIncomingMessage(
message, d->account, d->textChannel); message, d->account, d->textChannel);
...@@ -309,7 +309,7 @@ QVariant MessagesModel::data(const QModelIndex &index, int role) const ...@@ -309,7 +309,7 @@ QVariant MessagesModel::data(const QModelIndex &index, int role) const
break; break;
}; };
} else { } else {
kError() << "Attempting to access data at invalid index (" << index << ")"; qWarning() << "Attempting to access data at invalid index (" << index << ")";
} }
return result; return result;
...@@ -324,7 +324,7 @@ int MessagesModel::rowCount(const QModelIndex &parent) const ...@@ -324,7 +324,7 @@ int MessagesModel::rowCount(const QModelIndex &parent) const
void MessagesModel::sendNewMessage(const QString &message) void MessagesModel::sendNewMessage(const QString &message)
{ {
if (message.isEmpty()) { if (message.isEmpty()) {
kWarning() << "Attempting to send empty string"; qCWarning(KTP_DECLARATIVE) << "Attempting to send empty string";
} else { } else {
Tp::PendingOperation *op; Tp::PendingOperation *op;
QString modifiedMessage = message; QString modifiedMessage = message;
...@@ -365,7 +365,7 @@ void MessagesModel::acknowledgeAllMessages() ...@@ -365,7 +365,7 @@ void MessagesModel::acknowledgeAllMessages()
{ {
QList<Tp::ReceivedMessage> queue = d->textChannel->messageQueue(); QList<Tp::ReceivedMessage> queue = d->textChannel->messageQueue();
kDebug() << "Conversation Visible, Acknowledging " << queue.size() << " messages."; qCDebug(KTP_DECLARATIVE) << "Conversation Visible, Acknowledging " << queue.size() << " messages.";
d->textChannel->acknowledge(queue); d->textChannel->acknowledge(queue);
Q_EMIT unreadCountChanged(queue.size()); Q_EMIT unreadCountChanged(queue.size());
...@@ -373,7 +373,7 @@ void MessagesModel::acknowledgeAllMessages() ...@@ -373,7 +373,7 @@ void MessagesModel::acknowledgeAllMessages()
void MessagesModel::setVisibleToUser(bool visible) void MessagesModel::setVisibleToUser(bool visible)
{ {
kDebug() << visible; qCDebug(KTP_DECLARATIVE) << visible;
if (d->visible != visible) { if (d->visible != visible) {
d->visible = visible; d->visible = visible;
...@@ -392,7 +392,7 @@ bool MessagesModel::isVisibleToUser() const ...@@ -392,7 +392,7 @@ bool MessagesModel::isVisibleToUser() const
MessagesModel::~MessagesModel() MessagesModel::~MessagesModel()
{ {
kDebug(); qCDebug(KTP_DECLARATIVE);
delete d; delete d;
} }
......
...@@ -29,9 +29,8 @@ ...@@ -29,9 +29,8 @@
#include <TelepathyQt/ContactManager> #include <TelepathyQt/ContactManager>
#include <TelepathyQt/PendingContacts> #include <TelepathyQt/PendingContacts>
#include <KComponentData>
#include <KConfigGroup> #include <KConfigGroup>
#include <KDebug> #include "debug.h"
#include "KTp/presence.h" #include "KTp/presence.h"
#include "KTp/contact.h" #include "KTp/contact.h"
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <Widgets/add-contact-dialog.h> #include <Widgets/add-contact-dialog.h>
#include <Widgets/settings-kcm-dialog.h> #include <Widgets/settings-kcm-dialog.h>
#include <KTp/actions.h> #include <KTp/actions.h>
#include <kstandarddirs.h>
#include <KToolInvocation> #include <KToolInvocation>
#include <TelepathyQt/Account> #include <TelepathyQt/Account>
......
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