diff options
-rw-r--r-- | Kconfig | 22 | ||||
-rw-r--r-- | src/bookmarks/bookmarkstoolbar.cpp | 9 | ||||
-rw-r--r-- | src/mainwindow/mainwindow.cpp | 5 | ||||
-rw-r--r-- | src/mainwindow/menubar.cpp | 14 | ||||
-rw-r--r-- | src/mainwindow/widgets/navigationbar.cpp | 2 |
5 files changed, 41 insertions, 11 deletions
@@ -33,14 +33,14 @@ menu "Keyboard shortcuts" config shortcuts.window.search string "Show or hide search box" default "F3" - config shortcuts.window.bookmarks.show - string "Show bookmarks dialog in this window" - default "Ctrl+B" config shortcuts.window.downloads.show string "Show downloads dialog in this window" default "Ctrl+D" comment "Navigation Bar shortcuts" + config shortcuts.navigationbar.show + string "Toggle navigation bar" + default "Ctrl+Shift+N" config shortcuts.navigation.back string "Go back in history" default "Ctrl+Left" @@ -120,6 +120,18 @@ menu "Main Window" default 720 endmenu +menu "Bookmarks" + config bookmarks.path + string "Bookmarks location" + default "~/.config/smolbote/bookmarks.xbel" + config shortcuts.window.bookmarks.show + string "Show bookmarks dialog in this window" + default "Ctrl+B" + config shortcuts.bookmarkstoolbar.show + string "Toggle bookmarks toolbar" + default "Ctrl+Shift+B" +endmenu + menu "Profile Settings" config profile.path string "Profile load location" @@ -166,9 +178,6 @@ comment "Default paths" config filter.path string "Host filter path" default "~/.config/smolbote/hosts.d" -config bookmarks.path - string "Bookmarks location" - default "~/.config/smolbote/bookmarks.xbel" config downloads.path string "Downloads location" default "~/Downloads" @@ -214,5 +223,4 @@ menu "Workarounds" default y help See QTBUG-65223: loadStarted is emitted twice when loading link with anchor - endmenu diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp index 55710ca..b8747d8 100644 --- a/src/bookmarks/bookmarkstoolbar.cpp +++ b/src/bookmarks/bookmarkstoolbar.cpp @@ -15,6 +15,9 @@ BookmarksToolbar::BookmarksToolbar(const BookmarkModel *model, MainWindow *paren : QToolBar(parent) { m_window = parent; + setObjectName("bookmarkstoolbar"); + setWindowTitle(tr("Bookmarks Toolbar")); + setMovable(false); setToolButtonStyle(Qt::ToolButtonTextBesideIcon); const auto *root = model->root(); @@ -58,6 +61,12 @@ void BookmarksToolbar::addFolder(const BookmarkItem *item, QMenu *where) auto *menu = new QMenu(this); addFolder(child, menu); action->setMenu(menu); + + connect(action, &QAction::triggered, this, [this, action, menu]() { + const auto *widget = this->widgetForAction(action); + const auto pos = widget->mapToGlobal(QPoint(0, widget->height())); + menu->popup(pos); + }); } } } diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index 5386aab..e03ec46 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -41,8 +41,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , mdiArea(new QMdiArea(this)) { - m_menuBar = new MenuBar(this); - this->setMenuBar(m_menuBar); Configuration config; @@ -82,6 +80,9 @@ MainWindow::MainWindow(QWidget *parent) this->addToolBarBreak(); this->addToolBar(new BookmarksToolbar(app->bookmarks()->model(), this)); + m_menuBar = new MenuBar(this); + this->setMenuBar(m_menuBar); + mdiArea->setBackground(Qt::NoBrush); setCentralWidget(mdiArea); mdiArea->setFocus(); diff --git a/src/mainwindow/menubar.cpp b/src/mainwindow/menubar.cpp index 27a8561..f1b3565 100644 --- a/src/mainwindow/menubar.cpp +++ b/src/mainwindow/menubar.cpp @@ -29,6 +29,7 @@ #include <QVBoxLayout> #include <QWidgetAction> #include <functional> +#include <QToolBar> inline void run_if(SubWindow *_subwindow, const std::function<void(SubWindow *, int)> &f) { @@ -161,14 +162,23 @@ MenuBar::MenuBar(MainWindow *parent) }); setShortcut(actionNewSubwindow, "shortcuts.window.newgroup"); - window->addSeparator(); - auto *actionTileSubwindows = window->addAction(tr("Tile Subwindows"), parent->mdiArea, &QMdiArea::tileSubWindows); setShortcut(actionTileSubwindows, "shortcuts.subwindow.tile"); auto *actionCascadeSubwindows = window->addAction(tr("Cascade Subwindows"), parent->mdiArea, &QMdiArea::cascadeSubWindows); setShortcut(actionCascadeSubwindows, "shortcuts.subwindow.cascade"); + window->addSeparator()->setText(tr("Toolbars")); + + for(auto *toolbar : parent->findChildren<QToolBar*>()) { + auto *action = window->addAction(toolbar->windowTitle()); + action->setCheckable(true); + action->setChecked(toolbar->isVisible()); + connect(toolbar, &QToolBar::visibilityChanged, action, &QAction::setChecked); + connect(action, &QAction::triggered, toolbar, &QToolBar::setVisible); + setShortcut(action, qUtf8Printable("shortcuts."+toolbar->objectName()+".show")); + } + window->addSeparator()->setText(tr("Subwindows")); } diff --git a/src/mainwindow/widgets/navigationbar.cpp b/src/mainwindow/widgets/navigationbar.cpp index 89e1e50..75bc90c 100644 --- a/src/mainwindow/widgets/navigationbar.cpp +++ b/src/mainwindow/widgets/navigationbar.cpp @@ -23,6 +23,8 @@ NavigationBar::NavigationBar(QWidget *parent) : QToolBar(parent) { + setObjectName("navigationbar"); + setWindowTitle(tr("Navigation Toolbar")); Configuration config; // Back button |