KCodecs 5.109.0
|
This collection of methods that can validate email addresses as supplied by the user (typically, user input from a text box). More...
Functions | |
QString | KEmailAddress::emailParseResultToString (EmailParseResult errorCode) |
Translate the enum errorcodes from emailParseResult into i18n'd strings that can be used for msg boxes. | |
EmailParseResult | KEmailAddress::isValidAddress (const QString &aStr) |
Validates an email address in the form of "Joe User" joe@e.nosp@m.xamp.nosp@m.le.or.nosp@m.g. | |
EmailParseResult | KEmailAddress::isValidAddressList (const QString &aStr, QString &badAddr) |
Validates a list of email addresses, and also allow aliases and distribution lists to be expanded before validation. | |
bool | KEmailAddress::isValidSimpleAddress (const QString &aStr) |
Validates an email address in the form of joe@e.nosp@m.xamp.nosp@m.le.or.nosp@m.g. | |
QString | KEmailAddress::simpleEmailAddressErrorMsg () |
Returns a i18n string to be used in msgboxes. | |
EmailParseResult | KEmailAddress::splitAddress (const QByteArray &address, QByteArray &displayName, QByteArray &addrSpec, QByteArray &comment) |
Splits the given address into display name, email address and comment. | |
EmailParseResult | KEmailAddress::splitAddress (const QString &address, QString &displayName, QString &addrSpec, QString &comment) |
This is an overloaded member function, provided for convenience. | |
QStringList | KEmailAddress::splitAddressList (const QString &aStr) |
Split a comma separated list of email addresses. | |
This collection of methods that can validate email addresses as supplied by the user (typically, user input from a text box).
There are also functions for splitting an RFC2822 address into its component parts.
Email validation result.
The only 'success' code in this enumeration is AddressOK; all the other values indicate some specific problem with the address which is being validated.
Result type for splitAddress(), isValidAddress() and isValidSimpleAddress().
QString KEmailAddress::emailParseResultToString | ( | EmailParseResult | errorCode | ) |
Translate the enum errorcodes from emailParseResult into i18n'd strings that can be used for msg boxes.
errorCode | an error code returned from one of the email validation functions. Do not pass AddressOk as a value, since that will yield a misleading error message |
EmailParseResult KEmailAddress::isValidAddress | ( | const QString & | aStr | ) |
Validates an email address in the form of "Joe User" joe@e.nosp@m.xamp.nosp@m.le.or.nosp@m.g.
Returns AddressOk if no error was encountered. Otherwise an appropriate error code is returned.
aStr | a single email address, example: Joe User (comment1) joe.u.nosp@m.ser@.nosp@m.examp.nosp@m.le.o.nosp@m.rg |
EmailParseResult KEmailAddress::isValidAddressList | ( | const QString & | aStr, |
QString & | badAddr | ||
) |
Validates a list of email addresses, and also allow aliases and distribution lists to be expanded before validation.
aStr | a string containing a list of email addresses. |
badAddr | a string to hold the address that was faulty. |
bool KEmailAddress::isValidSimpleAddress | ( | const QString & | aStr | ) |
Validates an email address in the form of joe@e.nosp@m.xamp.nosp@m.le.or.nosp@m.g.
Returns true if no error was encountered. This method should be used when the input field should not allow a "full" email address with comments and other special cases that normally are valid in an email address.
aStr | a single email address, example: joe.u.nosp@m.ser@.nosp@m.examp.nosp@m.le.o.nosp@m.rg |
QString KEmailAddress::simpleEmailAddressErrorMsg | ( | ) |
Returns a i18n string to be used in msgboxes.
This allows for error messages to be the same across the board.
EmailParseResult KEmailAddress::splitAddress | ( | const QByteArray & | address, |
QByteArray & | displayName, | ||
QByteArray & | addrSpec, | ||
QByteArray & | comment | ||
) |
Splits the given address into display name, email address and comment.
Returns AddressOk if no error was encountered. Otherwise an appropriate error code is returned. In case of an error the values of displayName, addrSpec and comment are undefined.
address | a single email address, example: Joe User (comment1) joe.u.nosp@m.ser@.nosp@m.examp.nosp@m.le.o.nosp@m.rg (comment2) |
displayName | only out: the display-name of the email address, i.e. "Joe User" in the example; in case of an error the return value is undefined |
addrSpec | only out: the addr-spec, i.e. "joe.user@example.org" in the example; in case of an error the return value is undefined |
comment | only out: the space-separated comments, i.e. "comment1 comment2" in the example; in case of an error the return value is undefined |
EmailParseResult KEmailAddress::splitAddress | ( | const QString & | address, |
QString & | displayName, | ||
QString & | addrSpec, | ||
QString & | comment | ||
) |
This is an overloaded member function, provided for convenience.
It behaves essentially like the above function.
Splits the given address into display name, email address and comment. Returns AddressOk if no error was encountered. Otherwise an appropriate error code is returned. In case of an error the values of displayName, addrSpec and comment are undefined.
address | a single email address, example: Joe User (comment1) joe.u.nosp@m.ser@.nosp@m.examp.nosp@m.le.o.nosp@m.rg (comment2) |
displayName | only out: the display-name of the email address, i.e. "Joe User" in the example; in case of an error the return value is undefined |
addrSpec | only out: the addr-spec, i.e. "joe.user@example.org" in the example; in case of an error the return value is undefined |
comment | only out: the space-separated comments, i.e. "comment1 comment2" in the example; in case of an error the return value is undefined |
QStringList KEmailAddress::splitAddressList | ( | const QString & | aStr | ) |
Split a comma separated list of email addresses.
aStr | a single string representing a list of addresses |