summaryrefslogtreecommitdiff
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
parentreenabled lost close confirm dialog (diff)
downloadrekonq-9da41bf9224e233bba49149a2cb9db11c460d7f8.tar.xz
Fix developers panel handling
BUG:236319
-rw-r--r--src/analyzer/analyzerpanel.cpp8
-rw-r--r--src/webinspectorpanel.cpp27
-rw-r--r--src/webinspectorpanel.h9
3 files changed, 23 insertions, 21 deletions
diff --git a/src/analyzer/analyzerpanel.cpp b/src/analyzer/analyzerpanel.cpp
index be346300..9198cade 100644
--- a/src/analyzer/analyzerpanel.cpp
+++ b/src/analyzer/analyzerpanel.cpp
@@ -79,10 +79,7 @@ void NetworkAnalyzerPanel::toggle(bool enable)
connect(manager, SIGNAL(networkData(QNetworkAccessManager::Operation, const QNetworkRequest &, QNetworkReply *)),
_viewer, SLOT(addRequest(QNetworkAccessManager::Operation, const QNetworkRequest &, QNetworkReply *) ) );
-
-// mainWindow()->currentTab()->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
-// findChild<QWebInspector *>()->setPage(mainWindow()->currentTab()->page());
- show();
+ show();
}
else
{
@@ -91,13 +88,12 @@ void NetworkAnalyzerPanel::toggle(bool enable)
_viewer, SLOT(addRequest(QNetworkAccessManager::Operation, const QNetworkRequest &, QNetworkReply *) ) );
hide();
-// mainWindow()->currentTab()->view()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false);
}
}
void NetworkAnalyzerPanel::changeCurrentPage()
{
- bool enable = mainWindow()->currentTab()->view()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled);
+ bool enable = mainWindow()->currentTab()->page()->hasNetworkAnalyzerEnabled();
toggle(enable);
}
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);
}
diff --git a/src/webinspectorpanel.h b/src/webinspectorpanel.h
index 8b1e3507..1f0ea06b 100644
--- a/src/webinspectorpanel.h
+++ b/src/webinspectorpanel.h
@@ -35,7 +35,11 @@
#include "mainwindow.h"
// Qt Includes
-#include <QDockWidget>
+#include <QtGui/QDockWidget>
+
+// Forward
+class QWebInspector;
+
/**
Docked web inspector
@@ -54,8 +58,7 @@ public slots:
protected:
virtual void closeEvent(QCloseEvent *event);
- MainWindow *mainWindow();
-
+ QWebInspector *_inspector;
};
#endif