summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/addresspicker.cpp2
-rw-r--r--noncore/net/mail/composemail.cpp48
-rw-r--r--noncore/net/mail/composemailui.ui186
-rw-r--r--noncore/net/mail/editaccounts.cpp23
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp25
-rw-r--r--noncore/net/mail/libmailwrapper/settings.h20
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp54
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.h3
-rw-r--r--noncore/net/mail/settings.cpp25
-rw-r--r--noncore/net/mail/settings.h20
-rw-r--r--noncore/net/mail/smtpconfigui.ui401
-rw-r--r--noncore/net/mail/smtpwrapper.cpp54
-rw-r--r--noncore/net/mail/smtpwrapper.h3
13 files changed, 322 insertions, 542 deletions
diff --git a/noncore/net/mail/addresspicker.cpp b/noncore/net/mail/addresspicker.cpp
index 581de62..7857870 100644
--- a/noncore/net/mail/addresspicker.cpp
+++ b/noncore/net/mail/addresspicker.cpp
@@ -33,7 +33,7 @@ AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFl
33 if ((*it).defaultEmail().length()!=0) { 33 if ((*it).defaultEmail().length()!=0) {
34 mails = (*it).emailList(); 34 mails = (*it).emailList();
35 if ((*it).fileAs().length()>0) { 35 if ((*it).fileAs().length()>0) {
36 pre = "\""+(*it).fileAs()+"\" <"; 36 pre = "\""+(*it).firstName()+" "+(*it).lastName()+"\" <";
37 suf = ">"; 37 suf = ">";
38 } else { 38 } else {
39 pre = ""; 39 pre = "";
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,7 +220,7 @@ 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}
diff --git a/noncore/net/mail/composemailui.ui b/noncore/net/mail/composemailui.ui
index 4d225e4..aebdf67 100644
--- a/noncore/net/mail/composemailui.ui
+++ b/noncore/net/mail/composemailui.ui
@@ -11,7 +11,7 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>260</width> 14 <width>252</width>
15 <height>360</height> 15 <height>360</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
@@ -28,13 +28,31 @@
28 <vbox> 28 <vbox>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>3</number> 31 <number>1</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>3</number> 35 <number>1</number>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QLayoutWidget</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>Layout4</cstring>
42 </property>
43 <property>
44 <name>layoutSpacing</name>
45 </property>
46 <grid>
47 <property stdset="1">
48 <name>margin</name>
49 <number>0</number>
50 </property>
51 <property stdset="1">
52 <name>spacing</name>
53 <number>3</number>
54 </property>
55 <widget row="0" column="0" >
38 <class>QCheckBox</class> 56 <class>QCheckBox</class>
39 <property stdset="1"> 57 <property stdset="1">
40 <name>name</name> 58 <name>name</name>
@@ -45,6 +63,33 @@
45 <string>send later</string> 63 <string>send later</string>
46 </property> 64 </property>
47 </widget> 65 </widget>
66 <widget row="0" column="1" >
67 <class>QLabel</class>
68 <property stdset="1">
69 <name>name</name>
70 <cstring>accountLabel</cstring>
71 </property>
72 <property stdset="1">
73 <name>text</name>
74 <string>use:</string>
75 </property>
76 </widget>
77 <widget row="0" column="2" >
78 <class>QComboBox</class>
79 <property stdset="1">
80 <name>name</name>
81 <cstring>smtpAccountBox</cstring>
82 </property>
83 <property stdset="1">
84 <name>sizePolicy</name>
85 <sizepolicy>
86 <hsizetype>3</hsizetype>
87 <vsizetype>0</vsizetype>
88 </sizepolicy>
89 </property>
90 </widget>
91 </grid>
92 </widget>
48 <widget> 93 <widget>
49 <class>QTabWidget</class> 94 <class>QTabWidget</class>
50 <property stdset="1"> 95 <property stdset="1">
@@ -67,27 +112,129 @@
67 <name>title</name> 112 <name>title</name>
68 <string>Mail</string> 113 <string>Mail</string>
69 </attribute> 114 </attribute>
115 <vbox>
116 <property stdset="1">
117 <name>margin</name>
118 <number>1</number>
119 </property>
120 <property stdset="1">
121 <name>spacing</name>
122 <number>1</number>
123 </property>
124 <widget>
125 <class>QLayoutWidget</class>
126 <property stdset="1">
127 <name>name</name>
128 <cstring>Layout10</cstring>
129 </property>
130 <property>
131 <name>layoutSpacing</name>
132 </property>
133 <grid>
134 <property stdset="1">
135 <name>margin</name>
136 <number>0</number>
137 </property>
138 <property stdset="1">
139 <name>spacing</name>
140 <number>1</number>
141 </property>
142 <widget row="0" column="1" >
143 <class>QLayoutWidget</class>
144 <property stdset="1">
145 <name>name</name>
146 <cstring>Layout9</cstring>
147 </property>
148 <property>
149 <name>layoutSpacing</name>
150 </property>
70 <grid> 151 <grid>
71 <property stdset="1"> 152 <property stdset="1">
72 <name>margin</name> 153 <name>margin</name>
73 <number>-1</number> 154 <number>0</number>
74 </property> 155 </property>
75 <property stdset="1"> 156 <property stdset="1">
76 <name>spacing</name> 157 <name>spacing</name>
77 <number>-1</number> 158 <number>3</number>
78 </property> 159 </property>
160 <widget row="0" column="1" >
161 <class>QComboBox</class>
162 <property stdset="1">
163 <name>name</name>
164 <cstring>fromBox</cstring>
165 </property>
166 <property stdset="1">
167 <name>sizePolicy</name>
168 <sizepolicy>
169 <hsizetype>3</hsizetype>
170 <vsizetype>0</vsizetype>
171 </sizepolicy>
172 </property>
173 <property stdset="1">
174 <name>editable</name>
175 <bool>true</bool>
176 </property>
177 <property stdset="1">
178 <name>duplicatesEnabled</name>
179 <bool>false</bool>
180 </property>
181 </widget>
182 <widget row="0" column="0" >
183 <class>QLineEdit</class>
184 <property stdset="1">
185 <name>name</name>
186 <cstring>senderNameEdit</cstring>
187 </property>
188 <property stdset="1">
189 <name>sizePolicy</name>
190 <sizepolicy>
191 <hsizetype>0</hsizetype>
192 <vsizetype>0</vsizetype>
193 </sizepolicy>
194 </property>
195 <property stdset="1">
196 <name>minimumSize</name>
197 <size>
198 <width>70</width>
199 <height>0</height>
200 </size>
201 </property>
202 <property stdset="1">
203 <name>maximumSize</name>
204 <size>
205 <width>70</width>
206 <height>32767</height>
207 </size>
208 </property>
209 </widget>
210 </grid>
211 </widget>
79 <widget row="2" column="1" > 212 <widget row="2" column="1" >
80 <class>QLineEdit</class> 213 <class>QLineEdit</class>
81 <property stdset="1"> 214 <property stdset="1">
82 <name>name</name> 215 <name>name</name>
83 <cstring>subjectLine</cstring> 216 <cstring>subjectLine</cstring>
84 </property> 217 </property>
218 <property stdset="1">
219 <name>sizePolicy</name>
220 <sizepolicy>
221 <hsizetype>3</hsizetype>
222 <vsizetype>0</vsizetype>
223 </sizepolicy>
224 </property>
85 </widget> 225 </widget>
86 <widget row="3" column="0" rowspan="1" colspan="2" > 226 <widget row="1" column="1" >
87 <class>QMultiLineEdit</class> 227 <class>QLineEdit</class>
88 <property stdset="1"> 228 <property stdset="1">
89 <name>name</name> 229 <name>name</name>
90 <cstring>message</cstring> 230 <cstring>toLine</cstring>
231 </property>
232 <property stdset="1">
233 <name>sizePolicy</name>
234 <sizepolicy>
235 <hsizetype>3</hsizetype>
236 <vsizetype>0</vsizetype>
237 </sizepolicy>
91 </property> 238 </property>
92 </widget> 239 </widget>
93 <widget row="2" column="0" > 240 <widget row="2" column="0" >
@@ -112,20 +259,6 @@
112 <string>From</string> 259 <string>From</string>
113 </property> 260 </property>
114 </widget> 261 </widget>
115 <widget row="1" column="1" >
116 <class>QLineEdit</class>
117 <property stdset="1">
118 <name>name</name>
119 <cstring>toLine</cstring>
120 </property>
121 </widget>
122 <widget row="0" column="1" >
123 <class>QComboBox</class>
124 <property stdset="1">
125 <name>name</name>
126 <cstring>fromBox</cstring>
127 </property>
128 </widget>
129 <widget row="1" column="0" > 262 <widget row="1" column="0" >
130 <class>QPushButton</class> 263 <class>QPushButton</class>
131 <property stdset="1"> 264 <property stdset="1">
@@ -140,6 +273,15 @@
140 </grid> 273 </grid>
141 </widget> 274 </widget>
142 <widget> 275 <widget>
276 <class>QMultiLineEdit</class>
277 <property stdset="1">
278 <name>name</name>
279 <cstring>message</cstring>
280 </property>
281 </widget>
282 </vbox>
283 </widget>
284 <widget>
143 <class>QWidget</class> 285 <class>QWidget</class>
144 <property stdset="1"> 286 <property stdset="1">
145 <name>name</name> 287 <name>name</name>
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp
index 1246037..de36e0d 100644
--- a/noncore/net/mail/editaccounts.cpp
+++ b/noncore/net/mail/editaccounts.cpp
@@ -355,9 +355,6 @@ SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name,
355{ 355{
356 data = account; 356 data = account;
357 357
358 connect( ccBox, SIGNAL( toggled( bool ) ), ccLine, SLOT( setEnabled( bool ) ) );
359 connect( bccBox, SIGNAL( toggled( bool ) ), bccLine, SLOT( setEnabled( bool ) ) );
360 connect( replyBox, SIGNAL( toggled( bool ) ), replyLine, SLOT( setEnabled( bool ) ) );
361 connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); 358 connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) );
362 connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); 359 connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) );
363 360
@@ -384,16 +381,6 @@ void SMTPconfig::fillValues()
384 loginBox->setChecked( data->getLogin() ); 381 loginBox->setChecked( data->getLogin() );
385 userLine->setText( data->getUser() ); 382 userLine->setText( data->getUser() );
386 passLine->setText( data->getPassword() ); 383 passLine->setText( data->getPassword() );
387 nameLine->setText( data->getName() );
388 mailLine->setText( data->getMail() );
389 orgLine->setText( data->getOrg() );
390 ccBox->setChecked( data->getUseCC() );
391 ccLine->setText( data->getCC() );
392 bccBox->setChecked( data->getUseBCC() );
393 bccLine->setText( data->getBCC() );
394 replyBox->setChecked( data->getUseReply() );
395 replyLine->setText( data->getReply() );
396 sigMultiLine->setText( data->getSignature() );
397} 384}
398 385
399void SMTPconfig::accept() 386void SMTPconfig::accept()
@@ -405,16 +392,6 @@ void SMTPconfig::accept()
405 data->setLogin( loginBox->isChecked() ); 392 data->setLogin( loginBox->isChecked() );
406 data->setUser( userLine->text() ); 393 data->setUser( userLine->text() );
407 data->setPassword( passLine->text() ); 394 data->setPassword( passLine->text() );
408 data->setName( nameLine->text() );
409 data->setMail( mailLine->text() );
410 data->setOrg( orgLine->text() );
411 data->setCC( ccLine->text() );
412 data->setUseCC( ccBox->isChecked() );
413 data->setBCC( bccLine->text() );
414 data->setUseBCC( bccBox->isChecked() );
415 data->setReply( replyLine->text() );
416 data->setUseReply( replyBox->isChecked() );
417 data->setSignature( sigMultiLine->text() );
418 395
419 QDialog::accept(); 396 QDialog::accept();
420} 397}
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index b580954..17aa1b0 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -273,9 +273,6 @@ SMTPaccount::SMTPaccount( QString filename )
273 accountName = "New SMTP Account"; 273 accountName = "New SMTP Account";
274 ssl = false; 274 ssl = false;
275 login = false; 275 login = false;
276 useCC = false;
277 useBCC = false;
278 useReply = false;
279 type = "SMTP"; 276 type = "SMTP";
280 port = SMTP_PORT; 277 port = SMTP_PORT;
281} 278}
@@ -306,17 +303,6 @@ void SMTPaccount::read()
306 login = conf->readBoolEntry( "Login" ); 303 login = conf->readBoolEntry( "Login" );
307 user = conf->readEntry( "User" ); 304 user = conf->readEntry( "User" );
308 password = conf->readEntryCrypt( "Password" ); 305 password = conf->readEntryCrypt( "Password" );
309 useCC = conf->readBoolEntry( "useCC" );
310 useBCC = conf->readBoolEntry( "useBCC" );
311 useReply = conf->readBoolEntry( "useReply" );
312 name = conf->readEntry( "Name" );
313 mail = conf->readEntry( "Mail" );
314 org = conf->readEntry( "Org" );
315 cc = conf->readEntry( "CC" );
316 bcc = conf->readEntry( "BCC" );
317 reply = conf->readEntry( "Reply" );
318 signature = conf->readEntry( "Signature" );
319 signature = signature.replace( QRegExp( "<br>" ), "\n" );
320} 306}
321 307
322void SMTPaccount::save() 308void SMTPaccount::save()
@@ -333,17 +319,6 @@ void SMTPaccount::save()
333 conf->writeEntry( "Login", login ); 319 conf->writeEntry( "Login", login );
334 conf->writeEntry( "User", user ); 320 conf->writeEntry( "User", user );
335 conf->writeEntryCrypt( "Password", password ); 321 conf->writeEntryCrypt( "Password", password );
336 conf->writeEntry( "useCC", useCC );
337 conf->writeEntry( "useBCC", useBCC );
338 conf->writeEntry( "useReply", useReply );
339 conf->writeEntry( "Name", name );
340 conf->writeEntry( "Mail", mail );
341 conf->writeEntry( "Org", org );
342 conf->writeEntry( "CC", cc );
343 conf->writeEntry( "BCC", bcc );
344 conf->writeEntry( "Reply", reply );
345 conf->writeEntry( "Signature",
346 signature.replace( QRegExp( "\\n" ), "<br>" ) );
347 conf->write(); 322 conf->write();
348} 323}
349 324
diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h
index 22184a5..caa5dfc 100644
--- a/noncore/net/mail/libmailwrapper/settings.h
+++ b/noncore/net/mail/libmailwrapper/settings.h
@@ -93,26 +93,6 @@ public:
93 virtual void save(); 93 virtual void save();
94 virtual QString getFileName(); 94 virtual QString getFileName();
95 95
96 void setName( QString str ) { name = str; }
97 QString getName() { return name; }
98 void setMail( QString str ) { mail = str; }
99 QString getMail() { return mail; }
100 void setOrg( QString str ) { org = str; }
101 QString getOrg() { return org; }
102 void setUseCC( bool b ) { useCC = b; }
103 bool getUseCC() { return useCC; }
104 void setCC( QString str ) { cc = str; }
105 QString getCC() { return cc; }
106 void setUseBCC( bool b ) { useBCC = b; }
107 bool getUseBCC() { return useBCC; }
108 void setBCC( QString str ) { bcc = str; }
109 QString getBCC() { return bcc; }
110 void setUseReply( bool b ) { useReply = b; }
111 bool getUseReply() { return useReply; }
112 void setReply( QString str ) { reply = str; }
113 QString getReply() { return reply; }
114 void setSignature( QString str ) { signature = str; }
115 QString getSignature() { return signature; }
116 void setLogin( bool b ) { login = b; } 96 void setLogin( bool b ) { login = b; }
117 bool getLogin() { return login; } 97 bool getLogin() { return login; }
118 98
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index 521cd0a..30c0707 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -128,9 +128,9 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail )
128{ 128{
129 mailimf_fields *fields; 129 mailimf_fields *fields;
130 mailimf_field *xmailer; 130 mailimf_field *xmailer;
131 mailimf_mailbox *sender, *fromBox; 131 mailimf_mailbox *sender=0,*fromBox=0;
132 mailimf_mailbox_list *from; 132 mailimf_mailbox_list *from=0;
133 mailimf_address_list *to, *cc, *bcc, *reply; 133 mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0;
134 char *subject = strdup( mail.getSubject().latin1() ); 134 char *subject = strdup( mail.getSubject().latin1() );
135 int err; 135 int err;
136 136
@@ -167,22 +167,22 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail )
167 return fields; // Success :) 167 return fields; // Success :)
168 168
169err_free_xmailer: 169err_free_xmailer:
170 mailimf_field_free( xmailer ); 170 if (xmailer) mailimf_field_free( xmailer );
171err_free_fields: 171err_free_fields:
172 mailimf_fields_free( fields ); 172 if (fields) mailimf_fields_free( fields );
173err_free_reply: 173err_free_reply:
174 mailimf_address_list_free( reply ); 174 if (reply) mailimf_address_list_free( reply );
175 mailimf_address_list_free( bcc ); 175 if (bcc) mailimf_address_list_free( bcc );
176 mailimf_address_list_free( cc ); 176 if (cc) mailimf_address_list_free( cc );
177 mailimf_address_list_free( to ); 177 if (to) mailimf_address_list_free( to );
178err_free_from: 178err_free_from:
179 mailimf_mailbox_list_free( from ); 179 if (from) mailimf_mailbox_list_free( from );
180err_free_fromBox: 180err_free_fromBox:
181 mailimf_mailbox_free( fromBox ); 181 mailimf_mailbox_free( fromBox );
182err_free_sender: 182err_free_sender:
183 mailimf_mailbox_free( sender ); 183 if (sender) mailimf_mailbox_free( sender );
184err_free: 184err_free:
185 free( subject ); 185 if (subject) free( subject );
186 qDebug( "createImfFields - error" ); 186 qDebug( "createImfFields - error" );
187 187
188 return NULL; // Error :( 188 return NULL; // Error :(
@@ -206,7 +206,7 @@ mailmime *SMTPwrapper::buildTxtPart(const QString&str )
206 err = clist_append( content->ct_parameters, param ); 206 err = clist_append( content->ct_parameters, param );
207 if ( err != MAILIMF_NO_ERROR ) goto err_free_content; 207 if ( err != MAILIMF_NO_ERROR ) goto err_free_content;
208 208
209 fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_QUOTED_PRINTABLE); 209 fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT);
210 if ( fields == NULL ) goto err_free_content; 210 if ( fields == NULL ) goto err_free_content;
211 211
212 txtPart = mailmime_new_empty( content, fields ); 212 txtPart = mailmime_new_empty( content, fields );
@@ -462,26 +462,6 @@ char *SMTPwrapper::getFrom( mailmime *mail )
462 return getFrom(ffrom); 462 return getFrom(ffrom);
463} 463}
464 464
465SMTPaccount *SMTPwrapper::getAccount(const QString&name )
466{
467 SMTPaccount *smtp;
468
469 QList<Account> list = settings->getAccounts();
470 Account *it;
471 for ( it = list.first(); it; it = list.next() ) {
472 if ( it->getType().compare( "SMTP" ) == 0 ) {
473 smtp = static_cast<SMTPaccount *>(it);
474 if ( smtp->getName()== name ) {
475 qDebug( "SMTPaccount found for" );
476 qDebug( name );
477 return smtp;
478 }
479 }
480 }
481
482 return NULL;
483}
484
485void SMTPwrapper::progress( size_t current, size_t maximum ) 465void SMTPwrapper::progress( size_t current, size_t maximum )
486{ 466{
487 if (SMTPwrapper::sendProgress) { 467 if (SMTPwrapper::sendProgress) {
@@ -613,12 +593,16 @@ free_mem:
613 return result; 593 return result;
614} 594}
615 595
616void SMTPwrapper::sendMail(const Mail&mail,bool later ) 596void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later )
617{ 597{
618 mailmime * mimeMail; 598 mailmime * mimeMail;
619 599
620 SMTPaccount *smtp = getAccount(mail.getName()); 600 SMTPaccount *smtp = aSmtp;
621 601
602 if (!later && !smtp) {
603 qDebug("Didn't get any send method - giving up");
604 return;
605 }
622 mimeMail = createMimeMail(mail ); 606 mimeMail = createMimeMail(mail );
623 if ( mimeMail == NULL ) { 607 if ( mimeMail == NULL ) {
624 qDebug( "sendMail: error creating mime mail" ); 608 qDebug( "sendMail: error creating mime mail" );
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h
index f734fa4..0535983 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h
@@ -27,7 +27,7 @@ class SMTPwrapper : public QObject
27public: 27public:
28 SMTPwrapper( Settings *s ); 28 SMTPwrapper( Settings *s );
29 virtual ~SMTPwrapper(){} 29 virtual ~SMTPwrapper(){}
30 void sendMail(const Mail& mail,bool later=false ); 30 void sendMail(const Mail& mail,SMTPaccount*smtp,bool later=false );
31 bool flushOutbox(SMTPaccount*smtp); 31 bool flushOutbox(SMTPaccount*smtp);
32 32
33 static progressMailSend*sendProgress; 33 static progressMailSend*sendProgress;
@@ -42,7 +42,6 @@ protected:
42 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); 42 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content);
43 void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ); 43 void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp );
44 clist *createRcptList( mailimf_fields *fields ); 44 clist *createRcptList( mailimf_fields *fields );
45 SMTPaccount *getAccount(const QString&from );
46 45
47 static void storeMail(char*mail, size_t length, const QString&box); 46 static void storeMail(char*mail, size_t length, const QString&box);
48 static QString mailsmtpError( int err ); 47 static QString mailsmtpError( int err );
diff --git a/noncore/net/mail/settings.cpp b/noncore/net/mail/settings.cpp
index b580954..17aa1b0 100644
--- a/noncore/net/mail/settings.cpp
+++ b/noncore/net/mail/settings.cpp
@@ -273,9 +273,6 @@ SMTPaccount::SMTPaccount( QString filename )
273 accountName = "New SMTP Account"; 273 accountName = "New SMTP Account";
274 ssl = false; 274 ssl = false;
275 login = false; 275 login = false;
276 useCC = false;
277 useBCC = false;
278 useReply = false;
279 type = "SMTP"; 276 type = "SMTP";
280 port = SMTP_PORT; 277 port = SMTP_PORT;
281} 278}
@@ -306,17 +303,6 @@ void SMTPaccount::read()
306 login = conf->readBoolEntry( "Login" ); 303 login = conf->readBoolEntry( "Login" );
307 user = conf->readEntry( "User" ); 304 user = conf->readEntry( "User" );
308 password = conf->readEntryCrypt( "Password" ); 305 password = conf->readEntryCrypt( "Password" );
309 useCC = conf->readBoolEntry( "useCC" );
310 useBCC = conf->readBoolEntry( "useBCC" );
311 useReply = conf->readBoolEntry( "useReply" );
312 name = conf->readEntry( "Name" );
313 mail = conf->readEntry( "Mail" );
314 org = conf->readEntry( "Org" );
315 cc = conf->readEntry( "CC" );
316 bcc = conf->readEntry( "BCC" );
317 reply = conf->readEntry( "Reply" );
318 signature = conf->readEntry( "Signature" );
319 signature = signature.replace( QRegExp( "<br>" ), "\n" );
320} 306}
321 307
322void SMTPaccount::save() 308void SMTPaccount::save()
@@ -333,17 +319,6 @@ void SMTPaccount::save()
333 conf->writeEntry( "Login", login ); 319 conf->writeEntry( "Login", login );
334 conf->writeEntry( "User", user ); 320 conf->writeEntry( "User", user );
335 conf->writeEntryCrypt( "Password", password ); 321 conf->writeEntryCrypt( "Password", password );
336 conf->writeEntry( "useCC", useCC );
337 conf->writeEntry( "useBCC", useBCC );
338 conf->writeEntry( "useReply", useReply );
339 conf->writeEntry( "Name", name );
340 conf->writeEntry( "Mail", mail );
341 conf->writeEntry( "Org", org );
342 conf->writeEntry( "CC", cc );
343 conf->writeEntry( "BCC", bcc );
344 conf->writeEntry( "Reply", reply );
345 conf->writeEntry( "Signature",
346 signature.replace( QRegExp( "\\n" ), "<br>" ) );
347 conf->write(); 322 conf->write();
348} 323}
349 324
diff --git a/noncore/net/mail/settings.h b/noncore/net/mail/settings.h
index 22184a5..caa5dfc 100644
--- a/noncore/net/mail/settings.h
+++ b/noncore/net/mail/settings.h
@@ -93,26 +93,6 @@ public:
93 virtual void save(); 93 virtual void save();
94 virtual QString getFileName(); 94 virtual QString getFileName();
95 95
96 void setName( QString str ) { name = str; }
97 QString getName() { return name; }
98 void setMail( QString str ) { mail = str; }
99 QString getMail() { return mail; }
100 void setOrg( QString str ) { org = str; }
101 QString getOrg() { return org; }
102 void setUseCC( bool b ) { useCC = b; }
103 bool getUseCC() { return useCC; }
104 void setCC( QString str ) { cc = str; }
105 QString getCC() { return cc; }
106 void setUseBCC( bool b ) { useBCC = b; }
107 bool getUseBCC() { return useBCC; }
108 void setBCC( QString str ) { bcc = str; }
109 QString getBCC() { return bcc; }
110 void setUseReply( bool b ) { useReply = b; }
111 bool getUseReply() { return useReply; }
112 void setReply( QString str ) { reply = str; }
113 QString getReply() { return reply; }
114 void setSignature( QString str ) { signature = str; }
115 QString getSignature() { return signature; }
116 void setLogin( bool b ) { login = b; } 96 void setLogin( bool b ) { login = b; }
117 bool getLogin() { return login; } 97 bool getLogin() { return login; }
118 98
diff --git a/noncore/net/mail/smtpconfigui.ui b/noncore/net/mail/smtpconfigui.ui
index 2cae8d6..f5ce8cb 100644
--- a/noncore/net/mail/smtpconfigui.ui
+++ b/noncore/net/mail/smtpconfigui.ui
@@ -11,8 +11,8 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>253</width> 14 <width>241</width>
15 <height>342</height> 15 <height>321</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
@@ -28,92 +28,31 @@
28 <vbox> 28 <vbox>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>0</number> 31 <number>2</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>0</number> 35 <number>2</number>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QTabWidget</class> 38 <class>QLayoutWidget</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>smtpTab</cstring> 41 <cstring>Layout4</cstring>
42 </property>
43 <property stdset="1">
44 <name>caption</name>
45 <string></string>
46 </property>
47 <property>
48 <name>layoutMargin</name>
49 </property> 42 </property>
50 <property> 43 <property>
51 <name>layoutSpacing</name> 44 <name>layoutSpacing</name>
52 </property> 45 </property>
53 <widget>
54 <class>QWidget</class>
55 <property stdset="1">
56 <name>name</name>
57 <cstring>serverTab</cstring>
58 </property>
59 <attribute>
60 <name>title</name>
61 <string>Server</string>
62 </attribute>
63 <grid> 46 <grid>
64 <property stdset="1"> 47 <property stdset="1">
65 <name>margin</name> 48 <name>margin</name>
66 <number>4</number> 49 <number>0</number>
67 </property> 50 </property>
68 <property stdset="1"> 51 <property stdset="1">
69 <name>spacing</name> 52 <name>spacing</name>
70 <number>3</number> 53 <number>2</number>
71 </property> 54 </property>
72 <widget row="3" column="0" > 55 <widget row="0" column="0" rowspan="1" colspan="2" >
73 <class>QLabel</class>
74 <property stdset="1">
75 <name>name</name>
76 <cstring>portLabel</cstring>
77 </property>
78 <property stdset="1">
79 <name>text</name>
80 <string>Port</string>
81 </property>
82 </widget>
83 <widget row="2" column="1" rowspan="1" colspan="2" >
84 <class>QLineEdit</class>
85 <property stdset="1">
86 <name>name</name>
87 <cstring>serverLine</cstring>
88 </property>
89 <property>
90 <name>toolTip</name>
91 <string>Name of the SMTP Server</string>
92 </property>
93 </widget>
94 <widget row="2" column="0" >
95 <class>QLabel</class>
96 <property stdset="1">
97 <name>name</name>
98 <cstring>serverLabel</cstring>
99 </property>
100 <property stdset="1">
101 <name>text</name>
102 <string>Server</string>
103 </property>
104 </widget>
105 <widget row="3" column="1" rowspan="1" colspan="2" >
106 <class>QLineEdit</class>
107 <property stdset="1">
108 <name>name</name>
109 <cstring>portLine</cstring>
110 </property>
111 <property>
112 <name>toolTip</name>
113 <string>Port of the SMTP Server</string>
114 </property>
115 </widget>
116 <widget row="0" column="0" >
117 <class>QLabel</class> 56 <class>QLabel</class>
118 <property stdset="1"> 57 <property stdset="1">
119 <name>name</name> 58 <name>name</name>
@@ -124,51 +63,7 @@
124 <string>Account</string> 63 <string>Account</string>
125 </property> 64 </property>
126 </widget> 65 </widget>
127 <widget row="0" column="1" rowspan="1" colspan="2" > 66 <widget row="8" column="2" >
128 <class>QLineEdit</class>
129 <property stdset="1">
130 <name>name</name>
131 <cstring>accountLine</cstring>
132 </property>
133 <property>
134 <name>toolTip</name>
135 <string>Name of the Account</string>
136 </property>
137 </widget>
138 <widget row="1" column="0" rowspan="1" colspan="3" >
139 <class>Line</class>
140 <property stdset="1">
141 <name>name</name>
142 <cstring>line1</cstring>
143 </property>
144 <property stdset="1">
145 <name>orientation</name>
146 <enum>Horizontal</enum>
147 </property>
148 </widget>
149 <widget row="4" column="1" >
150 <class>QCheckBox</class>
151 <property stdset="1">
152 <name>name</name>
153 <cstring>sslBox</cstring>
154 </property>
155 <property stdset="1">
156 <name>text</name>
157 <string>Use SSL</string>
158 </property>
159 </widget>
160 <widget row="5" column="0" rowspan="1" colspan="3" >
161 <class>Line</class>
162 <property stdset="1">
163 <name>name</name>
164 <cstring>line2</cstring>
165 </property>
166 <property stdset="1">
167 <name>orientation</name>
168 <enum>Horizontal</enum>
169 </property>
170 </widget>
171 <widget row="8" column="1" rowspan="1" colspan="2" >
172 <class>QLineEdit</class> 67 <class>QLineEdit</class>
173 <property stdset="1"> 68 <property stdset="1">
174 <name>name</name> 69 <name>name</name>
@@ -183,298 +78,175 @@
183 <enum>Password</enum> 78 <enum>Password</enum>
184 </property> 79 </property>
185 </widget> 80 </widget>
186 <widget row="6" column="1" rowspan="1" colspan="2" > 81 <widget row="4" column="0" rowspan="1" colspan="3" >
187 <class>QCheckBox</class> 82 <class>QCheckBox</class>
188 <property stdset="1"> 83 <property stdset="1">
189 <name>name</name> 84 <name>name</name>
190 <cstring>loginBox</cstring> 85 <cstring>sslBox</cstring>
191 </property>
192 <property stdset="1">
193 <name>text</name>
194 <string>Use Login</string>
195 </property>
196 </widget>
197 <widget row="8" column="0" >
198 <class>QLabel</class>
199 <property stdset="1">
200 <name>name</name>
201 <cstring>passLabel</cstring>
202 </property> 86 </property>
203 <property stdset="1"> 87 <property stdset="1">
204 <name>text</name> 88 <name>text</name>
205 <string>Password</string> 89 <string>Use SSL</string>
206 </property> 90 </property>
207 </widget> 91 </widget>
208 <widget row="7" column="0" > 92 <widget row="6" column="0" rowspan="1" colspan="3" >
209 <class>QLabel</class> 93 <class>QCheckBox</class>
210 <property stdset="1"> 94 <property stdset="1">
211 <name>name</name> 95 <name>name</name>
212 <cstring>userLabel</cstring> 96 <cstring>loginBox</cstring>
213 </property> 97 </property>
214 <property stdset="1"> 98 <property stdset="1">
215 <name>text</name> 99 <name>text</name>
216 <string>User</string> 100 <string>Use Login</string>
217 </property> 101 </property>
218 </widget> 102 </widget>
219 <widget row="7" column="1" rowspan="1" colspan="2" > 103 <widget row="0" column="2" >
220 <class>QLineEdit</class> 104 <class>QLineEdit</class>
221 <property stdset="1"> 105 <property stdset="1">
222 <name>name</name> 106 <name>name</name>
223 <cstring>userLine</cstring> 107 <cstring>accountLine</cstring>
224 </property>
225 <property stdset="1">
226 <name>enabled</name>
227 <bool>false</bool>
228 </property>
229 </widget>
230 <spacer row="9" column="2" >
231 <property>
232 <name>name</name>
233 <cstring>spacer</cstring>
234 </property>
235 <property stdset="1">
236 <name>orientation</name>
237 <enum>Vertical</enum>
238 </property>
239 <property stdset="1">
240 <name>sizeType</name>
241 <enum>Expanding</enum>
242 </property>
243 <property>
244 <name>sizeHint</name>
245 <size>
246 <width>20</width>
247 <height>20</height>
248 </size>
249 </property>
250 </spacer>
251 </grid>
252 </widget>
253 <widget>
254 <class>QWidget</class>
255 <property stdset="1">
256 <name>name</name>
257 <cstring>identityTab</cstring>
258 </property>
259 <attribute>
260 <name>title</name>
261 <string>Identity</string>
262 </attribute>
263 <grid>
264 <property stdset="1">
265 <name>margin</name>
266 <number>4</number>
267 </property>
268 <property stdset="1">
269 <name>spacing</name>
270 <number>3</number>
271 </property>
272 <widget row="9" column="0" rowspan="1" colspan="4" >
273 <class>QMultiLineEdit</class>
274 <property stdset="1">
275 <name>name</name>
276 <cstring>sigMultiLine</cstring>
277 </property>
278 </widget>
279 <spacer row="10" column="3" >
280 <property>
281 <name>name</name>
282 <cstring>Spacer3</cstring>
283 </property>
284 <property stdset="1">
285 <name>orientation</name>
286 <enum>Vertical</enum>
287 </property>
288 <property stdset="1">
289 <name>sizeType</name>
290 <enum>Expanding</enum>
291 </property>
292 <property>
293 <name>sizeHint</name>
294 <size>
295 <width>20</width>
296 <height>20</height>
297 </size>
298 </property> 108 </property>
299 <property> 109 <property>
300 <name>toolTip</name> 110 <name>toolTip</name>
301 <string>Name of the Account</string> 111 <string>Name of the Account</string>
302 </property> 112 </property>
303 </spacer>
304 <widget row="8" column="0" rowspan="1" colspan="3" >
305 <class>QLabel</class>
306 <property stdset="1">
307 <name>name</name>
308 <cstring>sigLabel</cstring>
309 </property>
310 <property stdset="1">
311 <name>text</name>
312 <string>Signature</string>
313 </property>
314 </widget>
315 <widget row="6" column="2" rowspan="1" colspan="2" >
316 <class>QLineEdit</class>
317 <property stdset="1">
318 <name>name</name>
319 <cstring>replyLine</cstring>
320 </property>
321 <property stdset="1">
322 <name>enabled</name>
323 <bool>false</bool>
324 </property>
325 </widget> 113 </widget>
326 <widget row="5" column="2" rowspan="1" colspan="2" > 114 <widget row="2" column="1" rowspan="1" colspan="2" >
327 <class>QLineEdit</class> 115 <class>QLineEdit</class>
328 <property stdset="1"> 116 <property stdset="1">
329 <name>name</name> 117 <name>name</name>
330 <cstring>bccLine</cstring> 118 <cstring>serverLine</cstring>
331 </property> 119 </property>
332 <property stdset="1"> 120 <property>
333 <name>enabled</name> 121 <name>toolTip</name>
334 <bool>false</bool> 122 <string>Name of the SMTP Server</string>
335 </property> 123 </property>
336 </widget> 124 </widget>
337 <widget row="4" column="2" rowspan="1" colspan="2" > 125 <widget row="7" column="2" >
338 <class>QLineEdit</class> 126 <class>QLineEdit</class>
339 <property stdset="1"> 127 <property stdset="1">
340 <name>name</name> 128 <name>name</name>
341 <cstring>ccLine</cstring> 129 <cstring>userLine</cstring>
342 </property> 130 </property>
343 <property stdset="1"> 131 <property stdset="1">
344 <name>enabled</name> 132 <name>enabled</name>
345 <bool>false</bool> 133 <bool>false</bool>
346 </property> 134 </property>
347 </widget> 135 </widget>
348 <widget row="5" column="0" rowspan="1" colspan="2" > 136 <widget row="8" column="0" rowspan="1" colspan="2" >
349 <class>QCheckBox</class> 137 <class>QLabel</class>
350 <property stdset="1">
351 <name>name</name>
352 <cstring>bccBox</cstring>
353 </property>
354 <property stdset="1">
355 <name>text</name>
356 <string>BCC</string>
357 </property>
358 </widget>
359 <widget row="6" column="0" rowspan="1" colspan="2" >
360 <class>QCheckBox</class>
361 <property stdset="1"> 138 <property stdset="1">
362 <name>name</name> 139 <name>name</name>
363 <cstring>replyBox</cstring> 140 <cstring>passLabel</cstring>
364 </property> 141 </property>
365 <property stdset="1"> 142 <property stdset="1">
366 <name>text</name> 143 <name>text</name>
367 <string>Reply-To</string> 144 <string>Password</string>
368 </property> 145 </property>
369 </widget> 146 </widget>
370 <widget row="4" column="0" rowspan="1" colspan="2" > 147 <widget row="3" column="0" >
371 <class>QCheckBox</class> 148 <class>QLabel</class>
372 <property stdset="1"> 149 <property stdset="1">
373 <name>name</name> 150 <name>name</name>
374 <cstring>ccBox</cstring> 151 <cstring>portLabel</cstring>
375 </property> 152 </property>
376 <property stdset="1"> 153 <property stdset="1">
377 <name>text</name> 154 <name>text</name>
378 <string>CC</string> 155 <string>Port</string>
379 </property> 156 </property>
380 </widget> 157 </widget>
381 <widget row="1" column="0" > 158 <widget row="2" column="0" >
382 <class>QLabel</class> 159 <class>QLabel</class>
383 <property stdset="1"> 160 <property stdset="1">
384 <name>name</name> 161 <name>name</name>
385 <cstring>mailLabel</cstring> 162 <cstring>serverLabel</cstring>
386 </property> 163 </property>
387 <property stdset="1"> 164 <property stdset="1">
388 <name>text</name> 165 <name>text</name>
389 <string>E-Mail</string> 166 <string>Server</string>
390 </property> 167 </property>
391 </widget> 168 </widget>
392 <widget row="0" column="1" rowspan="1" colspan="3" > 169 <widget row="3" column="1" rowspan="1" colspan="2" >
393 <class>QLineEdit</class> 170 <class>QLineEdit</class>
394 <property stdset="1"> 171 <property stdset="1">
395 <name>name</name> 172 <name>name</name>
396 <cstring>nameLine</cstring> 173 <cstring>portLine</cstring>
397 </property> 174 </property>
398 <property> 175 <property>
399 <name>toolTip</name> 176 <name>toolTip</name>
400 <string>Your Full Name</string> 177 <string>Port of the SMTP Server</string>
401 </property> 178 </property>
402 </widget> 179 </widget>
403 <widget row="0" column="0" > 180 <widget row="1" column="0" rowspan="1" colspan="3" >
404 <class>QLabel</class> 181 <class>Line</class>
405 <property stdset="1"> 182 <property stdset="1">
406 <name>name</name> 183 <name>name</name>
407 <cstring>nameLabel</cstring> 184 <cstring>line1</cstring>
408 </property> 185 </property>
409 <property stdset="1"> 186 <property stdset="1">
410 <name>text</name> 187 <name>sizePolicy</name>
411 <string>Name</string> 188 <sizepolicy>
189 <hsizetype>3</hsizetype>
190 <vsizetype>0</vsizetype>
191 </sizepolicy>
192 </property>
193 <property stdset="1">
194 <name>orientation</name>
195 <enum>Horizontal</enum>
412 </property> 196 </property>
413 </widget> 197 </widget>
414 <widget row="2" column="0" > 198 <widget row="7" column="0" rowspan="1" colspan="2" >
415 <class>QLabel</class> 199 <class>QLabel</class>
416 <property stdset="1"> 200 <property stdset="1">
417 <name>name</name> 201 <name>name</name>
418 <cstring>orgLabel</cstring> 202 <cstring>userLabel</cstring>
419 </property> 203 </property>
420 <property stdset="1"> 204 <property stdset="1">
421 <name>text</name> 205 <name>text</name>
422 <string>Org.</string> 206 <string>User</string>
423 </property>
424 <property>
425 <name>layoutMargin</name>
426 </property>
427 <property>
428 <name>layoutSpacing</name>
429 </property>
430 </widget>
431 <widget row="2" column="1" rowspan="1" colspan="3" >
432 <class>QLineEdit</class>
433 <property stdset="1">
434 <name>name</name>
435 <cstring>orgLine</cstring>
436 </property>
437 <property>
438 <name>toolTip</name>
439 <string>Your Organisation</string>
440 </property> 207 </property>
441 </widget> 208 </widget>
442 <widget row="1" column="1" rowspan="1" colspan="3" > 209 <widget row="5" column="0" rowspan="1" colspan="3" >
443 <class>QLineEdit</class> 210 <class>Line</class>
444 <property stdset="1"> 211 <property stdset="1">
445 <name>name</name> 212 <name>name</name>
446 <cstring>mailLine</cstring> 213 <cstring>line2</cstring>
447 </property>
448 <property>
449 <name>toolTip</name>
450 <string>Your E-Mail Adress</string>
451 </property> 214 </property>
452 </widget>
453 <widget row="3" column="0" rowspan="1" colspan="4" >
454 <class>Line</class>
455 <property stdset="1"> 215 <property stdset="1">
456 <name>name</name> 216 <name>sizePolicy</name>
457 <cstring>line3</cstring> 217 <sizepolicy>
218 <hsizetype>3</hsizetype>
219 <vsizetype>0</vsizetype>
220 </sizepolicy>
458 </property> 221 </property>
459 <property stdset="1"> 222 <property stdset="1">
460 <name>orientation</name> 223 <name>orientation</name>
461 <enum>Horizontal</enum> 224 <enum>Horizontal</enum>
462 </property> 225 </property>
463 </widget> 226 </widget>
464 <widget row="7" column="0" rowspan="1" colspan="4" > 227 </grid>
465 <class>Line</class> 228 </widget>
466 <property stdset="1"> 229 <spacer>
230 <property>
467 <name>name</name> 231 <name>name</name>
468 <cstring>line4</cstring> 232 <cstring>spacer</cstring>
469 </property> 233 </property>
470 <property stdset="1"> 234 <property stdset="1">
471 <name>orientation</name> 235 <name>orientation</name>
472 <enum>Horizontal</enum> 236 <enum>Vertical</enum>
473 </property> 237 </property>
474 </widget> 238 <property stdset="1">
475 </grid> 239 <name>sizeType</name>
476 </widget> 240 <enum>Expanding</enum>
477 </widget> 241 </property>
242 <property>
243 <name>sizeHint</name>
244 <size>
245 <width>20</width>
246 <height>20</height>
247 </size>
248 </property>
249 </spacer>
478 </vbox> 250 </vbox>
479</widget> 251</widget>
480<tabstops> 252<tabstops>
@@ -485,16 +257,5 @@
485 <tabstop>loginBox</tabstop> 257 <tabstop>loginBox</tabstop>
486 <tabstop>userLine</tabstop> 258 <tabstop>userLine</tabstop>
487 <tabstop>passLine</tabstop> 259 <tabstop>passLine</tabstop>
488 <tabstop>smtpTab</tabstop>
489 <tabstop>nameLine</tabstop>
490 <tabstop>mailLine</tabstop>
491 <tabstop>orgLine</tabstop>
492 <tabstop>ccBox</tabstop>
493 <tabstop>ccLine</tabstop>
494 <tabstop>bccBox</tabstop>
495 <tabstop>bccLine</tabstop>
496 <tabstop>replyBox</tabstop>
497 <tabstop>replyLine</tabstop>
498 <tabstop>sigMultiLine</tabstop>
499</tabstops> 260</tabstops>
500</UI> 261</UI>
diff --git a/noncore/net/mail/smtpwrapper.cpp b/noncore/net/mail/smtpwrapper.cpp
index 521cd0a..30c0707 100644
--- a/noncore/net/mail/smtpwrapper.cpp
+++ b/noncore/net/mail/smtpwrapper.cpp
@@ -128,9 +128,9 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail )
128{ 128{
129 mailimf_fields *fields; 129 mailimf_fields *fields;
130 mailimf_field *xmailer; 130 mailimf_field *xmailer;
131 mailimf_mailbox *sender, *fromBox; 131 mailimf_mailbox *sender=0,*fromBox=0;
132 mailimf_mailbox_list *from; 132 mailimf_mailbox_list *from=0;
133 mailimf_address_list *to, *cc, *bcc, *reply; 133 mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0;
134 char *subject = strdup( mail.getSubject().latin1() ); 134 char *subject = strdup( mail.getSubject().latin1() );
135 int err; 135 int err;
136 136
@@ -167,22 +167,22 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail )
167 return fields; // Success :) 167 return fields; // Success :)
168 168
169err_free_xmailer: 169err_free_xmailer:
170 mailimf_field_free( xmailer ); 170 if (xmailer) mailimf_field_free( xmailer );
171err_free_fields: 171err_free_fields:
172 mailimf_fields_free( fields ); 172 if (fields) mailimf_fields_free( fields );
173err_free_reply: 173err_free_reply:
174 mailimf_address_list_free( reply ); 174 if (reply) mailimf_address_list_free( reply );
175 mailimf_address_list_free( bcc ); 175 if (bcc) mailimf_address_list_free( bcc );
176 mailimf_address_list_free( cc ); 176 if (cc) mailimf_address_list_free( cc );
177 mailimf_address_list_free( to ); 177 if (to) mailimf_address_list_free( to );
178err_free_from: 178err_free_from:
179 mailimf_mailbox_list_free( from ); 179 if (from) mailimf_mailbox_list_free( from );
180err_free_fromBox: 180err_free_fromBox:
181 mailimf_mailbox_free( fromBox ); 181 mailimf_mailbox_free( fromBox );
182err_free_sender: 182err_free_sender:
183 mailimf_mailbox_free( sender ); 183 if (sender) mailimf_mailbox_free( sender );
184err_free: 184err_free:
185 free( subject ); 185 if (subject) free( subject );
186 qDebug( "createImfFields - error" ); 186 qDebug( "createImfFields - error" );
187 187
188 return NULL; // Error :( 188 return NULL; // Error :(
@@ -206,7 +206,7 @@ mailmime *SMTPwrapper::buildTxtPart(const QString&str )
206 err = clist_append( content->ct_parameters, param ); 206 err = clist_append( content->ct_parameters, param );
207 if ( err != MAILIMF_NO_ERROR ) goto err_free_content; 207 if ( err != MAILIMF_NO_ERROR ) goto err_free_content;
208 208
209 fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_QUOTED_PRINTABLE); 209 fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT);
210 if ( fields == NULL ) goto err_free_content; 210 if ( fields == NULL ) goto err_free_content;
211 211
212 txtPart = mailmime_new_empty( content, fields ); 212 txtPart = mailmime_new_empty( content, fields );
@@ -462,26 +462,6 @@ char *SMTPwrapper::getFrom( mailmime *mail )
462 return getFrom(ffrom); 462 return getFrom(ffrom);
463} 463}
464 464
465SMTPaccount *SMTPwrapper::getAccount(const QString&name )
466{
467 SMTPaccount *smtp;
468
469 QList<Account> list = settings->getAccounts();
470 Account *it;
471 for ( it = list.first(); it; it = list.next() ) {
472 if ( it->getType().compare( "SMTP" ) == 0 ) {
473 smtp = static_cast<SMTPaccount *>(it);
474 if ( smtp->getName()== name ) {
475 qDebug( "SMTPaccount found for" );
476 qDebug( name );
477 return smtp;
478 }
479 }
480 }
481
482 return NULL;
483}
484
485void SMTPwrapper::progress( size_t current, size_t maximum ) 465void SMTPwrapper::progress( size_t current, size_t maximum )
486{ 466{
487 if (SMTPwrapper::sendProgress) { 467 if (SMTPwrapper::sendProgress) {
@@ -613,12 +593,16 @@ free_mem:
613 return result; 593 return result;
614} 594}
615 595
616void SMTPwrapper::sendMail(const Mail&mail,bool later ) 596void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later )
617{ 597{
618 mailmime * mimeMail; 598 mailmime * mimeMail;
619 599
620 SMTPaccount *smtp = getAccount(mail.getName()); 600 SMTPaccount *smtp = aSmtp;
621 601
602 if (!later && !smtp) {
603 qDebug("Didn't get any send method - giving up");
604 return;
605 }
622 mimeMail = createMimeMail(mail ); 606 mimeMail = createMimeMail(mail );
623 if ( mimeMail == NULL ) { 607 if ( mimeMail == NULL ) {
624 qDebug( "sendMail: error creating mime mail" ); 608 qDebug( "sendMail: error creating mime mail" );
diff --git a/noncore/net/mail/smtpwrapper.h b/noncore/net/mail/smtpwrapper.h
index f734fa4..0535983 100644
--- a/noncore/net/mail/smtpwrapper.h
+++ b/noncore/net/mail/smtpwrapper.h
@@ -27,7 +27,7 @@ class SMTPwrapper : public QObject
27public: 27public:
28 SMTPwrapper( Settings *s ); 28 SMTPwrapper( Settings *s );
29 virtual ~SMTPwrapper(){} 29 virtual ~SMTPwrapper(){}
30 void sendMail(const Mail& mail,bool later=false ); 30 void sendMail(const Mail& mail,SMTPaccount*smtp,bool later=false );
31 bool flushOutbox(SMTPaccount*smtp); 31 bool flushOutbox(SMTPaccount*smtp);
32 32
33 static progressMailSend*sendProgress; 33 static progressMailSend*sendProgress;
@@ -42,7 +42,6 @@ protected:
42 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); 42 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content);
43 void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ); 43 void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp );
44 clist *createRcptList( mailimf_fields *fields ); 44 clist *createRcptList( mailimf_fields *fields );
45 SMTPaccount *getAccount(const QString&from );
46 45
47 static void storeMail(char*mail, size_t length, const QString&box); 46 static void storeMail(char*mail, size_t length, const QString&box);
48 static QString mailsmtpError( int err ); 47 static QString mailsmtpError( int err );