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).

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@348 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
stippi 2010-03-23 15:37:01 +00:00 committed by Alexandre Deckner
parent f65c57d54e
commit 34c5cb8c83

View File

@ -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 @@ public:
|| 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: