Diffstat (limited to 'noncore/net/mail/composemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/composemail.cpp | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index 73d1a43..13c7900 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp @@ -4,4 +4,6 @@ #include <qpe/resource.h> #include <qpe/config.h> +#include <qpe/global.h> +#include <qpe/contact.h> #include "composemail.h" @@ -13,4 +15,24 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m settings = s; + 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" ); @@ -21,9 +43,10 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m QList<Account> accounts = settings->getAccounts(); + Account *it; for ( it = accounts.first(); it; it = accounts.next() ) { if ( it->getType().compare( "SMTP" ) == 0 ) { SMTPaccount *smtp = static_cast<SMTPaccount *>(it); - fromBox->insertItem( smtp->getMail() ); + smtpAccountBox->insertItem( smtp->getAccountName() ); smtpAccounts.append( smtp ); } @@ -31,5 +54,5 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m if ( smtpAccounts.count() > 0 ) { - fillValues( fromBox->currentItem() ); + fillValues( smtpAccountBox->currentItem() ); } else { QMessageBox::information( this, tr( "Problem" ), @@ -39,5 +62,5 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m } - connect( fromBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); + connect( smtpAccountBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); @@ -109,6 +132,6 @@ void ComposeMail::pickAddressReply() void ComposeMail::fillValues( int current ) { +#if 0 SMTPaccount *smtp = smtpAccounts.at( current ); - ccLine->clear(); if ( smtp->getUseCC() ) { @@ -123,6 +146,6 @@ void ComposeMail::fillValues( int current ) replyLine->setText( smtp->getReply() ); } - sigMultiLine->setText( smtp->getSignature() ); +#endif } @@ -164,12 +187,12 @@ void ComposeMail::accept() } - +#if 0 qDebug( "Sending Mail with " + - smtpAccounts.at( fromBox->currentItem() )->getAccountName() ); + smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); +#endif Mail *mail = new Mail(); - SMTPaccount *smtp = smtpAccounts.at( fromBox->currentItem() ); - mail->setMail( smtp->getMail() ); - mail->setName( smtp->getName() ); + SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); + mail->setMail(fromBox->currentText()); if ( !toLine->text().isEmpty() ) { @@ -179,5 +202,5 @@ void ComposeMail::accept() return; } - + mail->setName(senderNameEdit->text()); mail->setCC( ccLine->text() ); mail->setBCC( bccLine->text() ); @@ -189,4 +212,5 @@ void ComposeMail::accept() txt.append( sigMultiLine->text() ); } + qDebug(txt); mail->setMessage( txt ); AttachViewItem *it = (AttachViewItem *) attList->firstChild(); @@ -197,6 +221,6 @@ void ComposeMail::accept() SMTPwrapper wrapper( settings ); - wrapper.sendMail( *mail,checkBoxLater->isChecked() ); - + wrapper.sendMail( *mail,smtp,checkBoxLater->isChecked() ); + QDialog::accept(); } |