[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/base/konq-plugins/domtreeviewer
From:       Harri Porten <porten () kde ! org>
Date:       2008-11-17 21:32:51
Message-ID: 1226957571.055368.10064.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 885774 by porten:

Avoid running into a DOM exception. Trying to set a CSS rule
does not make sense without a document. 


 M  +19 -1     domtreeview.cpp  
 M  +1 -0      domtreeview.h  


--- trunk/extragear/base/konq-plugins/domtreeviewer/domtreeview.cpp #885773:885774
@@ -857,6 +857,24 @@
 	  SLOT(activateNode(const DOM::Node &)));
     connect(part, SIGNAL(completed()), this, SLOT(refresh()));
 
+    if (!part->document().isNull()) {
+      connectToDocument();
+    } else {
+      // TODO: regularly poll for a document? wait for a signal?
+    }
+  } else {
+    slotShowTree(DOM::Node());
+  }
+
+  updateIncrDecreaseButton();
+}
+
+void DOMTreeView::connectToDocument()
+{
+  assert(part);
+  assert(!part->document().isNull());
+
+  {
     // insert a style rule to indicate activated nodes
     try {
 kDebug(90180) << "(1) part.document: " << part->document().handle();
@@ -877,7 +895,7 @@
     }
   }
 
-  slotShowTree(part ? (DOM::Node)part->document() : DOM::Node());
+  slotShowTree(part->document());
   updateIncrDecreaseButton();
 }
 
--- trunk/extragear/base/konq-plugins/domtreeviewer/domtreeview.h #885773:885774
@@ -122,6 +122,7 @@
 	bool m_bPure, m_bShowAttributes, m_bHighlightHTML;
 
     private:
+	void connectToDocument();
 	void showRecursive(const DOM::Node &pNode, const DOM::Node &node,
 			   uint depth);
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic