Commit 77ccb3e7 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Start to implement windows-contacts import/export support

CCBUG: 424940
parent e3f1ff25
Pipeline #29495 canceled with stage
......@@ -11,4 +11,4 @@ add_subdirectory(csv)
add_subdirectory(gmx)
add_subdirectory(ldap)
add_subdirectory(ldif)
add_subdirectory(windows-contacts)
set(kaddressbook_importexport_windowscontact_SRCS
windowscontactimportexportplugin.cpp
windowscontactimportexportplugininterface.cpp
)
kcoreaddons_add_plugin(kaddressbook_importexportwindowscontactplugin JSON kaddressbook_importexportwindowscontactplugin.json SOURCES
${kaddressbook_importexport_windowscontact_SRCS} INSTALL_NAMESPACE kaddressbook/importexportplugin)
target_link_libraries(kaddressbook_importexportwindowscontactplugin KF5::KaddressbookImportExport
KF5::PimCommon
KF5::I18n
KF5::XmlGui
KF5::Contacts
KF5::JobWidgets
KF5::Completion
KF5::KIOWidgets
KF5::AkonadiCore
kaddressbookimportexportlibprivate
)
{
"KPlugin": {
"Description": "This plugin allows you to import/export Windows Contacts.",
"EnabledByDefault": "true",
"Id": "kaddressbookimportexportwindowscontact",
"Name": "Import/Export CSV",
"ServiceTypes": [
"KAddressBook/ImportExportPlugin"
],
"Version": "1.0"
}
}
/*
Copyright (C) 2020 Laurent Montel <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 "windowscontactimportexportplugin.h"
#include "windowscontactimportexportplugininterface.h"
#include <KPluginFactory>
K_PLUGIN_CLASS_WITH_JSON(WindowsContactImportExportPlugin, "kaddressbook_importexportwindowscontactplugin.json")
WindowsContactImportExportPlugin::WindowsContactImportExportPlugin(QObject *parent, const QList<QVariant> &)
: KAddressBookImportExport::KAddressBookImportExportPlugin(parent)
{
}
WindowsContactImportExportPlugin::~WindowsContactImportExportPlugin()
{
}
PimCommon::AbstractGenericPluginInterface *WindowsContactImportExportPlugin::createInterface(QObject *parent)
{
WindowsContactImportExportPluginInterface *interface = new WindowsContactImportExportPluginInterface(parent);
return interface;
}
bool WindowsContactImportExportPlugin::hasPopupMenuSupport() const
{
return true;
}
#include "windowscontactimportexportplugin.moc"
/*
Copyright (C) 2020 Laurent Montel <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 WINDOWSCONTACTIMPORTEXPORTPLUGIN_H
#define WINDOWSCONTACTIMPORTEXPORTPLUGIN_H
#include <KAddressBookImportExport/KAddressBookImportExportPlugin>
#include <QVariant>
class WindowsContactImportExportPlugin : public KAddressBookImportExport::KAddressBookImportExportPlugin
{
Q_OBJECT
public:
explicit WindowsContactImportExportPlugin(QObject *parent = nullptr, const QList<QVariant> & =
{
});
~WindowsContactImportExportPlugin() override;
PimCommon::AbstractGenericPluginInterface *createInterface(QObject *parent) override;
Q_REQUIRED_RESULT bool hasPopupMenuSupport() const override;
};
#endif // WINDOWSCONTACTIMPORTEXPORTPLUGIN_H
/*
Copyright (C) 2016-2020 Laurent Montel <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 "windowscontactimportexportplugininterface.h"
#include "../shared/importexportengine.h"
#include <KLocalizedString>
#include <KActionCollection>
#include <QAction>
#include <QFileInfo>
#include <QTemporaryFile>
#include <PimCommon/RenameFileDialog>
#include <KMessageBox>
#include <KJobWidgets>
#include <QTextStream>
#include <QFileDialog>
#include <QTextCodec>
#include <QPointer>
#include <KAddressBookContactSelectionDialog>
#include <KIO/Job>
WindowsContactImportExportPluginInterface::WindowsContactImportExportPluginInterface(QObject *parent)
: KAddressBookImportExport::KAddressBookImportExportPluginInterface(parent)
{
}
WindowsContactImportExportPluginInterface::~WindowsContactImportExportPluginInterface()
{
}
void WindowsContactImportExportPluginInterface::createAction(KActionCollection *ac)
{
// QAction *action = ac->addAction(QStringLiteral("file_export_csv"));
// action->setText(i18n("Export CSV file..."));
// action->setWhatsThis(i18n("Export contacts to a file in comma separated value format."));
// setExportActions(QList<QAction *>() << action);
// connect(action, &QAction::triggered, this, &WindowsContactImportExportPluginInterface::slotExportCVS);
// action = ac->addAction(QStringLiteral("file_import_csv"));
// action->setText(i18n("Import CSV file..."));
// action->setWhatsThis(i18n("Import contacts from a file in comma separated value format."));
// setImportActions(QList<QAction *>() << action);
// connect(action, &QAction::triggered, this, &WindowsContactImportExportPluginInterface::slotImportCVS);
}
void WindowsContactImportExportPluginInterface::exec()
{
// switch (mImportExportAction) {
// case Import:
// importCSV();
// break;
// case Export:
// exportCSV();
// break;
// }
}
bool WindowsContactImportExportPluginInterface::canImportFileType(const QUrl &url)
{
//TODO
return false;
}
void WindowsContactImportExportPluginInterface::importFile(const QUrl &url)
{
//TODO
}
/*
Copyright (C) 2016-2020 Laurent Montel <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 WINDOWSCONTACTIMPORTEXPORTPLUGININTERFACE_H
#define WINDOWSCONTACTIMPORTEXPORTPLUGININTERFACE_H
#include <KAddressBookImportExport/KAddressBookImportExportPluginInterface>
#include <KContacts/Addressee>
class QFile;
class WindowsContactImportExportPluginInterface : public KAddressBookImportExport::KAddressBookImportExportPluginInterface
{
Q_OBJECT
public:
explicit WindowsContactImportExportPluginInterface(QObject *parent = nullptr);
~WindowsContactImportExportPluginInterface() override;
void createAction(KActionCollection *ac) override;
void exec() override;
Q_REQUIRED_RESULT bool canImportFileType(const QUrl &url) override;
void importFile(const QUrl &url) override;
};
#endif
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