Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit e841b4fb authored by Laurent Montel's avatar Laurent Montel 😁

Don't show mimetreeview if model is empty (as when we show a patch in kmail)

parent 5279ac07
......@@ -567,7 +567,8 @@ void KMReaderMainWin::showMessagePopup(const Akonadi::Item&msg ,const KUrl&url,c
menu->addAction( mReaderWin->viewSourceAction() );
menu->addAction( mReaderWin->toggleFixFontAction() );
menu->addAction( mReaderWin->toggleMimePartTreeAction() );
if (!mReaderWin->mimePartTreeIsEmpty())
menu->addAction( mReaderWin->toggleMimePartTreeAction() );
menu->addSeparator();
if (mMsgActions->printPreviewAction())
menu->addAction( mMsgActions->printPreviewAction() );
......@@ -584,7 +585,8 @@ void KMReaderMainWin::showMessagePopup(const Akonadi::Item&msg ,const KUrl&url,c
}
} else {
menu->addAction( mReaderWin->toggleFixFontAction() );
menu->addAction( mReaderWin->toggleMimePartTreeAction() );
if (!mReaderWin->mimePartTreeIsEmpty())
menu->addAction( mReaderWin->toggleMimePartTreeAction() );
}
if (mReaderWin->adblockEnabled()) {
menu->addSeparator();
......
......@@ -613,6 +613,11 @@ KToggleAction *KMReaderWin::toggleFixFontAction() const
return mViewer->toggleFixFontAction();
}
bool KMReaderWin::mimePartTreeIsEmpty() const
{
return mViewer->mimePartTreeIsEmpty();
}
KAction *KMReaderWin::toggleMimePartTreeAction() const
{
return mViewer->toggleMimePartTreeAction();
......
......@@ -182,6 +182,7 @@ public:
bool adblockEnabled() const;
bool isAShortUrl(const KUrl &url) const;
bool mimePartTreeIsEmpty() const;
signals:
/** Emitted after parsing of a message to have it stored
in unencrypted state in it's folder. */
......
......@@ -388,6 +388,12 @@ KToggleAction *Viewer::toggleFixFontAction()
return d->mToggleFixFontAction;
}
bool Viewer::mimePartTreeIsEmpty() const
{
Q_D( const Viewer );
return d->mimePartTreeIsEmpty();
}
KToggleAction *Viewer::toggleMimePartTreeAction()
{
Q_D( Viewer );
......
......@@ -345,6 +345,7 @@ public:
bool isAShortUrl(const KUrl &url) const;
void showOpenAttachmentFolderWidget(const KUrl &url);
bool mimePartTreeIsEmpty() const;
signals:
void moveMessageToTrash();
......
......@@ -1373,6 +1373,10 @@ void ViewerPrivate::setMessagePart( KMime::Content * node )
void ViewerPrivate::showHideMimeTree( )
{
#ifndef QT_NO_TREEVIEW
if (mMimePartTree->model()->rowCount() == 0) {
mMimePartTree->hide();
return;
}
bool showMimeTree = false;
if ( GlobalSettings::self()->mimeTreeMode() == GlobalSettings::EnumMimeTreeMode::Always )
{
......@@ -2527,6 +2531,11 @@ void ViewerPrivate::showOpenAttachmentFolderWidget(const KUrl &url)
mOpenAttachmentFolderWidget->slotShowWarning();
}
bool ViewerPrivate::mimePartTreeIsEmpty() const
{
return (mMimePartTree->model()->rowCount() == 0);
}
void ViewerPrivate::slotAttachmentSaveAs()
{
const KMime::Content::List contents = selectedContents();
......
......@@ -453,6 +453,8 @@ public:
void showOpenAttachmentFolderWidget(const KUrl &url);
bool mimePartTreeIsEmpty() const;
private slots:
void slotModifyItemDone(KJob* job);
void slotMessageMayBeAScam();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment