author | conber <conber> | 2002-06-15 20:53:53 (UTC) |
---|---|---|
committer | conber <conber> | 2002-06-15 20:53:53 (UTC) |
commit | be10ba352f2a89bc5ec816eefc307a4ae2f7ff6b (patch) (side-by-side diff) | |
tree | 414e77447b8f8d6baeef6588a009cb65e1353c0b | |
parent | e23774336087439cfed07899c8446eab674a3de8 (diff) | |
download | opie-be10ba352f2a89bc5ec816eefc307a4ae2f7ff6b.zip opie-be10ba352f2a89bc5ec816eefc307a4ae2f7ff6b.tar.gz opie-be10ba352f2a89bc5ec816eefc307a4ae2f7ff6b.tar.bz2 |
fixed abort bug
-rw-r--r-- | noncore/unsupported/mail2/composer.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/unsupported/mail2/composer.cpp b/noncore/unsupported/mail2/composer.cpp index 03d50b6..57f0779 100644 --- a/noncore/unsupported/mail2/composer.cpp +++ b/noncore/unsupported/mail2/composer.cpp @@ -75,96 +75,97 @@ void Composer::slotPopupHandler(int itemid) if (itemid == POPUP_ATTACH_RENAME) { QString tmp = Rename::rename(attachView->currentItem()->text(0), this); if (tmp != QString(0)) attachView->currentItem()->setText(0, tmp); } else if (itemid == POPUP_ATTACH_DESC) { QString tmp = Rename::getText(tr("Set Description"), tr("<div align=center>Description"), this); if (tmp != QString(0)) attachView->currentItem()->setText(1, tmp); } else if (itemid == POPUP_ATTACH_REMOVE) { attachView->takeItem(attachView->currentItem()); } } void Composer::slotSendMail() { if (to->text().find(QRegExp(".*\\@.*\\..*")) == -1) { QMessageBox::information(this, tr("Error"), tr("<p>You have to specify a recipient.<br>(eg: foo@bar.org)</p>"), tr("Ok")); return; } SendMail smail; smail.setFrom(from->currentText()); smail.setReplyTo(replyto->text()); smail.setTo(to->text()); smail.setCc(cc->text()); smail.setBcc(bcc->text()); smail.setSubject(subject->text()); smail.setMessage(message->text()); smail.setNeedsMime(attachView->childCount() == 0 ? false : true); smail.setAccount(accountsLoaded[from->currentItem()]); if (priority->currentItem() == POPUP_PRIO_LOW) { smail.setPriority("Low"); // No i18n on purpose } else if (priority->currentItem() == POPUP_PRIO_NORMAL) { smail.setPriority("Normal"); // No i18n on purpose } else if (priority->currentItem() == POPUP_PRIO_HIGH) { smail.setPriority("High"); // No i18n on purpose } QValueList<Attachment> attachments; QListViewItem *item; for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) { attachments.append(((AttachViewItem *)item)->attachment()); } smail.setAttachments(attachments); QString header, message; MailFactory::genMail(header, message, smail, this); + if (header.isNull() || message.isNull()) return; // Aborted. abort->setEnabled(true); SmtpHandler *handler = new SmtpHandler(header, message, accountsLoaded[from->currentItem()], to->text()); connect(handler, SIGNAL(finished()), SLOT(slotSendFinished())); connect(handler, SIGNAL(error(const QString &)), SLOT(slotSendError(const QString &))); connect(handler, SIGNAL(status(const QString &)), status, SLOT(setText(const QString &))); } void Composer::slotSendError(const QString &error) { status->setText(tr("<font color=#ff0000>Error occoured during sending.</font>")); QMessageBox::warning(this, tr("Error"), tr("<p>%1</p").arg(error), tr("Ok")); } void Composer::slotSendFinished() { QMessageBox::information(this, tr("Success"), tr("<p>The mail was sent successfully.</p>"), tr("Ok")); status->setText(QString(0)); abort->setEnabled(false); } void Composer::slotFillStuff() { QValueList<Account> accounts = ConfigFile::getAccounts(); int i = 0; QValueList<Account>::Iterator it; for (it = accounts.begin(); it != accounts.end(); it++) { if (!(*it).email().isEmpty() && !(*it).smtpServer().isEmpty() && !(*it).smtpPort().isEmpty()) { if (!(*it).realName().isEmpty()) from->insertItem((*it).realName() + " <" + (*it).email() + ">", i); else from->insertItem((*it).email()); accountsLoaded.append(*it); i++; } } } void Composer::slotFromChanged(int id) { Account account = accountsLoaded[id]; if (account.defaultCc()) cc->setText(account.cc()); if (account.defaultBcc()) bcc->setText(account.bcc()); |