2
Copyright (c) 2012 Montel Laurent <montel@kde.org>
4
This program is free software; you can redistribute it and/or modify it
5
under the terms of the GNU General Public License, version 2, as
6
published by the Free Software Foundation.
8
This program is distributed in the hope that it will be useful, but
9
WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
General Public License for more details.
13
You should have received a copy of the GNU General Public License along
14
with this program; if not, write to the Free Software Foundation, Inc.,
15
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
#include "claws-mail/clawsmailimportdata.h"
19
#include "claws-mail/clawsmailsettings.h"
20
#include "claws-mail/clawsmailaddressbook.h"
21
#include "mailimporter/filter_clawsmail.h"
22
#include "mailcommon/filter/filterimporter/filterimporterclawsmail_p.h"
23
#include "mailimporter/filterinfo.h"
24
#include "importfilterinfogui.h"
25
#include "importwizard.h"
33
ClawsMailImportData::ClawsMailImportData(ImportWizard*parent)
34
:AbstractImporter(parent)
36
mPath = MailImporter::FilterClawsMail::defaultSettingsPath();
39
ClawsMailImportData::~ClawsMailImportData()
44
bool ClawsMailImportData::foundMailer() const
46
QDir directory( mPath );
47
if ( directory.exists() )
52
QString ClawsMailImportData::name() const
54
return QLatin1String("Claws Mails");
57
bool ClawsMailImportData::importMails()
59
MailImporter::FilterInfo *info = initializeInfo();
61
MailImporter::FilterClawsMail clawsMail;
62
clawsMail.setFilterInfo( info );
63
info->setStatusMessage(i18n("Import in progress"));
64
const QString mailsPath = clawsMail.localMailDirPath();
65
QDir directory(mailsPath);
66
if(directory.exists())
67
clawsMail.importMails(mailsPath);
70
info->setStatusMessage(i18n("Import finished"));
77
bool ClawsMailImportData::importAddressBook()
79
const QDir addressbookDir(mPath + QLatin1String("addrbook/"));
80
ClawsMailAddressBook account( addressbookDir, mImportWizard );
84
bool ClawsMailImportData::importSettings()
86
const QString accountFile = mPath + QLatin1String("accountrc");
87
if ( QFile( accountFile ).exists() ) {
88
ClawsMailSettings account( mImportWizard );
89
account.importSettings(accountFile, mPath);
91
addImportSettingsInfo(i18n("Claws Mail settings not found."));
96
bool ClawsMailImportData::importFilters()
98
const QString filterPath(mPath + QLatin1String("matcherrc"));
99
return addFilters( filterPath, MailCommon::FilterImporterExporter::ClawsMailFilter );
103
AbstractImporter::TypeSupportedOptions ClawsMailImportData::supportedOption()
105
TypeSupportedOptions options;
106
options |=AbstractImporter::Mails;
107
options |=AbstractImporter::AddressBooks;
108
options |=AbstractImporter::Settings;
109
options |=AbstractImporter::Filters;