Commit 563dde98 authored by Simon Redman's avatar Simon Redman

Correct braces and add contributors

Summary: Braces to start a method are on a newline, braces to begin an in-method block are on the same line

Test Plan: Pure source code cosmetic changes. Hopefully no functionality has changed!

Reviewers: #kde_connect, nicolasfella

Reviewed By: #kde_connect, nicolasfella

Subscribers: apol, nicolasfella, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D15978
parent d3147586
......@@ -33,7 +33,7 @@ ConversationMessage::ConversationMessage(const QVariantMap& args, QObject* paren
m_read(args["read"].toInt()),
m_threadID(args["thread_id"].toInt()),
m_uID(args["_id"].toInt())
{
{
}
ConversationMessage::ConversationMessage (const QString& body, const QString& address, const qint64& date,
......@@ -49,7 +49,6 @@ ConversationMessage::ConversationMessage (const QString& body, const QString& ad
, m_threadID(threadID)
, m_uID(uID)
{
}
ConversationMessage::ConversationMessage(const ConversationMessage& other, QObject* parent)
......@@ -62,7 +61,6 @@ ConversationMessage::ConversationMessage(const ConversationMessage& other, QObje
, m_threadID(other.m_threadID)
, m_uID(other.m_uID)
{
}
ConversationMessage::~ConversationMessage() { }
......
......@@ -42,8 +42,7 @@ class KDECONNECTINTERFACES_EXPORT ConversationMessage
public:
// TYPE field values from Android
enum Types
{
enum Types {
MessageTypeAll = 0,
MessageTypeInbox = 1,
MessageTypeSent = 2,
......
......@@ -52,8 +52,7 @@ void ConversationsDbusInterface::requestConversation(const QString& conversation
{
const auto messagesList = m_conversations[conversationID].values();
if (messagesList.isEmpty())
{
if (messagesList.isEmpty()) {
// Since there are no messages in the conversation, it's likely that it is a junk ID, but go ahead anyway
qCWarning(KDECONNECT_CONVERSATIONS) << "Got a conversationID for a conversation with no messages!" << conversationID;
}
......@@ -64,12 +63,10 @@ void ConversationsDbusInterface::requestConversation(const QString& conversation
// messages (smallest timestamp number)
// Therefore, return the end of the list first (most recent messages)
int i = start;
for(auto it = messagesList.crbegin(); it != messagesList.crend(); ++it)
{
for(auto it = messagesList.crbegin(); it != messagesList.crend(); ++it) {
Q_EMIT conversationMessageReceived(it->toVariant(), i);
i++;
if (i >= end)
{
if (i >= end) {
break;
}
}
......@@ -79,8 +76,7 @@ void ConversationsDbusInterface::addMessage(const ConversationMessage &message)
{
const QString& threadId = QString::number(message.threadID());
if (m_known_messages[threadId].contains(message.uID()))
{
if (m_known_messages[threadId].contains(message.uID())) {
// This message has already been processed. Don't do anything.
return;
}
......@@ -91,11 +87,9 @@ void ConversationsDbusInterface::addMessage(const ConversationMessage &message)
m_known_messages[threadId].insert(message.uID());
// Tell the world about what just happened
if (newConversation)
{
if (newConversation) {
Q_EMIT conversationCreated(threadId);
} else
{
} else {
Q_EMIT conversationUpdated(message.toVariant());
}
}
......@@ -108,8 +102,7 @@ void ConversationsDbusInterface::removeMessage(const QString& internalId)
void ConversationsDbusInterface::replyToConversation(const QString& conversationID, const QString& message)
{
const auto messagesList = m_conversations[conversationID];
if (messagesList.isEmpty())
{
if (messagesList.isEmpty()) {
// Since there are no messages in the conversation, we can't do anything sensible
qCWarning(KDECONNECT_CONVERSATIONS) << "Got a conversationID for a conversation with no messages!";
return;
......
/**
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
* Copyright 2018 Simon Redman <simon@ergotech.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......
/**
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
* Copyright 2018 Simon Redman <simon@ergotech.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -99,8 +100,7 @@ bool SmsPlugin::handleBatchMessages(const NetworkPacket& np)
{
const auto messages = np.get<QVariantList>("messages");
for (const QVariant& body : messages)
{
for (const QVariant& body : messages) {
ConversationMessage message(body.toMap());
forwardToTelepathy(message);
m_conversationInterface->addMessage(message);
......
/**
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
* Copyright 2018 Simon Redman <simon@ergotech.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -123,7 +124,6 @@ private:
*/
bool handleBatchMessages(const NetworkPacket& np);
QDBusInterface m_telepathyInterface;
ConversationsDbusInterface* m_conversationInterface;
......
......@@ -107,10 +107,8 @@ bool TelephonyPlugin::receivePacket(const NetworkPacket& np)
const QString& event = np.get<QString>(QStringLiteral("event"), QStringLiteral("unknown"));
// Handle old-style packets
if (np.type() == PACKET_TYPE_TELEPHONY)
{
if (event == QLatin1String("sms"))
{
if (np.type() == PACKET_TYPE_TELEPHONY) {
if (event == QLatin1String("sms")) {
return false;
}
KNotification* n = createNotification(np);
......
......@@ -2,6 +2,7 @@
* This file is part of KDE Telepathy Chat
*
* Copyright (C) 2018 Aleix Pol Gonzalez <aleixpol@kde.org>
* Copyright (C) 2018 Simon Redman <simon@ergotech.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -104,8 +105,7 @@ void ConversationListModel::createRowFromMessage(const QVariantMap& msg, int row
return;
const ConversationMessage message(msg);
if (message.type() == -1)
{
if (message.type() == -1) {
// The Android side currently hacks in -1 if something weird comes up
// TODO: Remove this hack when MMS support is implemented
return;
......@@ -117,14 +117,11 @@ void ConversationListModel::createRowFromMessage(const QVariantMap& msg, int row
toadd = true;
item = new QStandardItem();
QScopedPointer<KPeople::PersonData> personData(lookupPersonByAddress(message.address()));
if (personData)
{
if (personData) {
item->setText(personData->name());
item->setIcon(QIcon(personData->photo()));
item->setData(personData->personUri(), PersonUriRole);
}
else
{
} else {
item->setData(QString(), PersonUriRole);
item->setText(message.address());
}
......@@ -142,16 +139,14 @@ void ConversationListModel::createRowFromMessage(const QVariantMap& msg, int row
KPeople::PersonData* ConversationListModel::lookupPersonByAddress(const QString& address)
{
int rowIndex = 0;
for (rowIndex = 0; rowIndex < m_people.rowCount(); rowIndex++)
{
for (rowIndex = 0; rowIndex < m_people.rowCount(); rowIndex++) {
const QString& uri = m_people.get(rowIndex, KPeople::PersonsModel::PersonUriRole).toString();
KPeople::PersonData* person = new KPeople::PersonData(uri);
const QString& email = person->email();
const QString& phoneNumber = canonicalizePhoneNumber(person->contactCustomProperty("phoneNumber").toString());
if (address == email || canonicalizePhoneNumber(address) == phoneNumber)
{
if (address == email || canonicalizePhoneNumber(address) == phoneNumber) {
qCDebug(KDECONNECT_SMS_CONVERSATIONS_LIST_MODEL) << "Matched" << address << "to" << person->name();
return person;
}
......
......@@ -2,6 +2,7 @@
* This file is part of KDE Telepathy Chat
*
* Copyright (C) 2018 Aleix Pol Gonzalez <aleixpol@kde.org>
* Copyright (C) 2018 Simon Redman <simon@ergotech.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
......@@ -2,6 +2,7 @@
* This file is part of KDE Telepathy Chat
*
* Copyright (C) 2018 Aleix Pol Gonzalez <aleixpol@kde.org>
* Copyright (C) 2018 Simon Redman <simon@ergotech.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/*
* This file is part of KDE Telepathy Chat
*
* Copyright (C) 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
* Copyright (C) 2018 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
* Copyright (C) 2018 Simon Redman <simon@ergotech.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -37,6 +38,8 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
KAboutData aboutData("org.kde.kdeconnect.sms", i18n("SMS Instant Messaging"), QStringLiteral(KDECONNECT_VERSION_STRING), i18n("KDE Connect SMS"), KAboutLicense::GPL, i18n("(c) 2018, Aleix Pol Gonzalez"));
aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), {}, "aleixpol@kde.org");
aboutData.addAuthor(i18n("Nicolas Fella"), {}, "nicolas.fella@gmx.de");
aboutData.addAuthor(i18n("Simon Redman"), {}, "simon@ergotech.com");
KAboutData::setApplicationData(aboutData);
{
......
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