Deleting files to Recycle bin

Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

Locked
Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Deleting files to Recycle bin

Post by Guitarm » 2006-09-26 08:35

Hello,

I've been looking at bug 1048 in the Bugzilla and was wondering a bit on howto attack it.
Is SHFileOperation the way to go or is there another and better way to do it?

Regards
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

poy
Posts: 83
Joined: 2006-04-03 15:55

Post by poy » 2006-09-26 13:22

SHFileOperation should do it :)

i also took a look at this feature idea and i was thinking of showing a whole Shell menu... something like this: http://www.codeproject.com/shell/shellcontextmenu.asp
this way, you get the "real" Windows behavior about deleting, renaming, etc.

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2006-09-26 13:31

Yeah, that's a nice idea :)
But for me personally it would be enough to have remove removing the file to Recycle bin. But sure, if you code a nice solution I will probably like it anyway :wink:
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

TheParanoidOne
Forum Moderator
Posts: 1420
Joined: 2003-04-22 14:37

Post by TheParanoidOne » 2006-09-26 15:15

Shell context menu in the finished downloads window would be quite nifty.
The world is coming to an end. Please log off.

DC++ Guide | Words

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2006-09-26 22:03

Heh, I've made a (ugly hack) patch now that actually works. It "deletes" the files/dirs to Recycle bin from Finished Downloads Frame.
Maybe the next step is a complete Shell ContextMenu...
what do you say poy? :)
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

poy
Posts: 83
Joined: 2006-04-03 15:55

Post by poy » 2006-09-27 07:51

Guitarm wrote:Heh, I've made a (ugly hack) patch now that actually works. It "deletes" the files/dirs to Recycle bin from Finished Downloads Frame.
Maybe the next step is a complete Shell ContextMenu...
what do you say poy? :)
i say i'm gonna try something :D

and about your patch, do you also get a confirm dialog box? like "are you sure". you may also use WinUtil::isShift() to see if the user has pressed "shift"; if he has, the file should be completely removed (not through the recycle bin).

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2006-09-27 17:48

Strange, I didn't get your answer to my mail. Oh, well.
No, no confirmation, but that can be easily arranged :)

I mailed with arne and If I understood him correctly he thinks ShellMenu is the best alternative, but with an option to turn it off and use "standard" menu.

I look forward to see, and try, your patch!. I'll tinker away here too but you're probably faster than me so... :)
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

poy
Posts: 83
Joined: 2006-04-03 15:55

Post by poy » 2006-09-27 18:01

http://dcpp.net/bugzilla/show_bug.cgi?id=1063 :wink:

i've not added any option, but it should be easy, because the shell menu is added in an if(1 item selected) block. so it would just need to be changed to if(1 item && BOOLSETTING(...))

[edit: however, the "standard" menu is still there, it's inserted at the beginning of the shell menu :) ]

i'm not sure about everything, so please try it!

oh and sorry for the e-mail, i'm using a "trash" e-mail here so i fear i can't be reached anywhere else but here or on the public dev hub...

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2006-09-27 19:01

Nice :)
I've just patched, compiled and started up. I'll come back with a review...

Whoops...try to remove a file ("new" remove) -> it does remove the file but not the list item ->

Code: Select all

Code: c0000005
Version: 0.696
Major: 5
Minor: 1
Build: 2600
SP: 2
Type: 1
Time: 2006-09-28 02:03:26
TTH: AF6TRFOHY7S3NAS5AFUTABYJ5K3WYXMMP37CBOQ

c:\dcpp\svn\dcplusplus\trunk\windows\shellcontextmenu.cpp(72): CShellContextMenu::SetPath
c:\dcpp\svn\dcplusplus\trunk\windows\finishedframebase.h(206): FinishedFrameBase<FinishedULFrame=0x0000007B,152=0x00AE02C0,1126>::onContextMenu
c:\dcpp\svn\dcplusplus\trunk\windows\finishedframebase.h(50): FinishedFrameBase<FinishedFrame=0x009602CE,151=0x0000007B,1091>::ProcessWindowMessage
c:\program\microsoft visual studio .net 2003\vc7\atlmfc\include\atlwin.h(3017): ATL::CWindowImplBaseT<WTL::CMDIWindow=0x00E3BA18,ATL::CWinTraits<1456406528=0x0000007B,64> >::WindowProc
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

poy
Posts: 83
Joined: 2006-04-03 15:55

Post by poy » 2006-09-27 20:08

thanks for trying! :)

i don't manage to reproduce what you get :?
when i do a remove (the old remove that's already in the current context menu), it removes fine... same with many items at a time.
what do you call "new" remove? i've not added any "remove" :|

since the bug seems to have appeared in CShellContextMenu::SetPath, completely in the middle of trying to get PIDLs corresponding to the path, it may be a path issue. does it also happen with the same path you tried, without remove? and if it does, what's so special in this path then...? thanks

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2006-09-27 20:37

Ah, ok. I mean the ( I have a swedish XP here - My girlfriends comp ) second alternative from the bottom, in swedish it's "ta bort" but I don't even know where you're from and what language you use *lol*. But second from the bottom (second from properties). You get a dialog "Confirm deletion of file" or something similar...

Yes, the original remove works fine here too, no problemo
:)
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

poy
Posts: 83
Joined: 2006-04-03 15:55

Post by poy » 2006-09-28 07:10

you are right, thanks! fixed :wink:

actually, it happens also if you have moved/deleted the file from somewhere else (for instance from the windows explorer). the SetPath() function couldn't associate PIDLs to the path, because the path doesn't exist...

oh and here it's called "Supprimer" [french] :roll:
it must be "Delete" in english, which would differentiate this command from the "Remove" which is in the "standard" menu.

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2006-09-28 08:08

poy wrote:it must be "Delete" in english, which would differentiate this command from the "Remove" which is in the "standard" menu.
Yes you're right, I should've used "Delete" instead, my mistake :roll:

If I'll get the time I'll try that new patch aswell and I hope that the copyright/wrong issue can be solved.

Good coding btw :)
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

Locked