Commit b5615e12 authored by Laurent Montel's avatar Laurent Montel 😁

Fix coding style

parent bc6d4170
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
using namespace KAddressBookGrantlee; using namespace KAddressBookGrantlee;
ContactGrantleeAddressObject::ContactGrantleeAddressObject(const KContacts::Address &address, QObject *parent) ContactGrantleeAddressObject::ContactGrantleeAddressObject(const KContacts::Address &address, QObject *parent)
: QObject(parent), : QObject(parent)
mAddress(address) , mAddress(address)
{ {
} }
......
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
#define CONTACTGRANTLEEPRINTADDRESSOBJECT_H #define CONTACTGRANTLEEPRINTADDRESSOBJECT_H
#include <QObject> #include <QObject>
#include <KContacts/Addressee> #include <KContacts/Addressee>
namespace KAddressBookGrantlee namespace KAddressBookGrantlee {
{
class ContactGrantleeAddressObject : public QObject class ContactGrantleeAddressObject : public QObject
{ {
Q_OBJECT Q_OBJECT
......
...@@ -27,14 +27,13 @@ inline QString loadCustom(const KContacts::Addressee &contact, const QString &ke ...@@ -27,14 +27,13 @@ inline QString loadCustom(const KContacts::Addressee &contact, const QString &ke
} }
ContactGrantleeCryptoObject::ContactGrantleeCryptoObject(const KContacts::Addressee &address, QObject *parent) ContactGrantleeCryptoObject::ContactGrantleeCryptoObject(const KContacts::Addressee &address, QObject *parent)
: QObject(parent), : QObject(parent)
mAddress(address) , mAddress(address)
{ {
} }
ContactGrantleeCryptoObject::~ContactGrantleeCryptoObject() ContactGrantleeCryptoObject::~ContactGrantleeCryptoObject()
{ {
} }
QString ContactGrantleeCryptoObject::signaturePreference() const QString ContactGrantleeCryptoObject::signaturePreference() const
......
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
#define CONTACTGRANTLEEPRINTCRYPTOOBJECT_H #define CONTACTGRANTLEEPRINTCRYPTOOBJECT_H
#include <QObject> #include <QObject>
#include <KContacts/Addressee> #include <KContacts/Addressee>
namespace KAddressBookGrantlee namespace KAddressBookGrantlee {
{
class ContactGrantleeCryptoObject : public QObject class ContactGrantleeCryptoObject : public QObject
{ {
Q_OBJECT Q_OBJECT
......
...@@ -21,16 +21,14 @@ ...@@ -21,16 +21,14 @@
using namespace KAddressBookGrantlee; using namespace KAddressBookGrantlee;
ContactGrantleeEmail::ContactGrantleeEmail(const KContacts::Addressee &addressee, const KContacts::Email &email, QObject *parent) ContactGrantleeEmail::ContactGrantleeEmail(const KContacts::Addressee &addressee, const KContacts::Email &email, QObject *parent)
: QObject(parent), : QObject(parent)
mEmail(email), , mEmail(email)
mAddressee(addressee) , mAddressee(addressee)
{ {
} }
ContactGrantleeEmail::~ContactGrantleeEmail() ContactGrantleeEmail::~ContactGrantleeEmail()
{ {
} }
QString ContactGrantleeEmail::email() const QString ContactGrantleeEmail::email() const
......
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
#include <KContacts/Addressee> #include <KContacts/Addressee>
#include <KContacts/Email> #include <KContacts/Email>
namespace KAddressBookGrantlee namespace KAddressBookGrantlee {
{
class ContactGrantleeEmail : public QObject class ContactGrantleeEmail : public QObject
{ {
Q_OBJECT Q_OBJECT
......
...@@ -22,15 +22,13 @@ ...@@ -22,15 +22,13 @@
using namespace KAddressBookGrantlee; using namespace KAddressBookGrantlee;
ContactGrantleeGeoObject::ContactGrantleeGeoObject(const KContacts::Geo &geo, QObject *parent) ContactGrantleeGeoObject::ContactGrantleeGeoObject(const KContacts::Geo &geo, QObject *parent)
: QObject(parent), : QObject(parent)
mGeo(geo) , mGeo(geo)
{ {
} }
ContactGrantleeGeoObject::~ContactGrantleeGeoObject() ContactGrantleeGeoObject::~ContactGrantleeGeoObject()
{ {
} }
float ContactGrantleeGeoObject::latitude() const float ContactGrantleeGeoObject::latitude() const
......
...@@ -23,9 +23,7 @@ ...@@ -23,9 +23,7 @@
#include <QObject> #include <QObject>
#include <kcontacts/geo.h> #include <kcontacts/geo.h>
namespace KAddressBookGrantlee namespace KAddressBookGrantlee {
{
class ContactGrantleeGeoObject : public QObject class ContactGrantleeGeoObject : public QObject
{ {
Q_OBJECT Q_OBJECT
......
...@@ -22,15 +22,14 @@ ...@@ -22,15 +22,14 @@
using namespace KAddressBookGrantlee; using namespace KAddressBookGrantlee;
ContactGrantleeImObject::ContactGrantleeImObject(const QString &type, const QString &address, QObject *parent) ContactGrantleeImObject::ContactGrantleeImObject(const QString &type, const QString &address, QObject *parent)
: QObject(parent), : QObject(parent)
mType(type), , mType(type)
mAddress(address) , mAddress(address)
{ {
} }
ContactGrantleeImObject::~ContactGrantleeImObject() ContactGrantleeImObject::~ContactGrantleeImObject()
{ {
} }
QString ContactGrantleeImObject::type() const QString ContactGrantleeImObject::type() const
......
...@@ -20,8 +20,7 @@ ...@@ -20,8 +20,7 @@
#ifndef CONTACTGRANTLEEPRINTIMOBJECT_H #ifndef CONTACTGRANTLEEPRINTIMOBJECT_H
#define CONTACTGRANTLEEPRINTIMOBJECT_H #define CONTACTGRANTLEEPRINTIMOBJECT_H
#include <QObject> #include <QObject>
namespace KAddressBookGrantlee namespace KAddressBookGrantlee {
{
class ContactGrantleeImObject : public QObject class ContactGrantleeImObject : public QObject
{ {
Q_OBJECT Q_OBJECT
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
using namespace KAddressBookGrantlee; using namespace KAddressBookGrantlee;
ContactGrantleePhoneObject::ContactGrantleePhoneObject(const KContacts::PhoneNumber &phone, QObject *parent) ContactGrantleePhoneObject::ContactGrantleePhoneObject(const KContacts::PhoneNumber &phone, QObject *parent)
: QObject(parent), : QObject(parent)
mPhoneNumber(phone) , mPhoneNumber(phone)
{ {
} }
...@@ -42,5 +42,5 @@ QString ContactGrantleePhoneObject::number() const ...@@ -42,5 +42,5 @@ QString ContactGrantleePhoneObject::number() const
bool ContactGrantleePhoneObject::preferred() const bool ContactGrantleePhoneObject::preferred() const
{ {
return (mPhoneNumber.type() & KContacts::PhoneNumber::Pref); return mPhoneNumber.type() & KContacts::PhoneNumber::Pref;
} }
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
#define CONTACTGRANTLEEPRINTPHONEOBJECT_H #define CONTACTGRANTLEEPRINTPHONEOBJECT_H
#include <QObject> #include <QObject>
#include <KContacts/PhoneNumber> #include <KContacts/PhoneNumber>
namespace KAddressBookGrantlee namespace KAddressBookGrantlee {
{
class ContactGrantleePhoneObject : public QObject class ContactGrantleePhoneObject : public QObject
{ {
Q_OBJECT Q_OBJECT
......
...@@ -23,15 +23,13 @@ ...@@ -23,15 +23,13 @@
using namespace KAddressBookGrantlee; using namespace KAddressBookGrantlee;
ContactGrantleeWebSite::ContactGrantleeWebSite(const KContacts::ResourceLocatorUrl &resourceLocator, QObject *parent) ContactGrantleeWebSite::ContactGrantleeWebSite(const KContacts::ResourceLocatorUrl &resourceLocator, QObject *parent)
: QObject(parent), : QObject(parent)
mResourceLocator(resourceLocator) , mResourceLocator(resourceLocator)
{ {
} }
ContactGrantleeWebSite::~ContactGrantleeWebSite() ContactGrantleeWebSite::~ContactGrantleeWebSite()
{ {
} }
QString ContactGrantleeWebSite::url() const QString ContactGrantleeWebSite::url() const
......
...@@ -22,8 +22,7 @@ ...@@ -22,8 +22,7 @@
#include <QObject> #include <QObject>
#include <KContacts/ResourceLocatorUrl> #include <KContacts/ResourceLocatorUrl>
namespace KAddressBookGrantlee namespace KAddressBookGrantlee {
{
class ContactGrantleeWebSite : public QObject class ContactGrantleeWebSite : public QObject
{ {
Q_OBJECT Q_OBJECT
......
...@@ -56,8 +56,8 @@ class Q_DECL_HIDDEN GrantleeContactFormatter::Private ...@@ -56,8 +56,8 @@ class Q_DECL_HIDDEN GrantleeContactFormatter::Private
{ {
public: public:
Private() Private()
: forceDisableQRCode(false), : forceDisableQRCode(false)
showQRCode(true) , showQRCode(true)
{ {
KConfig config(QStringLiteral("akonadi_contactrc")); KConfig config(QStringLiteral("akonadi_contactrc"));
KConfigGroup group(&config, QStringLiteral("View")); KConfigGroup group(&config, QStringLiteral("View"));
...@@ -152,15 +152,15 @@ static QVariantHash phoneNumberHash(const KContacts::PhoneNumber &phoneNumber, i ...@@ -152,15 +152,15 @@ static QVariantHash phoneNumberHash(const KContacts::PhoneNumber &phoneNumber, i
setHashField(numberObject, QStringLiteral("number"), phoneNumber.number()); setHashField(numberObject, QStringLiteral("number"), phoneNumber.number());
if (!phoneNumber.isEmpty()) { if (!phoneNumber.isEmpty()) {
const QString url = const QString url
QStringLiteral("<a href=\"phone:?index=%1\">%2</a>"). = QStringLiteral("<a href=\"phone:?index=%1\">%2</a>").
arg(counter). arg(counter).
arg(phoneNumber.number()); arg(phoneNumber.number());
numberObject.insert(QStringLiteral("numberLink"), url); numberObject.insert(QStringLiteral("numberLink"), url);
if (phoneNumber.type() & KContacts::PhoneNumber::Cell) { if (phoneNumber.type() & KContacts::PhoneNumber::Cell) {
const QString url = const QString url
QStringLiteral("<a href=\"sms:?index=%1\"><img src=\"sms_icon\" align=\"top\"/></a>").arg(counter); = QStringLiteral("<a href=\"sms:?index=%1\"><img src=\"sms_icon\" align=\"top\"/></a>").arg(counter);
numberObject.insert(QStringLiteral("smsLink"), url); numberObject.insert(QStringLiteral("smsLink"), url);
} }
} }
...@@ -179,7 +179,7 @@ static QVariantHash imAddressHash(const QString &typeKey, const QString &imAddre ...@@ -179,7 +179,7 @@ static QVariantHash imAddressHash(const QString &typeKey, const QString &imAddre
setHashField(addressObject, QStringLiteral("imAddress"), imAddress); setHashField(addressObject, QStringLiteral("imAddress"), imAddress);
const QString iconUrl = QUrl::fromLocalFile(KIconLoader::global()->iconPath(IMProtocols::self()->icon(typeKey), const QString iconUrl = QUrl::fromLocalFile(KIconLoader::global()->iconPath(IMProtocols::self()->icon(typeKey),
-KIconLoader::SizeSmall)).url(); -KIconLoader::SizeSmall)).url();
const QString url = QStringLiteral("<img src=\"%1\" align=\"top\" height=\"%2\" width=\"%2\"/>").arg(iconUrl, QString::number(KIconLoader::SizeSmall)); const QString url = QStringLiteral("<img src=\"%1\" align=\"top\" height=\"%2\" width=\"%2\"/>").arg(iconUrl, QString::number(KIconLoader::SizeSmall));
addressObject.insert(QStringLiteral("imIcon"), url); addressObject.insert(QStringLiteral("imIcon"), url);
...@@ -283,14 +283,14 @@ QString GrantleeContactFormatter::toHtml(HtmlForm form) const ...@@ -283,14 +283,14 @@ QString GrantleeContactFormatter::toHtml(HtmlForm form) const
const int years = contactAge(birthday); const int years = contactAge(birthday);
contactObject.insert(QStringLiteral("age"), QString::number(years)); contactObject.insert(QStringLiteral("age"), QString::number(years));
contactObject.insert(QStringLiteral("birthdayage"), QString(formattedBirthday + contactObject.insert(QStringLiteral("birthdayage"), QString(formattedBirthday
QStringLiteral("&nbsp;&nbsp;") + +QStringLiteral("&nbsp;&nbsp;")
i18np("(One year old)", "(%1 years old)", years))); +i18np("(One year old)", "(%1 years old)", years)));
} }
const QDate anniversary = const QDate anniversary
QDate::fromString(rawContact.custom(QStringLiteral("KADDRESSBOOK"), = QDate::fromString(rawContact.custom(QStringLiteral("KADDRESSBOOK"),
QStringLiteral("X-Anniversary")), Qt::ISODate); QStringLiteral("X-Anniversary")), Qt::ISODate);
if (anniversary.isValid()) { if (anniversary.isValid()) {
contactObject.insert(QStringLiteral("anniversary"), contactObject.insert(QStringLiteral("anniversary"),
QLocale().toString(anniversary)); QLocale().toString(anniversary));
...@@ -342,8 +342,8 @@ QString GrantleeContactFormatter::toHtml(HtmlForm form) const ...@@ -342,8 +342,8 @@ QString GrantleeContactFormatter::toHtml(HtmlForm form) const
const KContacts::ResourceLocatorUrl::List extraUrlList = rawContact.extraUrlList(); const KContacts::ResourceLocatorUrl::List extraUrlList = rawContact.extraUrlList();
for (const KContacts::ResourceLocatorUrl &resourceLocator : extraUrlList) { for (const KContacts::ResourceLocatorUrl &resourceLocator : extraUrlList) {
QString url = resourceLocator.url().url(); QString url = resourceLocator.url().url();
if (!url.startsWith(QStringLiteral("http://")) && if (!url.startsWith(QStringLiteral("http://"))
!url.startsWith(QStringLiteral("https://"))) { && !url.startsWith(QStringLiteral("https://"))) {
url = QStringLiteral("http://") + url; url = QStringLiteral("http://") + url;
} }
websites.append(KStringHandler::tagUrls(url)); websites.append(KStringHandler::tagUrls(url));
...@@ -354,16 +354,16 @@ QString GrantleeContactFormatter::toHtml(HtmlForm form) const ...@@ -354,16 +354,16 @@ QString GrantleeContactFormatter::toHtml(HtmlForm form) const
} }
// Blog Feed // Blog Feed
const QString blog = const QString blog
rawContact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("BlogFeed")); = rawContact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("BlogFeed"));
if (!blog.isEmpty()) { if (!blog.isEmpty()) {
contactObject.insert(QStringLiteral("blogUrl"), KStringHandler::tagUrls(blog)); contactObject.insert(QStringLiteral("blogUrl"), KStringHandler::tagUrls(blog));
grantleeContactUtil.insertVariableToQVariantHash(contactObject, QStringLiteral("blogUrli18n")); grantleeContactUtil.insertVariableToQVariantHash(contactObject, QStringLiteral("blogUrli18n"));
} }
// Address Book // Address Book
const QString addressBookName = const QString addressBookName
rawContact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("AddressBook")); = rawContact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("AddressBook"));
if (!addressBookName.isEmpty()) { if (!addressBookName.isEmpty()) {
contactObject.insert(QStringLiteral("addressBookName"), addressBookName); contactObject.insert(QStringLiteral("addressBookName"), addressBookName);
grantleeContactUtil.insertVariableToQVariantHash(contactObject, QStringLiteral("addressBookNamei18n")); grantleeContactUtil.insertVariableToQVariantHash(contactObject, QStringLiteral("addressBookNamei18n"));
...@@ -487,15 +487,12 @@ QString GrantleeContactFormatter::toHtml(HtmlForm form) const ...@@ -487,15 +487,12 @@ QString GrantleeContactFormatter::toHtml(HtmlForm form) const
} else { } else {
value = i18nc("Boolean value", "no"); value = i18nc("Boolean value", "no");
} }
} else if (descriptionType == QLatin1String("date")) {
} else if (descriptionType == QLatin1String("date")) {
const QDate date = QDate::fromString(value, Qt::ISODate); const QDate date = QDate::fromString(value, Qt::ISODate);
value = QLocale().toString(date, QLocale::ShortFormat); value = QLocale().toString(date, QLocale::ShortFormat);
} else if (descriptionType == QLatin1String("time")) { } else if (descriptionType == QLatin1String("time")) {
const QTime time = QTime::fromString(value, Qt::ISODate); const QTime time = QTime::fromString(value, Qt::ISODate);
value = QLocale::system().toString(time, QLocale::ShortFormat); value = QLocale::system().toString(time, QLocale::ShortFormat);
} else if (descriptionType == QLatin1String("datetime")) { } else if (descriptionType == QLatin1String("datetime")) {
const QDateTime dateTime = QDateTime::fromString(value, Qt::ISODate); const QDateTime dateTime = QDateTime::fromString(value, Qt::ISODate);
value = QLocale().toString(dateTime, QLocale::ShortFormat); value = QLocale().toString(dateTime, QLocale::ShortFormat);
......
...@@ -25,14 +25,11 @@ ...@@ -25,14 +25,11 @@
#include <Akonadi/Contact/AbstractContactFormatter> #include <Akonadi/Contact/AbstractContactFormatter>
#include "kaddressbook_grantlee_export.h" #include "kaddressbook_grantlee_export.h"
namespace GrantleeTheme namespace GrantleeTheme {
{
class Theme; class Theme;
} }
namespace KAddressBookGrantlee namespace KAddressBookGrantlee {
{
/** /**
* @short A class that formats a contact as HTML code. * @short A class that formats a contact as HTML code.
* *
...@@ -70,7 +67,6 @@ private: ...@@ -70,7 +67,6 @@ private:
Private *const d; Private *const d;
//@endcond //@endcond
}; };
} }
#endif #endif
...@@ -112,9 +112,9 @@ static QVariantHash memberHash(const KContacts::ContactGroup::Data &data) ...@@ -112,9 +112,9 @@ static QVariantHash memberHash(const KContacts::ContactGroup::Data &data)
contact.setFormattedName(data.name()); contact.setFormattedName(data.name());
contact.insertEmail(data.email()); contact.insertEmail(data.email());
const QString emailLink = QStringLiteral("<a href=\"mailto:") + const QString emailLink = QStringLiteral("<a href=\"mailto:")
QString::fromLatin1(QUrl::toPercentEncoding(contact.fullEmail())) + +QString::fromLatin1(QUrl::toPercentEncoding(contact.fullEmail()))
QStringLiteral("\">%1</a>").arg(contact.preferredEmail()); +QStringLiteral("\">%1</a>").arg(contact.preferredEmail());
setHashField(memberObject, QStringLiteral("emailLink"), emailLink); setHashField(memberObject, QStringLiteral("emailLink"), emailLink);
......
...@@ -25,14 +25,11 @@ ...@@ -25,14 +25,11 @@
#include <Akonadi/Contact/AbstractContactGroupFormatter> #include <Akonadi/Contact/AbstractContactGroupFormatter>
#include "kaddressbook_grantlee_export.h" #include "kaddressbook_grantlee_export.h"
namespace GrantleeTheme namespace GrantleeTheme {
{
class Theme; class Theme;
} }
namespace KAddressBookGrantlee namespace KAddressBookGrantlee {
{
/** /**
* @short A class that formats a contact group as HTML code. * @short A class that formats a contact group as HTML code.
* *
...@@ -65,7 +62,6 @@ private: ...@@ -65,7 +62,6 @@ private:
Private *const d; Private *const d;
//@endcond //@endcond
}; };
} }
#endif #endif
...@@ -24,7 +24,6 @@ using namespace KAddressBookGrantlee; ...@@ -24,7 +24,6 @@ using namespace KAddressBookGrantlee;
GrantleeContactUtils::GrantleeContactUtils() GrantleeContactUtils::GrantleeContactUtils()
{ {
} }
void GrantleeContactUtils::insertVariableToQVariantHash(QVariantHash &contactI18n, const QString &variable) void GrantleeContactUtils::insertVariableToQVariantHash(QVariantHash &contactI18n, const QString &variable)
......
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
#define GRANTLEECONTACTUTILS_H #define GRANTLEECONTACTUTILS_H
#include <QVariantHash> #include <QVariantHash>
namespace KAddressBookGrantlee namespace KAddressBookGrantlee {
{
class GrantleeContactUtils class GrantleeContactUtils
{ {
public: public:
......
...@@ -24,12 +24,10 @@ ...@@ -24,12 +24,10 @@
GrantleePrintTest::GrantleePrintTest(QObject *parent) GrantleePrintTest::GrantleePrintTest(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
} }
GrantleePrintTest::~GrantleePrintTest() GrantleePrintTest::~GrantleePrintTest()
{ {
} }
void GrantleePrintTest::shouldHaveDefaultValue() void GrantleePrintTest::shouldHaveDefaultValue()
......
...@@ -37,7 +37,6 @@ private Q_SLOTS: ...@@ -37,7 +37,6 @@ private Q_SLOTS: