By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release.

Bug 1923

Summary: Add trash can configuration dialog to set limits
Product: TDE Reporter: Darrell <darrella>
Component: tdebaseAssignee: Michele Calgaro <michele.calgaro>
Status: RESOLVED FIXED    
Severity: enhancement CC: bugwatch, deloptes, michele.calgaro
Priority: P5    
Version: R14.1.x [Trinity]   
Hardware: Other   
OS: Linux   
Compiler Version: TDE Version String:
Application Version: Application Name:
Bug Depends on: 2717    
Bug Blocks: 2247    
Attachments: Non working patch to add trash configuration dialog
Cmake patch to build
Cmake patch to build2
final patch for trashbin size limit
patch for the debian tdebase-tdeio-plugins-trinity.install
patch for the debian tdebase-tdeio-plugins-trinity.install
final working patch for trashbin size limit with proper step calc

Description Darrell 2014-02-10 19:09:32 CST
Created attachment 1926 [details]
Non working patch to add trash configuration dialog

I found the patch online and this originally was intended for 3.5.10. The patch is described here:

http://tokoe-kde.blogspot.com/2008/08/size-limits-for-trash.html

The patch never was merged into 3.5.x.

I converted the patch to TQt3 but the patch fails to build for me:

/dev/shm/tdebase/tdeioslave/trash/ktrashpropsdlgplugin.cpp:226: undefined reference to `TrashImpl::trashDirectories() const'
/dev/shm/tdebase/tdeioslave/trash/ktrashpropsdlgplugin.cpp:141: undefined reference to `TrashImpl::trashDirectories() const'
/dev/shm/tdebase/tdeioslave/trash/ktrashpropsdlgplugin.cpp:61: undefined reference to `TrashImpl::TrashImpl()'
/dev/shm/tdebase/tdeioslave/trash/ktrashpropsdlgplugin.cpp:62: undefined reference to `TrashImpl::init()'

If anybody can tweak this I'll be happy to test.
Comment 1 deloptes 2016-09-20 15:42:18 CDT
Created attachment 2692 [details]
Cmake patch to build

Hi I solved the build problem, but I had to manually copy
 tdepassivepopupstack.h
 tdecryptographiccarddevice.h
in /opt/trinity/include/ in order to build.

I have not tested the enhancement provided here
Comment 2 deloptes 2016-09-20 19:27:19 CDT
It does not work this way.
I think your CMake rules are wrong but I don't know what exactly there is wrong. Good that there is the old Makefile.am. I will try to fix it and come back with a solution.
Comment 3 deloptes 2016-09-20 20:16:15 CDT
Created attachment 2693 [details]
Cmake patch to build2

this is much better and includes a build target for the testtrach executable, however still not working - I don't see the wonderful options promised
Comment 4 deloptes 2016-09-24 04:06:46 CDT
Created attachment 2697 [details]
final patch for trashbin size limit

The only problem I see now is that when you use the controls on the percent input, the defined step by 1 misbehaves if the value is < 1. IMO a function should be hooked to set the step if < 1 or > 1.
Comment 5 deloptes 2016-09-24 04:36:52 CDT
Created attachment 2698 [details]
patch for the debian tdebase-tdeio-plugins-trinity.install

This provides the service file for the ktrash size limit properties in the deb file
Comment 6 deloptes 2016-09-24 04:38:30 CDT
This obviously can not go in 14.0.0, I change the version to 14.1
Comment 7 deloptes 2016-09-24 05:13:46 CDT
Created attachment 2699 [details]
patch for the debian tdebase-tdeio-plugins-trinity.install

Sorry, forgot to add most important - the libraries for the plugin.
Comment 8 Michele Calgaro 2016-09-24 06:07:49 CDT
For reference, from ML email.
-----------------------------------------

This plugin (library) is service.
In the .desktop file I write now 

[Desktop Entry]
Type=Service
Name=Trash Properties Page
Name[bg]=Свойства на кошчето
X-TDE-Library=ktrashpropsdlgplugin
X-TDE-ServiceTypes=KPropsDlg/Plugin,media/builtin-trash

