Commit 2ed6b548 authored by Laurent Montel's avatar Laurent Montel 😁

Coding style

parent fa95247c
...@@ -26,13 +26,11 @@ ...@@ -26,13 +26,11 @@
#include <QVariantMap> #include <QVariantMap>
namespace KContacts namespace KContacts {
{
class Addressee; class Addressee;
} }
namespace Akonadi namespace Akonadi {
{
class Item; class Item;
/** /**
...@@ -131,7 +129,6 @@ private: ...@@ -131,7 +129,6 @@ private:
Private *const d; Private *const d;
//@endcond //@endcond
}; };
} }
#endif #endif
...@@ -26,13 +26,11 @@ ...@@ -26,13 +26,11 @@
#include <QVariant> #include <QVariant>
namespace KContacts namespace KContacts {
{
class ContactGroup; class ContactGroup;
} }
namespace Akonadi namespace Akonadi {
{
class Item; class Item;
/** /**
...@@ -123,7 +121,6 @@ private: ...@@ -123,7 +121,6 @@ private:
Private *const d; Private *const d;
//@endcond //@endcond
}; };
} }
#endif #endif
...@@ -22,14 +22,11 @@ ...@@ -22,14 +22,11 @@
#ifndef AKONADI_DIALPHONENUMBERACTION_H #ifndef AKONADI_DIALPHONENUMBERACTION_H
#define AKONADI_DIALPHONENUMBERACTION_H #define AKONADI_DIALPHONENUMBERACTION_H
namespace KContacts namespace KContacts {
{
class PhoneNumber; class PhoneNumber;
} }
namespace Akonadi namespace Akonadi {
{
/** /**
* @short An action to dial the phone number of a contact. * @short An action to dial the phone number of a contact.
* *
...@@ -40,7 +37,6 @@ class DialPhoneNumberAction ...@@ -40,7 +37,6 @@ class DialPhoneNumberAction
public: public:
void dialNumber(const KContacts::PhoneNumber &number); void dialNumber(const KContacts::PhoneNumber &number);
}; };
} }
#endif #endif
...@@ -70,7 +70,8 @@ static QDBusInterface *searchEkigaDBusInterface() ...@@ -70,7 +70,8 @@ static QDBusInterface *searchEkigaDBusInterface()
} }
QEkigaDialer::QEkigaDialer(const QString &applicationName) QEkigaDialer::QEkigaDialer(const QString &applicationName)
: QDialer(applicationName), mInterface(nullptr) : QDialer(applicationName)
, mInterface(nullptr)
{ {
} }
...@@ -83,7 +84,6 @@ bool QEkigaDialer::initializeEkiga() ...@@ -83,7 +84,6 @@ bool QEkigaDialer::initializeEkiga()
{ {
// first check whether dbus interface is available yet // first check whether dbus interface is available yet
if (!isEkigaServiceRegistered()) { if (!isEkigaServiceRegistered()) {
// it could be skype is not running yet, so start it now // it could be skype is not running yet, so start it now
if (!QProcess::startDetached(QStringLiteral("ekiga"), QStringList())) { if (!QProcess::startDetached(QStringLiteral("ekiga"), QStringList())) {
mErrorMessage = i18n("Unable to start ekiga process, check that ekiga executable is in your PATH variable."); mErrorMessage = i18n("Unable to start ekiga process, check that ekiga executable is in your PATH variable.");
......
...@@ -67,7 +67,6 @@ bool QSflPhoneDialer::initializeSflPhone() ...@@ -67,7 +67,6 @@ bool QSflPhoneDialer::initializeSflPhone()
{ {
// first check whether dbus interface is available yet // first check whether dbus interface is available yet
if (!isSflPhoneServiceRegistered()) { if (!isSflPhoneServiceRegistered()) {
// it could be skype is not running yet, so start it now // it could be skype is not running yet, so start it now
if (!QProcess::startDetached(QStringLiteral("sflphone-client-kde"), QStringList())) { if (!QProcess::startDetached(QStringLiteral("sflphone-client-kde"), QStringList())) {
mErrorMessage = i18n("Unable to start sflphone-client-kde process, check that sflphone-client-kde executable is in your PATH variable."); mErrorMessage = i18n("Unable to start sflphone-client-kde process, check that sflphone-client-kde executable is in your PATH variable.");
......
...@@ -34,6 +34,5 @@ public: ...@@ -34,6 +34,5 @@ public:
private: private:
bool initializeSflPhone(); bool initializeSflPhone();
}; };
#endif // QSFLPHONEDIALER_H #endif // QSFLPHONEDIALER_H
...@@ -68,7 +68,8 @@ static QDBusInterface *searchSkypeDBusInterface() ...@@ -68,7 +68,8 @@ static QDBusInterface *searchSkypeDBusInterface()
} }
QSkypeDialer::QSkypeDialer(const QString &applicationName) QSkypeDialer::QSkypeDialer(const QString &applicationName)
: QDialer(applicationName), mInterface(nullptr) : QDialer(applicationName)
, mInterface(nullptr)
{ {
} }
...@@ -85,7 +86,6 @@ bool QSkypeDialer::initializeSkype() ...@@ -85,7 +86,6 @@ bool QSkypeDialer::initializeSkype()
// first check whether dbus interface is available yet // first check whether dbus interface is available yet
if (!isSkypeServiceRegistered()) { if (!isSkypeServiceRegistered()) {
// it could be skype is not running yet, so start it now // it could be skype is not running yet, so start it now
if (!QProcess::startDetached(QStringLiteral("skype"), QStringList())) { if (!QProcess::startDetached(QStringLiteral("skype"), QStringList())) {
mErrorMessage = i18n("Unable to start skype process, check that skype executable is in your PATH variable."); mErrorMessage = i18n("Unable to start skype process, check that skype executable is in your PATH variable.");
......
...@@ -22,8 +22,7 @@ ...@@ -22,8 +22,7 @@
#ifndef SENDSMSACTION_H #ifndef SENDSMSACTION_H
#define SENDSMSACTION_H #define SENDSMSACTION_H
namespace KContacts namespace KContacts {
{
class PhoneNumber; class PhoneNumber;
} }
......
...@@ -22,14 +22,11 @@ ...@@ -22,14 +22,11 @@
#ifndef AKONADI_SHOWADDRESSACTION_H #ifndef AKONADI_SHOWADDRESSACTION_H
#define AKONADI_SHOWADDRESSACTION_H #define AKONADI_SHOWADDRESSACTION_H
namespace KContacts namespace KContacts {
{
class Address; class Address;
} }
namespace Akonadi namespace Akonadi {
{
/** /**
* @short A contact action to show the address of a contact on a map. * @short A contact action to show the address of a contact on a map.
* *
...@@ -57,7 +54,6 @@ class ShowAddressAction ...@@ -57,7 +54,6 @@ class ShowAddressAction
public: public:
void showAddress(const KContacts::Address &address); void showAddress(const KContacts::Address &address);
}; };
} }
#endif #endif
...@@ -28,8 +28,7 @@ class QLabel; ...@@ -28,8 +28,7 @@ class QLabel;
class KTextEdit; class KTextEdit;
namespace KContacts namespace KContacts {
{
class PhoneNumber; class PhoneNumber;
} }
......
...@@ -32,4 +32,3 @@ ...@@ -32,4 +32,3 @@
#endif #endif
#endif #endif
...@@ -23,9 +23,7 @@ ...@@ -23,9 +23,7 @@
#include <attributefactory.h> #include <attributefactory.h>
namespace namespace {
{
// Anonymous namespace; function is invisible outside this file. // Anonymous namespace; function is invisible outside this file.
bool dummy() bool dummy()
{ {
...@@ -36,5 +34,4 @@ bool dummy() ...@@ -36,5 +34,4 @@ bool dummy()
// Called when this library is loaded. // Called when this library is loaded.
const bool registered = dummy(); const bool registered = dummy();
} // namespace } // namespace
...@@ -28,9 +28,7 @@ ...@@ -28,9 +28,7 @@
#include <QVariant> #include <QVariant>
namespace Akonadi namespace Akonadi {
{
/** /**
* @short Attribute to store contact specific meta data. * @short Attribute to store contact specific meta data.
* *
...@@ -70,7 +68,6 @@ private: ...@@ -70,7 +68,6 @@ private:
Private *const d; Private *const d;
//@endcond //@endcond
}; };
} }
#endif #endif
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* *
* @author David Jarvie <djarvie@kde.org> * @author David Jarvie <djarvie@kde.org>
*/ */
template <class T> template<class T>
class AutoQPointer : public QPointer<T> class AutoQPointer : public QPointer<T>
{ {
public: public:
...@@ -38,23 +38,28 @@ public: ...@@ -38,23 +38,28 @@ public:
: QPointer<T>() : QPointer<T>()
{ {
} }
inline AutoQPointer(T *p) inline AutoQPointer(T *p)
: QPointer<T>(p) : QPointer<T>(p)
{ {
} }
inline AutoQPointer(const QPointer<T> &p) inline AutoQPointer(const QPointer<T> &p)
: QPointer<T>(p) : QPointer<T>(p)
{ {
} }
inline ~AutoQPointer() inline ~AutoQPointer()
{ {
delete this->data(); delete this->data();
} }
inline AutoQPointer<T> &operator=(const AutoQPointer<T> &p) inline AutoQPointer<T> &operator=(const AutoQPointer<T> &p)
{ {
QPointer<T>::operator=(p); QPointer<T>::operator=(p);
return *this; return *this;
} }
inline AutoQPointer<T> &operator=(T *p) inline AutoQPointer<T> &operator=(T *p)
{ {
QPointer<T>::operator=(p); QPointer<T>::operator=(p);
......
...@@ -89,7 +89,8 @@ QVariant ContactCompletionModel::entityData(const Item &item, int column, int ro ...@@ -89,7 +89,8 @@ QVariant ContactCompletionModel::entityData(const Item &item, int column, int ro
return contact.assembledName(); return contact.assembledName();
} }
break; break;
case NameAndEmailColumn: { case NameAndEmailColumn:
{
QString name = QStringLiteral("%1 %2").arg(contact.givenName(), contact.familyName()).simplified(); QString name = QStringLiteral("%1 %2").arg(contact.givenName(), contact.familyName()).simplified();
if (name.isEmpty()) { if (name.isEmpty()) {
name = contact.organization().simplified(); name = contact.organization().simplified();
...@@ -104,8 +105,8 @@ QVariant ContactCompletionModel::entityData(const Item &item, int column, int ro ...@@ -104,8 +105,8 @@ QVariant ContactCompletionModel::entityData(const Item &item, int column, int ro
} }
return QStringLiteral("%1 <%2>").arg(name, email); return QStringLiteral("%1 <%2>").arg(name, email);
break;
} }
break;
case EmailColumn: case EmailColumn:
return contact.preferredEmail(); return contact.preferredEmail();
break; break;
......
...@@ -24,9 +24,7 @@ ...@@ -24,9 +24,7 @@
#include <entitytreemodel.h> #include <entitytreemodel.h>
namespace Akonadi namespace Akonadi {
{
class ContactCompletionModel : public EntityTreeModel class ContactCompletionModel : public EntityTreeModel
{ {
Q_OBJECT Q_OBJECT
...@@ -51,7 +49,6 @@ public: ...@@ -51,7 +49,6 @@ public:
private: private:
static QAbstractItemModel *mSelf; static QAbstractItemModel *mSelf;
}; };
} }
#endif #endif
...@@ -28,15 +28,12 @@ ...@@ -28,15 +28,12 @@
class QUrl; class QUrl;
namespace KContacts namespace KContacts {
{
class Address; class Address;
class PhoneNumber; class PhoneNumber;
} }
namespace Akonadi namespace Akonadi {
{
/** /**
* @short A convenience class that handles different contact related actions. * @short A convenience class that handles different contact related actions.
* *
...@@ -145,7 +142,6 @@ private: ...@@ -145,7 +142,6 @@ private:
Private *const d; Private *const d;
//@endcond PRIVATE //@endcond PRIVATE
}; };
} }
#endif #endif
...@@ -112,9 +112,9 @@ void Akonadi::AkonadiContactEditor::Private::itemFetchDone(KJob *job) ...@@ -112,9 +112,9 @@ void Akonadi::AkonadiContactEditor::Private::itemFetchDone(KJob *job)
// about the modify rights of the item // about the modify rights of the item
Akonadi::CollectionFetchJob *collectionFetchJob = new Akonadi::CollectionFetchJob(mItem.parentCollection(), Akonadi::CollectionFetchJob *collectionFetchJob = new Akonadi::CollectionFetchJob(mItem.parentCollection(),
Akonadi::CollectionFetchJob::Base); Akonadi::CollectionFetchJob::Base);
mParent->connect(collectionFetchJob, SIGNAL(result(KJob*)), mParent->connect(collectionFetchJob, SIGNAL(result(KJob *)),
SLOT(parentCollectionFetchDone(KJob*))); SLOT(parentCollectionFetchDone(KJob *)));
} else { } else {
const KContacts::Addressee addr = mItem.payload<KContacts::Addressee>(); const KContacts::Addressee addr = mItem.payload<KContacts::Addressee>();
mContactMetaData.load(mItem); mContactMetaData.load(mItem);
...@@ -177,7 +177,7 @@ void Akonadi::AkonadiContactEditor::Private::itemChanged(const Akonadi::Item &it ...@@ -177,7 +177,7 @@ void Akonadi::AkonadiContactEditor::Private::itemChanged(const Akonadi::Item &it
job->fetchScope().fetchAttribute<ContactMetaDataAttribute>(); job->fetchScope().fetchAttribute<ContactMetaDataAttribute>();
job->fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent); job->fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent);
mParent->connect(job, SIGNAL(result(KJob*)), mParent, SLOT(itemFetchDone(KJob*))); mParent->connect(job, SIGNAL(result(KJob *)), mParent, SLOT(itemFetchDone(KJob *)));
} }
delete dlg; delete dlg;
...@@ -236,7 +236,7 @@ void Akonadi::AkonadiContactEditor::loadContact(const Akonadi::Item &item) ...@@ -236,7 +236,7 @@ void Akonadi::AkonadiContactEditor::loadContact(const Akonadi::Item &item)
job->fetchScope().fetchAttribute<ContactMetaDataAttribute>(); job->fetchScope().fetchAttribute<ContactMetaDataAttribute>();
job->fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent); job->fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent);
connect(job, SIGNAL(result(KJob*)), SLOT(itemFetchDone(KJob*))); connect(job, SIGNAL(result(KJob *)), SLOT(itemFetchDone(KJob *)));
d->setupMonitor(); d->setupMonitor();
d->mMonitor->setItemMonitored(item); d->mMonitor->setItemMonitored(item);
...@@ -266,7 +266,7 @@ void Akonadi::AkonadiContactEditor::saveContactInAddressBook() ...@@ -266,7 +266,7 @@ void Akonadi::AkonadiContactEditor::saveContactInAddressBook()
d->mItem.setPayload<KContacts::Addressee>(addr); d->mItem.setPayload<KContacts::Addressee>(addr);
Akonadi::ItemModifyJob *job = new Akonadi::ItemModifyJob(d->mItem); Akonadi::ItemModifyJob *job = new Akonadi::ItemModifyJob(d->mItem);
connect(job, SIGNAL(result(KJob*)), SLOT(storeDone(KJob*))); connect(job, SIGNAL(result(KJob *)), SLOT(storeDone(KJob *)));
} else if (d->mMode == CreateMode) { } else if (d->mMode == CreateMode) {
if (!d->mDefaultCollection.isValid()) { if (!d->mDefaultCollection.isValid()) {
const QStringList mimeTypeFilter(KContacts::Addressee::mimeType()); const QStringList mimeTypeFilter(KContacts::Addressee::mimeType());
...@@ -293,7 +293,7 @@ void Akonadi::AkonadiContactEditor::saveContactInAddressBook() ...@@ -293,7 +293,7 @@ void Akonadi::AkonadiContactEditor::saveContactInAddressBook()
d->mContactMetaData.store(item); d->mContactMetaData.store(item);
Akonadi::ItemCreateJob *job = new Akonadi::ItemCreateJob(item, d->mDefaultCollection); Akonadi::ItemCreateJob *job = new Akonadi::ItemCreateJob(item, d->mDefaultCollection);
connect(job, SIGNAL(result(KJob*)), SLOT(storeDone(KJob*))); connect(job, SIGNAL(result(KJob *)), SLOT(storeDone(KJob *)));
} }
} }
......
...@@ -26,17 +26,13 @@ ...@@ -26,17 +26,13 @@
#include <QWidget> #include <QWidget>
namespace KContacts namespace KContacts {
{
class Addressee; class Addressee;
} }
namespace ContactEditor