From the branch: Plugging two memleaks - the message was never deleted, and the composewin was not deleted when using automatic sending

svn path=/trunk/kdepim/; revision=349931
wilder-work
Bo Thorsen 22 years ago
parent b2d1b67616
commit 70e1bee969
  1. 8
      kmcomposewin.cpp
  2. 6
      kmcomposewin.h
  3. 12
      kmkernel.cpp

@ -364,6 +364,14 @@ KMComposeWin::~KMComposeWin()
std::for_each( mComposedMessages.begin(), mComposedMessages.end(), DeleteObject<KMMessage> );
}
void KMComposeWin::setAutoDeleteWindow( bool f )
{
if ( f )
setWFlags( getWFlags() | WDestructiveClose );
else
setWFlags( getWFlags() & ~WDestructiveClose );
}
//-----------------------------------------------------------------------------
void KMComposeWin::send(int how)
{

@ -314,6 +314,12 @@ public:
*/
inline void setAutoDelete(bool f) { mAutoDeleteMsg = f; }
/**
* If this flag is set, the compose window will delete itself after
* the window has been closed.
*/
void setAutoDeleteWindow( bool f );
/**
* If this folder is set, the original message is inserted back after
* cancelling

@ -426,7 +426,7 @@ int KMKernel::openComposer (const QString &to, const QString &cc,
if ( !to.isEmpty() ) msg->setTo(to);
if ( !body.isEmpty() ) msg->setBody(body.utf8());
bool iCalHack = false;
bool iCalAutoSend = false;
KConfigGroup options( config(), "Groupware" );
if ( !attachData.isEmpty() ) {
if ( attachName == "cal.ics" && attachType == "text" &&
@ -440,7 +440,7 @@ int KMKernel::openComposer (const QString &to, const QString &cc,
arg( attachParamValue ) );
// Don't show the composer window, if the automatic sending is checked
iCalHack = options.readBoolEntry( "AutomaticSending", true );
iCalAutoSend = options.readBoolEntry( "AutomaticSending", true );
} else {
// Just do what we're told to do
msgPart = new KMMessagePart;
@ -460,14 +460,15 @@ int KMKernel::openComposer (const QString &to, const QString &cc,
}
KMComposeWin *cWin = new KMComposeWin( msg );
if( iCalHack )
cWin->setAutoDelete( true );
if( iCalAutoSend )
cWin->slotWordWrapToggled( false );
else
cWin->setCharset( "", true );
if ( msgPart )
cWin->addAttach(msgPart);
if ( hidden == 0 && !iCalHack ) {
if ( hidden == 0 && !iCalAutoSend ) {
cWin->show();
// Activate window - doing this instead of KWin::activateWindow(cWin->winId());
// so that it also works when called from KMailApplication::newInstance()
@ -475,8 +476,7 @@ int KMKernel::openComposer (const QString &to, const QString &cc,
KStartupInfo::setNewStartupId( cWin, kapp->startupId() );
#endif
} else {
// TODO: Delete the window
kdDebug(5006) << "Hidden send now window\n";
cWin->setAutoDeleteWindow( true );
cWin->slotSendNow();
}

Loading…
Cancel
Save