summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/addresspicker.cpp2
-rw-r--r--noncore/net/mail/composemail.cpp50
-rw-r--r--noncore/net/mail/composemailui.ui268
-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.ui637
-rw-r--r--noncore/net/mail/smtpwrapper.cpp54
-rw-r--r--noncore/net/mail/smtpwrapper.h3
13 files changed, 482 insertions, 702 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,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
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,22 +28,67 @@
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>QCheckBox</class> 38 <class>QLayoutWidget</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>checkBoxLater</cstring> 41 <cstring>Layout4</cstring>
42 </property> 42 </property>
43 <property stdset="1"> 43 <property>
44 <name>text</name> 44 <name>layoutSpacing</name>
45 <string>send later</string>
46 </property> 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" >
56 <class>QCheckBox</class>
57 <property stdset="1">
58 <name>name</name>
59 <cstring>checkBoxLater</cstring>
60 </property>
61 <property stdset="1">
62 <name>text</name>
63 <string>send later</string>
64 </property>
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>
47 </widget> 92 </widget>
48 <widget> 93 <widget>
49 <class>QTabWidget</class> 94 <class>QTabWidget</class>
@@ -67,77 +112,174 @@
67 <name>title</name> 112 <name>title</name>
68 <string>Mail</string> 113 <string>Mail</string>
69 </attribute> 114 </attribute>
70 <grid> 115 <vbox>
71 <property stdset="1"> 116 <property stdset="1">
72 <name>margin</name> 117 <name>margin</name>
73 <number>-1</number> 118 <number>1</number>
74 </property> 119 </property>
75 <property stdset="1"> 120 <property stdset="1">
76 <name>spacing</name> 121 <name>spacing</name>
77 <number>-1</number> 122 <number>1</number>
78 </property> 123 </property>
79 <widget row="2" column="1" > 124 <widget>
80 <class>QLineEdit</class> 125 <class>QLayoutWidget</class>
81 <property stdset="1"> 126 <property stdset="1">
82 <name>name</name> 127 <name>name</name>
83 <cstring>subjectLine</cstring> 128 <cstring>Layout10</cstring>
84 </property> 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>
151 <grid>
152 <property stdset="1">
153 <name>margin</name>
154 <number>0</number>
155 </property>
156 <property stdset="1">
157 <name>spacing</name>
158 <number>3</number>
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>
212 <widget row="2" column="1" >
213 <class>QLineEdit</class>
214 <property stdset="1">
215 <name>name</name>
216 <cstring>subjectLine</cstring>
217 </property>
218 <property stdset="1">
219 <name>sizePolicy</name>
220 <sizepolicy>
221 <hsizetype>3</hsizetype>
222 <vsizetype>0</vsizetype>
223 </sizepolicy>
224 </property>
225 </widget>
226 <widget row="1" column="1" >
227 <class>QLineEdit</class>
228 <property stdset="1">
229 <name>name</name>
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>
238 </property>
239 </widget>
240 <widget row="2" column="0" >
241 <class>QLabel</class>
242 <property stdset="1">
243 <name>name</name>
244 <cstring>subjectLabel</cstring>
245 </property>
246 <property stdset="1">
247 <name>text</name>
248 <string>Subject</string>
249 </property>
250 </widget>
251 <widget row="0" column="0" >
252 <class>QLabel</class>
253 <property stdset="1">
254 <name>name</name>
255 <cstring>fromLabel</cstring>
256 </property>
257 <property stdset="1">
258 <name>text</name>
259 <string>From</string>
260 </property>
261 </widget>
262 <widget row="1" column="0" >
263 <class>QPushButton</class>
264 <property stdset="1">
265 <name>name</name>
266 <cstring>toButton</cstring>
267 </property>
268 <property stdset="1">
269 <name>text</name>
270 <string>To</string>
271 </property>
272 </widget>
273 </grid>
85 </widget> 274 </widget>
86 <widget row="3" column="0" rowspan="1" colspan="2" > 275 <widget>
87 <class>QMultiLineEdit</class> 276 <class>QMultiLineEdit</class>
88 <property stdset="1"> 277 <property stdset="1">
89 <name>name</name> 278 <name>name</name>
90 <cstring>message</cstring> 279 <cstring>message</cstring>
91 </property> 280 </property>
92 </widget> 281 </widget>
93 <widget row="2" column="0" > 282 </vbox>
94 <class>QLabel</class>
95 <property stdset="1">
96 <name>name</name>
97 <cstring>subjectLabel</cstring>
98 </property>
99 <property stdset="1">
100 <name>text</name>
101 <string>Subject</string>
102 </property>
103 </widget>
104 <widget row="0" column="0" >
105 <class>QLabel</class>
106 <property stdset="1">
107 <name>name</name>
108 <cstring>fromLabel</cstring>
109 </property>
110 <property stdset="1">
111 <name>text</name>
112 <string>From</string>
113 </property>
114 </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" >
130 <class>QPushButton</class>
131 <property stdset="1">
132 <name>name</name>
133 <cstring>toButton</cstring>
134 </property>
135 <property stdset="1">
136 <name>text</name>
137 <string>To</string>
138 </property>
139 </widget>
140 </grid>
141 </widget> 283 </widget>
142 <widget> 284 <widget>
143 <class>QWidget</class> 285 <class>QWidget</class>
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,453 +28,225 @@
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> 46 <grid>
54 <class>QWidget</class>
55 <property stdset="1"> 47 <property stdset="1">
56 <name>name</name> 48 <name>margin</name>
57 <cstring>serverTab</cstring> 49 <number>0</number>
58 </property> 50 </property>
59 <attribute> 51 <property stdset="1">
60 <name>title</name> 52 <name>spacing</name>
61 <string>Server</string> 53 <number>2</number>
62 </attribute> 54 </property>
63 <grid> 55 <widget row="0" column="0" rowspan="1" colspan="2" >
56 <class>QLabel</class>
64 <property stdset="1"> 57 <property stdset="1">
65 <name>margin</name> 58 <name>name</name>
66 <number>4</number> 59 <cstring>accountLabel</cstring>
67 </property> 60 </property>
68 <property stdset="1"> 61 <property stdset="1">
69 <name>spacing</name> 62 <name>text</name>
70 <number>3</number> 63 <string>Account</string>
64 </property>
65 </widget>
66 <widget row="8" column="2" >
67 <class>QLineEdit</class>
68 <property stdset="1">
69 <name>name</name>
70 <cstring>passLine</cstring>
71 </property>
72 <property stdset="1">
73 <name>enabled</name>
74 <bool>false</bool>
75 </property>
76 <property stdset="1">
77 <name>echoMode</name>
78 <enum>Password</enum>
79 </property>
80 </widget>
81 <widget row="4" column="0" rowspan="1" colspan="3" >
82 <class>QCheckBox</class>
83 <property stdset="1">
84 <name>name</name>
85 <cstring>sslBox</cstring>
86 </property>
87 <property stdset="1">
88 <name>text</name>
89 <string>Use SSL</string>
90 </property>
91 </widget>
92 <widget row="6" column="0" rowspan="1" colspan="3" >
93 <class>QCheckBox</class>
94 <property stdset="1">
95 <name>name</name>
96 <cstring>loginBox</cstring>
97 </property>
98 <property stdset="1">
99 <name>text</name>
100 <string>Use Login</string>
101 </property>
102 </widget>
103 <widget row="0" column="2" >
104 <class>QLineEdit</class>
105 <property stdset="1">
106 <name>name</name>
107 <cstring>accountLine</cstring>
108 </property>
109 <property>
110 <name>toolTip</name>
111 <string>Name of the Account</string>
112 </property>
113 </widget>
114 <widget row="2" column="1" rowspan="1" colspan="2" >
115 <class>QLineEdit</class>
116 <property stdset="1">
117 <name>name</name>
118 <cstring>serverLine</cstring>
119 </property>
120 <property>
121 <name>toolTip</name>
122 <string>Name of the SMTP Server</string>
123 </property>
124 </widget>
125 <widget row="7" column="2" >
126 <class>QLineEdit</class>
127 <property stdset="1">
128 <name>name</name>
129 <cstring>userLine</cstring>
130 </property>
131 <property stdset="1">
132 <name>enabled</name>
133 <bool>false</bool>
134 </property>
135 </widget>
136 <widget row="8" column="0" rowspan="1" colspan="2" >
137 <class>QLabel</class>
138 <property stdset="1">
139 <name>name</name>
140 <cstring>passLabel</cstring>
71 </property> 141 </property>
72 <widget row="3" column="0" >
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>
118 <property stdset="1">
119 <name>name</name>
120 <cstring>accountLabel</cstring>
121 </property>
122 <property stdset="1">
123 <name>text</name>
124 <string>Account</string>
125 </property>
126 </widget>
127 <widget row="0" column="1" rowspan="1" colspan="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>
173 <property stdset="1">
174 <name>name</name>
175 <cstring>passLine</cstring>
176 </property>
177 <property stdset="1">
178 <name>enabled</name>
179 <bool>false</bool>
180 </property>
181 <property stdset="1">
182 <name>echoMode</name>
183 <enum>Password</enum>
184 </property>
185 </widget>
186 <widget row="6" column="1" rowspan="1" colspan="2" >
187 <class>QCheckBox</class>
188 <property stdset="1">
189 <name>name</name>
190 <cstring>loginBox</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>
203 <property stdset="1">
204 <name>text</name>
205 <string>Password</string>
206 </property>
207 </widget>
208 <widget row="7" column="0" >
209 <class>QLabel</class>
210 <property stdset="1">
211 <name>name</name>
212 <cstring>userLabel</cstring>
213 </property>
214 <property stdset="1">
215 <name>text</name>
216 <string>User</string>
217 </property>
218 </widget>
219 <widget row="7" column="1" rowspan="1" colspan="2" >
220 <class>QLineEdit</class>
221 <property stdset="1">
222 <name>name</name>
223 <cstring>userLine</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"> 142 <property stdset="1">
265 <name>margin</name> 143 <name>text</name>
266 <number>4</number> 144 <string>Password</string>
267 </property> 145 </property>
146 </widget>
147 <widget row="3" column="0" >
148 <class>QLabel</class>
268 <property stdset="1"> 149 <property stdset="1">
269 <name>spacing</name> 150 <name>name</name>
270 <number>3</number> 151 <cstring>portLabel</cstring>
271 </property> 152 </property>
272 <widget row="9" column="0" rowspan="1" colspan="4" > 153 <property stdset="1">
273 <class>QMultiLineEdit</class> 154 <name>text</name>
274 <property stdset="1"> 155 <string>Port</string>
275 <name>name</name> 156 </property>
276 <cstring>sigMultiLine</cstring> 157 </widget>
277 </property> 158 <widget row="2" column="0" >
278 </widget> 159 <class>QLabel</class>
279 <spacer row="10" column="3" > 160 <property stdset="1">
280 <property> 161 <name>name</name>
281 <name>name</name> 162 <cstring>serverLabel</cstring>
282 <cstring>Spacer3</cstring> 163 </property>
283 </property> 164 <property stdset="1">
284 <property stdset="1"> 165 <name>text</name>
285 <name>orientation</name> 166 <string>Server</string>
286 <enum>Vertical</enum> 167 </property>
287 </property> 168 </widget>
288 <property stdset="1"> 169 <widget row="3" column="1" rowspan="1" colspan="2" >
289 <name>sizeType</name> 170 <class>QLineEdit</class>
290 <enum>Expanding</enum> 171 <property stdset="1">
291 </property> 172 <name>name</name>
292 <property> 173 <cstring>portLine</cstring>
293 <name>sizeHint</name> 174 </property>
294 <size> 175 <property>
295 <width>20</width> 176 <name>toolTip</name>
296 <height>20</height> 177 <string>Port of the SMTP Server</string>
297 </size> 178 </property>
298 </property> 179 </widget>
299 <property> 180 <widget row="1" column="0" rowspan="1" colspan="3" >
300 <name>toolTip</name> 181 <class>Line</class>
301 <string>Name of the Account</string> 182 <property stdset="1">
302 </property> 183 <name>name</name>
303 </spacer> 184 <cstring>line1</cstring>
304 <widget row="8" column="0" rowspan="1" colspan="3" > 185 </property>
305 <class>QLabel</class> 186 <property stdset="1">
306 <property stdset="1"> 187 <name>sizePolicy</name>
307 <name>name</name> 188 <sizepolicy>
308 <cstring>sigLabel</cstring> 189 <hsizetype>3</hsizetype>
309 </property> 190 <vsizetype>0</vsizetype>
310 <property stdset="1"> 191 </sizepolicy>
311 <name>text</name> 192 </property>
312 <string>Signature</string> 193 <property stdset="1">
313 </property> 194 <name>orientation</name>
314 </widget> 195 <enum>Horizontal</enum>
315 <widget row="6" column="2" rowspan="1" colspan="2" > 196 </property>
316 <class>QLineEdit</class> 197 </widget>
317 <property stdset="1"> 198 <widget row="7" column="0" rowspan="1" colspan="2" >
318 <name>name</name> 199 <class>QLabel</class>
319 <cstring>replyLine</cstring> 200 <property stdset="1">
320 </property> 201 <name>name</name>
321 <property stdset="1"> 202 <cstring>userLabel</cstring>
322 <name>enabled</name> 203 </property>
323 <bool>false</bool> 204 <property stdset="1">
324 </property> 205 <name>text</name>
325 </widget> 206 <string>User</string>
326 <widget row="5" column="2" rowspan="1" colspan="2" > 207 </property>
327 <class>QLineEdit</class> 208 </widget>
328 <property stdset="1"> 209 <widget row="5" column="0" rowspan="1" colspan="3" >
329 <name>name</name> 210 <class>Line</class>
330 <cstring>bccLine</cstring> 211 <property stdset="1">
331 </property> 212 <name>name</name>
332 <property stdset="1"> 213 <cstring>line2</cstring>
333 <name>enabled</name> 214 </property>
334 <bool>false</bool> 215 <property stdset="1">
335 </property> 216 <name>sizePolicy</name>
336 </widget> 217 <sizepolicy>
337 <widget row="4" column="2" rowspan="1" colspan="2" > 218 <hsizetype>3</hsizetype>
338 <class>QLineEdit</class> 219 <vsizetype>0</vsizetype>
339 <property stdset="1"> 220 </sizepolicy>
340 <name>name</name> 221 </property>
341 <cstring>ccLine</cstring> 222 <property stdset="1">
342 </property> 223 <name>orientation</name>
343 <property stdset="1"> 224 <enum>Horizontal</enum>
344 <name>enabled</name> 225 </property>
345 <bool>false</bool> 226 </widget>
346 </property> 227 </grid>
347 </widget>
348 <widget row="5" column="0" rowspan="1" colspan="2" >
349 <class>QCheckBox</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">
362 <name>name</name>
363 <cstring>replyBox</cstring>
364 </property>
365 <property stdset="1">
366 <name>text</name>
367 <string>Reply-To</string>
368 </property>
369 </widget>
370 <widget row="4" column="0" rowspan="1" colspan="2" >
371 <class>QCheckBox</class>
372 <property stdset="1">
373 <name>name</name>
374 <cstring>ccBox</cstring>
375 </property>
376 <property stdset="1">
377 <name>text</name>
378 <string>CC</string>
379 </property>
380 </widget>
381 <widget row="1" column="0" >
382 <class>QLabel</class>
383 <property stdset="1">
384 <name>name</name>
385 <cstring>mailLabel</cstring>
386 </property>
387 <property stdset="1">
388 <name>text</name>
389 <string>E-Mail</string>
390 </property>
391 </widget>
392 <widget row="0" column="1" rowspan="1" colspan="3" >
393 <class>QLineEdit</class>
394 <property stdset="1">
395 <name>name</name>
396 <cstring>nameLine</cstring>
397 </property>
398 <property>
399 <name>toolTip</name>
400 <string>Your Full Name</string>
401 </property>
402 </widget>
403 <widget row="0" column="0" >
404 <class>QLabel</class>
405 <property stdset="1">
406 <name>name</name>
407 <cstring>nameLabel</cstring>
408 </property>
409 <property stdset="1">
410 <name>text</name>
411 <string>Name</string>
412 </property>
413 </widget>
414 <widget row="2" column="0" >
415 <class>QLabel</class>
416 <property stdset="1">
417 <name>name</name>
418 <cstring>orgLabel</cstring>
419 </property>
420 <property stdset="1">
421 <name>text</name>
422 <string>Org.</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>
441 </widget>
442 <widget row="1" column="1" rowspan="1" colspan="3" >
443 <class>QLineEdit</class>
444 <property stdset="1">
445 <name>name</name>
446 <cstring>mailLine</cstring>
447 </property>
448 <property>
449 <name>toolTip</name>
450 <string>Your E-Mail Adress</string>
451 </property>
452 </widget>
453 <widget row="3" column="0" rowspan="1" colspan="4" >
454 <class>Line</class>
455 <property stdset="1">
456 <name>name</name>
457 <cstring>line3</cstring>
458 </property>
459 <property stdset="1">
460 <name>orientation</name>
461 <enum>Horizontal</enum>
462 </property>
463 </widget>
464 <widget row="7" column="0" rowspan="1" colspan="4" >
465 <class>Line</class>
466 <property stdset="1">
467 <name>name</name>
468 <cstring>line4</cstring>
469 </property>
470 <property stdset="1">
471 <name>orientation</name>
472 <enum>Horizontal</enum>
473 </property>
474 </widget>
475 </grid>
476 </widget>
477 </widget> 228 </widget>
229 <spacer>
230 <property>
231 <name>name</name>
232 <cstring>spacer</cstring>
233 </property>
234 <property stdset="1">
235 <name>orientation</name>
236 <enum>Vertical</enum>
237 </property>
238 <property stdset="1">
239 <name>sizeType</name>
240 <enum>Expanding</enum>
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 );