Imported Upstream version 0.8~alpha1
[platform/upstream/syncevolution.git] / src / client-api / src / c++ / common / spds / SyncSourceConfig.cpp
index 5b06fad..80112f8 100644 (file)
 
 #include "spds/SyncSourceConfig.h"
 #include "base/util/utils.h"
+#include "base/globalsdef.h"
+
+USE_NAMESPACE
+
 
 
 SyncSourceConfig::SyncSourceConfig() {
@@ -184,11 +188,27 @@ void SyncSourceConfig::setSupportedTypes(const char* s) {
     supportedTypes = stringdup(s);
 }
 
-CTCap SyncSourceConfig::getCtCap() const {
-    return ctCap;
+CTCap* SyncSourceConfig::createCtCap(ArrayList *props, const char *ct_Type, const char *ver_CT, bool fLevel) {
+
+    return new CTCap(ct_Type , ver_CT, fLevel, *props);
 }
-void SyncSourceConfig::setCtCap(CTCap v){
-    ctCap.setCTTypeSupported(v.getCTTypeSupported());
+
+void SyncSourceConfig::addCtCap(ArrayList *props, const char *ct_Type, const char *ver_CT, int fLevel){
+    const char* cttype;
+    const char* verct;
+    bool fieldlevel;
+    cttype = ( ct_Type ) ? ct_Type : getType()    ; 
+    verct  = ( ver_CT  ) ? ver_CT  : getVersion() ;
+    if ( fLevel == FLEVEL_UNDEFINED ){
+        fieldlevel = getFieldLevel();
+    }else if ( fLevel == FLEVEL_DISABLED ){
+        fieldlevel = false;
+    }else if ( fLevel == FLEVEL_ENABLED ){
+        fieldlevel = true;
+    }
+
+    ctCaps.add(*(createCtCap(props, cttype, verct, fieldlevel)));
+
 }
 
 const char* SyncSourceConfig::getEncryption() const {
@@ -198,6 +218,7 @@ const char* SyncSourceConfig::getEncryption() const {
 void SyncSourceConfig::setEncryption(const char* n) {
     safeDelete(&encryption);
     encryption = stringdup(n);
+
 }
 
 // ------------------------------------------------------------- Private methods
@@ -216,6 +237,7 @@ void SyncSourceConfig::assign(const SyncSourceConfig& sc) {
     setEncoding      (sc.getEncoding      ());
     setVersion       (sc.getVersion       ());
     setSupportedTypes(sc.getSupportedTypes());
-    setCtCap         (sc.getCtCap         ());
+//    setCtCap         (sc.getCtCap         ());
     setEncryption    (sc.getEncryption    ());
+
 }