D28302: [KNewFileMenu] Add extension to proposed filename

David Faure noreply at phabricator.kde.org
Sat Mar 28 11:22:38 GMT 2020


dfaure added inline comments.

INLINE COMMENTS

> knewfilemenu.cpp:467
>      text = text.trimmed(); // In some languages, there is a space in front of "...", see bug 268895
> +    // add the extension but also use the translations from "Name=" entry,
> +    // should work with .txt, .html and with ".tar.gz"... etc

"use the translation" is done before that comment, so it's a bit of a confusing place for it.

> knewfilemenu.cpp:470
> +    const QString fileName = entry.templatePath.mid(entry.templatePath.lastIndexOf(QLatin1Char('/')));
> +    text = text + fileName.mid(fileName.indexOf(QLatin1Char('.')));
> +

text += fileName.midRef(....);

This also assumes all those files always have an extension.... mid(-1) returns the whole string.
Since users can create additional templates, maybe this is worth a >=0 check?

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D28302

To: ahmadsamir, #frameworks, dfaure
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200328/df950140/attachment.html>


More information about the Kde-frameworks-devel mailing list