Commit 9b2ea142 authored by Laurent Montel's avatar Laurent Montel 😁

Start using AbstractDisplayInfo

parent 5984f027
......@@ -19,6 +19,7 @@
#include "abstract/abstractaddressbook.h"
#include "importwizard.h"
#include "importaddressbookpage.h"
#include "abstractdisplayinfo.h"
#include <KContacts/Addressee>
#include <kcontacts/contactgroup.h>
......@@ -31,7 +32,9 @@
#include <QPointer>
using namespace LibImportWizard;
AbstractAddressBook::AbstractAddressBook(ImportWizard *parent)
: mImportWizard(parent), mCollection(-1)
: mImportWizard(parent),
mAbstractDisplayInfo(nullptr),
mCollection(-1)
{
}
......@@ -85,6 +88,11 @@ void AbstractAddressBook::addImportContactNote(KContacts::Addressee &address, co
address.setNote(currentNote);
}
void AbstractAddressBook::setAbstractDisplayInfo(AbstractDisplayInfo *abstractDisplayInfo)
{
mAbstractDisplayInfo = abstractDisplayInfo;
}
void AbstractAddressBook::createContact(const KContacts::Addressee &address)
{
if (selectAddressBook()) {
......@@ -118,15 +126,15 @@ void AbstractAddressBook::addImportError(const QString &log)
void AbstractAddressBook::addAddressBookImportInfo(const QString &log)
{
if (mImportWizard) {
mImportWizard->importAddressBookPage()->addImportInfo(log);
if (mAbstractDisplayInfo) {
mAbstractDisplayInfo->addressbookImportInfo(log);
}
}
void AbstractAddressBook::addAddressBookImportError(const QString &log)
{
if (mImportWizard) {
mImportWizard->importAddressBookPage()->addImportError(log);
if (mAbstractDisplayInfo) {
mAbstractDisplayInfo->addressbookImportError(log);
}
}
......
......@@ -35,6 +35,7 @@ class ContactGroup;
class KJob;
namespace LibImportWizard
{
class AbstractDisplayInfo;
class LIBIMPORTWIZARD_EXPORT AbstractAddressBook: public LibImportWizard::AbstractBase
{
Q_OBJECT
......@@ -42,6 +43,8 @@ public:
explicit AbstractAddressBook(ImportWizard *parent);
~AbstractAddressBook();
void setAbstractDisplayInfo(AbstractDisplayInfo *abstractDisplayInfo);
protected:
void createGroup(const KContacts::ContactGroup &group);
void createContact(const KContacts::Addressee &address);
......@@ -56,6 +59,7 @@ protected:
protected:
ImportWizard *mImportWizard;
AbstractDisplayInfo *mAbstractDisplayInfo;
private:
void slotStoreDone(KJob *job);
......
......@@ -29,6 +29,7 @@ class LIBIMPORTWIZARD_EXPORT AbstractDisplayInfo
{
public:
AbstractDisplayInfo();
virtual ~AbstractDisplayInfo() = default;
virtual void calendarImportError(const QString &log);
virtual void settingsImportError(const QString &log);
......
......@@ -35,7 +35,9 @@ using namespace LibImportWizard;
AbstractImporter::AbstractImporter(QObject *parent)
: QObject(parent),
mImportWizard(nullptr)
mImportWizard(nullptr),
mAbstractDisplayInfo(nullptr),
mParentWidget(nullptr)
{
}
......@@ -150,3 +152,8 @@ QWidget *AbstractImporter::parentWidget() const
{
return mParentWidget;
}
void AbstractImporter::setAbstractDisplayInfo(AbstractDisplayInfo *info)
{
mAbstractDisplayInfo = info;
}
......@@ -36,6 +36,7 @@ class FilterImporterExporter;
}
namespace LibImportWizard {
class AbstractDisplayInfo;
class LIBIMPORTWIZARD_EXPORT AbstractImporter : public QObject
{
Q_OBJECT
......@@ -79,6 +80,9 @@ public:
void setParentWidget(QWidget *parent);
QWidget *parentWidget() const;
void setAbstractDisplayInfo(AbstractDisplayInfo *info);
protected:
//TODO we need to redefine it.
virtual void initializeFilter(MailImporter::Filter &filter);
......@@ -92,6 +96,7 @@ protected:
QString mPath;
ImportWizard *mImportWizard;
AbstractDisplayInfo *mAbstractDisplayInfo;
QWidget *mParentWidget;
};
}
......
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