Commit bca6e101 authored by Nicolas Fella's avatar Nicolas Fella Committed by Laurent Montel
Browse files

Show paths instead of URLs in attachment warning

This removes the file:// prefix, which is unnecessarily technical and doesn't add information
parent 03138dde
Pipeline #140443 passed with stage
in 3 minutes and 38 seconds
......@@ -5,6 +5,9 @@
*/
#include "attachmentaddedfromexternalwarning.h"
#include <QUrl>
#include <KLocalizedString>
AttachmentAddedFromExternalWarning::AttachmentAddedFromExternalWarning(QWidget *parent)
......@@ -20,9 +23,22 @@ AttachmentAddedFromExternalWarning::~AttachmentAddedFromExternalWarning() = defa
void AttachmentAddedFromExternalWarning::setAttachmentNames(const QStringList &lst)
{
if (lst.count() == 1) {
setText(i18n("This attachment: <ul><li>%1</li></ul> was added externally. Remove it if it's an error.", lst.at(0)));
QStringList attachments;
for (const QString &item : lst) {
QUrl url(item);
if (url.isLocalFile()) {
attachments << url.toLocalFile();
} else {
attachments << item;
}
}
if (attachments.count() == 1) {
setText(i18n("This attachment: <ul><li>%1</li></ul> was added externally. Remove it if it's an error.", attachments.at(0)));
} else {
setText(i18n("These attachments: <ul><li>%1</li></ul> were added externally. Remove them if it's an error.", lst.join(QLatin1String("</li><li>"))));
setText(
i18n("These attachments: <ul><li>%1</li></ul> were added externally. Remove them if it's an error.", attachments.join(QLatin1String("</li><li>"))));
}
}
Markdown is supported
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