[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/runtime/resources/kolabproxy/wizard
From:       Casey Link <unnamedrambler () gmail ! com>
Date:       2010-05-31 23:51:29
Message-ID: 20100531235129.711ECAC8CC () svn ! kde ! org
[Download RAW message or body]

SVN commit 1133039 by link:

Make the kolab resource wizard perform a servertest on the imap server,
now it works with demo.kolab.org.

 M  +47 -9     kolabwizard.js  


--- trunk/KDE/kdepim/runtime/resources/kolabproxy/wizard/kolabwizard.js \
#1133038:1133039 @@ -1,5 +1,6 @@
 /*
     Copyright (c) 2009 Volker Krause <vkrause@kde.org>
+    Copyright (c) 2010 Casey Link <unnamedrambler@gmail.com>
 
     This library is free software; you can redistribute it and/or modify it
     under the terms of the GNU Library General Public License as published by
@@ -41,22 +42,22 @@
   }
 }
 
+// stage 1, setup identity and run imap server test
+// stage 2, smtp setup (no server test), ldap and korganizer
+var stage = 1;
+var identity; // global so it can be accesed in setup and testOk
+
 function setup()
 {
+  if ( stage == 1 ) {
   SetupManager.createResource( "akonadi_kolabproxy_resource" );
 
-  var identity = SetupManager.createIdentity();
+    identity = SetupManager.createIdentity();
   identity.setEmail( SetupManager.email() );
   identity.setRealName( SetupManager.name() );
 
-  var imapRes = SetupManager.createResource( "akonadi_imap_resource" );
-  imapRes.setOption( "ImapServer", page.widget().serverAddress.text );
-  imapRes.setOption( "UserName", SetupManager.email() );
-  imapRes.setOption( "Password", SetupManager.password() );
-  imapRes.setOption( "UseDefaultIdentity", false );
-  imapRes.setOption( "AccountIdentity", identity.uoid() );
-  imapRes.setOption( "SubscriptionEnabled", true );
-
+    ServerTest.test( page.widget().serverAddress.text, "imap" );
+  } else { // stage 2
   var smtp = SetupManager.createTransport( "smtp" );
   smtp.setName( page.widget().serverAddress.text );
   smtp.setHost( page.widget().serverAddress.text );
@@ -76,7 +77,44 @@
   korganizer.setConfig( "FreeBusy Retrieve", "FreeBusyRetrieveUrl", "https://" + \
page.widget().serverAddress.text  + "/freebusy/" );  SetupManager.execute();
 }
+}
 
+function testResultFail()
+{
+  testOk( -1 );
+}
+
+function testOk( arg )
+{
+    print("testOk arg =", arg);
+    var imapRes = SetupManager.createResource( "akonadi_imap_resource" );
+    imapRes.setOption( "ImapServer", page.widget().serverAddress.text );
+    imapRes.setOption( "UserName", SetupManager.email() );
+    imapRes.setOption( "Password", SetupManager.password() );
+    imapRes.setOption( "UseDefaultIdentity", false );
+    imapRes.setOption( "AccountIdentity", identity.uoid() );
+    imapRes.setOption( "SubscriptionEnabled", true );
+    if ( arg == "ssl" ) { 
+      // The ENUM used for authentication (in the imap resource only)
+      // is KIMAP::LoginJob::AuthenticationMode
+      imapRes.setOption( "Safety", "SSL" ); // SSL/TLS
+      imapRes.setOption( "Authentication", 0 ); // ClearText
+      imapRes.setOption( "ImapPort", 993 );
+    } else if ( arg == "tls" ) { // tls is really STARTTLS
+      imapRes.setOption( "Safety", "STARTTLS" );  // STARTTLS
+      imapRes.setOption( "Authentication", 0 ); // ClearText
+      imapRes.setOption( "ImapPort", 143 );
+    } else {
+      imapRes.setOption( "Safety", "NONE" );  // No encryption
+      imapRes.setOption( "Authentication", 0 ); // ClearText
+      imapRes.setOption( "ImapPort", 143 );
+    }
+    stage = 2;
+    setup();
+}
+
+connect( ServerTest, "testFail()", this, "testResultFail()" );
+connect( ServerTest, "testResult(QString)", this, "testOk(QString)" );
 connect( page.widget().serverAddress, "textChanged(QString)", this, \
"serverChanged(QString)" );  connect( page, "pageLeftNext()", this, "setup()" );
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic