~ubuntu-branches/ubuntu/raring/kdepim/raring-proposed

« back to all changes in this revision

Viewing changes to importwizard/evolutionv3/evolutionsettings.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-06-07 07:56:38 UTC
  • mfrom: (0.2.27)
  • Revision ID: package-import@ubuntu.com-20120607075638-0luhdq11z7sgvs4m
Tags: 4:4.8.80-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (c) 2012 Montel Laurent <montel@kde.org>
 
3
 
 
4
  This program is free software; you can redistribute it and/or modify it
 
5
  under the terms of the GNU General Public License, version 2, as
 
6
  published by the Free Software Foundation.
 
7
 
 
8
  This program is distributed in the hope that it will be useful, but
 
9
  WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
  General Public License for more details.
 
12
 
 
13
  You should have received a copy of the GNU General Public License along
 
14
  with this program; if not, write to the Free Software Foundation, Inc.,
 
15
  51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
16
*/
 
17
 
 
18
#include "evolutionsettings.h"
 
19
#include "evolutionutil.h"
 
20
 
 
21
#include <kpimidentities/identity.h>
 
22
 
 
23
#include <mailtransport/transportmanager.h>
 
24
 
 
25
#include <KConfig>
 
26
#include <KConfigGroup>
 
27
#include <KDebug>
 
28
 
 
29
#include <QFile>
 
30
#include <QDir>
 
31
#include <QDomDocument>
 
32
#include <QDomElement>
 
33
#include <QDebug>
 
34
 
 
35
EvolutionSettings::EvolutionSettings( const QString& filename, ImportWizard *parent )
 
36
    :AbstractSettings( parent )
 
37
{
 
38
  //Read gconf file
 
39
  QFile file(filename);
 
40
  if ( !file.open( QIODevice::ReadOnly ) ) {
 
41
    kDebug()<<" We can't open file"<<filename;
 
42
    return;
 
43
  }
 
44
  QDomDocument doc;
 
45
  if ( !EvolutionUtil::loadInDomDocument( &file, doc ) )
 
46
    return;
 
47
  QDomElement config = doc.documentElement();
 
48
 
 
49
  if ( config.isNull() ) {
 
50
    kDebug() << "No config found";
 
51
    return;
 
52
  }
 
53
  for ( QDomElement e = config.firstChildElement(); !e.isNull(); e = e.nextSiblingElement() ) {
 
54
    const QString tag = e.tagName();
 
55
    if ( tag == QLatin1String( "entry" ) ) {
 
56
      if ( e.hasAttribute( "name" ) ) {
 
57
        const QString attr = e.attribute("name");
 
58
        if ( attr == QLatin1String( "accounts" ) ) {
 
59
          readAccount(e);
 
60
        } else if ( attr == QLatin1String( "signatures" ) ) {
 
61
          readSignatures( e );
 
62
        } else if( attr == QLatin1String("send_recv_all_on_start")) {
 
63
          //TODO
 
64
        } else if( attr == QLatin1String("send_recv_on_start")) {
 
65
          //TODO
 
66
        } else {
 
67
          qDebug()<<" attr unknown "<<attr;
 
68
        }
 
69
      }
 
70
    }
 
71
  }
 
72
}
 
73
 
 
74
EvolutionSettings::~EvolutionSettings()
 
75
{
 
76
}
 
77
 
 
78
void EvolutionSettings::readSignatures(const QDomElement &account)
 
79
{
 
80
  for ( QDomElement signatureConfig = account.firstChildElement(); !signatureConfig.isNull(); signatureConfig = signatureConfig.nextSiblingElement() ) {
 
81
    if(signatureConfig.tagName() == QLatin1String("li")) {
 
82
      QDomElement stringValue = signatureConfig.firstChildElement();
 
83
      extractSignatureInfo(stringValue.text());
 
84
    }
 
85
  }
 
86
}
 
87
 
 
88
void EvolutionSettings::extractSignatureInfo( const QString&info )
 
