diff --git a/src/akonadi-contacts/standardcontactgroupformatter.cpp b/src/akonadi-contacts/standardcontactgroupformatter.cpp index 0696e018..22f7d678 100644 --- a/src/akonadi-contacts/standardcontactgroupformatter.cpp +++ b/src/akonadi-contacts/standardcontactgroupformatter.cpp @@ -1,137 +1,137 @@ /* This file is part of Akonadi Contact. Copyright (c) 2010 Tobias Koenig This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "standardcontactgroupformatter.h" #include "job/contactgroupexpandjob.h" #include #include #include #include using namespace Akonadi; StandardContactGroupFormatter::StandardContactGroupFormatter() : d(nullptr) { } StandardContactGroupFormatter::~StandardContactGroupFormatter() { } QString StandardContactGroupFormatter::toHtml(HtmlForm form) const { KContacts::ContactGroup group; const Akonadi::Item localItem = item(); if (localItem.isValid() && localItem.hasPayload()) { group = localItem.payload(); } else { group = contactGroup(); } if (group.name().isEmpty() && group.count() == 0) { // empty group return QString(); } if (group.contactReferenceCount() != 0) { // we got a contact group with unresolved references -> we have to resolve it ourself // this shouldn't be the normal case, actually the calling code should pass in an already resolved // contact group ContactGroupExpandJob *job = new ContactGroupExpandJob(group); if (job->exec()) { group.removeAllContactData(); const KContacts::Addressee::List listContact = job->contacts(); for (const KContacts::Addressee &contact : listContact) { group.append(KContacts::ContactGroup::Data(contact.realName(), contact.preferredEmail())); } } } // Assemble all parts QString strGroup = QStringLiteral( "" "" "" "" // name "" "
" "" // image "%2
") .arg(QStringLiteral("group_photo")) .arg(group.name()); strGroup += QLatin1String(""); - for (uint i = 0; i < group.dataCount(); ++i) { + for (int i = 0; i < group.dataCount(); ++i) { const KContacts::ContactGroup::Data data = group.data(i); if (data.email().isEmpty()) { strGroup.append(QStringLiteral("" "") .arg(data.name())); } else { KContacts::Addressee contact; contact.setFormattedName(data.name()); contact.insertEmail(data.email()); const QString fullEmail = QLatin1String("%1").arg(contact.preferredEmail()); strGroup.append(QStringLiteral("" "") .arg(contact.realName()) .arg(fullEmail)); } } for (const QVariantMap &map : additionalFields()) { strGroup.append(QStringLiteral("" "") .arg(map.value(QStringLiteral("title")).toString()) .arg(map.value(QStringLiteral("value")).toString())); } strGroup.append(QLatin1String("
%1
%1<%2>
 
%1%2
\n")); QString document = QStringLiteral("
%1
").arg(strGroup); if (form == EmbeddableForm) { return document; } document = QStringLiteral( "" "" " " "" "" // text and background color "%3" // contact group part "" "") .arg(KColorScheme(QPalette::Active, KColorScheme::View).foreground().color().name()) .arg(KColorScheme(QPalette::Active, KColorScheme::View).background().color().name()) .arg(document); return document; }