You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
2.8 KiB
C

#ifndef ADDRESSBOOKDATA_H
#define ADDRESSBOOKDATA_H
#include "../addressbook_global.h"
#include <data/comboitem.h>
#include <data/countrydata.h>
#include <QObject>
#include <QString>
#include <QDate>
#include <QtCore/qglobal.h>
#include <QSharedPointer>
#include <QxOrm.h>
class ADDRESSBOOKSHARED_EXPORT AddressbookData : public ComboItem
{
Q_OBJECT
QX_REGISTER_FRIEND_CLASS(AddressbookData)
Q_PROPERTY(QString title READ title WRITE setTitle)
Q_PROPERTY(QString firstName READ firstName WRITE setFirstName)
Q_PROPERTY(QString lastName READ lastName WRITE setLastName)
Q_PROPERTY(QDate birthDate READ birthDate WRITE setBirthDate)
Q_PROPERTY(QString idCardNumber READ idCardNumber WRITE setIdCardNumber)
Q_PROPERTY(bool ztp READ ztp WRITE setZtp)
Q_PROPERTY(QString addressCity READ addressCity WRITE setAddressCity)
Q_PROPERTY(QString addressStreet READ addressStreet WRITE setAddressStreet)
Q_PROPERTY(QString addressHouseNumber READ addressHouseNumber WRITE setAddressHouseNumber)
Q_PROPERTY(QString addressZipCode READ addressZipCode WRITE setAddressZipCode)
Q_PROPERTY(QSharedPointer<QObject> country READ country WRITE setCountry)
public:
AddressbookData(QObject *parent = 0);
QString title() const;
void setTitle(const QString &title);
QString firstName() const;
void setFirstName(const QString &firstName);
QString lastName() const;
void setLastName(const QString &lastName);
QDate birthDate() const;
void setBirthDate(const QDate &birthDate);
QString idCardNumber() const;
void setIdCardNumber(const QString &idCardNumber);
bool ztp() const;
void setZtp(bool ztp);
QString addressCity() const;
void setAddressCity(const QString &addressCity);
QString addressStreet() const;
void setAddressStreet(const QString &addressStreet);
QString addressHouseNumber() const;
void setAddressHouseNumber(const QString &addressHouseNumber);
QString addressZipCode() const;
void setAddressZipCode(const QString &addressZipCode);
long id() const;
void setId(long id);
QSharedPointer<QObject> country() const;
void setCountry(const QSharedPointer<QObject> &country);
Q_INVOKABLE QStringList eagerLoad();
private:
long m_id{0};
QString m_title;
QString m_firstName;
QString m_lastName;
QDate m_birthDate;
QString m_idCardNumber;
bool m_ztp;
QString m_addressCity;
QString m_addressStreet;
QString m_addressHouseNumber;
QString m_addressZipCode;
CountryDataPtr m_country;
// ComboItem interface
public:
bool eq(ComboItem *other) override;
QString toString() override;
};
typedef QSharedPointer<AddressbookData> AddressbookDataPtr;
QX_REGISTER_HPP_ADDR(AddressbookData, ComboItem, 0)
#endif // ADDRESSBOOKDATA_H