mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
MainMenu: Fix shortcuts for toggling sidebars
This commit is contained in:
parent
5c20fdfe82
commit
01b4fd971f
@ -949,6 +949,9 @@ void BrowserWindow::restoreWindowState(const RestoreManager::WindowData &d)
|
||||
|
||||
void BrowserWindow::createToolbarsMenu(QMenu* menu)
|
||||
{
|
||||
removeActions(menu->actions());
|
||||
menu->clear();
|
||||
|
||||
QAction* action;
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
@ -970,6 +973,8 @@ void BrowserWindow::createToolbarsMenu(QMenu* menu)
|
||||
action = menu->addAction(tr("&Tabs on Top"), this, SLOT(toggleTabsOnTop(bool)));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(qzSettings->tabsOnTop);
|
||||
|
||||
addActions(menu->actions());
|
||||
}
|
||||
|
||||
void BrowserWindow::createSidebarsMenu(QMenu* menu)
|
||||
@ -1018,6 +1023,13 @@ void BrowserWindow::createEncodingMenu(QMenu* menu)
|
||||
createEncodingSubMenu(tr("Other"), otherCodecs, menu);
|
||||
}
|
||||
|
||||
void BrowserWindow::removeActions(const QList<QAction *> &actions)
|
||||
{
|
||||
foreach (QAction *action, actions) {
|
||||
removeAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWindow::addTab()
|
||||
{
|
||||
m_tabWidget->addView(QUrl(), Qz::NT_SelectedNewEmptyTab, true);
|
||||
|
@ -82,6 +82,8 @@ public:
|
||||
void createSidebarsMenu(QMenu* menu);
|
||||
void createEncodingMenu(QMenu* menu);
|
||||
|
||||
void removeActions(const QList<QAction*> &actions);
|
||||
|
||||
SideBar* addSideBar();
|
||||
|
||||
QByteArray saveState(int version = 0) const;
|
||||
|
@ -465,7 +465,6 @@ void MainMenu::aboutToShowSidebarsMenu()
|
||||
Q_ASSERT(menu);
|
||||
|
||||
if (m_window) {
|
||||
menu->clear();
|
||||
m_window->createSidebarsMenu(menu);
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +93,9 @@ SideBarManager::SideBarManager(BrowserWindow* parent)
|
||||
|
||||
void SideBarManager::createMenu(QMenu* menu)
|
||||
{
|
||||
m_window->removeActions(menu->actions());
|
||||
menu->clear();
|
||||
|
||||
QAction* act = menu->addAction(SideBar::tr("Bookmarks"), this, SLOT(slotShowSideBar()));
|
||||
act->setCheckable(true);
|
||||
act->setShortcut(QKeySequence("Ctrl+Shift+B"));
|
||||
@ -116,9 +119,6 @@ void SideBarManager::createMenu(QMenu* menu)
|
||||
}
|
||||
|
||||
m_window->addActions(menu->actions());
|
||||
|
||||
// Menu is only valid until hidden
|
||||
connect(menu, SIGNAL(aboutToHide()), this, SLOT(clearMenu()));
|
||||
}
|
||||
|
||||
void SideBarManager::addSidebar(const QString &id, SideBarInterface* interface)
|
||||
@ -142,14 +142,6 @@ void SideBarManager::slotShowSideBar()
|
||||
}
|
||||
}
|
||||
|
||||
void SideBarManager::clearMenu()
|
||||
{
|
||||
QMenu* menu = qobject_cast<QMenu*>(sender());
|
||||
Q_ASSERT(menu);
|
||||
|
||||
menu->clear();
|
||||
}
|
||||
|
||||
void SideBarManager::showSideBar(const QString &id, bool toggle)
|
||||
{
|
||||
if (id == QLatin1String("None")) {
|
||||
|
@ -72,7 +72,6 @@ public:
|
||||
|
||||
private slots:
|
||||
void slotShowSideBar();
|
||||
void clearMenu();
|
||||
|
||||
private:
|
||||
BrowserWindow* m_window;
|
||||
|
Loading…
Reference in New Issue
Block a user