- handle NetPositive what codes; this makes it easy to use NetSurf instead by just changing the archived message used to instantiate it.

- fix background view color, some host apps hide the BDragger, making it visible.
- handle mailto: urls as a special case, we historically use the prefered app for text/x-email.

svn path=/trunk/netsurf/; revision=5584
This commit is contained in:
François Revel 2008-10-16 16:01:44 +00:00
parent b3a5250f99
commit ce07ebcea8
4 changed files with 54 additions and 0 deletions

View File

@ -162,6 +162,15 @@ NSBrowserApplication::MessageReceived(BMessage *message)
case 'urlc':
case 'urle':
case 'menu':
// NetPositive messages
case B_NETPOSITIVE_OPEN_URL:
case B_NETPOSITIVE_BACK:
case B_NETPOSITIVE_FORWARD:
case B_NETPOSITIVE_HOME:
case B_NETPOSITIVE_RELOAD:
case B_NETPOSITIVE_STOP:
case B_NETPOSITIVE_DOWN:
case B_NETPOSITIVE_UP:
//DetachCurrentMessage();
//nsbeos_pipe_message(message, this, fGuiWindow);
break;
@ -943,6 +952,11 @@ void gui_launch_url(const char *url)
BString arg(url);
mimeType.Append(arg, arg.FindFirst(":"));
// special case, text/x-email is used traditionally
// use it instead
if (arg.IFindFirst("mailto:") == 0)
mimeType = "text/x-email";
// the protocol should be alphanum
// we just check if it's registered
// if not there is likely no supporting app anyway

View File

@ -354,6 +354,15 @@ NSBaseView::MessageReceived(BMessage *message)
case B_PASTE:
case B_SELECT_ALL:
//case B_MOUSE_WHEEL_CHANGED:
// NetPositive messages
case B_NETPOSITIVE_OPEN_URL:
case B_NETPOSITIVE_BACK:
case B_NETPOSITIVE_FORWARD:
case B_NETPOSITIVE_HOME:
case B_NETPOSITIVE_RELOAD:
case B_NETPOSITIVE_STOP:
case B_NETPOSITIVE_DOWN:
case B_NETPOSITIVE_UP:
// messages for top-level
case 'back':
case 'forw':
@ -523,6 +532,8 @@ NSBaseView::AllAttached()
g->url_bar->SetTarget(this);
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
g->dragger->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
g->status_bar->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
@ -623,6 +634,9 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
case B_QUIT_REQUESTED:
nsbeos_scaffolding_destroy(scaffold);
break;
case B_NETPOSITIVE_DOWN:
//XXX WRITEME
break;
case B_SIMPLE_DATA:
{
if (!message->HasRef("refs")) {
@ -683,6 +697,15 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
}
break;
}
case B_NETPOSITIVE_OPEN_URL:
{
int32 i;
BString url;
if (message->FindString("be:url", &url) < B_OK)
break;
browser_window_go(bw, url.String(), 0, true);
break;
}
case B_COPY:
gui_copy_to_clipboard(bw->sel);
break;
@ -696,6 +719,7 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
LOG(("Selecting all text"));
selection_select_all(bw->sel);
break;
case B_NETPOSITIVE_BACK:
case BROWSER_NAVIGATE_BACK:
case 'back':
if (!history_back_available(bw->history))
@ -703,6 +727,7 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
history_back(bw, bw->history);
nsbeos_window_update_back_forward(scaffold);
break;
case B_NETPOSITIVE_FORWARD:
case BROWSER_NAVIGATE_FORWARD:
case 'forw':
if (!history_forward_available(bw->history))
@ -710,10 +735,12 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
history_forward(bw, bw->history);
nsbeos_window_update_back_forward(scaffold);
break;
case B_NETPOSITIVE_STOP:
case BROWSER_NAVIGATE_STOP:
case 'stop':
browser_window_stop(bw);
break;
case B_NETPOSITIVE_RELOAD:
case BROWSER_NAVIGATE_RELOAD_ALL:
case 'relo':
reloadAll = true;
@ -721,6 +748,7 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
case BROWSER_NAVIGATE_RELOAD:
browser_window_reload(bw, reloadAll);
break;
case B_NETPOSITIVE_HOME:
case BROWSER_NAVIGATE_HOME:
case 'home':
{
@ -855,6 +883,7 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
break;
case HISTORY_EXPORT:
break;
case B_NETPOSITIVE_UP:
case BROWSER_NAVIGATE_UP:
break;
case BROWSER_NAVIGATE_URL:

View File

@ -22,6 +22,8 @@
#include <View.h>
#include <Window.h>
#include <NetPositive.h>
extern "C" {
#include "desktop/gui.h"
#include "desktop/plotters.h"

View File

@ -150,6 +150,15 @@ NSBrowserFrameView::MessageReceived(BMessage *message)
case B_PASTE:
case B_SELECT_ALL:
//case B_MOUSE_WHEEL_CHANGED:
// NetPositive messages
case B_NETPOSITIVE_OPEN_URL:
case B_NETPOSITIVE_BACK:
case B_NETPOSITIVE_FORWARD:
case B_NETPOSITIVE_HOME:
case B_NETPOSITIVE_RELOAD:
case B_NETPOSITIVE_STOP:
case B_NETPOSITIVE_DOWN:
case B_NETPOSITIVE_UP:
// messages for top-level
case 'back':
case 'forw':