summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp56
1 files changed, 55 insertions, 1 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index a598128b..128648bf 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -47,6 +47,7 @@
#include "urlbar.h"
#include "tabbar.h"
#include "adblockmanager.h"
+#include "analyzerpanel.h"
// Ui Includes
#include "ui_cleardata.h"
@@ -99,6 +100,7 @@ MainWindow::MainWindow()
, m_historyPanel(0)
, m_bookmarksPanel(0)
, m_webInspectorPanel(0)
+ , m_analyzerPanel(0)
, m_historyBackMenu(0)
, m_encodingMenu(new KMenu(this))
, m_mainBar(new KToolBar(QString("MainToolBar"), this, Qt::TopToolBarArea, true, true, true))
@@ -391,6 +393,16 @@ void MainWindow::setupActions()
a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev());
actionCollection()->addAction(QL1S("show_prev_tab"), a);
connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab()));
+
+ a = new KAction(KIcon("tab-new"), i18n("Open Closed Tabs"), this);
+ a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_T));
+ actionCollection()->addAction(QL1S("open_closed_tabs"), a);
+ connect(a, SIGNAL(triggered(bool)), m_view, SLOT(openClosedTabs()));
+
+ // Closed Tabs Menu
+ KActionMenu *closedTabsMenu = new KActionMenu(KIcon("tab-new"), i18n("Closed Tabs"), this);
+ closedTabsMenu->setDelayed(false);
+ actionCollection()->addAction(QL1S("closed_tab_menu"), closedTabsMenu);
// ============================== Indexed Tab Actions ====================================
a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this);
@@ -494,9 +506,10 @@ void MainWindow::setupTools()
toolsMenu->addSeparator();
- KActionMenu *webMenu = new KActionMenu(KIcon("applications-development-web"), i18n("Web Development"), this);
+ KActionMenu *webMenu = new KActionMenu(KIcon("applications-development-web"), i18n("Development"), this);
webMenu->addAction(actionByName(QL1S("web_inspector")));
webMenu->addAction(actionByName(QL1S("page_source")));
+ webMenu->addAction(actionByName(QL1S("net_analyzer")));
toolsMenu->addAction(webMenu);
toolsMenu->addSeparator();
@@ -565,6 +578,19 @@ void MainWindow::setupPanels()
addDockWidget(Qt::BottomDockWidgetArea, m_webInspectorPanel);
m_webInspectorPanel->hide();
+
+ // STEP 4
+ // Setup Network analyzer panel
+ m_analyzerPanel = new NetworkAnalyzerPanel( i18n("Network Analyzer"), this);
+ connect(mainView(), SIGNAL(currentChanged(int)), m_analyzerPanel, SLOT(changeCurrentPage()));
+
+ a = new KAction(KIcon("document-edit-decrypt-verify"), i18n("Network Analyzer"), this);
+ a->setCheckable(true);
+ actionCollection()->addAction(QL1S("net_analyzer"), a);
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(enableNetworkAnalysis(bool)));
+
+ addDockWidget(Qt::BottomDockWidgetArea, m_analyzerPanel);
+ m_analyzerPanel->hide();
}
@@ -618,6 +644,27 @@ void MainWindow::updateActions()
QAction *historyForwardAction = actionByName(KStandardAction::name(KStandardAction::Forward));
historyForwardAction->setEnabled(currentTab()->view()->history()->canGoForward());
+
+ QAction *openClosedTabsAction = actionByName(QLatin1String("open_closed_tabs"));
+ openClosedTabsAction->setEnabled(mainView()->recentlyClosedTabs().size() > 0);
+
+ // update closed tabs menu
+ KActionMenu *am = dynamic_cast<KActionMenu *>(actionByName(QLatin1String("closed_tab_menu")));
+ if (!am)
+ return;
+
+ am->setEnabled(mainView()->recentlyClosedTabs().size() > 0);
+
+ if (am->menu())
+ am->menu()->clear();
+
+ foreach (HistoryItem item, mainView()->recentlyClosedTabs())
+ {
+ KAction *a = new KAction(Application::icon(item.url), item.title, this);
+ a->setData(item.url);
+ connect(a, SIGNAL(triggered()), m_view, SLOT(openClosedTab()));
+ am->addAction(a);
+ }
}
@@ -1262,3 +1309,10 @@ void MainWindow::populateEncodingMenu()
action->setChecked(true);
}
}
+
+
+void MainWindow::enableNetworkAnalysis(bool b)
+{
+ currentTab()->page()->enableNetworkAnalyzer(b);
+ m_analyzerPanel->toggle(b);
+}