author | zautrix <zautrix> | 2004-07-06 16:42:29 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-06 16:42:29 (UTC) |
commit | 12695014a6bbf791f084d479a33883eeeb6d4e3b (patch) (side-by-side diff) | |
tree | 7877a59b574584303f930a91c8f265aa27e84e0a /kmicromail/composemail.cpp | |
parent | 45e2744074e876a74919b340efc320bdadadcb25 (diff) | |
download | kdepimpi-12695014a6bbf791f084d479a33883eeeb6d4e3b.zip kdepimpi-12695014a6bbf791f084d479a33883eeeb6d4e3b.tar.gz kdepimpi-12695014a6bbf791f084d479a33883eeeb6d4e3b.tar.bz2 |
Fixed a crash
-rw-r--r-- | kmicromail/composemail.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index c1b58a4..9060364 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -60,50 +60,51 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m cfg.setGroup( "Compose" ); checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); attList->addColumn( tr( "Name" ) ); attList->addColumn( tr( "Size" ) ); QList<Account> accounts = settings->getAccounts(); Account *it; for ( it = accounts.first(); it; it = accounts.next() ) { if ( it->getType()==MAILLIB::A_SMTP ) { SMTPaccount *smtp = static_cast<SMTPaccount *>(it); smtpAccountBox->insertItem( smtp->getAccountName() ); 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() ) ); connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 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() { Opie::Core::OSmartPointer<Mail> mail= new Mail(); mail->setMail(fromBox->currentText()); mail->setTo( toLine->text() ); mail->setName(senderNameEdit->text()); mail->setCC( ccLine->text() ); mail->setBCC( bccLine->text() ); mail->setReply( replyLine->text() ); mail->setSubject( subjectLine->text() ); if (!m_replyid.isEmpty()) { QStringList ids; ids.append(m_replyid); mail->setInreply(ids); @@ -243,32 +244,38 @@ void ComposeMail::addAttachment() } } void ComposeMail::removeAttachment() { if ( !attList->currentItem() ) { QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select a File.</p>" ), tr( "Ok" ) ); } else { attList->takeItem( attList->currentItem() ); } } 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?"), tr("Yes"), tr("Cancel")); if (yesno == 1) { return; } } #if 0 odebug << "Sending Mail with " << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; #endif Opie::Core::OSmartPointer<Mail> mail=new Mail; @@ -314,32 +321,37 @@ void ComposeMail::accept() } QDialog::accept(); } void ComposeMail::reject() { //qDebug("ComposeMail::reject() "); int yesno = QMessageBox::warning(0,tr("Store message?"), tr("Store message into drafts?\n"), tr("Yes"), tr("No")); //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) { qDebug("return "); return; } QDialog::reject(); } ComposeMail::~ComposeMail() { } void ComposeMail::reEditMail(const RecMailP¤t) { RecMailP data = current; |