Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
KDE PIM Add-ons
Commits
365477c5
Commit
365477c5
authored
Apr 19, 2017
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move plugins from importwizard
parent
fe4fd6ad
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
1888 additions
and
0 deletions
+1888
-0
akonadi-import-wizard/CMakeLists.txt
akonadi-import-wizard/CMakeLists.txt
+6
-0
akonadi-import-wizard/geary/CMakeLists.txt
akonadi-import-wizard/geary/CMakeLists.txt
+21
-0
akonadi-import-wizard/geary/gearyaddressbook.cpp
akonadi-import-wizard/geary/gearyaddressbook.cpp
+37
-0
akonadi-import-wizard/geary/gearyaddressbook.h
akonadi-import-wizard/geary/gearyaddressbook.h
+34
-0
akonadi-import-wizard/geary/gearyimportdata.cpp
akonadi-import-wizard/geary/gearyimportdata.cpp
+94
-0
akonadi-import-wizard/geary/gearyimportdata.h
akonadi-import-wizard/geary/gearyimportdata.h
+40
-0
akonadi-import-wizard/geary/gearyimporter.json
akonadi-import-wizard/geary/gearyimporter.json
+21
-0
akonadi-import-wizard/geary/gearysettings.cpp
akonadi-import-wizard/geary/gearysettings.cpp
+175
-0
akonadi-import-wizard/geary/gearysettings.h
akonadi-import-wizard/geary/gearysettings.h
+41
-0
akonadi-import-wizard/mailapp/CMakeLists.txt
akonadi-import-wizard/mailapp/CMakeLists.txt
+18
-0
akonadi-import-wizard/mailapp/mailappimportdata.cpp
akonadi-import-wizard/mailapp/mailappimportdata.cpp
+82
-0
akonadi-import-wizard/mailapp/mailappimportdata.h
akonadi-import-wizard/mailapp/mailappimportdata.h
+37
-0
akonadi-import-wizard/mailapp/mailappimporter.json
akonadi-import-wizard/mailapp/mailappimporter.json
+20
-0
akonadi-import-wizard/oe/CMakeLists.txt
akonadi-import-wizard/oe/CMakeLists.txt
+18
-0
akonadi-import-wizard/oe/oeimportdata.cpp
akonadi-import-wizard/oe/oeimportdata.cpp
+83
-0
akonadi-import-wizard/oe/oeimportdata.h
akonadi-import-wizard/oe/oeimportdata.h
+37
-0
akonadi-import-wizard/oe/oeimporter.json
akonadi-import-wizard/oe/oeimporter.json
+20
-0
akonadi-import-wizard/opera/CMakeLists.txt
akonadi-import-wizard/opera/CMakeLists.txt
+21
-0
akonadi-import-wizard/opera/operaaddressbook.cpp
akonadi-import-wizard/opera/operaaddressbook.cpp
+96
-0
akonadi-import-wizard/opera/operaaddressbook.h
akonadi-import-wizard/opera/operaaddressbook.h
+37
-0
akonadi-import-wizard/opera/operaimportdata.cpp
akonadi-import-wizard/opera/operaimportdata.cpp
+102
-0
akonadi-import-wizard/opera/operaimportdata.h
akonadi-import-wizard/opera/operaimportdata.h
+41
-0
akonadi-import-wizard/opera/operaimporter.json
akonadi-import-wizard/opera/operaimporter.json
+20
-0
akonadi-import-wizard/opera/operasettings.cpp
akonadi-import-wizard/opera/operasettings.cpp
+295
-0
akonadi-import-wizard/opera/operasettings.h
akonadi-import-wizard/opera/operasettings.h
+42
-0
akonadi-import-wizard/pmail/CMakeLists.txt
akonadi-import-wizard/pmail/CMakeLists.txt
+19
-0
akonadi-import-wizard/pmail/pmailimportdata.cpp
akonadi-import-wizard/pmail/pmailimportdata.cpp
+93
-0
akonadi-import-wizard/pmail/pmailimportdata.h
akonadi-import-wizard/pmail/pmailimportdata.h
+40
-0
akonadi-import-wizard/pmail/pmailimporter.json
akonadi-import-wizard/pmail/pmailimporter.json
+20
-0
akonadi-import-wizard/pmail/pmailsettings.cpp
akonadi-import-wizard/pmail/pmailsettings.cpp
+83
-0
akonadi-import-wizard/pmail/pmailsettings.h
akonadi-import-wizard/pmail/pmailsettings.h
+39
-0
akonadi-import-wizard/thebat/CMakeLists.txt
akonadi-import-wizard/thebat/CMakeLists.txt
+18
-0
akonadi-import-wizard/thebat/thebatimportdata.cpp
akonadi-import-wizard/thebat/thebatimportdata.cpp
+81
-0
akonadi-import-wizard/thebat/thebatimportdata.h
akonadi-import-wizard/thebat/thebatimportdata.h
+37
-0
akonadi-import-wizard/thebat/thebatimporter.json
akonadi-import-wizard/thebat/thebatimporter.json
+20
-0
No files found.
akonadi-import-wizard/CMakeLists.txt
View file @
365477c5
add_definitions
(
-DTRANSLATION_DOMAIN=\"importwizard_plugins\"
)
add_definitions
(
-DTRANSLATION_DOMAIN=\"importwizard_plugins\"
)
add_subdirectory
(
evolutionv1
)
add_subdirectory
(
evolutionv1
)
add_subdirectory
(
evolutionv2
)
add_subdirectory
(
evolutionv2
)
add_subdirectory
(
geary
)
add_subdirectory
(
mailapp
)
add_subdirectory
(
oe
)
add_subdirectory
(
opera
)
add_subdirectory
(
pmail
)
add_subdirectory
(
thebat
)
akonadi-import-wizard/geary/CMakeLists.txt
0 → 100644
View file @
365477c5
set
(
gearyimporter_SRCS
gearyaddressbook.cpp
gearyimportdata.cpp
gearysettings.cpp
)
ecm_qt_declare_logging_category
(
gearyimporter_SRCS HEADER gearyplugin_debug.h IDENTIFIER GEARYPLUGIN_LOG CATEGORY_NAME org.kde.pim.importwizard.gearyplugin
)
kcoreaddons_add_plugin
(
gearyimporterplugin JSON gearyimporter.json SOURCES
${
gearyimporter_SRCS
}
INSTALL_NAMESPACE importwizard
)
target_link_libraries
(
gearyimporterplugin
KPim::ImportWizard
KF5::XmlGui
KF5::I18n
KF5::Contacts
KF5::MailImporterAkonadi
KF5::MailTransport
KF5::IdentityManagement
KF5::MailCommon
)
akonadi-import-wizard/geary/gearyaddressbook.cpp
0 → 100644
View file @
365477c5
/*
Copyright (C) 2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "gearyaddressbook.h"
#include <KContacts/Addressee>
#include <QUrl>
#include <QSettings>
GearyAddressBook
::
GearyAddressBook
(
const
QString
&
filename
)
{
}
GearyAddressBook
::~
GearyAddressBook
()
{
}
void
GearyAddressBook
::
importAddressBook
()
{
}
akonadi-import-wizard/geary/gearyaddressbook.h
0 → 100644
View file @
365477c5
/*
Copyright (C) 2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef GearyAddressBook_H
#define GearyAddressBook_H
#include <ImportWizard/AbstractAddressBook>
#include <QHash>
class
GearyAddressBook
:
public
LibImportWizard
::
AbstractAddressBook
{
public:
explicit
GearyAddressBook
(
const
QString
&
filename
);
~
GearyAddressBook
();
void
importAddressBook
();
};
#endif
/* GearyAddressBook_H */
akonadi-import-wizard/geary/gearyimportdata.cpp
0 → 100644
View file @
365477c5
/*
Copyright (C) 2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "gearyimportdata.h"
#include "gearysettings.h"
#include "gearyaddressbook.h"
#include "mailimporter/filterinfo.h"
#include "mailimporter/othermailerutil.h"
#include "gearyplugin_debug.h"
#include <kpluginfactory.h>
#include <QDir>
K_PLUGIN_FACTORY_WITH_JSON
(
GearyImporterFactory
,
"gearyimporter.json"
,
registerPlugin
<
GearyImportData
>
();
)
GearyImportData
::
GearyImportData
(
QObject
*
parent
,
const
QList
<
QVariant
>
&
)
:
LibImportWizard
::
AbstractImporter
(
parent
)
{
mPath
=
MailImporter
::
OtherMailerUtil
::
gearyDefaultPath
();
}
GearyImportData
::~
GearyImportData
()
{
}
bool
GearyImportData
::
foundMailer
()
const
{
QDir
directory
(
mPath
);
if
(
directory
.
exists
())
{
return
true
;
}
return
false
;
}
QString
GearyImportData
::
name
()
const
{
return
QStringLiteral
(
"Geary"
);
}
bool
GearyImportData
::
importMails
()
{
return
false
;
}
bool
GearyImportData
::
importSettings
()
{
QDir
directory
(
mPath
);
const
QStringList
lstDir
=
directory
.
entryList
(
QDir
::
AllDirs
);
qCDebug
(
GEARYPLUGIN_LOG
)
<<
"Number of directory "
<<
lstDir
.
count
();
const
QString
configName
=
QStringLiteral
(
"geary.ini"
);
for
(
int
i
=
0
;
i
<
lstDir
.
count
();
++
i
)
{
const
QString
fullPath
=
lstDir
.
at
(
i
)
+
QDir
::
separator
()
+
configName
;
if
(
QFileInfo
::
exists
(
fullPath
))
{
GearySettings
setting
(
fullPath
);
setting
.
setAbstractDisplayInfo
(
mAbstractDisplayInfo
);
setting
.
importSettings
();
}
}
return
true
;
}
bool
GearyImportData
::
importAddressBook
()
{
return
false
;
}
LibImportWizard
::
AbstractImporter
::
TypeSupportedOptions
GearyImportData
::
supportedOption
()
{
TypeSupportedOptions
options
;
//options |=LibImportWizard::AbstractImporter::Mails;
options
|=
LibImportWizard
::
AbstractImporter
::
Settings
;
//options |= LibImportWizard::AbstractImporter::AddressBooks;
return
options
;
}
#include "gearyimportdata.moc"
akonadi-import-wizard/geary/gearyimportdata.h
0 → 100644
View file @
365477c5
/*
Copyright (C) 2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef GearyImportData_H
#define GearyImportData_H
#include <ImportWizard/AbstractImporter>
class
GearyImportData
:
public
LibImportWizard
::
AbstractImporter
{
public:
explicit
GearyImportData
(
QObject
*
parent
,
const
QList
<
QVariant
>
&
=
QList
<
QVariant
>
());
~
GearyImportData
();
TypeSupportedOptions
supportedOption
()
Q_DECL_OVERRIDE
;
bool
foundMailer
()
const
Q_DECL_OVERRIDE
;
bool
importMails
()
Q_DECL_OVERRIDE
;
bool
importSettings
()
Q_DECL_OVERRIDE
;
bool
importAddressBook
()
Q_DECL_OVERRIDE
;
QString
name
()
const
Q_DECL_OVERRIDE
;
};
#endif
/* TrojiraImportData_H */
akonadi-import-wizard/geary/gearyimporter.json
0 → 100644
View file @
365477c5
{
"KPlugin"
:
{
"Id"
:
"gearyimporter"
,
"Name"
:
"Geary Importer"
,
"Name[ca@valencia]"
:
"Importador del Geary"
,
"Name[ca]"
:
"Importador del Geary"
,
"Name[es]"
:
"Importador Geary"
,
"Name[it]"
:
"Importatore da Geary"
,
"Name[nl]"
:
"Geary-importeur"
,
"Name[pl]"
:
"Importer Geary"
,
"Name[pt]"
:
"Importador do Geary"
,
"Name[sk]"
:
"Importér Geary"
,
"Name[sv]"
:
"Geary-importverktyg"
,
"Name[uk]"
:
"Засіб імпортування з Geary"
,
"Name[x-test]"
:
"xxGeary Importerxx"
,
"ServiceTypes"
:
[
"ImportWizard/PluginMailImporter"
],
"Version"
:
"1.0"
}
}
akonadi-import-wizard/geary/gearysettings.cpp
0 → 100644
View file @
365477c5
/*
Copyright (C) 2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "gearysettings.h"
#include <ImportWizard/ImportWizardUtil>
#include <mailtransport/transportmanager.h>
#include <KIdentityManagement/kidentitymanagement/identity.h>
#include <KIdentityManagement/kidentitymanagement/signature.h>
#include <QSettings>
GearySettings
::
GearySettings
(
const
QString
&
filename
)
{
settings
=
new
QSettings
(
filename
,
QSettings
::
IniFormat
,
this
);
}
GearySettings
::~
GearySettings
()
{
delete
settings
;
}
void
GearySettings
::
importSettings
()
{
readImapAccount
();
readTransport
();
readIdentity
();
readGlobalSettings
();
}
void
GearySettings
::
readImapAccount
()
{
QMap
<
QString
,
QVariant
>
newSettings
;
QString
name
;
name
=
settings
->
value
(
QStringLiteral
(
"imap_host"
)).
toString
();
if
(
!
name
.
isEmpty
())
{
newSettings
.
insert
(
QStringLiteral
(
"ImapServer"
),
name
);
}
const
int
port
=
settings
->
value
(
QStringLiteral
(
"imap_port"
),
-
1
).
toInt
();
if
(
port
>
-
1
)
{
newSettings
.
insert
(
QStringLiteral
(
"ImapPort"
),
port
);
}
if
(
settings
->
contains
(
QStringLiteral
(
"imap_starttls"
)))
{
const
bool
useTLS
=
settings
->
value
(
QStringLiteral
(
"imap_starttls"
)).
toBool
();
if
(
useTLS
)
{
newSettings
.
insert
(
QStringLiteral
(
"Safety"
),
QStringLiteral
(
"STARTTLS"
));
}
}
const
QString
userName
=
settings
->
value
(
QStringLiteral
(
"imap_username"
)).
toString
();
if
(
!
userName
.
isEmpty
())
{
newSettings
.
insert
(
QStringLiteral
(
"Username"
),
userName
);
}
if
(
!
name
.
isEmpty
())
{
const
QString
agentIdentifyName
=
LibImportWizard
::
AbstractBase
::
createResource
(
QStringLiteral
(
"akonadi_imap_resource"
),
name
,
newSettings
);
//Check by default
addCheckMailOnStartup
(
agentIdentifyName
,
true
);
}
}
void
GearySettings
::
readTransport
()
{
const
QString
host
=
settings
->
value
(
QStringLiteral
(
"smtp_host"
)).
toString
();
if
(
!
host
.
isEmpty
())
{
MailTransport
::
Transport
*
mt
=
createTransport
();
mt
->
setType
(
MailTransport
::
Transport
::
EnumType
::
SMTP
);
mt
->
setHost
(
host
);
const
int
port
=
settings
->
value
(
QStringLiteral
(
"msa.smtp.port"
),
-
1
).
toInt
();
if
(
port
!=
-
1
)
{
mt
->
setPort
(
port
);
}
//ADD more settings
storeTransport
(
mt
,
true
);
//only one smtp for the moment
}
#if 0
smtp_host = smtp.bla.bla
smtp_port = 465
smtp_ssl = true
smtp_starttls = false
smtp_use_imap_credentials = false
smtp_noauth = true
#endif
#if 0
const QString smtpMethod = settings->value(QStringLiteral("msa.method")).toString();
if (!smtpMethod.isEmpty()) {
MailTransport::Transport *mt = createTransport();
if (smtpMethod == QLatin1String("IMAP-SENDMAIL")) {
//see http://tools.ietf.org/html/draft-kundrat-imap-submit-01
} else if (smtpMethod == QLatin1String("SMTP") || smtpMethod == QLatin1String("SSMTP")) {
if (settings->contains(QStringLiteral("msa.smtp.host"))) {
mt->setHost(settings->value(QStringLiteral("msa.smtp.host")).toString());
}
if (settings->contains(QStringLiteral("msa.smtp.port"))) {
mt->setPort(settings->value(QStringLiteral("msa.smtp.port")).toInt());
}
if (settings->contains(QStringLiteral("msa.smtp.auth"))) {
if (settings->value(QStringLiteral("msa.smtp.auth")).toBool()) {
if (settings->contains(QStringLiteral("msa.smtp.auth.user"))) {
mt->setUserName(settings->value(QStringLiteral("msa.smtp.auth.user")).toString());
}
if (settings->contains(QStringLiteral("msa.smtp.auth.pass"))) {
mt->setPassword(settings->value(QStringLiteral("msa.smtp.auth.pass")).toString());
}
}
}
if (settings->contains(QStringLiteral("msa.smtp.starttls"))) {
if (settings->value(QStringLiteral("msa.smtp.starttls")).toBool()) {
mt->setEncryption(MailTransport::Transport::EnumEncryption::TLS);
}
}
mt->setType(MailTransport::Transport::EnumType::SMTP);
} else {
qCWarning(IMPORTWIZARD_LOG) << " smtpMethod unknown " << smtpMethod;
}
storeTransport(mt, true); //only one smtp for the moment
}
#endif
}
void
GearySettings
::
readIdentity
()
{
QString
realName
=
settings
->
value
(
QStringLiteral
(
"realName"
)).
toString
();
if
(
!
realName
.
isEmpty
())
{
KIdentityManagement
::
Identity
*
identity
=
createIdentity
(
realName
);
identity
->
setFullName
(
realName
);
identity
->
setIdentityName
(
realName
);
const
QString
address
=
settings
->
value
(
QStringLiteral
(
"primary_email"
)).
toString
();
identity
->
setPrimaryEmailAddress
(
address
);
const
QString
alias
=
settings
->
value
(
QStringLiteral
(
"alternate_emails"
)).
toString
();
if
(
!
alias
.
isEmpty
())
{
identity
->
setEmailAliases
(
alias
.
split
(
QLatin1Char
(
';'
),
QString
::
SkipEmptyParts
));
}
const
QString
signatureStr
=
settings
->
value
(
QStringLiteral
(
"email_signature"
)).
toString
();
if
(
!
signatureStr
.
isEmpty
())
{
KIdentityManagement
::
Signature
signature
;
signature
.
setType
(
KIdentityManagement
::
Signature
::
Inlined
);
signature
.
setText
(
signatureStr
);
const
bool
useSignature
=
settings
->
value
(
QStringLiteral
(
"use_email_signature"
),
true
).
toBool
();
signature
.
setEnabledSignature
(
useSignature
);
identity
->
setSignature
(
signature
);
}
//TODO add "nickname=bli@kde.org"
storeIdentity
(
identity
);
}
}
void
GearySettings
::
readGlobalSettings
()
{
//TODO
}
akonadi-import-wizard/geary/gearysettings.h
0 → 100644
View file @
365477c5
/*
Copyright (C) 2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef GearySettings_H
#define GearySettings_H
#include <ImportWizard/AbstractSettings>
class
QSettings
;
class
GearySettings
:
public
AbstractSettings
{
public:
explicit
GearySettings
(
const
QString
&
filename
);
~
GearySettings
();
void
importSettings
();
private:
void
readImapAccount
();
void
readIdentity
();
void
readGlobalSettings
();
void
readTransport
();
QSettings
*
settings
;
};
#endif // ClawsMailSettings_H
akonadi-import-wizard/mailapp/CMakeLists.txt
0 → 100644
View file @
365477c5
set
(
mailappimporter_SRCS
mailappimportdata.cpp
)
kcoreaddons_add_plugin
(
mailappimporterplugin JSON mailappimporter.json SOURCES
${
mailappimporter_SRCS
}
INSTALL_NAMESPACE importwizard
)
target_link_libraries
(
mailappimporterplugin
KPim::ImportWizard
KF5::XmlGui
KF5::I18n
KF5::Contacts
KF5::MailImporterAkonadi
KF5::MailTransport
KF5::IdentityManagement
KF5::MailCommon
)
akonadi-import-wizard/mailapp/mailappimportdata.cpp
0 → 100644
View file @
365477c5
/*
Copyright (C) 2012-2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "mailappimportdata.h"
#include "mailimporter/filtermailapp.h"
#include "mailimporter/filterinfo.h"
#include <KLocalizedString>
#include <kpluginfactory.h>
#include <QDir>
K_PLUGIN_FACTORY_WITH_JSON
(
MailAppImporterFactory
,
"mailappimporter.json"
,
registerPlugin
<
MailAppImportData
>
();
)
MailAppImportData
::
MailAppImportData
(
QObject
*
parent
,
const
QList
<
QVariant
>
&
)
:
LibImportWizard
::
AbstractImporter
(
parent
)
{
mPath
=
QDir
::
homePath
();
}
MailAppImportData
::~
MailAppImportData
()
{
}
bool
MailAppImportData
::
foundMailer
()
const
{
#ifdef Q_OS_MAC
//TODO find a method to search it. Perhaps look at binary.
QDir
directory
(
mPath
);
if
(
directory
.
exists
())
{
return
true
;
}
#endif
return
false
;
}
QString
MailAppImportData
::
name
()
const
{
return
QStringLiteral
(
"Mail App"
);
}
bool
MailAppImportData
::
importMails
()
{
MailImporter
::
FilterMailApp
mailapp
;
initializeFilter
(
mailapp
);
mailapp
.
filterInfo
()
->
setStatusMessage
(
i18n
(
"Import in progress"
));
QDir
directory
(
mPath
);
if
(
directory
.
exists
())
{
mailapp
.
importMails
(
mPath
);
}
else
{
mailapp
.
import
();
}
mailapp
.
filterInfo
()
->
setStatusMessage
(
i18n
(
"Import finished"
));
return
true
;
}
LibImportWizard
::
AbstractImporter
::
TypeSupportedOptions
MailAppImportData
::
supportedOption
()
{
TypeSupportedOptions
options
;
options
|=
LibImportWizard
::
AbstractImporter
::
Mails
;
return
options
;
}
#include "mailappimportdata.moc"
akonadi-import-wizard/mailapp/mailappimportdata.h
0 → 100644
View file @
365477c5
/*
Copyright (C) 2012-2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef MailAppImportData_H