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

List:       kfm-devel
Subject:    Re: Is someone working on #41620 ?
From:       David Faure <david () mandrakesoft ! com>
Date:       2002-07-19 17:22:02
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 19 July 2002 13:00, Germain Garand wrote:
> Le Jeudi 18 Juillet 2002 15:33, David Faure a écrit :
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Please test this patch with as many combinations as possible:
> >
> 
> Hi David,
> I've got two more observations since yesterday :
> 
> 1) bool KHTMLPart::processObjectRequest() should be in sync with this change, 
> since that's what is used to create parts in frames (see BR#43393)
> (same "if" test on mimetype at khtml_part.cpp -l.2664)

One can't ask for another viewer than the preferred one, in khtml.
Ah, but if the current viewer handles the new mimetype but isn't preferred.... I see.
Ok, please test attached patch.

> 2) What about the case where the new mimetype is different, but the preferred 
> part for the new mimetype finally proves to be the same as the current one ?
> e.g: you display a "text/plain" file, then a "text/css" file... 
> 
> /me think konqueror should then reuse the current view, instead of creating a 
> new one of the same kind ?

You are very right!
Please test attached patch for konq_view too ;) 
(I'm busy with so many other things right now....)

Ah, a similar test for KHTML is missing. A bit harder. I think we need to pass
the current serviceName to createPart so that it skips creating a new part if
the old one is of the same service. Hmm, to be checked.

- -- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
On holidays from 20/07 to 24/07
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9OEq672KcVAmwbhARAi/6AJ9A7rxi1KxP64abRmtYhjxD6oe2jwCglHeg
5jbzBqE7v8p9LjZR9nwXFx8=
=7BJ7
-----END PGP SIGNATURE-----

["konq_view.cc.diff" (text/x-diff)]

Index: konq_view.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_view.cc,v
retrieving revision 1.305
diff -u -p -r1.305 konq_view.cc
--- konq_view.cc	2002/07/05 23:24:04	1.305
+++ konq_view.cc	2002/07/19 16:55:32
@@ -254,7 +254,7 @@ bool KonqView::changeViewMode( const QSt
                 << " serviceName is " << serviceName
                 << " current service name is " << m_service->desktopEntryName() << \
endl;  
-  if ( !m_service->serviceTypes().contains( serviceType ) ||
+  if ( m_serviceType != serviceType ||
        ( !serviceName.isEmpty() && serviceName != m_service->desktopEntryName() ) )
   {
 
@@ -276,13 +276,24 @@ bool KonqView::changeViewMode( const QSt
         setLocationBarURL( history().current()->locationBarURL );
       return false;
     }
-
-    m_service = service;
+    m_serviceType = serviceType;
     m_partServiceOffers = partServiceOffers;
     m_appServiceOffers = appServiceOffers;
-    m_serviceType = serviceType;
 
-    switchView( viewFactory );
+    // Check if that's already the kind of part we have -> no need to recreate it
+    // Note: we should have an operator= for KService...
+    if ( m_service && m_service->desktopEntryPath() == service->desktopEntryPath() )
+    {
+      kdDebug( 1202 ) << "KonqView::changeViewMode. Reusing service. Service type \
set to " << m_serviceType << endl; +      if (  m_pMainWindow->currentView() == this \
) +          m_pMainWindow->updateViewModeActions();
+    }
+    else
+    {
+      m_service = service;
+
+      switchView( viewFactory );
+    }
 
     // Make the new part active. Note that we don't do it each time we
     // open a URL (becomes awful in view-follows-view mode), but we do
@@ -291,15 +302,6 @@ bool KonqView::changeViewMode( const QSt
     // where the location bar url isn't set yet.
     kdDebug(1202) << "Giving focus to new part " << m_pPart << endl;
     m_pMainWindow->viewManager()->setActivePart( m_pPart );
-  }
-  else if ( m_serviceType != serviceType )
-  {
-      m_serviceType = serviceType;
-      kdDebug(1202) << "KonqView::changeViewMode service type set to " << \
                m_serviceType << endl;
-      // Re-query the trader
-      KonqFactory::getOffers( m_serviceType, &m_partServiceOffers, \
                &m_appServiceOffers );
-      if ( m_pMainWindow->currentView() == this )
-          m_pMainWindow->updateViewModeActions();
   }
   return true;
 }


["khtml_part.cpp.diff" (text/x-diff)]

Index: khtml_part.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtml_part.cpp,v
retrieving revision 1.714
diff -u -p -r1.714 khtml_part.cpp
--- khtml_part.cpp	2002/07/12 21:11:35	1.714
+++ khtml_part.cpp	2002/07/19 17:21:52
@@ -2661,8 +2661,9 @@ bool KHTMLPart::processObjectRequest( kh
           emit d->m_extension->openURLNotify();
   }
 
-  if ( !child->m_services.contains( mimetype ) )
+  if ( child->m_serviceType != mimetype )
   {
+    // TODO: remove child->m_services, it's now unused
     KParts::ReadOnlyPart *part = createPart( d->m_view->viewport(), \
child->m_name.ascii(), this, child->m_name.ascii(), mimetype, child->m_serviceName, \
child->m_services, child->m_params );  
     if ( !part )



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

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