From 12695014a6bbf791f084d479a33883eeeb6d4e3b Mon Sep 17 00:00:00 2001 From: zautrix Date: Tue, 06 Jul 2004 16:42:29 +0000 Subject: Fixed a crash --- (limited to 'kmicromail/composemail.cpp') diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index c1b58a4..9060364 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -73,6 +73,14 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m smtpAccounts.append( smtp ); } } + if ( smtpAccounts.count() > 0 ) { + fillValues( smtpAccountBox->currentItem() ); + } else { + QMessageBox::information( 0, tr( "Problem" ), + tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), + tr( "Ok" ) ); + return; + } connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); @@ -83,14 +91,7 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); mMail = 0; warnAttach = true; - if ( smtpAccounts.count() > 0 ) { - fillValues( smtpAccountBox->currentItem() ); - } else { - QMessageBox::information( 0, tr( "Problem" ), - tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), - tr( "Ok" ) ); - return; - } + } void ComposeMail::saveAsDraft() { @@ -256,6 +257,12 @@ void ComposeMail::removeAttachment() void ComposeMail::accept() { + if ( smtpAccountBox->count() == 0 ) { + + reject(); + return; + } + if (! checkBoxLater->isChecked() ) { int yesno = QMessageBox::warning(0,tr("Stop editing message"), tr("Send this message?"), @@ -327,6 +334,11 @@ void ComposeMail::reject() //qDebug("button %d ", yesno); if (yesno == 0) { + if ( toLine->text().isEmpty() ) { + QMessageBox::warning(0,tr("Sending mail"), + tr("No Receiver spezified" ) ); + return; + } saveAsDraft(); } if (yesno == 2) { -- cgit v0.9.0.2