Distinguish between settings and explicit override for external content

Summary:
This will allow KMail to properly communicate the difference also when
using per-folder settings for loading external references. This in turn
makes 746e02af07 also work in that case.

Taken from KDE patches and adapted to TDE.
See https://phabricator.kde.org/D12393 and https://phabricator.kde.org/D12394

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/70/head
Slávek Banko 2 years ago
parent 746e02af07
commit c8e1b254e2
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -1386,7 +1386,7 @@ void KMMainWidget::slotOverrideHtmlLoadExt()
} }
mFolderHtmlLoadExtPref = !mFolderHtmlLoadExtPref; mFolderHtmlLoadExtPref = !mFolderHtmlLoadExtPref;
if (mMsgView) { if (mMsgView) {
mMsgView->setHtmlLoadExtOverride(mFolderHtmlLoadExtPref); mMsgView->setHtmlLoadExtDefault(mFolderHtmlLoadExtPref);
mMsgView->update( true ); mMsgView->update( true );
} }
} }
@ -2084,7 +2084,7 @@ void KMMainWidget::folderSelected( KMFolder* aFolder, bool forceJumpToUnread )
if (mMsgView) if (mMsgView)
{ {
mMsgView->setHtmlOverride(mFolderHtmlPref); mMsgView->setHtmlOverride(mFolderHtmlPref);
mMsgView->setHtmlLoadExtOverride(mFolderHtmlLoadExtPref); mMsgView->setHtmlLoadExtDefault(mFolderHtmlLoadExtPref);
} }
mHeaders->setFolder( mFolder, forceJumpToUnread ); mHeaders->setFolder( mFolder, forceJumpToUnread );
updateMessageActions(); updateMessageActions();
@ -2140,7 +2140,8 @@ void KMMainWidget::slotMsgSelected(KMMessage *msg)
} }
// reset HTML override to the folder setting // reset HTML override to the folder setting
mMsgView->setHtmlOverride(mFolderHtmlPref); mMsgView->setHtmlOverride(mFolderHtmlPref);
mMsgView->setHtmlLoadExtOverride(mFolderHtmlLoadExtPref); mMsgView->setHtmlLoadExtDefault(mFolderHtmlLoadExtPref);
mMsgView->setHtmlLoadExtOverride(false);
mMsgView->setDecryptMessageOverwrite( false ); mMsgView->setDecryptMessageOverwrite( false );
mMsgView->setShowSignatureDetails( false ); mMsgView->setShowSignatureDetails( false );
} }

