Added country combo to addressbook. Addressbook plugin depends on Countryregister which must be loaded first.
This commit is contained in:
@@ -106,6 +106,19 @@ void AddressbookData::setId(int id)
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
QSharedPointer<QObject> AddressbookData::country() const
|
||||
{
|
||||
return m_country;
|
||||
}
|
||||
|
||||
void AddressbookData::setCountry(const QSharedPointer<QObject> &country)
|
||||
{
|
||||
if (qobject_cast<CountryData*>(country.data()) != NULL)
|
||||
{
|
||||
m_country = qSharedPointerDynamicCast<CountryData, QObject>(country);
|
||||
}
|
||||
}
|
||||
|
||||
bool AddressbookData::eq(ComboItem *other)
|
||||
{
|
||||
AddressbookData *adb = qobject_cast<AddressbookData*>(other);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include <data/comboitem.h>
|
||||
#include <countrydata.h>
|
||||
|
||||
#if defined(ADDRESSBOOK_LIBRARY)
|
||||
# define ADDRESSBOOKSHARED_EXPORT Q_DECL_EXPORT
|
||||
@@ -30,6 +31,7 @@ class ADDRESSBOOKSHARED_EXPORT AddressbookData : public ComboItem
|
||||
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);
|
||||
@@ -66,6 +68,9 @@ public:
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
QSharedPointer<QObject> country() const;
|
||||
void setCountry(const QSharedPointer<QObject> &country);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
@@ -80,6 +85,7 @@ private:
|
||||
QString m_addressStreet;
|
||||
QString m_addressHouseNumber;
|
||||
QString m_addressZipCode;
|
||||
CountryDataPtr m_country;
|
||||
|
||||
// ComboItem interface
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user