summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/obackendfactory.h
Unidiff
Diffstat (limited to 'libopie2/opiepim/backend/obackendfactory.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/obackendfactory.h42
1 files changed, 22 insertions, 20 deletions
diff --git a/libopie2/opiepim/backend/obackendfactory.h b/libopie2/opiepim/backend/obackendfactory.h
index 9f3a823..25e247b 100644
--- a/libopie2/opiepim/backend/obackendfactory.h
+++ b/libopie2/opiepim/backend/obackendfactory.h
@@ -62,9 +62,9 @@ using namespace Opie;
62using namespace Opie::Pim; 62using namespace Opie::Pim;
63 63
64namespace Opie { 64namespace Opie {
65 65
66class OBackendPrivate; 66class OBackendPrivate;
67 67
68/** 68/**
69 * This class is our factory. It will give us the default implementations 69 * This class is our factory. It will give us the default implementations
70 * of at least Todolist, Contacts and Datebook. In the future this class will 70 * of at least Todolist, Contacts and Datebook. In the future this class will
@@ -84,8 +84,8 @@ class OBackendPrivate;
84 class OBackendFactory 84 class OBackendFactory
85 { 85 {
86 public: 86 public:
87 OBackendFactory() {}; 87 OBackendFactory() {};
88 88
89 /** 89 /**
90 * Returns a selected backend implementation 90 * Returns a selected backend implementation
91 * @param type the type of the backend 91 * @param type the type of the backend
@@ -96,16 +96,18 @@ class OBackendPrivate;
96 */ 96 */
97 static T* create( OPimGlobal::PimType type, OPimGlobal::DatabaseStyle database, 97 static T* create( OPimGlobal::PimType type, OPimGlobal::DatabaseStyle database,
98 const QString& appName, const QString& filename = QString::null ){ 98 const QString& appName, const QString& filename = QString::null ){
99 owarn << "Selected backend for " << type << " is: " << database << oendl; 99 owarn << "Selected backend for " << type << " is: " <<
100 // If we should use the dafult database style, we have to request it 100database << oendl;
101
102 // If we should use the dafult database style, we have to request it
101 OPimGlobal::DatabaseStyle use_database = database; 103 OPimGlobal::DatabaseStyle use_database = database;
102 if ( use_database == OPimGlobal::DEFAULT ){ 104 if ( use_database == OPimGlobal::DEFAULT ){
103 use_database = defaultDB( type ); 105 use_database = defaultDB( type );
104 } 106 }
105 107
106 switch ( type ){ 108 switch ( type ){
107 case OPimGlobal::TODOLIST: 109 case OPimGlobal::TODOLIST:
108 110
109 switch ( use_database ){ 111 switch ( use_database ){
110 default: // Use SQL if something weird is given. 112 default: // Use SQL if something weird is given.
111 // Fall through !! 113 // Fall through !!
@@ -166,9 +168,9 @@ class OBackendPrivate;
166 default: 168 default:
167 return (T*) NULL; 169 return (T*) NULL;
168 } 170 }
169 171
170 } 172 }
171 173
172 /** 174 /**
173 * Returns the style of the default database which is used to contact PIM data. 175 * Returns the style of the default database which is used to contact PIM data.
174 * @param type the type of the backend 176 * @param type the type of the backend
@@ -189,27 +191,27 @@ class OBackendPrivate;
189 default: 191 default:
190 group_name = "unknown"; 192 group_name = "unknown";
191 } 193 }
192 194
193 Config config( "pimaccess" ); 195 Config config( "pimaccess" );
194 config.setGroup ( group_name ); 196 config.setGroup ( group_name );
195 QString db_String = config.readEntry( "usebackend", "xml" ); 197 QString db_String = config.readEntry( "usebackend", "xml" );
196 198
197 QAsciiDict<int> dictDbTypes( OPimGlobal::_END_DatabaseStyle ); 199 QAsciiDict<int> dictDbTypes( OPimGlobal::_END_DatabaseStyle );
198 dictDbTypes.setAutoDelete( TRUE ); 200 dictDbTypes.setAutoDelete( TRUE );
199 201
200 dictDbTypes.insert( "xml", new int (OPimGlobal::XML) ); 202 dictDbTypes.insert( "xml", new int (OPimGlobal::XML) );
201 dictDbTypes.insert( "sql", new int (OPimGlobal::SQL) ); 203 dictDbTypes.insert( "sql", new int (OPimGlobal::SQL) );
202 dictDbTypes.insert( "vcard", new int (OPimGlobal::VCARD) ); 204 dictDbTypes.insert( "vcard", new int (OPimGlobal::VCARD) );
203 205
204 int* db_find = dictDbTypes[ db_String ]; 206 int* db_find = dictDbTypes[ db_String ];
205 207
206 if ( !db_find ) 208 if ( !db_find )
207 return OPimGlobal::UNKNOWN; 209 return OPimGlobal::UNKNOWN;
208 210
209 return (OPimGlobal::DatabaseStyle) *db_find; 211 return (OPimGlobal::DatabaseStyle) *db_find;
210 } 212 }
211 213
212 214
213 /** 215 /**
214 * Returns the default backend implementation for backendName. Which one is used, is defined 216 * Returns the default backend implementation for backendName. Which one is used, is defined
215 * by the configfile "pimaccess.conf". 217 * by the configfile "pimaccess.conf".
@@ -222,9 +224,9 @@ class OBackendPrivate;
222 } 224 }
223 private: 225 private:
224 OBackendPrivate* d; 226 OBackendPrivate* d;
225 227
226 }; 228 };
227 229
228} 230}
229 231
230#endif 232#endif