Commit 83d036c2 authored by Laurent Montel's avatar Laurent Montel 😁

Coding style

parent 57b30228
......@@ -22,9 +22,7 @@
#include <AkonadiCore/attributefactory.h>
namespace
{
namespace {
// Anonymous namespace; function is invisible outside this file.
bool dummy()
{
......@@ -35,5 +33,4 @@ bool dummy()
// Called when this library is loaded.
const bool registered = dummy();
} // namespace
......@@ -26,13 +26,13 @@
using namespace MailCommon;
ExpireCollectionAttribute::ExpireCollectionAttribute()
: mExpireMessages(false),
mUnreadExpireAge(28),
mReadExpireAge(14),
mUnreadExpireUnits(ExpireNever),
mReadExpireUnits(ExpireNever),
mExpireAction(ExpireDelete),
mExpireToFolderId(-1)
: mExpireMessages(false)
, mUnreadExpireAge(28)
, mReadExpireAge(14)
, mUnreadExpireUnits(ExpireNever)
, mReadExpireUnits(ExpireNever)
, mExpireAction(ExpireDelete)
, mExpireToFolderId(-1)
{
}
......@@ -135,17 +135,16 @@ ExpireCollectionAttribute::ExpireUnits ExpireCollectionAttribute::readExpireUnit
bool ExpireCollectionAttribute::operator==(const ExpireCollectionAttribute &other) const
{
return (mExpireMessages == other.isAutoExpire()) &&
(mUnreadExpireAge == other.unreadExpireAge()) &&
(mReadExpireAge == other.readExpireAge()) &&
(mUnreadExpireUnits == other.unreadExpireUnits()) &&
(mReadExpireUnits == other.readExpireUnits()) &&
(mExpireAction == other.expireAction()) &&
(mExpireToFolderId == other.expireToFolderId());
return (mExpireMessages == other.isAutoExpire())
&& (mUnreadExpireAge == other.unreadExpireAge())
&& (mReadExpireAge == other.readExpireAge())
&& (mUnreadExpireUnits == other.unreadExpireUnits())
&& (mReadExpireUnits == other.readExpireUnits())
&& (mExpireAction == other.expireAction())
&& (mExpireToFolderId == other.expireToFolderId());
}
int ExpireCollectionAttribute::daysToExpire(int number,
ExpireCollectionAttribute::ExpireUnits units)
int ExpireCollectionAttribute::daysToExpire(int number, ExpireCollectionAttribute::ExpireUnits units)
{
switch (units) {
case ExpireCollectionAttribute::ExpireDays: // Days
......@@ -200,4 +199,3 @@ void ExpireCollectionAttribute::deserialize(const QByteArray &data)
s >> mUnreadExpireAge;
s >> mExpireMessages;
}
......@@ -24,9 +24,7 @@
#include <Attribute>
#include <Collection>
namespace MailCommon
{
namespace MailCommon {
class MAILCOMMON_EXPORT ExpireCollectionAttribute : public Akonadi::Attribute
{
public:
......@@ -135,12 +133,10 @@ private:
bool mExpireMessages; // true if old messages are expired
int mUnreadExpireAge; // Given in unreadExpireUnits
int mReadExpireAge; // Given in readExpireUnits
ExpireCollectionAttribute::ExpireUnits mUnreadExpireUnits;
ExpireCollectionAttribute::ExpireUnits mReadExpireUnits;
ExpireCollectionAttribute::ExpireUnits mUnreadExpireUnits;
ExpireCollectionAttribute::ExpireUnits mReadExpireUnits;
ExpireCollectionAttribute::ExpireAction mExpireAction;
Akonadi::Collection::Id mExpireToFolderId;
};
}
#endif /* EXPIRATIONCOLLECTIONATTRIBUTE_H */
......@@ -30,7 +30,6 @@ ExpireCollectionAttributeTest::ExpireCollectionAttributeTest(QObject *parent)
ExpireCollectionAttributeTest::~ExpireCollectionAttributeTest()
{
}
void ExpireCollectionAttributeTest::shouldHaveDefaultValue()
......@@ -55,11 +54,16 @@ void ExpireCollectionAttributeTest::shouldAssignValue_data()
QTest::addColumn<MailCommon::ExpireCollectionAttribute::ExpireAction>("expireaction");
QTest::addColumn<Akonadi::Collection::Id>("akonadiid");
QTest::newRow("add autoexpire") << true << 28 << 14 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireDelete << qint64(5);
QTest::newRow("change action") << true << 28 << 14 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change age") << true << 150 << 1 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change units") << true << 15 << 1 << MailCommon::ExpireCollectionAttribute::ExpireDays << MailCommon::ExpireCollectionAttribute::ExpireDays << MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change units2") << true << 150 << 18 << MailCommon::ExpireCollectionAttribute::ExpireMonths << MailCommon::ExpireCollectionAttribute::ExpireWeeks << MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(6);
QTest::newRow("add autoexpire") << true << 28 << 14 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever
<< MailCommon::ExpireCollectionAttribute::ExpireDelete << qint64(5);
QTest::newRow("change action") << true << 28 << 14 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever
<< MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change age") << true << 150 << 1 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever
<< MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change units") << true << 15 << 1 << MailCommon::ExpireCollectionAttribute::ExpireDays << MailCommon::ExpireCollectionAttribute::ExpireDays
<< MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change units2") << true << 150 << 18 << MailCommon::ExpireCollectionAttribute::ExpireMonths << MailCommon::ExpireCollectionAttribute::ExpireWeeks
<< MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(6);
}
void ExpireCollectionAttributeTest::shouldAssignValue()
......@@ -87,7 +91,6 @@ void ExpireCollectionAttributeTest::shouldAssignValue()
QCOMPARE(attr.unreadExpireUnits(), unreadexpireunit);
QCOMPARE(attr.readExpireUnits(), readexpireunit);
QCOMPARE(attr.expireToFolderId(), akonadiid);
}
void ExpireCollectionAttributeTest::shouldCloneAttr_data()
......@@ -100,12 +103,16 @@ void ExpireCollectionAttributeTest::shouldCloneAttr_data()
QTest::addColumn<MailCommon::ExpireCollectionAttribute::ExpireAction>("expireaction");
QTest::addColumn<Akonadi::Collection::Id>("akonadiid");
QTest::newRow("add autoexpire") << true << 28 << 14 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireDelete << qint64(5);
QTest::newRow("change action") << true << 28 << 14 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change age") << true << 150 << 1 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change units") << true << 15 << 1 << MailCommon::ExpireCollectionAttribute::ExpireDays << MailCommon::ExpireCollectionAttribute::ExpireDays << MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change units2") << true << 150 << 18 << MailCommon::ExpireCollectionAttribute::ExpireMonths << MailCommon::ExpireCollectionAttribute::ExpireWeeks << MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(6);
QTest::newRow("add autoexpire") << true << 28 << 14 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever
<< MailCommon::ExpireCollectionAttribute::ExpireDelete << qint64(5);
QTest::newRow("change action") << true << 28 << 14 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever
<< MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change age") << true << 150 << 1 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever
<< MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change units") << true << 15 << 1 << MailCommon::ExpireCollectionAttribute::ExpireDays << MailCommon::ExpireCollectionAttribute::ExpireDays
<< MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change units2") << true << 150 << 18 << MailCommon::ExpireCollectionAttribute::ExpireMonths << MailCommon::ExpireCollectionAttribute::ExpireWeeks
<< MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(6);
}
void ExpireCollectionAttributeTest::shouldCloneAttr()
......@@ -140,11 +147,16 @@ void ExpireCollectionAttributeTest::shouldSerializedValue_data()
QTest::addColumn<MailCommon::ExpireCollectionAttribute::ExpireAction>("expireaction");
QTest::addColumn<Akonadi::Collection::Id>("akonadiid");
QTest::newRow("add autoexpire") << true << 28 << 14 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireDelete << qint64(5);
QTest::newRow("change action") << true << 28 << 14 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change age") << true << 150 << 1 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change units") << true << 15 << 1 << MailCommon::ExpireCollectionAttribute::ExpireDays << MailCommon::ExpireCollectionAttribute::ExpireDays << MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change units2") << true << 150 << 18 << MailCommon::ExpireCollectionAttribute::ExpireMonths << MailCommon::ExpireCollectionAttribute::ExpireWeeks << MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(6);
QTest::newRow("add autoexpire") << true << 28 << 14 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever
<< MailCommon::ExpireCollectionAttribute::ExpireDelete << qint64(5);
QTest::newRow("change action") << true << 28 << 14 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever
<< MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change age") << true << 150 << 1 << MailCommon::ExpireCollectionAttribute::ExpireNever << MailCommon::ExpireCollectionAttribute::ExpireNever
<< MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change units") << true << 15 << 1 << MailCommon::ExpireCollectionAttribute::ExpireDays << MailCommon::ExpireCollectionAttribute::ExpireDays
<< MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(5);
QTest::newRow("change units2") << true << 150 << 18 << MailCommon::ExpireCollectionAttribute::ExpireMonths << MailCommon::ExpireCollectionAttribute::ExpireWeeks
<< MailCommon::ExpireCollectionAttribute::ExpireMove << qint64(6);
}
void ExpireCollectionAttributeTest::shouldSerializedValue()
......
......@@ -54,7 +54,7 @@ CollectionExpiryPage::~CollectionExpiryPage()
bool CollectionExpiryPage::canHandle(const Akonadi::Collection &col) const
{
QSharedPointer<FolderSettings> fd = FolderSettings::forCollection(col, false);
return (fd->canDeleteMessages() && !fd->isStructural());
return fd->canDeleteMessages() && !fd->isStructural();
}
void CollectionExpiryPage::init()
......@@ -140,14 +140,14 @@ void CollectionExpiryPage::load(const Akonadi::Collection &collection)
attr->daysToExpire(daysToExpireUnread, daysToExpireRead);
if (expiryGloballyOn
&& attr->readExpireUnits() != ExpireCollectionAttribute::ExpireNever
&& daysToExpireRead >= 0) {
&& attr->readExpireUnits() != ExpireCollectionAttribute::ExpireNever
&& daysToExpireRead >= 0) {
expireReadMailCB->setChecked(true);
expireReadMailSB->setValue(daysToExpireRead);
}
if (expiryGloballyOn
&& attr->unreadExpireUnits() != ExpireCollectionAttribute::ExpireNever
&& daysToExpireUnread >= 0) {
&& attr->unreadExpireUnits() != ExpireCollectionAttribute::ExpireNever
&& daysToExpireUnread >= 0) {
expireUnreadMailCB->setChecked(true);
expireUnreadMailSB->setValue(daysToExpireUnread);
}
......@@ -205,17 +205,17 @@ void CollectionExpiryPage::saveAndExpire(Akonadi::Collection &collection, bool s
}
}
if (!attribute) {
attribute = collection.attribute<MailCommon::ExpireCollectionAttribute>(Akonadi::Collection::AddIfMissing);
attribute = collection.attribute<MailCommon::ExpireCollectionAttribute>(Akonadi::Collection::AddIfMissing);
}
attribute->setAutoExpire(enableGlobally);
// we always write out days now
attribute->setReadExpireAge(expireReadMailSB->value());
attribute->setUnreadExpireAge(expireUnreadMailSB->value());
attribute->setReadExpireUnits(expireReadMailCB->isChecked() ? MailCommon::ExpireCollectionAttribute::ExpireDays :
MailCommon::ExpireCollectionAttribute::ExpireNever);
attribute->setUnreadExpireUnits(expireUnreadMailCB->isChecked() ? MailCommon::ExpireCollectionAttribute::ExpireDays :
MailCommon::ExpireCollectionAttribute::ExpireNever);
attribute->setReadExpireUnits(expireReadMailCB->isChecked() ? MailCommon::ExpireCollectionAttribute::ExpireDays
: MailCommon::ExpireCollectionAttribute::ExpireNever);
attribute->setUnreadExpireUnits(expireUnreadMailCB->isChecked() ? MailCommon::ExpireCollectionAttribute::ExpireDays
: MailCommon::ExpireCollectionAttribute::ExpireNever);
if (deletePermanentlyRB->isChecked()) {
attribute->setExpireAction(ExpireCollectionAttribute::ExpireDelete);
......@@ -271,4 +271,3 @@ void CollectionExpiryPage::slotChanged()
{
mChanged = true;
}
......@@ -31,9 +31,7 @@ class QCheckBox;
class QPushButton;
class QRadioButton;
namespace MailCommon
{
namespace MailCommon {
class FolderRequester;
class MAILCOMMON_EXPORT CollectionExpiryPage : public Akonadi::CollectionPropertiesPage
......@@ -75,7 +73,6 @@ private:
};
AKONADI_COLLECTION_PROPERTIES_PAGE_FACTORY(CollectionExpiryPageFactory, CollectionExpiryPage)
}
#endif
......@@ -26,20 +26,16 @@ class KLineEdit;
class QCheckBox;
template <typename T> class QSharedPointer;
namespace PimCommon
{
template<typename T> class QSharedPointer;
namespace PimCommon {
class IncidencesForWidget;
class ContentTypeWidget;
}
namespace KIdentityManagement
{
namespace KIdentityManagement {
class IdentityCombo;
}
class QVBoxLayout;
namespace MailCommon
{
namespace MailCommon {
class FolderSettings;
class MAILCOMMON_EXPORT CollectionGeneralPage : public Akonadi::CollectionPropertiesPage
{
......@@ -66,11 +62,11 @@ private:
PimCommon::ContentTypeWidget *mContentsComboBox;
PimCommon::IncidencesForWidget *mIncidencesForComboBox;
QCheckBox *mSharedSeenFlagsCheckBox;
QCheckBox *mNotifyOnNewMailCheckBox;
QCheckBox *mKeepRepliesInSameFolderCheckBox;
QCheckBox *mHideInSelectionDialogCheckBox;
QCheckBox *mUseDefaultIdentityCheckBox;
KLineEdit *mNameEdit;
QCheckBox *mNotifyOnNewMailCheckBox;
QCheckBox *mKeepRepliesInSameFolderCheckBox;
QCheckBox *mHideInSelectionDialogCheckBox;
QCheckBox *mUseDefaultIdentityCheckBox;
KLineEdit *mNameEdit;
KIdentityManagement::IdentityCombo *mIdentityComboBox;
QSharedPointer<MailCommon::FolderSettings> mFolderCollection;
bool mIsLocalSystemFolder;
......@@ -78,7 +74,6 @@ private:
};
AKONADI_COLLECTION_PROPERTIES_PAGE_FACTORY(CollectionGeneralPageFactory, CollectionGeneralPage)
}
#endif
......@@ -27,12 +27,10 @@
FilterActionAddHeaderTest::FilterActionAddHeaderTest(QObject *parent)
: QObject(parent)
{
}
FilterActionAddHeaderTest::~FilterActionAddHeaderTest()
{
}
void FilterActionAddHeaderTest::shouldCreateWidget()
......
......@@ -28,12 +28,10 @@
FilterActionAddToAddressBookTest::FilterActionAddToAddressBookTest(QObject *parent)
: QObject(parent)
{
}
FilterActionAddToAddressBookTest::~FilterActionAddToAddressBookTest()
{
}
void FilterActionAddToAddressBookTest::shouldHaveDefaultValue()
......
......@@ -22,12 +22,10 @@
FilterActionCopyTest::FilterActionCopyTest(QObject *parent)
: QObject(parent)
{
}
FilterActionCopyTest::~FilterActionCopyTest()
{
}
void FilterActionCopyTest::shouldBeEmpty()
......
......@@ -22,12 +22,10 @@
FilterActionDeleteTest::FilterActionDeleteTest(QObject *parent)
: QObject(parent)
{
}
FilterActionDeleteTest::~FilterActionDeleteTest()
{
}
void FilterActionDeleteTest::shouldHaveDefaultValue()
......
......@@ -25,12 +25,10 @@
FilterActionExecTest::FilterActionExecTest(QObject *parent)
: QObject(parent)
{
}
FilterActionExecTest::~FilterActionExecTest()
{
}
void FilterActionExecTest::shouldHaveDefaultValue()
......
......@@ -22,12 +22,10 @@
FilterActionForwardTest::FilterActionForwardTest(QObject *parent)
: QObject(parent)
{
}
FilterActionForwardTest::~FilterActionForwardTest()
{
}
void FilterActionForwardTest::shouldBeEmpty()
......
......@@ -27,12 +27,10 @@
FilterActionMissingAccountDialogTest::FilterActionMissingAccountDialogTest(QObject *parent)
: QObject(parent)
{
}
FilterActionMissingAccountDialogTest::~FilterActionMissingAccountDialogTest()
{
}
void FilterActionMissingAccountDialogTest::shouldHaveDefaultValue()
......
......@@ -29,12 +29,10 @@
FilterActionMissingIdentityDialogTest::FilterActionMissingIdentityDialogTest(QObject *parent)
: QObject(parent)
{
}
FilterActionMissingIdentityDialogTest::~FilterActionMissingIdentityDialogTest()
{
}
void FilterActionMissingIdentityDialogTest::initTestCase()
......
......@@ -33,7 +33,6 @@ FilterActionMissingSoundUrlDialogTest::FilterActionMissingSoundUrlDialogTest(QOb
FilterActionMissingSoundUrlDialogTest::~FilterActionMissingSoundUrlDialogTest()
{
}
void FilterActionMissingSoundUrlDialogTest::shouldHaveDefaultValue()
......
......@@ -28,12 +28,10 @@
FilterActionMissingTagDialogTest::FilterActionMissingTagDialogTest(QObject *parent)
: QObject(parent)
{
}
FilterActionMissingTagDialogTest::~FilterActionMissingTagDialogTest()
{
}
void FilterActionMissingTagDialogTest::shouldHaveDefaultValue()
......
......@@ -27,12 +27,10 @@
FilterActionMissingTemplateDialogTest::FilterActionMissingTemplateDialogTest(QObject *parent)
: QObject(parent)
{
}
FilterActionMissingTemplateDialogTest::~FilterActionMissingTemplateDialogTest()
{
}
void FilterActionMissingTemplateDialogTest::shouldHaveDefaultValue()
......
......@@ -29,12 +29,10 @@
FilterActionMissingTransportDialogTest::FilterActionMissingTransportDialogTest(QObject *parent)
: QObject(parent)
{
}
FilterActionMissingTransportDialogTest::~FilterActionMissingTransportDialogTest()
{
}
void FilterActionMissingTransportDialogTest::shouldHaveDefaultValue()
......
......@@ -23,12 +23,10 @@
FilterActionMoveTest::FilterActionMoveTest(QObject *parent)
: QObject(parent)
{
}
FilterActionMoveTest::~FilterActionMoveTest()
{
}
void FilterActionMoveTest::shouldHaveSieveRequires()
......
......@@ -22,12 +22,11 @@
#include <QObject>
namespace MailCommon
{
namespace MailCommon {
class FilterAction;
}
class FilterActionPipeThroughTest : public QObject
class FilterActionPipeThroughTest : public QObject
{
Q_OBJECT
public:
......
......@@ -23,12 +23,10 @@
FilterActionPlaySoundTest::FilterActionPlaySoundTest(QObject *parent)
: QObject(parent)
{