89
{
 
90
  qDebug()<<" signature info "<<info;
 
91
  QDomDocument signature;
 
92
  if ( !EvolutionUtil::loadInDomDocument( info, signature ) )
 
93
    return;
 
94
 
 
95
  QDomElement domElement = signature.documentElement();
 
96
 
 
97
  if ( domElement.isNull() ) {
 
98
    kDebug() << "Signature not found";
 
99
    return;
 
100
  }
 
101
  for ( QDomElement e = domElement.firstChildElement(); !e.isNull(); e = e.nextSiblingElement() ) {
 
102
    KPIMIdentities::Signature signature;
 
103
    
 
104
    const QString tag = e.tagName();
 
105
    const QString uid = e.attribute( QLatin1String( "uid" ) );
 
106
    const QString signatureName = e.attribute( QLatin1String( "name" ) ); //Use it ?
 
107
    const QString format = e.attribute( QLatin1String( "text" ) );
 
108
    const bool automatic = ( e.attribute( QLatin1String( "auto" ) ) == QLatin1String( "true" ) );
 
109
 
 
110
    if ( format == QLatin1String( "text/html" ) ) {
 
111
      signature.setInlinedHtml( true );
 
112
    } else if ( format == QLatin1String( "text/plain" ) ) {
 
113
      signature.setInlinedHtml( false );
 
114
    }
 
115
    
 
116
    
 
117
    if ( tag == QLatin1String( "filename" ) ) {
 
118
      if ( e.hasAttribute( QLatin1String( "script" ) ) && e.attribute( QLatin1String( "script" ) ) == QLatin1String( "true" ) ){
 
119
        signature.setUrl( e.text(), true );
 
120
        signature.setType( KPIMIdentities::Signature::FromCommand );
 
121
      }
 
122
      else {
 
123
        signature.setUrl( QDir::homePath() + QLatin1String( ".local/share/evolution/signatures/" ) + e.text(), false );
 
124
        signature.setType( KPIMIdentities::Signature::FromFile );
 
125
 
 
126
      }
 
127
    }
 
128
    
 
129
    if ( automatic ) {
 
130
      // TODO
 
131
    }
 
132
    
 
133
    mMapSignature.insert( uid, signature );
 
134
        
 
135
    qDebug()<<" signature tag :"<<tag;
 
136
  }
 
137
}
 
138
 
 
139
void EvolutionSettings::readAccount(const QDomElement &account)
 
140
{
 
141
  for ( QDomElement accountConfig = account.firstChildElement(); !accountConfig.isNull(); accountConfig = accountConfig.nextSiblingElement() ) {
 
142
    if(accountConfig.tagName() == QLatin1String("li")) {
 
143
      QDomElement stringValue = accountConfig.firstChildElement();
 
144
      extractAccountInfo(stringValue.text());
 
145
    }
 
146
  }
 
147
}
 
148
 
 
149
void EvolutionSettings::extractAccountInfo(const QString& info)
 
