Author: stippi Date: Tue Mar 23 15:37:01 2010 New Revision: 348 URL: http://mmlr.dyndns.org/changeset/348 Log: Following another suggestion by Axel: Check if a download file is being moved into the trash. If it's still in progress, cancel it. Dim the icon in any case. Undim the icon if a download is moved back out of the trash (restarting still has to happen manually). Modified: webkit/trunk/WebKit/haiku/WebPositive/DownloadWindow.cpp Modified: webkit/trunk/WebKit/haiku/WebPositive/DownloadWindow.cpp ============================================================================== --- webkit/trunk/WebKit/haiku/WebPositive/DownloadWindow.cpp Tue Mar 23 15:13:56 2010 (r347) +++ webkit/trunk/WebKit/haiku/WebPositive/DownloadWindow.cpp Tue Mar 23 15:37:01 2010 (r348) @@ -32,6 +32,7 @@ #include <Alert.h> #include <Bitmap.h> #include <Button.h> +#include <Directory.h> #include <Entry.h> #include <FindDirectory.h> #include <GridLayoutBuilder.h> @@ -381,12 +382,36 @@ || strlen(name) == 0) { break; } + // Construct the BEntry and update fPath entry_ref ref(device, directory, name); BEntry entry(&ref); - if (entry.GetPath(&fPath) == B_OK) { - fStatusBar->SetText(name); - Window()->PostMessage(SAVE_SETTINGS); + if (entry.GetPath(&fPath) != B_OK) + break; + // Find out if the directory is the Trash for this + // volume + char trashPath[B_PATH_NAME_LENGTH]; + if (find_directory(B_TRASH_DIRECTORY, device, false, + trashPath, B_PATH_NAME_LENGTH) == B_OK) { + BPath trashDirectory(trashPath); + BPath parentDirectory; + fPath.GetParent(&parentDirectory); + if (parentDirectory == trashDirectory) { + // The entry was moved into the Trash. + // If the download is still in progress, + // cancel it. + if (fDownload) + fDownload->Cancel(); + fIconView->SetIconDimmed(true); + DownloadCanceled(); + break; + } else if (fIconView->IsIconDimmed()) { + // Maybe it was moved out of the trash. + fIconView->SetIconDimmed(false); + } } + + fStatusBar->SetText(name); + Window()->PostMessage(SAVE_SETTINGS); break; } case B_ATTR_CHANGED: