Commit 5741f442 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Coding style

parent 6a7f5526
......@@ -39,8 +39,8 @@
#include <QVBoxLayout>
AddArchiveMailDialog::AddArchiveMailDialog(ArchiveMailInfo *info, QWidget *parent)
: QDialog(parent),
mInfo(info)
: QDialog(parent)
, mInfo(info)
{
if (info) {
setWindowTitle(i18n("Modify Archive Mail"));
......@@ -236,4 +236,3 @@ int AddArchiveMailDialog::maximumArchiveCount() const
{
return mMaximumArchive->value();
}
......@@ -32,8 +32,7 @@ class QPushButton;
class FormatComboBox;
class UnitComboBox;
namespace MailCommon
{
namespace MailCommon {
class FolderRequester;
}
......
......@@ -170,4 +170,3 @@ void ArchiveMailAgent::archiveFolder(const QString &path, Akonadi::Collection::I
}
AKONADI_AGENT_MAIN(ArchiveMailAgent)
......@@ -64,4 +64,3 @@ private:
};
#endif /* ARCHIVEMAILAGENT_H */
......@@ -23,8 +23,7 @@
#include "archivemailinfo.h"
#include <QDate>
namespace ArchiveMailAgentUtil
{
namespace ArchiveMailAgentUtil {
static QString archivePattern = QStringLiteral("ArchiveMailCollection %1");
QDate diffDate(ArchiveMailInfo *info);
bool needToArchive(ArchiveMailInfo *info);
......
......@@ -36,11 +36,10 @@
#include <QPushButton>
#include <QLocale>
namespace
{
namespace {
inline QString archiveMailCollectionPattern()
{
return QStringLiteral("ArchiveMailCollection \\d+");
return QStringLiteral("ArchiveMailCollection \\d+");
}
}
......@@ -72,12 +71,12 @@ ArchiveMailDialog::ArchiveMailDialog(QWidget *parent)
readConfig();
KAboutData aboutData = KAboutData(
QStringLiteral("archivemailagent"),
i18n("Archive Mail Agent"),
QStringLiteral(KDEPIM_VERSION),
i18n("Archive emails automatically."),
KAboutLicense::GPL_V2,
i18n("Copyright (C) 2012-2017 Laurent Montel"));
QStringLiteral("archivemailagent"),
i18n("Archive Mail Agent"),
QStringLiteral(KDEPIM_VERSION),
i18n("Archive emails automatically."),
KAboutLicense::GPL_V2,
i18n("Copyright (C) 2012-2017 Laurent Montel"));
aboutData.addAuthor(i18n("Laurent Montel"),
i18n("Maintainer"), QStringLiteral("montel@kde.org"));
......@@ -130,4 +129,3 @@ void ArchiveMailDialog::slotSave()
mWidget->save();
accept();
}
......@@ -46,4 +46,3 @@ private:
};
#endif /* ARCHIVEMAILWIDGET_H */
......@@ -75,7 +75,7 @@ ArchiveMailInfo &ArchiveMailInfo::operator=(const ArchiveMailInfo &old)
mSaveSubCollection = old.saveSubCollection();
mPath = old.url();
mIsEnabled = old.isEnabled();
return (*this);
return *this;
}
QString normalizeFolderName(const QString &folderName)
......@@ -123,15 +123,15 @@ QStringList ArchiveMailInfo::listOfArchive(const QString &folderName, bool &dirE
QDir dir(dirPath);
QStringList nameFilters;
nameFilters << i18nc("Start of the filename for a mail archive file", "Archive") + QLatin1Char('_') +
normalizeFolderName(folderName) + QLatin1Char('_') + QLatin1String("*") + QString::fromLatin1(extensions[mArchiveType]);
nameFilters << i18nc("Start of the filename for a mail archive file", "Archive") + QLatin1Char('_')
+normalizeFolderName(folderName) + QLatin1Char('_') + QLatin1String("*") + QString::fromLatin1(extensions[mArchiveType]);
const QStringList lst = dir.entryList(nameFilters, QDir::Files | QDir::NoDotAndDotDot, QDir::Time | QDir::Reversed);
return lst;
}
bool ArchiveMailInfo::isValid() const
{
return (mSaveCollectionId != -1);
return mSaveCollectionId != -1;
}
void ArchiveMailInfo::setArchiveAge(int age)
......@@ -266,13 +266,13 @@ void ArchiveMailInfo::setEnabled(bool b)
bool ArchiveMailInfo::operator==(const ArchiveMailInfo &other) const
{
return saveCollectionId() == other.saveCollectionId() &&
saveSubCollection() == other.saveSubCollection() &&
url() == other.url() &&
archiveType() == other.archiveType() &&
archiveUnit() == other.archiveUnit() &&
archiveAge() == other.archiveAge() &&
lastDateSaved() == other.lastDateSaved() &&
maximumArchiveCount() == other.maximumArchiveCount() &&
isEnabled() == other.isEnabled();
return saveCollectionId() == other.saveCollectionId()
&& saveSubCollection() == other.saveSubCollection()
&& url() == other.url()
&& archiveType() == other.archiveType()
&& archiveUnit() == other.archiveUnit()
&& archiveAge() == other.archiveAge()
&& lastDateSaved() == other.lastDateSaved()
&& maximumArchiveCount() == other.maximumArchiveCount()
&& isEnabled() == other.isEnabled();
}
......@@ -22,14 +22,12 @@
#include <MailCommon/MailInterfaces>
namespace Akonadi
{
namespace Akonadi {
class EntityTreeModel;
class EntityMimeTypeFilterModel;
}
namespace MailCommon
{
namespace MailCommon {
class FolderCollectionMonitor;
class JobScheduler;
}
......@@ -37,7 +35,7 @@ class JobScheduler;
class ArchiveMailKernel : public QObject, public MailCommon::IKernel, public MailCommon::ISettings
{
public:
explicit ArchiveMailKernel(QObject *parent = nullptr);
explicit ArchiveMailKernel(QObject *parent = nullptr);
KIdentityManagement::IdentityManager *identityManager() override;
MessageComposer::MessageSender *msgSender() override;
......
......@@ -83,7 +83,7 @@ void ArchiveMailManager::load()
if (info) {
//Store task started
mListArchiveInfo.append(info);
ScheduledArchiveTask *task = new ScheduledArchiveTask(this, info, Akonadi::Collection(info->saveCollectionId()), /*immediate*/false);
ScheduledArchiveTask *task = new ScheduledArchiveTask(this, info, Akonadi::Collection(info->saveCollectionId()), /*immediate*/ false);
mArchiveMailKernel->jobScheduler()->registerTask(task);
}
} else {
......@@ -211,4 +211,3 @@ void ArchiveMailManager::archiveFolder(const QString &path, Akonadi::Collection:
slotArchiveNow(info);
delete info;
}
......@@ -62,4 +62,3 @@ private:
};
#endif /* ARCHIVEMAILMANAGER_H */
......@@ -34,16 +34,16 @@
#include <QHBoxLayout>
namespace
{
namespace {
inline QString archiveMailCollectionPattern()
{
return QStringLiteral("ArchiveMailCollection \\d+");
return QStringLiteral("ArchiveMailCollection \\d+");
}
}
ArchiveMailItem::ArchiveMailItem(QTreeWidget *parent)
: QTreeWidgetItem(parent), mInfo(0)
: QTreeWidgetItem(parent)
, mInfo(0)
{
}
......@@ -63,8 +63,8 @@ ArchiveMailInfo *ArchiveMailItem::info() const
}
ArchiveMailWidget::ArchiveMailWidget(QWidget *parent)
: QWidget(parent),
mChanged(false)
: QWidget(parent)
, mChanged(false)
{
mWidget = new Ui::ArchiveMailWidget;
mWidget->setupUi(this);
......@@ -333,4 +333,3 @@ void ArchiveMailWidget::slotItemChanged(QTreeWidgetItem *item, int col)
}
}
}
......@@ -26,12 +26,10 @@
ArchiveMailDialogTest::ArchiveMailDialogTest(QObject *parent)
: QObject(parent)
{
}
ArchiveMailDialogTest::~ArchiveMailDialogTest()
{
}
void ArchiveMailDialogTest::shouldHaveDefaultValue()
......@@ -45,7 +43,6 @@ void ArchiveMailDialogTest::shouldHaveDefaultValue()
QVERIFY(treeWidget);
QCOMPARE(treeWidget->topLevelItemCount(), 0);
}
QTEST_MAIN(ArchiveMailDialogTest)
......@@ -34,4 +34,3 @@ private Q_SLOTS:
};
#endif // ARCHIVEMAILDIALOGTEST_H
......@@ -27,12 +27,10 @@
ArchiveMailInfoTest::ArchiveMailInfoTest(QObject *parent)
: QObject(parent)
{
}
ArchiveMailInfoTest::~ArchiveMailInfoTest()
{
}
void ArchiveMailInfoTest::shouldHaveDefaultValue()
......
......@@ -36,4 +36,3 @@ private Q_SLOTS:
};
#endif // ARCHIVEMAILINFOTEST_H
......@@ -24,12 +24,10 @@
FormatComboBoxTest::FormatComboBoxTest(QObject *parent)
: QObject(parent)
{
}
FormatComboBoxTest::~FormatComboBoxTest()
{
}
void FormatComboBoxTest::shouldHaveDefaultValue()
......
......@@ -24,12 +24,10 @@
UnitComboBoxTest::UnitComboBoxTest(QObject *parent)
: QObject(parent)
{
}
UnitComboBoxTest::~UnitComboBoxTest()
{
}
void UnitComboBoxTest::shouldHaveDefaultValue()
......
......@@ -46,7 +46,6 @@ ArchiveJob::~ArchiveJob()
void ArchiveJob::execute()
{
if (mInfo) {
Akonadi::Collection collection(mInfo->saveCollectionId());
const QString realPath = MailCommon::Util::fullCollectionPath(collection);
if (realPath.isEmpty()) {
......@@ -131,4 +130,3 @@ MailCommon::ScheduledJob *ScheduledArchiveTask::run()
{
return folder().isValid() ? new ArchiveJob(mManager, mInfo, folder(), isImmediate()) : nullptr;
}
......@@ -67,6 +67,7 @@ public:
{
return 2;
}
private:
ArchiveMailInfo *mInfo;
ArchiveMailManager *mManager;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment