summaryrefslogtreecommitdiff
path: root/libopie2/opiepim
authorzecke <zecke>2004-05-20 19:05:32 (UTC)
committer zecke <zecke>2004-05-20 19:05:32 (UTC)
commitbd50c1a78affd8a6ce6b9e6d811831c0e3325303 (patch) (unidiff)
tree3348c2715d8db822003f887fef31683c96f59f12 /libopie2/opiepim
parentf2ced3e20749f7f2f523ead85f45a38391e6fca0 (diff)
downloadopie-bd50c1a78affd8a6ce6b9e6d811831c0e3325303.zip
opie-bd50c1a78affd8a6ce6b9e6d811831c0e3325303.tar.gz
opie-bd50c1a78affd8a6ce6b9e6d811831c0e3325303.tar.bz2
add a 'default' backend for readEntry or you could/will crash
because QString::null is not in the dictionary of available backends. I'm conversative so it is 'xml' Eilers/BradC change it on your will
Diffstat (limited to 'libopie2/opiepim') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/backend/obackendfactory.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiepim/backend/obackendfactory.h b/libopie2/opiepim/backend/obackendfactory.h
index 4daf861..4bedbef 100644
--- a/libopie2/opiepim/backend/obackendfactory.h
+++ b/libopie2/opiepim/backend/obackendfactory.h
@@ -133,49 +133,49 @@ class OBackendFactory
133 133
134 /** 134 /**
135 * Returns the style of the default database which is used to contact PIM data. 135 * Returns the style of the default database which is used to contact PIM data.
136 * @param type the type of the backend 136 * @param type the type of the backend
137 * @see OPimGlobal 137 * @see OPimGlobal
138 */ 138 */
139 static OPimGlobal::DatabaseStyle defaultDB( OPimGlobal::PimType type ){ 139 static OPimGlobal::DatabaseStyle defaultDB( OPimGlobal::PimType type ){
140 QString group_name; 140 QString group_name;
141 switch ( type ){ 141 switch ( type ){
142 case OPimGlobal::TODOLIST: 142 case OPimGlobal::TODOLIST:
143 group_name = "todo"; 143 group_name = "todo";
144 break; 144 break;
145 case OPimGlobal::CONTACTLIST: 145 case OPimGlobal::CONTACTLIST:
146 group_name = "contact"; 146 group_name = "contact";
147 break; 147 break;
148 case OPimGlobal::DATEBOOK: 148 case OPimGlobal::DATEBOOK:
149 group_name = "datebook"; 149 group_name = "datebook";
150 break; 150 break;
151 default: 151 default:
152 group_name = "unknown"; 152 group_name = "unknown";
153 } 153 }
154 154
155 Config config( "pimaccess" ); 155 Config config( "pimaccess" );
156 config.setGroup ( group_name ); 156 config.setGroup ( group_name );
157 QString db_String = config.readEntry( "usebackend" ); 157 QString db_String = config.readEntry( "usebackend", "xml" );
158 158
159 QAsciiDict<int> dictDbTypes( OPimGlobal::_END_DatabaseStyle ); 159 QAsciiDict<int> dictDbTypes( OPimGlobal::_END_DatabaseStyle );
160 dictDbTypes.setAutoDelete( TRUE ); 160 dictDbTypes.setAutoDelete( TRUE );
161 161
162 dictDbTypes.insert( "xml", new int (OPimGlobal::XML) ); 162 dictDbTypes.insert( "xml", new int (OPimGlobal::XML) );
163 dictDbTypes.insert( "sql", new int (OPimGlobal::SQL) ); 163 dictDbTypes.insert( "sql", new int (OPimGlobal::SQL) );
164 dictDbTypes.insert( "vcard", new int (OPimGlobal::VCARD) ); 164 dictDbTypes.insert( "vcard", new int (OPimGlobal::VCARD) );
165 165
166 int* db_find = dictDbTypes[ db_String ]; 166 int* db_find = dictDbTypes[ db_String ];
167 167
168 if ( !db_find ) 168 if ( !db_find )
169 return OPimGlobal::UNKNOWN; 169 return OPimGlobal::UNKNOWN;
170 170
171 return (OPimGlobal::DatabaseStyle) *db_find; 171 return (OPimGlobal::DatabaseStyle) *db_find;
172 } 172 }
173 173
174 174
175 /** 175 /**
176 * Returns the default backend implementation for backendName. Which one is used, is defined 176 * Returns the default backend implementation for backendName. Which one is used, is defined
177 * by the configfile "pimaccess.conf". 177 * by the configfile "pimaccess.conf".
178 * @param backendName the type of the backend (use "todo", "contact" or "datebook" ) 178 * @param backendName the type of the backend (use "todo", "contact" or "datebook" )
179 * @param appName The name of your application. It will be passed on to the backend 179 * @param appName The name of your application. It will be passed on to the backend
180 */ 180 */
181 static T* defaultBackend( const QString backendName, const QString& appName ){ 181 static T* defaultBackend( const QString backendName, const QString& appName ){