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

enum KPIM::EmailParseResult
 

Result type for splitAddress, isValidEmailAddress.

Definition at line 44 of file email.h.


Function Documentation

KDE_EXPORT bool KPIM::compareEmail const QString &  email1,
const QString &  email2,
bool  matchName
 

Compare two email addresses.

If matchName is false, it just checks the email address, and returns true if this matches. If matchName is true, both the name and the email must be the same.

Definition at line 780 of file email.cpp.

KDE_EXPORT QString KPIM::decodeIDN const QString &  addrSpec  ) 
 

Decodes the punycode domain part of the given addr-spec if it's an IDN.

Parameters:
addrSpec a pure 7-bit email address (addr-spec in RFC2822)
Returns:
the email address with Unicode domain

Definition at line 812 of file email.cpp.

KDE_EXPORT QString KPIM::emailParseResultToString EmailParseResult  errorCode  ) 
 

Translate the enum errorcodes from emailParseResult into i18n'd strings that can be used for msg boxes.

Parameters:
errorCode the errorCode from isValidEmailEmailAddress().
Returns:
An i18n ready string for use in msgboxes.

Definition at line 446 of file email.cpp.

KDE_EXPORT QString KPIM::encodeIDN const QString &  addrSpec  ) 
 

Encodes the domain part of the given addr-spec in punycode if it's an IDN.

Parameters:
addrSpec a pure email address with Unicode domain
Returns:
the email address with domain in punycode

Definition at line 827 of file email.cpp.

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

Definition at line 574 of file email.cpp.

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

Definition at line 556 of file email.cpp.

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

Definition at line 599 of file email.cpp.

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

Definition at line 581 of file email.cpp.

KDE_EXPORT bool KPIM::getNameAndMail const QString &  aStr,
QString &  name,
QString &  mail
 

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.

Definition at line 606 of file email.cpp.

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.

Definition at line 276 of file email.cpp.

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.

Definition at line 504 of file email.cpp.

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  ) 
 

Normalizes all email addresses in the given list and decodes all IDNs.

Parameters:
addresses a list of email addresses with punycoded IDNs
Returns:
the email addresses in normalized form with Unicode IDNs

Definition at line 842 of file email.cpp.

KDE_EXPORT QString KPIM::normalizeAddressesAndEncodeIDNs const QString &  str  ) 
 

Normalizes all email addresses in the given list and encodes all IDNs in punycode.

Definition at line 880 of file email.cpp.

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

Definition at line 794 of file email.cpp.

KDE_EXPORT QString KPIM::quoteNameIfNecessary const QString &  str  ) 
 

Add quote characters around the given string if it contains a character that makes that necessary, in an email name, such as ",".

Definition at line 949 of file email.cpp.

KDE_EXPORT QString KPIM::simpleEmailAddressErrorMsg  ) 
 

Returns a i18n string to be used in msgboxes this allows for error messages to be the same across the board.

Returns:
An i18n ready string for use in msgboxes.

Definition at line 549 of file email.cpp.

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.

Definition at line 259 of file email.cpp.

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.

Definition at line 248 of file email.cpp.

KDE_EXPORT QStringList KPIM::splitEmailAddrList const QString &  aStr  ) 
 

Split a comma separated list of email addresses.

Definition at line 31 of file email.cpp.

KDE Home | KDE Accessibility Home | Description of Access Keys