[pim/kdepim-addons] kaddressbook/plugins/sendvcards: group must be unique too

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit afe863d4a69458970da2e2787c98602be49749b0 by Laurent Montel.
Committed on 16/08/2026 at 07:10.
Pushed by mlaurent into branch 'master'.

group must be unique too

M  +6    -5    kaddressbook/plugins/sendvcards/sendvcardsjob.cpp

https://invent.kde.org/pim/kdepim-addons/-/commit/afe863d4a69458970da2e2787c98602be49749b0

diff --git a/kaddressbook/plugins/sendvcards/sendvcardsjob.cpp b/kaddressbook/plugins/sendvcards/sendvcardsjob.cpp
index cc45ba285..c9c3c7e84 100644
--- a/kaddressbook/plugins/sendvcards/sendvcardsjob.cpp
+++ b/kaddressbook/plugins/sendvcards/sendvcardsjob.cpp
@@ -62,7 +62,7 @@ bool SendVcardsJob::start()
         return false;
     }
 
-    QStringList realNameLst;
+    QStringList attachmentNameLst;
     for (const Akonadi::Item &item : std::as_const(mListItem)) {
         if (item.hasPayload<KContacts::Addressee>()) {
             const auto contact = item.payload<KContacts::Addressee>();
@@ -71,16 +71,17 @@ bool SendVcardsJob::start()
             KContacts::adaptIMAttributes(data);
             createTemporaryDir();
             const QString contactRealName(contact.realName());
-            const QString generatedUniqueAttachmentName = createUniqueAttachmentName(contactRealName, realNameLst);
+            const QString generatedUniqueAttachmentName = createUniqueAttachmentName(contactRealName, attachmentNameLst);
             const QString attachmentName = generatedUniqueAttachmentName + QStringLiteral(".vcf");
-            realNameLst.append(generatedUniqueAttachmentName);
+            attachmentNameLst.append(generatedUniqueAttachmentName);
             createTemporaryFile(data, attachmentName);
         } else if (item.hasPayload<KContacts::ContactGroup>()) {
             ++mExpandGroupJobCount;
             const auto group = item.payload<KContacts::ContactGroup>();
-            const QString groupName(group.name());
-            const QString attachmentName = (groupName.isEmpty() ? QStringLiteral("vcard") : groupName) + QStringLiteral(".vcf");
+            const QString uniqueName = createUniqueAttachmentName(group.name(), attachmentNameLst);
+            attachmentNameLst.append(uniqueName);
             auto expandJob = new Akonadi::ContactGroupExpandJob(group, this);
+            const QString attachmentName = uniqueName + QStringLiteral(".vcf");
             expandJob->setProperty("groupName", attachmentName);
             connect(expandJob, &KJob::result, this, &SendVcardsJob::slotExpandGroupResult);
             expandJob->start();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.