Skip to content
Permalink
Browse files

[composer] Fix refresh HTML item always using cached copy (fix #11747)

  • Loading branch information
nyalldawson committed Nov 27, 2014
1 parent 3c0d233 commit 9c8b44a5bdb23dca80ee4686f00cff2e2ef15cee
@@ -183,10 +183,12 @@ class QgsComposerHtml: QgsComposerMultiFrame
public slots:

/**Reloads the html source from the url and redraws the item.
* @param useCache set to true to use a cached copy of remote html
* content
* @see setUrl
* @see url
*/
void loadHtml();
void loadHtml( const bool useCache = false );

/**Recalculates the frame sizes for the current viewport dimensions*/
void recalculateFrameSizes();
@@ -120,7 +120,7 @@ void QgsComposerHtml::setUrl( const QUrl& url )
}

mUrl = url;
loadHtml();
loadHtml( true );
emit changed();
}

@@ -136,11 +136,11 @@ void QgsComposerHtml::setHtml( const QString html )
void QgsComposerHtml::setEvaluateExpressions( bool evaluateExpressions )
{
mEvaluateExpressions = evaluateExpressions;
loadHtml();
loadHtml( true );
emit changed();
}

void QgsComposerHtml::loadHtml()
void QgsComposerHtml::loadHtml( const bool useCache )
{
if ( !mWebPage )
{
@@ -166,7 +166,7 @@ void QgsComposerHtml::loadHtml()
{
return;
}
if ( currentUrl != mLastFetchedUrl )
if ( !( useCache && currentUrl == mLastFetchedUrl ) )
{
loadedHtml = fetchHtml( QUrl( currentUrl ) );
mLastFetchedUrl = currentUrl;
@@ -459,7 +459,7 @@ void QgsComposerHtml::setUserStylesheetEnabled( const bool stylesheetEnabled )
if ( mEnableUserStylesheet != stylesheetEnabled )
{
mEnableUserStylesheet = stylesheetEnabled;
loadHtml();
loadHtml( true );
emit changed();
}
}
@@ -518,7 +518,7 @@ bool QgsComposerHtml::readXML( const QDomElement& itemElem, const QDomDocument&
{
mUrl = urlString;
}
loadHtml();
loadHtml( true );

//since frames had to be created before, we need to emit a changed signal to refresh the widget
emit changed();
@@ -562,15 +562,15 @@ void QgsComposerHtml::refreshExpressionContext()
}

setExpressionContext( feature, vl );
loadHtml();
loadHtml( true );
}

void QgsComposerHtml::refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property )
{
//updates data defined properties and redraws item to match
if ( property == QgsComposerObject::SourceUrl || property == QgsComposerObject::AllProperties )
{
loadHtml();
loadHtml( true );
}
QgsComposerObject::refreshDataDefinedProperty( property );
}
@@ -211,10 +211,12 @@ class CORE_EXPORT QgsComposerHtml: public QgsComposerMultiFrame
public slots:

/**Reloads the html source from the url and redraws the item.
* @param useCache set to true to use a cached copy of remote html
* content
* @see setUrl
* @see url
*/
void loadHtml();
void loadHtml( const bool useCache = false );

/**Recalculates the frame sizes for the current viewport dimensions*/
void recalculateFrameSizes();

0 comments on commit 9c8b44a

Please sign in to comment.
You can’t perform that action at this time.