150
{
 
151
  qDebug()<<" info "<<info;
 
152
  //Read QDomElement
 
153
  QDomDocument account;
 
154
  if ( !EvolutionUtil::loadInDomDocument( info, account ) )
 
155
    return;
 
156
 
 
157
  QDomElement domElement = account.documentElement();
 
158
 
 
159
  if ( domElement.isNull() ) {
 
160
    kDebug() << "Account not found";
 
161
    return;
 
162
  }
 
163
  KPIMIdentities::Identity* newIdentity = createIdentity();
 
164
  QString name;
 
165
  if(domElement.hasAttribute(QLatin1String("name"))) {
 
166
    name = domElement.attribute(QLatin1String("name"));
 
167
  }
 
168
  for ( QDomElement e = domElement.firstChildElement(); !e.isNull(); e = e.nextSiblingElement() ) {
 
169
    const QString tag = e.tagName();
 
170
    if ( tag == QLatin1String( "identity" ) )
 
171
    {
 
172
      for ( QDomElement identity = e.firstChildElement(); !identity.isNull(); identity = identity.nextSiblingElement() ) {
 
173
        const QString identityTag = identity.tagName();
 
174
        if ( identityTag == QLatin1String( "name" ) )
 
175
        {
 
176
          const QString fullName( identity.text() );
 
177
          newIdentity->setIdentityName( fullName );
 
178
          newIdentity->setFullName( fullName );
 
179
        }
 
180
        else if ( identityTag == QLatin1String( "addr-spec" ) )
 
181
        {
 
182
          newIdentity->setPrimaryEmailAddress(identity.text());
 
183
        }
 
184
        else if ( identityTag == QLatin1String( "organization" ) )
 
185
        {
 
186
          newIdentity->setOrganization(identity.text());
 
187
        }
 
188
        else if ( identityTag == QLatin1String( "signature" ) )
 
189
        {
 
190
          if ( identity.hasAttribute( "uid" ) ) {
 
191
            newIdentity->setSignature( mMapSignature.value( identity.attribute( "uid" ) ) );
 
192
          }
 
193
        }
 
194
        else if ( identityTag == QLatin1String( "reply-to" ) )
 
195
        {
 
196
          newIdentity->setReplyToAddr( identity.text() );
 
197
        }
 
198
        else
 
199
        {
 
200
          qDebug()<<" tag identity not found :"<<identityTag;
 
201
        }
 
202
      }
 
203
    }
 
204
    else if ( tag == QLatin1String( "source" ) )
 
205
    {
 
206
      if(e.hasAttribute(QLatin1String("save-passwd"))&& e.attribute( "save-passwd" ) == QLatin1String( "true" ) ) {
 
207
        //TODO
 
208
      }
 
209
      int interval = -1;
 
210
      bool intervalCheck = false;
 
211
      if(e.hasAttribute(QLatin1String("auto-check"))) {
 
212
        intervalCheck = ( e.attribute(QLatin1String("auto-check")) == QLatin1String( "true" ) );
 
213
      }
 
214
      if(e.hasAttribute(QLatin1String("auto-check-timeout"))) {
 
215
        interval = e.attribute(QLatin1String("auto-check-timeout")).toInt();
 
216
      }
 
217
      for ( QDomElement server = e.firstChildElement(); !server.isNull(); server = server.nextSiblingElement() ) {
 
218
        const QString serverTag = server.tagName();
 
219
        if ( serverTag == QLatin1String( "url" ) ) {
 
220
          qDebug()<<" server.text() :"<<server.text();
 
221
          QUrl serverUrl( server.text() );
 
222
          const QString scheme = serverUrl.scheme();
 
223
          QMap<QString, QVariant> settings;
 
224
          const int port = serverUrl.port();
 
225
 
 
226
          const QString path = serverUrl.path();
 
227
          qDebug()<<" path !"<<path;
 
228
          const QString userName = serverUrl.userInfo();
 
229
 
 
230
          const QStringList listArgument = path.split(QLatin1Char(';'));
 
231
 
 
232
          //imapx://name@pop3.xx.org:993/;security-method=ssl-on-alternate-port;namespace;shell-command=ssh%20-C%20-l%20%25u%20%25h%20exec%20/usr/sbin/imapd%20;use-shell-command=true
 
233
          if(scheme == QLatin1String("imap") || scheme == QLatin1String("imapx")) {
 
234
            if( port > 0 )
 
235
              settings.insert(QLatin1String("ImapPort"),port);
 
236
            //Perhaps imapx is specific don't know
 
237
            if ( intervalCheck ) {
 
238
              settings.insert( QLatin1String( "IntervalCheckEnabled" ), true );
 
239
            }
 
240
            if ( interval > -1 ) {
 
241
              settings.insert(QLatin1String("IntervalCheckTime" ), interval );
 
242
            }
 
243
 
 
244
            bool found = false;
 
245
            const QString securityMethod = getSecurityMethod( listArgument, found );
 
246
            if( found ) {
 
247
              if( securityMethod == QLatin1String("none")) {
 
248
                settings.insert( QLatin1String( "Safety" ), QLatin1String("None") );
 
249
                //Nothing
 
250
              } else if(securityMethod == QLatin1String("ssl-on-alternate-port")){
 
251
                settings.insert( QLatin1String( "Safety" ), QLatin1String("SSL") );
 
252
              } else {
 
253
                qDebug()<<" security method unknown : "<<path;
 
254
              }
 
255
            } else {
 
256
              settings.insert( QLatin1String( "Safety" ), QLatin1String("STARTTLS") );
 
257
            }
 
258
 
 
259
            addAuth(settings, QLatin1String( "Authentication" ), userName);
 
260
            AbstractBase::createResource( "akonadi_imap_resource", name,settings );
 
261
          } else if(scheme == QLatin1String("pop")) {
 
262
            if( port > 0 )
 
263
              settings.insert(QLatin1String("Port"),port);
 
264
            bool found = false;
 
265
            const QString securityMethod = getSecurityMethod( listArgument, found );
 
266
            if( found ) {
 
267
              if( securityMethod == QLatin1String("none")) {
 
268
                //Nothing
 
269
              } else if(securityMethod == QLatin1String("ssl-on-alternate-port")){
 
270
                settings.insert( QLatin1String( "UseSSL" ), true );
 
271
              } else {
 
272
                qDebug()<<" security method unknown : "<<path;
 
273
              }
 
274
            } else {
 
275
              settings.insert( QLatin1String( "UseTLS" ), true );
 
276
            }
 
277
 
 
278
            if ( intervalCheck ) {
 
279
              settings.insert( QLatin1String( "IntervalCheckEnabled" ), true );
 
280
            }
 
281
            if ( interval > -1 ) {
 
282
              settings.insert(QLatin1String("IntervalCheckInterval" ), interval );
 
283
            }
 
284
            if(e.hasAttribute(QLatin1String("keep-on-server"))&& e.attribute(QLatin1String("keep-on-server") ) == QLatin1String( "true" ) ) {
 
285
              settings.insert(QLatin1String("LeaveOnServer"),true);
 
286
            }
 
287
            addAuth(settings, QLatin1String( "AuthenticationMethod" ), userName);
 
288
            AbstractBase::createResource( "akonadi_pop3_resource", name, settings );
 
289
 
 
290
          } else if( scheme == QLatin1String("spool") || scheme == QLatin1String("mbox") ) {
 
291
            //mbox file
 
292
            settings.insert(QLatin1String("Path"),path);
 
293
            settings.insert(QLatin1String("DisplayName"),name);
 
294
            AbstractBase::createResource( "akonadi_mbox_resource", name, settings );
 
295
          } else if( scheme == QLatin1String("maildir") ||scheme == QLatin1String( "spooldir" ) ) {
 
296
            settings.insert(QLatin1String("Path"),path);
 
297
            AbstractBase::createResource( "akonadi_maildir_resource", name, settings );
 
298
          } else if( scheme == QLatin1String("nntp")) {
 
299
            //FIXME in the future
 
300
            qDebug()<<" For the moment we can't import nntp resource";
 
301
          } else {
 
302
            qDebug()<<" unknown scheme "<<scheme;
 
303
          }
 
304
        } else {
 
305
          qDebug()<<" server tag unknow :"<<serverTag;
 
306
        }
 
307
      }
 
308
    }
 
309
    else if ( tag == QLatin1String( "transport" ) )
 
310
    {
 
311
      if ( e.hasAttribute( "save-passwd" ) && e.attribute( "save-passwd" ) == QLatin1String( "true" ) )
 
312
      {
 
313
        //TODO save to kwallet ?
 
314
      }
 
315
      
 
316
      MailTransport::Transport *transport = createTransport();
 
317
      for ( QDomElement smtp = e.firstChildElement(); !smtp.isNull(); smtp = smtp.nextSiblingElement() ) {
 
318
        const QString smtpTag = smtp.tagName();
 
319
        if ( smtpTag == QLatin1String( "url" ) ) {
 
320
          qDebug()<<" smtp.text() :"<<smtp.text();
 
321
          QUrl smtpUrl( smtp.text() );
 
322
          const QString scheme = smtpUrl.scheme();
 
323
          if(scheme == QLatin1String("sendmail")) {
 
324
            transport->setType(MailTransport::Transport::EnumType::Sendmail);
 
325
          } else {
 
326
            transport->setHost( smtpUrl.host() );
 
327
            transport->setName( smtpUrl.host() );
 
328
            //TODO setUserName :
 
329
            //transport->setRequiresAuthentication(true);
 
330
            //transport->setUserName(....);
 
331
            const int port = smtpUrl.port();
 
332
            if ( port > 0 )
 
333
              transport->setPort( port );
 
334
 
 
335
            const QString userName = smtpUrl.userInfo();
 
336
            bool found = false;
 
337
            const QString authMethod = getAuthMethod(userName, found);
 
338
            if( found ) {
 
339
              if(authMethod==QLatin1String("PLAIN")) {
 
340
                transport->setAuthenticationType(MailTransport::Transport::EnumAuthenticationType::PLAIN);
 
341
              } else if(authMethod==QLatin1String("NTLM")) {
 
342
                transport->setAuthenticationType(MailTransport::Transport::EnumAuthenticationType::NTLM);
 
343
              } else if(authMethod==QLatin1String("DIGEST-MD5")) {
 
344
                transport->setAuthenticationType(MailTransport::Transport::EnumAuthenticationType::DIGEST_MD5);
 
345
              } else if(authMethod==QLatin1String("CRAM-MD5")) {
 
346
                transport->setAuthenticationType(MailTransport::Transport::EnumAuthenticationType::CRAM_MD5);
 
347
              } else if(authMethod==QLatin1String("LOGIN")) {
 
348
                transport->setAuthenticationType(MailTransport::Transport::EnumAuthenticationType::LOGIN);
 
349
              } else if(authMethod==QLatin1String("GSSAPI")) {
 
350
                transport->setAuthenticationType(MailTransport::Transport::EnumAuthenticationType::GSSAPI);
 
351
              } else if(authMethod==QLatin1String("POPB4SMTP")) {
 
352
                transport->setAuthenticationType(MailTransport::Transport::EnumAuthenticationType::APOP); //????
 
353
              } else {
 
354
                qDebug()<<" smtp auth method unknown "<<authMethod;
 
355
              }
 
356
            }
 
357
 
 
358
            const QString path = smtpUrl.path();
 
359
            found = false;
 
360
            const QStringList listArgument = path.split(QLatin1Char(';'));
 
361
            const QString securityMethod = getSecurityMethod( listArgument, found );
 
362
            if( found ) {
 
363
              if( securityMethod == QLatin1String("none")) {
 
364
                transport->setEncryption( MailTransport::Transport::EnumEncryption::None );
 
365
 
 
366
              } else if(securityMethod == QLatin1String("ssl-on-alternate-port")){
 
367
                transport->setEncryption( MailTransport::Transport::EnumEncryption::SSL );
 
368
              } else {
 
369
                qDebug()<<" security method unknown : "<<path;
 
370
              }
 
371
            } else {
 
372
              transport->setEncryption( MailTransport::Transport::EnumEncryption::TLS );
 
373
            }
 
374
          }
 
375
        } else {
 
376
          qDebug()<<" smtp tag unknow :"<<smtpTag;
 
377
        }
 
378
      }
 
379
      storeTransport(transport, true );
 
380
    }
 
381
    else if ( tag == QLatin1String( "drafts-folder" ) )
 
382
    {
 
383
      const QString selectedFolder = adaptFolder( e.text().remove( QLatin1String( "folder://" ) ) );
 
384
      newIdentity->setDrafts(selectedFolder); 
 
385
    }
 
386
    else if ( tag == QLatin1String( "sent-folder" ) )
 
387
    {
 
388
      const QString selectedFolder = adaptFolder( e.text().remove( QLatin1String( "folder://" ) ) );
 
389
      newIdentity->setFcc(selectedFolder);
 
390
    }
 
391
    else if ( tag == QLatin1String( "auto-cc" ) )
 
392
    {
 
393
      if ( e.hasAttribute( "always" ) && ( e.attribute( "always" ) == QLatin1String( "true" ) ) )
 
394
      {
 
395
        QDomElement recipient = e.firstChildElement();
 
396
        const QString text = recipient.text();
 
397
        newIdentity->setCc(text);
 
398
      }
 
399
    }
 
400
    else if( tag == QLatin1String("reply-to"))
 
401
    {
 
402
      newIdentity->setReplyToAddr(e.text());
 
403
    }
 
404
    else if ( tag == QLatin1String( "auto-bcc" ) )
 
405
    {
 
406
      if ( e.hasAttribute( "always" ) && ( e.attribute( "always" ) == QLatin1String( "true" ) ) )
 
407
      {
 
408
        QDomElement recipient = e.firstChildElement();
 
409
        const QString text = recipient.text();
 
410
        newIdentity->setBcc(text);
 
411
      }
 
412
    }
 
413
    else if ( tag == QLatin1String( "receipt-policy" ) )
 
414
    {
 
415
      if ( e.hasAttribute( QLatin1String( "policy" ) ) ) {
 
416
        const QString policy = e.attribute( QLatin1String( "policy" ) );
 
417
        //TODO
 
418
      }
 
419
    }
 
420
    else if ( tag == QLatin1String( "pgp" ) )
 
421
    {
 
422
      if ( e.hasAttribute( QLatin1String( "encrypt-to-self" ) ) &&
 
423
           ( e.attribute( QLatin1String( "encrypt-to-self" ) ) == QLatin1String( "true" ) ) ) {
 
424
        //TODO
 
425
      }
 
426
      if ( e.hasAttribute( QLatin1String( "always-trust" ) ) &&
 
427
           ( e.attribute( QLatin1String( "always-trust" ) ) == QLatin1String( "true" ) ) ) {
 
428
        //TODO
 
429
      }
 
430
      if ( e.hasAttribute( QLatin1String( "always-sign" ) ) &&
 
431
           ( e.attribute( QLatin1String( "always-sign" ) ) == QLatin1String( "true" ) ) ) {
 
432
        //TODO
 
433
      }
 
434
      if ( e.hasAttribute( QLatin1String( "no-imip-sign" ) ) &&
 
435
           ( e.attribute( QLatin1String( "no-imip-sign" ) ) == QLatin1String( "true" ) ) ) {
 
436
        //TODO
 
437
      }
 
438
    }
 
439
    else if ( tag == QLatin1String( "smime" ) )
 
440
    {
 
441
      if ( e.hasAttribute( QLatin1String( "sign-default" ) ) &&
 
442
           ( e.attribute( QLatin1String( "sign-default" ) ) == QLatin1String( "true" ) ) ) {
 
443
        //TODO
 
444
      }
 
445
      if ( e.hasAttribute( QLatin1String( "encrypt-default" ) ) &&
 
446
           ( e.attribute( QLatin1String( "encrypt-default" ) ) == QLatin1String( "true" ) ) ) {
 
447
        //TODO
 
448
      }
 
449
      if ( e.hasAttribute( QLatin1String( "encrypt-to-self" ) ) &&
 
450
           ( e.attribute( QLatin1String( "encrypt-to-self" ) ) == QLatin1String( "true" ) ) ) {
 
451
        //TODO
 
452
      }
 
453
      //TODO
 
454
    }
 
455
    else
 
456
      qDebug()<<" tag not know :"<<tag;
 
457
 
 
458
  }
 
459
  storeIdentity(newIdentity);
 
460
}
 
