libemailfunctions
KPIM Namespace Reference
KPIM holds all kinds of functions specific to KDE PIM. More...
Classes | |
class | IdMapper |
An Id Mapper maps Ids. More... | |
class | NetworkStatus |
This is a class for monitoring network status -- basically, the machine KDE is running on going from "online" mode to offline. More... | |
Enumerations | |
enum | EmailParseResult { AddressOk, AddressEmpty, UnexpectedEnd, UnbalancedParens, MissingDomainPart, UnclosedAngleAddr, UnopenedAngleAddr, TooManyAts, UnexpectedComma, TooFewAts, MissingLocalPart, UnbalancedQuote, NoAddressSpec, DisallowedChar, InvalidDisplayName } |
Functions | |
static unsigned char | ASCIIToLower (unsigned char ch) |
static unsigned char | ASCIIToUpper (unsigned char ch) |
KDE_EXPORT bool | compareEmail (const QString &email1, const QString &email2, bool matchName) |
KDE_EXPORT QString | decodeIDN (const QString &addrSpec) |
KDE_EXPORT QString | emailParseResultToString (EmailParseResult errorCode) |
KDE_EXPORT QString | encodeIDN (const QString &addrSpec) |
KDE_EXPORT QString | getEmailAddress (const QString &address) |
KDE_EXPORT QCString | getEmailAddress (const QCString &address) |
KDE_EXPORT QString | getFirstEmailAddress (const QString &addresses) |
KDE_EXPORT QCString | getFirstEmailAddress (const QCString &addresses) |
KDE_EXPORT bool | getNameAndMail (const QString &aStr, QString &name, QString &mail) |
KDE_EXPORT EmailParseResult | isValidEmailAddress (const QString &aStr) |
KDE_EXPORT bool | isValidSimpleEmailAddress (const QString &aStr) |
char * | kAsciiToLower (char *str) |
char * | kAsciiToUpper (char *str) |
KDE_EXPORT QString | normalizeAddressesAndDecodeIDNs (const QString &addresses) |
KDE_EXPORT QString | normalizeAddressesAndEncodeIDNs (const QString &str) |
KDE_EXPORT QString | normalizedAddress (const QString &displayName, const QString &addrSpec, const QString &comment) |
KDE_EXPORT QString | quoteNameIfNecessary (const QString &str) |
KDE_EXPORT QString | simpleEmailAddressErrorMsg () |
KDE_EXPORT EmailParseResult | splitAddress (const QString &address, QString &displayName, QString &addrSpec, QString &comment) |
KDE_EXPORT EmailParseResult | splitAddress (const QCString &address, QCString &displayName, QCString &addrSpec, QCString &comment) |
KDE_EXPORT QStringList | splitEmailAddrList (const QString &aStr) |
Detailed Description
KPIM holds all kinds of functions specific to KDE PIM.The KPIM namespace hides away functions, enums, and other things that are KDE PIM specific and that we don't want to have polluting the global namespace.
Enumeration Type Documentation
Function Documentation
static unsigned char KPIM::ASCIIToLower | ( | unsigned char | ch | ) | [static] |
Definition at line 28 of file kasciistringtools.cpp.
static unsigned char KPIM::ASCIIToUpper | ( | unsigned char | ch | ) | [static] |
Definition at line 45 of file kasciistringtools.cpp.
QString KPIM::emailParseResultToString | ( | EmailParseResult | errorCode | ) |
This is an overloaded member function, provided for convenience.
It behaves essentially like the above function.
Returns the pure email address (addr-spec in RFC2822) of the given address (mailbox in RFC2822).
- Parameters:
-
address an email address, e.g. "Joe User <joe.user@example.org>"
- Returns:
- the addr-spec of address, i.e. joe.user@example.org in the example
Returns the pure email address (addr-spec in RFC2822) of the given address (mailbox in RFC2822).
- Parameters:
-
address an email address, e.g. "Joe User <joe.user@example.org>"
- Returns:
- the addr-spec of address, i.e. joe.user@example.org in the example
This is an overloaded member function, provided for convenience.
It behaves essentially like the above function.
Returns the pure email address (addr-spec in RFC2822) of the first email address of a list of addresses.
- Parameters:
-
addresses an email address, e.g. "Joe User <joe.user@example.org>"
- Returns:
- the addr-spec of addresses, i.e. joe.user@example.org in the example
Returns the pure email address (addr-spec in RFC2822) of the first email address of a list of addresses.
- Parameters:
-
addresses an email address, e.g. "Joe User <joe.user@example.org>"
- Returns:
- the addr-spec of addresses, i.e. joe.user@example.org in the example
Return email address and name from string.
Examples: "Stefan Taferner <taferner@example.org>" returns "taferner@example.org" and "Stefan Taferner". "joe@example.com" returns "joe@example.com" and "". Note that this only returns the first address. Also note that the return value is TRUE if both the name and the mail are not empty: this does NOT tell you if mail contains a valid email address or just some rubbish.
KPIM::EmailParseResult KPIM::isValidEmailAddress | ( | const QString & | aStr | ) |
Validates an email address in the form of "Joe User" <joe@example.org>.
Returns AddressOk if no error was encountered. Otherwise an appropriate error code is returned.
- Parameters:
-
aStr a single email address, example: Joe User (comment1) <joe.user@example.org>
- Returns:
- AddressOk if no error was encountered. Otherwise an appropriate error code is returned.
bool KPIM::isValidSimpleEmailAddress | ( | const QString & | aStr | ) |
Validates an email address in the form of joe@example.org.
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.
- Parameters:
-
aStr a single email address, example: joe.user@example.org
- Returns:
- true if no error was encountered.
char * KPIM::kAsciiToLower | ( | char * | str | ) |
Locale-independent function to convert ASCII strings to lower case ASCII strings.
This means that it affects only the ASCII characters A-Z.
- Parameters:
-
str pointer to the string which should be converted to lower case
- Returns:
- pointer to the converted string (same as str)
Definition at line 36 of file kasciistringtools.cpp.
char * KPIM::kAsciiToUpper | ( | char * | str | ) |
Locale-independent function to convert ASCII strings to upper case ASCII strings.
This means that it affects only the ASCII characters a-z.
- Parameters:
-
str pointer to the string which should be converted to upper case
- Returns:
- pointer to the converted string (same as str)
Definition at line 53 of file kasciistringtools.cpp.
QString KPIM::normalizedAddress | ( | const QString & | displayName, | |
const QString & | addrSpec, | |||
const QString & | comment | |||
) |
Returns a normalized address built from the given parts.
The normalized address is of one the following forms:
- displayName (comment) <addrSpec>
- displayName <addrSpec>
- comment <addrSpec>
- addrSpec
- Parameters:
-
displayName the display name of the address addrSpec the actual email address (addr-spec in RFC 2822) comment a comment
- Returns:
- a normalized address built from the given parts
QString KPIM::simpleEmailAddressErrorMsg | ( | ) |
KPIM::EmailParseResult KPIM::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.
- Parameters:
-
address a single email address, example: Joe User (comment1) <joe.user@example.org> (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
- Returns:
- AddressOk if no error was encountered. Otherwise an appropriate error code is returned.
KPIM::EmailParseResult KPIM::splitAddress | ( | const QCString & | address, | |
QCString & | displayName, | |||
QCString & | addrSpec, | |||
QCString & | 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.
- Parameters:
-
address a single email address, example: Joe User (comment1) <joe.user@example.org> (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
- Returns:
- AddressOk if no error was encountered. Otherwise an appropriate error code is returned.
QStringList KPIM::splitEmailAddrList | ( | const QString & | aStr | ) |