Commit d5a8e20f authored by pvuorela's avatar pvuorela

Merge branch 'use_standard_logging' into 'master'

Use standard logging. JB#53698

See merge request !52
parents 8e9cdc9c f5ad02f2
......@@ -36,16 +36,16 @@ AccountOperationsObserver::AccountOperationsObserver(Tp::AccountManagerPtr accou
m_pGroupModel(0),
m_AccountManager(accountManager)
{
DEBUG() << Q_FUNC_INFO << "START";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "START";
if (!m_AccountManager.isNull()) {
if (!m_AccountManager->isReady()) {
DEBUG() << Q_FUNC_INFO << "Account manager is not ready. Making it ready...";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Account manager is not ready. Making it ready...";
connect(m_AccountManager->becomeReady(),
SIGNAL(finished(Tp::PendingOperation *)),
SLOT(slotAccountManagerReady(Tp::PendingOperation *)));
} else {
DEBUG() << Q_FUNC_INFO << "Account manager is already ready.";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Account manager is already ready.";
connectToAccounts();
}
} else {
......@@ -58,12 +58,12 @@ AccountOperationsObserver::AccountOperationsObserver(Tp::AccountManagerPtr accou
SLOT(removeNotifications(QString)),
Qt::UniqueConnection);
DEBUG() << Q_FUNC_INFO << "END";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "END";
}
void AccountOperationsObserver::connectToAccounts()
{
DEBUG() << Q_FUNC_INFO << "START";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "START";
// First of all we must connect to listen removed()-signals of the accounts created in the future:
connect(m_AccountManager.data(),
......@@ -76,14 +76,14 @@ void AccountOperationsObserver::connectToAccounts()
slotConnectToSignals(account);
}
DEBUG() << Q_FUNC_INFO << "END";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "END";
}
// S L O T S
void AccountOperationsObserver::slotAccountManagerReady(Tp::PendingOperation *op)
{
DEBUG() << Q_FUNC_INFO << "START";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "START";
if (op->isError()) {
qWarning() << "Account manager cannot become ready:" << op->errorName() << "-" << op->errorMessage();
......@@ -92,12 +92,12 @@ void AccountOperationsObserver::slotAccountManagerReady(Tp::PendingOperation *op
connectToAccounts();
DEBUG() << Q_FUNC_INFO << "END";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "END";
}
void AccountOperationsObserver::slotConnectToSignals(const Tp::AccountPtr &account)
{
DEBUG() << Q_FUNC_INFO << "START";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "START";
if (!account.isNull()) {
m_accounts.insert(account->objectPath(), account);
......@@ -114,12 +114,12 @@ void AccountOperationsObserver::slotConnectToSignals(const Tp::AccountPtr &accou
Qt::UniqueConnection);
}
DEBUG() << Q_FUNC_INFO << "END";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "END";
}
void AccountOperationsObserver::slotAccountStateChanged(bool isEnabled)
{
DEBUG() << Q_FUNC_INFO << isEnabled;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << isEnabled;
if (!isEnabled) {
......@@ -131,13 +131,13 @@ void AccountOperationsObserver::slotAccountStateChanged(bool isEnabled)
void AccountOperationsObserver::slotAccountRemoved()
{
DEBUG() << Q_FUNC_INFO << "START";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "START";
Tp::Account *account = qobject_cast<Tp::Account *>(sender());
if (account) {
QString accountPath = account->objectPath();
DEBUG() << Q_FUNC_INFO << "Account " << accountPath << " removed.";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Account " << accountPath << " removed.";
m_accounts.remove(accountPath);
......@@ -183,12 +183,12 @@ void AccountOperationsObserver::slotAccountRemoved()
}
}
DEBUG() << Q_FUNC_INFO << "END";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "END";
}
void AccountOperationsObserver::slotDeleteConversations()
{
DEBUG() << Q_FUNC_INFO << "START";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "START";
if (!m_pGroupModel)
return;
......@@ -203,7 +203,7 @@ void AccountOperationsObserver::slotDeleteConversations()
int groupId = group.id();
QString localId = group.localUid();
if (localId == accountPath) {
DEBUG() << Q_FUNC_INFO << "Group " << groupId << " to be deleted";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Group " << groupId << " to be deleted";
groupsToBeDeleted.append(groupId);
}
}
......@@ -221,12 +221,12 @@ void AccountOperationsObserver::slotDeleteConversations()
m_accountPathsForConvs.clear();
DEBUG() << Q_FUNC_INFO << "END";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "END";
}
void AccountOperationsObserver::slotDeleteCalls()
{
DEBUG() << Q_FUNC_INFO << "START";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "START";
CommHistory::CallModel *callModel = qobject_cast<CommHistory::CallModel *>(sender());
......@@ -241,7 +241,7 @@ void AccountOperationsObserver::slotDeleteCalls()
QModelIndex index = callModel->index(i,0);
if (index.isValid()) {
CommHistory::Event callEvent = callModel->event(index);
DEBUG() << Q_FUNC_INFO << "Call " << callEvent.id() << " to be deleted";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Call " << callEvent.id() << " to be deleted";
callsToBeDeleted.append(callEvent);
}
}
......@@ -255,14 +255,14 @@ void AccountOperationsObserver::slotDeleteCalls()
if (callsToBeDeleted.isEmpty()) {
QString accountPath = m_accountPathsForCalls.key(callModel);
DEBUG() << Q_FUNC_INFO << "No calls to be deleted for " << accountPath << ". We can delete the CallModel.";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "No calls to be deleted for " << accountPath << ". We can delete the CallModel.";
m_accountPathsForCalls.take(accountPath)->deleteLater();
// delete notifcations of this account
emit removeAccountNotifications(accountPath);
}
DEBUG() << Q_FUNC_INFO << "END";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "END";
}
void AccountOperationsObserver::slotRowsRemoved(const QModelIndex& index, int start, int end)
......@@ -271,7 +271,7 @@ void AccountOperationsObserver::slotRowsRemoved(const QModelIndex& index, int st
Q_UNUSED(start)
Q_UNUSED(end)
DEBUG() << Q_FUNC_INFO << "start: " << start << " end: " << end;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "start: " << start << " end: " << end;
CommHistory::CallModel *callModel = qobject_cast<CommHistory::CallModel *>(sender());
......@@ -281,7 +281,7 @@ void AccountOperationsObserver::slotRowsRemoved(const QModelIndex& index, int st
}
if (callModel->rowCount() == 0) {
DEBUG() << Q_FUNC_INFO << "Last event in CallModel deleted. We can delete the model.";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Last event in CallModel deleted. We can delete the model.";
QString accountPath = m_accountPathsForCalls.key(callModel);
m_accountPathsForCalls.take(accountPath)->deleteLater();
......@@ -289,5 +289,5 @@ void AccountOperationsObserver::slotRowsRemoved(const QModelIndex& index, int st
emit removeAccountNotifications(accountPath);
}
DEBUG() << Q_FUNC_INFO << "END";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "END";
}
......@@ -59,7 +59,7 @@ AccountPresenceService::AccountPresenceService(Tp::AccountManagerPtr manager, QO
if (!QDBusConnection::sessionBus().registerObject(ACCOUNT_PRESENCE_OBJECT_PATH, this)) {
qWarning() << "Object registration failed!";
} else {
if(!QDBusConnection::sessionBus().registerService(ACCOUNT_PRESENCE_SERVICE_NAME)) {
if (!QDBusConnection::sessionBus().registerService(ACCOUNT_PRESENCE_SERVICE_NAME)) {
qWarning() << "Unable to register account presence service!"
<< QDBusConnection::sessionBus().lastError();
} else {
......@@ -69,7 +69,7 @@ AccountPresenceService::AccountPresenceService(Tp::AccountManagerPtr manager, QO
if (!m_accountManager->isReady()) {
// Wait for the account manager to become ready
DEBUG() << "Waiting for account manager to become ready";
qCDebug(lcCommhistoryd) << "Waiting for account manager to become ready";
Tp::PendingReady *pr = m_accountManager->becomeReady(Tp::AccountManager::FeatureCore);
Q_ASSERT(pr);
connect(pr, SIGNAL(finished(Tp::PendingOperation *)),
......@@ -138,7 +138,7 @@ void AccountPresenceService::setAccountPresenceWithMessage(const QString &accoun
void AccountPresenceService::accountManagerReady(Tp::PendingOperation *)
{
if (m_accountManager->isReady()) {
DEBUG() << "Account manager is now ready";
qCDebug(lcCommhistoryd) << "Account manager is now ready";
// Process any updates that were previously deferred
if (m_globalUpdatePresent) {
......
......@@ -52,7 +52,7 @@ ChannelListener::ChannelListener(const Tp::AccountPtr &account,
void ChannelListener::slotChannelReady(Tp::PendingOperation* operation)
{
DEBUG() << __PRETTY_FUNCTION__ << channel();
qCDebug(lcCommhistoryd) << __PRETTY_FUNCTION__ << channel();
if (!checkIfError(operation) && m_Channel) {
m_Direction = m_Channel->isRequested() ?
......@@ -70,11 +70,11 @@ bool ChannelListener::checkIfError(Tp::PendingOperation* operation)
{
bool error = true;
if( operation && !operation->isError() ) {
if (operation && !operation->isError()) {
error = false;
} else if( operation ) {
finishedWithError( operation->errorName(),
operation->errorMessage() );
} else if (operation) {
finishedWithError(operation->errorName(),
operation->errorMessage());
}
return error;
}
......@@ -82,7 +82,7 @@ bool ChannelListener::checkIfError(Tp::PendingOperation* operation)
void ChannelListener::invalidated(Tp::DBusProxy *proxy,
const QString &errorName, const QString &errorMessage)
{
DEBUG() << __PRETTY_FUNCTION__ << proxy->objectPath();
qCDebug(lcCommhistoryd) << __PRETTY_FUNCTION__ << proxy->objectPath();
Q_UNUSED(proxy)
finishedWithError(errorName, errorMessage);
......@@ -91,7 +91,7 @@ void ChannelListener::invalidated(Tp::DBusProxy *proxy,
void ChannelListener::finishedWithError(const QString& errorName,
const QString& errorMessage)
{
if( !m_InvocationContext.isNull() ) {
if (!m_InvocationContext.isNull()) {
m_InvocationContext->setFinishedWithError(errorName, errorMessage);
}
closed();
......@@ -104,7 +104,7 @@ ChannelListener::~ChannelListener()
QString ChannelListener::channel() const
{
QString channel;
if(!m_Channel.isNull()) {
if (!m_Channel.isNull()) {
channel = m_Channel->objectPath();
}
return channel;
......@@ -112,7 +112,7 @@ QString ChannelListener::channel() const
void ChannelListener::closed()
{
DEBUG() << "channelClosed";
qCDebug(lcCommhistoryd) << "channelClosed";
emit channelClosed(this);
}
......@@ -134,7 +134,7 @@ void ChannelListener::makeChannelReady(const Tp::Features &features)
void ChannelListener::invocationContextFinished()
{
if(!m_InvocationContext.isNull()) {
if (!m_InvocationContext.isNull()) {
m_InvocationContext->setFinished();
}
}
......@@ -146,7 +146,7 @@ void ChannelListener::invocationContextError()
CommHistory::EventModel& ChannelListener::eventModel()
{
if(!m_pEventModel){
if (!m_pEventModel) {
m_pEventModel = new CommHistory::EventModel(this);
}
......@@ -170,5 +170,5 @@ QString ChannelListener::targetId() const
void ChannelListener::channelReady()
{
DEBUG() << Q_FUNC_INFO << "not implemented";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "not implemented";
}
......@@ -46,10 +46,10 @@ CommHistoryService::CommHistoryService( QObject* parent )
}
if (parent) {
if(!QDBusConnection::sessionBus().registerObject(COMM_HISTORY_DAEMON_OBJECT_PATH, this)) {
if (!QDBusConnection::sessionBus().registerObject(COMM_HISTORY_DAEMON_OBJECT_PATH, this)) {
qWarning() << "Object registration failed!";
} else {
if(!QDBusConnection::sessionBus().registerService(COMM_HISTORY_DAEMON_SERVICE_NAME)) {
if (!QDBusConnection::sessionBus().registerService(COMM_HISTORY_DAEMON_SERVICE_NAME)) {
qWarning() << "Unable to register commhistory service!"
<< QDBusConnection::sessionBus().lastError();
} else {
......
......@@ -32,7 +32,7 @@ using namespace RTComLogger;
ConnectionUtils::ConnectionUtils(QObject* parent) : QObject(parent)
{
DEBUG() << Q_FUNC_INFO;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;
Tp::registerTypes();
......@@ -55,9 +55,9 @@ Tp::AccountManagerPtr ConnectionUtils::accountManager() const
void ConnectionUtils::prepareAccounts()
{
DEBUG() << Q_FUNC_INFO;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;
if(!m_AccountManager.isNull() && m_AccountManager->isReady()){
if (!m_AccountManager.isNull() && m_AccountManager->isReady()) {
// connect to new account signals
connect(m_AccountManager.data(),
SIGNAL(newAccount(const Tp::AccountPtr &)),
......@@ -73,7 +73,7 @@ void ConnectionUtils::prepareAccounts()
void ConnectionUtils::slotAccountManagerReady(Tp::PendingOperation *op)
{
DEBUG() << Q_FUNC_INFO;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;
if (!op->isError() && m_AccountManager->isReady()) {
prepareAccounts();
......@@ -84,9 +84,9 @@ void ConnectionUtils::slotAccountManagerReady(Tp::PendingOperation *op)
void ConnectionUtils::prepareAccount(const Tp::AccountPtr &account)
{
if(!account.isNull() && account->isReady()) {
if (!account.isNull() && account->isReady()) {
prepareConnection(account);
} else if(!account.isNull() && !account->isReady()) {
} else if (!account.isNull() && !account->isReady()) {
Tp::PendingOperation* po = account->becomeReady();
connect(po,
SIGNAL(finished(Tp::PendingOperation *)),
......@@ -122,7 +122,7 @@ void ConnectionUtils::slotAccountValidityChanged(bool valid)
void ConnectionUtils::slotAddAccount(const Tp::AccountPtr &account)
{
if(!m_AccountManager.isNull()) {
if (!m_AccountManager.isNull()) {
prepareAccount(account);
}
}
......@@ -136,8 +136,8 @@ void ConnectionUtils::prepareConnection(const Tp::AccountPtr &account)
Tp::ConnectionPtr connection = account->connection();
if(!connection.isNull()) {
DEBUG() << Q_FUNC_INFO << "Connection object exists";
if (!connection.isNull()) {
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Connection object exists";
connect(connection->becomeReady(Tp::Connection::FeatureSimplePresence),
SIGNAL(finished(Tp::PendingOperation*)),
SLOT(slotConnectionReady(Tp::PendingOperation*)));
......@@ -150,13 +150,13 @@ void ConnectionUtils::prepareConnection(const Tp::AccountPtr &account)
void ConnectionUtils::slotConnectionChanged(const Tp::ConnectionPtr &connection)
{
DEBUG() << Q_FUNC_INFO;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;
Tp::Account *account = qobject_cast<Tp::Account *>(sender());
if(account != 0 && account->isValid()) {
if(!connection.isNull()) {
DEBUG() << Q_FUNC_INFO << "Connection object exists";
if (account != 0 && account->isValid()) {
if (!connection.isNull()) {
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Connection object exists";
connect(connection->becomeReady(Tp::Connection::FeatureSimplePresence),
SIGNAL(finished(Tp::PendingOperation*)),
SLOT(slotConnectionReady(Tp::PendingOperation*)));
......@@ -166,11 +166,11 @@ void ConnectionUtils::slotConnectionChanged(const Tp::ConnectionPtr &connection)
void ConnectionUtils::slotConnectionReady(Tp::PendingOperation* operation)
{
DEBUG() << Q_FUNC_INFO;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;
if(operation && !operation->isError()) {
if (operation && !operation->isError()) {
Tp::PendingReady *pr = qobject_cast<Tp::PendingReady*>(operation);
if(pr){
if (pr) {
Tp::ConnectionPtr connection = Tp::ConnectionPtr::qObjectCast(pr->proxy());
if (!connection.isNull() && connection->isValid()) {
......
......@@ -41,7 +41,7 @@ ContactAuthorizationListener::ContactAuthorizationListener(ConnectionUtils *conn
QObject(parent),
m_pConnectionUtils(connectionUtils)
{
DEBUG() << Q_FUNC_INFO;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;
connect(m_pConnectionUtils,
SIGNAL(connectionReady(Tp::ConnectionPtr)),
......@@ -68,21 +68,21 @@ ContactAuthorizationListener::ContactAuthorizationListener(ConnectionUtils *conn
ContactAuthorizationListener::~ContactAuthorizationListener()
{
DEBUG() << Q_FUNC_INFO;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;
}
void ContactAuthorizationListener::slotConnectionReady(const Tp::ConnectionPtr& connection)
{
DEBUG() << Q_FUNC_INFO;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;
if(!connection)
if (!connection)
return;
Tp::AccountPtr account;
Tp::AccountManagerPtr accountManager = m_pConnectionUtils->accountManager();
if(accountManager && accountManager->isReady()) {
DEBUG() << Q_FUNC_INFO << "Connection object path: " << connection->objectPath();
if (accountManager && accountManager->isReady()) {
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Connection object path: " << connection->objectPath();
#if 1
foreach (Tp::AccountPtr a, accountManager->validAccounts()->accounts()) {
if (a->connection() && a->connection()->objectPath() == connection->objectPath()) {
......@@ -96,17 +96,17 @@ void ContactAuthorizationListener::slotConnectionReady(const Tp::ConnectionPtr&
filter.insert(QLatin1String("connection"), QVariant::fromValue(connection));
Tp::AccountSetPtr accountSet =
accountManager->filterAccounts(filter);
if(!accountSet->accounts().isEmpty()){
if (!accountSet->accounts().isEmpty()) {
account = accountSet->accounts().first();
}
#endif
}
if(account) {
if (account) {
// Create ContactAuthorizer only for IM accounts:
if (connection->actualFeatures().contains(Tp::Connection::FeatureSimplePresence))
{
DEBUG() << Q_FUNC_INFO << "Creating ContactAuthorizer for " << account->uniqueIdentifier();
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Creating ContactAuthorizer for " << account->uniqueIdentifier();
/* After connection is ready we need to listen account's connection status changes so that we can
instantiate ContactAuthorizer again when account goes from offline (ContactAuthorizer destroyed then)
state to online state: */
......@@ -133,7 +133,7 @@ void ContactAuthorizationListener::slotConnectionReady(const Tp::ConnectionPtr&
connect(authorizer, SIGNAL(destroyed(QObject*)), this, SLOT(slotRemoveAuthorizer(QObject*)));
m_authorizers.insert(account->uniqueIdentifier(), authorizer);
if(parent()) {
if (parent()) {
connect(parent(), SIGNAL(showAuthorizationDialog(QString, QString, QString,
QString, QString, QString)),
authorizer, SLOT(slotShowAuthorizationDialog(QString, QString, QString,
......@@ -148,7 +148,7 @@ void ContactAuthorizationListener::slotConnectionReady(const Tp::ConnectionPtr&
void ContactAuthorizationListener::slotRemoveAuthorizer(QObject *removedAuthorizer)
{
DEBUG() << Q_FUNC_INFO;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;
if (removedAuthorizer) {
QMutableMapIterator<QString,ContactAuthorizer*> i(m_authorizers);
......@@ -163,21 +163,21 @@ void ContactAuthorizationListener::slotRemoveAuthorizer(QObject *removedAuthoriz
void ContactAuthorizationListener::slotAccountConnectionStatusChanged(Tp::ConnectionStatus connectionStatus)
{
DEBUG() << Q_FUNC_INFO;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;
Tp::Account *account = qobject_cast<Tp::Account *>(sender());
if(account != 0 && account->isValid()) {
if (account != 0 && account->isValid()) {
if (connectionStatus == Tp::ConnectionStatusConnected) {
if (!m_authorizers.contains(account->uniqueIdentifier())) {
DEBUG() << Q_FUNC_INFO << "Connection status changed to Connected";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Connection status changed to Connected";
Tp::ConnectionPtr connection = account->connection();
if (!connection.isNull() && connection->isValid()) {
if (connection->isReady()) {
DEBUG() << Q_FUNC_INFO << "Connection is ready";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Connection is ready";
slotConnectionReady(connection);
} else {
DEBUG() << Q_FUNC_INFO << "Asking connection to become ready";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Asking connection to become ready";
connect(connection->becomeReady(Tp::Connection::FeatureSimplePresence),
SIGNAL(finished(Tp::PendingOperation*)),
m_pConnectionUtils,
......@@ -185,14 +185,14 @@ void ContactAuthorizationListener::slotAccountConnectionStatusChanged(Tp::Connec
}
}
} else {
DEBUG() << Q_FUNC_INFO << "ContactAuthorizer for account " << account->uniqueIdentifier() << " already exists.";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "ContactAuthorizer for account " << account->uniqueIdentifier() << " already exists.";
}
} else if (connectionStatus == Tp::ConnectionStatusDisconnected) {
DEBUG() << Q_FUNC_INFO << "Connection status changed to disconnected";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Connection status changed to disconnected";
} else if (connectionStatus == Tp::ConnectionStatusConnecting) {
DEBUG() << Q_FUNC_INFO << "Connection status changed to connecting...";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Connection status changed to connecting...";
} else {
DEBUG() << Q_FUNC_INFO << "Unknown connection status!";
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Unknown connection status!";
}
}
}
......@@ -210,7 +210,7 @@ void ContactAuthorizationListener::slotShowUnableToAuthorizeDialog(const QString
Q_UNUSED(unused4)
Q_UNUSED(unused5)
DEBUG() << Q_FUNC_INFO;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;
if (m_pConnectionUtils == NULL) {
qWarning() << "ConnectionUtils is NULL.";
......@@ -224,7 +224,7 @@ void ContactAuthorizationListener::slotShowUnableToAuthorizeDialog(const QString
QVariantMap filter;
filter.insert(QLatin1String("uniqueIdentifier"), accountUniqueIdentifier);
Tp::AccountSetPtr accountSet = accountManager->filterAccounts(filter);
DEBUG() << "Finding out if account is online: " << accountUniqueIdentifier;
qCDebug(lcCommhistoryd) << "Finding out if account is online: " << accountUniqueIdentifier;
if (!accountSet->accounts().isEmpty()) {
Tp::AccountPtr account = accountSet->accounts().first();
......@@ -234,15 +234,15 @@ void ContactAuthorizationListener::slotShowUnableToAuthorizeDialog(const QString
}
if (account->connectionStatus() == Tp::ConnectionStatusConnected) {
DEBUG() << "Nothing to do here: the account is online.";
qCDebug(lcCommhistoryd) << "Nothing to do here: the account is online.";
} else {
DEBUG() << "The account is offline: cannot authorize anyway.";
qCDebug(lcCommhistoryd) << "The account is offline: cannot authorize anyway.";
showNotification = true;
accountPath = account->objectPath();
}
}
} else {
DEBUG() << "Nothing to do here: the account manager is not even ready!";
qCDebug(lcCommhistoryd) << "Nothing to do here: the account manager is not even ready!";
showNotification = true;
}
......@@ -261,7 +261,7 @@ void ContactAuthorizationListener::slotShowUnableToAuthorizeDialog(const QString
void ContactAuthorizationListener::slotAccountStateChanged(bool isEnabled)
{
DEBUG() << Q_FUNC_INFO << isEnabled;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << isEnabled;
// remove buddy authorization notifications when account is disabled
// sure we will lose them and not be able to see them when the account is
......@@ -273,7 +273,7 @@ void ContactAuthorizationListener::slotAccountStateChanged(bool isEnabled)
void ContactAuthorizationListener::slotAccountRemoved() {
// We need to remove the ongoing notifications for this account
DEBUG() << Q_FUNC_INFO;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;
Tp::Account *account = qobject_cast<Tp::Account*>(sender());
......
This diff is collapsed.
......@@ -42,16 +42,16 @@ class Request {
public:
bool operator==(const Request& other) const
{
if(contact && other.contact
if (contact && other.contact
&& !contact->handle().isEmpty() && !other.contact->handle().isEmpty()
&& contact->handle().first() == other.contact->handle().first()){
&& contact->handle().first() == other.contact->handle().first()) {
return true;
} else {
return false;
}
}
Request& operator=(const Request& other){
Request& operator=(const Request& other) {
if (this != &other) {
notificationId = other.notificationId;
contact = other.contact;
......@@ -62,7 +62,7 @@ public:
return *this;
}
bool isValid(){return !contact.isNull();}
bool isValid() {return !contact.isNull();}
QString notificationId;
Tp::ContactPtr contact;
......
......@@ -24,7 +24,8 @@
#define DEBUG_H
#include <QDebug>
#include <QLoggingCategory>
#define DEBUG qDebug
Q_DECLARE_LOGGING_CATEGORY(lcCommhistoryd)
#endif // DEBUG_H
......@@ -29,8 +29,9 @@
#include <QDirIterator>
#include <QDBusConnection>
#include <QLoggingCategory>
#define DEBUG_(x) qDebug() << "FsCleanup:" << x
Q_LOGGING_CATEGORY(lcFsCleanup, "commhistoryd.fscleanup", QtWarningMsg)
FsCleanup::FsCleanup(QObject* aParent) :
QObject(aParent)
......@@ -47,23 +48,23 @@ void FsCleanup::onEventDeleted(int aEventId)
{
CommHistory::DatabaseIO* io = CommHistory::DatabaseIO::instance();
if (!io->eventExists(aEventId)) {
DEBUG_("Event" << aEventId << "deleted");
qCDebug(lcFsCleanup) << "FsCleanup: Event" << aEventId << "deleted";
deleteFiles(aEventId);
} else {
// Ignore deleteEvent signals emitted by EventModel::moveEvent
DEBUG_("Ignoring delete signal for" << aEventId);
qCDebug(lcFsCleanup) << "FsCleanup: Ignoring delete signal for" << aEventId;
}
}
void FsCleanup::onGroupsDeleted(QList<int> aGroupIds)
{
DEBUG_(aGroupIds.count() << "group(s) deleted");
qCDebug(lcFsCleanup) << "FsCleanup:" << aGroupIds.count() << "group(s) deleted";
fullCleanup();
}
void FsCleanup::fullCleanup()
{
DEBUG_("Running full cleanup");
qCDebug(lcFsCleanup) << "FsCleanup: Running full cleanup";
CommHistory::DatabaseIO* io = CommHistory::DatabaseIO::instance();
QDirIterator it(CommHistoryDatabasePath::dataDir(),
QDir::Dirs | QDir::NoDotAndDotDot);
......@@ -75,7 +76,7 @@ void FsCleanup::fullCleanup()
deleteFiles(id);
}
}
DEBUG_("Cleanup done");
qCDebug(lcFsCleanup) << "FsCleanup: Cleanup done";
}
void FsCleanup::deleteFiles(int aEventId)
......@@ -88,7 +89,7 @@ bool FsCleanup::removeDir(QString aDirPath)
bool result = true;
QDir dir(aDirPath);
if (dir.exists()) {
DEBUG_("Removing" << aDirPath);
qCDebug(lcFsCleanup) << "FsCleanup: Removing" << aDirPath;
QFileInfoList list = dir.entryInfoList(QDir::NoDotAndDotDot |
QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files,
QDir::DirsFirst);
......@@ -101,13 +102,13 @@ bool FsCleanup::removeDir(QString aDirPath)
result = QFile::remove(path);
}
if (!result) {
qWarning() << "Failed to remove" << path;
qWarning() << "FsCleanup: Failed to remove" << path;
return result;
}
}
result = dir.rmdir(aDirPath);
if (!result) {
qWarning() << "Failed to remove" << aDirPath;
qWarning() << "FsCleanup: Failed to remove" << aDirPath;
}
}
return result;
......
......@@ -82,7 +82,7 @@ void LastDialedCache::writeLastDialed(const QString &number)
return;
}
DEBUG() << "Writing last dialed number to file:" << number;
qCDebug(lcCommhistoryd) << "Writing last dialed number to file:" << number;
file.write(number.toLatin1());
if (!file.commit())
qWarning() << "Writing last dialed cache failed:" << file.errorString();
......@@ -90,7 +90,7 @@ void LastDialedCache::writeLastDialed(const QString &number)
void LastDialedCache::removeLastDialed()
{
DEBUG() << "Removing last dialed number file";
qCDebug(lcCommhistoryd) << "Removing last dialed number file";
QFile::remove(filePath);
}
......@@ -60,8 +60,8 @@ Logger::Logger(const Tp::AccountManagerPtr &accountManager,
AbstractClientPtr::dynamicCast(SharedPtr<LoggerClientObserver>(observer)),
COMMHISTORY_CHANNEL_OBSERVER);
if(registered) {
DEBUG() << "commhistoryd: started";
if (registered) {
qCDebug(lcCommhistoryd) << "commhistoryd: started";
} else {
qCritical() << "commhistoryd: observer registration failed";
}
......@@ -76,7 +76,7 @@ void Logger::createChannelListener(const QString &channelType,
const Tp::AccountPtr &account,
const Tp::ChannelPtr &channel)
{