author | harlekin <harlekin> | 2004-01-08 22:00:28 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-01-08 22:00:28 (UTC) |
commit | 96f44572cb3ac54a685515694d6c095101df9365 (patch) (unidiff) | |
tree | 5b2aa1b30990dee38df43f51478dc58b0c62d6d5 | |
parent | fb30e3e116d8616cb05b3765ae1aed5f7e96c74e (diff) | |
download | opie-96f44572cb3ac54a685515694d6c095101df9365.zip opie-96f44572cb3ac54a685515694d6c095101df9365.tar.gz opie-96f44572cb3ac54a685515694d6c095101df9365.tar.bz2 |
more smtp settings
-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 22 | ||||
-rw-r--r-- | noncore/net/mail/editaccounts.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 308 | ||||
-rw-r--r-- | noncore/net/mail/smtpconfigui.ui | 433 |
5 files changed, 459 insertions, 310 deletions
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index 0c0ecaf..9fc97e8 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp | |||
@@ -341,93 +341,103 @@ void POP3config::fillValues() | |||
341 | portLine->setText( data->getPort() ); | 341 | portLine->setText( data->getPort() ); |
342 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 342 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
343 | userLine->setText( data->getUser() ); | 343 | userLine->setText( data->getUser() ); |
344 | passLine->setText( data->getPassword() ); | 344 | passLine->setText( data->getPassword() ); |
345 | } | 345 | } |
346 | 346 | ||
347 | void POP3config::accept() | 347 | void POP3config::accept() |
348 | { | 348 | { |
349 | data->setAccountName( accountLine->text() ); | 349 | data->setAccountName( accountLine->text() ); |
350 | data->setServer( serverLine->text() ); | 350 | data->setServer( serverLine->text() ); |
351 | data->setPort( portLine->text() ); | 351 | data->setPort( portLine->text() ); |
352 | data->setConnectionType( ComboBox1->currentItem() ); | 352 | data->setConnectionType( ComboBox1->currentItem() ); |
353 | data->setUser( userLine->text() ); | 353 | data->setUser( userLine->text() ); |
354 | data->setPassword( passLine->text() ); | 354 | data->setPassword( passLine->text() ); |
355 | 355 | ||
356 | QDialog::accept(); | 356 | QDialog::accept(); |
357 | } | 357 | } |
358 | 358 | ||
359 | /** | 359 | /** |
360 | * SMTPconfig | 360 | * SMTPconfig |
361 | */ | 361 | */ |
362 | 362 | ||
363 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 363 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
364 | : SMTPconfigUI( parent, name, modal, flags ) | 364 | : SMTPconfigUI( parent, name, modal, flags ) |
365 | { | 365 | { |
366 | data = account; | 366 | data = account; |
367 | 367 | ||
368 | connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); | 368 | connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); |
369 | connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); | 369 | connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); |
370 | 370 | ||
371 | fillValues(); | 371 | fillValues(); |
372 | 372 | ||
373 | connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) ); | 373 | connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) ); |
374 | ComboBox1->insertItem( "Only if available", 0 ); | ||
375 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | ||
376 | ComboBox1->insertItem( "Connect on secure port", 2 ); | ||
377 | ComboBox1->insertItem( "Run command instead", 3 ); | ||
378 | CommandEdit->hide(); | ||
379 | ComboBox1->setCurrentItem( data->ConnectionType() ); | ||
374 | } | 380 | } |
375 | 381 | ||
376 | void SMTPconfig::slotSSL( bool enabled ) | 382 | void SMTPconfig::slotConnectionToggle( int index ) |
377 | { | 383 | { |
378 | if ( enabled ) { | 384 | // 2 is ssl connection |
379 | portLine->setText( SMTP_SSL_PORT ); | 385 | if ( index == 2 ) { |
386 | portLine->setText( SMTP_SSL_PORT ); | ||
387 | } else if ( index == 3 ) { | ||
388 | portLine->setText( SMTP_PORT ); | ||
389 | CommandEdit->show(); | ||
380 | } else { | 390 | } else { |
381 | portLine->setText( SMTP_PORT ); | 391 | portLine->setText( SMTP_PORT ); |
382 | } | 392 | } |
383 | } | 393 | } |
384 | 394 | ||
385 | void SMTPconfig::fillValues() | 395 | void SMTPconfig::fillValues() |
386 | { | 396 | { |
387 | accountLine->setText( data->getAccountName() ); | 397 | accountLine->setText( data->getAccountName() ); |
388 | serverLine->setText( data->getServer() ); | 398 | serverLine->setText( data->getServer() ); |
389 | portLine->setText( data->getPort() ); | 399 | portLine->setText( data->getPort() ); |
390 | sslBox->setChecked( data->getSSL() ); | 400 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
391 | loginBox->setChecked( data->getLogin() ); | 401 | loginBox->setChecked( data->getLogin() ); |
392 | userLine->setText( data->getUser() ); | 402 | userLine->setText( data->getUser() ); |
393 | passLine->setText( data->getPassword() ); | 403 | passLine->setText( data->getPassword() ); |
394 | } | 404 | } |
395 | 405 | ||
396 | void SMTPconfig::accept() | 406 | void SMTPconfig::accept() |
397 | { | 407 | { |
398 | data->setAccountName( accountLine->text() ); | 408 | data->setAccountName( accountLine->text() ); |
399 | data->setServer( serverLine->text() ); | 409 | data->setServer( serverLine->text() ); |
400 | data->setPort( portLine->text() ); | 410 | data->setPort( portLine->text() ); |
401 | data->setSSL( sslBox->isChecked() ); | 411 | data->setConnectionType( ComboBox1->currentItem() ); |
402 | data->setLogin( loginBox->isChecked() ); | 412 | data->setLogin( loginBox->isChecked() ); |
403 | data->setUser( userLine->text() ); | 413 | data->setUser( userLine->text() ); |
404 | data->setPassword( passLine->text() ); | 414 | data->setPassword( passLine->text() ); |
405 | 415 | ||
406 | QDialog::accept(); | 416 | QDialog::accept(); |
407 | } | 417 | } |
408 | 418 | ||
409 | /** | 419 | /** |
410 | * NNTPconfig | 420 | * NNTPconfig |
411 | */ | 421 | */ |
412 | 422 | ||
413 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 423 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
414 | : NNTPconfigUI( parent, name, modal, flags ) | 424 | : NNTPconfigUI( parent, name, modal, flags ) |
415 | { | 425 | { |
416 | data = account; | 426 | data = account; |
417 | 427 | ||
418 | connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); | 428 | connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); |
419 | connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); | 429 | connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); |
420 | 430 | ||
421 | fillValues(); | 431 | fillValues(); |
422 | 432 | ||
423 | connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) ); | 433 | connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) ); |
424 | } | 434 | } |
425 | 435 | ||
426 | void NNTPconfig::slotSSL( bool enabled ) | 436 | void NNTPconfig::slotSSL( bool enabled ) |
427 | { | 437 | { |
428 | if ( enabled ) { | 438 | if ( enabled ) { |
429 | portLine->setText( NNTP_SSL_PORT ); | 439 | portLine->setText( NNTP_SSL_PORT ); |
430 | } else { | 440 | } else { |
431 | portLine->setText( NNTP_PORT ); | 441 | portLine->setText( NNTP_PORT ); |
432 | } | 442 | } |
433 | } | 443 | } |
diff --git a/noncore/net/mail/editaccounts.h b/noncore/net/mail/editaccounts.h index fb4be71..d51e299 100644 --- a/noncore/net/mail/editaccounts.h +++ b/noncore/net/mail/editaccounts.h | |||
@@ -85,63 +85,63 @@ protected slots: | |||
85 | private: | 85 | private: |
86 | IMAPaccount *data; | 86 | IMAPaccount *data; |
87 | 87 | ||
88 | }; | 88 | }; |
89 | 89 | ||
90 | class POP3config : public POP3configUI | 90 | class POP3config : public POP3configUI |
91 | { | 91 | { |
92 | Q_OBJECT | 92 | Q_OBJECT |
93 | 93 | ||
94 | public: | 94 | public: |
95 | POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 95 | POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); |
96 | 96 | ||
97 | public slots: | 97 | public slots: |
98 | void fillValues(); | 98 | void fillValues(); |
99 | 99 | ||
100 | protected slots: | 100 | protected slots: |
101 | void slotConnectionToggle( int index ); | 101 | void slotConnectionToggle( int index ); |
102 | void accept(); | 102 | void accept(); |
103 | 103 | ||
104 | private: | 104 | private: |
105 | POP3account *data; | 105 | POP3account *data; |
106 | 106 | ||
107 | }; | 107 | }; |
108 | 108 | ||
109 | class SMTPconfig : public SMTPconfigUI | 109 | class SMTPconfig : public SMTPconfigUI |
110 | { | 110 | { |
111 | Q_OBJECT | 111 | Q_OBJECT |
112 | 112 | ||
113 | public: | 113 | public: |
114 | SMTPconfig( SMTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 114 | SMTPconfig( SMTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); |
115 | 115 | ||
116 | public slots: | 116 | public slots: |
117 | void slotSSL( bool enabled ); | ||
118 | void fillValues(); | 117 | void fillValues(); |
119 | 118 | ||
120 | protected slots: | 119 | protected slots: |
120 | void slotConnectionToggle( int index ); | ||
121 | void accept(); | 121 | void accept(); |
122 | 122 | ||
123 | private: | 123 | private: |
124 | SMTPaccount *data; | 124 | SMTPaccount *data; |
125 | 125 | ||
126 | }; | 126 | }; |
127 | 127 | ||
128 | class NNTPconfig : public NNTPconfigUI | 128 | class NNTPconfig : public NNTPconfigUI |
129 | { | 129 | { |
130 | Q_OBJECT | 130 | Q_OBJECT |
131 | 131 | ||
132 | public: | 132 | public: |
133 | NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 133 | NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); |
134 | 134 | ||
135 | public slots: | 135 | public slots: |
136 | void fillValues(); | 136 | void fillValues(); |
137 | 137 | ||
138 | protected slots: | 138 | protected slots: |
139 | void slotSSL( bool enabled ); | 139 | void slotSSL( bool enabled ); |
140 | void accept(); | 140 | void accept(); |
141 | 141 | ||
142 | private: | 142 | private: |
143 | NNTPaccount *data; | 143 | NNTPaccount *data; |
144 | 144 | ||
145 | }; | 145 | }; |
146 | 146 | ||
147 | #endif | 147 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index 83e51e3..7b6a58d 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp | |||
@@ -254,123 +254,127 @@ void POP3account::read() | |||
254 | 254 | ||
255 | void POP3account::save() | 255 | void POP3account::save() |
256 | { | 256 | { |
257 | qDebug( "saving " + getFileName() ); | 257 | qDebug( "saving " + getFileName() ); |
258 | Settings::checkDirectory(); | 258 | Settings::checkDirectory(); |
259 | 259 | ||
260 | Config *conf = new Config( getFileName(), Config::File ); | 260 | Config *conf = new Config( getFileName(), Config::File ); |
261 | conf->setGroup( "POP3 Account" ); | 261 | conf->setGroup( "POP3 Account" ); |
262 | conf->writeEntry( "Account", accountName ); | 262 | conf->writeEntry( "Account", accountName ); |
263 | conf->writeEntry( "Server", server ); | 263 | conf->writeEntry( "Server", server ); |
264 | conf->writeEntry( "Port", port ); | 264 | conf->writeEntry( "Port", port ); |
265 | conf->writeEntry( "SSL", ssl ); | 265 | conf->writeEntry( "SSL", ssl ); |
266 | conf->writeEntry( "ConnectionType", connectionType ); | 266 | conf->writeEntry( "ConnectionType", connectionType ); |
267 | conf->writeEntry( "User", user ); | 267 | conf->writeEntry( "User", user ); |
268 | conf->writeEntryCrypt( "Password", password ); | 268 | conf->writeEntryCrypt( "Password", password ); |
269 | conf->writeEntry( "Offline",offline); | 269 | conf->writeEntry( "Offline",offline); |
270 | conf->write(); | 270 | conf->write(); |
271 | delete conf; | 271 | delete conf; |
272 | } | 272 | } |
273 | 273 | ||
274 | 274 | ||
275 | QString POP3account::getFileName() | 275 | QString POP3account::getFileName() |
276 | { | 276 | { |
277 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; | 277 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; |
278 | } | 278 | } |
279 | 279 | ||
280 | SMTPaccount::SMTPaccount() | 280 | SMTPaccount::SMTPaccount() |
281 | : Account() | 281 | : Account() |
282 | { | 282 | { |
283 | file = SMTPaccount::getUniqueFileName(); | 283 | file = SMTPaccount::getUniqueFileName(); |
284 | accountName = "New SMTP Account"; | 284 | accountName = "New SMTP Account"; |
285 | ssl = false; | 285 | ssl = false; |
286 | connectionType = 1; | ||
286 | login = false; | 287 | login = false; |
287 | useCC = false; | 288 | useCC = false; |
288 | useBCC = false; | 289 | useBCC = false; |
289 | useReply = false; | 290 | useReply = false; |
290 | type = "SMTP"; | 291 | type = "SMTP"; |
291 | port = SMTP_PORT; | 292 | port = SMTP_PORT; |
292 | } | 293 | } |
293 | 294 | ||
294 | SMTPaccount::SMTPaccount( QString filename ) | 295 | SMTPaccount::SMTPaccount( QString filename ) |
295 | : Account() | 296 | : Account() |
296 | { | 297 | { |
297 | file = filename; | 298 | file = filename; |
298 | accountName = "New SMTP Account"; | 299 | accountName = "New SMTP Account"; |
299 | ssl = false; | 300 | ssl = false; |
301 | connectionType = 1; | ||
300 | login = false; | 302 | login = false; |
301 | type = "SMTP"; | 303 | type = "SMTP"; |
302 | port = SMTP_PORT; | 304 | port = SMTP_PORT; |
303 | } | 305 | } |
304 | 306 | ||
305 | QString SMTPaccount::getUniqueFileName() | 307 | QString SMTPaccount::getUniqueFileName() |
306 | { | 308 | { |
307 | int num = 0; | 309 | int num = 0; |
308 | QString unique; | 310 | QString unique; |
309 | 311 | ||
310 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 312 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
311 | 313 | ||
312 | QStringList imap = dir.entryList( "smtp-*" ); | 314 | QStringList imap = dir.entryList( "smtp-*" ); |
313 | do { | 315 | do { |
314 | unique.setNum( num++ ); | 316 | unique.setNum( num++ ); |
315 | } while ( imap.contains( "smtp-" + unique ) > 0 ); | 317 | } while ( imap.contains( "smtp-" + unique ) > 0 ); |
316 | 318 | ||
317 | return unique; | 319 | return unique; |
318 | } | 320 | } |
319 | 321 | ||
320 | void SMTPaccount::read() | 322 | void SMTPaccount::read() |
321 | { | 323 | { |
322 | Config *conf = new Config( getFileName(), Config::File ); | 324 | Config *conf = new Config( getFileName(), Config::File ); |
323 | conf->setGroup( "SMTP Account" ); | 325 | conf->setGroup( "SMTP Account" ); |
324 | accountName = conf->readEntry( "Account" ); | 326 | accountName = conf->readEntry( "Account" ); |
325 | server = conf->readEntry( "Server" ); | 327 | server = conf->readEntry( "Server" ); |
326 | port = conf->readEntry( "Port" ); | 328 | port = conf->readEntry( "Port" ); |
327 | ssl = conf->readBoolEntry( "SSL" ); | 329 | ssl = conf->readBoolEntry( "SSL" ); |
330 | connectionType = conf->readNumEntry( "ConnectionType" ); | ||
328 | login = conf->readBoolEntry( "Login" ); | 331 | login = conf->readBoolEntry( "Login" ); |
329 | user = conf->readEntry( "User" ); | 332 | user = conf->readEntry( "User" ); |
330 | password = conf->readEntryCrypt( "Password" ); | 333 | password = conf->readEntryCrypt( "Password" ); |
331 | delete conf; | 334 | delete conf; |
332 | } | 335 | } |
333 | 336 | ||
334 | void SMTPaccount::save() | 337 | void SMTPaccount::save() |
335 | { | 338 | { |
336 | qDebug( "saving " + getFileName() ); | 339 | qDebug( "saving " + getFileName() ); |
337 | Settings::checkDirectory(); | 340 | Settings::checkDirectory(); |
338 | 341 | ||
339 | Config *conf = new Config( getFileName(), Config::File ); | 342 | Config *conf = new Config( getFileName(), Config::File ); |
340 | conf->setGroup( "SMTP Account" ); | 343 | conf->setGroup( "SMTP Account" ); |
341 | conf->writeEntry( "Account", accountName ); | 344 | conf->writeEntry( "Account", accountName ); |
342 | conf->writeEntry( "Server", server ); | 345 | conf->writeEntry( "Server", server ); |
343 | conf->writeEntry( "Port", port ); | 346 | conf->writeEntry( "Port", port ); |
344 | conf->writeEntry( "SSL", ssl ); | 347 | conf->writeEntry( "SSL", ssl ); |
348 | conf->writeEntry( "ConnectionType", connectionType ); | ||
345 | conf->writeEntry( "Login", login ); | 349 | conf->writeEntry( "Login", login ); |
346 | conf->writeEntry( "User", user ); | 350 | conf->writeEntry( "User", user ); |
347 | conf->writeEntryCrypt( "Password", password ); | 351 | conf->writeEntryCrypt( "Password", password ); |
348 | conf->write(); | 352 | conf->write(); |
349 | delete conf; | 353 | delete conf; |
350 | } | 354 | } |
351 | 355 | ||
352 | 356 | ||
353 | QString SMTPaccount::getFileName() | 357 | QString SMTPaccount::getFileName() |
354 | { | 358 | { |
355 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; | 359 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; |
356 | } | 360 | } |
357 | 361 | ||
358 | NNTPaccount::NNTPaccount() | 362 | NNTPaccount::NNTPaccount() |
359 | : Account() | 363 | : Account() |
360 | { | 364 | { |
361 | file = NNTPaccount::getUniqueFileName(); | 365 | file = NNTPaccount::getUniqueFileName(); |
362 | accountName = "New NNTP Account"; | 366 | accountName = "New NNTP Account"; |
363 | ssl = false; | 367 | ssl = false; |
364 | login = false; | 368 | login = false; |
365 | type = "NNTP"; | 369 | type = "NNTP"; |
366 | port = NNTP_PORT; | 370 | port = NNTP_PORT; |
367 | } | 371 | } |
368 | 372 | ||
369 | NNTPaccount::NNTPaccount( QString filename ) | 373 | NNTPaccount::NNTPaccount( QString filename ) |
370 | : Account() | 374 | : Account() |
371 | { | 375 | { |
372 | file = filename; | 376 | file = filename; |
373 | accountName = "New NNTP Account"; | 377 | accountName = "New NNTP Account"; |
374 | ssl = false; | 378 | ssl = false; |
375 | login = false; | 379 | login = false; |
376 | type = "NNTP"; | 380 | type = "NNTP"; |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index 08f6bb7..085d5e4 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |||
@@ -1,728 +1,764 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <sys/stat.h> | 2 | #include <sys/stat.h> |
3 | #include <sys/types.h> | 3 | #include <sys/types.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include <fcntl.h> | 5 | #include <fcntl.h> |
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <qdir.h> | 7 | #include <qdir.h> |
8 | #include <qt.h> | 8 | #include <qt.h> |
9 | 9 | ||
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | #include <qpe/qcopenvelope_qws.h> | 11 | #include <qpe/qcopenvelope_qws.h> |
12 | 12 | ||
13 | #include <libetpan/libetpan.h> | 13 | #include <libetpan/libetpan.h> |
14 | 14 | ||
15 | #include "smtpwrapper.h" | 15 | #include "smtpwrapper.h" |
16 | #include "mailwrapper.h" | 16 | #include "mailwrapper.h" |
17 | #include "abstractmail.h" | 17 | #include "abstractmail.h" |
18 | #include "logindialog.h" | 18 | #include "logindialog.h" |
19 | #include "mailtypes.h" | 19 | #include "mailtypes.h" |
20 | //#include "defines.h" | 20 | //#include "defines.h" |
21 | #include "sendmailprogress.h" | 21 | #include "sendmailprogress.h" |
22 | 22 | ||
23 | const char* SMTPwrapper::USER_AGENT="OpieMail v0.3"; | 23 | const char* SMTPwrapper::USER_AGENT="OpieMail v0.3"; |
24 | 24 | ||
25 | progressMailSend*SMTPwrapper::sendProgress = 0; | 25 | progressMailSend*SMTPwrapper::sendProgress = 0; |
26 | 26 | ||
27 | SMTPwrapper::SMTPwrapper( Settings *s ) | 27 | SMTPwrapper::SMTPwrapper( Settings *s ) |
28 | : QObject() | 28 | : QObject() { |
29 | { | ||
30 | settings = s; | 29 | settings = s; |
31 | Config cfg( "mail" ); | 30 | Config cfg( "mail" ); |
32 | cfg.setGroup( "Status" ); | 31 | cfg.setGroup( "Status" ); |
33 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); | 32 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); |
34 | emit queuedMails( m_queuedMail ); | 33 | emit queuedMails( m_queuedMail ); |
35 | connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); | 34 | connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); |
36 | } | 35 | } |
37 | 36 | ||
38 | void SMTPwrapper::emitQCop( int queued ) { | 37 | void SMTPwrapper::emitQCop( int queued ) { |
39 | QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); | 38 | QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); |
40 | env << queued; | 39 | env << queued; |
41 | } | 40 | } |
42 | 41 | ||
43 | QString SMTPwrapper::mailsmtpError( int errnum ) | 42 | QString SMTPwrapper::mailsmtpError( int errnum ) { |
44 | { | ||
45 | switch ( errnum ) { | 43 | switch ( errnum ) { |
46 | case MAILSMTP_NO_ERROR: | 44 | case MAILSMTP_NO_ERROR: |
47 | return tr( "No error" ); | 45 | return tr( "No error" ); |
48 | case MAILSMTP_ERROR_UNEXPECTED_CODE: | 46 | case MAILSMTP_ERROR_UNEXPECTED_CODE: |
49 | return tr( "Unexpected error code" ); | 47 | return tr( "Unexpected error code" ); |
50 | case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: | 48 | case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: |
51 | return tr( "Service not available" ); | 49 | return tr( "Service not available" ); |
52 | case MAILSMTP_ERROR_STREAM: | 50 | case MAILSMTP_ERROR_STREAM: |
53 | return tr( "Stream error" ); | 51 | return tr( "Stream error" ); |
54 | case MAILSMTP_ERROR_HOSTNAME: | 52 | case MAILSMTP_ERROR_HOSTNAME: |
55 | return tr( "gethostname() failed" ); | 53 | return tr( "gethostname() failed" ); |
56 | case MAILSMTP_ERROR_NOT_IMPLEMENTED: | 54 | case MAILSMTP_ERROR_NOT_IMPLEMENTED: |
57 | return tr( "Not implemented" ); | 55 | return tr( "Not implemented" ); |
58 | case MAILSMTP_ERROR_ACTION_NOT_TAKEN: | 56 | case MAILSMTP_ERROR_ACTION_NOT_TAKEN: |
59 | return tr( "Error, action not taken" ); | 57 | return tr( "Error, action not taken" ); |
60 | case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: | 58 | case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: |
61 | return tr( "Data exceeds storage allocation" ); | 59 | return tr( "Data exceeds storage allocation" ); |
62 | case MAILSMTP_ERROR_IN_PROCESSING: | 60 | case MAILSMTP_ERROR_IN_PROCESSING: |
63 | return tr( "Error in processing" ); | 61 | return tr( "Error in processing" ); |
64 | // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: | 62 | // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: |
65 | // return tr( "Insufficient system storage" ); | 63 | // return tr( "Insufficient system storage" ); |
66 | case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: | 64 | case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: |
67 | return tr( "Mailbox unavailable" ); | 65 | return tr( "Mailbox unavailable" ); |
68 | case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: | 66 | case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: |
69 | return tr( "Mailbox name not allowed" ); | 67 | return tr( "Mailbox name not allowed" ); |
70 | case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: | 68 | case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: |
71 | return tr( "Bad command sequence" ); | 69 | return tr( "Bad command sequence" ); |
72 | case MAILSMTP_ERROR_USER_NOT_LOCAL: | 70 | case MAILSMTP_ERROR_USER_NOT_LOCAL: |
73 | return tr( "User not local" ); | 71 | return tr( "User not local" ); |
74 | case MAILSMTP_ERROR_TRANSACTION_FAILED: | 72 | case MAILSMTP_ERROR_TRANSACTION_FAILED: |
75 | return tr( "Transaction failed" ); | 73 | return tr( "Transaction failed" ); |
76 | case MAILSMTP_ERROR_MEMORY: | 74 | case MAILSMTP_ERROR_MEMORY: |
77 | return tr( "Memory error" ); | 75 | return tr( "Memory error" ); |
78 | case MAILSMTP_ERROR_CONNECTION_REFUSED: | 76 | case MAILSMTP_ERROR_CONNECTION_REFUSED: |
79 | return tr( "Connection refused" ); | 77 | return tr( "Connection refused" ); |
80 | default: | 78 | default: |
81 | return tr( "Unknown error code" ); | 79 | return tr( "Unknown error code" ); |
82 | } | 80 | } |
83 | } | 81 | } |
84 | 82 | ||
85 | mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) | 83 | mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) { |
86 | { | ||
87 | return mailimf_mailbox_new( strdup( name.latin1() ), | 84 | return mailimf_mailbox_new( strdup( name.latin1() ), |
88 | strdup( mail.latin1() ) ); | 85 | strdup( mail.latin1() ) ); |
89 | } | 86 | } |
90 | 87 | ||
91 | mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) | 88 | mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) { |
92 | { | ||
93 | mailimf_address_list *addresses; | 89 | mailimf_address_list *addresses; |
94 | 90 | ||
95 | if ( addr.isEmpty() ) return NULL; | 91 | if ( addr.isEmpty() ) |
92 | return NULL; | ||
96 | 93 | ||
97 | addresses = mailimf_address_list_new_empty(); | 94 | addresses = mailimf_address_list_new_empty(); |
98 | 95 | ||
99 | bool literal_open = false; | 96 | bool literal_open = false; |
100 | unsigned int startpos = 0; | 97 | unsigned int startpos = 0; |
101 | QStringList list; | 98 | QStringList list; |
102 | QString s; | 99 | QString s; |
103 | unsigned int i = 0; | 100 | unsigned int i = 0; |
104 | for (; i < addr.length();++i) { | 101 | for (; i < addr.length();++i) { |
105 | switch (addr[i]) { | 102 | switch (addr[i]) { |
106 | case '\"': | 103 | case '\"': |
107 | literal_open = !literal_open; | 104 | literal_open = !literal_open; |
108 | break; | 105 | break; |
109 | case ',': | 106 | case ',': |
110 | if (!literal_open) { | 107 | if (!literal_open) { |
111 | s = addr.mid(startpos,i-startpos); | 108 | s = addr.mid(startpos,i-startpos); |
112 | if (!s.isEmpty()) { | 109 | if (!s.isEmpty()) { |
113 | list.append(s); | 110 | list.append(s); |
114 | qDebug("Appended %s",s.latin1()); | 111 | qDebug("Appended %s",s.latin1()); |
115 | } | 112 | } |
116 | // !!!! this is a MUST BE! | 113 | // !!!! this is a MUST BE! |
117 | startpos = ++i; | 114 | startpos = ++i; |
118 | } | 115 | } |
119 | break; | 116 | break; |
120 | default: | 117 | default: |
121 | break; | 118 | break; |
122 | } | 119 | } |
123 | } | 120 | } |
124 | s = addr.mid(startpos,i-startpos); | 121 | s = addr.mid(startpos,i-startpos); |
125 | if (!s.isEmpty()) { | 122 | if (!s.isEmpty()) { |
126 | list.append(s); | 123 | list.append(s); |
127 | qDebug("Appended %s",s.latin1()); | 124 | qDebug("Appended %s",s.latin1()); |
128 | } | 125 | } |
129 | QStringList::Iterator it; | 126 | QStringList::Iterator it; |
130 | for ( it = list.begin(); it != list.end(); it++ ) { | 127 | for ( it = list.begin(); it != list.end(); it++ ) { |
131 | int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() ); | 128 | int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() ); |
132 | if ( err != MAILIMF_NO_ERROR ) { | 129 | if ( err != MAILIMF_NO_ERROR ) { |
133 | qDebug( "Error parsing" ); | 130 | qDebug( "Error parsing" ); |
134 | qDebug( *it ); | 131 | qDebug( *it ); |
135 | } else { | 132 | } else { |
136 | qDebug( "Parse success! %s",(*it).latin1()); | 133 | qDebug( "Parse success! %s",(*it).latin1()); |
137 | } | 134 | } |
138 | } | 135 | } |
139 | return addresses; | 136 | return addresses; |
140 | } | 137 | } |
141 | 138 | ||
142 | mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail ) | 139 | mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail ) { |
143 | { | ||
144 | mailimf_fields *fields; | 140 | mailimf_fields *fields; |
145 | mailimf_field *xmailer; | 141 | mailimf_field *xmailer; |
146 | mailimf_mailbox *sender=0,*fromBox=0; | 142 | mailimf_mailbox *sender=0,*fromBox=0; |
147 | mailimf_mailbox_list *from=0; | 143 | mailimf_mailbox_list *from=0; |
148 | mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; | 144 | mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; |
149 | char *subject = strdup( mail.getSubject().latin1() ); | 145 | char *subject = strdup( mail.getSubject().latin1() ); |
150 | int err; | 146 | int err; |
151 | 147 | ||
152 | sender = newMailbox( mail.getName(), mail.getMail() ); | 148 | sender = newMailbox( mail.getName(), mail.getMail() ); |
153 | if ( sender == NULL ) goto err_free; | 149 | if ( sender == NULL ) |
150 | goto err_free; | ||
154 | 151 | ||
155 | fromBox = newMailbox( mail.getName(), mail.getMail() ); | 152 | fromBox = newMailbox( mail.getName(), mail.getMail() ); |
156 | if ( fromBox == NULL ) goto err_free_sender; | 153 | if ( fromBox == NULL ) |
154 | goto err_free_sender; | ||
157 | 155 | ||
158 | from = mailimf_mailbox_list_new_empty(); | 156 | from = mailimf_mailbox_list_new_empty(); |
159 | if ( from == NULL ) goto err_free_fromBox; | 157 | if ( from == NULL ) |
158 | goto err_free_fromBox; | ||
160 | 159 | ||
161 | err = mailimf_mailbox_list_add( from, fromBox ); | 160 | err = mailimf_mailbox_list_add( from, fromBox ); |
162 | if ( err != MAILIMF_NO_ERROR ) goto err_free_from; | 161 | if ( err != MAILIMF_NO_ERROR ) |
162 | goto err_free_from; | ||
163 | 163 | ||
164 | to = parseAddresses( mail.getTo() ); | 164 | to = parseAddresses( mail.getTo() ); |
165 | if ( to == NULL ) goto err_free_from; | 165 | if ( to == NULL ) |
166 | goto err_free_from; | ||
166 | 167 | ||
167 | cc = parseAddresses( mail.getCC() ); | 168 | cc = parseAddresses( mail.getCC() ); |
168 | bcc = parseAddresses( mail.getBCC() ); | 169 | bcc = parseAddresses( mail.getBCC() ); |
169 | reply = parseAddresses( mail.getReply() ); | 170 | reply = parseAddresses( mail.getReply() ); |
170 | 171 | ||
171 | fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc, | 172 | fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc, |
172 | NULL, NULL, subject ); | 173 | NULL, NULL, subject ); |
173 | if ( fields == NULL ) goto err_free_reply; | 174 | if ( fields == NULL ) |
175 | goto err_free_reply; | ||
174 | 176 | ||
175 | xmailer = mailimf_field_new_custom( strdup( "User-Agent" ), | 177 | xmailer = mailimf_field_new_custom( strdup( "User-Agent" ), |
176 | strdup( USER_AGENT ) ); | 178 | strdup( USER_AGENT ) ); |
177 | if ( xmailer == NULL ) goto err_free_fields; | 179 | if ( xmailer == NULL ) |
180 | goto err_free_fields; | ||
178 | 181 | ||
179 | err = mailimf_fields_add( fields, xmailer ); | 182 | err = mailimf_fields_add( fields, xmailer ); |
180 | if ( err != MAILIMF_NO_ERROR ) goto err_free_xmailer; | 183 | if ( err != MAILIMF_NO_ERROR ) |
184 | goto err_free_xmailer; | ||
181 | 185 | ||
182 | return fields; // Success :) | 186 | return fields; // Success :) |
183 | 187 | ||
184 | err_free_xmailer: | 188 | err_free_xmailer: |
185 | if (xmailer) mailimf_field_free( xmailer ); | 189 | if (xmailer) |
190 | mailimf_field_free( xmailer ); | ||
186 | err_free_fields: | 191 | err_free_fields: |
187 | if (fields) mailimf_fields_free( fields ); | 192 | if (fields) |
193 | mailimf_fields_free( fields ); | ||
188 | err_free_reply: | 194 | err_free_reply: |
189 | if (reply) mailimf_address_list_free( reply ); | 195 | if (reply) |
190 | if (bcc) mailimf_address_list_free( bcc ); | 196 | mailimf_address_list_free( reply ); |
191 | if (cc) mailimf_address_list_free( cc ); | 197 | if (bcc) |
192 | if (to) mailimf_address_list_free( to ); | 198 | mailimf_address_list_free( bcc ); |
199 | if (cc) | ||
200 | mailimf_address_list_free( cc ); | ||
201 | if (to) | ||
202 | mailimf_address_list_free( to ); | ||
193 | err_free_from: | 203 | err_free_from: |
194 | if (from) mailimf_mailbox_list_free( from ); | 204 | if (from) |
205 | mailimf_mailbox_list_free( from ); | ||
195 | err_free_fromBox: | 206 | err_free_fromBox: |
196 | mailimf_mailbox_free( fromBox ); | 207 | mailimf_mailbox_free( fromBox ); |
197 | err_free_sender: | 208 | err_free_sender: |
198 | if (sender) mailimf_mailbox_free( sender ); | 209 | if (sender) |
210 | mailimf_mailbox_free( sender ); | ||
199 | err_free: | 211 | err_free: |
200 | if (subject) free( subject ); | 212 | if (subject) |
213 | free( subject ); | ||
201 | qDebug( "createImfFields - error" ); | 214 | qDebug( "createImfFields - error" ); |
202 | 215 | ||
203 | return NULL; // Error :( | 216 | return NULL; // Error :( |
204 | } | 217 | } |
205 | 218 | ||
206 | mailmime *SMTPwrapper::buildTxtPart(const QString&str ) | 219 | mailmime *SMTPwrapper::buildTxtPart(const QString&str ) { |
207 | { | ||
208 | mailmime *txtPart; | 220 | mailmime *txtPart; |
209 | mailmime_fields *fields; | 221 | mailmime_fields *fields; |
210 | mailmime_content *content; | 222 | mailmime_content *content; |
211 | mailmime_parameter *param; | 223 | mailmime_parameter *param; |
212 | int err; | 224 | int err; |
213 | 225 | ||
214 | param = mailmime_parameter_new( strdup( "charset" ), | 226 | param = mailmime_parameter_new( strdup( "charset" ), |
215 | strdup( "iso-8859-1" ) ); | 227 | strdup( "iso-8859-1" ) ); |
216 | if ( param == NULL ) goto err_free; | 228 | if ( param == NULL ) |
229 | goto err_free; | ||
217 | 230 | ||
218 | content = mailmime_content_new_with_str( "text/plain" ); | 231 | content = mailmime_content_new_with_str( "text/plain" ); |
219 | if ( content == NULL ) goto err_free_param; | 232 | if ( content == NULL ) |
233 | goto err_free_param; | ||
220 | 234 | ||
221 | err = clist_append( content->ct_parameters, param ); | 235 | err = clist_append( content->ct_parameters, param ); |
222 | if ( err != MAILIMF_NO_ERROR ) goto err_free_content; | 236 | if ( err != MAILIMF_NO_ERROR ) |
237 | goto err_free_content; | ||
223 | 238 | ||
224 | fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); | 239 | fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); |
225 | if ( fields == NULL ) goto err_free_content; | 240 | if ( fields == NULL ) |
241 | goto err_free_content; | ||
226 | 242 | ||
227 | txtPart = mailmime_new_empty( content, fields ); | 243 | txtPart = mailmime_new_empty( content, fields ); |
228 | if ( txtPart == NULL ) goto err_free_fields; | 244 | if ( txtPart == NULL ) |
245 | goto err_free_fields; | ||
229 | 246 | ||
230 | err = mailmime_set_body_text( txtPart, (char*)str.data(), str.length() ); | 247 | err = mailmime_set_body_text( txtPart, (char*)str.data(), str.length() ); |
231 | if ( err != MAILIMF_NO_ERROR ) goto err_free_txtPart; | 248 | if ( err != MAILIMF_NO_ERROR ) |
249 | goto err_free_txtPart; | ||
232 | 250 | ||
233 | return txtPart; // Success :) | 251 | return txtPart; // Success :) |
234 | 252 | ||
235 | err_free_txtPart: | 253 | err_free_txtPart: |
236 | mailmime_free( txtPart ); | 254 | mailmime_free( txtPart ); |
237 | err_free_fields: | 255 | err_free_fields: |
238 | mailmime_fields_free( fields ); | 256 | mailmime_fields_free( fields ); |
239 | err_free_content: | 257 | err_free_content: |
240 | mailmime_content_free( content ); | 258 | mailmime_content_free( content ); |
241 | err_free_param: | 259 | err_free_param: |
242 | mailmime_parameter_free( param ); | 260 | mailmime_parameter_free( param ); |
243 | err_free: | 261 | err_free: |
244 | qDebug( "buildTxtPart - error" ); | 262 | qDebug( "buildTxtPart - error" ); |
245 | 263 | ||
246 | return NULL; // Error :( | 264 | return NULL; // Error :( |
247 | } | 265 | } |
248 | 266 | ||
249 | mailmime *SMTPwrapper::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) | 267 | mailmime *SMTPwrapper::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) { |
250 | { | ||
251 | mailmime * filePart = 0; | 268 | mailmime * filePart = 0; |
252 | mailmime_fields * fields = 0; | 269 | mailmime_fields * fields = 0; |
253 | mailmime_content * content = 0; | 270 | mailmime_content * content = 0; |
254 | mailmime_parameter * param = 0; | 271 | mailmime_parameter * param = 0; |
255 | char*name = 0; | 272 | char*name = 0; |
256 | char*file = 0; | 273 | char*file = 0; |
257 | int err; | 274 | int err; |
258 | 275 | ||
259 | int pos = filename.findRev( '/' ); | 276 | int pos = filename.findRev( '/' ); |
260 | 277 | ||
261 | if (filename.length()>0) { | 278 | if (filename.length()>0) { |
262 | QString tmp = filename.right( filename.length() - ( pos + 1 ) ); | 279 | QString tmp = filename.right( filename.length() - ( pos + 1 ) ); |
263 | name = strdup( tmp.latin1() ); // just filename | 280 | name = strdup( tmp.latin1() ); // just filename |
264 | file = strdup( filename.latin1() ); // full name with path | 281 | file = strdup( filename.latin1() ); // full name with path |
265 | } | 282 | } |
266 | 283 | ||
267 | int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; | 284 | int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; |
268 | int mechanism = MAILMIME_MECHANISM_BASE64; | 285 | int mechanism = MAILMIME_MECHANISM_BASE64; |
269 | 286 | ||
270 | if ( mimetype.startsWith( "text/" ) ) { | 287 | if ( mimetype.startsWith( "text/" ) ) { |
271 | param = mailmime_parameter_new( strdup( "charset" ), | 288 | param = mailmime_parameter_new( strdup( "charset" ), |
272 | strdup( "iso-8859-1" ) ); | 289 | strdup( "iso-8859-1" ) ); |
273 | mechanism = MAILMIME_MECHANISM_QUOTED_PRINTABLE; | 290 | mechanism = MAILMIME_MECHANISM_QUOTED_PRINTABLE; |
274 | } | 291 | } |
275 | 292 | ||
276 | fields = mailmime_fields_new_filename( | 293 | fields = mailmime_fields_new_filename( |
277 | disptype, name, | 294 | disptype, name, |
278 | mechanism ); | 295 | mechanism ); |
279 | content = mailmime_content_new_with_str( (char*)mimetype.latin1() ); | 296 | content = mailmime_content_new_with_str( (char*)mimetype.latin1() ); |
280 | if (content!=0 && fields != 0) { | 297 | if (content!=0 && fields != 0) { |
281 | if (param) { | 298 | if (param) { |
282 | clist_append(content->ct_parameters,param); | 299 | clist_append(content->ct_parameters,param); |
283 | param = 0; | 300 | param = 0; |
284 | } | 301 | } |
285 | if (filename.length()>0) { | 302 | if (filename.length()>0) { |
286 | QFileInfo f(filename); | 303 | QFileInfo f(filename); |
287 | param = mailmime_parameter_new(strdup("name"),strdup(f.fileName().latin1())); | 304 | param = mailmime_parameter_new(strdup("name"),strdup(f.fileName().latin1())); |
288 | clist_append(content->ct_parameters,param); | 305 | clist_append(content->ct_parameters,param); |
289 | param = 0; | 306 | param = 0; |
290 | } | 307 | } |
291 | filePart = mailmime_new_empty( content, fields ); | 308 | filePart = mailmime_new_empty( content, fields ); |
292 | } | 309 | } |
293 | if (filePart) { | 310 | if (filePart) { |
294 | if (filename.length()>0) { | 311 | if (filename.length()>0) { |
295 | err = mailmime_set_body_file( filePart, file ); | 312 | err = mailmime_set_body_file( filePart, file ); |
296 | } else { | 313 | } else { |
297 | err = mailmime_set_body_text(filePart,strdup(TextContent.data()),TextContent.length()); | 314 | err = mailmime_set_body_text(filePart,strdup(TextContent.data()),TextContent.length()); |
298 | } | 315 | } |
299 | if (err != MAILIMF_NO_ERROR) { | 316 | if (err != MAILIMF_NO_ERROR) { |
300 | qDebug("Error setting body with file %s",file); | 317 | qDebug("Error setting body with file %s",file); |
301 | mailmime_free( filePart ); | 318 | mailmime_free( filePart ); |
302 | filePart = 0; | 319 | filePart = 0; |
303 | } | 320 | } |
304 | } | 321 | } |
305 | 322 | ||
306 | if (!filePart) { | 323 | if (!filePart) { |
307 | if ( param != NULL ) { | 324 | if ( param != NULL ) { |
308 | mailmime_parameter_free( param ); | 325 | mailmime_parameter_free( param ); |
309 | } | 326 | } |
310 | if (content) { | 327 | if (content) { |
311 | mailmime_content_free( content ); | 328 | mailmime_content_free( content ); |
312 | } | 329 | } |
313 | if (fields) { | 330 | if (fields) { |
314 | mailmime_fields_free( fields ); | 331 | mailmime_fields_free( fields ); |
315 | } else { | 332 | } else { |
316 | if (name) { | 333 | if (name) { |
317 | free( name ); | 334 | free( name ); |
318 | } | 335 | } |
319 | if (file) { | 336 | if (file) { |
320 | free( file ); | 337 | free( file ); |
321 | } | 338 | } |
322 | } | 339 | } |
323 | } | 340 | } |
324 | return filePart; // Success :) | 341 | return filePart; // Success :) |
325 | 342 | ||
326 | } | 343 | } |
327 | 344 | ||
328 | void SMTPwrapper::addFileParts( mailmime *message,const QList<Attachment>&files ) | 345 | void SMTPwrapper::addFileParts( mailmime *message,const QList<Attachment>&files ) { |
329 | { | ||
330 | const Attachment *it; | 346 | const Attachment *it; |
331 | unsigned int count = files.count(); | 347 | unsigned int count = files.count(); |
332 | qDebug("List contains %i values",count); | 348 | qDebug("List contains %i values",count); |
333 | for ( unsigned int i = 0; i < count; ++i ) { | 349 | for ( unsigned int i = 0; i < count; ++i ) { |
334 | qDebug( "Adding file" ); | 350 | qDebug( "Adding file" ); |
335 | mailmime *filePart; | 351 | mailmime *filePart; |
336 | int err; | 352 | int err; |
337 | it = ((QList<Attachment>)files).at(i); | 353 | it = ((QList<Attachment>)files).at(i); |
338 | 354 | ||
339 | filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" ); | 355 | filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" ); |
340 | if ( filePart == NULL ) { | 356 | if ( filePart == NULL ) { |
341 | qDebug( "addFileParts: error adding file:" ); | 357 | qDebug( "addFileParts: error adding file:" ); |
342 | qDebug( it->getFileName() ); | 358 | qDebug( it->getFileName() ); |
343 | continue; | 359 | continue; |
344 | } | 360 | } |
345 | err = mailmime_smart_add_part( message, filePart ); | 361 | err = mailmime_smart_add_part( message, filePart ); |
346 | if ( err != MAILIMF_NO_ERROR ) { | 362 | if ( err != MAILIMF_NO_ERROR ) { |
347 | mailmime_free( filePart ); | 363 | mailmime_free( filePart ); |
348 | qDebug("error smart add"); | 364 | qDebug("error smart add"); |
349 | } | 365 | } |
350 | } | 366 | } |
351 | } | 367 | } |
352 | 368 | ||
353 | mailmime *SMTPwrapper::createMimeMail(const Mail &mail ) | 369 | mailmime *SMTPwrapper::createMimeMail(const Mail &mail ) { |
354 | { | ||
355 | mailmime *message, *txtPart; | 370 | mailmime *message, *txtPart; |
356 | mailimf_fields *fields; | 371 | mailimf_fields *fields; |
357 | int err; | 372 | int err; |
358 | 373 | ||
359 | fields = createImfFields( mail ); | 374 | fields = createImfFields( mail ); |
360 | if ( fields == NULL ) goto err_free; | 375 | if ( fields == NULL ) |
376 | goto err_free; | ||
361 | 377 | ||
362 | message = mailmime_new_message_data( NULL ); | 378 | message = mailmime_new_message_data( NULL ); |
363 | if ( message == NULL ) goto err_free_fields; | 379 | if ( message == NULL ) |
380 | goto err_free_fields; | ||
364 | 381 | ||
365 | mailmime_set_imf_fields( message, fields ); | 382 | mailmime_set_imf_fields( message, fields ); |
366 | 383 | ||
367 | txtPart = buildTxtPart( mail.getMessage() ); | 384 | txtPart = buildTxtPart( mail.getMessage() ); |
368 | 385 | ||
369 | if ( txtPart == NULL ) goto err_free_message; | 386 | if ( txtPart == NULL ) |
387 | goto err_free_message; | ||
370 | 388 | ||
371 | err = mailmime_smart_add_part( message, txtPart ); | 389 | err = mailmime_smart_add_part( message, txtPart ); |
372 | if ( err != MAILIMF_NO_ERROR ) goto err_free_txtPart; | 390 | if ( err != MAILIMF_NO_ERROR ) |
391 | goto err_free_txtPart; | ||
373 | 392 | ||
374 | addFileParts( message, mail.getAttachments() ); | 393 | addFileParts( message, mail.getAttachments() ); |
375 | 394 | ||
376 | return message; // Success :) | 395 | return message; // Success :) |
377 | 396 | ||
378 | err_free_txtPart: | 397 | err_free_txtPart: |
379 | mailmime_free( txtPart ); | 398 | mailmime_free( txtPart ); |
380 | err_free_message: | 399 | err_free_message: |
381 | mailmime_free( message ); | 400 | mailmime_free( message ); |
382 | err_free_fields: | 401 | err_free_fields: |
383 | mailimf_fields_free( fields ); | 402 | mailimf_fields_free( fields ); |
384 | err_free: | 403 | err_free: |
385 | qDebug( "createMimeMail: error" ); | 404 | qDebug( "createMimeMail: error" ); |
386 | 405 | ||
387 | return NULL; // Error :( | 406 | return NULL; // Error :( |
388 | } | 407 | } |
389 | 408 | ||
390 | mailimf_field *SMTPwrapper::getField( mailimf_fields *fields, int type ) | 409 | mailimf_field *SMTPwrapper::getField( mailimf_fields *fields, int type ) { |
391 | { | ||
392 | mailimf_field *field; | 410 | mailimf_field *field; |
393 | clistiter *it; | 411 | clistiter *it; |
394 | 412 | ||
395 | it = clist_begin( fields->fld_list ); | 413 | it = clist_begin( fields->fld_list ); |
396 | while ( it ) { | 414 | while ( it ) { |
397 | field = (mailimf_field *) it->data; | 415 | field = (mailimf_field *) it->data; |
398 | if ( field->fld_type == type ) { | 416 | if ( field->fld_type == type ) { |
399 | return field; | 417 | return field; |
400 | } | 418 | } |
401 | it = it->next; | 419 | it = it->next; |
402 | } | 420 | } |
403 | 421 | ||
404 | return NULL; | 422 | return NULL; |
405 | } | 423 | } |
406 | 424 | ||
407 | void SMTPwrapper::addRcpts( clist *list, mailimf_address_list *addr_list ) | 425 | void SMTPwrapper::addRcpts( clist *list, mailimf_address_list *addr_list ) { |
408 | { | ||
409 | clistiter *it, *it2; | 426 | clistiter *it, *it2; |
410 | 427 | ||
411 | for ( it = clist_begin( addr_list->ad_list ); it; it = it->next ) { | 428 | for ( it = clist_begin( addr_list->ad_list ); it; it = it->next ) { |
412 | mailimf_address *addr; | 429 | mailimf_address *addr; |
413 | addr = (mailimf_address *) it->data; | 430 | addr = (mailimf_address *) it->data; |
414 | 431 | ||
415 | if ( addr->ad_type == MAILIMF_ADDRESS_MAILBOX ) { | 432 | if ( addr->ad_type == MAILIMF_ADDRESS_MAILBOX ) { |
416 | esmtp_address_list_add( list, addr->ad_data.ad_mailbox->mb_addr_spec, 0, NULL ); | 433 | esmtp_address_list_add( list, addr->ad_data.ad_mailbox->mb_addr_spec, 0, NULL ); |
417 | } else if ( addr->ad_type == MAILIMF_ADDRESS_GROUP ) { | 434 | } else if ( addr->ad_type == MAILIMF_ADDRESS_GROUP ) { |
418 | clist *l = addr->ad_data.ad_group->grp_mb_list->mb_list; | 435 | clist *l = addr->ad_data.ad_group->grp_mb_list->mb_list; |
419 | for ( it2 = clist_begin( l ); it2; it2 = it2->next ) { | 436 | for ( it2 = clist_begin( l ); it2; it2 = it2->next ) { |
420 | mailimf_mailbox *mbox; | 437 | mailimf_mailbox *mbox; |
421 | mbox = (mailimf_mailbox *) it2->data; | 438 | mbox = (mailimf_mailbox *) it2->data; |
422 | esmtp_address_list_add( list, mbox->mb_addr_spec, 0, NULL ); | 439 | esmtp_address_list_add( list, mbox->mb_addr_spec, 0, NULL ); |
423 | } | 440 | } |
424 | } | 441 | } |
425 | } | 442 | } |
426 | } | 443 | } |
427 | 444 | ||
428 | clist *SMTPwrapper::createRcptList( mailimf_fields *fields ) | 445 | clist *SMTPwrapper::createRcptList( mailimf_fields *fields ) { |
429 | { | ||
430 | clist *rcptList; | 446 | clist *rcptList; |
431 | mailimf_field *field; | 447 | mailimf_field *field; |
432 | 448 | ||
433 | rcptList = esmtp_address_list_new(); | 449 | rcptList = esmtp_address_list_new(); |
434 | 450 | ||
435 | field = getField( fields, MAILIMF_FIELD_TO ); | 451 | field = getField( fields, MAILIMF_FIELD_TO ); |
436 | if ( field && (field->fld_type == MAILIMF_FIELD_TO) | 452 | if ( field && (field->fld_type == MAILIMF_FIELD_TO) |
437 | && field->fld_data.fld_to->to_addr_list ) { | 453 | && field->fld_data.fld_to->to_addr_list ) { |
438 | addRcpts( rcptList, field->fld_data.fld_to->to_addr_list ); | 454 | addRcpts( rcptList, field->fld_data.fld_to->to_addr_list ); |
439 | } | 455 | } |
440 | 456 | ||
441 | field = getField( fields, MAILIMF_FIELD_CC ); | 457 | field = getField( fields, MAILIMF_FIELD_CC ); |
442 | if ( field && (field->fld_type == MAILIMF_FIELD_CC) | 458 | if ( field && (field->fld_type == MAILIMF_FIELD_CC) |
443 | && field->fld_data.fld_cc->cc_addr_list ) { | 459 | && field->fld_data.fld_cc->cc_addr_list ) { |
444 | addRcpts( rcptList, field->fld_data.fld_cc->cc_addr_list ); | 460 | addRcpts( rcptList, field->fld_data.fld_cc->cc_addr_list ); |
445 | } | 461 | } |
446 | 462 | ||
447 | field = getField( fields, MAILIMF_FIELD_BCC ); | 463 | field = getField( fields, MAILIMF_FIELD_BCC ); |
448 | if ( field && (field->fld_type == MAILIMF_FIELD_BCC) | 464 | if ( field && (field->fld_type == MAILIMF_FIELD_BCC) |
449 | && field->fld_data.fld_bcc->bcc_addr_list ) { | 465 | && field->fld_data.fld_bcc->bcc_addr_list ) { |
450 | addRcpts( rcptList, field->fld_data.fld_bcc->bcc_addr_list ); | 466 | addRcpts( rcptList, field->fld_data.fld_bcc->bcc_addr_list ); |
451 | } | 467 | } |
452 | 468 | ||
453 | return rcptList; | 469 | return rcptList; |
454 | } | 470 | } |
455 | 471 | ||
456 | char *SMTPwrapper::getFrom( mailimf_field *ffrom) | 472 | char *SMTPwrapper::getFrom( mailimf_field *ffrom) { |
457 | { | ||
458 | char *from = NULL; | 473 | char *from = NULL; |
459 | if ( ffrom && (ffrom->fld_type == MAILIMF_FIELD_FROM) | 474 | if ( ffrom && (ffrom->fld_type == MAILIMF_FIELD_FROM) |
460 | && ffrom->fld_data.fld_from->frm_mb_list && ffrom->fld_data.fld_from->frm_mb_list->mb_list ) { | 475 | && ffrom->fld_data.fld_from->frm_mb_list && ffrom->fld_data.fld_from->frm_mb_list->mb_list ) { |
461 | clist *cl = ffrom->fld_data.fld_from->frm_mb_list->mb_list; | 476 | clist *cl = ffrom->fld_data.fld_from->frm_mb_list->mb_list; |
462 | clistiter *it; | 477 | clistiter *it; |
463 | for ( it = clist_begin( cl ); it; it = it->next ) { | 478 | for ( it = clist_begin( cl ); it; it = it->next ) { |
464 | mailimf_mailbox *mb = (mailimf_mailbox *) it->data; | 479 | mailimf_mailbox *mb = (mailimf_mailbox *) it->data; |
465 | from = strdup( mb->mb_addr_spec ); | 480 | from = strdup( mb->mb_addr_spec ); |
466 | } | 481 | } |
467 | } | 482 | } |
468 | 483 | ||
469 | return from; | 484 | return from; |
470 | } | 485 | } |
471 | 486 | ||
472 | char *SMTPwrapper::getFrom( mailmime *mail ) | 487 | char *SMTPwrapper::getFrom( mailmime *mail ) { |
473 | { | ||
474 | /* no need to delete - its just a pointer to structure content */ | 488 | /* no need to delete - its just a pointer to structure content */ |
475 | mailimf_field *ffrom = 0; | 489 | mailimf_field *ffrom = 0; |
476 | ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); | 490 | ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); |
477 | return getFrom(ffrom); | 491 | return getFrom(ffrom); |
478 | } | 492 | } |
479 | 493 | ||
480 | void SMTPwrapper::progress( size_t current, size_t maximum ) | 494 | void SMTPwrapper::progress( size_t current, size_t maximum ) { |
481 | { | ||
482 | if (SMTPwrapper::sendProgress) { | 495 | if (SMTPwrapper::sendProgress) { |
483 | SMTPwrapper::sendProgress->setSingleMail(current, maximum ); | 496 | SMTPwrapper::sendProgress->setSingleMail(current, maximum ); |
484 | qApp->processEvents(); | 497 | qApp->processEvents(); |
485 | } | 498 | } |
486 | } | 499 | } |
487 | 500 | ||
488 | void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) | 501 | void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) { |
489 | { | 502 | if (!mail) |
490 | if (!mail) return; | 503 | return; |
491 | QString localfolders = AbstractMail::defaultLocalfolder(); | 504 | QString localfolders = AbstractMail::defaultLocalfolder(); |
492 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); | 505 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
493 | wrap->createMbox(box); | 506 | wrap->createMbox(box); |
494 | wrap->storeMessage(mail,length,box); | 507 | wrap->storeMessage(mail,length,box); |
495 | delete wrap; | 508 | delete wrap; |
496 | } | 509 | } |
497 | 510 | ||
498 | void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) | 511 | void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) { |
499 | { | ||
500 | clist *rcpts = 0; | 512 | clist *rcpts = 0; |
501 | char *from, *data; | 513 | char *from, *data; |
502 | size_t size; | 514 | size_t size; |
503 | 515 | ||
504 | if ( smtp == NULL ) { | 516 | if ( smtp == NULL ) { |
505 | return; | 517 | return; |
506 | } | 518 | } |
507 | from = data = 0; | 519 | from = data = 0; |
508 | 520 | ||
509 | mailmessage * msg = 0; | 521 | mailmessage * msg = 0; |
510 | msg = mime_message_init(mail); | 522 | msg = mime_message_init(mail); |
511 | mime_message_set_tmpdir(msg,getenv( "HOME" )); | 523 | mime_message_set_tmpdir(msg,getenv( "HOME" )); |
512 | int r = mailmessage_fetch(msg,&data,&size); | 524 | int r = mailmessage_fetch(msg,&data,&size); |
513 | mime_message_detach_mime(msg); | 525 | mime_message_detach_mime(msg); |
514 | mailmessage_free(msg); | 526 | mailmessage_free(msg); |
515 | if (r != MAIL_NO_ERROR || !data) { | 527 | if (r != MAIL_NO_ERROR || !data) { |
516 | if (data) free(data); | 528 | if (data) |
529 | free(data); | ||
517 | qDebug("Error fetching mime..."); | 530 | qDebug("Error fetching mime..."); |
518 | return; | 531 | return; |
519 | } | 532 | } |
520 | msg = 0; | 533 | msg = 0; |
521 | if (later) { | 534 | if (later) { |
522 | storeMail(data,size,"Outgoing"); | 535 | storeMail(data,size,"Outgoing"); |
523 | if (data) free( data ); | 536 | if (data) |
537 | free( data ); | ||
524 | Config cfg( "mail" ); | 538 | Config cfg( "mail" ); |
525 | cfg.setGroup( "Status" ); | 539 | cfg.setGroup( "Status" ); |
526 | cfg.writeEntry( "outgoing", ++m_queuedMail ); | 540 | cfg.writeEntry( "outgoing", ++m_queuedMail ); |
527 | emit queuedMails( m_queuedMail ); | 541 | emit queuedMails( m_queuedMail ); |
528 | return; | 542 | return; |
529 | } | 543 | } |
530 | from = getFrom( mail ); | 544 | from = getFrom( mail ); |
531 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); | 545 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); |
532 | smtpSend(from,rcpts,data,size,smtp); | 546 | smtpSend(from,rcpts,data,size,smtp); |
533 | if (data) {free(data);} | 547 | if (data) { |
534 | if (from) {free(from);} | 548 | free(data); |
535 | if (rcpts) smtp_address_list_free( rcpts ); | 549 | } |
550 | if (from) { | ||
551 | free(from); | ||
552 | } | ||
553 | if (rcpts) | ||
554 | smtp_address_list_free( rcpts ); | ||
536 | } | 555 | } |
537 | 556 | ||
538 | int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ) | 557 | int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ) { |
539 | { | ||
540 | const char *server, *user, *pass; | 558 | const char *server, *user, *pass; |
541 | bool ssl; | 559 | bool ssl; |
542 | uint16_t port; | 560 | uint16_t port; |
543 | mailsmtp *session; | 561 | mailsmtp *session; |
544 | int err,result; | 562 | int err,result; |
545 | 563 | ||
546 | result = 1; | 564 | result = 1; |
547 | server = user = pass = 0; | 565 | server = user = pass = 0; |
548 | server = smtp->getServer().latin1(); | 566 | server = smtp->getServer().latin1(); |
549 | ssl = smtp->getSSL(); | 567 | |
568 | // FIXME: currently only TLS and Plain work. | ||
569 | |||
570 | ssl = false; | ||
571 | |||
572 | if ( smtp->ConnectionType() == 2 ) { | ||
573 | ssl = true; | ||
574 | } | ||
575 | |||
550 | port = smtp->getPort().toUInt(); | 576 | port = smtp->getPort().toUInt(); |
551 | 577 | ||
552 | session = mailsmtp_new( 20, &progress ); | 578 | session = mailsmtp_new( 20, &progress ); |
553 | if ( session == NULL ) goto free_mem; | 579 | if ( session == NULL ) |
580 | goto free_mem; | ||
554 | 581 | ||
555 | qDebug( "Servername %s at port %i", server, port ); | 582 | qDebug( "Servername %s at port %i", server, port ); |
556 | if ( ssl ) { | 583 | if ( ssl ) { |
557 | qDebug( "SSL session" ); | 584 | qDebug( "SSL session" ); |
558 | err = mailsmtp_ssl_connect( session, server, port ); | 585 | err = mailsmtp_ssl_connect( session, server, port ); |
559 | } else { | 586 | } else { |
560 | qDebug( "No SSL session" ); | 587 | qDebug( "No SSL session" ); |
561 | err = mailsmtp_socket_connect( session, server, port ); | 588 | err = mailsmtp_socket_connect( session, server, port ); |
562 | } | 589 | } |
563 | if ( err != MAILSMTP_NO_ERROR ) {qDebug("Error init connection");result = 0;goto free_mem_session;} | 590 | if ( err != MAILSMTP_NO_ERROR ) { |
591 | qDebug("Error init connection"); | ||
592 | result = 0; | ||
593 | goto free_mem_session; | ||
594 | } | ||
564 | 595 | ||
565 | err = mailsmtp_init( session ); | 596 | err = mailsmtp_init( session ); |
566 | if ( err != MAILSMTP_NO_ERROR ) {result = 0; goto free_con_session;} | 597 | if ( err != MAILSMTP_NO_ERROR ) { |
598 | result = 0; | ||
599 | goto free_con_session; | ||
600 | } | ||
567 | 601 | ||
568 | qDebug( "INIT OK" ); | 602 | qDebug( "INIT OK" ); |
569 | 603 | ||
570 | if ( smtp->getLogin() ) { | 604 | if ( smtp->getLogin() ) { |
571 | qDebug("smtp with auth"); | 605 | qDebug("smtp with auth"); |
572 | if ( smtp->getUser().isEmpty() || smtp->getPassword().isEmpty() ) { | 606 | if ( smtp->getUser().isEmpty() || smtp->getPassword().isEmpty() ) { |
573 | // get'em | 607 | // get'em |
574 | LoginDialog login( smtp->getUser(), smtp->getPassword(), NULL, 0, true ); | 608 | LoginDialog login( smtp->getUser(), smtp->getPassword(), NULL, 0, true ); |
575 | login.show(); | 609 | login.show(); |
576 | if ( QDialog::Accepted == login.exec() ) { | 610 | if ( QDialog::Accepted == login.exec() ) { |
577 | // ok | 611 | // ok |
578 | user = login.getUser().latin1(); | 612 | user = login.getUser().latin1(); |
579 | pass = login.getPassword().latin1(); | 613 | pass = login.getPassword().latin1(); |
580 | } else { | 614 | } else { |
581 | result = 0; goto free_con_session; | 615 | result = 0; |
616 | goto free_con_session; | ||
582 | } | 617 | } |
583 | } else { | 618 | } else { |
584 | user = smtp->getUser().latin1(); | 619 | user = smtp->getUser().latin1(); |
585 | pass = smtp->getPassword().latin1(); | 620 | pass = smtp->getPassword().latin1(); |
586 | } | 621 | } |
587 | qDebug( "session->auth: %i", session->auth); | 622 | qDebug( "session->auth: %i", session->auth); |
588 | err = mailsmtp_auth( session, (char*)user, (char*)pass ); | 623 | err = mailsmtp_auth( session, (char*)user, (char*)pass ); |
589 | if ( err == MAILSMTP_NO_ERROR ) qDebug("auth ok"); | 624 | if ( err == MAILSMTP_NO_ERROR ) |
625 | qDebug("auth ok"); | ||
590 | qDebug( "Done auth!" ); | 626 | qDebug( "Done auth!" ); |
591 | } else { | 627 | } else { |
592 | qDebug("SMTP without auth"); | 628 | qDebug("SMTP without auth"); |
593 | } | 629 | } |
594 | 630 | ||
595 | err = mailsmtp_send( session, from, rcpts, data, size ); | 631 | err = mailsmtp_send( session, from, rcpts, data, size ); |
596 | if ( err != MAILSMTP_NO_ERROR ) { | 632 | if ( err != MAILSMTP_NO_ERROR ) { |
597 | qDebug("Error sending mail: %s",mailsmtpError(err).latin1()); | 633 | qDebug("Error sending mail: %s",mailsmtpError(err).latin1()); |
598 | result = 0; goto free_con_session; | 634 | result = 0; |
635 | goto free_con_session; | ||
599 | } | 636 | } |
600 | 637 | ||
601 | qDebug( "Mail sent." ); | 638 | qDebug( "Mail sent." ); |
602 | storeMail(data,size,"Sent"); | 639 | storeMail(data,size,"Sent"); |
603 | 640 | ||
604 | free_con_session: | 641 | free_con_session: |
605 | mailsmtp_quit( session ); | 642 | mailsmtp_quit( session ); |
606 | free_mem_session: | 643 | free_mem_session: |
607 | mailsmtp_free( session ); | 644 | mailsmtp_free( session ); |
608 | free_mem: | 645 | free_mem: |
609 | return result; | 646 | return result; |
610 | } | 647 | } |
611 | 648 | ||
612 | void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later ) | 649 | void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later ) { |
613 | { | ||
614 | mailmime * mimeMail; | 650 | mailmime * mimeMail; |
615 | 651 | ||
616 | SMTPaccount *smtp = aSmtp; | 652 | SMTPaccount *smtp = aSmtp; |
617 | 653 | ||
618 | if (!later && !smtp) { | 654 | if (!later && !smtp) { |
619 | qDebug("Didn't get any send method - giving up"); | 655 | qDebug("Didn't get any send method - giving up"); |
620 | return; | 656 | return; |
621 | } | 657 | } |
622 | mimeMail = createMimeMail(mail ); | 658 | mimeMail = createMimeMail(mail ); |
623 | if ( mimeMail == NULL ) { | 659 | if ( mimeMail == NULL ) { |
624 | qDebug( "sendMail: error creating mime mail" ); | 660 | qDebug( "sendMail: error creating mime mail" ); |
625 | } else { | 661 | } else { |
626 | sendProgress = new progressMailSend(); | 662 | sendProgress = new progressMailSend(); |
627 | sendProgress->show(); | 663 | sendProgress->show(); |
628 | sendProgress->setMaxMails(1); | 664 | sendProgress->setMaxMails(1); |
629 | smtpSend( mimeMail,later,smtp); | 665 | smtpSend( mimeMail,later,smtp); |
630 | qDebug("Clean up done"); | 666 | qDebug("Clean up done"); |
631 | sendProgress->hide(); | 667 | sendProgress->hide(); |
632 | delete sendProgress; | 668 | delete sendProgress; |
633 | sendProgress = 0; | 669 | sendProgress = 0; |
634 | mailmime_free( mimeMail ); | 670 | mailmime_free( mimeMail ); |
635 | } | 671 | } |
636 | } | 672 | } |
637 | 673 | ||
638 | int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which) | 674 | int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which) { |
639 | { | ||
640 | size_t curTok = 0; | 675 | size_t curTok = 0; |
641 | mailimf_fields *fields = 0; | 676 | mailimf_fields *fields = 0; |
642 | mailimf_field*ffrom = 0; | 677 | mailimf_field*ffrom = 0; |
643 | clist *rcpts = 0; | 678 | clist *rcpts = 0; |
644 | char*from = 0; | 679 | char*from = 0; |
645 | int res = 0; | 680 | int res = 0; |
646 | 681 | ||
647 | encodedString * data = wrap->fetchRawBody(*which); | 682 | encodedString * data = wrap->fetchRawBody(*which); |
648 | if (!data) return 0; | 683 | if (!data) |
684 | return 0; | ||
649 | int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); | 685 | int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); |
650 | if (err != MAILIMF_NO_ERROR) { | 686 | if (err != MAILIMF_NO_ERROR) { |
651 | delete data; | 687 | delete data; |
652 | delete wrap; | 688 | delete wrap; |
653 | return 0; | 689 | return 0; |
654 | } | 690 | } |
655 | 691 | ||
656 | rcpts = createRcptList( fields ); | 692 | rcpts = createRcptList( fields ); |
657 | ffrom = getField(fields, MAILIMF_FIELD_FROM ); | 693 | ffrom = getField(fields, MAILIMF_FIELD_FROM ); |
658 | from = getFrom(ffrom); | 694 | from = getFrom(ffrom); |
659 | 695 | ||
660 | if (rcpts && from) { | 696 | if (rcpts && from) { |
661 | res = smtpSend(from,rcpts,data->Content(),data->Length(),smtp ); | 697 | res = smtpSend(from,rcpts,data->Content(),data->Length(),smtp ); |
662 | } | 698 | } |
663 | if (fields) { | 699 | if (fields) { |
664 | mailimf_fields_free(fields); | 700 | mailimf_fields_free(fields); |
665 | fields = 0; | 701 | fields = 0; |
666 | } | 702 | } |
667 | if (data) { | 703 | if (data) { |
668 | delete data; | 704 | delete data; |
669 | } | 705 | } |
670 | if (from) { | 706 | if (from) { |
671 | free(from); | 707 | free(from); |
672 | } | 708 | } |
673 | if (rcpts) { | 709 | if (rcpts) { |
674 | smtp_address_list_free( rcpts ); | 710 | smtp_address_list_free( rcpts ); |
675 | } | 711 | } |
676 | return res; | 712 | return res; |
677 | } | 713 | } |
678 | 714 | ||
679 | /* this is a special fun */ | 715 | /* this is a special fun */ |
680 | bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | 716 | bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) { |
681 | { | ||
682 | bool returnValue = true; | 717 | bool returnValue = true; |
683 | 718 | ||
684 | if (!smtp) return false; | 719 | if (!smtp) |
720 | return false; | ||
685 | 721 | ||
686 | QString localfolders = AbstractMail::defaultLocalfolder(); | 722 | QString localfolders = AbstractMail::defaultLocalfolder(); |
687 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); | 723 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
688 | if (!wrap) { | 724 | if (!wrap) { |
689 | qDebug("memory error"); | 725 | qDebug("memory error"); |
690 | return false; | 726 | return false; |
691 | } | 727 | } |
692 | QList<RecMail> mailsToSend; | 728 | QList<RecMail> mailsToSend; |
693 | QList<RecMail> mailsToRemove; | 729 | QList<RecMail> mailsToRemove; |
694 | QString mbox("Outgoing"); | 730 | QString mbox("Outgoing"); |
695 | wrap->listMessages(mbox,mailsToSend); | 731 | wrap->listMessages(mbox,mailsToSend); |
696 | if (mailsToSend.count()==0) { | 732 | if (mailsToSend.count()==0) { |
697 | delete wrap; | 733 | delete wrap; |
698 | return false; | 734 | return false; |
699 | } | 735 | } |
700 | mailsToSend.setAutoDelete(false); | 736 | mailsToSend.setAutoDelete(false); |
701 | sendProgress = new progressMailSend(); | 737 | sendProgress = new progressMailSend(); |
702 | sendProgress->show(); | 738 | sendProgress->show(); |
703 | sendProgress->setMaxMails(mailsToSend.count()); | 739 | sendProgress->setMaxMails(mailsToSend.count()); |
704 | 740 | ||
705 | while (mailsToSend.count()>0) { | 741 | while (mailsToSend.count()>0) { |
706 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { | 742 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { |
707 | QMessageBox::critical(0,tr("Error sending mail"), | 743 | QMessageBox::critical(0,tr("Error sending mail"), |
708 | tr("Error sending queued mail - breaking")); | 744 | tr("Error sending queued mail - breaking")); |
709 | returnValue = false; | 745 | returnValue = false; |
710 | break; | 746 | break; |
711 | } | 747 | } |
712 | mailsToRemove.append(mailsToSend.at(0)); | 748 | mailsToRemove.append(mailsToSend.at(0)); |
713 | mailsToSend.removeFirst(); | 749 | mailsToSend.removeFirst(); |
714 | sendProgress->setCurrentMails(mailsToRemove.count()); | 750 | sendProgress->setCurrentMails(mailsToRemove.count()); |
715 | } | 751 | } |
716 | Config cfg( "mail" ); | 752 | Config cfg( "mail" ); |
717 | cfg.setGroup( "Status" ); | 753 | cfg.setGroup( "Status" ); |
718 | m_queuedMail = 0; | 754 | m_queuedMail = 0; |
719 | cfg.writeEntry( "outgoing", m_queuedMail ); | 755 | cfg.writeEntry( "outgoing", m_queuedMail ); |
720 | emit queuedMails( m_queuedMail ); | 756 | emit queuedMails( m_queuedMail ); |
721 | sendProgress->hide(); | 757 | sendProgress->hide(); |
722 | delete sendProgress; | 758 | delete sendProgress; |
723 | sendProgress = 0; | 759 | sendProgress = 0; |
724 | wrap->deleteMails(mbox,mailsToRemove); | 760 | wrap->deleteMails(mbox,mailsToRemove); |
725 | mailsToSend.setAutoDelete(true); | 761 | mailsToSend.setAutoDelete(true); |
726 | delete wrap; | 762 | delete wrap; |
727 | return returnValue; | 763 | return returnValue; |
728 | } | 764 | } |
diff --git a/noncore/net/mail/smtpconfigui.ui b/noncore/net/mail/smtpconfigui.ui index f5ce8cb..d4151a9 100644 --- a/noncore/net/mail/smtpconfigui.ui +++ b/noncore/net/mail/smtpconfigui.ui | |||
@@ -1,261 +1,360 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>SMTPconfigUI</class> | 2 | <class>SMTPconfigUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>SMTPconfigUI</cstring> | 7 | <cstring>SMTPconfigUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>241</width> | 14 | <width>335</width> |
15 | <height>321</height> | 15 | <height>426</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Configure SMTP</string> | 20 | <string>Configure SMTP</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>2</number> | 31 | <number>3</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>2</number> | 35 | <number>3</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QLayoutWidget</class> | 38 | <class>QLabel</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>Layout4</cstring> | 41 | <cstring>accountLabel</cstring> |
42 | </property> | ||
43 | <property stdset="1"> | ||
44 | <name>text</name> | ||
45 | <string>Account</string> | ||
46 | </property> | ||
47 | </widget> | ||
48 | <widget> | ||
49 | <class>QLineEdit</class> | ||
50 | <property stdset="1"> | ||
51 | <name>name</name> | ||
52 | <cstring>accountLine</cstring> | ||
42 | </property> | 53 | </property> |
43 | <property> | 54 | <property> |
44 | <name>layoutSpacing</name> | 55 | <name>toolTip</name> |
56 | <string>Name of the Account</string> | ||
57 | </property> | ||
58 | </widget> | ||
59 | <widget> | ||
60 | <class>Line</class> | ||
61 | <property stdset="1"> | ||
62 | <name>name</name> | ||
63 | <cstring>line1</cstring> | ||
64 | </property> | ||
65 | <property stdset="1"> | ||
66 | <name>sizePolicy</name> | ||
67 | <sizepolicy> | ||
68 | <hsizetype>1</hsizetype> | ||
69 | <vsizetype>0</vsizetype> | ||
70 | </sizepolicy> | ||
71 | </property> | ||
72 | <property stdset="1"> | ||
73 | <name>orientation</name> | ||
74 | <enum>Horizontal</enum> | ||
45 | </property> | 75 | </property> |
46 | <grid> | 76 | </widget> |
77 | <widget> | ||
78 | <class>QLayoutWidget</class> | ||
79 | <property stdset="1"> | ||
80 | <name>name</name> | ||
81 | <cstring>Layout20</cstring> | ||
82 | </property> | ||
83 | <hbox> | ||
47 | <property stdset="1"> | 84 | <property stdset="1"> |
48 | <name>margin</name> | 85 | <name>margin</name> |
49 | <number>0</number> | 86 | <number>0</number> |
50 | </property> | 87 | </property> |
51 | <property stdset="1"> | 88 | <property stdset="1"> |
52 | <name>spacing</name> | 89 | <name>spacing</name> |
53 | <number>2</number> | 90 | <number>6</number> |
54 | </property> | 91 | </property> |
55 | <widget row="0" column="0" rowspan="1" colspan="2" > | 92 | <widget> |
56 | <class>QLabel</class> | 93 | <class>QLayoutWidget</class> |
57 | <property stdset="1"> | ||
58 | <name>name</name> | ||
59 | <cstring>accountLabel</cstring> | ||
60 | </property> | ||
61 | <property stdset="1"> | ||
62 | <name>text</name> | ||
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> | ||
141 | </property> | ||
142 | <property stdset="1"> | ||
143 | <name>text</name> | ||
144 | <string>Password</string> | ||
145 | </property> | ||
146 | </widget> | ||
147 | <widget row="3" column="0" > | ||
148 | <class>QLabel</class> | ||
149 | <property stdset="1"> | 94 | <property stdset="1"> |
150 | <name>name</name> | 95 | <name>name</name> |
151 | <cstring>portLabel</cstring> | 96 | <cstring>Layout18</cstring> |
152 | </property> | ||
153 | <property stdset="1"> | ||
154 | <name>text</name> | ||
155 | <string>Port</string> | ||
156 | </property> | ||
157 | </widget> | ||
158 | <widget row="2" column="0" > | ||
159 | <class>QLabel</class> | ||
160 | <property stdset="1"> | ||
161 | <name>name</name> | ||
162 | <cstring>serverLabel</cstring> | ||
163 | </property> | ||
164 | <property stdset="1"> | ||
165 | <name>text</name> | ||
166 | <string>Server</string> | ||
167 | </property> | ||
168 | </widget> | ||
169 | <widget row="3" column="1" rowspan="1" colspan="2" > | ||
170 | <class>QLineEdit</class> | ||
171 | <property stdset="1"> | ||
172 | <name>name</name> | ||
173 | <cstring>portLine</cstring> | ||
174 | </property> | ||
175 | <property> | ||
176 | <name>toolTip</name> | ||
177 | <string>Port of the SMTP Server</string> | ||
178 | </property> | 97 | </property> |
98 | <vbox> | ||
99 | <property stdset="1"> | ||
100 | <name>margin</name> | ||
101 | <number>0</number> | ||
102 | </property> | ||
103 | <property stdset="1"> | ||
104 | <name>spacing</name> | ||
105 | <number>6</number> | ||
106 | </property> | ||
107 | <widget> | ||
108 | <class>QLabel</class> | ||
109 | <property stdset="1"> | ||
110 | <name>name</name> | ||
111 | <cstring>serverLabel</cstring> | ||
112 | </property> | ||
113 | <property stdset="1"> | ||
114 | <name>text</name> | ||
115 | <string>Server</string> | ||
116 | </property> | ||
117 | </widget> | ||
118 | <widget> | ||
119 | <class>QLabel</class> | ||
120 | <property stdset="1"> | ||
121 | <name>name</name> | ||
122 | <cstring>portLabel</cstring> | ||
123 | </property> | ||
124 | <property stdset="1"> | ||
125 | <name>text</name> | ||
126 | <string>Port</string> | ||
127 | </property> | ||
128 | </widget> | ||
129 | </vbox> | ||
179 | </widget> | 130 | </widget> |
180 | <widget row="1" column="0" rowspan="1" colspan="3" > | 131 | <widget> |
181 | <class>Line</class> | 132 | <class>QLayoutWidget</class> |
182 | <property stdset="1"> | 133 | <property stdset="1"> |
183 | <name>name</name> | 134 | <name>name</name> |
184 | <cstring>line1</cstring> | 135 | <cstring>Layout19</cstring> |
185 | </property> | ||
186 | <property stdset="1"> | ||
187 | <name>sizePolicy</name> | ||
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> | ||
196 | </property> | 136 | </property> |
137 | <vbox> | ||
138 | <property stdset="1"> | ||
139 | <name>margin</name> | ||
140 | <number>0</number> | ||
141 | </property> | ||
142 | <property stdset="1"> | ||
143 | <name>spacing</name> | ||
144 | <number>6</number> | ||
145 | </property> | ||
146 | <widget> | ||
147 | <class>QLineEdit</class> | ||
148 | <property stdset="1"> | ||
149 | <name>name</name> | ||
150 | <cstring>serverLine</cstring> | ||
151 | </property> | ||
152 | <property> | ||
153 | <name>toolTip</name> | ||
154 | <string>Name of the SMTP Server</string> | ||
155 | </property> | ||
156 | </widget> | ||
157 | <widget> | ||
158 | <class>QLineEdit</class> | ||
159 | <property stdset="1"> | ||
160 | <name>name</name> | ||
161 | <cstring>portLine</cstring> | ||
162 | </property> | ||
163 | <property> | ||
164 | <name>toolTip</name> | ||
165 | <string>Port of the SMTP Server</string> | ||
166 | </property> | ||
167 | </widget> | ||
168 | </vbox> | ||
197 | </widget> | 169 | </widget> |
198 | <widget row="7" column="0" rowspan="1" colspan="2" > | 170 | </hbox> |
199 | <class>QLabel</class> | 171 | </widget> |
172 | <widget> | ||
173 | <class>QLabel</class> | ||
174 | <property stdset="1"> | ||
175 | <name>name</name> | ||
176 | <cstring>TextLabel1</cstring> | ||
177 | </property> | ||
178 | <property stdset="1"> | ||
179 | <name>text</name> | ||
180 | <string>Use secure sockets:</string> | ||
181 | </property> | ||
182 | </widget> | ||
183 | <widget> | ||
184 | <class>QComboBox</class> | ||
185 | <property stdset="1"> | ||
186 | <name>name</name> | ||
187 | <cstring>ComboBox1</cstring> | ||
188 | </property> | ||
189 | </widget> | ||
190 | <widget> | ||
191 | <class>QLineEdit</class> | ||
192 | <property stdset="1"> | ||
193 | <name>name</name> | ||
194 | <cstring>CommandEdit</cstring> | ||
195 | </property> | ||
196 | <property stdset="1"> | ||
197 | <name>text</name> | ||
198 | <string>ssh $SERVER exec</string> | ||
199 | </property> | ||
200 | </widget> | ||
201 | <widget> | ||
202 | <class>Line</class> | ||
203 | <property stdset="1"> | ||
204 | <name>name</name> | ||
205 | <cstring>line2</cstring> | ||
206 | </property> | ||
207 | <property stdset="1"> | ||
208 | <name>sizePolicy</name> | ||
209 | <sizepolicy> | ||
210 | <hsizetype>1</hsizetype> | ||
211 | <vsizetype>0</vsizetype> | ||
212 | </sizepolicy> | ||
213 | </property> | ||
214 | <property stdset="1"> | ||
215 | <name>orientation</name> | ||
216 | <enum>Horizontal</enum> | ||
217 | </property> | ||
218 | </widget> | ||
219 | <widget> | ||
220 | <class>QCheckBox</class> | ||
221 | <property stdset="1"> | ||
222 | <name>name</name> | ||
223 | <cstring>loginBox</cstring> | ||
224 | </property> | ||
225 | <property stdset="1"> | ||
226 | <name>text</name> | ||
227 | <string>Use Login</string> | ||
228 | </property> | ||
229 | </widget> | ||
230 | <widget> | ||
231 | <class>QLayoutWidget</class> | ||
232 | <property stdset="1"> | ||
233 | <name>name</name> | ||
234 | <cstring>Layout17</cstring> | ||
235 | </property> | ||
236 | <hbox> | ||
237 | <property stdset="1"> | ||
238 | <name>margin</name> | ||
239 | <number>0</number> | ||
240 | </property> | ||
241 | <property stdset="1"> | ||
242 | <name>spacing</name> | ||
243 | <number>6</number> | ||
244 | </property> | ||
245 | <widget> | ||
246 | <class>QLayoutWidget</class> | ||
200 | <property stdset="1"> | 247 | <property stdset="1"> |
201 | <name>name</name> | 248 | <name>name</name> |
202 | <cstring>userLabel</cstring> | 249 | <cstring>Layout15</cstring> |
203 | </property> | ||
204 | <property stdset="1"> | ||
205 | <name>text</name> | ||
206 | <string>User</string> | ||
207 | </property> | 250 | </property> |
251 | <vbox> | ||
252 | <property stdset="1"> | ||
253 | <name>margin</name> | ||
254 | <number>0</number> | ||
255 | </property> | ||
256 | <property stdset="1"> | ||
257 | <name>spacing</name> | ||
258 | <number>6</number> | ||
259 | </property> | ||
260 | <widget> | ||
261 | <class>QLabel</class> | ||
262 | <property stdset="1"> | ||
263 | <name>name</name> | ||
264 | <cstring>userLabel</cstring> | ||
265 | </property> | ||
266 | <property stdset="1"> | ||
267 | <name>text</name> | ||
268 | <string>User</string> | ||
269 | </property> | ||
270 | </widget> | ||
271 | <widget> | ||
272 | <class>QLabel</class> | ||
273 | <property stdset="1"> | ||
274 | <name>name</name> | ||
275 | <cstring>passLabel</cstring> | ||
276 | </property> | ||
277 | <property stdset="1"> | ||
278 | <name>text</name> | ||
279 | <string>Password</string> | ||
280 | </property> | ||
281 | </widget> | ||
282 | </vbox> | ||
208 | </widget> | 283 | </widget> |
209 | <widget row="5" column="0" rowspan="1" colspan="3" > | 284 | <widget> |
210 | <class>Line</class> | 285 | <class>QLayoutWidget</class> |
211 | <property stdset="1"> | 286 | <property stdset="1"> |
212 | <name>name</name> | 287 | <name>name</name> |
213 | <cstring>line2</cstring> | 288 | <cstring>Layout16</cstring> |
214 | </property> | ||
215 | <property stdset="1"> | ||
216 | <name>sizePolicy</name> | ||
217 | <sizepolicy> | ||
218 | <hsizetype>3</hsizetype> | ||
219 | <vsizetype>0</vsizetype> | ||
220 | </sizepolicy> | ||
221 | </property> | ||
222 | <property stdset="1"> | ||
223 | <name>orientation</name> | ||
224 | <enum>Horizontal</enum> | ||
225 | </property> | 289 | </property> |
290 | <vbox> | ||
291 | <property stdset="1"> | ||
292 | <name>margin</name> | ||
293 | <number>0</number> | ||
294 | </property> | ||
295 | <property stdset="1"> | ||
296 | <name>spacing</name> | ||
297 | <number>6</number> | ||
298 | </property> | ||
299 | <widget> | ||
300 | <class>QLineEdit</class> | ||
301 | <property stdset="1"> | ||
302 | <name>name</name> | ||
303 | <cstring>userLine</cstring> | ||
304 | </property> | ||
305 | <property stdset="1"> | ||
306 | <name>enabled</name> | ||
307 | <bool>false</bool> | ||
308 | </property> | ||
309 | </widget> | ||
310 | <widget> | ||
311 | <class>QLineEdit</class> | ||
312 | <property stdset="1"> | ||
313 | <name>name</name> | ||
314 | <cstring>passLine</cstring> | ||
315 | </property> | ||
316 | <property stdset="1"> | ||
317 | <name>enabled</name> | ||
318 | <bool>false</bool> | ||
319 | </property> | ||
320 | <property stdset="1"> | ||
321 | <name>echoMode</name> | ||
322 | <enum>Password</enum> | ||
323 | </property> | ||
324 | </widget> | ||
325 | </vbox> | ||
226 | </widget> | 326 | </widget> |
227 | </grid> | 327 | </hbox> |
228 | </widget> | 328 | </widget> |
229 | <spacer> | 329 | <spacer> |
230 | <property> | 330 | <property> |
231 | <name>name</name> | 331 | <name>name</name> |
232 | <cstring>spacer</cstring> | 332 | <cstring>spacer</cstring> |
233 | </property> | 333 | </property> |
234 | <property stdset="1"> | 334 | <property stdset="1"> |
235 | <name>orientation</name> | 335 | <name>orientation</name> |
236 | <enum>Vertical</enum> | 336 | <enum>Vertical</enum> |
237 | </property> | 337 | </property> |
238 | <property stdset="1"> | 338 | <property stdset="1"> |
239 | <name>sizeType</name> | 339 | <name>sizeType</name> |
240 | <enum>Expanding</enum> | 340 | <enum>Expanding</enum> |
241 | </property> | 341 | </property> |
242 | <property> | 342 | <property> |
243 | <name>sizeHint</name> | 343 | <name>sizeHint</name> |
244 | <size> | 344 | <size> |
245 | <width>20</width> | 345 | <width>20</width> |
246 | <height>20</height> | 346 | <height>20</height> |
247 | </size> | 347 | </size> |
248 | </property> | 348 | </property> |
249 | </spacer> | 349 | </spacer> |
250 | </vbox> | 350 | </vbox> |
251 | </widget> | 351 | </widget> |
252 | <tabstops> | 352 | <tabstops> |
253 | <tabstop>accountLine</tabstop> | 353 | <tabstop>accountLine</tabstop> |
254 | <tabstop>serverLine</tabstop> | 354 | <tabstop>serverLine</tabstop> |
255 | <tabstop>portLine</tabstop> | 355 | <tabstop>portLine</tabstop> |
256 | <tabstop>sslBox</tabstop> | ||
257 | <tabstop>loginBox</tabstop> | 356 | <tabstop>loginBox</tabstop> |
258 | <tabstop>userLine</tabstop> | 357 | <tabstop>userLine</tabstop> |
259 | <tabstop>passLine</tabstop> | 358 | <tabstop>passLine</tabstop> |
260 | </tabstops> | 359 | </tabstops> |
261 | </UI> | 360 | </UI> |