KIdentityManagement

identity.cpp
1 /*
2  SPDX-FileCopyrightText: 2002-2004 Marc Mutz <[email protected]>
3  SPDX-FileCopyrightText: 2007 Tom Albers <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #include "identity.h"
9 
10 #include "kidentitymanagement_debug.h"
11 #include <KConfigGroup>
12 #include <KEmailAddress>
13 
14 #include <QByteArray>
15 #include <QHostInfo>
16 #include <QMimeData>
17 
18 using namespace KIdentityManagement;
19 
20 static Identity *identityNull = nullptr;
21 
22 Q_DECLARE_METATYPE(KIdentityManagement::Signature)
23 
24 Identity::Identity(const QString &id, const QString &fullName, const QString &emailAddr, const QString &organization, const QString &replyToAddr)
25 {
26  qRegisterMetaType<Signature>();
27 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
28  qRegisterMetaTypeStreamOperators<Signature>();
29 #endif
30  setProperty(QLatin1String(s_uoid), 0);
31  setProperty(QLatin1String(s_identity), id);
32  setProperty(QLatin1String(s_name), fullName);
33  setProperty(QLatin1String(s_primaryEmail), emailAddr);
34  setProperty(QLatin1String(s_organization), organization);
35  setProperty(QLatin1String(s_replyto), replyToAddr);
36  // FIXME KF5: Sonnet::defaultLanguageName is gone
37  // setDictionary( Sonnet::defaultLanguageName() );
38  setProperty(QLatin1String(s_disabledFcc), false);
39  setProperty(QLatin1String(s_defaultDomainName), QHostInfo::localHostName());
40 }
41 
42 const Identity &Identity::null()
43 {
44  if (!identityNull) {
45  identityNull = new Identity;
46  }
47  return *identityNull;
48 }
49 
50 bool Identity::isNull() const
51 {
52  bool empty = true;
54  while (i != mPropertiesMap.constEnd()) {
55  const QString &key = i.key();
56  // Take into account that the defaultDomainName for a null identity is not empty
57  if (key == QLatin1String(s_defaultDomainName)) {
58  ++i;
59  continue;
60  }
61  // Take into account that the dictionary for a null identity is not empty
62  if (key == QLatin1String(s_dict)) {
63  ++i;
64  continue;
65  }
66  // Take into account that disableFcc == false for a null identity
67  if (key == QLatin1String(s_disabledFcc) && i.value().toBool() == false) {
68  ++i;
69  continue;
70  }
71  // The uoid is 0 by default, so ignore this
72  if (!(key == QLatin1String(s_uoid) && i.value().toUInt() == 0)) {
73  if (!i.value().isNull() || (i.value().type() == QVariant::String && !i.value().toString().isEmpty())) {
74  empty = false;
75  }
76  }
77  ++i;
78  }
79  return empty;
80 }
81 
83 {
84  // get all keys and convert them to our QHash.
85  QMap<QString, QString> entries = config.entryMap();
88  while (i != end) {
89  const QString &key = i.key();
90  if (key == QLatin1String(s_emailAliases)) {
91  // HACK: Read s_emailAliases as a stringlist
92  mPropertiesMap.insert(key, config.readEntry(key, QStringList()));
93  } else {
94  mPropertiesMap.insert(key, config.readEntry(key));
95  }
96  ++i;
97  }
98  mSignature.readConfig(config);
99 }
100 
102 {
104  QHash<QString, QVariant>::const_iterator end = mPropertiesMap.constEnd();
105  while (i != end) {
106  config.writeEntry(i.key(), i.value());
107  qCDebug(KIDENTITYMANAGEMENT_LOG) << "Store:" << i.key() << ":" << i.value();
108  ++i;
109  }
110  mSignature.writeConfig(config);
111 }
112 
114 {
115  return !property(QLatin1String(s_primaryEmail)).toString().isEmpty();
116 }
117 
118 QString Identity::mimeDataType()
119 {
120  return QStringLiteral("application/x-kmail-identity-drag");
121 }
122 
123 bool Identity::canDecode(const QMimeData *md)
124 {
125  if (md) {
126  return md->hasFormat(mimeDataType());
127  } else {
128  return false;
129  }
130 }
131 
132 void Identity::populateMimeData(QMimeData *md) const
133 {
134  QByteArray a;
135  {
137  s << *this;
138  }
139  md->setData(mimeDataType(), a);
140 }
141 
142 Identity Identity::fromMimeData(const QMimeData *md)
143 {
144  Identity i;
145  if (canDecode(md)) {
146  QByteArray ba = md->data(mimeDataType());
148  s >> i;
149  }
150  return i;
151 }
152 
153 // ------------------ Operators --------------------------//
154 
155 QDataStream &KIdentityManagement::operator<<(QDataStream &stream, const KIdentityManagement::Identity &i)
156 {
157  return stream << static_cast<quint32>(i.uoid()) << i.mPropertiesMap[QLatin1String(s_identity)] << i.mPropertiesMap[QLatin1String(s_name)]
158  << i.mPropertiesMap[QLatin1String(s_organization)] << i.mPropertiesMap[QLatin1String(s_pgps)] << i.mPropertiesMap[QLatin1String(s_pgpe)]
159  << i.mPropertiesMap[QLatin1String(s_smimes)] << i.mPropertiesMap[QLatin1String(s_smimee)] << i.mPropertiesMap[QLatin1String(s_primaryEmail)]
160  << i.mPropertiesMap[QLatin1String(s_emailAliases)] << i.mPropertiesMap[QLatin1String(s_replyto)] << i.mPropertiesMap[QLatin1String(s_bcc)]
161  << i.mPropertiesMap[QLatin1String(s_vcard)] << i.mPropertiesMap[QLatin1String(s_transport)] << i.mPropertiesMap[QLatin1String(s_fcc)]
162  << i.mPropertiesMap[QLatin1String(s_drafts)] << i.mPropertiesMap[QLatin1String(s_templates)] << i.mSignature
163  << i.mPropertiesMap[QLatin1String(s_dict)] << i.mPropertiesMap[QLatin1String(s_xface)] << i.mPropertiesMap[QLatin1String(s_xfaceenabled)]
164  << i.mPropertiesMap[QLatin1String(s_prefcrypt)] << i.mPropertiesMap[QLatin1String(s_cc)] << i.mPropertiesMap[QLatin1String(s_attachVcard)]
165  << i.mPropertiesMap[QLatin1String(s_autocorrectionLanguage)] << i.mPropertiesMap[QLatin1String(s_disabledFcc)]
166  << i.mPropertiesMap[QLatin1String(s_pgpautosign)] << i.mPropertiesMap[QLatin1String(s_pgpautoencrypt)]
167  << i.mPropertiesMap[QLatin1String(s_autocryptEnabled)] << i.mPropertiesMap[QLatin1String(s_defaultDomainName)]
168  << i.mPropertiesMap[QLatin1String(s_face)] << i.mPropertiesMap[QLatin1String(s_faceenabled)];
169 }
170 
171 QDataStream &KIdentityManagement::operator>>(QDataStream &stream, KIdentityManagement::Identity &i)
172 {
173  quint32 uoid;
174  stream >> uoid >> i.mPropertiesMap[QLatin1String(s_identity)] >> i.mPropertiesMap[QLatin1String(s_name)] >> i.mPropertiesMap[QLatin1String(s_organization)]
175  >> i.mPropertiesMap[QLatin1String(s_pgps)] >> i.mPropertiesMap[QLatin1String(s_pgpe)] >> i.mPropertiesMap[QLatin1String(s_smimes)]
176  >> i.mPropertiesMap[QLatin1String(s_smimee)] >> i.mPropertiesMap[QLatin1String(s_primaryEmail)] >> i.mPropertiesMap[QLatin1String(s_emailAliases)]
177  >> i.mPropertiesMap[QLatin1String(s_replyto)] >> i.mPropertiesMap[QLatin1String(s_bcc)] >> i.mPropertiesMap[QLatin1String(s_vcard)]
178  >> i.mPropertiesMap[QLatin1String(s_transport)] >> i.mPropertiesMap[QLatin1String(s_fcc)] >> i.mPropertiesMap[QLatin1String(s_drafts)]
179  >> i.mPropertiesMap[QLatin1String(s_templates)] >> i.mSignature >> i.mPropertiesMap[QLatin1String(s_dict)] >> i.mPropertiesMap[QLatin1String(s_xface)]
180  >> i.mPropertiesMap[QLatin1String(s_xfaceenabled)] >> i.mPropertiesMap[QLatin1String(s_prefcrypt)] >> i.mPropertiesMap[QLatin1String(s_cc)]
181  >> i.mPropertiesMap[QLatin1String(s_attachVcard)] >> i.mPropertiesMap[QLatin1String(s_autocorrectionLanguage)]
182  >> i.mPropertiesMap[QLatin1String(s_disabledFcc)] >> i.mPropertiesMap[QLatin1String(s_pgpautosign)] >> i.mPropertiesMap[QLatin1String(s_pgpautoencrypt)]
183  >> i.mPropertiesMap[QLatin1String(s_autocryptEnabled)] >> i.mPropertiesMap[QLatin1String(s_defaultDomainName)]
184  >> i.mPropertiesMap[QLatin1String(s_face)] >> i.mPropertiesMap[QLatin1String(s_faceenabled)];
185 
186  i.setProperty(QLatin1String(s_uoid), uoid);
187  return stream;
188 }
189 
190 bool Identity::operator<(const Identity &other) const
191 {
192  if (isDefault()) {
193  return true;
194  }
195  if (other.isDefault()) {
196  return false;
197  }
198  return identityName() < other.identityName();
199 }
200 
201 bool Identity::operator>(const Identity &other) const
202 {
203  if (isDefault()) {
204  return false;
205  }
206  if (other.isDefault()) {
207  return true;
208  }
209  return identityName() > other.identityName();
210 }
211 
212 bool Identity::operator<=(const Identity &other) const
213 {
214  return !operator>(other);
215 }
216 
217 bool Identity::operator>=(const Identity &other) const
218 {
219  return !operator<(other);
220 }
221 
222 bool Identity::operator==(const Identity &other) const
223 {
224  // The deserializer fills in the QHash will lots of invalid variants, which
225  // is OK, but the CTOR doesn't fill the hash with the missing fields, so
226  // regular mPropertiesMap == other.mPropertiesMap comparison will fail.
227  // This algo considers both maps equal even if one map does not contain the
228  // key and the other one contains the key but with an invalid value
229  for (const auto &pair : {qMakePair(mPropertiesMap, other.mPropertiesMap), qMakePair(other.mPropertiesMap, mPropertiesMap)}) {
230  const auto lhs = pair.first;
231  const auto rhs = pair.second;
232  for (auto lhsIt = lhs.constBegin(), lhsEnd = lhs.constEnd(); lhsIt != lhsEnd; ++lhsIt) {
233  const auto rhsIt = rhs.constFind(lhsIt.key());
234  // Does the other map contain the key?
235  if (rhsIt == rhs.constEnd()) {
236  // It does not, so check if our value is invalid, if yes, consider it
237  // equal to not present and continue
238  if (lhsIt->isValid()) {
239  return false;
240  }
241  } else if (lhsIt.value() != rhsIt.value()) {
242  // Both maps have the key, but different value -> different maps
243  return false;
244  }
245  }
246  }
247 
248  return mSignature == other.mSignature;
249 }
250 
251 bool Identity::operator!=(const Identity &other) const
252 {
253  return !operator==(other);
254 }
255 
256 // --------------------- Getters -----------------------------//
257 
259 {
260  if (key == QLatin1String(s_signature)) {
261  return QVariant::fromValue(mSignature);
262  } else {
263  return mPropertiesMap.value(key);
264  }
265 }
266 
268 {
269  const QString name = mPropertiesMap.value(QLatin1String(s_name)).toString();
270  const QString mail = mPropertiesMap.value(QLatin1String(s_primaryEmail)).toString();
271 
272  if (name.isEmpty()) {
273  return mail;
274  }
275 
276  const QString specials(QStringLiteral("()<>@,.;:[]"));
277 
278  QString result;
279 
280  // add DQUOTE's if necessary:
281  bool needsQuotes = false;
282  const int nameLength(name.length());
283  for (int i = 0; i < nameLength; i++) {
284  if (specials.contains(name[i])) {
285  needsQuotes = true;
286  } else if (name[i] == QLatin1Char('\\') || name[i] == QLatin1Char('"')) {
287  needsQuotes = true;
288  result += QLatin1Char('\\');
289  }
290  result += name[i];
291  }
292 
293  if (needsQuotes) {
294  result.insert(0, QLatin1Char('"'));
295  result += QLatin1Char('"');
296  }
297 
298  result += QLatin1String(" <") + mail + QLatin1Char('>');
299 
300  return result;
301 }
302 
304 {
305  return property(QLatin1String(s_identity)).toString();
306 }
307 
309 {
310  return mSignature.withSeparator(ok);
311 }
312 
314 {
315  return mSignature.isInlinedHtml();
316 }
317 
319 {
320  return mIsDefault;
321 }
322 
323 uint Identity::uoid() const
324 {
325  return property(QLatin1String(s_uoid)).toInt();
326 }
327 
329 {
330  return property(QLatin1String(s_name)).toString();
331 }
332 
334 {
335  return property(QLatin1String(s_organization)).toString();
336 }
337 
339 {
340  return property(QLatin1String(s_pgpe)).toByteArray();
341 }
342 
344 {
345  return property(QLatin1String(s_pgps)).toByteArray();
346 }
347 
349 {
350  return property(QLatin1String(s_smimee)).toByteArray();
351 }
352 
354 {
355  return property(QLatin1String(s_smimes)).toByteArray();
356 }
357 
358 QString Identity::preferredCryptoMessageFormat() const
359 {
360  return property(QLatin1String(s_prefcrypt)).toString();
361 }
362 
364 {
365  return property(QLatin1String(s_primaryEmail)).toString();
366 }
367 
369 {
370  return property(QLatin1String(s_emailAliases)).toStringList();
371 }
372 
374 {
375  return property(QLatin1String(s_vcard)).toString();
376 }
377 
379 {
380  return property(QLatin1String(s_attachVcard)).toBool();
381 }
382 
384 {
385  return property(QLatin1String(s_replyto)).toString();
386 }
387 
389 {
390  return property(QLatin1String(s_bcc)).toString();
391 }
392 
394 {
395  return property(QLatin1String(s_cc)).toString();
396 }
397 
398 Signature &Identity::signature()
399 {
400  return mSignature;
401 }
402 
403 bool Identity::isXFaceEnabled() const
404 {
405  return property(QLatin1String(s_xfaceenabled)).toBool();
406 }
407 
409 {
410  return property(QLatin1String(s_xface)).toString();
411 }
412 
413 bool Identity::isFaceEnabled() const
414 {
415  return property(QLatin1String(s_faceenabled)).toBool();
416 }
417 
419 {
420  return property(QLatin1String(s_face)).toString();
421 }
422 
424 {
425  return property(QLatin1String(s_dict)).toString();
426 }
427 
429 {
430  const QString str = property(QLatin1String(s_templates)).toString();
431  return verifyAkonadiId(str);
432 }
433 
435 {
436  const QString str = property(QLatin1String(s_drafts)).toString();
437  return verifyAkonadiId(str);
438 }
439 
441 {
442  const QString str = property(QLatin1String(s_fcc)).toString();
443  return verifyAkonadiId(str);
444 }
445 
447 {
448  return property(QLatin1String(s_transport)).toString();
449 }
450 
452 {
453  return mSignature.type() == Signature::FromCommand;
454 }
455 
457 {
458  return mSignature.type() == Signature::FromFile;
459 }
460 
462 {
463  return mSignature.type() == Signature::Inlined;
464 }
465 
467 {
469 }
470 
472 {
473  return mSignature.text();
474 }
475 
477 {
478  return mSignature.path();
479 }
480 
482 {
483  return property(QLatin1String(s_autocorrectionLanguage)).toString();
484 }
485 
486 // --------------------- Setters -----------------------------//
487 
488 void Identity::setProperty(const QString &key, const QVariant &value)
489 {
490  if (key == QLatin1String(s_signature)) {
491  mSignature = value.value<Signature>();
492  } else {
493  if (value.isNull() || (value.type() == QVariant::String && value.toString().isEmpty())) {
494  mPropertiesMap.remove(key);
495  } else {
496  mPropertiesMap.insert(key, value);
497  }
498  }
499 }
500 
501 void Identity::setUoid(uint aUoid)
502 {
503  setProperty(QLatin1String(s_uoid), aUoid);
504 }
505 
507 {
508  setProperty(QLatin1String(s_identity), name);
509 }
510 
511 void Identity::setFullName(const QString &str)
512 {
513  setProperty(QLatin1String(s_name), str);
514 }
515 
516 void Identity::setOrganization(const QString &str)
517 {
518  setProperty(QLatin1String(s_organization), str);
519 }
520 
521 void Identity::setPGPSigningKey(const QByteArray &str)
522 {
523  setProperty(QLatin1String(s_pgps), QLatin1String(str));
524 }
525 
526 void Identity::setPGPEncryptionKey(const QByteArray &str)
527 {
528  setProperty(QLatin1String(s_pgpe), QLatin1String(str));
529 }
530 
531 void Identity::setSMIMESigningKey(const QByteArray &str)
532 {
533  setProperty(QLatin1String(s_smimes), QLatin1String(str));
534 }
535 
536 void Identity::setSMIMEEncryptionKey(const QByteArray &str)
537 {
538  setProperty(QLatin1String(s_smimee), QLatin1String(str));
539 }
540 
541 void Identity::setPrimaryEmailAddress(const QString &email)
542 {
543  setProperty(QLatin1String(s_primaryEmail), email);
544 }
545 
546 void Identity::setEmailAliases(const QStringList &aliases)
547 {
548  setProperty(QLatin1String(s_emailAliases), aliases);
549 }
550 
551 void Identity::setVCardFile(const QString &str)
552 {
553  setProperty(QLatin1String(s_vcard), str);
554 }
555 
556 void Identity::setAttachVcard(bool attachment)
557 {
558  setProperty(QLatin1String(s_attachVcard), attachment);
559 }
560 
561 void Identity::setReplyToAddr(const QString &str)
562 {
563  setProperty(QLatin1String(s_replyto), str);
564 }
565 
566 void Identity::setSignatureFile(const QString &str)
567 {
568  mSignature.setPath(str, signatureIsCommand());
569 }
570 
571 void Identity::setSignatureInlineText(const QString &str)
572 {
573  mSignature.setText(str);
574 }
575 
576 void Identity::setTransport(const QString &str)
577 {
578  setProperty(QLatin1String(s_transport), str);
579 }
580 
581 void Identity::setFcc(const QString &str)
582 {
583  setProperty(QLatin1String(s_fcc), str);
584 }
585 
586 void Identity::setDrafts(const QString &str)
587 {
588  setProperty(QLatin1String(s_drafts), str);
589 }
590 
591 void Identity::setTemplates(const QString &str)
592 {
593  setProperty(QLatin1String(s_templates), str);
594 }
595 
596 void Identity::setDictionary(const QString &str)
597 {
598  setProperty(QLatin1String(s_dict), str);
599 }
600 
601 void Identity::setBcc(const QString &str)
602 {
603  setProperty(QLatin1String(s_bcc), str);
604 }
605 
606 void Identity::setCc(const QString &str)
607 {
608  setProperty(QLatin1String(s_cc), str);
609 }
610 
611 void Identity::setIsDefault(bool flag)
612 {
613  mIsDefault = flag;
614 }
615 
616 void Identity::setPreferredCryptoMessageFormat(const QString &str)
617 {
618  setProperty(QLatin1String(s_prefcrypt), str);
619 }
620 
621 void Identity::setXFace(const QString &str)
622 {
623  QString strNew = str;
624  strNew.remove(QLatin1Char(' '));
625  strNew.remove(QLatin1Char('\n'));
626  strNew.remove(QLatin1Char('\r'));
627  setProperty(QLatin1String(s_xface), strNew);
628 }
629 
630 void Identity::setXFaceEnabled(bool on)
631 {
632  setProperty(QLatin1String(s_xfaceenabled), on);
633 }
634 
635 void Identity::setFace(const QString &str)
636 {
637  QString strNew = str;
638  strNew.remove(QLatin1Char(' '));
639  strNew.remove(QLatin1Char('\n'));
640  strNew.remove(QLatin1Char('\r'));
641  setProperty(QLatin1String(s_face), strNew);
642 }
643 
644 void Identity::setFaceEnabled(bool on)
645 {
646  setProperty(QLatin1String(s_faceenabled), on);
647 }
648 
649 void Identity::setSignature(const Signature &sig)
650 {
651  mSignature = sig;
652 }
653 
654 bool Identity::matchesEmailAddress(const QString &addr) const
655 {
656  const QString addrSpec = KEmailAddress::extractEmailAddress(addr).toLower();
657  if (addrSpec == primaryEmailAddress().toLower()) {
658  return true;
659  }
660 
661  const QStringList lst = emailAliases();
662  for (const QString &alias : lst) {
663  if (alias.toLower() == addrSpec) {
664  return true;
665  }
666  }
667 
668  return false;
669 }
670 
671 void Identity::setAutocorrectionLanguage(const QString &language)
672 {
673  setProperty(QLatin1String(s_autocorrectionLanguage), language);
674 }
675 
677 {
678  const QVariant var = property(QLatin1String(s_disabledFcc));
679  if (var.isNull()) {
680  return false;
681  } else {
682  return var.toBool();
683  }
684 }
685 
686 void Identity::setDisabledFcc(bool disable)
687 {
688  setProperty(QLatin1String(s_disabledFcc), disable);
689 }
690 
692 {
693  const QVariant var = property(QLatin1String(s_pgpautosign));
694  if (var.isNull()) {
695  return false;
696  } else {
697  return var.toBool();
698  }
699 }
700 
701 void Identity::setPgpAutoSign(bool autoSign)
702 {
703  setProperty(QLatin1String(s_pgpautosign), autoSign);
704 }
705 
707 {
708  const QVariant var = property(QLatin1String(s_pgpautoencrypt));
709  if (var.isNull()) {
710  return false;
711  } else {
712  return var.toBool();
713  }
714 }
715 
716 void Identity::setPgpAutoEncrypt(bool autoEncrypt)
717 {
718  setProperty(QLatin1String(s_pgpautoencrypt), autoEncrypt);
719 }
720 
722 {
723  const auto var = property(QLatin1String(s_autocryptEnabled));
724  if (var.isNull()) {
725  return false;
726  } else {
727  return var.toBool();
728  }
729 }
730 
731 void Identity::setAutocryptEnabled(const bool on)
732 {
733  setProperty(QLatin1String(s_autocryptEnabled), on);
734 }
735 
737 {
738  return property(QLatin1String(s_defaultDomainName)).toString();
739 }
740 
741 void Identity::setDefaultDomainName(const QString &domainName)
742 {
743  setProperty(QLatin1String(s_defaultDomainName), domainName);
744 }
745 
747 {
748  if (str.isEmpty()) {
749  return str;
750  }
751  bool ok = false;
752  const qlonglong val = str.toLongLong(&ok);
753  Q_UNUSED(val)
754  if (ok) {
755  return str;
756  } else {
757  return {};
758  }
759 }
KCODECS_EXPORT QByteArray extractEmailAddress(const QByteArray &address)
bool isNull() const const
QMap::const_iterator constBegin() const const
QByteArray data(const QString &mimeType) const const
const T value(const Key &key) const const
QByteArray smimeEncryptionKey() const
The user's S/MIME encryption key.
Definition: identity.cpp:348
bool isNull() const
Returns true when the identity contains no values, all null values or only empty values.
Definition: identity.cpp:50
QString cc() const
email addresses for the CC: field
Definition: identity.cpp:393
QByteArray toLower() const const
void readConfig(const KConfigGroup &)
Read configuration from config.
Definition: identity.cpp:82
QByteArray pgpEncryptionKey() const
The user's OpenPGP encryption key.
Definition: identity.cpp:338
QVariant fromValue(const T &value)
void setData(const QString &mimeType, const QByteArray &data)
bool operator>(const Identity &other) const
used for sorting
Definition: identity.cpp:201
QString drafts() const
The folder where draft messages from this identity will be stored by default.
Definition: identity.cpp:434
QByteArray smimeSigningKey() const
The user's S/MIME signing key.
Definition: identity.cpp:353
uint uoid() const
Unique Object Identifier for this identity.
Definition: identity.cpp:323
QString dictionary() const
Dictionary which should be used for spell checking.
Definition: identity.cpp:423
T value() const const
QString fullName() const
Full name of the user.
Definition: identity.cpp:328
Identity(const QString &id=QString(), const QString &realName=QString(), const QString &emailAddr=QString(), const QString &organization=QString(), const QString &replyToAddress=QString())
Constructor.
Definition: identity.cpp:24
QString signatureInlineText() const
inline signature
Definition: identity.cpp:471
User identity information.
Definition: identity.h:67
qlonglong toLongLong(bool *ok, int base) const const
QCA_EXPORT void setProperty(const QString &name, const QVariant &value)
Abstraction of a signature (aka "footer").
Definition: signature.h:65
QString signatureText(bool *ok=nullptr) const
Definition: identity.cpp:308
QString xface() const
a X-Face header for this identity
Definition: identity.cpp:408
QByteArray toByteArray() const const
void setPath(const QString &path, bool isExecutable=false)
Set the signature URL and mark this signature as being of "from file" resp.
Definition: signature.cpp:287
bool operator!=(const Identity &other) const
used for comparison
Definition: identity.cpp:251
void writeConfig(KConfigGroup &) const
Write configuration to config.
Definition: identity.cpp:101
bool operator>=(const Identity &other) const
used for sorting
Definition: identity.cpp:217
QVariant property(const QString &key) const
Get random properties.
Definition: identity.cpp:258
QString face() const
a Face header for this identity
Definition: identity.cpp:418
QString fullEmailAddr() const
email address in the format "username <[email protected]>" suitable for the "From:" field of email messages.
Definition: identity.cpp:267
QHash::iterator insert(const Key &key, const T &value)
QString organization() const
The user's organization (optional)
Definition: identity.cpp:333
void setIdentityName(const QString &name)
Identity/nickname for this collection.
Definition: identity.cpp:506
bool signatureIsInlinedHtml() const
Definition: identity.cpp:313
QString transport() const
The transport that is set for this identity.
Definition: identity.cpp:446
QByteArray pgpSigningKey() const
The user's OpenPGP signing key.
Definition: identity.cpp:343
QVariant::Type type() const const
void setText(const QString &text)
Set the signature text and mark this signature as being of "inline text" type.
Definition: signature.cpp:498
QHash::const_iterator constBegin() const const
QHash::const_iterator constEnd() const const
QMap::const_iterator constEnd() const const
void setUoid(uint aUoid)
set the uiod
Definition: identity.cpp:501
bool isEmpty() const const
const Key key(const T &value) const const
void setProperty(const QString &key, const QVariant &value)
Set random properties, when value is empty (for QStrings) or null, the property is deleted.
Definition: identity.cpp:488
bool operator<(const Identity &other) const
used for sorting
Definition: identity.cpp:190
int toInt(bool *ok) const const
QString replyToAddr() const
email address for the ReplyTo: field
Definition: identity.cpp:383
bool matchesEmailAddress(const QString &addr) const
Definition: identity.cpp:654
bool mailingAllowed() const
Tests if there are enough values set to allow mailing.
Definition: identity.cpp:113
virtual bool hasFormat(const QString &mimeType) const const
QString bcc() const
email addresses for the BCC: field
Definition: identity.cpp:388
const Key key(const T &value, const Key &defaultKey) const const
bool toBool() const const
QString & remove(int position, int n)
bool operator<=(const Identity &other) const
used for sorting
Definition: identity.cpp:212
void setIsDefault(bool flag)
Set whether this identity is the default identity.
Definition: identity.cpp:611
QString identityName() const
Identity/nickname for this collection.
Definition: identity.cpp:303
bool operator==(const Identity &other) const
used for comparison
Definition: identity.cpp:222
QString withSeparator(bool *ok=nullptr, QString *errorMessage=nullptr) const
Definition: signature.cpp:261
bool signatureIsPlainFile() const
Definition: identity.cpp:456
int remove(const Key &key)
QString & insert(int position, QChar ch)
QString localHostName()
QString defaultDomainName() const
Definition: identity.cpp:736
QString autocorrectionLanguage() const
Definition: identity.cpp:481
QString templates() const
The folder where template messages from this identity will be stored by default.
Definition: identity.cpp:428
const QStringList emailAliases() const
email address aliases
Definition: identity.cpp:368
QString vCardFile() const
vCard to attach to outgoing emails
Definition: identity.cpp:373
QStringList toStringList() const const
QString verifyAkonadiId(const QString &str) const
during migration when it failed it can be a string => not a qlonglong akonadi::id => fix it
Definition: identity.cpp:746
bool useSignatureFile() const
Inline or signature from a file.
Definition: identity.cpp:466
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
QString primaryEmailAddress() const
primary email address (without the user name - only [email protected]).
Definition: identity.cpp:363
QString signatureFile() const
name of the signature file (with path)
Definition: identity.cpp:476
QString fcc() const
The folder where sent messages from this identity will be stored by default.
Definition: identity.cpp:440
QString toString() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu May 19 2022 03:47:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.