the file goes in

        /opt/trinity/share/services/ktrashpropsdlgplugin.desktop

After this run
        tdebuildsycoca

Now right click and select properties on the trashbin and watch
in .xsession-err...

tdeio (KSycoca): Trying to open tdesycoca
from /var/tmp/tdecache-emanoil/tdesycoca
tdeio (TDETrader): query for ThumbCreator : returning 14 offers
tdeio (TDETrader): query for media/builtin-trash : returning 0 offers
tdeio (TDEIOJob): stat file:///opt/trinity/share/apps/kdesktop/Desktop/Trash
tdeio_file: FileProtocol::stat details=2
tdeio (TDETrader): query for ThumbCreator : returning 14 offers
tdeio (TDETrader): query for media/builtin-trash : returning 1 offers
Comment 9 Michele Calgaro 2016-09-25 05:41:23 CDT
Emanoil,
I have tested the patches. tdebase builds and install correctly, the size limit plugin dialog is displayed and I can set the options.
But it does not seems to be doing anything: I set the option to warn me if the trash limit is exceed, but nothing happens. I also try the other two options (delete oldest/delete largest) but the result was the same.

Is it working on your system? If not, there is more work to be done.
Good job anyway in getting the patch to at least build and install.
Comment 10 deloptes 2016-09-25 08:02:46 CDT
Yes indeed. However in the code I do not see anything that would check size and issue a warning. There is functionality missing behind and you are right to be of some use it needs further dev.
Wouldn't be better if we open another bug for it and close this one?
Comment 11 Michele Calgaro 2016-09-25 09:27:17 CDT
See this function in the code
bool TrashImpl::adaptTrashSize( const TQString& origPath, int trashId )
It looks like the size of trash is checked against the limit, but obviously for some reasons it does not do anything.

I don't think we need a new bug report. This one is about adding the trash limit functionality, so we just continue here. When it is working 100% we will push it to git repository
Comment 12 deloptes 2016-09-25 10:09:06 CDT
yes agree. I doubt it has ever worked.
I'll play with it and come back.
Thanks for pointing me the function there.

