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:
committed by
Alexandre Deckner
parent
f65c57d54e
commit
34c5cb8c83
@@ -32,6 +32,7 @@
|
|||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Directory.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
#include <GridLayoutBuilder.h>
|
#include <GridLayoutBuilder.h>
|
||||||
@@ -381,12 +382,36 @@ public:
|
|||||||
|| strlen(name) == 0) {
|
|| strlen(name) == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// Construct the BEntry and update fPath
|
||||||
entry_ref ref(device, directory, name);
|
entry_ref ref(device, directory, name);
|
||||||
BEntry entry(&ref);
|
BEntry entry(&ref);
|
||||||
if (entry.GetPath(&fPath) == B_OK) {
|
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);
|
fStatusBar->SetText(name);
|
||||||
Window()->PostMessage(SAVE_SETTINGS);
|
Window()->PostMessage(SAVE_SETTINGS);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_ATTR_CHANGED:
|
case B_ATTR_CHANGED:
|
||||||
|
|||||||
Reference in New Issue
Block a user