Commit 463a9138 authored by Laurent Montel's avatar Laurent Montel 😁

asryle kdelibs + QStringLiteral

parent a827c80a
......@@ -25,15 +25,13 @@
#include "mailcommon/filter/filterimporterexporter.h"
#include "importwizard.h"
#include <KLocale>
#include <KConfig>
#include <QDir>
IcedoveImportData::IcedoveImportData(ImportWizard*parent)
:AbstractImporter(parent)
IcedoveImportData::IcedoveImportData(ImportWizard *parent)
: AbstractImporter(parent)
{
mPath = MailImporter::FilterIcedove::defaultSettingsPath();
}
......@@ -52,16 +50,17 @@ QString IcedoveImportData::defaultProfile()
bool IcedoveImportData::foundMailer() const
{
QDir directory( mPath );
if ( directory.exists() )
QDir directory(mPath);
if (directory.exists()) {
return true;
}
return false;
}
bool IcedoveImportData::importAddressBook()
{
const QDir addressbookDir(mPath+defaultProfile());
ThunderBirdAddressBook account( addressbookDir, mImportWizard );
const QDir addressbookDir(mPath + defaultProfile());
ThunderBirdAddressBook account(addressbookDir, mImportWizard);
return true;
}
......@@ -73,8 +72,8 @@ QString IcedoveImportData::name() const
bool IcedoveImportData::importSettings()
{
const QString accountFile = mPath + defaultProfile() + QLatin1String("/prefs.js");
if ( QFile( accountFile ).exists() ) {
ThunderbirdSettings account( accountFile, mImportWizard );
if (QFile(accountFile).exists()) {
ThunderbirdSettings account(accountFile, mImportWizard);
} else {
addImportSettingsInfo(i18n("Thunderbird settings not found."));
}
......@@ -86,17 +85,17 @@ bool IcedoveImportData::importMails()
//* This should be usually ~/.icedove/xxxx.default/Mail/Local Folders/
MailImporter::FilterInfo *info = initializeInfo();
MailImporter::FilterThunderbird thunderbird;
thunderbird.setFilterInfo( info );
thunderbird.setFilterInfo(info);
info->clear();
info->setStatusMessage(i18n("Import in progress"));
const QString mailsPath = mPath + defaultProfile() + QLatin1String("/Mail/Local Folders/");
QDir directory(mailsPath);
if (directory.exists())
if (directory.exists()) {
thunderbird.importMails(mailsPath);
else
} else {
thunderbird.import();
}
info->setStatusMessage(i18n("Import finished"));
delete info;
......@@ -108,27 +107,29 @@ bool IcedoveImportData::importFilters()
const QString path(mPath + defaultProfile());
QDir dir(path);
bool filtersAdded = false;
const QStringList subDir = dir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
if (subDir.isEmpty())
const QStringList subDir = dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name);
if (subDir.isEmpty()) {
return true;
}
Q_FOREACH ( const QString& mailPath, subDir ) {
Q_FOREACH (const QString &mailPath, subDir) {
const QString subMailPath(path + QLatin1Char('/') + mailPath);
QDir dirMail(subMailPath);
const QStringList subDirMail = dirMail.entryList(QDir::AllDirs|QDir::NoDotAndDotDot,QDir::Name);
const QStringList subDirMail = dirMail.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name);
bool foundFilterFile = false;
Q_FOREACH ( const QString& file, subDirMail ) {
const QString filterFile(subMailPath +QLatin1Char('/')+ file + QLatin1String("/msgFilterRules.dat"));
Q_FOREACH (const QString &file, subDirMail) {
const QString filterFile(subMailPath + QLatin1Char('/') + file + QLatin1String("/msgFilterRules.dat"));
if (QFile(filterFile).exists()) {
foundFilterFile = true;
const bool added = addFilters( filterFile, MailCommon::FilterImporterExporter::ThunderBirdFilter );
const bool added = addFilters(filterFile, MailCommon::FilterImporterExporter::ThunderBirdFilter);
if (!filtersAdded && added) {
filtersAdded = true;
}
}
}
if (!foundFilterFile)
if (!foundFilterFile) {
return true;
}
}
return filtersAdded;
}
......@@ -136,9 +137,9 @@ bool IcedoveImportData::importFilters()
AbstractImporter::TypeSupportedOptions IcedoveImportData::supportedOption()
{
TypeSupportedOptions options;
options |=AbstractImporter::Mails;
options |=AbstractImporter::Filters;
options |=AbstractImporter::Settings;
options |=AbstractImporter::AddressBooks;
options |= AbstractImporter::Mails;
options |= AbstractImporter::Filters;
options |= AbstractImporter::Settings;
options |= AbstractImporter::AddressBooks;
return options;
}
......@@ -25,7 +25,7 @@ class IcedoveImportData : public AbstractImporter
public:
explicit IcedoveImportData(ImportWizard *parent);
~IcedoveImportData();
TypeSupportedOptions supportedOption();
bool foundMailer() const;
......
......@@ -222,11 +222,11 @@ void ImportWizard::slotAtLeastOneComponentSelected(bool result)
void ImportWizard::setAppropriatePage(AbstractImporter::TypeSupportedOptions options)
{
setAppropriate(mPage3,(options & AbstractImporter::Mails));
setAppropriate(mPage4,(options & AbstractImporter::Filters));
setAppropriate(mPage5,(options & AbstractImporter::Settings));
setAppropriate(mPage6,(options & AbstractImporter::AddressBooks));
setAppropriate(mPage7,(options & AbstractImporter::Calendars));
setAppropriate(mPage3, (options & AbstractImporter::Mails));
setAppropriate(mPage4, (options & AbstractImporter::Filters));
setAppropriate(mPage5, (options & AbstractImporter::Settings));
setAppropriate(mPage6, (options & AbstractImporter::AddressBooks));
setAppropriate(mPage7, (options & AbstractImporter::Calendars));
}
void ImportWizard::next()
......
......@@ -58,7 +58,7 @@ void SylpheedSettings::importSettings(const QString &filename, const QString &pa
}
}
KConfig config(filename);
const QStringList accountList = config.groupList().filter(QRegExp("Account: \\d+"));
const QStringList accountList = config.groupList().filter(QRegExp(QStringLiteral("Account: \\d+")));
const QStringList::const_iterator end(accountList.constEnd());
for (QStringList::const_iterator it = accountList.constBegin(); it != end; ++it) {
KConfigGroup group = config.group(*it);
......
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