D16412: Add the possibility to have a keyboard shortcut to create a file

Elvis Angelaccio noreply at phabricator.kde.org
Wed Oct 24 21:35:29 BST 2018


elvisangelaccio added inline comments.

INLINE COMMENTS

> knewfilemenu.cpp:755
>                      } else {
> +                        if (m_firstFileEntry == nullptr) {
> +                            m_firstFileEntry = &entry;

`!m_firstFileEntry`

> knewfilemenu.cpp:1263-1299
> +    QString text = d->m_firstFileEntry->text;
> +    text.remove(QStringLiteral("...")); // the ... is fine for the menu item but not for the default filename
> +    text = text.trimmed(); // In some languages, there is a space in front of "...", see bug 268895
> +    d->m_copyData = KNewFileMenuCopyData();
> +    d->m_copyData.m_src = d->m_firstFileEntry->templatePath;
> +
> +    const QUrl defaultFile = QUrl::fromLocalFile(directory.toLocalFile() + '/' + KIO::encodeFileName(text));

Can we try to not duplicate this code? We should create this new `createFile()` function such that we can also call it from `executeRealFileOrDir()`

> knewfilemenu.h:162
> +     */
> +    void createFile();
> +

Missing @since

REPOSITORY
  R241 KIO

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

To: thsurrel, #frameworks
Cc: elvisangelaccio, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20181024/98f69d8b/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list