summaryrefslogtreecommitdiff
path: root/noncore/net/mail/composemail.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/composemail.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/composemail.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index f8ac76f..b5cd75b 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -1,40 +1,41 @@
#include <qt.h>
#include <opie2/ofiledialog.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/global.h>
#include <qpe/contact.h>
#include "composemail.h"
#include <libmailwrapper/smtpwrapper.h>
ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
: ComposeMailUI( parent, name, modal, flags )
{
settings = s;
+ m_replyid = "";
QString vfilename = Global::applicationFileName("addressbook",
"businesscard.vcf");
Contact c;
if (QFile::exists(vfilename)) {
c = Contact::readVCard( vfilename )[0];
}
QStringList mails = c.emailList();
QString defmail = c.defaultEmail();
if (defmail.length()!=0) {
fromBox->insertItem(defmail);
}
QStringList::ConstIterator sit = mails.begin();
for (;sit!=mails.end();++sit) {
if ( (*sit)==defmail)
continue;
fromBox->insertItem((*sit));
}
senderNameEdit->setText(c.firstName()+" "+c.lastName());
Config cfg( "mail" );
cfg.setGroup( "Compose" );
checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
@@ -63,66 +64,59 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
}
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() ) );
}
void ComposeMail::pickAddress( QLineEdit *line )
{
QString names = AddressPicker::getNames();
if ( line->text().isEmpty() ) {
line->setText( names );
} else if ( !names.isEmpty() ) {
line->setText( line->text() + ", " + names );
}
}
void ComposeMail::setTo( const QString & to )
{
-/* QString toline;
- QStringList toEntry = to;
- for ( QStringList::Iterator it = toEntry.begin(); it != toEntry.end(); ++it ) {
- toline += (*it);
- }
- toLine->setText( toline );
-*/
toLine->setText( to );
}
void ComposeMail::setSubject( const QString & subject )
{
subjectLine->setText( subject );
}
void ComposeMail::setInReplyTo( const QString & messageId )
{
-
+ m_replyid = messageId;
}
void ComposeMail::setMessage( const QString & text )
{
message->setText( text );
}
void ComposeMail::pickAddressTo()
{
pickAddress( toLine );
}
void ComposeMail::pickAddressCC()
{
pickAddress( ccLine );
}
void ComposeMail::pickAddressBCC()
{
pickAddress( bccLine );
}
void ComposeMail::pickAddressReply()
@@ -186,48 +180,53 @@ void ComposeMail::accept()
if ( checkBoxLater->isChecked() ) {
qDebug( "Send later" );
}
#if 0
qDebug( "Sending Mail with " +
smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() );
#endif
Mail *mail = new Mail();
SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
mail->setMail(fromBox->currentText());
if ( !toLine->text().isEmpty() ) {
mail->setTo( toLine->text() );
} else {
qDebug( "No Reciever spezified -> returning" );
return;
}
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);
+ }
QString txt = message->text();
if ( !sigMultiLine->text().isEmpty() ) {
txt.append( "\n--\n" );
txt.append( sigMultiLine->text() );
}
qDebug(txt);
mail->setMessage( txt );
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
while ( it != NULL ) {
mail->addAttachment( it->getAttachment() );
it = (AttachViewItem *) it->nextSibling();
}
SMTPwrapper wrapper( smtp );
wrapper.sendMail( *mail,checkBoxLater->isChecked() );
QDialog::accept();
}
AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
: QListViewItem( parent )
{
attachment = att;
qDebug( att->getMimeType() );