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

Coding style

parent fa95247c
......@@ -26,13 +26,11 @@
#include <QVariantMap>
namespace KContacts
{
namespace KContacts {
class Addressee;
}
namespace Akonadi
{
namespace Akonadi {
class Item;
/**
......@@ -131,7 +129,6 @@ private:
Private *const d;
//@endcond
};
}
#endif
......@@ -26,13 +26,11 @@
#include <QVariant>
namespace KContacts
{
namespace KContacts {
class ContactGroup;
}
namespace Akonadi
{
namespace Akonadi {
class Item;
/**
......@@ -123,7 +121,6 @@ private:
Private *const d;
//@endcond
};
}
#endif
......@@ -22,14 +22,11 @@
#ifndef AKONADI_DIALPHONENUMBERACTION_H
#define AKONADI_DIALPHONENUMBERACTION_H
namespace KContacts
{
namespace KContacts {
class PhoneNumber;
}
namespace Akonadi
{
namespace Akonadi {
/**
* @short An action to dial the phone number of a contact.
*
......@@ -40,7 +37,6 @@ class DialPhoneNumberAction
public:
void dialNumber(const KContacts::PhoneNumber &number);
};
}
#endif
......@@ -70,7 +70,8 @@ static QDBusInterface *searchEkigaDBusInterface()
}
QEkigaDialer::QEkigaDialer(const QString &applicationName)
: QDialer(applicationName), mInterface(nullptr)
: QDialer(applicationName)
, mInterface(nullptr)
{
}
......@@ -83,7 +84,6 @@ bool QEkigaDialer::initializeEkiga()
{
// first check whether dbus interface is available yet
if (!isEkigaServiceRegistered()) {
// it could be skype is not running yet, so start it now
if (!QProcess::startDetached(QStringLiteral("ekiga"), QStringList())) {
mErrorMessage = i18n("Unable to start ekiga process, check that ekiga executable is in your PATH variable.");
......
......@@ -67,7 +67,6 @@ bool QSflPhoneDialer::initializeSflPhone()
{
// first check whether dbus interface is available yet
if (!isSflPhoneServiceRegistered()) {
// it could be skype is not running yet, so start it now
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.");
......
......@@ -34,6 +34,5 @@ public:
private:
bool initializeSflPhone();
};
#endif // QSFLPHONEDIALER_H
......@@ -68,7 +68,8 @@ static QDBusInterface *searchSkypeDBusInterface()
}
QSkypeDialer::QSkypeDialer(const QString &applicationName)
: QDialer(applicationName), mInterface(nullptr)
: QDialer(applicationName)
, mInterface(nullptr)
{
}
......@@ -85,7 +86,6 @@ bool QSkypeDialer::initializeSkype()
// first check whether dbus interface is available yet
if (!isSkypeServiceRegistered()) {
// it could be skype is not running yet, so start it now
if (!QProcess::startDetached(QStringLiteral("skype"), QStringList())) {
mErrorMessage = i18n("Unable to start skype process, check that skype executable is in your PATH variable.");
......
......@@ -22,8 +22,7 @@
#ifndef SENDSMSACTION_H
#define SENDSMSACTION_H
namespace KContacts
{
namespace KContacts {
class PhoneNumber;
}
......
......@@ -22,14 +22,11 @@
#ifndef AKONADI_SHOWADDRESSACTION_H
#define AKONADI_SHOWADDRESSACTION_H
namespace KContacts
{
namespace KContacts {
class Address;
}
namespace Akonadi
{
namespace Akonadi {
/**
* @short A contact action to show the address of a contact on a map.
*
......@@ -57,7 +54,6 @@ class ShowAddressAction
public:
void showAddress(const KContacts::Address &address);
};
}
#endif
......@@ -28,8 +28,7 @@ class QLabel;
class KTextEdit;
namespace KContacts
{
namespace KContacts {
class PhoneNumber;
}
......
......@@ -23,9 +23,7 @@
#include <attributefactory.h>
namespace
{
namespace {
// Anonymous namespace; function is invisible outside this file.
bool dummy()
{
......@@ -36,5 +34,4 @@ bool dummy()
// Called when this library is loaded.
const bool registered = dummy();
} // namespace
......@@ -28,9 +28,7 @@
#include <QVariant>
namespace Akonadi
{
namespace Akonadi {
/**
* @short Attribute to store contact specific meta data.
*
......@@ -70,7 +68,6 @@ private:
Private *const d;
//@endcond
};
}
#endif
......@@ -30,7 +30,7 @@
*
* @author David Jarvie <djarvie@kde.org>
*/
template <class T>
template<class T>
class AutoQPointer : public QPointer<T>
{
public:
......@@ -38,23 +38,28 @@ public:
: QPointer<T>()
{
}
inline AutoQPointer(T *p)
: QPointer<T>(p)
{
}
inline AutoQPointer(const QPointer<T> &p)
: QPointer<T>(p)
{
}
inline ~AutoQPointer()
{
delete this->data();
}
inline AutoQPointer<T> &operator=(const AutoQPointer<T> &p)
{
QPointer<T>::operator=(p);
return *this;
}
inline AutoQPointer<T> &operator=(T *p)
{
QPointer<T>::operator=(p);
......
......@@ -89,7 +89,8 @@ QVariant ContactCompletionModel::entityData(const Item &item, int column, int ro
return contact.assembledName();
}
break;
case NameAndEmailColumn: {
case NameAndEmailColumn:
{
QString name = QStringLiteral("%1 %2").arg(contact.givenName(), contact.familyName()).simplified();
if (name.isEmpty()) {
name = contact.organization().simplified();
......@@ -104,8 +105,8 @@ QVariant ContactCompletionModel::entityData(const Item &item, int column, int ro
}
return QStringLiteral("%1 <%2>").arg(name, email);
break;
}
break;
case EmailColumn:
return contact.preferredEmail();
break;
......
......@@ -24,9 +24,7 @@
#include <entitytreemodel.h>
namespace Akonadi
{
namespace Akonadi {
class ContactCompletionModel : public EntityTreeModel
{
Q_OBJECT
......@@ -51,7 +49,6 @@ public:
private:
static QAbstractItemModel *mSelf;
};
}
#endif
......@@ -28,15 +28,12 @@
class QUrl;
namespace KContacts
{
namespace KContacts {
class Address;
class PhoneNumber;
}
namespace Akonadi
{
namespace Akonadi {
/**
* @short A convenience class that handles different contact related actions.
*
......@@ -145,7 +142,6 @@ private:
Private *const d;
//@endcond PRIVATE
};
}
#endif
......@@ -112,9 +112,9 @@ void Akonadi::AkonadiContactEditor::Private::itemFetchDone(KJob *job)
// about the modify rights of the item
Akonadi::CollectionFetchJob *collectionFetchJob = new Akonadi::CollectionFetchJob(mItem.parentCollection(),
Akonadi::CollectionFetchJob::Base);
mParent->connect(collectionFetchJob, SIGNAL(result(KJob*)),
SLOT(parentCollectionFetchDone(KJob*)));
Akonadi::CollectionFetchJob::Base);
mParent->connect(collectionFetchJob, SIGNAL(result(KJob *)),
SLOT(parentCollectionFetchDone(KJob *)));
} else {
const KContacts::Addressee addr = mItem.payload<KContacts::Addressee>();
mContactMetaData.load(mItem);
......@@ -177,7 +177,7 @@ void Akonadi::AkonadiContactEditor::Private::itemChanged(const Akonadi::Item &it
job->fetchScope().fetchAttribute<ContactMetaDataAttribute>();
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;
......@@ -236,7 +236,7 @@ void Akonadi::AkonadiContactEditor::loadContact(const Akonadi::Item &item)
job->fetchScope().fetchAttribute<ContactMetaDataAttribute>();
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->mMonitor->setItemMonitored(item);
......@@ -266,7 +266,7 @@ void Akonadi::AkonadiContactEditor::saveContactInAddressBook()
d->mItem.setPayload<KContacts::Addressee>(addr);
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) {
if (!d->mDefaultCollection.isValid()) {
const QStringList mimeTypeFilter(KContacts::Addressee::mimeType());
......@@ -293,7 +293,7 @@ void Akonadi::AkonadiContactEditor::saveContactInAddressBook()
d->mContactMetaData.store(item);
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 @@
#include <QWidget>
namespace KContacts
{
namespace KContacts {
class Addressee;
}
namespace ContactEditor
{
namespace ContactEditor {
class AbstractContactEditorWidget;
}
namespace Akonadi
{
namespace Akonadi {
class Collection;
class Item;
......@@ -193,7 +189,6 @@ private:
Q_PRIVATE_SLOT(d, void itemChanged(const Akonadi::Item &, const QSet<QByteArray> &))
//@endcond
};
}
#endif
......@@ -43,8 +43,7 @@ using namespace Akonadi;
class Q_DECL_HIDDEN ContactEditorDialog::Private
{
public:
Private(ContactEditorDialog::Mode mode, ContactEditorDialog::DisplayMode displaymode, ContactEditor::AbstractContactEditorWidget *editorWidget,
ContactEditorDialog *parent)
Private(ContactEditorDialog::Mode mode, ContactEditorDialog::DisplayMode displaymode, ContactEditor::AbstractContactEditorWidget *editorWidget, ContactEditorDialog *parent)
: q(parent)
, mAddressBookBox(nullptr)
, mMode(mode)
......@@ -65,7 +64,8 @@ public:
if (editorWidget) {
mEditor = new AkonadiContactEditor(mode == ContactEditorDialog::CreateMode ? AkonadiContactEditor::CreateMode : AkonadiContactEditor::EditMode, editorWidget, q);
} else {
mEditor = new AkonadiContactEditor(mode == ContactEditorDialog::CreateMode ? AkonadiContactEditor::CreateMode : AkonadiContactEditor::EditMode, displaymode == ContactEditorDialog::FullMode ? AkonadiContactEditor::FullMode : AkonadiContactEditor::VCardMode, q);
mEditor = new AkonadiContactEditor(mode == ContactEditorDialog::CreateMode ? AkonadiContactEditor::CreateMode : AkonadiContactEditor::EditMode,
displaymode == ContactEditorDialog::FullMode ? AkonadiContactEditor::FullMode : AkonadiContactEditor::VCardMode, q);
}
if (mode == ContactEditorDialog::CreateMode) {
......@@ -115,7 +115,7 @@ public:
{
KConfig config(QStringLiteral("akonadi_contactrc"));
KConfigGroup group(&config, QStringLiteral("ContactEditor"));
const QSize size = group.readEntry("Size", QSize(800, 500));
const QSize size = group.readEntry("Size", QSize(800, 500));
if (size.isValid()) {
q->resize(size);
}
......
......@@ -26,13 +26,10 @@
#include <QDialog>
namespace ContactEditor
{
namespace ContactEditor {
class AbstractContactEditorWidget;
}
namespace Akonadi
{
namespace Akonadi {
class AkonadiContactEditor;
class Collection;
class Item;
......@@ -172,7 +169,6 @@ private:
Q_PRIVATE_SLOT(d, void slotFinish())
//@endcond
};
}
#endif
......@@ -87,9 +87,9 @@ void ContactGroupEditor::Private::itemFetchDone(KJob *job)
// about the modify rights of the item
Akonadi::CollectionFetchJob *collectionFetchJob = new Akonadi::CollectionFetchJob(mItem.parentCollection(),
Akonadi::CollectionFetchJob::Base);
mParent->connect(collectionFetchJob, SIGNAL(result(KJob*)),
SLOT(parentCollectionFetchDone(KJob*)));
Akonadi::CollectionFetchJob::Base);
mParent->connect(collectionFetchJob, SIGNAL(result(KJob *)),
SLOT(parentCollectionFetchDone(KJob *)));
} else {
const KContacts::ContactGroup group = mItem.payload<KContacts::ContactGroup>();
loadContactGroup(group);
......@@ -152,7 +152,7 @@ void ContactGroupEditor::Private::itemChanged(const Item &item, const QSet<QByte
job->fetchScope().fetchFullPayload();
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 *)));
new WaitingOverlay(job, mParent);
}
}
......@@ -245,7 +245,7 @@ void ContactGroupEditor::loadContactGroup(const Akonadi::Item &item)
job->fetchScope().fetchFullPayload();
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->mMonitor->setItemMonitored(item);
......@@ -273,7 +273,7 @@ bool ContactGroupEditor::saveContactGroup()
d->mItem.setPayload<KContacts::ContactGroup>(group);
ItemModifyJob *job = new ItemModifyJob(d->mItem);
connect(job, SIGNAL(result(KJob*)), SLOT(storeDone(KJob*)));
connect(job, SIGNAL(result(KJob *)), SLOT(storeDone(KJob *)));
} else if (d->mMode == CreateMode) {
if (!d->mDefaultCollection.isValid()) {
const QStringList mimeTypeFilter(KContacts::ContactGroup::mimeType());
......@@ -301,7 +301,7 @@ bool ContactGroupEditor::saveContactGroup()
item.setMimeType(KContacts::ContactGroup::mimeType());
ItemCreateJob *job = new ItemCreateJob(item, d->mDefaultCollection);
connect(job, SIGNAL(result(KJob*)), SLOT(storeDone(KJob*)));
connect(job, SIGNAL(result(KJob *)), SLOT(storeDone(KJob *)));
}
return true;
......
......@@ -26,14 +26,11 @@
#include <QWidget>
namespace KContacts
{
namespace KContacts {
class ContactGroup;
}
namespace Akonadi
{
namespace Akonadi {
class Collection;
class Item;
......@@ -164,7 +161,6 @@ private:
Q_PRIVATE_SLOT(d, void adaptHeaderSizes())
//@endcond
};
}
#endif
......@@ -31,9 +31,7 @@
class KJob;
namespace Akonadi
{
namespace Akonadi {
class ContactGroupModel;
class Monitor;
......@@ -65,7 +63,6 @@ public:
bool mReadOnly;
ContactGroupModel *mGroupModel;
};
}
#endif
......@@ -136,14 +136,13 @@ ContactGroupEditorDelegate::~ContactGroupEditorDelegate()
delete d;
}
QWidget *ContactGroupEditorDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const
QWidget *ContactGroupEditorDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
const bool isReference = index.data(ContactGroupModel::IsReferenceRole).toBool();
Q_UNUSED(option)
if (index.column() == 0) {
auto edit = new ContactLineEdit(isReference, ContactCompletionModel::EmailColumn, parent);
connect(edit, SIGNAL(completed(QWidget*)), SLOT(completed(QWidget*)));
connect(edit, SIGNAL(completed(QWidget *)), SLOT(completed(QWidget *)));
return edit;
} else {
......@@ -154,7 +153,7 @@ QWidget *ContactGroupEditorDelegate::createEditor(QWidget *parent, const QStyleO
return comboBox;
} else {
auto edit = new ContactLineEdit(isReference, ContactCompletionModel::EmailColumn, parent);
connect(edit, static_cast<void(ContactLineEdit::*)(QWidget *)>(&ContactLineEdit::completed),
connect(edit, static_cast<void (ContactLineEdit::*)(QWidget *)>(&ContactLineEdit::completed),
this, &ContactGroupEditorDelegate::completed);
return edit;
}
......@@ -236,7 +235,7 @@ void ContactGroupEditorDelegate::setModelData(QWidget *editor, QAbstractItemMode