Changeset View
Changeset View
Standalone View
Standalone View
src/kaevent.cpp
Show First 20 Lines • Show All 5764 Lines • ▼ Show 20 Line(s) | |||||
5765 | /****************************************************************************** | 5765 | /****************************************************************************** | ||
5766 | * Sets the list of email addresses, removing any empty addresses. | 5766 | * Sets the list of email addresses, removing any empty addresses. | ||
5767 | * Reply = false if empty addresses were found. | 5767 | * Reply = false if empty addresses were found. | ||
5768 | */ | 5768 | */ | ||
5769 | EmailAddressList &EmailAddressList::operator=(const Person::List &addresses) | 5769 | EmailAddressList &EmailAddressList::operator=(const Person::List &addresses) | ||
5770 | { | 5770 | { | ||
5771 | clear(); | 5771 | clear(); | ||
5772 | for (int p = 0, end = addresses.count(); p < end; ++p) { | 5772 | for (int p = 0, end = addresses.count(); p < end; ++p) { | ||
5773 | if (!addresses[p]->email().isEmpty()) { | 5773 | if (!addresses[p].email().isEmpty()) { | ||
5774 | append(addresses[p]); | 5774 | append(addresses[p]); | ||
5775 | } | 5775 | } | ||
5776 | } | 5776 | } | ||
5777 | return *this; | 5777 | return *this; | ||
5778 | } | 5778 | } | ||
5779 | 5779 | | |||
5780 | /****************************************************************************** | 5780 | /****************************************************************************** | ||
5781 | * Return the email address list as a string list of email addresses. | 5781 | * Return the email address list as a string list of email addresses. | ||
Show All 31 Lines | |||||
5813 | */ | 5813 | */ | ||
5814 | QString EmailAddressList::address(int index) const | 5814 | QString EmailAddressList::address(int index) const | ||
5815 | { | 5815 | { | ||
5816 | if (index < 0 || index > count()) { | 5816 | if (index < 0 || index > count()) { | ||
5817 | return QString(); | 5817 | return QString(); | ||
5818 | } | 5818 | } | ||
5819 | QString result; | 5819 | QString result; | ||
5820 | bool quote = false; | 5820 | bool quote = false; | ||
5821 | const Person::Ptr person = (*this)[index]; | 5821 | const Person &person = (*this)[index]; | ||
5822 | const QString name = person->name(); | 5822 | const QString name = person.name(); | ||
djarvie: This should be changed to
`const Person &person = (*this)[index];` | |||||
5823 | if (!name.isEmpty()) { | 5823 | if (!name.isEmpty()) { | ||
5824 | // Need to enclose the name in quotes if it has any special characters | 5824 | // Need to enclose the name in quotes if it has any special characters | ||
5825 | for (int i = 0, len = name.length(); i < len; ++i) { | 5825 | for (int i = 0, len = name.length(); i < len; ++i) { | ||
5826 | const QChar ch = name[i]; | 5826 | const QChar ch = name[i]; | ||
5827 | if (!ch.isLetterOrNumber()) { | 5827 | if (!ch.isLetterOrNumber()) { | ||
5828 | quote = true; | 5828 | quote = true; | ||
5829 | result += QLatin1Char('\"'); | 5829 | result += QLatin1Char('\"'); | ||
5830 | break; | 5830 | break; | ||
5831 | } | 5831 | } | ||
5832 | } | 5832 | } | ||
5833 | result += (*this)[index]->name(); | 5833 | result += (*this)[index].name(); | ||
5834 | result += (quote ? QLatin1String("\" <") : QLatin1String(" <")); | 5834 | result += (quote ? QLatin1String("\" <") : QLatin1String(" <")); | ||
5835 | quote = true; // need angle brackets round email address | 5835 | quote = true; // need angle brackets round email address | ||
5836 | } | 5836 | } | ||
5837 | 5837 | | |||
5838 | result += person->email(); | 5838 | result += person.email(); | ||
5839 | if (quote) { | 5839 | if (quote) { | ||
5840 | result += QLatin1Char('>'); | 5840 | result += QLatin1Char('>'); | ||
5841 | } | 5841 | } | ||
5842 | return result; | 5842 | return result; | ||
5843 | } | 5843 | } | ||
5844 | 5844 | | |||
5845 | /****************************************************************************** | 5845 | /****************************************************************************** | ||
5846 | * Return a list of the pure email addresses, excluding names. | 5846 | * Return a list of the pure email addresses, excluding names. | ||
5847 | */ | 5847 | */ | ||
5848 | QStringList EmailAddressList::pureAddresses() const | 5848 | QStringList EmailAddressList::pureAddresses() const | ||
5849 | { | 5849 | { | ||
5850 | QStringList list; | 5850 | QStringList list; | ||
5851 | for (int p = 0, end = count(); p < end; ++p) { | 5851 | for (int p = 0, end = count(); p < end; ++p) { | ||
5852 | list += at(p)->email(); | 5852 | list += at(p).email(); | ||
5853 | } | 5853 | } | ||
5854 | return list; | 5854 | return list; | ||
5855 | } | 5855 | } | ||
5856 | 5856 | | |||
5857 | /****************************************************************************** | 5857 | /****************************************************************************** | ||
5858 | * Return a list of the pure email addresses, excluding names, as a string. | 5858 | * Return a list of the pure email addresses, excluding names, as a string. | ||
5859 | */ | 5859 | */ | ||
5860 | QString EmailAddressList::pureAddresses(const QString &separator) const | 5860 | QString EmailAddressList::pureAddresses(const QString &separator) const | ||
5861 | { | 5861 | { | ||
5862 | QString result; | 5862 | QString result; | ||
5863 | bool first = true; | 5863 | bool first = true; | ||
5864 | for (int p = 0, end = count(); p < end; ++p) { | 5864 | for (int p = 0, end = count(); p < end; ++p) { | ||
5865 | if (first) { | 5865 | if (first) { | ||
5866 | first = false; | 5866 | first = false; | ||
5867 | } else { | 5867 | } else { | ||
5868 | result += separator; | 5868 | result += separator; | ||
5869 | } | 5869 | } | ||
5870 | result += at(p)->email(); | 5870 | result += at(p).email(); | ||
5871 | } | 5871 | } | ||
5872 | return result; | 5872 | return result; | ||
5873 | } | 5873 | } | ||
5874 | 5874 | | |||
5875 | /*============================================================================= | 5875 | /*============================================================================= | ||
5876 | = Static functions | 5876 | = Static functions | ||
5877 | =============================================================================*/ | 5877 | =============================================================================*/ | ||
5878 | 5878 | | |||
▲ Show 20 Lines • Show All 83 Lines • Show Last 20 Lines |
This should be changed to
const Person &person = (*this)[index];