D10804: Show "Empty Trash" button inside trash directory

Mark Gaiser noreply at phabricator.kde.org
Tue Feb 27 17:28:51 GMT 2018


markg requested changes to this revision.
markg added inline comments.

INLINE COMMENTS

> dolphintrash.cpp:50-51
> +{
> +    KConfig trashConfig(QStringLiteral("trashrc"), KConfig::SimpleConfig);                                                                                                                                                      
> +    return (trashConfig.group("Status").readEntry("Empty", true));
> +}

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.

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/20180227/840212a6/attachment.htm>


More information about the kfm-devel mailing list