D6281: Prevent folders from drag and dropping onto themselves in dolphin main view

Henrik Fehlauer noreply at phabricator.kde.org
Sat Oct 21 12:35:50 BST 2017


rkflx added a comment.


  In https://phabricator.kde.org/D6281#120553, @elvisangelaccio wrote:
  
  > hmm the new diff seems to reintroduce the original issue. It is still possible to drop the folder onto itself with an accidental mouse click (even if the mouse switches to the forbidden cursor).
  
  
  I can still reproduce:
  
  - Enable Preferences > Navigation > Open folders during drag operations
  - Drag folder onto itself, drop before folder is opened
  - Even though folder is not moved onto itself, it is entered (without the patch we would only get a `KMessageWidget` without entering the folder).
  
  (Note: Without the patch you are allowed to at least select Copy after descending the folder hierarchy via dragging. Not sure if this is a bug or a feature, i.e. whether we should disable descending completely here or just fix the folder opening on its own after an invalid drop.)

INLINE COMMENTS

> emateli wrote in kfileitemmodel.h:76
> So, this is what I get when building without the override mark. Obviously it's just wa warning rather than an error, but I think it's best not to ignore it.
> 
>   In file included from ./src/kitemviews/kfileitemlistview.cpp:24:0:
>   ./src/kitemviews/kfileitemmodel.h:76:10: warning: virtual QUrl KFileItemModel::directory() const can be marked override [-Wsuggest-override]
>        QUrl directory() const;
>             ^~~~~~~~~

@emateli adds a call to `m_model->directory()`, for which the method needs to accessible from `KItemModelBase` and not only from `KFileItemModel`, where there is already an implementation (not showing up in this diff, of course).

We cannot move the implementation to the base class, so adding the `virtual` is the correct thing to do. Now `KFileItemModel` has a second implementation, which the compiler notices. By including `override`, we mark that as an intentional change. Unfortunately, we cannot make this a pure virtual function.

TL;DR: I'd keep the patch as proposed by @emateli.

REPOSITORY
  R318 Dolphin

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

To: emateli, #dolphin, elvisangelaccio, ngraham
Cc: rkflx, ngraham, elvisangelaccio, dfaure, anthonyfieroni, #konqueror, spoorun, navarromorales, firef, andrebarros, emmanuelp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20171021/ed9ba752/attachment.htm>


More information about the kfm-devel mailing list