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

Emirald Mateli noreply at phabricator.kde.org
Fri Nov 3 16:34:45 GMT 2017


emateli added inline comments.

INLINE COMMENTS

> elvisangelaccio wrote in kitemmodelbase.h:188
> How about calling it just `getUrl(int index)`?

Can do. It's just the way that I name things and sometimes you forget to check for naming conventions on the specific project.

> elvisangelaccio wrote in kitemmodelbase.h:193
> Why are we adding this method in the first place? Can't we use `data()` with the `"isDir"` role?
> 
> If there is a reason that I'm missing, then this method should be called `isDir()`, for consistency with `isExpanded()` and `isExpandable()`.
> 
> Also, you said you made it pure virtual because in the base class we don't know whether to return true or false. But that's not a problem, we can just say in the documentation that the default value is false (because we don't know any better). That's what we are already doing in e.g. `isExpanded()`/`isExpandable()`.

I was unaware of the `data()` function. Right now it looks like we can avoid all those method overrides by simply implementing them in the base class by using the data function.

The `getUrl` method never gets overriden since every descendant uses the `url` property, whereas `isDir` gets overridden only at the places model since it doesn't have an `isDir` index on the hash.

So far it works quite okay, however I'll see to push the patch on the weekend just to make sure that everything is fine.

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

To: emateli, #dolphin, elvisangelaccio, ngraham, rkflx
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/20171103/93b75bec/attachment.htm>


More information about the kfm-devel mailing list