WebPositive: Add support to show/hide bookmark bar
Default is shown, a menu option in the View menu allows you to show or hide the bar. Also move the bookmark bar below the tab frame, it looks better here I think and matches other browsers (e.g. Firefox.)
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 2010 Stephan Aßmus <[email protected]>
|
* Copyright (C) 2010 Stephan Aßmus <[email protected]>
|
||||||
* Copyright (C) 2010 Michael Lotz <[email protected]>
|
* Copyright (C) 2010 Michael Lotz <[email protected]>
|
||||||
* Copyright (C) 2010 Rene Gollent <[email protected]>
|
* Copyright (C) 2010 Rene Gollent <[email protected]>
|
||||||
* Copyright 2013 Haiku, Inc. All rights reserved.
|
* Copyright 2013-2014 Haiku, Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -101,6 +101,7 @@ enum {
|
|||||||
HOME = 'home',
|
HOME = 'home',
|
||||||
GOTO_URL = 'goul',
|
GOTO_URL = 'goul',
|
||||||
RELOAD = 'reld',
|
RELOAD = 'reld',
|
||||||
|
SHOW_HIDE_BOOKMARK_BAR = 'shbb',
|
||||||
CLEAR_HISTORY = 'clhs',
|
CLEAR_HISTORY = 'clhs',
|
||||||
|
|
||||||
CREATE_BOOKMARK = 'crbm',
|
CREATE_BOOKMARK = 'crbm',
|
||||||
@@ -572,6 +573,10 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
|||||||
menu = new BMenu(B_TRANSLATE("View"));
|
menu = new BMenu(B_TRANSLATE("View"));
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Reload"), new BMessage(RELOAD),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Reload"), new BMessage(RELOAD),
|
||||||
'R'));
|
'R'));
|
||||||
|
// the label will be replaced with the appropriate text later on
|
||||||
|
fBookmarkBarMenuItem = new BMenuItem("Show/Hide bookmark bar",
|
||||||
|
new BMessage(SHOW_HIDE_BOOKMARK_BAR));
|
||||||
|
menu->AddItem(fBookmarkBarMenuItem);
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Increase size"),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Increase size"),
|
||||||
new BMessage(ZOOM_FACTOR_INCREASE), '+'));
|
new BMessage(ZOOM_FACTOR_INCREASE), '+'));
|
||||||
@@ -715,15 +720,23 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
|||||||
.Add(toggleFullscreenButton, 0.0f)
|
.Add(toggleFullscreenButton, 0.0f)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
fBookmarkBar = new BookmarkBar("Bookmarks", this, &bookmarkRef);
|
||||||
|
if (fAppSettings->GetValue(kSettingsShowBookmarkBar, true)) {
|
||||||
|
// We need to hide the bookmark bar and then show it again
|
||||||
|
// to save the setting and set the menu item label.
|
||||||
|
fBookmarkBar->Hide();
|
||||||
|
_ShowBookmarkBar(true);
|
||||||
|
} else
|
||||||
|
_ShowBookmarkBar(false);
|
||||||
|
|
||||||
// Layout
|
// Layout
|
||||||
AddChild(BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
|
AddChild(BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
|
||||||
#if !INTEGRATE_MENU_INTO_TAB_BAR
|
#if !INTEGRATE_MENU_INTO_TAB_BAR
|
||||||
.Add(menuBarGroup)
|
.Add(menuBarGroup)
|
||||||
#endif
|
#endif
|
||||||
.Add(new BookmarkBar(B_TRANSLATE("Bookmarks"), this,
|
|
||||||
&bookmarkRef))
|
|
||||||
.Add(fTabManager->TabGroup())
|
.Add(fTabManager->TabGroup())
|
||||||
.Add(navigationGroup)
|
.Add(navigationGroup)
|
||||||
|
.Add(fBookmarkBar)
|
||||||
.Add(fTabManager->ContainerView())
|
.Add(fTabManager->ContainerView())
|
||||||
.Add(findGroup)
|
.Add(findGroup)
|
||||||
.Add(statusGroup)
|
.Add(statusGroup)
|
||||||
@@ -917,6 +930,10 @@ BrowserWindow::MessageReceived(BMessage* message)
|
|||||||
CurrentWebView()->Reload();
|
CurrentWebView()->Reload();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SHOW_HIDE_BOOKMARK_BAR:
|
||||||
|
_ShowBookmarkBar(fBookmarkBar->IsHidden());
|
||||||
|
break;
|
||||||
|
|
||||||
case GOTO_URL:
|
case GOTO_URL:
|
||||||
{
|
{
|
||||||
BString url;
|
BString url;
|
||||||
@@ -1229,6 +1246,9 @@ BrowserWindow::MessageReceived(BMessage* message)
|
|||||||
fHomeButton->Show();
|
fHomeButton->Show();
|
||||||
else
|
else
|
||||||
fHomeButton->Hide();
|
fHomeButton->Hide();
|
||||||
|
} else if (name == kSettingsShowBookmarkBar
|
||||||
|
&& message->FindBool("value", &flag) == B_OK) {
|
||||||
|
_ShowBookmarkBar(flag);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2627,3 +2647,21 @@ BrowserWindow::_HandlePageSourceResult(const BMessage* message)
|
|||||||
alert->Go(NULL);
|
alert->Go(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BrowserWindow::_ShowBookmarkBar(bool show)
|
||||||
|
{
|
||||||
|
if (fBookmarkBar == NULL || fBookmarkBar->IsHidden() != show)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fAppSettings->SetValue(kSettingsShowBookmarkBar, show);
|
||||||
|
|
||||||
|
fBookmarkBarMenuItem->SetLabel(show
|
||||||
|
? B_TRANSLATE("Hide bookmark bar")
|
||||||
|
: B_TRANSLATE("Show bookmark bar"));
|
||||||
|
if (show)
|
||||||
|
fBookmarkBar->Show();
|
||||||
|
else
|
||||||
|
fBookmarkBar->Hide();
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
* Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
|
* Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
|
||||||
* Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com>
|
* Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com>
|
||||||
* Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
|
* Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
|
||||||
*
|
* Copyright 2013-2014 Haiku, Inc. All rights reserved.
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -48,6 +47,8 @@ class BStringView;
|
|||||||
class BTextControl;
|
class BTextControl;
|
||||||
class BUrlContext;
|
class BUrlContext;
|
||||||
class BWebView;
|
class BWebView;
|
||||||
|
|
||||||
|
class BookmarkBar;
|
||||||
class SettingsMessage;
|
class SettingsMessage;
|
||||||
class TabManager;
|
class TabManager;
|
||||||
class URLInputGroup;
|
class URLInputGroup;
|
||||||
@@ -209,6 +210,8 @@ private:
|
|||||||
void _HandlePageSourceResult(
|
void _HandlePageSourceResult(
|
||||||
const BMessage* message);
|
const BMessage* message);
|
||||||
|
|
||||||
|
void _ShowBookmarkBar(bool show);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BMenu* fHistoryMenu;
|
BMenu* fHistoryMenu;
|
||||||
int32 fHistoryMenuFixedItemCount;
|
int32 fHistoryMenuFixedItemCount;
|
||||||
@@ -266,6 +269,9 @@ private:
|
|||||||
uint32 fNewTabPolicy;
|
uint32 fNewTabPolicy;
|
||||||
BString fStartPageURL;
|
BString fStartPageURL;
|
||||||
BString fSearchPageURL;
|
BString fSearchPageURL;
|
||||||
|
|
||||||
|
BMenuItem* fBookmarkBarMenuItem;
|
||||||
|
BookmarkBar* fBookmarkBar;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
|
* Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
|
||||||
|
* Coptright 2014 Haiku, Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Stephan Aßmus, superstippi@gmx.de
|
||||||
|
* John Scipione, jscipione@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "SettingsKeys.h"
|
#include "SettingsKeys.h"
|
||||||
|
|
||||||
|
|
||||||
const char* kSettingsKeyDownloadPath = "download path";
|
const char* kSettingsKeyDownloadPath = "download path";
|
||||||
const char* kSettingsKeyShowTabsIfSinglePageOpen
|
const char* kSettingsKeyShowTabsIfSinglePageOpen
|
||||||
= "show tabs if single page open";
|
= "show tabs if single page open";
|
||||||
@@ -31,3 +38,5 @@ const char* kSettingsKeyProxyPort = "http proxy port";
|
|||||||
const char* kSettingsKeyUseProxyAuth = "use http proxy authentication";
|
const char* kSettingsKeyUseProxyAuth = "use http proxy authentication";
|
||||||
const char* kSettingsKeyProxyUsername = "http proxy username";
|
const char* kSettingsKeyProxyUsername = "http proxy username";
|
||||||
const char* kSettingsKeyProxyPassword = "http proxy password";
|
const char* kSettingsKeyProxyPassword = "http proxy password";
|
||||||
|
|
||||||
|
const char* kSettingsShowBookmarkBar = "show bookmarks bar";
|
||||||
@@ -1,11 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
|
* Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
|
||||||
|
* Coptright 2014 Haiku, Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Stephan Aßmus, superstippi@gmx.de
|
||||||
|
* John Scipione, jscipione@gmail.com
|
||||||
*/
|
*/
|
||||||
#ifndef SETTINGS_KEYS_H
|
#ifndef SETTINGS_KEYS_H
|
||||||
#define SETTINGS_KEYS_H
|
#define SETTINGS_KEYS_H
|
||||||
|
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -31,4 +37,6 @@ extern const char* kSettingsKeyUseProxyAuth;
|
|||||||
extern const char* kSettingsKeyProxyUsername;
|
extern const char* kSettingsKeyProxyUsername;
|
||||||
extern const char* kSettingsKeyProxyPassword;
|
extern const char* kSettingsKeyProxyPassword;
|
||||||
|
|
||||||
|
extern const char* kSettingsShowBookmarkBar;
|
||||||
|
|
||||||
#endif // SETTINGS_KEYS_H
|
#endif // SETTINGS_KEYS_H
|
||||||
|
|||||||
Reference in New Issue
Block a user