461
 
 
462
QString EvolutionSettings::getSecurityMethod( const QStringList& listArgument, bool & found )
 
463
{
 
464
  found = false;
 
465
  if(listArgument.isEmpty())
 
466
    return QString();
 
467
  Q_FOREACH( const QString& str, listArgument ) {
 
468
    if(str.contains(QLatin1String("security-method="))) {
 
469
      const int index = str.indexOf(QLatin1String("security-method="));
 
470
      if(index != -1) {
 
471
        const QString securityMethod = str.right(str.length() - index - 16 /*security-method=*/);
 
472
        found = true;
 
473
        return securityMethod;
 
474
      }
 
475
    }
 
476
  }
 
477
  return QString();
 
478
}
 
479
 
 
480
QString EvolutionSettings::getAuthMethod( const QString& path, bool & found)
 
481
{
 
482
  const int index = path.indexOf(QLatin1String("auth="));
 
483
  if(index != -1) {
 
484
    const QString securityMethod = path.right(path.length() - index - 5 /*auth=*/);
 
485
    found = true;
 
486
    return securityMethod;
 
487
  }
 
488
  found = false;
 
489
  return QString();
 
490
}
 
491
 
 
492
void EvolutionSettings::addAuth(QMap<QString, QVariant>& settings, const QString & argument, const QString& userName)
 
