Commit 9bfdb938 authored by Laurent Montel's avatar Laurent Montel 😁

Coding style

parent 6a31dce3
......@@ -23,17 +23,14 @@
FilterBalsaMailTest::FilterBalsaMailTest(QObject *parent)
: QObject(parent)
{
}
FilterBalsaMailTest::~FilterBalsaMailTest()
{
}
void FilterBalsaMailTest::shouldImportData()
{
}
void FilterBalsaMailTest::canNotImportDataEmptyPath()
......@@ -69,6 +66,4 @@ void FilterBalsaMailTest::canNotImportDataWhenHomeDirSelected()
QVERIFY(importerTest->filterImporterDataList().isEmpty());
}
QTEST_MAIN(FilterBalsaMailTest)
......@@ -23,17 +23,14 @@
FilterClawsMailTest::FilterClawsMailTest(QObject *parent)
: QObject(parent)
{
}
FilterClawsMailTest::~FilterClawsMailTest()
{
}
void FilterClawsMailTest::shouldImportData()
{
}
void FilterClawsMailTest::canNotImportDataEmptyPath()
......@@ -68,4 +65,5 @@ void FilterClawsMailTest::canNotImportDataWhenHomeDirSelected()
filter.importMails(QDir::homePath());
QVERIFY(importerTest->filterImporterDataList().isEmpty());
}
QTEST_MAIN(FilterClawsMailTest)
......@@ -25,9 +25,10 @@ class FilterIcecoveAbstract : public MailImporter::FilterIcedove
public:
FilterIcecoveAbstract()
{
}
QString settingsPath() override {
QString settingsPath() override
{
return MailImporter::FilterIcedove::settingsPath();
}
};
......@@ -35,12 +36,10 @@ public:
FilterIcedoveTest::FilterIcedoveTest(QObject *parent)
: QObject(parent)
{
}
FilterIcedoveTest::~FilterIcedoveTest()
{
}
void FilterIcedoveTest::shouldHaveDefaultSettingsPath()
......@@ -51,7 +50,6 @@ void FilterIcedoveTest::shouldHaveDefaultSettingsPath()
void FilterIcedoveTest::shouldImportData()
{
}
void FilterIcedoveTest::canNotImportDataEmptyPath()
......@@ -86,4 +84,5 @@ void FilterIcedoveTest::canNotImportDataWhenHomeDirSelected()
filter.importMails(QDir::homePath());
QVERIFY(importerTest->filterImporterDataList().isEmpty());
}
QTEST_MAIN(FilterIcedoveTest)
......@@ -21,7 +21,6 @@
FilterImporterTest::FilterImporterTest(MailImporter::FilterInfo *info)
: MailImporter::FilterImporterBase(info)
{
}
bool FilterImporterTest::importMessage(const QString &folderName, const QString &msgPath, bool duplicateCheck, const MailImporter::MessageStatus &status)
......@@ -32,12 +31,10 @@ bool FilterImporterTest::importMessage(const QString &folderName, const QString
void FilterImporterTest::clear()
{
}
void FilterImporterTest::clearCountDuplicate()
{
}
int FilterImporterTest::countDuplicates() const
......@@ -52,7 +49,6 @@ QString FilterImporterTest::topLevelFolder() const
bool FilterImporterTest::importMessage(const KArchiveFile *file, const QString &folderPath, int &nbTotal, int &fileDone)
{
return false;
}
......
......@@ -20,7 +20,6 @@
FilterImporterTestUtil::FilterImporterTestUtil(const QString &filename)
: mFileName(filename)
{
}
QString FilterImporterTestUtil::extractData()
......
......@@ -23,17 +23,14 @@
FilterLnotesTest::FilterLnotesTest(QObject *parent)
: QObject(parent)
{
}
FilterLnotesTest::~FilterLnotesTest()
{
}
void FilterLnotesTest::shouldImportData()
{
}
void FilterLnotesTest::canNotImportDataEmptyPath()
......
......@@ -23,17 +23,14 @@
FilterMailAppTest::FilterMailAppTest(QObject *parent)
: QObject(parent)
{
}
FilterMailAppTest::~FilterMailAppTest()
{
}
void FilterMailAppTest::shouldImportData()
{
}
void FilterMailAppTest::canNotImportDataEmptyPath()
......
......@@ -23,17 +23,14 @@
FilterMAilmangzipTest::FilterMAilmangzipTest(QObject *parent)
: QObject(parent)
{
}
FilterMAilmangzipTest::~FilterMAilmangzipTest()
{
}
void FilterMAilmangzipTest::shouldImportData()
{
}
void FilterMAilmangzipTest::canNotImportDataEmptyPath()
......
......@@ -23,17 +23,14 @@
FilterMBoxTest::FilterMBoxTest(QObject *parent)
: QObject(parent)
{
}
FilterMBoxTest::~FilterMBoxTest()
{
}
void FilterMBoxTest::shouldImportData()
{
}
void FilterMBoxTest::canNotImportDataEmptyPath()
......
......@@ -23,17 +23,14 @@
FilterPlainTest::FilterPlainTest(QObject *parent)
: QObject(parent)
{
}
FilterPlainTest::~FilterPlainTest()
{
}
void FilterPlainTest::shouldImportData()
{
}
void FilterPlainTest::canNotImportDataEmptyPath()
......
......@@ -24,17 +24,14 @@
FilterSylpheedTest::FilterSylpheedTest(QObject *parent)
: QObject(parent)
{
}
FilterSylpheedTest::~FilterSylpheedTest()
{
}
void FilterSylpheedTest::shouldImportData()
{
}
void FilterSylpheedTest::canNotImportDataEmptyPath()
......@@ -69,4 +66,5 @@ void FilterSylpheedTest::canNotImportDataWhenHomeDirSelected()
filter.importMails(QDir::homePath());
QVERIFY(importerTest->filterImporterDataList().isEmpty());
}
QTEST_MAIN(FilterSylpheedTest)
......@@ -23,17 +23,14 @@
FilterTheBatTest::FilterTheBatTest(QObject *parent)
: QObject(parent)
{
}
FilterTheBatTest::~FilterTheBatTest()
{
}
void FilterTheBatTest::shouldImportData()
{
}
void FilterTheBatTest::canNotImportDataEmptyPath()
......
......@@ -25,9 +25,10 @@ class FilterThunderBirdAbstract : public MailImporter::FilterThunderbird
public:
FilterThunderBirdAbstract()
{
}
QString settingsPath() override {
QString settingsPath() override
{
return MailImporter::FilterThunderbird::settingsPath();
}
};
......@@ -35,12 +36,10 @@ public:
FilterThunderBirdTest::FilterThunderBirdTest(QObject *parent)
: QObject(parent)
{
}
FilterThunderBirdTest::~FilterThunderBirdTest()
{
}
void FilterThunderBirdTest::shouldHaveDefaultSettingsPath()
......@@ -51,7 +50,6 @@ void FilterThunderBirdTest::shouldHaveDefaultSettingsPath()
void FilterThunderBirdTest::shouldImportData()
{
}
void FilterThunderBirdTest::canNotImportDataEmptyPath()
......
......@@ -22,7 +22,6 @@
MessageStatusTest::MessageStatusTest(QObject *parent)
: QObject(parent)
{
}
void MessageStatusTest::shouldHaveDefaultValues()
......@@ -67,4 +66,3 @@ void MessageStatusTest::shouldAssignValues()
}
QTEST_MAIN(MessageStatusTest)
......@@ -24,7 +24,6 @@
SelectThunderbirdProfileDialogTest::SelectThunderbirdProfileDialogTest(QObject *parent)
: QObject(parent)
{
}
void SelectThunderbirdProfileDialogTest::shouldHaveDefaultValue()
......
......@@ -23,12 +23,10 @@ using namespace MailImporter;
FilterImporterBase::FilterImporterBase(MailImporter::FilterInfo *info)
: mInfo(info)
{
}
FilterImporterBase::~FilterImporterBase()
{
}
bool FilterImporterBase::importMessage(const QString &folderName, const QString &msgPath, bool duplicateCheck, const MessageStatus &status)
......@@ -51,12 +49,10 @@ bool FilterImporterBase::importMessage(const KArchiveFile *file, const QString &
void FilterImporterBase::clear()
{
}
void FilterImporterBase::clearCountDuplicate()
{
}
int FilterImporterBase::countDuplicates() const
......
......@@ -23,18 +23,14 @@
#include <QString>
#include <KArchive>
namespace MailImporter
{
namespace MailImporter {
class FilterInfo;
class MAILIMPORTER_EXPORT FilterImporterBase
{
public:
explicit FilterImporterBase(MailImporter::FilterInfo *info);
virtual ~FilterImporterBase();
virtual bool importMessage(const QString &folderName,
const QString &msgPath,
bool duplicateCheck,
const MailImporter::MessageStatus &status);
virtual bool importMessage(const QString &folderName, const QString &msgPath, bool duplicateCheck, const MailImporter::MessageStatus &status);
virtual bool importMessage(const KArchiveFile *file, const QString &folderPath, int &nbTotal, int &fileDone);
virtual void clear();
virtual void clearCountDuplicate();
......
......@@ -25,19 +25,20 @@ class Q_DECL_HIDDEN FilterInfo::Private
{
public:
Private()
: m_removeDupMsg(false),
m_filterInfoGui(nullptr)
: m_removeDupMsg(false)
, m_filterInfoGui(nullptr)
{
}
~Private()
{
delete m_filterInfoGui;
m_filterInfoGui = nullptr;
}
bool m_removeDupMsg;
FilterInfoGui *m_filterInfoGui;
static bool s_terminateASAP;
};
bool FilterInfo::Private::s_terminateASAP = false;
......@@ -87,14 +88,14 @@ void FilterInfo::setCurrent(const QString &current)
}
}
void FilterInfo::setCurrent(int percent)
void FilterInfo::setCurrent(int percent)
{
if (d->m_filterInfoGui) {
d->m_filterInfoGui->setCurrent(percent);
}
}
void FilterInfo::setOverall(int percent)
void FilterInfo::setOverall(int percent)
{
if (d->m_filterInfoGui) {
d->m_filterInfoGui->setOverall(percent);
......@@ -156,4 +157,3 @@ QWidget *FilterInfo::parentWidget() const
}
return nullptr;
}
......@@ -22,9 +22,7 @@
#include "mailimporter_export.h"
#include <QString>
#include <QObject>
namespace MailImporter
{
namespace MailImporter {
class FilterInfoGui;
class MAILIMPORTER_EXPORT FilterInfo
......@@ -61,4 +59,3 @@ private:
}
#endif /* FILTERINFO_H */
......@@ -26,6 +26,7 @@ FilterInfoGui::FilterInfoGui()
FilterInfoGui::~FilterInfoGui()
{
}
void FilterInfoGui::setStatusMessage(const QString &status)
{
Q_UNUSED(status);
......@@ -46,12 +47,12 @@ void FilterInfoGui::setCurrent(const QString &current)
Q_UNUSED(current);
}
void FilterInfoGui::setCurrent(int percent)
void FilterInfoGui::setCurrent(int percent)
{
Q_UNUSED(percent);
}
void FilterInfoGui::setOverall(int percent)
void FilterInfoGui::setOverall(int percent)
{
Q_UNUSED(percent);
}
......
......@@ -20,8 +20,7 @@
#include "filters.h"
namespace MailImporter
{
namespace MailImporter {
class MAILIMPORTER_EXPORT FilterInfoGui
{
public:
......@@ -44,4 +43,3 @@ public:
}
#endif /* FILTERINFOGUI_H */
......@@ -39,13 +39,14 @@ class Q_DECL_HIDDEN Filter::Private
{
public:
Private(const QString &_name, const QString &_author, const QString &_info)
: name(_name),
author(_author),
info(_info),
filterImporter(nullptr),
filterInfo(nullptr)
: name(_name)
, author(_author)
, info(_info)
, filterImporter(nullptr)
, filterInfo(nullptr)
{
}
~Private()
{
delete filterImporter;
......@@ -53,6 +54,7 @@ public:
delete filterInfo;
filterInfo = nullptr;
}
QString name;
QString author;
QString info;
......@@ -61,8 +63,7 @@ public:
MailImporter::FilterInfo *filterInfo;
};
Filter::Filter(const QString &name, const QString &author,
const QString &info)
Filter::Filter(const QString &name, const QString &author, const QString &info)
: d(new Private(name, author, info))
{
}
......@@ -148,15 +149,13 @@ void Filter::setName(const QString &_name)
{
d->name = _name;
}
void Filter::setInfo(const QString &_info)
{
d->info = _info;
}
bool Filter::importMessage(const QString &folderName,
const QString &msgPath,
bool duplicateCheck,
MailImporter::MessageStatus status)
bool Filter::importMessage(const QString &folderName, const QString &msgPath, bool duplicateCheck, MailImporter::MessageStatus status)
{
return filterImporter()->importMessage(folderName, msgPath, duplicateCheck, status);
}
......@@ -179,4 +178,3 @@ int Filter::countDirectory(const QDir &dir, bool searchHiddenDirectory)
}
return countDir;
}
......@@ -31,13 +31,11 @@
#include <QDir>
namespace MailImporter
{
namespace MailImporter {
class MAILIMPORTER_EXPORT Filter
{
public:
explicit Filter(const QString &name, const QString &author,
const QString &info = QString());
explicit Filter(const QString &name, const QString &author, const QString &info = QString());
virtual ~Filter();
virtual void import() = 0;
......@@ -65,16 +63,11 @@ public:
protected:
static int countDirectory(const QDir &dir, bool searchHiddenDirectory);
bool importMessage(const QString &folderName,
const QString &msgPath,
bool duplicateCheck,
MailImporter::MessageStatus status = MailImporter::MessageStatus());
bool importMessage(const QString &folderName, const QString &msgPath, bool duplicateCheck, MailImporter::MessageStatus status = MailImporter::MessageStatus());
private:
class Private;
Private *const d;
};
}
#endif
......@@ -26,10 +26,9 @@ class MailImporter::FilterBalsaPrivate
{
public:
FilterBalsaPrivate()
: mImportDirDone(0),
mTotalDir(0)
: mImportDirDone(0)
, mTotalDir(0)
{
}
int mImportDirDone;
......@@ -42,8 +41,8 @@ FilterBalsa::FilterBalsa()
i18n("<p><b>Balsa import filter</b></p>"
"<p>Select the base directory of your local Balsa mailfolder (usually ~/mail/).</p>"
"<p>Since it is possible to recreate the folder structure, the folders "
"will be stored under: \"Balsa-Import\".</p>")),
d(new MailImporter::FilterBalsaPrivate)
"will be stored under: \"Balsa-Import\".</p>"))
, d(new MailImporter::FilterBalsaPrivate)
{
}
......@@ -89,11 +88,10 @@ void FilterBalsa::processDirectory(const QString &path)
if (!(*filename == QLatin1String(".") || *filename == QLatin1String(".."))) {
filterInfo()->setCurrent(0);
importDirContents(dir.filePath(*filename));
filterInfo()->setOverall((d->mTotalDir > 0) ? (int)((float) d->mImportDirDone / d->mTotalDir * 100) : 0);
filterInfo()->setOverall((d->mTotalDir > 0) ? (int)((float)d->mImportDirDone / d->mTotalDir * 100) : 0);
filterInfo()->setCurrent(100);
}
}
}
void FilterBalsa::importMails(const QString &maildir)
......@@ -140,7 +138,6 @@ void FilterBalsa::importMails(const QString &maildir)
*/
void FilterBalsa::importDirContents(const QString &dirName)
{
/** Here Import all archives in the current dir */
importFiles(dirName);
......@@ -155,7 +152,6 @@ void FilterBalsa::importDirContents(const QString &dirName)
*/
void FilterBalsa::importFiles(const QString &dirName)
{
QDir dir(dirName);
QString _path;
bool generatedPath = false;
......@@ -171,10 +167,10 @@ void FilterBalsa::importFiles(const QString &dirName)
}
QString temp_mailfile = *mailFile;
if (!(temp_mailfile.endsWith(QLatin1String(".db"))
|| temp_mailfile.endsWith(QLatin1String(".cmeta"))
|| temp_mailfile.endsWith(QLatin1String(".ev-summary"))
|| temp_mailfile.endsWith(QLatin1String(".ibex.index"))
|| temp_mailfile.endsWith(QLatin1String(".ibex.index.data")))) {
|| temp_mailfile.endsWith(QLatin1String(".cmeta"))
|| temp_mailfile.endsWith(QLatin1String(".ev-summary"))
|| temp_mailfile.endsWith(QLatin1String(".ibex.index"))
|| temp_mailfile.endsWith(QLatin1String(".ibex.index.data")))) {
if (!generatedPath) {
_path = i18nc("define folder name where we import evolution mails", "Evolution-Import");