fort/src/ui/conf/addressgroup.cpp

88 lines
1.7 KiB
C++
Raw Normal View History

2017-09-02 10:17:51 +00:00
#include "addressgroup.h"
AddressGroup::AddressGroup(QObject *parent) :
QObject(parent),
2019-10-23 12:03:59 +00:00
m_edited(false),
m_includeAll(true),
2019-10-23 12:03:59 +00:00
m_excludeAll(false),
m_id(0)
2017-09-02 10:17:51 +00:00
{
}
void AddressGroup::setIncludeAll(bool includeAll)
2017-09-02 10:17:51 +00:00
{
if (m_includeAll != includeAll) {
m_includeAll = includeAll;
emit includeAllChanged();
2019-10-23 12:03:59 +00:00
setEdited(true);
2017-09-02 10:17:51 +00:00
}
}
void AddressGroup::setExcludeAll(bool excludeAll)
2017-09-02 10:17:51 +00:00
{
if (m_excludeAll != excludeAll) {
m_excludeAll = excludeAll;
emit excludeAllChanged();
2019-10-23 12:03:59 +00:00
setEdited(true);
}
}
void AddressGroup::setIncludeText(const QString &includeText)
{
if (m_includeText != includeText) {
m_includeText = includeText;
emit includeTextChanged();
2019-10-23 12:03:59 +00:00
setEdited(true);
}
}
void AddressGroup::setExcludeText(const QString &excludeText)
{
if (m_excludeText != excludeText) {
m_excludeText = excludeText;
emit excludeTextChanged();
2019-10-23 12:03:59 +00:00
setEdited(true);
2017-09-02 10:17:51 +00:00
}
}
2019-10-23 12:03:59 +00:00
void AddressGroup::copy(const AddressGroup &o)
{
m_edited = false;
m_includeAll = o.includeAll();
m_excludeAll = o.excludeAll();
m_id = 0;
m_includeText = o.includeText();
m_excludeText = o.excludeText();
}
2017-09-02 10:17:51 +00:00
QVariant AddressGroup::toVariant() const
{
QVariantMap map;
map["includeAll"] = includeAll();
map["excludeAll"] = excludeAll();
map["includeText"] = includeText();
map["excludeText"] = excludeText();
2017-09-02 10:17:51 +00:00
return map;
}
void AddressGroup::fromVariant(const QVariant &v)
{
2017-09-09 00:07:38 +00:00
const QVariantMap map = v.toMap();
2017-09-02 10:17:51 +00:00
m_includeAll = map["includeAll"].toBool();
m_excludeAll = map["excludeAll"].toBool();
m_includeText = map["includeText"].toString();
m_excludeText = map["excludeText"].toString();
2017-09-02 10:17:51 +00:00
}