summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2022-10-09 20:33:10 +0200
committerSlávek Banko <slavek.banko@axis.cz>2022-10-14 09:55:48 +0200
commit2128c14fb2cfce9512f957fe2475c1ef196156a4 (patch)
treeb5b3312c31df12d02523844b8cd1eaeac70d7a12
parentb1ef270c6158415d61fd95190281c1a498b2b4ec (diff)
downloadtdepim-2128c14fb2cfce9512f957fe2475c1ef196156a4.tar.gz
tdepim-2128c14fb2cfce9512f957fe2475c1ef196156a4.zip
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 746e02af07f7dc223940ad80a0a234c0aff85850 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> (cherry picked from commit c8e1b254e243af4368f5430d8478f7a3a66d1fc6)
-rw-r--r--kmail/kmmainwidget.cpp7
-rw-r--r--kmail/kmreadermainwin.cpp4
-rw-r--r--kmail/kmreadermainwin.h2
-rw-r--r--kmail/kmreaderwin.cpp17
-rw-r--r--kmail/kmreaderwin.h19
5 files changed, 33 insertions, 16 deletions
diff --git a/kmail/kmmainwidget.cpp b/kmail/kmmainwidget.cpp
index 8f883c58d..c868c5824 100644
--- a/kmail/kmmainwidget.cpp
+++ b/kmail/kmmainwidget.cpp
@@ -1386,7 +1386,7 @@ void KMMainWidget::slotOverrideHtmlLoadExt()
}
mFolderHtmlLoadExtPref = !mFolderHtmlLoadExtPref;
if (mMsgView) {
- mMsgView->setHtmlLoadExtOverride(mFolderHtmlLoadExtPref);
+ mMsgView->setHtmlLoadExtDefault(mFolderHtmlLoadExtPref);
mMsgView->update( true );
}
}
@@ -2084,7 +2084,7 @@ void KMMainWidget::folderSelected( KMFolder* aFolder, bool forceJumpToUnread )
if (mMsgView)
{
mMsgView->setHtmlOverride(mFolderHtmlPref);
- mMsgView->setHtmlLoadExtOverride(mFolderHtmlLoadExtPref);
+ mMsgView->setHtmlLoadExtDefault(mFolderHtmlLoadExtPref);
}
mHeaders->setFolder( mFolder, forceJumpToUnread );
updateMessageActions();
@@ -2140,7 +2140,8 @@ void KMMainWidget::slotMsgSelected(KMMessage *msg)
}
// reset HTML override to the folder setting
mMsgView->setHtmlOverride(mFolderHtmlPref);
- mMsgView->setHtmlLoadExtOverride(mFolderHtmlLoadExtPref);
+ mMsgView->setHtmlLoadExtDefault(mFolderHtmlLoadExtPref);
+ mMsgView->setHtmlLoadExtOverride(false);
mMsgView->setDecryptMessageOverwrite( false );
mMsgView->setShowSignatureDetails( false );
}
diff --git a/kmail/kmreadermainwin.cpp b/kmail/kmreadermainwin.cpp
index 6694ba3fd..06f6c7716 100644
--- a/kmail/kmreadermainwin.cpp
+++ b/kmail/kmreadermainwin.cpp
@@ -50,7 +50,7 @@
#include "kmreadermainwin.h"
-KMReaderMainWin::KMReaderMainWin( bool htmlOverride, bool htmlLoadExtOverride,
+KMReaderMainWin::KMReaderMainWin( bool htmlOverride, bool htmlLoadExtDefault,
char *name )
: KMail::SecondaryWindow( name ? name : "readerwindow#" ),
mMsg( 0 )
@@ -59,7 +59,7 @@ KMReaderMainWin::KMReaderMainWin( bool htmlOverride, bool htmlLoadExtOverride,
//mReaderWin->setShowCompleteMessage( true );
mReaderWin->setAutoDelete( true );
mReaderWin->setHtmlOverride( htmlOverride );
- mReaderWin->setHtmlLoadExtOverride( htmlLoadExtOverride );
+ mReaderWin->setHtmlLoadExtDefault( htmlLoadExtDefault );
mReaderWin->setDecryptMessageOverwrite( true );
mReaderWin->setShowSignatureDetails( false );
initKMReaderMainWin();
diff --git a/kmail/kmreadermainwin.h b/kmail/kmreadermainwin.h
index 2101fcb5f..976f10663 100644
--- a/kmail/kmreadermainwin.h
+++ b/kmail/kmreadermainwin.h
@@ -26,7 +26,7 @@ class KMReaderMainWin : public KMail::SecondaryWindow
public:
- KMReaderMainWin( bool htmlOverride, bool htmlLoadExtOverride, char *name = 0 );
+ KMReaderMainWin( bool htmlOverride, bool htmlLoadExtDefault, char *name = 0 );
KMReaderMainWin( char *name = 0 );
KMReaderMainWin(KMMessagePart* aMsgPart,
bool aHTML, const TQString& aFileName, const TQString& pname,
diff --git a/kmail/kmreaderwin.cpp b/kmail/kmreaderwin.cpp
index a8153393d..512f7ca87 100644
--- a/kmail/kmreaderwin.cpp
+++ b/kmail/kmreaderwin.cpp
@@ -462,6 +462,7 @@ KMReaderWin::KMReaderWin(TQWidget *aParent,
readConfig();
mHtmlOverride = false;
+ mHtmlLoadExtDefault = false;
mHtmlLoadExtOverride = false;
mLevelQuote = GlobalSettings::self()->collapseQuoteLevelSpin() - 1;
@@ -895,7 +896,6 @@ void KMReaderWin::readConfig(void)
mToggleFixFontAction->setChecked( mUseFixedFont );
mHtmlMail = reader.readBoolEntry( "htmlMail", false );
- mHtmlLoadExternal = reader.readBoolEntry( "htmlLoadExternal", false );
setHeaderStyleAndStrategy( HeaderStyle::create( reader.readEntry( "header-style", "fancy" ) ),
HeaderStrategy::create( reader.readEntry( "header-set-displayed", "rich" ) ) );
@@ -2471,11 +2471,14 @@ void KMReaderWin::setHtmlOverride(bool override)
//-----------------------------------------------------------------------------
-void KMReaderWin::setHtmlLoadExtOverride(bool override)
+void KMReaderWin::setHtmlLoadExtDefault(bool loadExtDefault)
{
- mHtmlLoadExtOverride = override;
- //if (message())
- // message()->setDecodeHTML(htmlMail());
+ mHtmlLoadExtDefault = loadExtDefault;
+}
+
+void KMReaderWin::setHtmlLoadExtOverride(bool loadExtOverride)
+{
+ mHtmlLoadExtOverride = loadExtOverride;
}
@@ -2500,8 +2503,8 @@ bool KMReaderWin::htmlLoadExternal()
return mHtmlLoadExtOverride;
}
- return ((mHtmlLoadExternal && !mHtmlLoadExtOverride) ||
- (!mHtmlLoadExternal && mHtmlLoadExtOverride));
+ return ((mHtmlLoadExtDefault && !mHtmlLoadExtOverride) ||
+ (!mHtmlLoadExtDefault && mHtmlLoadExtOverride));
}
diff --git a/kmail/kmreaderwin.h b/kmail/kmreaderwin.h
index 239c0fc0e..a3da97626 100644
--- a/kmail/kmreaderwin.h
+++ b/kmail/kmreaderwin.h
@@ -199,9 +199,22 @@ public:
bool htmlOverride() const { return mHtmlOverride; }
void setHtmlOverride( bool override );
- /** Override default load external references setting */
+ /** Get the load external references override setting */
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 */
bool htmlMail();
@@ -540,7 +553,7 @@ private:
TQString renderAttachments( partNode *node, const TQColor &bgColor );
private:
- bool mHtmlMail, mHtmlLoadExternal, mHtmlOverride, mHtmlLoadExtOverride;
+ bool mHtmlMail, mHtmlLoadExtDefault, mHtmlOverride, mHtmlLoadExtOverride;
int mAtmCurrent;
TQString mAtmCurrentName;
KMMessage *mMessage;