diff --git a/ChatView/ChatRootView.cpp b/ChatView/ChatRootView.cpp index 898f0e5..2bbe40f 100644 --- a/ChatView/ChatRootView.cpp +++ b/ChatView/ChatRootView.cpp @@ -264,10 +264,18 @@ void ChatRootView::showAttachFilesDialog() } if (dialog.exec() == QDialog::Accepted) { - QStringList filePaths = dialog.selectedFiles(); - if (!filePaths.isEmpty()) { - m_attachmentFiles = filePaths; - emit attachmentFilesChanged(); + QStringList newFilePaths = dialog.selectedFiles(); + if (!newFilePaths.isEmpty()) { + bool filesAdded = false; + for (const QString &filePath : newFilePaths) { + if (!m_attachmentFiles.contains(filePath)) { + m_attachmentFiles.append(filePath); + filesAdded = true; + } + } + if (filesAdded) { + emit attachmentFilesChanged(); + } } } }