Commit a910f2ea authored by Laurent Montel's avatar Laurent Montel 😁

Look at how to create autotests here

parent fb332b00
......@@ -34,12 +34,16 @@ AbstractCalendar::~AbstractCalendar()
void AbstractCalendar::addImportInfo(const QString &log)
{
mImportWizard->importCalendarPage()->addImportInfo(log);
if (mImportWizard) {
mImportWizard->importCalendarPage()->addImportInfo(log);
}
}
void AbstractCalendar::addImportError(const QString &log)
{
mImportWizard->importCalendarPage()->addImportError(log);
if (mImportWizard) {
mImportWizard->importCalendarPage()->addImportError(log);
}
}
//eventviewsrc for calendar color for example
......
......@@ -73,8 +73,10 @@ public:
virtual bool importCalendar();
protected:
//TODO we need to redefine it.
virtual void initializeFilter(MailImporter::Filter &filter);
void appendFilters(const QList<MailCommon::MailFilter *> &filters);
void initializeFilter(MailImporter::Filter &filter);
void addImportFilterInfo(const QString &log) const;
void addImportFilterError(const QString &log) const;
bool addFilters(const QString &filterPath, MailCommon::FilterImporterExporter::FilterType type);
......
......@@ -80,6 +80,7 @@ bool BalsaImportData::importSettings()
{
const QString settingFile(mPath + QStringLiteral("config"));
BalsaSettings settings(settingFile, mImportWizard);
settings.importSettings();
return true;
}
......
......@@ -32,9 +32,20 @@
#include <QRegularExpression>
BalsaSettings::BalsaSettings(const QString &filename, ImportWizard *parent)
: AbstractSettings(parent)
: AbstractSettings(parent),
mFileName(filename)
{
KConfig config(filename);
}
BalsaSettings::~BalsaSettings()
{
}
void BalsaSettings::importSettings()
{
KConfig config(mFileName);
bool autoCheck = false;
int autoCheckDelay = -1;
......@@ -58,11 +69,6 @@ BalsaSettings::BalsaSettings(const QString &filename, ImportWizard *parent)
readGlobalSettings(config);
}
BalsaSettings::~BalsaSettings()
{
}
void BalsaSettings::readAccount(const KConfigGroup &grp, bool autoCheck, int autoDelay)
{
Q_UNUSED(autoDelay);
......
......@@ -31,6 +31,7 @@ public:
explicit BalsaSettings(const QString &filename, ImportWizard *parent);
~BalsaSettings();
void importSettings();
private:
void readAccount(const KConfigGroup &grp, bool autoCheck, int autoDelay);
void readIdentity(const KConfigGroup &grp);
......@@ -38,6 +39,7 @@ private:
void readGlobalSettings(const KConfig &config);
QHash<QString, QString> mHashSmtp;
QString mFileName;
};
#endif // BalsaSettings_H
......@@ -68,6 +68,7 @@ bool GearyImportData::importSettings()
QFile f(fullPath);
if (f.exists()) {
GearySettings setting(fullPath, mImportWizard);
setting.importSettings();
}
}
return true;
......
......@@ -33,10 +33,6 @@ GearySettings::GearySettings(const QString &filename, ImportWizard *parent)
: AbstractSettings(parent)
{
settings = new QSettings(filename, QSettings::IniFormat, this);
readImapAccount();
readTransport();
readIdentity();
readGlobalSettings();
}
GearySettings::~GearySettings()
......@@ -44,6 +40,14 @@ GearySettings::~GearySettings()
delete settings;
}
void GearySettings::importSettings()
{
readImapAccount();
readTransport();
readIdentity();
readGlobalSettings();
}
void GearySettings::readImapAccount()
{
}
......
......@@ -30,6 +30,7 @@ class GearySettings : public AbstractSettings
public:
explicit GearySettings(const QString &filename, ImportWizard *parent);
~GearySettings();
void importSettings();
private:
void readImapAccount();
void readIdentity();
......
......@@ -76,6 +76,7 @@ bool IcedoveImportData::importSettings()
const QString accountFile = mPath + defaultProfile() + QLatin1String("/prefs.js");
if (QFile(accountFile).exists()) {
ThunderbirdSettings account(accountFile, mImportWizard);
account.importSettings();
} else {
addImportSettingsInfo(i18n("Thunderbird settings not found."));
}
......
......@@ -75,6 +75,7 @@ bool ThunderbirdImportData::importSettings()
const QString accountFile = mPath + defaultProfile() + QLatin1String("/prefs.js");
if (QFile(accountFile).exists()) {
ThunderbirdSettings account(accountFile, mImportWizard);
account.importSettings();
} else {
addImportSettingsInfo(i18n("Thunderbird settings not found."));
}
......
......@@ -37,11 +37,21 @@
#include <QDir>
ThunderbirdSettings::ThunderbirdSettings(const QString &filename, ImportWizard *parent)
: AbstractSettings(parent)
: AbstractSettings(parent),
mFileName(filename)
{
QFile file(filename);
}
ThunderbirdSettings::~ThunderbirdSettings()
{
}
void ThunderbirdSettings::importSettings()
{
QFile file(mFileName);
if (!file.open(QIODevice::ReadOnly)) {
qCDebug(IMPORTWIZARD_LOG) << " We can't open file" << filename;
qCDebug(IMPORTWIZARD_LOG) << " We can't open file" << mFileName;
return;
}
QTextStream stream(&file);
......@@ -83,9 +93,6 @@ ThunderbirdSettings::ThunderbirdSettings(const QString &filename, ImportWizard *
readExtensionsSettings();
}
ThunderbirdSettings::~ThunderbirdSettings()
{
}
void ThunderbirdSettings::readExtensionsSettings()
{
......
......@@ -32,6 +32,7 @@ class ThunderbirdSettings : public AbstractSettings
public:
explicit ThunderbirdSettings(const QString &filename, ImportWizard *parent);
~ThunderbirdSettings();
void importSettings();
private:
void readAccount();
void readIdentity(const QString &account);
......@@ -54,6 +55,7 @@ private:
QStringList mLdapAccountList;
QHash<QString, tagStruct> mHashTag;
QString mFileName;
};
#endif /* THUNDERBIRDSETTINGS_H */
......@@ -60,6 +60,7 @@ bool TrojitaImportData::importSettings()
{
const QString settingsPath = mPath + QLatin1String("trojita.conf");
TrojitaSettings settings(settingsPath, mImportWizard);
settings.importSettings();
return true;
}
......
......@@ -33,10 +33,6 @@ TrojitaSettings::TrojitaSettings(const QString &filename, ImportWizard *parent)
: AbstractSettings(parent)
{
settings = new QSettings(filename, QSettings::IniFormat, this);
readImapAccount();
readTransport();
readIdentity();
readGlobalSettings();
}
TrojitaSettings::~TrojitaSettings()
......@@ -44,6 +40,14 @@ TrojitaSettings::~TrojitaSettings()
delete settings;
}
void TrojitaSettings::importSettings()
{
readImapAccount();
readTransport();
readIdentity();
readGlobalSettings();
}
void TrojitaSettings::readImapAccount()
{
QMap<QString, QVariant> newSettings;
......
......@@ -30,6 +30,7 @@ class TrojitaSettings : public AbstractSettings
public:
explicit TrojitaSettings(const QString &filename, ImportWizard *parent);
~TrojitaSettings();
void importSettings();
private:
void readImapAccount();
void readIdentity();
......
......@@ -434,6 +434,7 @@ ImportSettingPage *ImportWizard::importSettingPage() const
{
return mImportSettingPage;
}
ImportFinishPage *ImportWizard::importFinishPage() const
{
return mImportFinishPage;
......
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