Commit 5f58c6f2 authored by Laurent Montel's avatar Laurent Montel 😁

Continue to implement import windows contact file + add debug category

parent fda1d112
Pipeline #29530 failed with stage
in 114 minutes and 6 seconds
......@@ -4,6 +4,10 @@ set(kaddressbook_importexport_windowscontact_SRCS
)
ecm_qt_declare_logging_category(kaddressbook_importexport_windowscontact_SRCS HEADER importexportwindowscontactplugin_debug.h IDENTIFIER IMPORTEXPORTWINDOWSCONTACTPLUGIN_LOG CATEGORY_NAME org.kde.pim.importexportwindowscontactplugin
DESCRIPTION "kdepim-addons (Import/Export Windows Contact plugin)"
EXPORT KDEPIMADDONS
)
kcoreaddons_add_plugin(kaddressbook_importexportwindowscontactplugin JSON kaddressbook_importexportwindowscontactplugin.json SOURCES
${kaddressbook_importexport_windowscontact_SRCS} INSTALL_NAMESPACE kaddressbook/importexportplugin)
......
......@@ -19,6 +19,7 @@
#include "windowscontactimportexportplugininterface.h"
#include "../shared/importexportengine.h"
#include "importexportwindowscontactplugin_debug.h"
#include <KLocalizedString>
#include <KActionCollection>
#include <QAction>
......@@ -32,6 +33,8 @@
#include <QTextCodec>
#include <QPointer>
#include <KAddressBookContactSelectionDialog>
#include <QFile>
#include <QDomElement>
#include <KIO/Job>
WindowsContactImportExportPluginInterface::WindowsContactImportExportPluginInterface(QObject *parent)
......@@ -84,6 +87,20 @@ void WindowsContactImportExportPluginInterface::exec()
}
}
bool WindowsContactImportExportPluginInterface::loadDomElement(QDomDocument &doc, QFile *file)
{
QString errorMsg;
int errorRow;
int errorCol;
if (!doc.setContent(file, &errorMsg, &errorRow, &errorCol)) {
qCWarning(IMPORTEXPORTWINDOWSCONTACTPLUGIN_LOG) << "Unable to load document.Parse error in line " << errorRow
<< ", col " << errorCol << ": " << errorMsg;
return false;
}
return true;
}
void WindowsContactImportExportPluginInterface::importWindowsContact()
{
KAddressBookImportExport::KAddressBookImportExportContactList contactList;
......@@ -100,12 +117,15 @@ void WindowsContactImportExportPluginInterface::importWindowsContact()
KMessageBox::error(parentWidget(), msg);
return;
}
QDomDocument doc;
if (loadDomElement(doc, &file)) {
//TODO read xml
}
}
void WindowsContactImportExportPluginInterface::exportWindowsContact()
{
qWarning() << "Export windows contact not implement yet";
qCWarning(IMPORTEXPORTWINDOWSCONTACTPLUGIN_LOG) << "Export windows contact not implement yet";
//TODO
}
......
......@@ -23,6 +23,7 @@
#include <KAddressBookImportExport/KAddressBookImportExportPluginInterface>
#include <KContacts/Addressee>
class QFile;
class QDomDocument;
class WindowsContactImportExportPluginInterface : public KAddressBookImportExport::KAddressBookImportExportPluginInterface
{
Q_OBJECT
......@@ -41,6 +42,7 @@ private:
void slotImportWindowsContact();
void importWindowsContact();
void exportWindowsContact();
Q_REQUIRED_RESULT bool loadDomElement(QDomDocument &doc, QFile *file);
};
#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