[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenox/konq-embed/src
From: Stefan Eilers <stefan.eilers () basyskom ! de>
Date: 2008-06-05 9:56:18
Message-ID: 1212659778.942788.15651.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 817122 by eilers:
Fixing bug: Manue reloading of images was broken, after pressing the
stop button.
M +61 -19 view.cc
M +5 -2 view.h
--- trunk/kdenox/konq-embed/src/view.cc #817121:817122
@@ -263,7 +263,7 @@
BrowserView::BrowserView( const QString &frameName, QWidget *parentWidget,
const char *widgetName, QObject *parent, const char *name, bool status )
- : View( parent, name ), m_frameName( frameName ), m_pageSecurity( -1 ), \
m_openedByJS(false), m_manualDocLoader( NULL ) + : View( parent, name ), \
m_frameName( frameName ), m_pageSecurity( -1 ), m_openedByJS(false), \
m_manualDocLoader( NULL ), m_manualLoadingInProgress( false ), \
m_manualLoadingWasCanceled( false ) {
m_history.setAutoDelete( true );
@@ -484,9 +484,33 @@
void BrowserView::loadingImages()
{
+ qDebug( "BrowserView::loadingImages()" );
+ if ( m_manualLoadingWasCanceled )
+ {
+ // Reload page when manual loading was interrupted. This is needed
+ // because the cache needs an update..
+ qDebug( "BrowserView::loadingImages(): Image load was interrupted.. Reload right \
now to update cache!!" ); + m_manualLoadingWasCanceled = false;
+ reload();
+
+ // reload needs some time and is asynchronous.. Restart image loading \
attempt when reload was processed. + QTimer::singleShot( 500, this, SLOT( \
loadingImages() ) ); +
+ return;
+ }
+ else
+ {
+ // Wait until reload is finished..
+ if( m_doc->inProgress() )
+ {
+ qDebug( "BrowserView::loadingImages(): Reload in progress.. retry .. " );
+ // reload needs some time and is asynchronous.. Restart image loading attempt \
when reload was processed. + QTimer::singleShot( 500, this, SLOT( loadingImages() \
) ); + return;
+ }
+ }
// Manually load images.
- m_manuallyImagesLoading.clear(); // FIXME:Sure?
-
+ m_manuallyImagesLoading.clear();
m_manualDocLoader = NULL;
// Receive signals when documents starts to load and when it finishes..
@@ -499,10 +523,12 @@
connect( &m_manualImageLoadTimer, SIGNAL( timeout() ),
this, SLOT( slotTimeoutImageLoad() ) );
- // In fact this signal is really useless.. We need it because "slotLoadImages()" \
is private.. + if ( m_stop ) m_stop->setEnabled( true );
+ m_manualLoadingInProgress = true;
+ m_manualImageLoadTimer.start( 0, true ); // Give up if no images were received \
after a short time. +
+ // In fact this signal is really useless.. We need it because \
"KHTML_Part::slotLoadImages()" is private.. // Now load images
- if ( m_stop ) m_stop->setEnabled( true );
- m_manualImageLoadTimer.start( 1000, true ); // Give up if no images were \
received after a short time. emit startLoadingImagesNow();
}
@@ -524,7 +550,6 @@
m_manualImageLoadTimer.stop();
- qDebug( "BrowserView::slotStartImageLoad" );
m_manuallyImagesLoading.append( obj );
}
@@ -536,17 +561,9 @@
// If no images left, stop loading indicator and do some cleanup
if ( m_manuallyImagesLoading.isEmpty() )
{
- // Cleanup
- disconnect( khtml::Cache::loader(), SIGNAL( requestDone( khtml::DocLoader* , \
khtml::CachedObject * ) ),
- this, SLOT( slotImageLoaded( khtml::DocLoader* , khtml::CachedObject * ) ) );
- disconnect( khtml::Cache::loader(), SIGNAL( requestStarted( khtml::DocLoader* dl, \
khtml::CachedObject* obj ) ),
- this, SLOT( slotStartImageLoad( khtml::DocLoader* , khtml::CachedObject * ) ) \
);
- disconnect( this, SIGNAL( startLoadingImagesNow() ),
- this->document(), SLOT( slotLoadImages() ) );
- disconnect( &m_manualImageLoadTimer, SIGNAL( timeout() ),
- this, SLOT( slotTimeoutImageLoad() ) );
-
-
+ disconnectAutoLoadSignals();
+ m_manualLoadingInProgress = false;
+
m_manualDocLoader = NULL;
if ( m_stop ) m_stop->setEnabled( false );
}
@@ -556,6 +573,9 @@
{
qDebug( "BrowserView::slotTimeoutImageLoad()" );
if ( m_stop ) m_stop->setEnabled( false );
+
+ disconnectAutoLoadSignals();
+ m_manualLoadingInProgress = false;
}
void BrowserView::runError()
@@ -566,6 +586,7 @@
void BrowserView::stop()
{
+ qDebug( "BrowserView::stop()" );
if ( m_run )
{
//setLocationBarURL( m_oldLocationBarURL ); Why should we set the old URL \
content, when we stop loading? (se) @@ -576,7 +597,6 @@
delete static_cast<Run *>( m_run );
emit operationCompleted();
-
}
m_doc->closeURL();
@@ -586,6 +606,14 @@
if ( m_history.count() > 0 )
updateHistoryEntry();
+ if ( m_manualLoadingInProgress )
+ {
+ m_manualLoadingInProgress = false;
+ m_manualLoadingWasCanceled = true;
+ qDebug( "BrowserView::stop(): Image load interrupt!!" );
+ }
+
+
}
// Called when the stop action was triggered
@@ -730,6 +758,20 @@
setLocationBarURL( h.m_url.prettyURL() );
}
+void BrowserView::disconnectAutoLoadSignals()
+{
+ // Cleanup
+ disconnect( khtml::Cache::loader(), SIGNAL( requestDone( khtml::DocLoader* , \
khtml::CachedObject * ) ), + this, SLOT( slotImageLoaded( khtml::DocLoader* , \
khtml::CachedObject * ) ) ); + disconnect( khtml::Cache::loader(), SIGNAL( \
requestStarted( khtml::DocLoader*, khtml::CachedObject* ) ), + this, SLOT( \
slotStartImageLoad( khtml::DocLoader* , khtml::CachedObject* ) ) ); + disconnect( \
this, SIGNAL( startLoadingImagesNow() ), + this->document(), SLOT( slotLoadImages() \
) ); + disconnect( &m_manualImageLoadTimer, SIGNAL( timeout() ),
+ this, SLOT( slotTimeoutImageLoad() ) );
+
+}
+
void BrowserView::findClose()
{
setItemVisible( "search_bar", false );
--- trunk/kdenox/konq-embed/src/view.h #817121:817122
@@ -196,8 +196,6 @@
bool openedByJS() { return m_openedByJS; }
void setOpenedByJS(bool opened) { m_openedByJS = opened; }
- void loadingImages();
-
static QStringList childFrameNames( KParts::ReadOnlyPart *part );
static KParts::BrowserHostExtension *hostExtension( KParts::ReadOnlyPart *part, \
const QString &name ); @@ -211,6 +209,8 @@
static int zoomFactor;
public slots:
+ void loadingImages();
+
virtual void openURL( const KURL &url, const KParts::URLArgs &args = \
KParts::URLArgs() );
virtual void zoomTo( int zoomValue );
@@ -262,6 +262,7 @@
void createHistoryEntry();
void updateHistoryEntry();
void goHistory( int steps );
+ void disconnectAutoLoadSignals();
struct HistoryEntry
{
@@ -292,6 +293,8 @@
QValueList<khtml::CachedObject*> m_manuallyImagesLoading;
khtml::DocLoader* m_manualDocLoader;
QTimer m_manualImageLoadTimer;
+ bool m_manualLoadingInProgress;
+ bool m_manualLoadingWasCanceled;
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic