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 | |||
@@ -5,2 +5,4 @@ | |||
5 | #include <qpe/config.h> | 5 | #include <qpe/config.h> |
6 | #include <qpe/global.h> | ||
7 | #include <qpe/contact.h> | ||
6 | 8 | ||
@@ -14,2 +16,22 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m | |||
14 | 16 | ||
17 | QString vfilename = Global::applicationFileName("addressbook", | ||
18 | "businesscard.vcf"); | ||
19 | Contact c; | ||
20 | if (QFile::exists(vfilename)) { | ||
21 | c = Contact::readVCard( vfilename )[0]; | ||
22 | } | ||
23 | |||
24 | QStringList mails = c.emailList(); | ||
25 | QString defmail = c.defaultEmail(); | ||
26 | |||
27 | if (defmail.length()!=0) { | ||
28 | fromBox->insertItem(defmail); | ||
29 | } | ||
30 | QStringList::ConstIterator sit = mails.begin(); | ||
31 | for (;sit!=mails.end();++sit) { | ||
32 | if ( (*sit)==defmail) | ||
33 | continue; | ||
34 | fromBox->insertItem((*sit)); | ||
35 | } | ||
36 | senderNameEdit->setText(c.firstName()+" "+c.lastName()); | ||
15 | Config cfg( "mail" ); | 37 | Config cfg( "mail" ); |
@@ -22,2 +44,3 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m | |||
22 | QList<Account> accounts = settings->getAccounts(); | 44 | QList<Account> accounts = settings->getAccounts(); |
45 | |||
23 | Account *it; | 46 | Account *it; |
@@ -26,3 +49,3 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m | |||
26 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 49 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
27 | fromBox->insertItem( smtp->getMail() ); | 50 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
28 | smtpAccounts.append( smtp ); | 51 | smtpAccounts.append( smtp ); |
@@ -32,3 +55,3 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m | |||
32 | if ( smtpAccounts.count() > 0 ) { | 55 | if ( smtpAccounts.count() > 0 ) { |
33 | fillValues( fromBox->currentItem() ); | 56 | fillValues( smtpAccountBox->currentItem() ); |
34 | } else { | 57 | } else { |
@@ -40,3 +63,3 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m | |||
40 | 63 | ||
41 | connect( fromBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); | 64 | connect( smtpAccountBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); |
42 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 65 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
@@ -110,4 +133,4 @@ void ComposeMail::fillValues( int current ) | |||
110 | { | 133 | { |
134 | #if 0 | ||
111 | SMTPaccount *smtp = smtpAccounts.at( current ); | 135 | SMTPaccount *smtp = smtpAccounts.at( current ); |
112 | |||
113 | ccLine->clear(); | 136 | ccLine->clear(); |
@@ -124,4 +147,4 @@ void ComposeMail::fillValues( int current ) | |||
124 | } | 147 | } |
125 | |||
126 | sigMultiLine->setText( smtp->getSignature() ); | 148 | sigMultiLine->setText( smtp->getSignature() ); |
149 | #endif | ||
127 | } | 150 | } |
@@ -165,10 +188,10 @@ void ComposeMail::accept() | |||
165 | 188 | ||
166 | 189 | #if 0 | |
167 | qDebug( "Sending Mail with " + | 190 | qDebug( "Sending Mail with " + |
168 | smtpAccounts.at( fromBox->currentItem() )->getAccountName() ); | 191 | smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); |
192 | #endif | ||
169 | Mail *mail = new Mail(); | 193 | Mail *mail = new Mail(); |
170 | SMTPaccount *smtp = smtpAccounts.at( fromBox->currentItem() ); | ||
171 | 194 | ||
172 | mail->setMail( smtp->getMail() ); | 195 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
173 | mail->setName( smtp->getName() ); | 196 | mail->setMail(fromBox->currentText()); |
174 | 197 | ||
@@ -180,3 +203,3 @@ void ComposeMail::accept() | |||
180 | } | 203 | } |
181 | 204 | mail->setName(senderNameEdit->text()); | |
182 | mail->setCC( ccLine->text() ); | 205 | mail->setCC( ccLine->text() ); |
@@ -190,2 +213,3 @@ void ComposeMail::accept() | |||
190 | } | 213 | } |
214 | qDebug(txt); | ||
191 | mail->setMessage( txt ); | 215 | mail->setMessage( txt ); |
@@ -198,4 +222,4 @@ void ComposeMail::accept() | |||
198 | SMTPwrapper wrapper( settings ); | 222 | SMTPwrapper wrapper( settings ); |
199 | wrapper.sendMail( *mail,checkBoxLater->isChecked() ); | 223 | wrapper.sendMail( *mail,smtp,checkBoxLater->isChecked() ); |
200 | 224 | ||
201 | QDialog::accept(); | 225 | QDialog::accept(); |