patch: khtmlimage

Simon Hausmann hausmann at kde.org
Mon Jan 5 20:01:40 GMT 2004


Hi,

Currently when viewing an image with khtmlimage and changing for example the 
active tab (or frame) and then switching back the pretty image caption ('Blah 
Type Image - 123x456 Pixels') is lost. The attached patch fixes this bug.

Ideally I'd rather like to get rid of the current 
ReadOnlyPart::guiActivateEvent implementation (as nowadays konq 
saves/restores the caption properly) , but I'm not sure if changing that 
behaviour is a good thing to do so late, so this patch kind of works around 
this base implementation by simply not calling it in the particular case 
(which apparently doesn't hurt as KHTMLPart doesn't do it either :)

Please review.

Simon
-------------- next part --------------
Index: khtmlimage.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtmlimage.cpp,v
retrieving revision 1.37
diff -u -p -b -r1.37 khtmlimage.cpp
--- khtmlimage.cpp	21 Dec 2003 17:37:50 -0000	1.37
+++ khtmlimage.cpp	5 Jan 2004 19:55:46 -0000
@@ -157,8 +157,12 @@ bool KHTMLImage::closeURL()
 
 void KHTMLImage::guiActivateEvent( KParts::GUIActivateEvent *e )
 {
+    // prevent the base implementation from emitting setWindowCaption with
+    // our url. It destroys our pretty, previously caption. Konq saves/restores
+    // the caption for us anyway.
     if ( e->activated() )
-        emit setWindowCaption( m_url.prettyURL() );
+        return;
+    KParts::ReadOnlyPart::guiActivateEvent(e);
 }
 
 void KHTMLImage::slotImageJobFinished( KIO::Job *job )


More information about the kfm-devel mailing list