summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-11-02 08:19:52 +0100
committerMontel Laurent <[email protected]>2017-11-02 08:19:52 +0100
commitc249ea86a0468a65748abef0db6067b55c77ce74 (patch)
treeb500ffab8c73278a86f02650225475137923f5b9
parent431e81d6f8319b71a40490773f7edec7430d1873 (diff)
Add nylasmaildata
-rw-r--r--CMakeLists.txt2
-rw-r--r--akonadi-import-wizard/nylas-mail/CMakeLists.txt1
-rw-r--r--akonadi-import-wizard/nylas-mail/nylasmaildata.cpp94
-rw-r--r--akonadi-import-wizard/nylas-mail/nylasmaildata.h40
4 files changed, 136 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4f8a609..2f4d18c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,7 +87,7 @@ set(LIBKSIEVE_LIB_VERSION_LIB "5.6.80")
set(KMAILTRANSPORT_LIB_VERSION "5.6.80")
set(AKONADICONTACT_LIB_VERSION "5.6.80")
set(IMPORTWIZARD_LIB_VERSION "5.6.80")
-set(MAILIMPORTER_LIB_VERSION "5.6.80")
+set(MAILIMPORTER_LIB_VERSION "5.6.81")
find_package(KF5CalendarUtils ${CALENDAR_UTILS_VERSION} CONFIG REQUIRED)
diff --git a/akonadi-import-wizard/nylas-mail/CMakeLists.txt b/akonadi-import-wizard/nylas-mail/CMakeLists.txt
index c5e65ae..21db181 100644
--- a/akonadi-import-wizard/nylas-mail/CMakeLists.txt
+++ b/akonadi-import-wizard/nylas-mail/CMakeLists.txt
@@ -1,5 +1,6 @@
set(nylasmailimporter_SRCS
nylasmailsettings.cpp
+ nylasmaildata.cpp
)
ecm_qt_declare_logging_category(nylasmailimporter_SRCS HEADER nylasmailplugin_debug.h IDENTIFIER NYLASMAILPLUGIN_LOG CATEGORY_NAME org.kde.pim.importwizard.nylasmailplugin)
diff --git a/akonadi-import-wizard/nylas-mail/nylasmaildata.cpp b/akonadi-import-wizard/nylas-mail/nylasmaildata.cpp
new file mode 100644
index 0000000..d132f09
--- /dev/null
+++ b/akonadi-import-wizard/nylas-mail/nylasmaildata.cpp
@@ -0,0 +1,94 @@
+/*
+ Copyright (C) 2017 Montel Laurent <[email protected]>
+
+ 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 "nylasmaildata.h"
+#include "nylasmailsettings.h"
+#include "mailimporter/filterinfo.h"
+#include "mailimporter/othermailerutil.h"
+
+#include "nylasmailplugin_debug.h"
+#include <kpluginfactory.h>
+#include <QDir>
+
+K_PLUGIN_FACTORY_WITH_JSON(NylasMailImporterFactory, "nylasmailimporter.json", registerPlugin<NylasMailImportData>();
+ )
+
+NylasMailImportData::NylasMailImportData(QObject *parent, const QList<QVariant> &)
+ : LibImportWizard::AbstractImporter(parent)
+{
+ mPath = MailImporter::OtherMailerUtil::nylasMailDefaultPath();
+}
+
+NylasMailImportData::~NylasMailImportData()
+{
+}
+
+bool NylasMailImportData::foundMailer() const
+{
+ QDir directory(mPath);
+ if (directory.exists()) {
+ return true;
+ }
+ return false;
+}
+
+QString NylasMailImportData::name() const
+{
+ return QStringLiteral("NylasMail");
+}
+
+bool NylasMailImportData::importMails()
+{
+ return false;
+}
+
+bool NylasMailImportData::importSettings()
+{
+ /*
+ QDir directory(mPath);
+ const QStringList lstDir = directory.entryList(QDir::AllDirs);
+ qCDebug(NylasMailPLUGIN_LOG) << "Number of directory " << lstDir.count();
+ const QString configName = QStringLiteral("NylasMail.ini");
+ for (int i = 0; i < lstDir.count(); ++i) {
+ const QString fullPath = lstDir.at(i) + QDir::separator() + configName;
+ if (QFileInfo::exists(fullPath)) {
+ NylasMailSettings setting(fullPath);
+ setting.setAbstractDisplayInfo(mAbstractDisplayInfo);
+ setting.importSettings();
+ }
+ }
+ */
+ return true;
+}
+
+bool NylasMailImportData::importAddressBook()
+{
+ return false;
+}
+
+LibImportWizard::AbstractImporter::TypeSupportedOptions NylasMailImportData::supportedOption()
+{
+ TypeSupportedOptions options;
+ //options |=LibImportWizard::AbstractImporter::Mails;
+ options |= LibImportWizard::AbstractImporter::Settings;
+ //options |= LibImportWizard::AbstractImporter::AddressBooks;
+ return options;
+}
+
+#include "nylasmaildata.moc"
diff --git a/akonadi-import-wizard/nylas-mail/nylasmaildata.h b/akonadi-import-wizard/nylas-mail/nylasmaildata.h
new file mode 100644
index 0000000..04cf780
--- /dev/null
+++ b/akonadi-import-wizard/nylas-mail/nylasmaildata.h
@@ -0,0 +1,40 @@
+/*
+ Copyright (C) 2017 Montel Laurent <[email protected]>
+
+ 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 NylasMailImportData_H
+#define NylasMailImportData_H
+
+#include <ImportWizard/AbstractImporter>
+
+class NylasMailImportData : public LibImportWizard::AbstractImporter
+{
+public:
+ explicit NylasMailImportData(QObject *parent, const QList<QVariant> & = QList<QVariant>());
+ ~NylasMailImportData();
+
+ TypeSupportedOptions supportedOption() override;
+ bool foundMailer() const override;
+
+ bool importMails() override;
+ bool importSettings() override;
+ bool importAddressBook() override;
+
+ QString name() const override;
+};
+
+#endif /* NylasMailImportData_H */