@ -50,7 +50,7 @@
#include "kmreadermainwin.h" #include "kmreadermainwin.h"
KMReaderMainWin::KMReaderMainWin( bool htmlOverride, bool htmlLoadExtOverride, KMReaderMainWin::KMReaderMainWin( bool htmlOverride, bool htmlLoadExtDefault,
char *name ) char *name )
: KMail::SecondaryWindow( name ? name : "readerwindow#" ), : KMail::SecondaryWindow( name ? name : "readerwindow#" ),
mMsg( 0 ) mMsg( 0 )
@ -59,7 +59,7 @@ KMReaderMainWin::KMReaderMainWin( bool htmlOverride, bool htmlLoadExtOverride,
//mReaderWin->setShowCompleteMessage( true ); //mReaderWin->setShowCompleteMessage( true );
mReaderWin->setAutoDelete( true ); mReaderWin->setAutoDelete( true );
mReaderWin->setHtmlOverride( htmlOverride ); mReaderWin->setHtmlOverride( htmlOverride );
mReaderWin->setHtmlLoadExtOverride( htmlLoadExtOverride ); mReaderWin->setHtmlLoadExtDefault( htmlLoadExtDefault );
mReaderWin->setDecryptMessageOverwrite( true ); mReaderWin->setDecryptMessageOverwrite( true );
mReaderWin->setShowSignatureDetails( false ); mReaderWin->setShowSignatureDetails( false );
initKMReaderMainWin(); initKMReaderMainWin();

@ -26,7 +26,7 @@ class KMReaderMainWin : public KMail::SecondaryWindow
public: public:
KMReaderMainWin( bool htmlOverride, bool htmlLoadExtOverride, char *name = 0 ); KMReaderMainWin( bool htmlOverride, bool htmlLoadExtDefault, char *name = 0 );
KMReaderMainWin( char *name = 0 ); KMReaderMainWin( char *name = 0 );
KMReaderMainWin(KMMessagePart* aMsgPart, KMReaderMainWin(KMMessagePart* aMsgPart,
bool aHTML, const TQString& aFileName, const TQString& pname, bool aHTML, const TQString& aFileName, const TQString& pname,

@ -464,6 +464,7 @@ KMReaderWin::KMReaderWin(TQWidget *aParent,
readConfig(); readConfig();
mHtmlOverride = false; mHtmlOverride = false;
mHtmlLoadExtDefault = false;
mHtmlLoadExtOverride = false; mHtmlLoadExtOverride = false;
mLevelQuote = GlobalSettings::self()->collapseQuoteLevelSpin() - 1; mLevelQuote = GlobalSettings::self()->collapseQuoteLevelSpin() - 1;
@ -902,7 +903,6 @@ void KMReaderWin::readConfig(void)
mToggleFixFontAction->setChecked( mUseFixedFont ); mToggleFixFontAction->setChecked( mUseFixedFont );
mHtmlMail = reader.readBoolEntry( "htmlMail", false ); mHtmlMail = reader.readBoolEntry( "htmlMail", false );
mHtmlLoadExternal = reader.readBoolEntry( "htmlLoadExternal", false );
setHeaderStyleAndStrategy( HeaderStyle::create( reader.readEntry( "header-style", "fancy" ) ), setHeaderStyleAndStrategy( HeaderStyle::create( reader.readEntry( "header-style", "fancy" ) ),
HeaderStrategy::create( reader.readEntry( "header-set-displayed", "rich" ) ) ); HeaderStrategy::create( reader.readEntry( "header-set-displayed", "rich" ) ) );
@ -2496,11 +2496,14 @@ void KMReaderWin::setHtmlOverride(bool override)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void KMReaderWin::setHtmlLoadExtOverride(bool override) void KMReaderWin::setHtmlLoadExtDefault(bool loadExtDefault)
{ {
mHtmlLoadExtOverride = override; mHtmlLoadExtDefault = loadExtDefault;
//if (message()) }
// message()->setDecodeHTML(htmlMail());
void KMReaderWin::setHtmlLoadExtOverride(bool loadExtOverride)
{
mHtmlLoadExtOverride = loadExtOverride;
} }
@ -2525,8 +2528,8 @@ bool KMReaderWin::htmlLoadExternal()
return mHtmlLoadExtOverride; return mHtmlLoadExtOverride;
} }
return ((mHtmlLoadExternal && !mHtmlLoadExtOverride) || return ((mHtmlLoadExtDefault && !mHtmlLoadExtOverride) ||
(!mHtmlLoadExternal && mHtmlLoadExtOverride)); (!mHtmlLoadExtDefault && mHtmlLoadExtOverride));
} }

@ -199,9 +199,22 @@ public:
bool htmlOverride() const { return mHtmlOverride; } bool htmlOverride() const { return mHtmlOverride; }
void setHtmlOverride( bool override ); void setHtmlOverride( bool override );
/** Override default load external references setting */ /** Get the load external references override setting */
bool htmlLoadExtOverride() const { return mHtmlLoadExtOverride; } bool htmlLoadExtOverride() const { return mHtmlLoadExtOverride; }
void setHtmlLoadExtOverride( bool override );
/** Default behavior for loading external references.
* Use this for specifying the external reference loading behavior as
* specified in the user settings.
* @see setHtmlLoadExtOverride
*/
void setHtmlLoadExtDefault(bool loadExtDefault);
/** Override default load external references setting
* @warning This must only be called when the user has explicitly
* been asked to retrieve external references!
* @see setHtmlLoadExtDefault
*/
void setHtmlLoadExtOverride(bool loadExtOverride);
/** Is html mail to be supported? Takes into account override */ /** Is html mail to be supported? Takes into account override */
bool htmlMail(); bool htmlMail();
@ -544,7 +557,7 @@ private:
TQString renderAttachments( partNode *node, const TQColor &bgColor ); TQString renderAttachments( partNode *node, const TQColor &bgColor );
private: private:
bool mHtmlMail, mHtmlLoadExternal, mHtmlOverride, mHtmlLoadExtOverride; bool mHtmlMail, mHtmlLoadExtDefault, mHtmlOverride, mHtmlLoadExtOverride;
int mAtmCurrent; int mAtmCurrent;
TQString mAtmCurrentName; TQString mAtmCurrentName;
KMMessage *mMessage; KMMessage *mMessage;

Loading…
Cancel
Save