From 04730674fdcf94cf4f5fa066d602b6f9a3267993 Mon Sep 17 00:00:00 2001 From: stippi Date: Mon, 15 Feb 2010 10:39:24 +0000 Subject: [PATCH] Support dropping files on LauncherWindows to load them. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@85 94f232f2-1747-11df-bad5-a5bfde151594 --- src/apps/webpositive/LauncherWindow.cpp | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/apps/webpositive/LauncherWindow.cpp b/src/apps/webpositive/LauncherWindow.cpp index 872da78b7f..7310925007 100644 --- a/src/apps/webpositive/LauncherWindow.cpp +++ b/src/apps/webpositive/LauncherWindow.cpp @@ -39,11 +39,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -230,6 +232,32 @@ void LauncherWindow::MessageReceived(BMessage* message) webView()->goForward(); break; + case B_SIMPLE_DATA: { + // User possibly dropped files on this window. + // If there is more than one entry_ref, let the app handle it (open one + // new page per ref). If there is one ref, open it in this window. + type_code type; + int32 countFound; + if (message->GetInfo("refs", &type, &countFound) != B_OK + || type != B_REF_TYPE) { + break; + } + if (countFound > 1) { + message->what = B_REFS_RECEIVED; + be_app->PostMessage(message); + break; + } + entry_ref ref; + if (message->FindRef("refs", &ref) != B_OK) + break; + BEntry entry(&ref, true); + BPath path; + if (!entry.Exists() || entry.GetPath(&path) != B_OK) + break; + webView()->loadRequest(path.Path()); + break; + } + case TEXT_SIZE_INCREASE: webView()->increaseTextSize(); break;