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-13 05:54:25 +0200
commitc8e1b254e243af4368f5430d8478f7a3a66d1fc6 (patch)
tree9d51f004212c45f9cc4c2a7c5e634b43630ae46d
parent746e02af07f7dc223940ad80a0a234c0aff85850 (diff)
downloadtdepim-c8e1b254e243af4368f5430d8478f7a3a66d1fc6.tar.gz
tdepim-c8e1b254e243af4368f5430d8478f7a3a66d1fc6.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>
-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 d5ba1f31a..6240a19be 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 336d4c162..0d74e87ee 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 9ecb56b1a..00a71a78b 100644
--- a/kmail/kmreaderwin.cpp
+++ b/kmail/kmreaderwin.cpp
@@ -464,6 +464,7 @@ KMReaderWin::KMReaderWin(TQWidget *aParent,
readConfig();
mHtmlOverride = false;
+ mHtmlLoadExtDefault = false;
mHtmlLoadExtOverride = false;
mLevelQuote = GlobalSettings::self()->collapseQuoteLevelSpin() - 1;
@@ -902,7 +903,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" ) ) );
@@ -2496,11 +2496,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;
}
@@ -2525,8 +2528,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 dfc4490c2..91e1702ea 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();
@@ -544,7 +557,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;