D10804: Show "Empty Trash" button inside trash directory

Roman Inflianskas noreply at phabricator.kde.org
Wed Feb 28 13:03:00 GMT 2018


rominf marked an inline comment as done.
rominf added inline comments.

INLINE COMMENTS

> markg wrote in dolphintrash.cpp:50-51
> You probably don't want to do that. As a mere setting would decide if the trash is empty or not.
> You can do this in a few different ways.
> 
> 1. Look at placesitem.cpp at the "m_trashDirLister" how that is used to update the trash icon in the places menu with whatever the trash state is.
> 
> Spoiler:
> 
>   void PlacesItem::onTrashDirListerCompleted()
>   {
>       Q_ASSERT(url().scheme() == QLatin1String("trash"));
>   
>       const bool isTrashEmpty = m_trashDirLister->items().isEmpty();
>       setIcon(isTrashEmpty ? QStringLiteral("user-trash") : QStringLiteral("user-trash-full"));
>   }
> 
> Also, you already have the information if the trash is empty. You have the view status information (the thingy below the view that says "x Folders, X files". Follow that to figure out how it fills that information which would also give you the trash state. This would be the way to go imho.

> Look at placesitem.cpp at the "m_trashDirLister" how that is used to update the trash icon in the places menu with whatever the trash state is.

This code doesn't work well. See https://bugs.kde.org/show_bug.cgi?id=252483

> You probably don't want to do that. As a mere setting would decide if the trash is empty or not.

This way is not my idea. I asked David Faure, the KIO maintainer. He said that this way is used everywhere (it's used in Dolphin too). He also said that because of that it's a nice idea to put it to KIO.

REPOSITORY
  R318 Dolphin

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

To: rominf, #dolphin, #kde_applications, ngraham, rkflx, markg
Cc: markg, emateli, broulik, elvisangelaccio, rkflx, mmustac, ngraham, #dolphin, spoorun, navarromorales, isidorov, firef, andrebarros, emmanuelp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20180228/d299e1f5/attachment.htm>


More information about the kfm-devel mailing list