regards
Comment 13 deloptes 2016-09-25 17:28:08 CDT
bool TrashImpl::adaptTrashSize( const TQString& origPath, int trashId )
{
    TDEConfig config( "ktrashrc" );
should read

    TDEConfig config( "trashrc" );

However I would like to fix the problem with the percent/size step value before releasing the final patch.
Comment 14 Michele Calgaro 2016-09-25 20:05:57 CDT
> However I would like to fix the problem with the percent/size step value 
> before releasing the final patch.

Thinking about this, the best way would be to add one more checkbox and give the user the choice among:
- delete file older than...
- size limit in %
- size limit specified in fixed amount (for example 1 GB, 537 MB, ...)

One checkbox + one combobox for size (KB, MB, GB,) + numeric edit field for the quantity selection.

That would make the patch really good, even better than the original
Comment 15 deloptes 2016-09-26 04:47:33 CDT
Created attachment 2701 [details]
final working patch for trashbin size limit with proper step calc

Hi
After thinking a while I decided to first fix this step calc and see what the responses would be. I just tested it and it looks really nice (at least for me).
What Michele suggested would take some more time which I prefer to spend on other items.
Let me know if you like the version ATM. I think it is sufficient.

enjoy
Comment 16 Michele Calgaro 2016-09-30 07:39:22 CDT
Thanks Emanoil, the code is working now, good job.
The code will definitely be added to R14.1.

Memo for future: after pushing above patches, the following things are also required:
- add option to allow setting a fixed size for the trash
- add entry point to trash configuration in TDE. Currently the only method I found is to enable the trash icon on the desktop and right click on it. There should be also another way to set trash option which do not require showing icons on desktop
Comment 17 Michele Calgaro 2016-09-30 09:01:41 CDT
It is also necessary to improve the feedback message displayed when trying to trash a file that is bigger than the maximum size allowed for Trash. Currently a message saying that the file is too big to be trashed is displayed, but it is not explained why it is too big. The message should say something like "too big to be trashed because it exceed the maximum size allowed for the trash bin" or something like that.
Comment 18 Michele Calgaro 2016-10-13 21:25:22 CDT
Comment on attachment 2701 [details]
final working patch for trashbin size limit with proper step calc

Pushed to GIT in commit ee3091b (R!4.1 only)
Many thanks to Tobias Koenig for the original patch and to Darrell and Emanoil for working on it.
Comment 19 Michele Calgaro 2016-10-13 21:26:41 CDT
Comment on attachment 2699 [details]
patch for the debian tdebase-tdeio-plugins-trinity.install

Extended to all supported Debian/Ubuntu distro and pushed to GIT in commit fe6bc03 (R14.1 only)
Comment 20 Michele Calgaro 2016-10-13 21:30:52 CDT
Emanoil, I have assumed that all the changes you made to get the original patch from Tobias to work are your own work, so I have signed off the patch with your name as well.
Let me know if that was not the case or if you have already settle the CLA with Tim.

Commit 6110a52 cleans up previous patch a bit and fix the error message when a file is too big to be trashed (see comment 17).
I have started working at adding an option to set a fixed size limit (instead of a percentual one), but first I will have to fix some bugs in KDoubleSpin
Comment 21 deloptes 2016-10-14 01:55:09 CDT
Hi Michele,
I completely forgot about this SLA. I put it on the todo and will follow next (in the weekend)

Regarding the question: Yes the work on the patch is my own work.

Thanks for the patience and help
Comment 22 Michele Calgaro 2016-10-14 07:11:45 CDT
Ok, thanks for the feedback Emanoil. And many thanks for contributing to TDE ;-)
Comment 23 deloptes 2016-10-22 06:07:41 CDT
I have signed the CLA. Is it possible to commit directly to the tree. I guess I have to read about the rules. Is there a guide?
Should I ask this question in the user list?
Comment 24 Michele Calgaro 2016-10-22 07:15:11 CDT
Hi Emanoil, I sent you email. Any question, let's discuss there if needed. Also you can use the IRC channel if you want
Comment 25 Michele Calgaro 2016-11-23 06:48:15 CST
Commit b688738 adds support for "fixed size trash". The user can now specify the size of the trash bin in a fixed value (from 0 bytes to 1024 TBytes).

Still some work left to be done before closing the bug, needs to make the trash option window more accessible.
Comment 26 deloptes 2017-03-27 04:45:01 CDT
I think we can close this. I built from git and all seems to be working perfectly - not that I use this functionality that often though.
Comment 27 Michele Calgaro 2017-03-27 04:58:13 CDT
>> Still some work left to be done before closing the bug, needs to make the 
>> trash option window more accessible.

> I think we can close this. I built from git and all seems to be working 
> perfectly - not that I use this functionality that often though.

Not really. The functionality is there but needs to make it more accessible because now it is quite hidden.
I need to have some time for TDE to complete this. Will be done sooner or later :-)
Comment 28 Michele Calgaro 2019-04-03 08:32:19 CDT
Back to work on this bug. The plan is to:
1) create a TCC module for trash configuration, under "System administration" category
2) in Konqueror main page there is a "trash" entry. Right click and properties should bring up the TCC module for config    
3) from Konqueror location bar, typing "trash:" will show the trash bin contents. Right click on the right pane -> properties should also bring up the config page
4) add a link to the TCC config page to the trash applet in kicker
5) maintain the link also in the right click popup menu from the "trash" icon on the desktop
Comment 29 Michele Calgaro 2019-04-07 22:52:33 CDT
Points 3-4-5 implemented in commit 48635e63 (tdebase) and 1977d22b7 (packaging:DEB).
Point 2 is invalid, since none of the links in the page have a right-click properties entry.
Point 1 still to be done.
Comment 30 Michele Calgaro 2019-04-14 08:04:53 CDT
Commits 691c9204, c53dbf95 and 85e0371c finally complete the work on this.
Comment 31 Michele Calgaro 2019-04-14 10:10:40 CDT
Two more commits related to this.
563adb52 (tdebase) and f8387c313 (DEB packaging)