File indexing completed on 2025-01-19 04:46:31

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <KAddressBookImportExport/PluginInterface>
0010 #include <KContacts/Addressee>
0011 class QFile;
0012 class CSVImportExportPluginInterface : public KAddressBookImportExport::PluginInterface
0013 {
0014     Q_OBJECT
0015 public:
0016     explicit CSVImportExportPluginInterface(QObject *parent = nullptr);
0017     ~CSVImportExportPluginInterface() override;
0018 
0019     void createAction(KActionCollection *ac) override;
0020     void exec() override;
0021 
0022     [[nodiscard]] bool canImportFileType(const QUrl &url) override;
0023     void importFile(const QUrl &url) override;
0024 
0025 private:
0026     void exportCSV();
0027     void slotImportCVS();
0028     void slotExportCVS();
0029     void exportToFile(QFile *file, const KContacts::Addressee::List &contacts) const;
0030     void importCSV();
0031 };