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

2018-11-25 Thread Thomas Surrel
This revision was automatically updated to reflect the committed changes.
Closed by commit R241:8100e99e1465: Add the possibility to have a keyboard 
shortcut to create a file (authored by thsurrel).

REPOSITORY
  R241 KIO

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D16412?vs=45292&id=46197

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

AFFECTED FILES
  src/filewidgets/knewfilemenu.cpp
  src/filewidgets/knewfilemenu.h

To: thsurrel, #frameworks, dfaure, elvisangelaccio
Cc: elvisangelaccio, kde-frameworks-devel, michaelh, ngraham, bruns


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

2018-11-25 Thread Elvis Angelaccio
elvisangelaccio accepted this revision.
This revision is now accepted and ready to land.

REPOSITORY
  R241 KIO

BRANCH
  newfileshortcut (branched from master)

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

To: thsurrel, #frameworks, dfaure, elvisangelaccio
Cc: elvisangelaccio, kde-frameworks-devel, michaelh, ngraham, bruns


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

2018-10-25 Thread Thomas Surrel
thsurrel marked 3 inline comments as done.

REPOSITORY
  R241 KIO

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

To: thsurrel, #frameworks
Cc: elvisangelaccio, kde-frameworks-devel, michaelh, ngraham, bruns


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

2018-10-25 Thread Thomas Surrel
thsurrel updated this revision to Diff 44202.
thsurrel added a comment.


  Fixes as per elvisangelaccio
  Thank you very much for the review!

REPOSITORY
  R241 KIO

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D16412?vs=44178&id=44202

BRANCH
  newfileshortcut (branched from master)

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

AFFECTED FILES
  src/filewidgets/knewfilemenu.cpp
  src/filewidgets/knewfilemenu.h

To: thsurrel, #frameworks
Cc: elvisangelaccio, kde-frameworks-devel, michaelh, ngraham, bruns


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

2018-10-24 Thread Elvis Angelaccio
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


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

2018-10-24 Thread Thomas Surrel
thsurrel added a dependent revision: D16413: Add a keyboard shortcut to create 
file.

REPOSITORY
  R241 KIO

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

To: thsurrel, #frameworks
Cc: kde-frameworks-devel, michaelh, ngraham, bruns


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

2018-10-24 Thread Thomas Surrel
thsurrel created this revision.
thsurrel added a reviewer: Frameworks.
Herald added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
thsurrel requested review of this revision.

REVISION SUMMARY
  It is already possible to create a directory with a keyboard shortcut (F10 in
  Dolphin). This patch adds the same possibility for creating a file.
  The file template used will be the first one encountered in the list, so it 
should
  be a text file by default, or a user defined one if any.

REPOSITORY
  R241 KIO

BRANCH
  newfileshortcut (branched from master)

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

AFFECTED FILES
  src/filewidgets/knewfilemenu.cpp
  src/filewidgets/knewfilemenu.h

To: thsurrel, #frameworks
Cc: kde-frameworks-devel, michaelh, ngraham, bruns