Skip to content

Commit

Permalink
Fix some code style inconsitencies
Browse files Browse the repository at this point in the history
  • Loading branch information
pvuorela committed Mar 26, 2021
1 parent 201aaa7 commit f5ad02f
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 74 deletions.
2 changes: 1 addition & 1 deletion src/accountpresenceservice.cpp
Expand Up @@ -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 {
Expand Down
16 changes: 8 additions & 8 deletions src/channellistener.cpp
Expand Up @@ -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;
}
Expand All @@ -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();
Expand All @@ -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;
Expand Down Expand Up @@ -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();
}
}
Expand All @@ -146,7 +146,7 @@ void ChannelListener::invocationContextError()

CommHistory::EventModel& ChannelListener::eventModel()
{
if(!m_pEventModel){
if (!m_pEventModel) {
m_pEventModel = new CommHistory::EventModel(this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/commhistoryservice.cpp
Expand Up @@ -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 {
Expand Down
18 changes: 9 additions & 9 deletions src/connectionutils.cpp
Expand Up @@ -57,7 +57,7 @@ void ConnectionUtils::prepareAccounts()
{
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 &)),
Expand All @@ -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 *)),
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -136,7 +136,7 @@ void ConnectionUtils::prepareConnection(const Tp::AccountPtr &account)

Tp::ConnectionPtr connection = account->connection();

if(!connection.isNull()) {
if (!connection.isNull()) {
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Connection object exists";
connect(connection->becomeReady(Tp::Connection::FeatureSimplePresence),
SIGNAL(finished(Tp::PendingOperation*)),
Expand All @@ -154,8 +154,8 @@ void ConnectionUtils::slotConnectionChanged(const Tp::ConnectionPtr &connection)

Tp::Account *account = qobject_cast<Tp::Account *>(sender());

if(account != 0 && account->isValid()) {
if(!connection.isNull()) {
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*)),
Expand All @@ -168,9 +168,9 @@ void ConnectionUtils::slotConnectionReady(Tp::PendingOperation* operation)
{
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()) {
Expand Down
12 changes: 6 additions & 6 deletions src/contactauthorizationlistener.cpp
Expand Up @@ -75,13 +75,13 @@ void ContactAuthorizationListener::slotConnectionReady(const Tp::ConnectionPtr&
{
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;

if(!connection)
if (!connection)
return;

Tp::AccountPtr account;
Tp::AccountManagerPtr accountManager = m_pConnectionUtils->accountManager();

if(accountManager && accountManager->isReady()) {
if (accountManager && accountManager->isReady()) {
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Connection object path: " << connection->objectPath();
#if 1
foreach (Tp::AccountPtr a, accountManager->validAccounts()->accounts()) {
Expand All @@ -96,13 +96,13 @@ 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))
{
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -167,7 +167,7 @@ void ContactAuthorizationListener::slotAccountConnectionStatusChanged(Tp::Connec

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())) {
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Connection status changed to Connected";
Expand Down
52 changes: 26 additions & 26 deletions src/contactauthorizer.cpp
Expand Up @@ -69,7 +69,7 @@ ContactAuthorizer::ContactAuthorizer(const Tp::ConnectionPtr& connection,

if (connection->status() == Tp::ConnectionStatusConnected) {
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Account's' connection status is CONNECTED!";
if(connection->isReady(Tp::Connection::FeatureRoster)) {
if (connection->isReady(Tp::Connection::FeatureRoster)) {
listenToAuthorization(connection);
} else {
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Asking FeatureRoster to be downloaded...";
Expand Down Expand Up @@ -106,7 +106,7 @@ void ContactAuthorizer::slotConnectionFeaturesReady(Tp::PendingOperation* op)
{
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;

if(op && !op->isError() && !m_connection.isNull() && m_connection->isReady())
if (op && !op->isError() && !m_connection.isNull() && m_connection->isReady())
listenToAuthorization(m_connection);
}

Expand All @@ -116,7 +116,7 @@ void ContactAuthorizer::listenToAuthorization(const Tp::ConnectionPtr& connectio

m_pContactManager = connection->contactManager();

if(m_pContactManager){
if (m_pContactManager) {
// Connect to listen invitation requests:
connect(m_pContactManager.data(),
SIGNAL(presencePublicationRequested(const Tp::Contacts)),
Expand Down Expand Up @@ -171,9 +171,9 @@ void ContactAuthorizer::slotPresencePublicationRequested(const Tp::Contacts &con
qDeleteAll(notifications);
notifications.clear();

if(!pendingContacts.isEmpty()){
if(m_pContactManager
&& m_pContactManager->supportedFeatures().contains(Tp::Contact::FeatureAvatarData)){
if (!pendingContacts.isEmpty()) {
if (m_pContactManager
&& m_pContactManager->supportedFeatures().contains(Tp::Contact::FeatureAvatarData)) {
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Adding auth. requests to pending queue to wait for avatar";
upgradeContacts(pendingContacts);
queueAuthorization(pendingContacts, m_authRequestWaitingForAvatar);
Expand Down Expand Up @@ -228,16 +228,16 @@ void ContactAuthorizer::queueAuthorization(const Tp::Contacts contacts,
{
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;

if(contacts.count() == 0)
if (contacts.count() == 0)
return;

QSet<Tp::ContactPtr>::const_iterator i;
for (i = contacts.constBegin(); i != contacts.constEnd(); ++i){
for (i = contacts.constBegin(); i != contacts.constEnd(); ++i) {
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Queuing request";
Request request;
request.contact = *i;
request.message = request.contact->publishStateMessage();
if(!requestQueue.contains(request)){
if (!requestQueue.contains(request)) {
requestQueue.append(request);
}
}
Expand All @@ -251,7 +251,7 @@ void ContactAuthorizer::queueAuthorization(const Tp::ContactPtr& contact,
Request tmpRequest;
tmpRequest.contact = contact;

if(m_authRequestWaitingForAvatar.contains(tmpRequest)) {
if (m_authRequestWaitingForAvatar.contains(tmpRequest)) {
// If this is a request that didn't already get an avatar, let's put it the list of
// the pending requests and fire it.
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "adding request to pending requests queue to wait for an avatar";
Expand All @@ -260,20 +260,20 @@ void ContactAuthorizer::queueAuthorization(const Tp::ContactPtr& contact,
(m_authRequestWaitingForAvatar.indexOf(tmpRequest));
r.filename = avatarFile;

if(!m_authRequests.contains(r)) {
if (!m_authRequests.contains(r)) {
m_authRequests.append(r);
m_authRequestWaitingForAvatar.removeOne(r);
fireAuthorisationRequest();
}
} else if(m_authRequests.contains(tmpRequest)) {
} else if (m_authRequests.contains(tmpRequest)) {
// This is a pending request that already got an avatar (someway or another) but has
// not been published yet. Let's simply update it.
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "pending request already having avatar, not published yet, updating avatar to it";
int index = m_authRequests.indexOf(tmpRequest);
Request r = m_authRequests.value(index);
r.filename = avatarFile;
m_authRequests.replace(index,r);
} else if(m_publishedAuthRequests.contains(tmpRequest)) {
} else if (m_publishedAuthRequests.contains(tmpRequest)) {
// This is a request that was already published. Let's change the avatar, update the
// and hope the notification and hope the user hasn't tapped it yet :)
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Already published request, but did not contain avatar.";
Expand Down Expand Up @@ -409,7 +409,7 @@ void ContactAuthorizer::fireAuthorisationRequest()
{
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;

if(!m_connection)
if (!m_connection)
return;

foreach(Request request, m_authRequests) {
Expand All @@ -418,7 +418,7 @@ void ContactAuthorizer::fireAuthorisationRequest()
QString message;
QString transactionId;

if(!request.contact->id().isEmpty()){
if (!request.contact->id().isEmpty()) {
id = request.contact->id();
filename = request.filename;
message = request.message;
Expand Down Expand Up @@ -453,7 +453,7 @@ void ContactAuthorizer::fireAuthorisationRequest()

qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Notification published with notification id: " << request.notificationId;
m_authRequests.removeOne(request);
if(!m_publishedAuthRequests.contains(request)){
if (!m_publishedAuthRequests.contains(request)) {
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Appending request to published auth requests queue";
m_publishedAuthRequests.append(request);
}
Expand All @@ -472,7 +472,7 @@ void ContactAuthorizer::slotShowAuthorizationDialog(const QString& contactId,
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Authorization dialog asked to be shown for account: " << accountPath << " requester being contact id: " << contactId;
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "Contact's avatar filename: " << filename;

if(m_account && m_account->objectPath() != accountPath) {
if (m_account && m_account->objectPath() != accountPath) {
qCDebug(lcCommhistoryd) << Q_FUNC_INFO << "This ContactsAuthorizer does not serve the given account, but " << m_account->objectPath();
return;
}
Expand All @@ -487,12 +487,12 @@ void ContactAuthorizer::slotShowAuthorizationDialog(const QString& contactId,
foreach(Request request, m_publishedAuthRequests) {
// Remove requests that don't have a valid contact associated with them.
// Why should it happen in the first place, by the way?
if(request.contact->id().isEmpty()) {
if (request.contact->id().isEmpty()) {
m_publishedAuthRequests.removeOne(request);
continue;
}

if(request.contact->id() == contactId) {
if (request.contact->id() == contactId) {
// We found a request amongst the ones we were keeping track of, i.e. one that was
// generating during the same session (not before a reboot).
// This means we can start the UI right away.
Expand All @@ -509,7 +509,7 @@ void ContactAuthorizer::slotShowAuthorizationDialog(const QString& contactId,
// If we couldn't find a request, it means that the user has tapped on an authorization
// request that was issued before a reboot, so we have to create the request again and
// find the contact.
if(!requestFound && m_pContactManager) {
if (!requestFound && m_pContactManager) {
Request req;
Tp::PendingContacts *pendingContacts;
QVariant reqVariant;
Expand All @@ -533,7 +533,7 @@ void ContactAuthorizer::slotDialogDismissed(const QString& dialogId, int result)
{
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;

if(m_ongoingRequest.isValid() && m_ongoingRequest.transactionId == dialogId) {
if (m_ongoingRequest.isValid() && m_ongoingRequest.transactionId == dialogId) {
QDBusConnection::sessionBus().disconnect(BUDDY_AUTHORIZER_SERVICE_NAME,
OBJECT_PATH,
BUDDY_AUTHORIZER_INTERFACE_NAME,
Expand Down Expand Up @@ -592,7 +592,7 @@ void ContactAuthorizer::slotAuthoriserQueryFinished(QDBusPendingCallWatcher* wat
{
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;

if(m_ongoingRequest.isValid() && watcher){
if (m_ongoingRequest.isValid() && watcher) {

QDBusPendingReply<> reply = *watcher;

Expand All @@ -602,7 +602,7 @@ void ContactAuthorizer::slotAuthoriserQueryFinished(QDBusPendingCallWatcher* wat
Request empty;
m_ongoingRequest = empty;
m_requestTapped = false;
} else if(reply.isFinished()){
} else if (reply.isFinished()) {
QDBusConnection::sessionBus().connect(BUDDY_AUTHORIZER_SERVICE_NAME,
OBJECT_PATH,
BUDDY_AUTHORIZER_INTERFACE_NAME,
Expand All @@ -620,7 +620,7 @@ void ContactAuthorizer::authorizeContact(const Tp::ContactPtr& contact)
{
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;

if(m_pContactManager && contact) {
if (m_pContactManager && contact) {
Tp::PendingOperation* po = m_pContactManager->authorizePresencePublication(
QList<Tp::ContactPtr>() << contact);
connect(po, SIGNAL(finished(Tp::PendingOperation*)),
Expand All @@ -645,7 +645,7 @@ void ContactAuthorizer::blockContact(const Tp::ContactPtr& contact)
{
qCDebug(lcCommhistoryd) << Q_FUNC_INFO;

if(m_pContactManager && contact) {
if (m_pContactManager && contact) {
Tp::PendingOperation *po = m_pContactManager->blockContacts
(QList<Tp::ContactPtr>() << contact);
connect(po, SIGNAL(finished(Tp::PendingOperation*)),
Expand Down Expand Up @@ -699,7 +699,7 @@ void ContactAuthorizer::slotConnectionInvalidated(Tp::DBusProxy*,
deleteLater();

// close ui if it is open
if(m_ongoingRequest.isValid()){
if (m_ongoingRequest.isValid()) {
QDBusInterface interface(BUDDY_AUTHORIZER_APP_NAME,
OBJECT_PATH,
BUDDY_AUTHORIZER_APP_IF);
Expand Down

0 comments on commit f5ad02f

Please sign in to comment.