Commit 35bfe306 authored by Laurent Montel's avatar Laurent Montel
Browse files

Fix show duplicate name

parent c1ee5b5f
......@@ -74,7 +74,7 @@ void ResultDuplicateTreeWidget::setContacts(const QVector<Akonadi::Item::List> &
int i = 1;
for (const Akonadi::Item::List &lst : lstItem) {
auto topLevelItem = new ResultDuplicateTreeWidgetItem(this);
topLevelItem->setText(0, i18n("Duplicate contact %1", i));
topLevelItem->setText(0, i18n("Duplicate contact \"%1\"", ResultDuplicateTreeWidgetItem::displayName(lst.first())));
for (const Akonadi::Item &item : lst) {
auto childItem = new ResultDuplicateTreeWidgetItem;
topLevelItem->addChild(childItem);
......@@ -143,7 +143,15 @@ QString ResultDuplicateTreeWidgetItem::contactName(const KContacts::Addressee &a
void ResultDuplicateTreeWidgetItem::setDisplayName()
{
if (mItem.isValid()) {
const auto address = mItem.payload<KContacts::Addressee>();
setText(0, contactName(address));
setText(0, displayName(mItem));
}
}
QString ResultDuplicateTreeWidgetItem::displayName(const Akonadi::Item &item)
{
if (item.isValid()) {
const auto address = item.payload<KContacts::Addressee>();
return contactName(address);
}
return {};
}
......@@ -24,9 +24,11 @@ public:
Q_REQUIRED_RESULT Akonadi::Item item() const;
void setItem(const Akonadi::Item &item);
Q_REQUIRED_RESULT static QString displayName(const Akonadi::Item &item);
private:
void setDisplayName();
Q_REQUIRED_RESULT QString contactName(const KContacts::Addressee &address);
Q_REQUIRED_RESULT static QString contactName(const KContacts::Addressee &address);
Akonadi::Item mItem;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment