Added country combo to addressbook. Addressbook plugin depends on Countryregister which must be loaded first.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "countrydata.h"
|
||||
|
||||
CountryData::CountryData(QObject *parent) : QObject(parent)
|
||||
CountryData::CountryData(QObject *parent) : ComboItem(parent)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -74,3 +74,20 @@ void CountryData::setEnglishName(const QString &englishName)
|
||||
{
|
||||
m_englishName = englishName;
|
||||
}
|
||||
|
||||
bool CountryData::eq(ComboItem *other)
|
||||
{
|
||||
CountryData *obj = qobject_cast<CountryData*>(other);
|
||||
|
||||
if (obj == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this == obj || (m_id == obj->m_id && m_code2 == obj->m_code2 && m_code3 == obj->m_code3);
|
||||
}
|
||||
|
||||
QString CountryData::toString()
|
||||
{
|
||||
return m_code3 + " - " + m_czechFullName;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
#include <odb/core.hxx>
|
||||
#include <QSharedPointer>
|
||||
#include <data/comboitem.h>
|
||||
|
||||
#pragma db object
|
||||
class CountryData : public QObject
|
||||
class CountryData : public ComboItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString code2 READ code2 WRITE setCode2)
|
||||
@@ -50,6 +52,13 @@ private:
|
||||
QString m_englishFullName;
|
||||
QString m_englishName;
|
||||
|
||||
|
||||
// ComboItem interface
|
||||
public:
|
||||
bool eq(ComboItem *other);
|
||||
QString toString();
|
||||
};
|
||||
|
||||
typedef QSharedPointer<CountryData> CountryDataPtr;
|
||||
|
||||
#endif // COUNTRYDATA_H
|
||||
|
||||
Reference in New Issue
Block a user