From c1d1c10af5a89da77a1005bcf28cde2d216bef74 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 24 Nov 2011 17:16:28 +0100 Subject: clean up UserAgentManager code This way we got the following gains: - UA Manager is NOT loaded until it is really used - rekonq other code does know ANYTHING about UA Manager (but the app instance) To let this really shine, we should link this directly to the webtab. Another point for moving tabs up :) --- src/mainwindow.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f242439f..ff500b4a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -502,7 +502,9 @@ void MainWindow::setupActions() // User Agent a = new KAction(KIcon("preferences-web-browser-identification"), i18n("Browser Identification"), this); actionCollection()->addAction(QL1S("useragent"), a); - a->setMenu(rApp->userAgentManager()->userAgentMenu()); + KMenu *uaMenu = new KMenu(this); + a->setMenu(uaMenu); + connect(uaMenu, SIGNAL(aboutToShow()), this, SLOT(populateUserAgentMenu())); // Editable Page a = new KAction(KIcon("document-edit"), i18n("Set Editable"), this); @@ -1497,3 +1499,10 @@ void MainWindow::closeEvent(QCloseEvent *event) kDebug() << "CLOSING WINDOW..."; KXmlGuiWindow::closeEvent(event); } + + +void MainWindow::populateUserAgentMenu() +{ + KMenu *uaMenu = static_cast(QObject::sender()); + rApp->userAgentManager()->populateUAMenuForTabUrl(uaMenu, currentTab()); +} -- cgit v1.2.1