summaryrefslogtreecommitdiff
authortille <tille>2002-06-18 15:57:43 (UTC)
committer tille <tille>2002-06-18 15:57:43 (UTC)
commiteacd774d0bf520d17dac5eea092197174b43c9f9 (patch) (side-by-side diff)
treec1fe6523be5c4b8ced71366dd7bb7cc65408a742
parent5538834e726c3b5d3ba7998c56845ea652d184dd (diff)
downloadopie-eacd774d0bf520d17dac5eea092197174b43c9f9.zip
opie-eacd774d0bf520d17dac5eea092197174b43c9f9.tar.gz
opie-eacd774d0bf520d17dac5eea092197174b43c9f9.tar.bz2
added dialog popup after mail is queued
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/mail2/composer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/unsupported/mail2/composer.cpp b/noncore/unsupported/mail2/composer.cpp
index cabffe5..1d793ee 100644
--- a/noncore/unsupported/mail2/composer.cpp
+++ b/noncore/unsupported/mail2/composer.cpp
@@ -207,184 +207,185 @@ void Composer::slotSendQueued()
qDebug("setting account [%i]",cfg.readNumEntry("account"));
Account accnt = accountsLoaded[ cfg.readNumEntry("account") ];
smail.setAccount( accnt ); //accountsLoaded[from->currentItem()]);
int prio = cfg.readNumEntry( "priority" );
qDebug("setting priority %i",prio);
if (prio == POPUP_PRIO_LOW) {
smail.setPriority("Low"); // No i18n on purpose
} else if (prio == POPUP_PRIO_NORMAL) {
smail.setPriority("Normal"); // No i18n on purpose
} else if (prio == POPUP_PRIO_HIGH) {
smail.setPriority("High"); // No i18n on purpose
}
QValueList<Attachment> attachments;
Attachment a;
QString an;
int ac = cfg.readNumEntry( "attachments", 0 );
qDebug("%i Attachments",ac);
for (int j = 0; i < ac; ac++) {
an = "Attachment_" + QString::number( j );
qDebug(an.latin1());
a.setFileName(cfg.readEntry( an + "fileName" ));
a.setNewName(cfg.readEntry( an + "newName" ));
a.setDescription(cfg.readEntry( an + "description" ));
a.setDocLnk( DocLnk( cfg.readEntry( an + "docLnk" )) );
attachments.append( a );
}
smail.setAttachments(attachments);
qDebug("putting mail together");
QString header, message;
MailFactory::genMail(header, message, smail, this);
if (header.isNull() || message.isNull()) continue;//return; // Aborted.
// abort->setEnabled(true);
qDebug("Sending to %s",toAdr.latin1());
SmtpHandler *handler = new SmtpHandler(header, message, accnt ,toAdr);
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 &)));
qDebug("remove mail %i", i);
cfg.clearGroup();
cfg.removeEntry( "Mail_" + QString::number(i) );
}
}
void Composer::slotQueueMail()
{
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;
}
Config cfg( "mailqueue", Config::User );
cfg.setGroup( "Settings" );
int count = cfg.readNumEntry( "count", 0 );
count++;
cfg.writeEntry( "count", count );
qDebug("queueing mail %i",count);
cfg.setGroup( "Mail_" + QString::number( count ));
cfg.writeEntry( "from", from->currentText() );
cfg.writeEntry( "reply", replyto->text());
cfg.writeEntry( "to", to->text());
cfg.writeEntry( "cc", cc->text());
cfg.writeEntry( "bcc", bcc->text());
cfg.writeEntry( "subject", subject->text());
cfg.writeEntryCrypt( "message", message->text());
cfg.writeEntry( "mime", attachView->childCount() == 0 );
cfg.writeEntry( "account", from->currentItem());
cfg.writeEntry( "priority", priority->currentItem() );
cfg.writeEntry( "attachments", attachView->childCount() );
Attachment a;
QListViewItem *item;
QString an;
int i = 0;
for (item = attachView->firstChild(); item != 0; item = item->itemBelow()) {
a = ((AttachViewItem *)item)->attachment();
an = "Attachment_" + QString::number( i++ );
cfg.writeEntry( an + "fileName", a.fileName() );
cfg.writeEntry( an + "newName", a.newName() );
cfg.writeEntry( an + "description", a.description() );
cfg.writeEntry( an + "docLnk", a.docLnk().file() );
}
- // cfg.close();
+ QMessageBox::information(this, tr("Success"), tr("<p>The mail was queued successfully.</p><p>The queue contains ")+QString::number(count)+tr(" mails.</p>"), tr("Ok"));
+
}
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());
if (account.defaultReplyTo()) replyto->setText(account.replyTo());
if (!account.signature().isEmpty())
message->setText(message->text() + "\n\n-- \n" + account.signature());
}
void Composer::slotOpenAddressPicker()
{
if (!to->isHidden() && cc->isHidden() && bcc->isHidden()) {
if (to->text().isEmpty()) {
to->setText(AddressPicker::getNames());
} else {
to->setText(to->text() + ", " + AddressPicker::getNames());
}
} else if (to->isHidden() && !cc->isHidden() && bcc->isHidden()) {
if (cc->text().isEmpty()) {
cc->setText(AddressPicker::getNames());
} else {
cc->setText(cc->text() + ", " + AddressPicker::getNames());
}
} else if (to->isHidden() && cc->isHidden() && !bcc->isHidden()) {
if (bcc->text().isEmpty()) {
bcc->setText(AddressPicker::getNames());
} else {
bcc->setText(bcc->text() + ", " + AddressPicker::getNames());
}
}
}
void Composer::slotAddAttach()
{
DocLnk lnk = AttachDiag::getFile(this);
if (lnk.name().isEmpty()) return;
Attachment attachment;
attachment.setFileName(lnk.file());
attachment.setNewName(lnk.name());
attachment.setDocLnk(lnk);
(void) new AttachViewItem(attachView, attachment);
}
void Composer::slotDelAttach()
{
if (attachView->currentItem() == NULL) return;
attachView->takeItem(attachView->currentItem());
}