libemailfunctions
KPIM Namespace Reference
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.
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 | |
QStringList | splitEmailAddrList (const QString &aStr) |
KPIM::EmailParseResult | splitAddress (const QCString &address, QCString &displayName, QCString &addrSpec, QCString &comment) |
KPIM::EmailParseResult | splitAddress (const QString &address, QString &displayName, QString &addrSpec, QString &comment) |
KPIM::EmailParseResult | isValidEmailAddress (const QString &aStr) |
QString | emailParseResultToString (EmailParseResult errorCode) |
bool | isValidSimpleEmailAddress (const QString &aStr) |
QString | simpleEmailAddressErrorMsg () |
QCString | getEmailAddress (const QCString &address) |
QString | getEmailAddress (const QString &address) |
QCString | getFirstEmailAddress (const QCString &addresses) |
QString | getFirstEmailAddress (const QString &addresses) |
bool | getNameAndMail (const QString &aStr, QString &name, QString &mail) |
bool | compareEmail (const QString &email1, const QString &email2, bool matchName) |
QString | normalizedAddress (const QString &displayName, const QString &addrSpec, const QString &comment) |
QString | decodeIDN (const QString &addrSpec) |
QString | encodeIDN (const QString &addrSpec) |
QString | normalizeAddressesAndDecodeIDNs (const QString &addresses) |
QString | normalizeAddressesAndEncodeIDNs (const QString &str) |
QString | quoteNameIfNecessary (const QString &str) |
static unsigned char | ASCIIToLower (unsigned char ch) |
char * | kAsciiToLower (char *str) |
static unsigned char | ASCIIToUpper (unsigned char ch) |
char * | kAsciiToUpper (char *str) |
Enumeration Type Documentation
Function Documentation
KDE_EXPORT bool KPIM::compareEmail | ( | const QString & | email1, | |
const QString & | email2, | |||
bool | matchName | |||
) |
KDE_EXPORT QString KPIM::decodeIDN | ( | const QString & | addrSpec | ) |
KDE_EXPORT QString KPIM::emailParseResultToString | ( | EmailParseResult | errorCode | ) |
KDE_EXPORT QString KPIM::encodeIDN | ( | const QString & | addrSpec | ) |
KDE_EXPORT QString KPIM::getEmailAddress | ( | const QString & | address | ) |
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
KDE_EXPORT QCString KPIM::getEmailAddress | ( | const QCString & | address | ) |
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
KDE_EXPORT QString KPIM::getFirstEmailAddress | ( | const QString & | addresses | ) |
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
KDE_EXPORT QCString KPIM::getFirstEmailAddress | ( | const QCString & | addresses | ) |
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
KDE_EXPORT bool KPIM::getNameAndMail | ( | const QString & | aStr, | |
QString & | name, | |||
QString & | ||||
) |
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.
KDE_EXPORT 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.
KDE_EXPORT 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.
KDE_EXPORT QString KPIM::normalizeAddressesAndDecodeIDNs | ( | const QString & | addresses | ) |
KDE_EXPORT QString KPIM::normalizeAddressesAndEncodeIDNs | ( | const QString & | str | ) |
KDE_EXPORT 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
KDE_EXPORT QString KPIM::quoteNameIfNecessary | ( | const QString & | str | ) |
KDE_EXPORT QString KPIM::simpleEmailAddressErrorMsg | ( | ) |
KDE_EXPORT 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.
KDE_EXPORT 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.
KDE_EXPORT QStringList KPIM::splitEmailAddrList | ( | const QString & | aStr | ) |