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

@ -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 );

@ -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);
}
//-----------------------------------------------------------------------------

@ -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;

Loading…
Cancel
Save