Commit 12a65d17 authored by Camilo higuita's avatar Camilo higuita

vcard now working too

parent ece06515
#include "synchroniser.h"
#include "./../db/dbactions.h"
#include "vcardproperty.h"
#include "vcard.h"
Synchroniser::Synchroniser(QObject *parent) : QObject (parent)
{
......@@ -10,28 +11,14 @@ Synchroniser::Synchroniser(QObject *parent) : QObject (parent)
FMH::MODEL_LIST Synchroniser::getContacts(const QString &query)
{
Q_UNUSED(query)
return {
{{FMH::MODEL_KEY::N, "Camilo Higuita"}, {FMH::MODEL_KEY::TITLE, "MauiKit Dev"}, {FMH::MODEL_KEY::TEL, "+57 3197673511"}, {FMH::MODEL_KEY::EMAIL, "camilohiguita@maui.org"}},
{{FMH::MODEL_KEY::N, "Anupam Basak"}, {FMH::MODEL_KEY::TITLE, "Nitrux Dev"}, {FMH::MODEL_KEY::EMAIL, "anupam_dev@maui.org"} },
{{FMH::MODEL_KEY::N, "Uri Herrera"}, {FMH::MODEL_KEY::TITLE, "Nitrux founder"}},
{{FMH::MODEL_KEY::N, "Valentina R"}, {FMH::MODEL_KEY::TITLE, "Designer"}, {FMH::MODEL_KEY::EMAIL, "uri_herera@maui.org"}},
{{FMH::MODEL_KEY::N, "Daniel Ray"}, {FMH::MODEL_KEY::TITLE, "Testing"}, {FMH::MODEL_KEY::TEL, "+57 3197673511"}},
{{FMH::MODEL_KEY::N, "Esteban Ergh"}, {FMH::MODEL_KEY::TITLE, "Testing"}, {FMH::MODEL_KEY::TEL, "+57 3197673511"}},
{{FMH::MODEL_KEY::N, "Sebastian Maui"}, {FMH::MODEL_KEY::TITLE, "Testing"}, {FMH::MODEL_KEY::TEL, "+57 3197673511"}, {FMH::MODEL_KEY::EMAIL, "testing@maui.org"}},
{{FMH::MODEL_KEY::N, "Camila Test"}, {FMH::MODEL_KEY::TITLE, "Testing"}, {FMH::MODEL_KEY::TEL, "+57 3197673511"}},
{{FMH::MODEL_KEY::N, "Aleix Unkown"}, {FMH::MODEL_KEY::TITLE, "Testing"}, {FMH::MODEL_KEY::TEL, "+57 3197673511"}, {FMH::MODEL_KEY::EMAIL, "testing@maui.org"}},
{{FMH::MODEL_KEY::N, "Daniel Ray"}, {FMH::MODEL_KEY::TITLE, "Testing"}, {FMH::MODEL_KEY::TEL, "+57 3197673511"}},
{{FMH::MODEL_KEY::N, "Pin Test"}, {FMH::MODEL_KEY::TITLE, "MauiKit Dev"}},
{{FMH::MODEL_KEY::N, "Hello World Higuita"}, {FMH::MODEL_KEY::TITLE, "MauiKit Dev"}, {FMH::MODEL_KEY::EMAIL, "testing@maui.org"}},
{{FMH::MODEL_KEY::N, "Alejandro Higuita"}, {FMH::MODEL_KEY::TITLE, "MauiKit Dev"}},
{{FMH::MODEL_KEY::N, "Julian Higuita"}, {FMH::MODEL_KEY::TITLE, "MauiKit Dev"}, {FMH::MODEL_KEY::EMAIL, "testing@maui.org"}},
{{FMH::MODEL_KEY::N, "Andres Higuita"}, {FMH::MODEL_KEY::TITLE, "MauiKit Dev"}}
};
return this->dba->getDBData(query);
}
bool Synchroniser::insertContact(const FMH::MODEL &contact)
{
vCard vcard;
vCardProperty name_prop = vCardProperty::createName("Emanuele", "Bertoldi");
vcard.addProperty(name_prop);
return this->dba->insertContact(contact);
}
QT += core
HEADERS += \
$$PWD/libvcard/include/vcard/vcard.h \
$$PWD/libvcard/include/vcard/vcardparam.h \
$$PWD/libvcard/include/vcard/vcardproperty.h
SOURCES += \
$$PWD/libvcard/libvcard/vcard.cpp \
$$PWD/libvcard/libvcard/vcardparam.cpp \
$$PWD/libvcard/libvcard/vcardproperty.cpp
DEPENDPATH += \
$$PWD/libvcard/include/vcard \
INCLUDEPATH += \
$$PWD/libvcard/include/vcard \
......@@ -130,7 +130,18 @@ QVariantMap ContactsModel::get(const int &index) const
bool ContactsModel::insert(const QVariantMap &map)
{
return this->syncer->insertContact(FM::toModel(map));
if(map.isEmpty())
return false;
auto model = FM::toModel(map);
if(!this->syncer->insertContact(model))
return false;
emit this->preListChanged();
this->setList();
emit this->postListChanged();
return true;
}
void ContactsModel::append(const QVariantMap &item)
......
......@@ -48,7 +48,7 @@ private:
void sortList();
void setList();
QString query;
QString query = "select * from contacts";
ContactsModel::SORTBY sort = ContactsModel::SORTBY::N;
signals:
......
......@@ -34,6 +34,7 @@ Maui.Dialog
photo: _img.source
})
newContact(contact)
control.close()
}
ColumnLayout
......
......@@ -14,6 +14,8 @@ linux:unix:!android {
message(Building for Linux KDE)
QT += webengine
QT += KService KNotifications KNotifications KI18n
QT += KIOCore KIOFileWidgets KIOWidgets KNTLM
LIBS += -lMauiKit
} else:android {
......@@ -31,6 +33,7 @@ linux:unix:!android {
message("Unknown configuration")
}
include($$PWD/src/libs/libvcard.pri)
SOURCES += \
$$PWD/src/main.cpp \
......
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