diff --git a/interfaces/conversationmessage.h b/interfaces/conversationmessage.h --- a/interfaces/conversationmessage.h +++ b/interfaces/conversationmessage.h @@ -42,8 +42,7 @@ public: // TYPE field values from Android - enum Types - { + enum Types { MessageTypeAll = 0, MessageTypeInbox = 1, MessageTypeSent = 2, diff --git a/interfaces/conversationmessage.cpp b/interfaces/conversationmessage.cpp --- a/interfaces/conversationmessage.cpp +++ b/interfaces/conversationmessage.cpp @@ -33,7 +33,7 @@ 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 @@ , m_threadID(threadID) , m_uID(uID) { - } ConversationMessage::ConversationMessage(const ConversationMessage& other, QObject* parent) @@ -62,7 +61,6 @@ , m_threadID(other.m_threadID) , m_uID(other.m_uID) { - } ConversationMessage::~ConversationMessage() { } diff --git a/plugins/sms/conversationsdbusinterface.h b/plugins/sms/conversationsdbusinterface.h --- a/plugins/sms/conversationsdbusinterface.h +++ b/plugins/sms/conversationsdbusinterface.h @@ -1,5 +1,6 @@ /** * Copyright 2013 Albert Vaca + * Copyright 2018 Simon Redman * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/plugins/sms/conversationsdbusinterface.cpp b/plugins/sms/conversationsdbusinterface.cpp --- a/plugins/sms/conversationsdbusinterface.cpp +++ b/plugins/sms/conversationsdbusinterface.cpp @@ -52,8 +52,7 @@ { 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 @@ // 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 @@ { 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 @@ 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::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; diff --git a/plugins/sms/smsplugin.h b/plugins/sms/smsplugin.h --- a/plugins/sms/smsplugin.h +++ b/plugins/sms/smsplugin.h @@ -1,5 +1,6 @@ /** * Copyright 2013 Albert Vaca + * Copyright 2018 Simon Redman * * 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 @@ */ bool handleBatchMessages(const NetworkPacket& np); - QDBusInterface m_telepathyInterface; ConversationsDbusInterface* m_conversationInterface; diff --git a/plugins/sms/smsplugin.cpp b/plugins/sms/smsplugin.cpp --- a/plugins/sms/smsplugin.cpp +++ b/plugins/sms/smsplugin.cpp @@ -1,5 +1,6 @@ /** * Copyright 2013 Albert Vaca + * Copyright 2018 Simon Redman * * 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 @@ { const auto messages = np.get("messages"); - for (const QVariant& body : messages) - { + for (const QVariant& body : messages) { ConversationMessage message(body.toMap()); forwardToTelepathy(message); m_conversationInterface->addMessage(message); diff --git a/plugins/telephony/telephonyplugin.cpp b/plugins/telephony/telephonyplugin.cpp --- a/plugins/telephony/telephonyplugin.cpp +++ b/plugins/telephony/telephonyplugin.cpp @@ -107,10 +107,8 @@ const QString& event = np.get(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); diff --git a/smsapp/conversationlistmodel.h b/smsapp/conversationlistmodel.h --- a/smsapp/conversationlistmodel.h +++ b/smsapp/conversationlistmodel.h @@ -2,6 +2,7 @@ * This file is part of KDE Telepathy Chat * * Copyright (C) 2018 Aleix Pol Gonzalez + * Copyright (C) 2018 Simon Redman * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/smsapp/conversationlistmodel.cpp b/smsapp/conversationlistmodel.cpp --- a/smsapp/conversationlistmodel.cpp +++ b/smsapp/conversationlistmodel.cpp @@ -2,6 +2,7 @@ * This file is part of KDE Telepathy Chat * * Copyright (C) 2018 Aleix Pol Gonzalez + * Copyright (C) 2018 Simon Redman * * 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 @@ 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 @@ toadd = true; item = new QStandardItem(); QScopedPointer 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 @@ 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; } diff --git a/smsapp/conversationmodel.h b/smsapp/conversationmodel.h --- a/smsapp/conversationmodel.h +++ b/smsapp/conversationmodel.h @@ -2,6 +2,7 @@ * This file is part of KDE Telepathy Chat * * Copyright (C) 2018 Aleix Pol Gonzalez + * Copyright (C) 2018 Simon Redman * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/smsapp/main.cpp b/smsapp/main.cpp --- a/smsapp/main.cpp +++ b/smsapp/main.cpp @@ -1,7 +1,8 @@ /* * This file is part of KDE Telepathy Chat * - * Copyright (C) 2015 Aleix Pol Gonzalez + * Copyright (C) 2018 Aleix Pol Gonzalez + * Copyright (C) 2018 Simon Redman * * 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 @@ 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); {