From c0e793908389b71c54ed0685b634609b5e1f71a3 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 2 Feb 2018 21:36:09 +0000 Subject: KMail: Menu options to toggle "Show Message Structure" Subtly different from the same feature in KDE: KDE's menu items toggle the default behaviour between always/never, and the menu item is disabled if smart is set. For Trinity, the option is always available, and only toggles visibility of the structure for the current session. Signed-off-by: Luke Dashjr --- kmail/kmmainwidget.cpp | 1 + kmail/kmreadermainwin.cpp | 1 + kmail/kmreaderwin.cpp | 20 ++++++++++++++++++++ kmail/kmreaderwin.h | 5 +++++ 4 files changed, 27 insertions(+) (limited to 'kmail') diff --git a/kmail/kmmainwidget.cpp b/kmail/kmmainwidget.cpp index 0d845225b..1d2661f58 100644 --- a/kmail/kmmainwidget.cpp +++ b/kmail/kmmainwidget.cpp @@ -2438,6 +2438,7 @@ void KMMainWidget::slotMsgPopup(KMMessage&, const KURL &aUrl, const TQPoint& aPo viewSourceAction()->plug(menu); if(mMsgView) { mMsgView->toggleFixFontAction()->plug(menu); + mMsgView->toggleMimePartTreeAction()->plug(menu); } menu->insertSeparator(); mPrintAction->plug( menu ); diff --git a/kmail/kmreadermainwin.cpp b/kmail/kmreadermainwin.cpp index 6694ba3fd..6257ba938 100644 --- a/kmail/kmreadermainwin.cpp +++ b/kmail/kmreadermainwin.cpp @@ -509,6 +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 ); menu->insertSeparator(); mPrintAction->plug( menu ); mSaveAsAction->plug( menu ); diff --git a/kmail/kmreaderwin.cpp b/kmail/kmreaderwin.cpp index b3c435703..1b6ca4874 100644 --- a/kmail/kmreaderwin.cpp +++ b/kmail/kmreaderwin.cpp @@ -618,6 +618,11 @@ void KMReaderWin::createActions( TDEActionCollection * ac ) { Key_X, TQT_TQOBJECT(this), TQT_SLOT(slotToggleFixedFont()), ac, "toggle_fixedfont" ); + mToggleMimePartTreeAction = new TDEToggleAction( i18n("Show Message Structure"), + 0, ac, "toggle_mimeparttree" ); + connect(mToggleMimePartTreeAction, TQT_SIGNAL(toggled(bool)), + TQT_TQOBJECT(this), TQT_SLOT(slotToggleMimePartTree())); + mStartIMChatAction = new TDEAction( i18n("Chat &With..."), 0, TQT_TQOBJECT(this), TQT_SLOT(slotIMChat()), ac, "start_im_chat" ); } @@ -1444,6 +1449,7 @@ int KMReaderWin::pointsToPixel(int pointSize) const //----------------------------------------------------------------------------- void KMReaderWin::showHideMimeTree( bool isPlainTextTopLevel ) { + mIsPlainText = isPlainTextTopLevel; if ( mMimeTreeMode == 2 || ( mMimeTreeMode == 1 && !isPlainTextTopLevel ) ) mMimePartTree->show(); @@ -1453,6 +1459,9 @@ void KMReaderWin::showHideMimeTree( bool isPlainTextTopLevel ) { saveSplitterSizes( reader ); mMimePartTree->hide(); } + if ( mToggleMimePartTreeAction->isChecked() != mMimePartTree->isVisible() ) { + mToggleMimePartTreeAction->setChecked( mMimePartTree->isVisible() ); + } } void KMReaderWin::displayMessage() { @@ -2134,6 +2143,17 @@ void KMReaderWin::slotToggleFixedFont() } +//----------------------------------------------------------------------------- +void KMReaderWin::slotToggleMimePartTree() +{ + if ( mToggleMimePartTreeAction->isChecked() ) { + mMimeTreeMode = 2; // always + } else { + mMimeTreeMode = 0; // never + } + showHideMimeTree(); +} + //----------------------------------------------------------------------------- void KMReaderWin::slotCopySelectedText() { diff --git a/kmail/kmreaderwin.h b/kmail/kmreaderwin.h index 81256e8c5..0495041b6 100644 --- a/kmail/kmreaderwin.h +++ b/kmail/kmreaderwin.h @@ -5,6 +5,7 @@ #ifndef KMREADERWIN_H #define KMREADERWIN_H +#include #include #include #include @@ -256,6 +257,7 @@ 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 @@ -398,6 +400,8 @@ public slots: /** The user toggled the "Fixed Font" flag from the view menu. */ void slotToggleFixedFont(); + void slotToggleMimePartTree(); + /** Copy the selected text to the clipboard */ void slotCopySelectedText(); @@ -594,6 +598,7 @@ private: TDEToggleAction *mHeaderOnlyAttachmentsAction; TDESelectAction *mSelectEncodingAction; TDEToggleAction *mToggleFixFontAction; + TDEToggleAction *mToggleMimePartTreeAction; KURL mHoveredUrl; KURL mClickedUrl; -- cgit v1.2.1