summaryrefslogtreecommitdiff
path: root/src/webinspectorpanel.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-05-21 00:03:32 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-05-21 00:03:32 +0200
commit9da41bf9224e233bba49149a2cb9db11c460d7f8 (patch)
tree0b0a010157bc32f1f305af863fdabbc15ba24c30 /src/webinspectorpanel.cpp
parentreenabled lost close confirm dialog (diff)
downloadrekonq-9da41bf9224e233bba49149a2cb9db11c460d7f8.tar.xz
Fix developers panel handling
BUG:236319
Diffstat (limited to 'src/webinspectorpanel.cpp')
-rw-r--r--src/webinspectorpanel.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/webinspectorpanel.cpp b/src/webinspectorpanel.cpp
index 31833ea9..3d1a5a1e 100644
--- a/src/webinspectorpanel.cpp
+++ b/src/webinspectorpanel.cpp
@@ -42,9 +42,9 @@
WebInspectorPanel::WebInspectorPanel(QString title, QWidget *parent)
: QDockWidget(title, parent)
+ , _inspector(0)
{
setObjectName("webInspectorDock");
- setWidget(new QWebInspector(this));
}
@@ -55,31 +55,34 @@ void WebInspectorPanel::closeEvent(QCloseEvent *event)
}
-MainWindow* WebInspectorPanel::mainWindow()
-{
- return qobject_cast< MainWindow* >(parentWidget());
-}
-
-
void WebInspectorPanel::toggle(bool enable)
{
- mainWindow()->actionByName("web_inspector")->setChecked(enable);
+ MainWindow *w = qobject_cast<MainWindow *>(parent());
+ w->actionByName( QL1S("web_inspector") )->setChecked(enable);
if (enable)
{
- mainWindow()->currentTab()->view()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
- findChild<QWebInspector *>()->setPage(mainWindow()->currentTab()->page());
+ w->currentTab()->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
+ if(!_inspector)
+ {
+ _inspector = new QWebInspector(this);
+ _inspector->setPage( w->currentTab()->page() );
+ setWidget(_inspector);
+ }
show();
}
else
{
+ w->currentTab()->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false);
+ delete _inspector;
+ _inspector = 0;
hide();
- mainWindow()->currentTab()->view()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false);
}
}
void WebInspectorPanel::changeCurrentPage()
{
- bool enable = mainWindow()->currentTab()->view()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled);
+ MainWindow *w = qobject_cast<MainWindow *>(parent());
+ bool enable = w->currentTab()->page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled);
toggle(enable);
}