author | groucho <groucho> | 2003-04-20 07:59:48 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-04-20 07:59:48 (UTC) |
commit | 8b85cba50912127ff6a2d048021baf68306481c6 (patch) (side-by-side diff) | |
tree | bfd1b377911d05db8e1c816f72fe070d5a5b2ff3 /noncore/net/mailit/writemail.cpp | |
parent | 6b381e438fdeb1757b3278c683349dee9c4ab230 (diff) | |
download | opie-8b85cba50912127ff6a2d048021baf68306481c6.zip opie-8b85cba50912127ff6a2d048021baf68306481c6.tar.gz opie-8b85cba50912127ff6a2d048021baf68306481c6.tar.bz2 |
- Added CC: support
- Added mail forwarding
- Added icon for selective mail download
- Removing mails from mail list via icon
- Temporarily disabled mail header download queue
Diffstat (limited to 'noncore/net/mailit/writemail.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mailit/writemail.cpp | 101 |
1 files changed, 88 insertions, 13 deletions
diff --git a/noncore/net/mailit/writemail.cpp b/noncore/net/mailit/writemail.cpp index 38a2596..a9dcb02 100644 --- a/noncore/net/mailit/writemail.cpp +++ b/noncore/net/mailit/writemail.cpp @@ -87,4 +87,6 @@ void WriteMail::init() recipientsBox->setCurrentItem(0); grid->addWidget( recipientsBox, 0, 0 ); + connect(recipientsBox,SIGNAL(activated(int)),this, SLOT(changeRecipients(int))); + subjetLabel = new QLabel( widget, "subjetLabel" ); @@ -103,4 +105,9 @@ void WriteMail::init() grid->addWidget( toInput, 0, 1 ); + ccInput = new QLineEdit( widget, "ccInput" ); + ccInput->hide(); + grid->addWidget( ccInput, 0, 1 ); + + addressButton = new QToolButton( widget, "addressButton" ); addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); @@ -140,17 +147,29 @@ void WriteMail::accept() int idCount = 0; - if (toInput->text() == "") { - QMessageBox::warning(this,"No recipient", "Send mail to whom?", "OK\n"); + if (toInput->text() == "") + { + QMessageBox::warning(this,tr("No recipient"), tr("Send mail to whom?"), tr("OK\n")); + return; + } + + if (! getRecipients(false) ) + { + QMessageBox::warning(this,tr("Incorrect recipient separator"), + tr("Recipients must be separated by ;\nand be valid emailaddresses"), tr("OK\n")); return; } - if (! getRecipients() ) { - QMessageBox::warning(this,"Incorrect recipient separator", - "Recipients must be separated by ;\nand be valid emailaddresses", "OK\n"); + + if ((ccInput->text()!="") && (! getRecipients(true) )) + { + QMessageBox::warning(this,tr("Incorrect carbon copy separator"), + tr("CC Recipients must be separated by ;\nand be valid emailaddresses"), tr("OK\n")); return; } + mail.subject = subjectInput->text(); mail.body = emailInput->text(); mail.sent = false; mail.received = false; + mail.rawMail = "To: "; @@ -161,5 +180,16 @@ void WriteMail::accept() mail.rawMail += ",\n"; } + mail.rawMail.truncate(mail.rawMail.length()-2); + + mail.rawMail += "\nCC: "; + + for (QStringList::Iterator it = mail.carbonCopies.begin(); + it != mail.carbonCopies.end(); ++it) { + + mail.rawMail += (*it); + mail.rawMail += ",\n"; + } + mail.rawMail += mail.from; mail.rawMail += "\nSubject: "; @@ -212,5 +242,5 @@ void WriteMail::attatchFile() } -void WriteMail::reply(Email replyMail) +void WriteMail::reply(Email replyMail, bool replyAll) { int pos; @@ -220,5 +250,9 @@ void WriteMail::reply(Email replyMail) toInput->setText(mail.fromMail); - subjectInput->setText("Re: " + mail.subject); + //replyAll ? ccInput->setText(mail.c) + + addRecipients(replyAll); + + subjectInput->setText(tr("Re: ") + mail.subject); pos = 0; @@ -233,5 +267,24 @@ void WriteMail::reply(Email replyMail) } -bool WriteMail::getRecipients() +void WriteMail::forward(Email forwMail) +{ + int pos=0; + + QString fwdBody=tr("======forwarded message from "); + fwdBody.append(forwMail.fromMail); + fwdBody.append(tr(" starts======\n\n")); + + mail=forwMail; + toInput->setText(""); + ccInput->setText(""); + subjectInput->setText(tr("FWD: ") + mail.subject); + + fwdBody+=mail.body; + fwdBody+=QString(tr("======end of forwarded message======\n\n")); + + emailInput->setText(fwdBody); +} + +bool WriteMail::getRecipients(bool ccField) { QString str, temp; @@ -240,5 +293,6 @@ bool WriteMail::getRecipients() mail.recipients.clear(); - temp = toInput->text(); + ccField ? temp = ccInput->text() : temp=toInput->text() ; + while ( (pos = temp.find(';')) != -1) { str = temp.left(pos).stripWhiteSpace(); @@ -246,5 +300,5 @@ bool WriteMail::getRecipients() if ( str.find('@') == -1) return false; - mail.recipients.append(str); + ccField ? mail.carbonCopies.append(str) : mail.recipients.append(str); addressList->addContact(str, ""); } @@ -252,5 +306,5 @@ bool WriteMail::getRecipients() if ( temp.find('@') == -1) return false; - mail.recipients.append(temp); + ccField ? mail.carbonCopies.append(temp) : mail.recipients.append(temp); addressList->addContact(temp, ""); @@ -258,10 +312,16 @@ bool WriteMail::getRecipients() } - void WriteMail::addRecipients() { + + addRecipients(false); +} + +void WriteMail::addRecipients(bool ccField) +{ QString recipients = ""; mail.recipients.clear(); + QListViewItem *item = addressView->firstChild(); while (item != NULL) { @@ -275,5 +335,6 @@ void WriteMail::addRecipients() item = item->nextSibling(); } - toInput->setText(recipients); + + ccField ? ccInput->setText(recipients):toInput->setText(recipients); addressView->hide(); @@ -284,4 +345,18 @@ void WriteMail::addRecipients() } +void WriteMail::changeRecipients(int selection) +{ + if (selection==0) + { + toInput->show(); + ccInput->hide(); + } + else if (selection==1) + { + toInput->hide(); + ccInput->show(); + } +} + void WriteMail::setRecipient(const QString &recipient) { |