9#include "parametermap_p.h"
14using namespace KContacts;
23 Private(
const Private &other)
26 mParamMap = other.mParamMap;
30 ParameterMap mParamMap;
55bool Email::operator==(
const Email &other)
const
57 return (d->mParamMap == other.d->mParamMap) && (d->mail == other.mail());
60bool Email::operator!=(
const Email &other)
const
62 return !(other == *
this);
77 str += QStringLiteral(
" mail: %1\n").
arg(d->mail);
78 str += d->mParamMap.toString();
83void Email::setParams(
const ParameterMap ¶ms)
85 d->mParamMap = params;
88ParameterMap Email::params()
const
93void Email::setEmail(
const QString &mail)
103bool Email::isValid()
const
105 return !d->mail.isEmpty();
108struct email_type_name {
113static const email_type_name email_type_names[] = {
121 const auto it = d->mParamMap.findParam(
QLatin1String(
"type"));
122 if (it == d->mParamMap.end()) {
127 for (
const auto &s : it->paramValues) {
128 const auto it = std::find_if(std::begin(email_type_names), std::end(email_type_names), [&s](
const email_type_name &t) {
131 if (it != std::end(email_type_names)) {
140 const auto oldType = this->type();
142 const QString paramName(QStringLiteral(
"type"));
144 ParameterMap::iterator theIt;
146 auto it = d->mParamMap.findParam(paramName);
147 if (it != d->mParamMap.end()) {
150 theIt = d->mParamMap.insertParam({paramName, {}});
153 for (
const auto &t : email_type_names) {
154 if (((type ^ oldType) & t.type) == 0) {
166bool Email::isPreferred()
const
169 if (it != d->mParamMap.end()) {
170 return !it->paramValues.isEmpty() && it->paramValues.at(0) ==
QLatin1Char(
'1');
174 if (it != d->mParamMap.end()) {
183 if (preferred == isPreferred()) {
187 const QString paramName(QStringLiteral(
"type"));
189 auto typeIt = d->mParamMap.findParam(paramName);
194 if (prefIt != d->mParamMap.end()) {
195 d->mParamMap.erase(prefIt);
203 typeIt = d->mParamMap.findParam(paramName);
204 if (typeIt != d->mParamMap.end()) {
205 typeIt->paramValues = types;
207 d->mParamMap.insertParam({paramName, types});
213 return s << email.d->mParamMap << email.d->mail;
218 s >> email.d->mParamMap >> email.d->mail;
222#include "moc_email.cpp"
Type type(const QSqlDatabase &db)
QAction * mail(const QObject *recvr, const char *slot, QObject *parent)
QString name(StandardAction id)
void push_back(parameter_type value)
qsizetype removeAll(const AT &t)
QString arg(Args &&... args) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:10 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.