1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Show Bookmark Toolbar when Location Bar gets focus

Optional behaviour providing quick access to bookmarks without
wasting the vertical space
This commit is contained in:
blaze 2016-08-23 08:57:11 +02:00 committed by David Rosca
parent c8a3930d8c
commit bc47a9aba5
4 changed files with 25 additions and 1 deletions

View File

@ -754,6 +754,7 @@ void BrowserWindow::toggleShowBookmarksToolbar()
setUpdatesEnabled(true);
Settings().setValue("Browser-View-Settings/showBookmarksToolbar", m_bookmarksToolbar->isVisible());
Settings().setValue("Browser-View-Settings/instantBookmarksToolbar", false);
}
void BrowserWindow::toggleShowNavigationToolbar()
@ -897,7 +898,7 @@ void BrowserWindow::createToolbarsMenu(QMenu* menu)
action = menu->addAction(tr("&Bookmarks Toolbar"), this, SLOT(toggleShowBookmarksToolbar()));
action->setCheckable(true);
action->setChecked(m_bookmarksToolbar->isVisible());
action->setChecked(Settings().value("Browser-View-Settings/showBookmarksToolbar").toBool());
menu->addSeparator();

View File

@ -24,6 +24,7 @@
#include "bookmarksicon.h"
#include "bookmarks.h"
#include "bookmarkitem.h"
#include "bookmarkstoolbar.h"
#include "siteicon.h"
#include "goicon.h"
#include "downicon.h"
@ -403,6 +404,10 @@ void LocationBar::focusInEvent(QFocusEvent* event)
clearTextFormat();
LineEdit::focusInEvent(event);
if (Settings().value("Browser-View-Settings/instantBookmarksToolbar").toBool()) {
m_window->bookmarksToolbar()->show();
}
}
void LocationBar::focusOutEvent(QFocusEvent* event)
@ -422,6 +427,10 @@ void LocationBar::focusOutEvent(QFocusEvent* event)
}
refreshTextFormat();
if (Settings().value("Browser-View-Settings/instantBookmarksToolbar").toBool()) {
m_window->bookmarksToolbar()->hide();
}
}
void LocationBar::dropEvent(QDropEvent* event)

View File

@ -214,7 +214,13 @@ Preferences::Preferences(BrowserWindow* window)
//APPEREANCE
settings.beginGroup("Browser-View-Settings");
ui->showStatusbar->setChecked(settings.value("showStatusBar", false).toBool());
// NOTE: instantBookmarksToolbar and showBookmarksToolbar cannot be both enabled at the same time
ui->instantBookmarksToolbar->setChecked(settings.value("instantBookmarksToolbar", false).toBool());
ui->showBookmarksToolbar->setChecked(settings.value("showBookmarksToolbar", true).toBool());
ui->instantBookmarksToolbar->setDisabled(settings.value("showBookmarksToolbar", true).toBool());
ui->showBookmarksToolbar->setDisabled(settings.value("instantBookmarksToolbar").toBool());
connect(ui->instantBookmarksToolbar, SIGNAL(toggled(bool)), ui->showBookmarksToolbar, SLOT(setDisabled(bool)));
connect(ui->showBookmarksToolbar, SIGNAL(toggled(bool)), ui->instantBookmarksToolbar, SLOT(setDisabled(bool)));
ui->showNavigationToolbar->setChecked(settings.value("showNavigationToolbar", true).toBool());
ui->showHome->setChecked(settings.value("showHomeButton", true).toBool());
ui->showBackForward->setChecked(settings.value("showBackForwardButtons", true).toBool());
@ -853,6 +859,7 @@ void Preferences::saveSettings()
//WINDOW
settings.beginGroup("Browser-View-Settings");
settings.setValue("showStatusBar", ui->showStatusbar->isChecked());
settings.setValue("instantBookmarksToolbar", ui->instantBookmarksToolbar->isChecked());
settings.setValue("showBookmarksToolbar", ui->showBookmarksToolbar->isChecked());
settings.setValue("showNavigationToolbar", ui->showNavigationToolbar->isChecked());
settings.setValue("showHomeButton", ui->showHome->isChecked());

View File

@ -591,6 +591,13 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="instantBookmarksToolbar">
<property name="text">
<string>Enable instant Bookmarks ToolBar</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">