author | eilers <eilers> | 2004-05-16 16:21:51 (UTC) |
---|---|---|
committer | eilers <eilers> | 2004-05-16 16:21:51 (UTC) |
commit | 0c5c6279a7eaadf61bfe5f113a4f6cd3558c7914 (patch) (unidiff) | |
tree | bca776a6ab6d751bdbd9861f95c4dc5bc57752a0 | |
parent | 52691aca593d6b321597d26467b9e9af9ec0b6fe (diff) | |
download | opie-0c5c6279a7eaadf61bfe5f113a4f6cd3558c7914.zip opie-0c5c6279a7eaadf61bfe5f113a4f6cd3558c7914.tar.gz opie-0c5c6279a7eaadf61bfe5f113a4f6cd3558c7914.tar.bz2 |
Improved accessing of default database style by using OPimGlobal::DEFAULT
-rw-r--r-- | libopie2/opiepim/backend/obackendfactory.h | 28 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimaccessfactory.h | 18 |
2 files changed, 37 insertions, 9 deletions
diff --git a/libopie2/opiepim/backend/obackendfactory.h b/libopie2/opiepim/backend/obackendfactory.h index d8caa80..993ecb4 100644 --- a/libopie2/opiepim/backend/obackendfactory.h +++ b/libopie2/opiepim/backend/obackendfactory.h | |||
@@ -88,2 +88,8 @@ class OBackendFactory | |||
88 | qWarning("Selected backend for %d is: %d", type, database ); | 88 | qWarning("Selected backend for %d is: %d", type, database ); |
89 | // If we should use the dafult database style, we have to request it | ||
90 | OPimGlobal::DatabaseStyle used_database = database; | ||
91 | if ( database == OPimGlobal::DEFAULT ){ | ||
92 | used_database = defaultDB( type ); | ||
93 | } | ||
94 | |||
89 | 95 | ||
@@ -92,6 +98,6 @@ class OBackendFactory | |||
92 | #ifdef __USE_SQL | 98 | #ifdef __USE_SQL |
93 | if ( database == OPimGlobal::SQL ) | 99 | if ( used_database == OPimGlobal::SQL ) |
94 | return (T*) new OPimTodoAccessBackendSQL(""); | 100 | return (T*) new OPimTodoAccessBackendSQL(""); |
95 | #else | 101 | #else |
96 | if ( database == OPimGlobal::SQL ) | 102 | if ( used_database == OPimGlobal::SQL ) |
97 | qWarning ("OBackendFactory:: sql Backend for TODO not implemented! Using XML instead!"); | 103 | qWarning ("OBackendFactory:: sql Backend for TODO not implemented! Using XML instead!"); |
@@ -102,6 +108,6 @@ class OBackendFactory | |||
102 | #ifdef __USE_SQL | 108 | #ifdef __USE_SQL |
103 | if ( database == OPimGlobal::SQL ) | 109 | if ( used_database == OPimGlobal::SQL ) |
104 | return (T*) new OPimContactAccessBackend_SQL(""); | 110 | return (T*) new OPimContactAccessBackend_SQL(""); |
105 | #else | 111 | #else |
106 | if ( database == OPimGlobal::SQL ) | 112 | if ( used_database == OPimGlobal::SQL ) |
107 | qWarning ("OBackendFactory:: sql Backend for CONTACT not implemented! Using XML instead!"); | 113 | qWarning ("OBackendFactory:: sql Backend for CONTACT not implemented! Using XML instead!"); |
@@ -112,6 +118,6 @@ class OBackendFactory | |||
112 | #ifdef __USE_SQL | 118 | #ifdef __USE_SQL |
113 | if ( database == OPimGlobal::SQL ) | 119 | if ( used_database == OPimGlobal::SQL ) |
114 | return (T*) new ODateBookAccessBackend_SQL(""); | 120 | return (T*) new ODateBookAccessBackend_SQL(""); |
115 | #else | 121 | #else |
116 | if ( database == OPimGlobal::SQL ) | 122 | if ( used_database == OPimGlobal::SQL ) |
117 | qWarning("OBackendFactory:: sql Backend for DATEBOOK not implemented! Using XML instead!"); | 123 | qWarning("OBackendFactory:: sql Backend for DATEBOOK not implemented! Using XML instead!"); |
@@ -127,6 +133,10 @@ class OBackendFactory | |||
127 | 133 | ||
128 | 134 | /** | |
129 | static OPimGlobal::DatabaseStyle defaultDB( OPimGlobal::PimType backend ){ | 135 | * Returns the style of the default database which is used to contact PIM data. |
136 | * @param type the type of the backend | ||
137 | * @see OPimGlobal | ||
138 | */ | ||
139 | static OPimGlobal::DatabaseStyle defaultDB( OPimGlobal::PimType type ){ | ||
130 | QString group_name; | 140 | QString group_name; |
131 | switch ( backend ){ | 141 | switch ( type ){ |
132 | case OPimGlobal::TODOLIST: | 142 | case OPimGlobal::TODOLIST: |
diff --git a/libopie2/opiepim/core/opimaccessfactory.h b/libopie2/opiepim/core/opimaccessfactory.h index ba99a15..eecfa96 100644 --- a/libopie2/opiepim/core/opimaccessfactory.h +++ b/libopie2/opiepim/core/opimaccessfactory.h | |||
@@ -94,2 +94,20 @@ class OPimAccessFactory | |||
94 | } | 94 | } |
95 | |||
96 | |||
97 | /** | ||
98 | * Returns the selected PIM access-object, using the default database style | ||
99 | * Which style is selected is defined in the configfile "pimaccess.conf" in | ||
100 | * the directory "Settings" | ||
101 | * @param type Type of the selected database (addressbook, todolist or datebook) | ||
102 | * @param appName "Name" of your application. This should be any constant string which is used | ||
103 | * by some backends for creating special files (i.e.journal files). Please keep the | ||
104 | * string unique for your application ! | ||
105 | * @see OPimGlobal | ||
106 | * | ||
107 | */ | ||
108 | static T* default( OPimGlobal::PimType type, const QString& appName ){ | ||
109 | |||
110 | return create( type, OPimGlobal::DEFAULT, appName ) | ||
111 | |||
112 | } | ||
95 | }; | 113 | }; |