[patch] fix for window.open(url, frame)

Koos Vriezen koos.vriezen at xs4all.nl
Sat Sep 4 11:44:37 BST 2004


Hi,

As shown in the tread 'replacing the textarea widget', the frame access
changes broke window.open(url,frame). Tried it with the 3.3 branch, same
result (likely 3.2 is affected as well).
The problem is that KHTMLPart::findFrameParent is called with a null
callingPart. This is done from KonqMainWindow::slotCreateNewWindow. The
patch is to get the callingPart back from the sender() call. See patch.
Though the comments are a bit confusing and might point to somewhere else
to solve. At KonqMainWindow::slotCreateNewWindow it says that
 // Found a view. If url isn't empty, we should open it - but this never
 // happens currently
and at KJS::Window::openWindow it states:
 // request window (new or existing if framename is set)
but acts only like the new part is a new window.

Koos

-------------- next part --------------
Index: konq_mainwindow.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.cc,v
retrieving revision 1.1348
diff -u -3 -p -r1.1348 konq_mainwindow.cc
--- konq_mainwindow.cc	24 Aug 2004 23:28:12 -0000	1.1348
+++ konq_mainwindow.cc	4 Sep 2004 10:42:59 -0000
@@ -1062,7 +1062,11 @@ void KonqMainWindow::slotCreateNewWindow
     if ( !args.frameName.isEmpty() && args.frameName.lower() != "_blank" )
     {
         KParts::BrowserHostExtension *hostExtension = 0;
-        if ( findChildView( 0, args.frameName, &mainWindow, &hostExtension, &part ) )
+        KParts::ReadOnlyPart *ro_part = 0L;
+        KParts::BrowserExtension *be = ::qt_cast<KParts::BrowserExtension *>(sender());
+        if (be)
+            ro_part = ::qt_cast<KParts::ReadOnlyPart *>(be->parent());
+        if ( findChildView( ro_part, args.frameName, &mainWindow, &hostExtension, &part ) )
         {
             // Found a view. If url isn't empty, we should open it - but this never happens currently
             // findChildView put the resulting part in 'part', so we can just return now


More information about the kfm-devel mailing list