summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2019-04-20 23:25:34 +0900
committerTDE Gitea <[email protected]>2019-05-02 11:18:05 +0000
commit70cc9c74084dac5234b64facb8c0488574b1acac (patch)
tree1ff3d6d11eb04452cdcffcd08ed525ff7be32fdb
parentc0e793908389b71c54ed0685b634609b5e1f71a3 (diff)
downloadtdepim-70cc9c74084dac5234b64facb8c0488574b1acac.tar.gz
tdepim-70cc9c74084dac5234b64facb8c0488574b1acac.zip
Improvements on previous commit and other commits published in #19. This removes the need for mIsPlainText caching and also avoid to reread the configuration every time a message is changed.
Signed-off-by: Michele Calgaro <[email protected]>
-rw-r--r--kmail/kmreadermainwin.cpp2
-rw-r--r--kmail/kmreaderwin.cpp15
-rw-r--r--kmail/kmreaderwin.h7
3 files changed, 14 insertions, 10 deletions
diff --git a/kmail/kmreadermainwin.cpp b/kmail/kmreadermainwin.cpp
index 6257ba938..336d4c162 100644
--- a/kmail/kmreadermainwin.cpp
+++ b/kmail/kmreadermainwin.cpp
@@ -509,7 +509,7 @@ void KMReaderMainWin::slotMsgPopup(KMMessage &aMsg, const KURL &aUrl, const TQPo
menu->insertSeparator();
mViewSourceAction->plug( menu );
mReaderWin->toggleFixFontAction()->plug( menu );
- mReaderWin->toggleMimePartTreeAction()->plug( menu );
+ mReaderWin->toggleMimePartTreeAction()->plug( menu );
menu->insertSeparator();
mPrintAction->plug( menu );
mSaveAsAction->plug( menu );
diff --git a/kmail/kmreaderwin.cpp b/kmail/kmreaderwin.cpp
index 1b6ca4874..76b25715d 100644
--- a/kmail/kmreaderwin.cpp
+++ b/kmail/kmreaderwin.cpp
@@ -447,6 +447,7 @@ KMReaderWin::KMReaderWin(TQWidget *aParent,
mExternalWindow = (aParent == mainWindow );
mSplitterSizes << 180 << 100;
mMimeTreeMode = 1;
+ mMimeTreeModeOverride = -1;
mMimeTreeAtBottom = true;
mAutoDelete = false;
mLastSerNum = 0;
@@ -1449,10 +1450,11 @@ int KMReaderWin::pointsToPixel(int pointSize) const
//-----------------------------------------------------------------------------
void KMReaderWin::showHideMimeTree( bool isPlainTextTopLevel ) {
- mIsPlainText = isPlainTextTopLevel;
- if ( mMimeTreeMode == 2 ||
- ( mMimeTreeMode == 1 && !isPlainTextTopLevel ) )
+ if ( mMimeTreeModeOverride == 2 ||
+ ( mMimeTreeModeOverride != 0 && (mMimeTreeMode == 2 ||
+ ( mMimeTreeMode == 1 && !isPlainTextTopLevel ) ) ) ) {
mMimePartTree->show();
+ }
else {
// don't rely on TQSplitter maintaining sizes for hidden widgets:
TDEConfigGroup reader( KMKernel::config(), "Reader" );
@@ -1468,6 +1470,7 @@ void KMReaderWin::displayMessage() {
KMMessage * msg = message();
mMimePartTree->clear();
+ mMimeTreeModeOverride = -1; // clear any previous manual overiding
showHideMimeTree( !msg || // treat no message as "text/plain"
( msg->type() == DwMime::kTypeText
&& msg->subtype() == DwMime::kSubtypePlain ) );
@@ -2147,11 +2150,11 @@ void KMReaderWin::slotToggleFixedFont()
void KMReaderWin::slotToggleMimePartTree()
{
if ( mToggleMimePartTreeAction->isChecked() ) {
- mMimeTreeMode = 2; // always
+ mMimeTreeModeOverride = 2; // always
} else {
- mMimeTreeMode = 0; // never
+ mMimeTreeModeOverride = 0; // never
}
- showHideMimeTree();
+ showHideMimeTree(false);
}
//-----------------------------------------------------------------------------
diff --git a/kmail/kmreaderwin.h b/kmail/kmreaderwin.h
index 0495041b6..c9f78aec6 100644
--- a/kmail/kmreaderwin.h
+++ b/kmail/kmreaderwin.h
@@ -5,7 +5,6 @@
#ifndef KMREADERWIN_H
#define KMREADERWIN_H
-#include <tdeactionclasses.h>
#include <tqwidget.h>
#include <tqtimer.h>
#include <tqstringlist.h>
@@ -246,6 +245,7 @@ public:
// Action to reply to a message
// but action( "some_name" ) some name could be used instead.
TDEToggleAction *toggleFixFontAction() { return mToggleFixFontAction; }
+ TDEToggleAction *toggleMimePartTreeAction() { return mToggleMimePartTreeAction; }
TDEAction *mailToComposeAction() { return mMailToComposeAction; }
TDEAction *mailToReplyAction() { return mMailToReplyAction; }
TDEAction *mailToForwardAction() { return mMailToForwardAction; }
@@ -257,7 +257,6 @@ public:
TDEAction *urlOpenAction() { return mUrlOpenAction; }
TDEAction *urlSaveAsAction() { return mUrlSaveAsAction; }
TDEAction *addBookmarksAction() { return mAddBookmarksAction;}
- TDEAction *toggleMimePartTreeAction() { return mToggleMimePartTreeAction; }
TDEAction *startImChatAction() { return mStartIMChatAction; }
// This function returns the complete data that were in this
// message parts - *after* all encryption has been removed that
@@ -400,12 +399,13 @@ public slots:
/** The user toggled the "Fixed Font" flag from the view menu. */
void slotToggleFixedFont();
+ /** Show or hide the Mime Tree Viewer */
void slotToggleMimePartTree();
/** Copy the selected text to the clipboard */
void slotCopySelectedText();
- void slotUrlClicked();
+ void slotUrlClicked();
/** Operations on mailto: URLs. */
void slotMailtoReply();
@@ -586,6 +586,7 @@ private:
TQStringList mTempFiles;
TQStringList mTempDirs;
int mMimeTreeMode;
+ int mMimeTreeModeOverride;
bool mMimeTreeAtBottom;
TQValueList<int> mSplitterSizes;
partNode* mRootNode;