summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-11 11:35:43 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-11 11:35:43 (GMT)
commit84fba0ea2db2d292ec7c6f2c95283c6915f412fa (patch)
tree5c123fc69b0b01f20c86a967346c2956eab6912c
parented65673984db1c9f08377f5c7998cf4141a9a955 (diff)
Continue to implement plugins
-rw-r--r--CMakeLists.txt2
-rw-r--r--kaddressbook/importexportplugins/csv/csvimportexportplugin.cpp7
-rw-r--r--kaddressbook/importexportplugins/csv/csvimportexportplugin.h4
-rw-r--r--kaddressbook/importexportplugins/csv/csvimportexportplugininterface.cpp43
-rw-r--r--kaddressbook/importexportplugins/csv/csvimportexportplugininterface.h2
-rw-r--r--kaddressbook/importexportplugins/gmx/gmximportexportplugin.cpp7
-rw-r--r--kaddressbook/importexportplugins/gmx/gmximportexportplugin.h4
-rw-r--r--kaddressbook/importexportplugins/ldap/ldapimportexportplugin.cpp7
-rw-r--r--kaddressbook/importexportplugins/ldap/ldapimportexportplugin.h4
-rw-r--r--kaddressbook/importexportplugins/ldap/ldapimportexportplugininterface.cpp20
-rw-r--r--kaddressbook/importexportplugins/ldap/ldapimportexportplugininterface.h3
-rw-r--r--kaddressbook/importexportplugins/ldif/ldifimportexportplugin.cpp7
-rw-r--r--kaddressbook/importexportplugins/ldif/ldifimportexportplugin.h4
-rw-r--r--kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.cpp40
-rw-r--r--kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.h3
-rw-r--r--kaddressbook/importexportplugins/shared/importexportengine.cpp8
-rw-r--r--kaddressbook/importexportplugins/shared/importexportengine.h2
-rw-r--r--kaddressbook/importexportplugins/vcards/vcardimportexportplugin.cpp6
-rw-r--r--kaddressbook/importexportplugins/vcards/vcardimportexportplugin.h4
19 files changed, 82 insertions, 95 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 559e112..645663a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,7 +63,7 @@ set(GRANTLEETHEME_LIB_VERSION "5.3.40")
set(CALENDARSUPPORT_LIB_VERSION "5.3.40")
set(EVENTVIEW_LIB_VERSION "5.3.40")
set(LIBKDEPIM_LIB_VERSION "5.3.40")
-set(KDEPIM_APPS_LIB_VERSION "5.3.50")
+set(KDEPIM_APPS_LIB_VERSION "5.3.51")
set(LIBKLEO_LIB_VERSION "5.3.40")
set(AKONADI_LIB_VERSION "5.3.45")
set(INCIDENCEEDITOR_LIB_VERSION "5.3.40")
diff --git a/kaddressbook/importexportplugins/csv/csvimportexportplugin.cpp b/kaddressbook/importexportplugins/csv/csvimportexportplugin.cpp
index 17e3d1a..c2d3dd6 100644
--- a/kaddressbook/importexportplugins/csv/csvimportexportplugin.cpp
+++ b/kaddressbook/importexportplugins/csv/csvimportexportplugin.cpp
@@ -20,8 +20,11 @@
#include "csvimportexportplugin.h"
#include "csvimportexportplugininterface.h"
+#include <kpluginfactory.h>
-CSVImportExportPlugin::CSVImportExportPlugin(QObject *parent)
+K_PLUGIN_FACTORY_WITH_JSON(CSVImportExportPluginFactory, "kaddressbook_importexportcsvplugin.json", registerPlugin<CSVImportExportPlugin>();)
+
+CSVImportExportPlugin::CSVImportExportPlugin(QObject *parent, const QList<QVariant> &)
: KAddressBookImportExport::KAddressBookImportExportPlugin(parent)
{
@@ -44,3 +47,5 @@ bool CSVImportExportPlugin::hasPopupMenuSupport() const
{
return true;
}
+
+#include "csvimportexportplugin.moc"
diff --git a/kaddressbook/importexportplugins/csv/csvimportexportplugin.h b/kaddressbook/importexportplugins/csv/csvimportexportplugin.h
index 3a69041..51eaf68 100644
--- a/kaddressbook/importexportplugins/csv/csvimportexportplugin.h
+++ b/kaddressbook/importexportplugins/csv/csvimportexportplugin.h
@@ -21,12 +21,12 @@
#ifndef CSVIMPORTEXPORTPLUGIN_H
#define CSVIMPORTEXPORTPLUGIN_H
#include <KAddressBookImportExport/KAddressBookImportExportPlugin>
-
+#include <QVariant>
class CSVImportExportPlugin : public KAddressBookImportExport::KAddressBookImportExportPlugin
{
Q_OBJECT
public:
- explicit CSVImportExportPlugin(QObject *parent = Q_NULLPTR);
+ explicit CSVImportExportPlugin(QObject *parent = Q_NULLPTR, const QList<QVariant> & = {});
~CSVImportExportPlugin();
PimCommon::AbstractGenericPluginInterface *createInterface(KActionCollection *ac, QObject *parent) Q_DECL_OVERRIDE;
diff --git a/kaddressbook/importexportplugins/csv/csvimportexportplugininterface.cpp b/kaddressbook/importexportplugins/csv/csvimportexportplugininterface.cpp
index 1c8a7cb..ec2cf96 100644
--- a/kaddressbook/importexportplugins/csv/csvimportexportplugininterface.cpp
+++ b/kaddressbook/importexportplugins/csv/csvimportexportplugininterface.cpp
@@ -35,8 +35,7 @@
#include <KIO/Job>
CSVImportExportPluginInterface::CSVImportExportPluginInterface(QObject *parent)
- : KAddressBookImportExport::KAddressBookImportExportPluginInterface(parent),
- mEngine(Q_NULLPTR)
+ : KAddressBookImportExport::KAddressBookImportExportPluginInterface(parent)
{
}
@@ -84,22 +83,12 @@ void CSVImportExportPluginInterface::importCSV()
}
delete dlg;
- if (!mEngine) {
- mEngine = new ImportExportEngine(this);
- }
- mEngine->setContactList(contactList);
- mEngine->setDefaultAddressBook(defaultCollection());
- connect(mEngine, &ImportExportEngine::finished, this, &CSVImportExportPluginInterface::slotFinished);
- mEngine->importContacts();
+ ImportExportEngine *engine = new ImportExportEngine(this);
+ engine->setContactList(contactList);
+ engine->setDefaultAddressBook(defaultCollection());
+ engine->importContacts();
}
-void CSVImportExportPluginInterface::slotFinished()
-{
- mEngine->deleteLater();
- mEngine = Q_NULLPTR;
-}
-
-
void CSVImportExportPluginInterface::slotImportCVS()
{
mImportExportAction = Import;
@@ -114,12 +103,11 @@ void CSVImportExportPluginInterface::slotExportCVS()
void CSVImportExportPluginInterface::exportToFile(QFile *file, const KContacts::Addressee::List &contacts) const
{
-#if 0 //FIXME
QTextStream stream(file);
stream.setCodec(QTextCodec::codecForLocale());
- ContactFields::Fields fields = ContactFields::allFields();
- fields.remove(ContactFields::Undefined);
+ KAddressBookImportExport::KAddressBookImportExportContactFields::Fields fields = KAddressBookImportExport::KAddressBookImportExportContactFields::allFields();
+ fields.remove(KAddressBookImportExport::KAddressBookImportExportContactFields::Undefined);
bool first = true;
@@ -130,7 +118,7 @@ void CSVImportExportPluginInterface::exportToFile(QFile *file, const KContacts::
}
// add quoting as defined in RFC 4180
- QString label = ContactFields::label(fields.at(i));
+ QString label = KAddressBookImportExport::KAddressBookImportExportContactFields::label(fields.at(i));
label.replace(QLatin1Char('"'), QStringLiteral("\"\""));
stream << "\"" << label << "\"";
@@ -150,15 +138,15 @@ void CSVImportExportPluginInterface::exportToFile(QFile *file, const KContacts::
}
QString content;
- if (fields.at(j) == ContactFields::Birthday ||
- fields.at(j) == ContactFields::Anniversary) {
+ if (fields.at(j) == KAddressBookImportExport::KAddressBookImportExportContactFields::Birthday ||
+ fields.at(j) == KAddressBookImportExport::KAddressBookImportExportContactFields::Anniversary) {
const QDateTime dateTime =
- QDateTime::fromString(ContactFields::value(fields.at(j), contact), Qt::ISODate);
+ QDateTime::fromString(KAddressBookImportExport::KAddressBookImportExportContactFields::value(fields.at(j), contact), Qt::ISODate);
if (dateTime.isValid()) {
content = dateTime.date().toString(Qt::ISODate);
}
} else {
- content = ContactFields::value(fields.at(j), contact).replace(QLatin1Char('\n'), QStringLiteral("\\n"));
+ content = KAddressBookImportExport::KAddressBookImportExportContactFields::value(fields.at(j), contact).replace(QLatin1Char('\n'), QStringLiteral("\\n"));
}
// add quoting as defined in RFC 4180
@@ -170,7 +158,6 @@ void CSVImportExportPluginInterface::exportToFile(QFile *file, const KContacts::
stream << "\n";
}
-#endif
}
void CSVImportExportPluginInterface::exportCSV()
@@ -202,13 +189,11 @@ void CSVImportExportPluginInterface::exportCSV()
KMessageBox::error(parentWidget(), msg);
return;
}
-#if 0 //FIXME
- exportToFile(&tmpFile, contacts.addressList());
+ exportToFile(&tmpFile, addressBookImportExportList().addressList());
tmpFile.flush();
auto job = KIO::file_copy(QUrl::fromLocalFile(tmpFile.fileName()), url, -1, KIO::Overwrite);
KJobWidgets::setWindow(job, parentWidget());
job->exec();
-#endif
} else {
QFile file(url.toLocalFile());
if (!file.open(QIODevice::WriteOnly)) {
@@ -217,7 +202,7 @@ void CSVImportExportPluginInterface::exportCSV()
return;
}
- //FIXME exportToFile(&file, contacts.addressList());
+ exportToFile(&file, addressBookImportExportList().addressList());
file.close();
}
diff --git a/kaddressbook/importexportplugins/csv/csvimportexportplugininterface.h b/kaddressbook/importexportplugins/csv/csvimportexportplugininterface.h
index 521e9ff..d7f2e47 100644
--- a/kaddressbook/importexportplugins/csv/csvimportexportplugininterface.h
+++ b/kaddressbook/importexportplugins/csv/csvimportexportplugininterface.h
@@ -23,7 +23,6 @@
#include <KAddressBookImportExport/KAddressBookImportExportPluginInterface>
#include <KContacts/Addressee>
class QFile;
-class ImportExportEngine;
class CSVImportExportPluginInterface : public KAddressBookImportExport::KAddressBookImportExportPluginInterface
{
Q_OBJECT
@@ -40,7 +39,6 @@ private:
void slotExportCVS();
void exportToFile(QFile *file, const KContacts::Addressee::List &contacts) const;
void importCSV();
- ImportExportEngine *mEngine;
};
#endif // CSVIMPORTEXPORTPLUGININTERFACE_H
diff --git a/kaddressbook/importexportplugins/gmx/gmximportexportplugin.cpp b/kaddressbook/importexportplugins/gmx/gmximportexportplugin.cpp
index 8f79ce8..2ef9a7a 100644
--- a/kaddressbook/importexportplugins/gmx/gmximportexportplugin.cpp
+++ b/kaddressbook/importexportplugins/gmx/gmximportexportplugin.cpp
@@ -20,8 +20,11 @@
#include "gmximportexportplugin.h"
#include "gmximportexportplugininterface.h"
+#include <kpluginfactory.h>
-GMXImportExportPlugin::GMXImportExportPlugin(QObject *parent)
+K_PLUGIN_FACTORY_WITH_JSON(GMXImportExportPluginFactory, "kaddressbook_importexportgmxplugin.json", registerPlugin<GMXImportExportPlugin>();)
+
+GMXImportExportPlugin::GMXImportExportPlugin(QObject *parent, const QList<QVariant> &)
: KAddressBookImportExport::KAddressBookImportExportPlugin(parent)
{
@@ -44,3 +47,5 @@ bool GMXImportExportPlugin::hasPopupMenuSupport() const
{
return true;
}
+
+#include "gmximportexportplugin.moc"
diff --git a/kaddressbook/importexportplugins/gmx/gmximportexportplugin.h b/kaddressbook/importexportplugins/gmx/gmximportexportplugin.h
index 1e273ad..930f021 100644
--- a/kaddressbook/importexportplugins/gmx/gmximportexportplugin.h
+++ b/kaddressbook/importexportplugins/gmx/gmximportexportplugin.h
@@ -21,12 +21,12 @@
#ifndef GMXIMPORTEXPORTPLUGIN_H
#define GMXIMPORTEXPORTPLUGIN_H
#include <KAddressBookImportExport/KAddressBookImportExportPlugin>
-
+#include <QVariant>
class GMXImportExportPlugin : public KAddressBookImportExport::KAddressBookImportExportPlugin
{
Q_OBJECT
public:
- explicit GMXImportExportPlugin(QObject *parent = Q_NULLPTR);
+ explicit GMXImportExportPlugin(QObject *parent = Q_NULLPTR, const QList<QVariant> & = {});
~GMXImportExportPlugin();
PimCommon::AbstractGenericPluginInterface *createInterface(KActionCollection *ac, QObject *parent) Q_DECL_OVERRIDE;
diff --git a/kaddressbook/importexportplugins/ldap/ldapimportexportplugin.cpp b/kaddressbook/importexportplugins/ldap/ldapimportexportplugin.cpp
index c55e518..8b928e3 100644
--- a/kaddressbook/importexportplugins/ldap/ldapimportexportplugin.cpp
+++ b/kaddressbook/importexportplugins/ldap/ldapimportexportplugin.cpp
@@ -20,8 +20,11 @@
#include "ldapimportexportplugin.h"
#include "ldapimportexportplugininterface.h"
+#include <kpluginfactory.h>
-LDapImportExportPlugin::LDapImportExportPlugin(QObject *parent)
+K_PLUGIN_FACTORY_WITH_JSON(LDapImportExportPluginFactory, "kaddressbook_importexportldapplugin.json", registerPlugin<LDapImportExportPlugin>();)
+
+LDapImportExportPlugin::LDapImportExportPlugin(QObject *parent, const QList<QVariant> &)
: KAddressBookImportExport::KAddressBookImportExportPlugin(parent)
{
@@ -44,3 +47,5 @@ bool LDapImportExportPlugin::hasPopupMenuSupport() const
{
return true;
}
+
+#include "ldapimportexportplugin.moc"
diff --git a/kaddressbook/importexportplugins/ldap/ldapimportexportplugin.h b/kaddressbook/importexportplugins/ldap/ldapimportexportplugin.h
index e628069..1d73315 100644
--- a/kaddressbook/importexportplugins/ldap/ldapimportexportplugin.h
+++ b/kaddressbook/importexportplugins/ldap/ldapimportexportplugin.h
@@ -21,12 +21,12 @@
#ifndef LDAPIMPORTEXPORTPLUGIN_H
#define LDAPIMPORTEXPORTPLUGIN_H
#include <KAddressBookImportExport/KAddressBookImportExportPlugin>
-
+#include <QVariant>
class LDapImportExportPlugin : public KAddressBookImportExport::KAddressBookImportExportPlugin
{
Q_OBJECT
public:
- explicit LDapImportExportPlugin(QObject *parent = Q_NULLPTR);
+ explicit LDapImportExportPlugin(QObject *parent = Q_NULLPTR, const QList<QVariant> & = {});
~LDapImportExportPlugin();
PimCommon::AbstractGenericPluginInterface *createInterface(KActionCollection *ac, QObject *parent) Q_DECL_OVERRIDE;
diff --git a/kaddressbook/importexportplugins/ldap/ldapimportexportplugininterface.cpp b/kaddressbook/importexportplugins/ldap/ldapimportexportplugininterface.cpp
index 91b91d0..f5ba4e8 100644
--- a/kaddressbook/importexportplugins/ldap/ldapimportexportplugininterface.cpp
+++ b/kaddressbook/importexportplugins/ldap/ldapimportexportplugininterface.cpp
@@ -27,8 +27,7 @@
#include "../shared/importexportengine.h"
LDapImportExportPluginInterface::LDapImportExportPluginInterface(QObject *parent)
- : KAddressBookImportExport::KAddressBookImportExportPluginInterface(parent),
- mEngine(Q_NULLPTR)
+ : KAddressBookImportExport::KAddressBookImportExportPluginInterface(parent)
{
}
@@ -75,17 +74,8 @@ void LDapImportExportPluginInterface::importLdap()
}
delete dlg;
- if (!mEngine) {
- mEngine = new ImportExportEngine(this);
- }
- mEngine->setContactList(contactList);
- mEngine->setDefaultAddressBook(defaultCollection());
- connect(mEngine, &ImportExportEngine::finished, this, &LDapImportExportPluginInterface::slotFinished);
- mEngine->importContacts();
-}
-
-void LDapImportExportPluginInterface::slotFinished()
-{
- mEngine->deleteLater();
- mEngine = Q_NULLPTR;
+ ImportExportEngine *engine = new ImportExportEngine(this);
+ engine->setContactList(contactList);
+ engine->setDefaultAddressBook(defaultCollection());
+ engine->importContacts();
}
diff --git a/kaddressbook/importexportplugins/ldap/ldapimportexportplugininterface.h b/kaddressbook/importexportplugins/ldap/ldapimportexportplugininterface.h
index bd3b4d2..6dbd8fd 100644
--- a/kaddressbook/importexportplugins/ldap/ldapimportexportplugininterface.h
+++ b/kaddressbook/importexportplugins/ldap/ldapimportexportplugininterface.h
@@ -21,7 +21,6 @@
#define LDAPIMPORTEXPORTPLUGININTERFACE_H
#include <KAddressBookImportExport/KAddressBookImportExportPluginInterface>
-class ImportExportEngine;
class LDapImportExportPluginInterface : public KAddressBookImportExport::KAddressBookImportExportPluginInterface
{
Q_OBJECT
@@ -33,9 +32,7 @@ public:
void exec() Q_DECL_OVERRIDE;
private:
void slotImportLdap();
- void slotFinished();
void importLdap();
- ImportExportEngine *mEngine;
};
#endif // LDAPIMPORTEXPORTPLUGININTERFACE_H
diff --git a/kaddressbook/importexportplugins/ldif/ldifimportexportplugin.cpp b/kaddressbook/importexportplugins/ldif/ldifimportexportplugin.cpp
index 7e05820..b230eda 100644
--- a/kaddressbook/importexportplugins/ldif/ldifimportexportplugin.cpp
+++ b/kaddressbook/importexportplugins/ldif/ldifimportexportplugin.cpp
@@ -20,8 +20,11 @@
#include "ldifimportexportplugin.h"
#include "ldifimportexportplugininterface.h"
+#include <kpluginfactory.h>
-LDifImportExportPlugin::LDifImportExportPlugin(QObject *parent)
+K_PLUGIN_FACTORY_WITH_JSON(LDifImportExportPluginFactory, "kaddressbook_importexportldifplugin.json", registerPlugin<LDifImportExportPlugin>();)
+
+LDifImportExportPlugin::LDifImportExportPlugin(QObject *parent, const QList<QVariant> &)
: KAddressBookImportExport::KAddressBookImportExportPlugin(parent)
{
@@ -44,3 +47,5 @@ bool LDifImportExportPlugin::hasPopupMenuSupport() const
{
return true;
}
+
+#include "ldifimportexportplugin.moc"
diff --git a/kaddressbook/importexportplugins/ldif/ldifimportexportplugin.h b/kaddressbook/importexportplugins/ldif/ldifimportexportplugin.h
index 8de4e7d..dc02a9c 100644
--- a/kaddressbook/importexportplugins/ldif/ldifimportexportplugin.h
+++ b/kaddressbook/importexportplugins/ldif/ldifimportexportplugin.h
@@ -21,12 +21,12 @@
#ifndef LDIFIMPORTEXPORTPLUGIN_H
#define LDIFIMPORTEXPORTPLUGIN_H
#include <KAddressBookImportExport/KAddressBookImportExportPlugin>
-
+#include <QVariant>
class LDifImportExportPlugin : public KAddressBookImportExport::KAddressBookImportExportPlugin
{
Q_OBJECT
public:
- explicit LDifImportExportPlugin(QObject *parent = Q_NULLPTR);
+ explicit LDifImportExportPlugin(QObject *parent = Q_NULLPTR, const QList<QVariant> & = {});
~LDifImportExportPlugin();
PimCommon::AbstractGenericPluginInterface *createInterface(KActionCollection *ac, QObject *parent) Q_DECL_OVERRIDE;
diff --git a/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.cpp b/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.cpp
index 6775d54..19deac6 100644
--- a/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.cpp
+++ b/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.cpp
@@ -26,14 +26,15 @@
#include <QFile>
#include <QTextStream>
#include <KMessageBox>
+#include <QTemporaryFile>
#include <KJobWidgets>
+#include <KIOCore/kio/filecopyjob.h>
#include <PimCommon/RenameFileDialog>
#include <KContacts/LDIFConverter>
#include <KAddressBookImportExport/KAddressBookImportExportContactList>
LDifImportExportPluginInterface::LDifImportExportPluginInterface(QObject *parent)
- : KAddressBookImportExport::KAddressBookImportExportPluginInterface(parent),
- mEngine(Q_NULLPTR)
+ : KAddressBookImportExport::KAddressBookImportExportPluginInterface(parent)
{
}
@@ -111,18 +112,24 @@ void LDifImportExportPluginInterface::import()
contactList.setAddressList(lstAddresses);
contactList.setContactGroupList(lstGroup);
- if (!mEngine) {
- mEngine = new ImportExportEngine(this);
- }
- mEngine->setContactList(contactList);
- mEngine->setDefaultAddressBook(defaultCollection());
- connect(mEngine, &ImportExportEngine::finished, this, &LDifImportExportPluginInterface::slotFinished);
- mEngine->importContacts();
+ ImportExportEngine *engine = new ImportExportEngine(this);
+ engine->setContactList(contactList);
+ engine->setDefaultAddressBook(defaultCollection());
+ engine->importContacts();
+}
+
+void doExport(QFile *file, const KAddressBookImportExport::KAddressBookImportExportContactList &list)
+{
+ QString data;
+ KContacts::LDIFConverter::addresseeAndContactGroupToLDIF(list.addressList(), list.contactGroupList(), data);
+
+ QTextStream stream(file);
+ stream.setCodec("UTF-8");
+ stream << data;
}
void LDifImportExportPluginInterface::exportLdif()
{
-#if 0 //FIXME
const QUrl url =
QFileDialog::getSaveFileUrl(parentWidget(), QString(), QUrl::fromLocalFile(QDir::homePath() + QLatin1String("/addressbook.ldif")), i18n("LDif Files (*.ldif)"));
if (url.isEmpty()) {
@@ -137,7 +144,7 @@ void LDifImportExportPluginInterface::exportLdif()
return;
}
- doExport(&tmpFile, list);
+ doExport(&tmpFile, addressBookImportExportList());
tmpFile.flush();
auto job = KIO::file_copy(QUrl::fromLocalFile(tmpFile.fileName()), url, -1, KIO::Overwrite);
KJobWidgets::setWindow(job, parentWidget());
@@ -169,18 +176,11 @@ void LDifImportExportPluginInterface::exportLdif()
return;
}
QString data;
- KContacts::LDIFConverter::addresseeAndContactGroupToLDIF(list.addressList(), list.contactGroupList(), data);
+ KContacts::LDIFConverter::addresseeAndContactGroupToLDIF(addressBookImportExportList().addressList(), addressBookImportExportList().contactGroupList(), data);
- QTextStream stream(file);
+ QTextStream stream(&file);
stream.setCodec("UTF-8");
stream << data;
file.close();
}
-#endif
-}
-
-void LDifImportExportPluginInterface::slotFinished()
-{
- mEngine->deleteLater();
- mEngine = Q_NULLPTR;
}
diff --git a/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.h b/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.h
index c6f644a..655bf87 100644
--- a/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.h
+++ b/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.h
@@ -21,7 +21,6 @@
#define LDIFIMPORTEXPORTPLUGININTERFACE_H
#include <KAddressBookImportExport/KAddressBookImportExportPluginInterface>
-class ImportExportEngine;
class LDifImportExportPluginInterface : public KAddressBookImportExport::KAddressBookImportExportPluginInterface
{
Q_OBJECT
@@ -36,8 +35,6 @@ private:
void slotExportLdif();
void import();
void exportLdif();
- void slotFinished();
- ImportExportEngine *mEngine;
};
#endif // LDIFIMPORTEXPORTPLUGININTERFACE_H
diff --git a/kaddressbook/importexportplugins/shared/importexportengine.cpp b/kaddressbook/importexportplugins/shared/importexportengine.cpp
index 6133360..4948336 100644
--- a/kaddressbook/importexportplugins/shared/importexportengine.cpp
+++ b/kaddressbook/importexportplugins/shared/importexportengine.cpp
@@ -46,11 +46,6 @@ void ImportExportEngine::setContactList(const KAddressBookImportExport::KAddress
mContactsList = contacts;
}
-void ImportExportEngine::exportContacts()
-{
-
-}
-
void ImportExportEngine::setParentWidget(QWidget *parent)
{
mParentWidget = parent;
@@ -70,6 +65,7 @@ void ImportExportEngine::importContacts()
{
if (mContactsList.isEmpty()) { // nothing to import
Q_EMIT finished();
+ deleteLater();
return;
}
@@ -85,6 +81,7 @@ void ImportExportEngine::importContacts()
if (!dlg->exec() || !dlg) {
delete dlg;
+ deleteLater();
return;
}
@@ -121,6 +118,7 @@ void ImportExportEngine::importContacts()
connect(createJob, &KJob::result, this, &ImportExportEngine::slotImportJobDone);
}
Q_EMIT finished();
+ deleteLater();
}
void ImportExportEngine::slotImportJobDone(KJob *)
diff --git a/kaddressbook/importexportplugins/shared/importexportengine.h b/kaddressbook/importexportplugins/shared/importexportengine.h
index 63616cd..256ccf3 100644
--- a/kaddressbook/importexportplugins/shared/importexportengine.h
+++ b/kaddressbook/importexportplugins/shared/importexportengine.h
@@ -35,12 +35,10 @@ public:
void setContactList(const KAddressBookImportExport::KAddressBookImportExportContactList &contacts);
void importContacts();
- void exportContacts();
void setParentWidget(QWidget *parent);
QWidget *parentWidget() const;
void setDefaultAddressBook(const Akonadi::Collection &defaultAddressBook);
-
Q_SIGNALS:
void finished();
diff --git a/kaddressbook/importexportplugins/vcards/vcardimportexportplugin.cpp b/kaddressbook/importexportplugins/vcards/vcardimportexportplugin.cpp
index c6dc554..6b48d42 100644
--- a/kaddressbook/importexportplugins/vcards/vcardimportexportplugin.cpp
+++ b/kaddressbook/importexportplugins/vcards/vcardimportexportplugin.cpp
@@ -20,8 +20,10 @@
#include "vcardimportexportplugin.h"
#include "vcardimportexportplugininterface.h"
+#include <kpluginfactory.h>
-VCardImportExportPlugin::VCardImportExportPlugin(QObject *parent)
+K_PLUGIN_FACTORY_WITH_JSON(VCardImportExportPluginFactory, "kaddressbook_importexportvcardplugin.json", registerPlugin<VCardImportExportPlugin>();)
+VCardImportExportPlugin::VCardImportExportPlugin(QObject *parent, const QList<QVariant> &)
: KAddressBookImportExport::KAddressBookImportExportPlugin(parent)
{
@@ -44,3 +46,5 @@ bool VCardImportExportPlugin::hasPopupMenuSupport() const
{
return true;
}
+
+#include "vcardimportexportplugin.moc"
diff --git a/kaddressbook/importexportplugins/vcards/vcardimportexportplugin.h b/kaddressbook/importexportplugins/vcards/vcardimportexportplugin.h
index ece4ae9..70564dd 100644
--- a/kaddressbook/importexportplugins/vcards/vcardimportexportplugin.h
+++ b/kaddressbook/importexportplugins/vcards/vcardimportexportplugin.h
@@ -21,12 +21,12 @@
#ifndef VCARDIMPORTEXPORTPLUGIN_H
#define VCARDIMPORTEXPORTPLUGIN_H
#include <KAddressBookImportExport/KAddressBookImportExportPlugin>
-
+#include <QVariant>
class VCardImportExportPlugin : public KAddressBookImportExport::KAddressBookImportExportPlugin
{
Q_OBJECT
public:
- explicit VCardImportExportPlugin(QObject *parent = Q_NULLPTR);
+ explicit VCardImportExportPlugin(QObject *parent = Q_NULLPTR, const QList<QVariant> & = {});
~VCardImportExportPlugin();
PimCommon::AbstractGenericPluginInterface *createInterface(KActionCollection *ac, QObject *parent) Q_DECL_OVERRIDE;