Commit 5e6f67b4 authored by Laurent Montel's avatar Laurent Montel 😁

Fix coding style

parent 558e7992
......@@ -43,9 +43,9 @@ KAddressBookPlugin::KAddressBookPlugin(KontactInterface::Core *core, const QVari
{
setComponentName(QStringLiteral("kaddressbook"), i18n("KAddressBook"));
QAction *action =
new QAction(QIcon::fromTheme(QStringLiteral("contact-new")),
i18nc("@action:inmenu", "New Contact..."), this);
QAction *action
= new QAction(QIcon::fromTheme(QStringLiteral("contact-new")),
i18nc("@action:inmenu", "New Contact..."), this);
actionCollection()->addAction(QStringLiteral("new_contact"), action);
connect(action, &QAction::triggered, this, &KAddressBookPlugin::slotNewContact);
actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C));
......@@ -56,9 +56,9 @@ KAddressBookPlugin::KAddressBookPlugin(KontactInterface::Core *core, const QVari
"You will be presented with a dialog where you can create a new contact."));
insertNewAction(action);
action =
new QAction(QIcon::fromTheme(QStringLiteral("user-group-new")),
i18nc("@action:inmenu", "New Contact Group..."), this);
action
= new QAction(QIcon::fromTheme(QStringLiteral("user-group-new")),
i18nc("@action:inmenu", "New Contact Group..."), this);
actionCollection()->addAction(QStringLiteral("new_contactgroup"), action);
connect(action, &QAction::triggered, this, &KAddressBookPlugin::slotNewContactGroup);
actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_G));
......
......@@ -23,8 +23,7 @@
#include <KontactInterface/UniqueAppHandler>
namespace KontactInterface
{
namespace KontactInterface {
class Plugin;
}
......@@ -33,7 +32,10 @@ class KAddressBookUniqueAppHandler : public KontactInterface::UniqueAppHandler
Q_OBJECT
public:
explicit KAddressBookUniqueAppHandler(KontactInterface::Plugin *plugin)
: KontactInterface::UniqueAppHandler(plugin) {}
: KontactInterface::UniqueAppHandler(plugin)
{
}
void loadCommandLineOptions(QCommandLineParser *parser) Q_DECL_OVERRIDE;
int activate(const QStringList &args, const QString &workingDir) Q_DECL_OVERRIDE;
};
......@@ -64,8 +66,6 @@ private Q_SLOTS:
private:
KontactInterface::UniqueAppWatcher *mUniqueAppWatcher;
};
#endif
......@@ -32,8 +32,8 @@ AboutData::AboutData()
KAboutLicense::GPL_V2,
i18n("Copyright © 2007–2017 KAddressBook authors"))
{
addAuthor(i18n("Laurent Montel"), i18n("Current maintainer"), QStringLiteral("montel@kde.org"));
addAuthor(i18n("Tobias Koenig"), i18n("Previous maintainer"), QStringLiteral("tokoe@kde.org"));
addAuthor(i18n("Laurent Montel"), i18n("Current maintainer"), QStringLiteral("montel@kde.org"));
addAuthor(i18n("Tobias Koenig"), i18n("Previous maintainer"), QStringLiteral("tokoe@kde.org"));
}
AboutData::~AboutData()
......
......@@ -40,4 +40,3 @@ public:
};
#endif /* ABOUTDATA_H */
......@@ -23,12 +23,10 @@
AkonadiContactGroupRepository::AkonadiContactGroupRepository()
: Domain::ContactGroupRepository()
{
}
AkonadiContactGroupRepository::~AkonadiContactGroupRepository()
{
}
KJob *AkonadiContactGroupRepository::createContactGroup(Domain::ContactGroup *contactGroup)
......
......@@ -23,8 +23,7 @@
#include "contactgrouprepository.h"
#include <QObject>
namespace Domain
{
namespace Domain {
class ContactGroup;
}
class KJob;
......
......@@ -22,12 +22,10 @@
AkonadiContactRepository::AkonadiContactRepository()
{
}
AkonadiContactRepository::~AkonadiContactRepository()
{
}
KJob *AkonadiContactRepository::createContact(Domain::Contact *contact)
......
This diff is collapsed.
......@@ -48,15 +48,15 @@ private:
};
CategoryFilterProxyModelPrivate::CategoryFilterProxyModelPrivate(CategoryFilterProxyModel *parent)
: QObject(),
filterEnabled(false),
q_ptr(parent)
: QObject()
, filterEnabled(false)
, q_ptr(parent)
{
}
CategoryFilterProxyModel::CategoryFilterProxyModel(QObject *parent)
: QSortFilterProxyModel(parent),
d_ptr(new CategoryFilterProxyModelPrivate(this))
: QSortFilterProxyModel(parent)
, d_ptr(new CategoryFilterProxyModelPrivate(this))
{
setDynamicSortFilter(true);
}
......
......@@ -76,7 +76,7 @@ protected:
/**
* @reimp
**/
bool filterAcceptsRow(int row, const QModelIndex &parent) const Q_DECL_OVERRIDE;
bool filterAcceptsRow(int row, const QModelIndex &parent) const Q_DECL_OVERRIDE;
private:
CategoryFilterProxyModelPrivate *const d_ptr;
......
......@@ -69,12 +69,12 @@ private:
};
CategorySelectWidgetPrivate::CategorySelectWidgetPrivate(CategorySelectWidget *parent)
: QObject(),
tagModel(nullptr),
rowOffset(0),
updateTimer(nullptr),
checkCombo(nullptr),
q_ptr(parent)
: QObject()
, tagModel(nullptr)
, rowOffset(0)
, updateTimer(nullptr)
, checkCombo(nullptr)
, q_ptr(parent)
{
}
......@@ -110,7 +110,7 @@ void CategorySelectWidgetPrivate::init()
connect(updateTimer, &QTimer::timeout, this, &CategorySelectWidgetPrivate::slotCheckedItemsTimer);
QToolButton *but = new QToolButton(q);
but ->setAutoRaise(true);
but->setAutoRaise(true);
but->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo")));
but->setToolTip(i18nc("@action:button", "Reset category filter"));
connect(but, &QToolButton::clicked, this, &CategorySelectWidgetPrivate::slotSelectAll);
......@@ -184,8 +184,8 @@ void CategorySelectWidgetPrivate::slotTagsInserted(const QModelIndex &parent, in
if (parent != QModelIndex()) {
const Tag::Id parentId = tagModel->data(idx, TagModel::IdRole).value<Tag::Id>();
QModelIndexList matchList = itemModel()->match(itemModel()->index(0, 0), FILTER_ROLE,
parentId, 1,
Qt::MatchExactly | Qt::MatchRecursive);
parentId, 1,
Qt::MatchExactly | Qt::MatchRecursive);
if (matchList.count() == 1) { // found the parent tag
QModelIndex parentIndex = matchList.at(0);
itemModel()->itemFromIndex(parentIndex)->appendRow(it);
......@@ -281,8 +281,8 @@ QList<Akonadi::Tag::Id> CategorySelectWidgetPrivate::filterTags() const
}
CategorySelectWidget::CategorySelectWidget(QWidget *parent)
: QWidget(parent),
d_ptr(new CategorySelectWidgetPrivate(this))
: QWidget(parent)
, d_ptr(new CategorySelectWidgetPrivate(this))
{
Q_D(CategorySelectWidget);
d->init();
......
......@@ -29,7 +29,8 @@
using namespace KAddressBook;
K_PLUGIN_FACTORY(KCMKaddressbookPluginsConfigFactory, registerPlugin<KCMKaddressbookPluginsConfig>();)
K_PLUGIN_FACTORY(KCMKaddressbookPluginsConfigFactory, registerPlugin<KCMKaddressbookPluginsConfig>();
)
KCMKaddressbookPluginsConfig::KCMKaddressbookPluginsConfig(QWidget *parent, const QVariantList &args)
: KCModule(parent, args)
......
......@@ -23,12 +23,10 @@
#include <KCModule>
#include <QVariant>
namespace PimCommon
{
namespace PimCommon {
class ConfigurePluginsWidget;
}
namespace KAddressBook
{
namespace KAddressBook {
class KCMKaddressbookPluginsConfig : public KCModule
{
Q_OBJECT
......
......@@ -25,12 +25,12 @@
#include <KLocalizedString>
#include <PimCommon/GenericPlugin>
namespace
{
namespace {
QString kaddressbookPluginToolsGroupName()
{
return QStringLiteral("kaddressbookplugintoolsgroupname");
}
QString kaddressbookImportExportGroupName()
{
return QStringLiteral("kaddressbookpluginimportexportgroupname");
......@@ -45,18 +45,17 @@ KAddressBookConfigPluginListWidget::KAddressBookConfigPluginListWidget(QWidget *
KAddressBookConfigPluginListWidget::~KAddressBookConfigPluginListWidget()
{
}
void KAddressBookConfigPluginListWidget::save()
{
PimCommon::ConfigurePluginsListWidget::savePlugins(KAddressBookPluginInterface::self()->configGroupName(),
KAddressBookPluginInterface::self()->configPrefixSettingKey(),
mPluginGenericItems);
KAddressBookPluginInterface::self()->configPrefixSettingKey(),
mPluginGenericItems);
PimCommon::ConfigurePluginsListWidget::savePlugins(KAddressBookImportExport::KAddressBookImportExportPluginManager::self()->configGroupName(),
KAddressBookImportExport::KAddressBookImportExportPluginManager::self()->configPrefixSettingKey(),
mPluginImportExportItems);
KAddressBookImportExport::KAddressBookImportExportPluginManager::self()->configPrefixSettingKey(),
mPluginImportExportItems);
}
void KAddressBookConfigPluginListWidget::doLoadFromGlobalSettings()
......@@ -75,17 +74,17 @@ void KAddressBookConfigPluginListWidget::initialize()
//Necessary to initialize pluging when we load it outside kaddressbook
KAddressBookPluginInterface::self()->initializePlugins();
PimCommon::ConfigurePluginsListWidget::fillTopItems(KAddressBookPluginInterface::self()->pluginsDataList(), i18n("Tools Plugins"),
KAddressBookPluginInterface::self()->configGroupName(),
KAddressBookPluginInterface::self()->configPrefixSettingKey(),
mPluginGenericItems,
kaddressbookPluginToolsGroupName());
KAddressBookPluginInterface::self()->configGroupName(),
KAddressBookPluginInterface::self()->configPrefixSettingKey(),
mPluginGenericItems,
kaddressbookPluginToolsGroupName());
PimCommon::ConfigurePluginsListWidget::fillTopItems(KAddressBookImportExport::KAddressBookImportExportPluginManager::self()->pluginsDataList(),
i18n("Import/Export Plugins"),
KAddressBookImportExport::KAddressBookImportExportPluginManager::self()->configGroupName(),
KAddressBookImportExport::KAddressBookImportExportPluginManager::self()->configPrefixSettingKey(),
mPluginImportExportItems,
kaddressbookImportExportGroupName());
i18n("Import/Export Plugins"),
KAddressBookImportExport::KAddressBookImportExportPluginManager::self()->configGroupName(),
KAddressBookImportExport::KAddressBookImportExportPluginManager::self()->configPrefixSettingKey(),
mPluginImportExportItems,
kaddressbookImportExportGroupName());
mListWidget->expandAll();
}
......
......@@ -26,35 +26,35 @@ class ContactSortHelper
{
public:
ContactSortHelper(KAddressBookImportExport::KAddressBookImportExportContactFields::Field field, Qt::SortOrder sortOrder)
: mSortField(field), mSortOrder(sortOrder)
: mSortField(field)
, mSortOrder(sortOrder)
{
}
inline bool operator()(const KContacts::Addressee &contact,
const KContacts::Addressee &otherContact) const
inline bool operator()(const KContacts::Addressee &contact, const KContacts::Addressee &otherContact) const
{
int result =
QString::localeAwareCompare(
KAddressBookImportExport::KAddressBookImportExportContactFields::value(mSortField, contact),
KAddressBookImportExport::KAddressBookImportExportContactFields::value(mSortField, otherContact));
int result
= QString::localeAwareCompare(
KAddressBookImportExport::KAddressBookImportExportContactFields::value(mSortField, contact),
KAddressBookImportExport::KAddressBookImportExportContactFields::value(mSortField, otherContact));
if (result == 0) {
int givenNameResult =
QString::localeAwareCompare(
KAddressBookImportExport::KAddressBookImportExportContactFields::value(KAddressBookImportExport::KAddressBookImportExportContactFields::GivenName, contact),
KAddressBookImportExport::KAddressBookImportExportContactFields::value(KAddressBookImportExport::KAddressBookImportExportContactFields::GivenName, otherContact));
int givenNameResult
= QString::localeAwareCompare(
KAddressBookImportExport::KAddressBookImportExportContactFields::value(KAddressBookImportExport::KAddressBookImportExportContactFields::GivenName, contact),
KAddressBookImportExport::KAddressBookImportExportContactFields::value(KAddressBookImportExport::KAddressBookImportExportContactFields::GivenName, otherContact));
if (givenNameResult == 0) {
int familyNameResult =
QString::localeAwareCompare(
KAddressBookImportExport::KAddressBookImportExportContactFields::value(KAddressBookImportExport::KAddressBookImportExportContactFields::FamilyName, contact),
KAddressBookImportExport::KAddressBookImportExportContactFields::value(KAddressBookImportExport::KAddressBookImportExportContactFields::FamilyName, otherContact));
int familyNameResult
= QString::localeAwareCompare(
KAddressBookImportExport::KAddressBookImportExportContactFields::value(KAddressBookImportExport::KAddressBookImportExportContactFields::FamilyName, contact),
KAddressBookImportExport::KAddressBookImportExportContactFields::value(KAddressBookImportExport::KAddressBookImportExportContactFields::FamilyName, otherContact));
if (familyNameResult == 0) {
result =
QString::localeAwareCompare(
KAddressBookImportExport::KAddressBookImportExportContactFields::value(KAddressBookImportExport::KAddressBookImportExportContactFields::FormattedName, contact),
KAddressBookImportExport::KAddressBookImportExportContactFields::value(KAddressBookImportExport::KAddressBookImportExportContactFields::FormattedName, otherContact));
result
= QString::localeAwareCompare(
KAddressBookImportExport::KAddressBookImportExportContactFields::value(KAddressBookImportExport::KAddressBookImportExportContactFields::FormattedName, contact),
KAddressBookImportExport::KAddressBookImportExportContactFields::value(KAddressBookImportExport::KAddressBookImportExportContactFields::FormattedName, otherContact));
} else {
result = familyNameResult;
}
......@@ -78,7 +78,8 @@ private:
};
ContactSorter::ContactSorter(KAddressBookImportExport::KAddressBookImportExportContactFields::Field field, Qt::SortOrder sortOrder)
: mSortField(field), mSortOrder(sortOrder)
: mSortField(field)
, mSortOrder(sortOrder)
{
}
......
......@@ -26,8 +26,7 @@
class ContactSorter
{
public:
explicit ContactSorter(KAddressBookImportExport::KAddressBookImportExportContactFields::Field field,
Qt::SortOrder sortOrder = Qt::AscendingOrder);
explicit ContactSorter(KAddressBookImportExport::KAddressBookImportExportContactFields::Field field, Qt::SortOrder sortOrder = Qt::AscendingOrder);
void sort(KContacts::Addressee::List &contacts) const;
......
......@@ -27,7 +27,8 @@
#include <QPushButton>
ContactSwitcher::ContactSwitcher(QWidget *parent)
: QWidget(parent), mView(nullptr)
: QWidget(parent)
, mView(nullptr)
{
QHBoxLayout *layout = new QHBoxLayout(this);
......@@ -84,8 +85,8 @@ void ContactSwitcher::nextClicked()
}
mView->selectionModel()->setCurrentIndex(mView->model()->index(row, 0),
QItemSelectionModel::Rows |
QItemSelectionModel::ClearAndSelect);
QItemSelectionModel::Rows
|QItemSelectionModel::ClearAndSelect);
updateStatus();
}
......@@ -104,8 +105,8 @@ void ContactSwitcher::previousClicked()
}
mView->selectionModel()->setCurrentIndex(mView->model()->index(row, 0),
QItemSelectionModel::Rows |
QItemSelectionModel::ClearAndSelect);
QItemSelectionModel::Rows
|QItemSelectionModel::ClearAndSelect);
updateStatus();
}
......@@ -133,4 +134,3 @@ void ContactSwitcher::updateStatus()
mStatusLabel->clear();
}
}
......@@ -25,12 +25,10 @@
ContactGroupTest::ContactGroupTest(QObject *parent)
: QObject(parent)
{
}
ContactGroupTest::~ContactGroupTest()
{
}
void ContactGroupTest::shouldHaveDefaultValue()
......
......@@ -25,12 +25,10 @@
ContactTest::ContactTest(QObject *parent)
: QObject(parent)
{
}
ContactTest::~ContactTest()
{
}
void ContactTest::shouldHaveDefaultValue()
......
......@@ -32,7 +32,6 @@ public:
private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldAssignAddresse();
};
#endif // CONTACTTEST_H
......@@ -24,12 +24,10 @@ using namespace Domain;
Contact::Contact()
{
}
Contact::~Contact()
{
}
KContacts::Addressee Contact::addressee() const
......
......@@ -23,8 +23,7 @@
#include <KContacts/Addressee>
#include "kaddressbookdomain_export.h"
namespace Domain
{
namespace Domain {
class KADDRESSBOOKDOMAIN_EXPORT Contact
{
public:
......
......@@ -24,12 +24,10 @@ using namespace Domain;
ContactGroup::ContactGroup()
{
}
ContactGroup::~ContactGroup()
{
}
QString ContactGroup::groupName() const
......
......@@ -24,8 +24,7 @@
#include <QString>
#include "kaddressbookdomain_export.h"
namespace Domain
{
namespace Domain {
class KADDRESSBOOKDOMAIN_EXPORT ContactGroup
{
public:
......
......@@ -24,10 +24,8 @@ using namespace Domain;
ContactGroupRepository::ContactGroupRepository()
{
}
ContactGroupRepository::~ContactGroupRepository()
{
}
......@@ -22,8 +22,7 @@
#define CONTACTGROUPREPOSITORY_H
#include "kaddressbookdomain_export.h"
class KJob;
namespace Domain
{
namespace Domain {
class ContactGroup;
class KADDRESSBOOKDOMAIN_EXPORT ContactGroupRepository
{
......
......@@ -24,10 +24,8 @@ using namespace Domain;
ContactRepository::ContactRepository()
{
}
ContactRepository::~ContactRepository()
{
}
......@@ -23,8 +23,7 @@
#include "kaddressbookdomain_export.h"
class KJob;
namespace Domain
{
namespace Domain {
class Contact;
class KADDRESSBOOKDOMAIN_EXPORT ContactRepository
{
......
......@@ -21,8 +21,7 @@
#ifndef GLOBALCONTACTMODEL_H
#define GLOBALCONTACTMODEL_H
namespace Akonadi
{
namespace Akonadi {
class ChangeRecorder;
class ContactsTreeModel;
class Monitor;
......
......@@ -78,4 +78,3 @@ void KAddressBookMigrateApplication::initializeMigrator()
//TODO add folder to migrate
}
......@@ -33,10 +33,10 @@
#include <QVBoxLayout>
K_PLUGIN_FACTORY(KAddressBookFactory, registerPlugin<KAddressBookPart>();)
K_PLUGIN_FACTORY(KAddressBookFactory, registerPlugin<KAddressBookPart>();
)
KAddressBookPart::KAddressBookPart(QWidget *parentWidget, QObject *parent,
const QVariantList &)
KAddressBookPart::KAddressBookPart(QWidget *parentWidget, QObject *parent, const QVariantList &)
: KParts::ReadOnlyPart(parent)
{
setComponentName(QStringLiteral("kaddressbook"), i18n("KAddressBook"));
......@@ -91,7 +91,6 @@ bool KAddressBookPart::openFile()
void KAddressBookPart::guiActivateEvent(KParts::GUIActivateEvent *e)
{
KParts::ReadOnlyPart::guiActivateEvent(e);
mMainWidget->initializePluginActions();
}
......
......@@ -27,7 +27,7 @@
class MainWidget;
class KAddressBookPart: public KParts::ReadOnlyPart
class KAddressBookPart : public KParts::ReadOnlyPart
{
Q_OBJECT
......
......@@ -22,12 +22,10 @@
AddressBookListViewModel::AddressBookListViewModel(QObject *parent)
: QIdentityProxyModel(parent)
{
}
AddressBookListViewModel::~AddressBookListViewModel()
{
}
QHash<int, QByteArray> AddressBookListViewModel::roleNames() const
......
......@@ -64,8 +64,8 @@ public:
if (role == Qt::CheckStateRole) {
// Don't show the checkbox if the collection can't contain incidences
const Akonadi::Collection collection =
index.data(Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
const Akonadi::Collection collection
= index.data(Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
if (collection.isValid() && isStructuralCollection(collection)) {
return QVariant();
}
......@@ -89,8 +89,8 @@ AddressBookMainWidget::AddressBookMainWidget(QWidget *parent)
mCollectionSelectionModel = new QItemSelectionModel(mCollectionTree);
StructuralCollectionsNotCheckableProxy *checkableProxyModel =
new StructuralCollectionsNotCheckableProxy(this);
StructuralCollectionsNotCheckableProxy *checkableProxyModel
= new StructuralCollectionsNotCheckableProxy(this);
checkableProxyModel->setSelectionModel(mCollectionSelectionModel);
checkableProxyModel->setSourceModel(mCollectionTree);
......@@ -106,8 +106,8 @@ AddressBookMainWidget::AddressBookMainWidget(QWidget *parent)
connect(mCollectionView, SIGNAL(currentChanged(Akonadi::Collection)),
this, SLOT(slotCurrentCollectionChanged(Akonadi::Collection)));
#endif
KSelectionProxyModel *selectionProxyModel =
new KSelectionProxyModel(mCollectionSelectionModel, this);
KSelectionProxyModel *selectionProxyModel
= new KSelectionProxyModel(mCollectionSelectionModel, this);
selectionProxyModel->setSourceModel(GlobalContactModel::instance()->model());
selectionProxyModel->setFilterBehavior(KSelectionProxyModel::ChildrenOfExactSelection);
......@@ -126,7 +126,7 @@ AddressBookMainWidget::AddressBookMainWidget(QWidget *parent)
#endif
mContactsFilterModel = new Akonadi::ContactsFilterProxyModel(this);
mContactsFilterModel->setSourceModel(/*mCategoryFilterModel*/mItemTree);
mContactsFilterModel->setSourceModel(/*mCategoryFilterModel*/ mItemTree);