Index: konqueror/konq_mainwindow.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.cc,v
retrieving revision 1.973.2.2
diff -u -p -r1.973.2.2 konq_mainwindow.cc
--- konqueror/konq_mainwindow.cc 9 Dec 2002 18:39:52 -0000 1.973.2.2
+++ konqueror/konq_mainwindow.cc 4 Aug 2004 21:35:05 -0000
@@ -629,6 +629,7 @@ void KonqMainWindow::slotOpenURLRequest(
{
kdDebug(1202) << "KonqMainWindow::slotOpenURLRequest frameName=" << args.frameName << endl;
+ KParts::ReadOnlyPart *callingPart = static_cast<KParts::ReadOnlyPart *>( sender()->parent() );
QString frameName = args.frameName;
if ( !frameName.isEmpty() )
@@ -649,11 +650,11 @@ void KonqMainWindow::slotOpenURLRequest(
frameName != _parent )
{
KParts::BrowserHostExtension *hostExtension = 0;
- KonqView *view = childView( frameName, &hostExtension );
+ KonqView *view = childView( callingPart, frameName, &hostExtension, 0 );
if ( !view )
{
KonqMainWindow *mainWindow = 0;
- view = findChildView( frameName, &mainWindow, &hostExtension );
+ view = findChildView( callingPart, frameName, &mainWindow, &hostExtension, 0 );
if ( !view || !mainWindow )
{
@@ -676,8 +677,7 @@ void KonqMainWindow::slotOpenURLRequest(
}
}
- KParts::ReadOnlyPart *part = static_cast<KParts::ReadOnlyPart *>( sender()->parent() );
- KonqView *view = childView( part );
+ KonqView *view = childView( callingPart );
openURL( view, url, args );
}
@@ -775,16 +775,14 @@ void KonqMainWindow::slotCreateNewWindow
<< " args.frameName=" << args.frameName << endl;
KonqMainWindow *mainWindow = 0L;
- KonqView * view = 0L;
if ( !args.frameName.isEmpty() && args.frameName != "_blank" )
{
KParts::BrowserHostExtension *hostExtension = 0;
- view = findChildView( args.frameName, &mainWindow, &hostExtension );
- kdDebug() << " frame=" << args.frameName << " -> found view=" << view << endl;
- if ( view )
+ if ( findChildView( 0, args.frameName, &mainWindow, &hostExtension, &part ) )
{
// Found a view. If url isn't empty, we should open it - but this never happens currently
- part = view->part();
+ // findChildView put the resulting part in 'part', so we can just return now
+ //kdDebug() << " frame=" << args.frameName << " -> found part=" << part << " " << part->name() << endl;
return;
}
}
@@ -806,6 +804,7 @@ void KonqMainWindow::slotCreateNewWindow
return;
}
+ KonqView * view = 0L;
// cannot use activePart/currentView, because the activation through the partmanager
// is delayed by a singleshot timer (see KonqViewManager::setActivePart)
if ( mainWindow->viewMap().count() )
@@ -1728,36 +1727,61 @@ KonqView * KonqMainWindow::childView( KP
return 0L;
}
-KonqView * KonqMainWindow::childView( const QString &name, KParts::BrowserHostExtension **hostExtension )
+KonqView * KonqMainWindow::childView( KParts::ReadOnlyPart *callingPart, const QString &name, KParts::BrowserHostExtension **hostExtension, KParts::ReadOnlyPart **part )
{
- //kdDebug() << "KonqMainWindow::childView this=" << this << " looking for " << name << endl;
+ kdDebug() << "KonqMainWindow::childView this=" << this << " looking for " << name << endl;
MapViews::ConstIterator it = m_mapViews.begin();
MapViews::ConstIterator end = m_mapViews.end();
for (; it != end; ++it )
{
- QString viewName = it.data()->viewName();
- //kdDebug() << " - viewName=" << viewName << " "
- // << "frame names:" << it.data()->frameNames().join( "," ) << endl;
+ KonqView* view = it.data();
+ QString viewName = view->viewName();
+ kdDebug() << " - viewName=" << viewName << " "
+ << "frame names:" << view->frameNames().join( "," ) << endl;
if ( !viewName.isEmpty() && viewName == name )
{
+ kdDebug() << "found existing view by name: " << view << endl;
if ( hostExtension )
*hostExtension = 0;
- return it.data();
+ if ( part )
+ *part = view->part();
+ return view;
}
- if ( it.data()->frameNames().contains( name ) )
+ // First look for a hostextension containing this frame name
+ KParts::BrowserHostExtension *ext = KParts::BrowserHostExtension::childObject( view->part() );
+ if ( ext )
{
- if ( hostExtension )
- *hostExtension = KonqView::hostExtension( it.data()->part(), name );
- return it.data();
+ ext = ext->findFrameParent(callingPart, name);
+ }
+
+// KParts::BrowserHostExtension* ext = KonqView::hostExtension( view->part(), name );
+
+ if ( ext )
+ {
+ QPtrList<KParts::ReadOnlyPart> frames = ext->frames();
+ QPtrListIterator<KParts::ReadOnlyPart> frameIt( frames );
+ for ( ; frameIt.current() ; ++frameIt )
+ {
+ if ( frameIt.current()->name() == name )
+ {
+ kdDebug() << "found a frame of name " << name << " : " << frameIt.current() << endl;
+ if ( hostExtension )
+ *hostExtension = ext;
+ if ( part )
+ *part = frameIt.current();
+ return view;
+ }
+ }
}
}
return 0;
}
-KonqView * KonqMainWindow::findChildView( const QString &name, KonqMainWindow **mainWindow, KParts::BrowserHostExtension **hostExtension )
+// static
+KonqView * KonqMainWindow::findChildView( KParts::ReadOnlyPart *callingPart, const QString &name, KonqMainWindow **mainWindow, KParts::BrowserHostExtension **hostExtension, KParts::ReadOnlyPart **part )
{
if ( !s_lstViews )
return 0;
@@ -1765,7 +1789,7 @@ KonqView * KonqMainWindow::findChildView
QPtrListIterator<KonqMainWindow> it( *s_lstViews );
for (; it.current(); ++it )
{
- KonqView *res = it.current()->childView( name, hostExtension );
+ KonqView *res = it.current()->childView( callingPart, name, hostExtension, part );
if ( res )
{
if ( mainWindow )
Index: konqueror/konq_mainwindow.h
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.h,v
retrieving revision 1.349.2.1
diff -u -p -r1.349.2.1 konq_mainwindow.h
--- konqueror/konq_mainwindow.h 4 Sep 2002 09:22:21 -0000 1.349.2.1
+++ konqueror/konq_mainwindow.h 4 Aug 2004 21:35:05 -0000
@@ -132,10 +132,10 @@ public:
void insertChildView( KonqView *childView );
void removeChildView( KonqView *childView );
KonqView *childView( KParts::ReadOnlyPart *view );
- KonqView *childView( const QString &name, KParts::BrowserHostExtension **hostExtension );
+ KonqView *childView( KParts::ReadOnlyPart *callingPart, const QString &name, KParts::BrowserHostExtension **hostExtension, KParts::ReadOnlyPart **part );
// dcop idl bug! it can't handle KonqMainWindow *&mainWindow
- static KonqView *findChildView( const QString &name, KonqMainWindow **mainWindow, KParts::BrowserHostExtension **hostExtension );
+ static KonqView *findChildView( KParts::ReadOnlyPart *callingPart, const QString &name, KonqMainWindow **mainWindow, KParts::BrowserHostExtension **hostExtension, KParts::ReadOnlyPart **part );
// Total number of views
int viewCount() const { return m_mapViews.count(); }