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
contact-pin.cpp
telepathy-manager.cpp
qml-plugins.cpp
debug.cpp
)
add_library (ktpqmlplugin SHARED ${ktp_qml_plugin_SRCS})
......@@ -20,7 +21,8 @@ add_library (ktpqmlplugin SHARED ${ktp_qml_plugin_SRCS})
target_link_libraries (ktpqmlplugin
Qt5::Qml
KF5::KDELibs4Support
KF5::WindowSystem
KF5::I18n
KTp::CommonInternals
KTp::Logger
KTp::Models
......
......@@ -25,7 +25,7 @@
#include <TelepathyQt/PendingChannelRequest>
#include <TelepathyQt/PendingChannel>
#include <KDebug>
#include "debug.h"
#include "channel-delegator.h"
......@@ -50,7 +50,7 @@ Conversation::Conversation(const Tp::TextChannelPtr &channel,
QObject(parent),
d (new ConversationPrivate)
{
kDebug();
qCDebug(KTP_DECLARATIVE);
d->account = account;
connect(d->account.data(), SIGNAL(connectionChanged(Tp::ConnectionPtr)), SLOT(onAccountConnectionChanged(Tp::ConnectionPtr)));
......@@ -78,8 +78,7 @@ Conversation::Conversation(const Tp::TextChannelPtr &channel,
Conversation::Conversation(QObject *parent) : QObject(parent)
{
kError() << "Conversation should not be created directly. Use ConversationWatcher instead.";
Q_ASSERT(false);
qCCritical(KTP_DECLARATIVE) << "Conversation should not be created directly. Use ConversationWatcher instead.";
}
void Conversation::setTextChannel(const Tp::TextChannelPtr& channel)
......@@ -156,7 +155,7 @@ bool Conversation::isValid()
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;
......@@ -198,7 +197,7 @@ void Conversation::delegateToProperClient()
void Conversation::requestClose()
{
kDebug();
qCDebug(KTP_DECLARATIVE);
//removing from the model will delete this object closing the channel
Q_EMIT conversationCloseRequested();
......@@ -230,7 +229,7 @@ void Conversation::onChatPausedTimerExpired()
Conversation::~Conversation()
{
kDebug();
qCDebug(KTP_DECLARATIVE);
//if we are not handling the channel do nothing.
if (!d->delegated) {
d->messages->textChannel()->requestClose();
......
......@@ -21,7 +21,7 @@
#include "conversation.h"
#include "messages-model.h"
#include <KDebug>
#include "debug.h"
#include <TelepathyQt/ChannelClassSpec>
#include <TelepathyQt/TextChannel>
......@@ -64,7 +64,7 @@ QVariant ConversationsModel::data(const QModelIndex &index, int role) const
if (index.isValid()) {
if (role == ConversationRole) {
result = QVariant::fromValue<Conversation*>(d->conversations[index.row()]);
kDebug() << "returning value " << result;
qCDebug(KTP_DECLARATIVE) << "returning value " << result;
}
}
return result;
......@@ -104,7 +104,7 @@ void ConversationsModel::handleChannels(const Tp::MethodInvocationContextPtr<> &
//find the relevant channelRequest
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();
}
......@@ -172,7 +172,7 @@ void ConversationsModel::removeConversation(Conversation* conv)
conv->deleteLater();
endRemoveRows();
} 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 @@
#include <QPixmap>
#include <KDebug>
#include "debug.h"
#include <KLocalizedString>
#include <KConfig>
......@@ -67,7 +67,7 @@ MessagesModel::MessagesModel(const Tp::AccountPtr &account, QObject *parent) :
QAbstractListModel(parent),
d(new MessagesModelPrivate)
{
kDebug();
qCDebug(KTP_DECLARATIVE);
QHash<int, QByteArray> roles;
roles[TextRole] = "text";
......@@ -103,7 +103,7 @@ bool MessagesModel::verifyPendingOperation(Tp::PendingOperation *op)
bool operationSucceeded = true;
if (op->isError()) {
kWarning() << op->errorName() << "+" << op->errorMessage();
qCWarning(KTP_DECLARATIVE) << op->errorName() << "+" << op->errorMessage();
operationSucceeded = false;
}
......@@ -126,7 +126,7 @@ void MessagesModel::setupChannelSignals(const Tp::TextChannelPtr &channel)
void MessagesModel::setTextChannel(const Tp::TextChannelPtr &channel)
{
Q_ASSERT(channel != d->textChannel);
kDebug();
qCDebug(KTP_DECLARATIVE);
setupChannelSignals(channel);
if (d->textChannel) {
......@@ -161,7 +161,7 @@ void MessagesModel::setTextChannel(const Tp::TextChannelPtr &channel)
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()) {
//Add all messages before the ones already present in the channel
beginInsertRows(QModelIndex(), 0, messages.count() - 1);
......@@ -176,21 +176,21 @@ void MessagesModel::onHistoryFetched(const QList<KTp::Message> &messages)
void MessagesModel::onMessageReceived(const Tp::ReceivedMessage &message)
{
int unreadCount = d->textChannel->messageQueue().size();
kDebug() << "unreadMessagesCount =" << unreadCount;
kDebug() << "text =" << message.text();
kDebug() << "messageType = " << message.messageType();
kDebug() << "messageToken =" << message.messageToken();
qCDebug(KTP_DECLARATIVE) << "unreadMessagesCount =" << unreadCount;
qCDebug(KTP_DECLARATIVE) << "text =" << message.text();
qCDebug(KTP_DECLARATIVE) << "messageType = " << message.messageType();
qCDebug(KTP_DECLARATIVE) << "messageToken =" << message.messageToken();
if (message.isDeliveryReport()) {
d->textChannel->acknowledge(QList<Tp::ReceivedMessage>() << message);
Tp::ReceivedMessage::DeliveryDetails deliveryDetails = message.deliveryDetails();
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.
return;
}
kDebug() << "originalMessageToken =" << deliveryDetails.originalToken();
qCDebug(KTP_DECLARATIVE) << "originalMessageToken =" << deliveryDetails.originalToken();
QPersistentModelIndex originalMessageIndex = d->messagesByMessageToken.value(
deliveryDetails.originalToken());
......@@ -200,7 +200,7 @@ void MessagesModel::onMessageReceived(const Tp::ReceivedMessage &message)
}
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();
originalMessage.deliveryReportReceiveTime = message.received();
switch(deliveryDetails.status()) {
......@@ -208,7 +208,7 @@ void MessagesModel::onMessageReceived(const Tp::ReceivedMessage &message)
case Tp::DeliveryStatusTemporarilyFailed:
originalMessage.deliveryStatus = DeliveryStatusFailed;
if (deliveryDetails.hasDebugMessage()) {
kDebug() << "Delivery failure debug message:" << deliveryDetails.debugMessage();
qCDebug(KTP_DECLARATIVE) << "Delivery failure debug message:" << deliveryDetails.debugMessage();
}
break;
case Tp::DeliveryStatusDelivered:
......@@ -245,7 +245,7 @@ void MessagesModel::onMessageSent(const Tp::Message &message, Tp::MessageSending
int length = rowCount();
beginInsertRows(QModelIndex(), length, length);
kDebug() << "text =" << message.text();
qCDebug(KTP_DECLARATIVE) << "text =" << message.text();
const KTp::Message &newMessage = KTp::MessageProcessor::instance()->processIncomingMessage(
message, d->account, d->textChannel);
......@@ -309,7 +309,7 @@ QVariant MessagesModel::data(const QModelIndex &index, int role) const
break;
};
} else {
kError() << "Attempting to access data at invalid index (" << index << ")";
qWarning() << "Attempting to access data at invalid index (" << index << ")";
}
return result;
......@@ -324,7 +324,7 @@ int MessagesModel::rowCount(const QModelIndex &parent) const
void MessagesModel::sendNewMessage(const QString &message)
{
if (message.isEmpty()) {
kWarning() << "Attempting to send empty string";
qCWarning(KTP_DECLARATIVE) << "Attempting to send empty string";
} else {
Tp::PendingOperation *op;
QString modifiedMessage = message;
......@@ -365,7 +365,7 @@ void MessagesModel::acknowledgeAllMessages()
{
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);
Q_EMIT unreadCountChanged(queue.size());
......@@ -373,7 +373,7 @@ void MessagesModel::acknowledgeAllMessages()
void MessagesModel::setVisibleToUser(bool visible)
{
kDebug() << visible;
qCDebug(KTP_DECLARATIVE) << visible;
if (d->visible != visible) {
d->visible = visible;
......@@ -392,7 +392,7 @@ bool MessagesModel::isVisibleToUser() const
MessagesModel::~MessagesModel()
{
kDebug();
qCDebug(KTP_DECLARATIVE);
delete d;
}
......
......@@ -29,9 +29,8 @@
#include <TelepathyQt/ContactManager>
#include <TelepathyQt/PendingContacts>
#include <KComponentData>
#include <KConfigGroup>
#include <KDebug>
#include "debug.h"
#include "KTp/presence.h"
#include "KTp/contact.h"
......
......@@ -22,7 +22,6 @@
#include <Widgets/add-contact-dialog.h>
#include <Widgets/settings-kcm-dialog.h>
#include <KTp/actions.h>
#include <kstandarddirs.h>
#include <KToolInvocation>
#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