Commit a9a12c79 authored by camilo higuita's avatar camilo higuita

fix issue with image provider for contacts

parent 49e86f2e
......@@ -5,7 +5,7 @@ project(dialer LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(ECM 1.7.0 REQUIRED NO_MODULE)
......@@ -20,9 +20,6 @@ include(ECMInstallIcons)
include(FeatureSummary)
include(ECMAddAppIcon)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTORCC ON)
set(dialer_SRCS
src/main.cpp
src/interfaces/synchroniser.cpp
......
......@@ -4,10 +4,10 @@
#endif
#include <QDebug>
ContactImage::ContactImage() : QQuickImageProvider(QQuickImageProvider::Image)
ContactImage::ContactImage(ImageType type, Flags flags)
: QQuickImageProvider(type, flags), no_image(QImage(":/portrait.jpg"))
{
this->no_image = QImage(":/portrait.jpg");
this->blockSignals(false);
// this->blockSignals(false);
}
QImage ContactImage::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
......
......@@ -8,8 +8,7 @@ class ContactImage : public QObject, public QQuickImageProvider
{
Q_OBJECT
public:
ContactImage();
ContactImage(ImageType type, Flags flags = nullptr);
QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
public slots:
......
......@@ -11,10 +11,6 @@
#include "./src/interfaces/kcontactsinterface.h"
#endif
extern void test()
{
qDebug()<< "from anotehr thread";
}
Synchroniser::Synchroniser(QObject *parent) : QObject (parent)
{
......
......@@ -25,8 +25,6 @@ public:
bool insertContact(const FMH::MODEL &contact, const FMH::MODEL &account = {{}});
bool updateContact(const FMH::MODEL &contact);
bool removeContact(const FMH::MODEL &contact);
// FMH::MODEL_LIST getAccounts() const;
private:
......@@ -34,7 +32,6 @@ private:
AndroidIntents *android;
#endif
signals:
void contactsReady(FMH::MODEL_LIST contacts);
void callLogsReady();
......
......@@ -13,6 +13,7 @@
#include <QApplication>
#endif
#include <memory>
#include "src/union.h"
#include "./src/models/basemodel.h"
......@@ -66,8 +67,11 @@ if(parser.isSet("sync"))
return 0;
}
QScopedPointer<ContactImage> contactImageProvider(new ContactImage());
{
// std::unique_ptr<ContactImage> contactImageProvider( new ContactImage);
QQmlApplicationEngine engine;
// engine->addImageProvider(QLatin1String("colors"), new ColorImageProvider);
// QQuickStyle::setStyle("Material");
#ifdef STATIC_KIRIGAMI
......@@ -79,7 +83,7 @@ if(parser.isSet("sync"))
#endif
engine.addImageProvider("contact", contactImageProvider.data());
engine.addImageProvider("contact", new ContactImage(QQuickImageProvider::ImageType::Image));
qmlRegisterUncreatableType<BaseList>("UnionModels", 1, 0, "BaseList", QStringLiteral("BaseList should not be created in QML"));
qmlRegisterType<BaseModel>("UnionModels", 1, 0, "BaseModel");
qmlRegisterType<ContactsModel>("UnionModels", 1, 0, "ContactsList");
......@@ -91,3 +95,4 @@ if(parser.isSet("sync"))
return app.exec();
}
}
......@@ -11,25 +11,22 @@
#include <MauiKit/fm.h>
#endif
ContactsModel::ContactsModel(QObject *parent) : BaseList(parent)
ContactsModel::ContactsModel(QObject *parent) : BaseList(parent), syncer(new Synchroniser(this))
{
this->syncer = new Synchroniser(this);
connect(syncer, &Synchroniser::contactsReady, [this](FMH::MODEL_LIST contacts)
{
qDebug() << "CONATCTS READY AT MODEL 1" << contacts;
emit this->preListChanged();
this->list = contacts;
this->listbk = this->list;
qDebug() << "CONATCTS READY AT MODEL" << this->list;
this->filter();
this->sortList();
emit this->postListChanged();
});
this->getList(true);
// connect(syncer, &Synchroniser::contactsReady, [this](FMH::MODEL_LIST contacts)
// {
// qDebug() << "CONATCTS READY AT MODEL 1" << contacts;
// emit this->preListChanged();
// this->list = contacts;
// this->listbk = this->list;
// qDebug() << "CONATCTS READY AT MODEL" << this->list;
// this->filter();
// this->sortList();
// emit this->postListChanged();
// });
// this->getList(true);
}
FMH::MODEL_LIST ContactsModel::items() const
......@@ -53,7 +50,6 @@ QString ContactsModel::getQuery() const
return this->query;
}
void ContactsModel::setSortBy(const SORTBY &sort)
{
if(this->sort == sort)
......
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