I've had a look at what sending something to trash from KDE actually does, and it seems fairly simple.
First is moves the file into the directory
~/.local/share/Trash/files.
Then it creates a plain text file caled
{file name}.trashinfo in
~/.local/share/Trash/info, containing the text
Code:
[Trash Info]
Path=original path of file
DeletionDate=year-month-dayThour:minute:second
Obviously the bits I've written in blue need to be replaced with the correct information, everything else is written exactly as I've writen it here. Note that the file ends with an empty line.
I can't help you with the coding, but it should be fairly straight forward to create a script that can do that.