493
{
 
494
  bool found = false;
 
495
  const QString authMethod = getAuthMethod(userName, found);
 
496
  if( found ) {
 
497
    if(authMethod==QLatin1String("PLAIN")) {
 
498
      settings.insert( argument, MailTransport::Transport::EnumAuthenticationType::PLAIN );
 
499
    } else if(authMethod==QLatin1String("NTLM")) {
 
500
      settings.insert( argument, MailTransport::Transport::EnumAuthenticationType::NTLM );
 
501
    } else if(authMethod==QLatin1String("DIGEST-MD5")) {
 
502
      settings.insert( argument, MailTransport::Transport::EnumAuthenticationType::DIGEST_MD5 );
 
503
    } else if(authMethod==QLatin1String("CRAM-MD5")) {
 
504
      settings.insert( argument, MailTransport::Transport::EnumAuthenticationType::CRAM_MD5 );
 
505
    } else if(authMethod==QLatin1String("LOGIN")) {
 
506
      settings.insert( argument, MailTransport::Transport::EnumAuthenticationType::LOGIN );
 
507
    } else if(authMethod==QLatin1String("POPB4SMTP")) {
 
508
      settings.insert( argument, MailTransport::Transport::EnumAuthenticationType::APOP ); //????
 
509
    } else {
 
510
      qDebug()<<" smtp auth method unknown "<<authMethod;
 
511
    }
 
512
  }
 
513
}