summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp84
1 files changed, 2 insertions, 82 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index c53fcb6c..f242439f 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -55,8 +55,7 @@
#include "webpage.h"
#include "webtab.h"
#include "zoombar.h"
-#include "useragentinfo.h"
-#include "useragentwidget.h"
+#include "useragentmanager.h"
// Ui Includes
#include "ui_cleardata.h"
@@ -113,7 +112,6 @@ MainWindow::MainWindow()
, m_analyzerPanel(0)
, m_historyBackMenu(0)
, m_historyForwardMenu(0)
- , m_userAgentMenu(new KMenu(this))
, m_bookmarksBar(0)
, m_popup(new QLabel(this))
, m_hidePopupTimer(new QTimer(this))
@@ -504,12 +502,7 @@ void MainWindow::setupActions()
// User Agent
a = new KAction(KIcon("preferences-web-browser-identification"), i18n("Browser Identification"), this);
actionCollection()->addAction(QL1S("useragent"), a);
- a->setMenu(m_userAgentMenu);
- connect(m_userAgentMenu, SIGNAL(aboutToShow()), this, SLOT(populateUserAgentMenu()));
-
- a = new KAction(KIcon("preferences-web-browser-identification"), i18n("Browser Identification"), this);
- actionCollection()->addAction(QL1S("UserAgentSettings"), a);
- connect(a, SIGNAL(triggered(bool)), this, SLOT(showUserAgentSettings()));
+ a->setMenu(rApp->userAgentManager()->userAgentMenu());
// Editable Page
a = new KAction(KIcon("document-edit"), i18n("Set Editable"), this);
@@ -1438,65 +1431,6 @@ void MainWindow::openActionTab(QAction* action)
}
-void MainWindow::setUserAgent()
-{
- QAction *sender = static_cast<QAction *>(QObject::sender());
-
- QString info;
- QString desc = sender->text();
- int uaIndex = sender->data().toInt();
-
- KUrl url = currentTab()->url();
- UserAgentInfo uaInfo;
- uaInfo.setUserAgentForHost(uaIndex, url.host());
- currentTab()->page()->triggerAction(QWebPage::Reload);
-}
-
-
-void MainWindow::populateUserAgentMenu()
-{
- bool defaultUA = true;
- KUrl url = currentTab()->url();
-
- QAction *a, *defaultAction;
-
- m_userAgentMenu->clear();
-
- defaultAction = new QAction(i18nc("Default rekonq user agent", "Default"), this);
- defaultAction->setData(-1);
- defaultAction->setCheckable(true);
- connect(defaultAction, SIGNAL(triggered(bool)), this, SLOT(setUserAgent()));
-
- m_userAgentMenu->addAction(defaultAction);
- m_userAgentMenu->addSeparator();
-
- UserAgentInfo uaInfo;
- QStringList UAlist = uaInfo.availableUserAgents();
- int uaIndex = uaInfo.uaIndexForHost(currentTab()->url().host());
-
- for (int i = 0; i < UAlist.count(); ++i)
- {
- QString uaDesc = UAlist.at(i);
-
- a = new QAction(uaDesc, this);
- a->setData(i);
- a->setCheckable(true);
- connect(a, SIGNAL(triggered(bool)), this, SLOT(setUserAgent()));
-
- if (i == uaIndex)
- {
- a->setChecked(true);
- defaultUA = false;
- }
- m_userAgentMenu->addAction(a);
- }
- defaultAction->setChecked(defaultUA);
-
- m_userAgentMenu->addSeparator();
- m_userAgentMenu->addAction(actionByName("UserAgentSettings"));
-}
-
-
void MainWindow::enableNetworkAnalysis(bool b)
{
currentTab()->page()->enableNetworkAnalyzer(b);
@@ -1529,20 +1463,6 @@ void MainWindow::setupBookmarksAndToolsShortcuts()
}
-void MainWindow::showUserAgentSettings()
-{
- QPointer<KDialog> dialog = new KDialog(this);
- dialog->setCaption(i18nc("@title:window", "User Agent Settings"));
- dialog->setButtons(KDialog::Ok);
-
- UserAgentWidget widget;
- dialog->setMainWidget(&widget);
- dialog->exec();
-
- dialog->deleteLater();
-}
-
-
void MainWindow::moveEvent(QMoveEvent *event)
{
if (m_hidePopupTimer)