diff --git a/src/apps/showimage/Jamfile b/src/apps/showimage/Jamfile index 723caa8111..b94afb9344 100644 --- a/src/apps/showimage/Jamfile +++ b/src/apps/showimage/Jamfile @@ -1,5 +1,7 @@ SubDir HAIKU_TOP src apps showimage ; +UsePrivateHeaders tracker ; + SetSubDirSupportedPlatformsBeOSCompatible ; Application ShowImage : ShowImageApp.cpp diff --git a/src/apps/showimage/ShowImageView.cpp b/src/apps/showimage/ShowImageView.cpp index 50b1c46cb6..a1e1707e8f 100644 --- a/src/apps/showimage/ShowImageView.cpp +++ b/src/apps/showimage/ShowImageView.cpp @@ -8,6 +8,7 @@ * Fernando Francisco de Oliveira * Michael Wilber * Michael Pfeiffer + * Ryan Leavengood * yellowTAB GmbH * Bernd Korz */ @@ -42,10 +43,17 @@ #include #include +#include + #include #include #include +// TODO: Remove this and use Tracker's Command.h once it is moved into the private headers +namespace BPrivate { + const uint32 kMoveToTrash = 'Ttrs'; +} + using std::nothrow; @@ -1599,8 +1607,22 @@ ShowImageView::KeyDown(const char* bytes, int32 numBytes) ClearSelection(); break; case B_DELETE: - // TODO: move image to Trash (script Tracker) + { + // Move image to Trash + BMessage trash(BPrivate::kMoveToTrash); + trash.AddRef("refs", &fCurrentRef); + // We create our own messenger because the member fTrackerMessenger + // could be invalid + BMessenger tracker(kTrackerSignature); + if (tracker.SendMessage(&trash) == B_OK) + if (!NextFile()) { + // This is the last (or only file) in this directory, + // close the window + BMessenger msgr(Window()); + msgr.SendMessage(B_QUIT_REQUESTED); + } break; + } case '+': case '=': ZoomIn();