summaryrefslogtreecommitdiff
path: root/noncore/net/mail/composemail.cpp
authoralwin <alwin>2003-12-28 17:32:43 (UTC)
committer alwin <alwin>2003-12-28 17:32:43 (UTC)
commit696a2dcfcb65fbb24b709bbae0a18a7854e2d72c (patch) (unidiff)
treee813c9508881796cf999e9c25c05e4482c6fd9e8 /noncore/net/mail/composemail.cpp
parentb900cad9c050c2d5963228a2191e13053457ef1d (diff)
downloadopie-696a2dcfcb65fbb24b709bbae0a18a7854e2d72c.zip
opie-696a2dcfcb65fbb24b709bbae0a18a7854e2d72c.tar.gz
opie-696a2dcfcb65fbb24b709bbae0a18a7854e2d72c.tar.bz2
reduced to the max...
- from address isn't setup any longer within the smtp account (it makes realy no sense, a smtp account describes the connection to a smtp server, not the identity of the sender) - from address is taken from the personal info of the addressbook (thats why this info exists). Of course the user can change it when sending an email. - user can select a from with a selection of the mails given in their personal infos. - in addresspicker: use "<Firstname> <Lastname>" instead of "Filename" - settings ui: switched of the part within the smtp accounts describing the identitiy of user ToDo: a dialog setting up a default signature
Diffstat (limited to 'noncore/net/mail/composemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/composemail.cpp50
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
@@ -3,6 +3,8 @@
3#include <opie/ofiledialog.h> 3#include <opie/ofiledialog.h>
4#include <qpe/resource.h> 4#include <qpe/resource.h>
5#include <qpe/config.h> 5#include <qpe/config.h>
6#include <qpe/global.h>
7#include <qpe/contact.h>
6 8
7#include "composemail.h" 9#include "composemail.h"
8#include "smtpwrapper.h" 10#include "smtpwrapper.h"
@@ -12,6 +14,26 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
12{ 14{
13 settings = s; 15 settings = s;
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" );
16 cfg.setGroup( "Compose" ); 38 cfg.setGroup( "Compose" );
17 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); 39 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
@@ -20,17 +42,18 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
20 attList->addColumn( tr( "Size" ) ); 42 attList->addColumn( tr( "Size" ) );
21 43
22 QList<Account> accounts = settings->getAccounts(); 44 QList<Account> accounts = settings->getAccounts();
45
23 Account *it; 46 Account *it;
24 for ( it = accounts.first(); it; it = accounts.next() ) { 47 for ( it = accounts.first(); it; it = accounts.next() ) {
25 if ( it->getType().compare( "SMTP" ) == 0 ) { 48 if ( it->getType().compare( "SMTP" ) == 0 ) {
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 );
29 } 52 }
30 } 53 }
31 54
32 if ( smtpAccounts.count() > 0 ) { 55 if ( smtpAccounts.count() > 0 ) {
33 fillValues( fromBox->currentItem() ); 56 fillValues( smtpAccountBox->currentItem() );
34 } else { 57 } else {
35 QMessageBox::information( this, tr( "Problem" ), 58 QMessageBox::information( this, tr( "Problem" ),
36 tr( "<p>Please create an SMTP account first.</p>" ), 59 tr( "<p>Please create an SMTP account first.</p>" ),
@@ -38,7 +61,7 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
38 return; 61 return;
39 } 62 }
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() ) );
43 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 66 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
44 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 67 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
@@ -108,8 +131,8 @@ void ComposeMail::pickAddressReply()
108 131
109void ComposeMail::fillValues( int current ) 132void 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();
114 if ( smtp->getUseCC() ) { 137 if ( smtp->getUseCC() ) {
115 ccLine->setText( smtp->getCC() ); 138 ccLine->setText( smtp->getCC() );
@@ -122,8 +145,8 @@ void ComposeMail::fillValues( int current )
122 if ( smtp->getUseReply() ) { 145 if ( smtp->getUseReply() ) {
123 replyLine->setText( smtp->getReply() ); 146 replyLine->setText( smtp->getReply() );
124 } 147 }
125
126 sigMultiLine->setText( smtp->getSignature() ); 148 sigMultiLine->setText( smtp->getSignature() );
149#endif
127} 150}
128 151
129void ComposeMail::slotAdjustColumns() 152void ComposeMail::slotAdjustColumns()
@@ -163,14 +186,14 @@ void ComposeMail::accept()
163 qDebug( "Send later" ); 186 qDebug( "Send later" );
164 } 187 }
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
175 if ( !toLine->text().isEmpty() ) { 198 if ( !toLine->text().isEmpty() ) {
176 mail->setTo( toLine->text() ); 199 mail->setTo( toLine->text() );
@@ -178,7 +201,7 @@ void ComposeMail::accept()
178 qDebug( "No Reciever spezified -> returning" ); 201 qDebug( "No Reciever spezified -> returning" );
179 return; 202 return;
180 } 203 }
181 204 mail->setName(senderNameEdit->text());
182 mail->setCC( ccLine->text() ); 205 mail->setCC( ccLine->text() );
183 mail->setBCC( bccLine->text() ); 206 mail->setBCC( bccLine->text() );
184 mail->setReply( replyLine->text() ); 207 mail->setReply( replyLine->text() );
@@ -188,6 +211,7 @@ void ComposeMail::accept()
188 txt.append( "\n--\n" ); 211 txt.append( "\n--\n" );
189 txt.append( sigMultiLine->text() ); 212 txt.append( sigMultiLine->text() );
190 } 213 }
214 qDebug(txt);
191 mail->setMessage( txt ); 215 mail->setMessage( txt );
192 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 216 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
193 while ( it != NULL ) { 217 while ( it != NULL ) {
@@ -196,8 +220,8 @@ void ComposeMail::accept()
196 } 220 }
197 221
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();
202} 226}
203 227