Fixes the following crash, by adding check for null-pointers:

A message part that is not an email by itself is "view"ed. When reply or forward actions are triggered, KMail crashes.

It also hides the main toolbar and menu for non-message viewers.

BUG: 123316

GUI: Remove menu and toolbar for e-mail parts that are not e-mails themselves.


svn path=/branches/KDE/3.5/kdepim/; revision=518656
wilder-work
Ismail Onur Filiz 20 years ago
parent ccc302c200
commit f266760a46
  1. 3
      kmcommands.cpp
  2. 9
      kmreadermainwin.cpp

@ -170,7 +170,8 @@ KMCommand::KMCommand( QWidget *parent, KMMessage *msg )
: mProgressDialog( 0 ), mResult( Undefined ), mDeletesItself( false ),
mEmitsCompletedItself( false ), mParent( parent )
{
mMsgList.append( &msg->toMsgBase() );
if (msg)
mMsgList.append( &msg->toMsgBase() );
}
KMCommand::~KMCommand()

@ -89,6 +89,10 @@ void KMReaderMainWin::initKMReaderMainWin() {
setupAccel();
setupGUI( ToolBar | Keys | StatusBar | Create, "kmreadermainwin.rc" );
applyMainWindowSettings( KMKernel::config(), "Separate Reader Window" );
if ( ! mReaderWin->message() ) {
menuBar()->hide();
toolBar( "mainToolBar" )->hide();
}
connect( kmkernel, SIGNAL( configChanged() ),
this, SLOT( slotConfigChanged() ) );
@ -113,6 +117,7 @@ void KMReaderMainWin::showMsg( const QString & encoding, KMMessage *msg )
mReaderWin->setMsg( msg, true );
setCaption( msg->subject() );
mMsg = msg;
menuBar()->show();
toolBar( "mainToolBar" )->show();
}
@ -162,7 +167,7 @@ void KMReaderMainWin::slotReplyListToMsg()
void KMReaderMainWin::slotForwardMsg()
{
KMCommand *command = 0;
if ( mReaderWin->message()->parent() ) {
if ( mReaderWin->message() && mReaderWin->message()->parent() ) {
command = new KMForwardCommand( this, mReaderWin->message(),
mReaderWin->message()->parent()->identity() );
} else {
@ -175,7 +180,7 @@ void KMReaderMainWin::slotForwardMsg()
void KMReaderMainWin::slotForwardAttachedMsg()
{
KMCommand *command = 0;
if ( mReaderWin->message()->parent() ) {
if ( mReaderWin->message() && mReaderWin->message()->parent() ) {
command = new KMForwardAttachedCommand( this, mReaderWin->message(),
mReaderWin->message()->parent()->identity() );
} else {

Loading…
Cancel
Save