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 <michele.calgaro@yahoo.it>
pull/29/head
Michele Calgaro 6 years ago committed by TDE Gitea
parent c0e7939083
commit 70cc9c7408

@ -447,6 +447,7 @@ KMReaderWin::KMReaderWin(TQWidget *aParent,
mExternalWindow = (aParent == mainWindow ); mExternalWindow = (aParent == mainWindow );
mSplitterSizes << 180 << 100; mSplitterSizes << 180 << 100;
mMimeTreeMode = 1; mMimeTreeMode = 1;
mMimeTreeModeOverride = -1;
mMimeTreeAtBottom = true; mMimeTreeAtBottom = true;
mAutoDelete = false; mAutoDelete = false;
mLastSerNum = 0; mLastSerNum = 0;
@ -1449,10 +1450,11 @@ int KMReaderWin::pointsToPixel(int pointSize) const
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void KMReaderWin::showHideMimeTree( bool isPlainTextTopLevel ) { void KMReaderWin::showHideMimeTree( bool isPlainTextTopLevel ) {
mIsPlainText = isPlainTextTopLevel; if ( mMimeTreeModeOverride == 2 ||
if ( mMimeTreeMode == 2 || ( mMimeTreeModeOverride != 0 && (mMimeTreeMode == 2 ||
( mMimeTreeMode == 1 && !isPlainTextTopLevel ) ) ( mMimeTreeMode == 1 && !isPlainTextTopLevel ) ) ) ) {
mMimePartTree->show(); mMimePartTree->show();
}
else { else {
// don't rely on TQSplitter maintaining sizes for hidden widgets: // don't rely on TQSplitter maintaining sizes for hidden widgets:
TDEConfigGroup reader( KMKernel::config(), "Reader" ); TDEConfigGroup reader( KMKernel::config(), "Reader" );
@ -1468,6 +1470,7 @@ void KMReaderWin::displayMessage() {
KMMessage * msg = message(); KMMessage * msg = message();
mMimePartTree->clear(); mMimePartTree->clear();
mMimeTreeModeOverride = -1; // clear any previous manual overiding
showHideMimeTree( !msg || // treat no message as "text/plain" showHideMimeTree( !msg || // treat no message as "text/plain"
( msg->type() == DwMime::kTypeText ( msg->type() == DwMime::kTypeText
&& msg->subtype() == DwMime::kSubtypePlain ) ); && msg->subtype() == DwMime::kSubtypePlain ) );
@ -2147,11 +2150,11 @@ void KMReaderWin::slotToggleFixedFont()
void KMReaderWin::slotToggleMimePartTree() void KMReaderWin::slotToggleMimePartTree()
{ {
if ( mToggleMimePartTreeAction->isChecked() ) { if ( mToggleMimePartTreeAction->isChecked() ) {
mMimeTreeMode = 2; // always mMimeTreeModeOverride = 2; // always
} else { } else {
mMimeTreeMode = 0; // never mMimeTreeModeOverride = 0; // never
} }
showHideMimeTree(); showHideMimeTree(false);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

@ -5,7 +5,6 @@
#ifndef KMREADERWIN_H #ifndef KMREADERWIN_H
#define KMREADERWIN_H #define KMREADERWIN_H
#include <tdeactionclasses.h>
#include <tqwidget.h> #include <tqwidget.h>
#include <tqtimer.h> #include <tqtimer.h>
#include <tqstringlist.h> #include <tqstringlist.h>
@ -246,6 +245,7 @@ public:
// Action to reply to a message // Action to reply to a message
// but action( "some_name" ) some name could be used instead. // but action( "some_name" ) some name could be used instead.
TDEToggleAction *toggleFixFontAction() { return mToggleFixFontAction; } TDEToggleAction *toggleFixFontAction() { return mToggleFixFontAction; }
TDEToggleAction *toggleMimePartTreeAction() { return mToggleMimePartTreeAction; }
TDEAction *mailToComposeAction() { return mMailToComposeAction; } TDEAction *mailToComposeAction() { return mMailToComposeAction; }
TDEAction *mailToReplyAction() { return mMailToReplyAction; } TDEAction *mailToReplyAction() { return mMailToReplyAction; }
TDEAction *mailToForwardAction() { return mMailToForwardAction; } TDEAction *mailToForwardAction() { return mMailToForwardAction; }
@ -257,7 +257,6 @@ public:
TDEAction *urlOpenAction() { return mUrlOpenAction; } TDEAction *urlOpenAction() { return mUrlOpenAction; }
TDEAction *urlSaveAsAction() { return mUrlSaveAsAction; } TDEAction *urlSaveAsAction() { return mUrlSaveAsAction; }
TDEAction *addBookmarksAction() { return mAddBookmarksAction;} TDEAction *addBookmarksAction() { return mAddBookmarksAction;}
TDEAction *toggleMimePartTreeAction() { return mToggleMimePartTreeAction; }
TDEAction *startImChatAction() { return mStartIMChatAction; } TDEAction *startImChatAction() { return mStartIMChatAction; }
// This function returns the complete data that were in this // This function returns the complete data that were in this
// message parts - *after* all encryption has been removed that // message parts - *after* all encryption has been removed that
@ -400,6 +399,7 @@ public slots:
/** The user toggled the "Fixed Font" flag from the view menu. */ /** The user toggled the "Fixed Font" flag from the view menu. */
void slotToggleFixedFont(); void slotToggleFixedFont();
/** Show or hide the Mime Tree Viewer */
void slotToggleMimePartTree(); void slotToggleMimePartTree();
/** Copy the selected text to the clipboard */ /** Copy the selected text to the clipboard */
@ -586,6 +586,7 @@ private:
TQStringList mTempFiles; TQStringList mTempFiles;
TQStringList mTempDirs; TQStringList mTempDirs;
int mMimeTreeMode; int mMimeTreeMode;
int mMimeTreeModeOverride;
bool mMimeTreeAtBottom; bool mMimeTreeAtBottom;
TQValueList<int> mSplitterSizes; TQValueList<int> mSplitterSizes;
partNode* mRootNode; partNode* mRootNode;

Loading…
Cancel
Save