-rw-r--r-- | libopie2/opiepim/backend/obackendfactory.h | 98 | ||||
-rw-r--r-- | libopie2/opiepim/core/ocontactaccess.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiepim/core/odatebookaccess.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimglobal.h | 2 | ||||
-rw-r--r-- | libopie2/opiepim/core/otodoaccess.cpp | 3 |
5 files changed, 63 insertions, 46 deletions
diff --git a/libopie2/opiepim/backend/obackendfactory.h b/libopie2/opiepim/backend/obackendfactory.h index 4bedbef..c8a4627 100644 --- a/libopie2/opiepim/backend/obackendfactory.h +++ b/libopie2/opiepim/backend/obackendfactory.h | |||
@@ -25,35 +25,38 @@ | |||
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | /* | 29 | /* |
30 | * ===================================================================== | 30 | * ===================================================================== |
31 | * ToDo: Use plugins | 31 | * ToDo: Use plugins |
32 | * ===================================================================== | 32 | * ===================================================================== |
33 | */ | 33 | */ |
34 | #ifndef OPIE_BACKENDFACTORY_H_ | 34 | #ifndef OPIE_BACKENDFACTORY_H_ |
35 | #define OPIE_BACKENDFACTORY_H_ | 35 | #define OPIE_BACKENDFACTORY_H_ |
36 | 36 | ||
37 | #include <qstring.h> | 37 | #include <qstring.h> |
38 | #include <qasciidict.h> | 38 | #include <qasciidict.h> |
39 | #include <qpe/config.h> | 39 | #include <qpe/config.h> |
40 | 40 | ||
41 | #include <opie2/opimaccessbackend.h> | ||
41 | #include <opie2/opimglobal.h> | 42 | #include <opie2/opimglobal.h> |
42 | #include <opie2/otodoaccessxml.h> | 43 | #include <opie2/otodoaccessxml.h> |
44 | #include <opie2/otodoaccessvcal.h> | ||
43 | #include <opie2/ocontactaccessbackend_xml.h> | 45 | #include <opie2/ocontactaccessbackend_xml.h> |
46 | #include <opie2/ocontactaccessbackend_vcard.h> | ||
44 | #include <opie2/odatebookaccessbackend_xml.h> | 47 | #include <opie2/odatebookaccessbackend_xml.h> |
45 | 48 | ||
46 | #ifdef __USE_SQL | 49 | #ifdef __USE_SQL |
47 | #include <opie2/otodoaccesssql.h> | 50 | #include <opie2/otodoaccesssql.h> |
48 | #include <opie2/ocontactaccessbackend_sql.h> | 51 | #include <opie2/ocontactaccessbackend_sql.h> |
49 | #include <opie2/odatebookaccessbackend_sql.h> | 52 | #include <opie2/odatebookaccessbackend_sql.h> |
50 | #endif | 53 | #endif |
51 | 54 | ||
52 | using namespace Opie; | 55 | using namespace Opie; |
53 | using namespace Opie::Pim; | 56 | using namespace Opie::Pim; |
54 | 57 | ||
55 | namespace Opie { | 58 | namespace Opie { |
56 | 59 | ||
57 | class OBackendPrivate; | 60 | class OBackendPrivate; |
58 | 61 | ||
59 | /** | 62 | /** |
@@ -69,79 +72,107 @@ class OBackendPrivate; | |||
69 | * </pre> | 72 | * </pre> |
70 | * | 73 | * |
71 | * @author Stefan Eilers | 74 | * @author Stefan Eilers |
72 | * @version 0.1 | 75 | * @version 0.1 |
73 | */ | 76 | */ |
74 | template<class T> | 77 | template<class T> |
75 | class OBackendFactory | 78 | class OBackendFactory |
76 | { | 79 | { |
77 | public: | 80 | public: |
78 | OBackendFactory() {}; | 81 | OBackendFactory() {}; |
79 | 82 | ||
80 | /** | 83 | /** |
81 | * Returns a selected backend implementation | 84 | * Returns a selected backend implementation |
82 | * @param type the type of the backend | 85 | * @param type the type of the backend |
83 | * @param database the type of the used database | 86 | * @param database the type of the used database |
84 | * @param appName The name of your application. It will be passed on to the backend. | 87 | * @param appName The name of your application. It will be passed on to the backend. |
88 | * @param filename Filename of the database file if you don't want to access the default | ||
85 | */ | 89 | */ |
86 | static T* create( OPimGlobal::PimType type, OPimGlobal::DatabaseStyle database, | 90 | static T* create( OPimGlobal::PimType type, OPimGlobal::DatabaseStyle database, |
87 | const QString& appName ){ | 91 | const QString& appName, const QString& filename = QString::null ){ |
88 | qWarning("Selected backend for %d is: %d", type, database ); | 92 | qWarning("Selected backend for %d is: %d", type, database ); |
89 | // If we should use the dafult database style, we have to request it | 93 | // If we should use the dafult database style, we have to request it |
90 | OPimGlobal::DatabaseStyle used_database = database; | 94 | OPimGlobal::DatabaseStyle use_database = database; |
91 | if ( database == OPimGlobal::DEFAULT ){ | 95 | if ( use_database == OPimGlobal::DEFAULT ){ |
92 | used_database = defaultDB( type ); | 96 | use_database = defaultDB( type ); |
93 | } | 97 | } |
94 | 98 | ||
95 | |||
96 | switch ( type ){ | 99 | switch ( type ){ |
97 | case OPimGlobal::TODOLIST: | 100 | case OPimGlobal::TODOLIST: |
101 | |||
102 | switch ( use_database ){ | ||
103 | default: // Use SQL if something weird is given. | ||
104 | // Fall through !! | ||
105 | case OPimGlobal::SQL: | ||
98 | #ifdef __USE_SQL | 106 | #ifdef __USE_SQL |
99 | if ( used_database == OPimGlobal::SQL ) | 107 | return (T*) new OPimTodoAccessBackendSQL( filename ); |
100 | return (T*) new OPimTodoAccessBackendSQL(""); | 108 | break; |
101 | #else | 109 | #else |
102 | if ( used_database == OPimGlobal::SQL ) | ||
103 | qWarning ("OBackendFactory:: sql Backend for TODO not implemented! Using XML instead!"); | 110 | qWarning ("OBackendFactory:: sql Backend for TODO not implemented! Using XML instead!"); |
111 | // Fall through !! | ||
104 | #endif | 112 | #endif |
105 | 113 | case OPimGlobal::XML: | |
106 | return (T*) new OPimTodoAccessXML( appName ); | 114 | return (T*) new OPimTodoAccessXML( appName, filename ); |
115 | break; | ||
116 | case OPimGlobal::VCARD: | ||
117 | return (T*) new OPimTodoAccessVCal( filename ); | ||
118 | break; | ||
119 | } | ||
107 | case OPimGlobal::CONTACTLIST: | 120 | case OPimGlobal::CONTACTLIST: |
121 | switch ( use_database ){ | ||
122 | default: // Use SQL if something weird is given. | ||
123 | // Fall through !! | ||
124 | case OPimGlobal::SQL: | ||
108 | #ifdef __USE_SQL | 125 | #ifdef __USE_SQL |
109 | if ( used_database == OPimGlobal::SQL ) | 126 | return (T*) new OPimContactAccessBackend_SQL( appName, filename ); |
110 | return (T*) new OPimContactAccessBackend_SQL(""); | 127 | break; |
111 | #else | 128 | #else |
112 | if ( used_database == OPimGlobal::SQL ) | ||
113 | qWarning ("OBackendFactory:: sql Backend for CONTACT not implemented! Using XML instead!"); | 129 | qWarning ("OBackendFactory:: sql Backend for CONTACT not implemented! Using XML instead!"); |
130 | // Fall through !! | ||
114 | #endif | 131 | #endif |
115 | 132 | case OPimGlobal::XML: | |
116 | return (T*) new OPimContactAccessBackend_XML( appName ); | 133 | return (T*) new OPimContactAccessBackend_XML( appName, filename ); |
134 | break; | ||
135 | case OPimGlobal::VCARD: | ||
136 | return (T*) new OPimContactAccessBackend_VCard( appName, filename ); | ||
137 | break; | ||
138 | } | ||
117 | case OPimGlobal::DATEBOOK: | 139 | case OPimGlobal::DATEBOOK: |
140 | switch ( use_database ){ | ||
141 | default: // Use SQL if something weird is given. | ||
142 | // Fall through !! | ||
143 | case OPimGlobal::SQL: | ||
118 | #ifdef __USE_SQL | 144 | #ifdef __USE_SQL |
119 | if ( used_database == OPimGlobal::SQL ) | 145 | return (T*) new ODateBookAccessBackend_SQL( appName, filename ); |
120 | return (T*) new ODateBookAccessBackend_SQL(""); | 146 | break; |
121 | #else | 147 | #else |
122 | if ( used_database == OPimGlobal::SQL ) | 148 | qWarning("OBackendFactory:: sql Backend for DATEBOOK not implemented! Using XML instead!"); |
123 | qWarning("OBackendFactory:: sql Backend for DATEBOOK not implemented! Using XML instead!"); | 149 | // Fall through !! |
124 | #endif | 150 | #endif |
125 | 151 | case OPimGlobal::XML: | |
126 | return (T*) new ODateBookAccessBackend_XML( appName ); | 152 | return (T*) new ODateBookAccessBackend_XML( appName, filename ); |
153 | break; | ||
154 | case OPimGlobal::VCARD: | ||
155 | qWarning("OBackendFactory:: VCal Backend for DATEBOOK not implemented!"); | ||
156 | return (T*) NULL; | ||
157 | break; | ||
158 | } | ||
127 | default: | 159 | default: |
128 | return (T*) NULL; | 160 | return (T*) NULL; |
129 | } | 161 | } |
130 | 162 | ||
131 | |||
132 | } | 163 | } |
133 | 164 | ||
134 | /** | 165 | /** |
135 | * Returns the style of the default database which is used to contact PIM data. | 166 | * Returns the style of the default database which is used to contact PIM data. |
136 | * @param type the type of the backend | 167 | * @param type the type of the backend |
137 | * @see OPimGlobal | 168 | * @see OPimGlobal |
138 | */ | 169 | */ |
139 | static OPimGlobal::DatabaseStyle defaultDB( OPimGlobal::PimType type ){ | 170 | static OPimGlobal::DatabaseStyle defaultDB( OPimGlobal::PimType type ){ |
140 | QString group_name; | 171 | QString group_name; |
141 | switch ( type ){ | 172 | switch ( type ){ |
142 | case OPimGlobal::TODOLIST: | 173 | case OPimGlobal::TODOLIST: |
143 | group_name = "todo"; | 174 | group_name = "todo"; |
144 | break; | 175 | break; |
145 | case OPimGlobal::CONTACTLIST: | 176 | case OPimGlobal::CONTACTLIST: |
146 | group_name = "contact"; | 177 | group_name = "contact"; |
147 | break; | 178 | break; |
@@ -162,47 +193,30 @@ class OBackendFactory | |||
162 | dictDbTypes.insert( "xml", new int (OPimGlobal::XML) ); | 193 | dictDbTypes.insert( "xml", new int (OPimGlobal::XML) ); |
163 | dictDbTypes.insert( "sql", new int (OPimGlobal::SQL) ); | 194 | dictDbTypes.insert( "sql", new int (OPimGlobal::SQL) ); |
164 | dictDbTypes.insert( "vcard", new int (OPimGlobal::VCARD) ); | 195 | dictDbTypes.insert( "vcard", new int (OPimGlobal::VCARD) ); |
165 | 196 | ||
166 | int* db_find = dictDbTypes[ db_String ]; | 197 | int* db_find = dictDbTypes[ db_String ]; |
167 | 198 | ||
168 | if ( !db_find ) | 199 | if ( !db_find ) |
169 | return OPimGlobal::UNKNOWN; | 200 | return OPimGlobal::UNKNOWN; |
170 | 201 | ||
171 | return (OPimGlobal::DatabaseStyle) *db_find; | 202 | return (OPimGlobal::DatabaseStyle) *db_find; |
172 | } | 203 | } |
173 | 204 | ||
174 | 205 | ||
175 | /** | 206 | /** |
176 | * Returns the default backend implementation for backendName. Which one is used, is defined | 207 | * Returns the default backend implementation for backendName. Which one is used, is defined |
177 | * by the configfile "pimaccess.conf". | 208 | * by the configfile "pimaccess.conf". |
178 | * @param backendName the type of the backend (use "todo", "contact" or "datebook" ) | 209 | * @param type The type of the backend (@see OPimGlobal()) |
179 | * @param appName The name of your application. It will be passed on to the backend | 210 | * @param appName The name of your application. It will be passed on to the backend |
180 | */ | 211 | */ |
181 | static T* defaultBackend( const QString backendName, const QString& appName ){ | 212 | static T* defaultBackend( OPimGlobal::PimType type, const QString& appName ){ |
182 | 213 | return create( type, OPimGlobal::DEFAULT, appName ); | |
183 | QAsciiDict<int> dictBackends( OPimGlobal::_END_PimType ); | ||
184 | dictBackends.setAutoDelete ( TRUE ); | ||
185 | |||
186 | dictBackends.insert( "todo", new int (OPimGlobal::TODOLIST) ); | ||
187 | dictBackends.insert( "contact", new int (OPimGlobal::CONTACTLIST) ); | ||
188 | dictBackends.insert( "datebook", new int(OPimGlobal::DATEBOOK) ); | ||
189 | |||
190 | int* backend_find = dictBackends[ backendName ]; | ||
191 | if ( !backend_find ) return NULL; | ||
192 | |||
193 | OPimGlobal::DatabaseStyle style = defaultDB( static_cast<OPimGlobal::PimType>( *backend_find ) ); | ||
194 | |||
195 | qDebug( "OBackendFactory::Default -> Backend is %s, Database is %d", backendName.latin1(), | ||
196 | style ); | ||
197 | |||
198 | return create( (OPimGlobal::PimType) *backend_find, style, appName ); | ||
199 | |||
200 | } | 214 | } |
201 | private: | 215 | private: |
202 | OBackendPrivate* d; | 216 | OBackendPrivate* d; |
203 | 217 | ||
204 | }; | 218 | }; |
205 | 219 | ||
206 | } | 220 | } |
207 | 221 | ||
208 | #endif | 222 | #endif |
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp index 417a954..a372267 100644 --- a/libopie2/opiepim/core/ocontactaccess.cpp +++ b/libopie2/opiepim/core/ocontactaccess.cpp | |||
@@ -40,45 +40,46 @@ | |||
40 | #include <qdatetime.h> | 40 | #include <qdatetime.h> |
41 | #include <qfile.h> | 41 | #include <qfile.h> |
42 | #include <qregexp.h> | 42 | #include <qregexp.h> |
43 | #include <qlist.h> | 43 | #include <qlist.h> |
44 | #include <qcopchannel_qws.h> | 44 | #include <qcopchannel_qws.h> |
45 | 45 | ||
46 | //#include <qpe/qcopenvelope_qws.h> | 46 | //#include <qpe/qcopenvelope_qws.h> |
47 | #include <qpe/global.h> | 47 | #include <qpe/global.h> |
48 | 48 | ||
49 | #include <errno.h> | 49 | #include <errno.h> |
50 | #include <fcntl.h> | 50 | #include <fcntl.h> |
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #include <stdlib.h> | 52 | #include <stdlib.h> |
53 | 53 | ||
54 | #include <opie2/ocontactaccessbackend_xml.h> | 54 | #include <opie2/ocontactaccessbackend_xml.h> |
55 | #include <opie2/opimresolver.h> | 55 | #include <opie2/opimresolver.h> |
56 | #include <opie2/opimglobal.h> | ||
56 | 57 | ||
57 | namespace Opie { | 58 | namespace Opie { |
58 | 59 | ||
59 | OPimContactAccess::OPimContactAccess ( const QString appname, const QString , | 60 | OPimContactAccess::OPimContactAccess ( const QString appname, const QString , |
60 | OPimContactAccessBackend* end, bool autosync ): | 61 | OPimContactAccessBackend* end, bool autosync ): |
61 | OPimAccessTemplate<OPimContact>( end ) | 62 | OPimAccessTemplate<OPimContact>( end ) |
62 | { | 63 | { |
63 | /* take care of the backend. If there is no one defined, we | 64 | /* take care of the backend. If there is no one defined, we |
64 | * will use the XML-Backend as default (until we have a cute SQL-Backend..). | 65 | * will use the XML-Backend as default (until we have a cute SQL-Backend..). |
65 | */ | 66 | */ |
66 | if( end == 0 ) { | 67 | if( end == 0 ) { |
67 | qWarning ("Using BackendFactory !"); | 68 | qWarning ("Using BackendFactory !"); |
68 | end = OBackendFactory<OPimContactAccessBackend>::defaultBackend( "contact", appname ); | 69 | end = OBackendFactory<OPimContactAccessBackend>::defaultBackend( OPimGlobal::CONTACTLIST, appname ); |
69 | } | 70 | } |
70 | // Set backend locally and in template | 71 | // Set backend locally and in template |
71 | m_backEnd = end; | 72 | m_backEnd = end; |
72 | OPimAccessTemplate<OPimContact>::setBackEnd (end); | 73 | OPimAccessTemplate<OPimContact>::setBackEnd (end); |
73 | 74 | ||
74 | 75 | ||
75 | /* Connect signal of external db change to function */ | 76 | /* Connect signal of external db change to function */ |
76 | QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); | 77 | QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); |
77 | connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)), | 78 | connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)), |
78 | this, SLOT(copMessage(const QCString&,const QByteArray&)) ); | 79 | this, SLOT(copMessage(const QCString&,const QByteArray&)) ); |
79 | if ( autosync ){ | 80 | if ( autosync ){ |
80 | QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); | 81 | QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); |
81 | connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)), | 82 | connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)), |
82 | this, SLOT(copMessage(const QCString&,const QByteArray&)) ); | 83 | this, SLOT(copMessage(const QCString&,const QByteArray&)) ); |
83 | } | 84 | } |
84 | 85 | ||
diff --git a/libopie2/opiepim/core/odatebookaccess.cpp b/libopie2/opiepim/core/odatebookaccess.cpp index 5f471cf..440ee0a 100644 --- a/libopie2/opiepim/core/odatebookaccess.cpp +++ b/libopie2/opiepim/core/odatebookaccess.cpp | |||
@@ -16,46 +16,47 @@ | |||
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | #include <opie2/obackendfactory.h> | 29 | #include <opie2/obackendfactory.h> |
30 | #include <opie2/odatebookaccess.h> | 30 | #include <opie2/odatebookaccess.h> |
31 | #include <opie2/opimresolver.h> | 31 | #include <opie2/opimresolver.h> |
32 | #include <opie2/opimglobal.h> | ||
32 | 33 | ||
33 | namespace Opie { | 34 | namespace Opie { |
34 | /** | 35 | /** |
35 | * Simple constructor | 36 | * Simple constructor |
36 | * It takes a ODateBookAccessBackend as parent. If it is 0 the default implementation | 37 | * It takes a ODateBookAccessBackend as parent. If it is 0 the default implementation |
37 | * will be used! | 38 | * will be used! |
38 | * @param back The backend to be used or 0 for the default backend | 39 | * @param back The backend to be used or 0 for the default backend |
39 | * @param ac What kind of access is intended | 40 | * @param ac What kind of access is intended |
40 | */ | 41 | */ |
41 | ODateBookAccess::ODateBookAccess( ODateBookAccessBackend* back, enum Access ac ) | 42 | ODateBookAccess::ODateBookAccess( ODateBookAccessBackend* back, enum Access ac ) |
42 | : OPimAccessTemplate<OPimEvent>( back ) | 43 | : OPimAccessTemplate<OPimEvent>( back ) |
43 | { | 44 | { |
44 | if (!back ) | 45 | if (!back ) |
45 | back = OBackendFactory<ODateBookAccessBackend>::defaultBackend("datebook", QString::null ); | 46 | back = OBackendFactory<ODateBookAccessBackend>::defaultBackend( OPimGlobal::DATEBOOK, QString::null ); |
46 | 47 | ||
47 | m_backEnd = back; | 48 | m_backEnd = back; |
48 | setBackEnd( m_backEnd ); | 49 | setBackEnd( m_backEnd ); |
49 | } | 50 | } |
50 | ODateBookAccess::~ODateBookAccess() { | 51 | ODateBookAccess::~ODateBookAccess() { |
51 | } | 52 | } |
52 | 53 | ||
53 | /** | 54 | /** |
54 | * @return all events available | 55 | * @return all events available |
55 | */ | 56 | */ |
56 | ODateBookAccess::List ODateBookAccess::rawEvents()const { | 57 | ODateBookAccess::List ODateBookAccess::rawEvents()const { |
57 | QArray<int> ints = m_backEnd->rawEvents(); | 58 | QArray<int> ints = m_backEnd->rawEvents(); |
58 | 59 | ||
59 | List lis( ints, this ); | 60 | List lis( ints, this ); |
60 | return lis; | 61 | return lis; |
61 | } | 62 | } |
diff --git a/libopie2/opiepim/core/opimglobal.h b/libopie2/opiepim/core/opimglobal.h index d56c9be..efd455c 100644 --- a/libopie2/opiepim/core/opimglobal.h +++ b/libopie2/opiepim/core/opimglobal.h | |||
@@ -37,28 +37,28 @@ namespace Pim{ | |||
37 | * Contains global types and enums for the PIM-API | 37 | * Contains global types and enums for the PIM-API |
38 | */ | 38 | */ |
39 | class OPimGlobal{ | 39 | class OPimGlobal{ |
40 | public: | 40 | public: |
41 | enum PimType { | 41 | enum PimType { |
42 | TODOLIST, | 42 | TODOLIST, |
43 | CONTACTLIST, | 43 | CONTACTLIST, |
44 | DATEBOOK, | 44 | DATEBOOK, |
45 | _END_PimType | 45 | _END_PimType |
46 | }; | 46 | }; |
47 | 47 | ||
48 | enum DatabaseStyle { | 48 | enum DatabaseStyle { |
49 | DEFAULT, // Use default Database | 49 | DEFAULT, // Use default Database |
50 | UNKNOWN, // Unknown database style | 50 | UNKNOWN, // Unknown database style |
51 | XML, | 51 | XML, |
52 | SQL, | 52 | SQL, |
53 | VCARD, | 53 | VCARD, // Also used for VCARD ! |
54 | _END_DatabaseStyle | 54 | _END_DatabaseStyle |
55 | }; | 55 | }; |
56 | 56 | ||
57 | 57 | ||
58 | }; | 58 | }; |
59 | 59 | ||
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | #endif | 64 | #endif |
diff --git a/libopie2/opiepim/core/otodoaccess.cpp b/libopie2/opiepim/core/otodoaccess.cpp index 87a211f..c4adbbd 100644 --- a/libopie2/opiepim/core/otodoaccess.cpp +++ b/libopie2/opiepim/core/otodoaccess.cpp | |||
@@ -21,43 +21,44 @@ | |||
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | #include <qdatetime.h> | 29 | #include <qdatetime.h> |
30 | 30 | ||
31 | #include <qpe/alarmserver.h> | 31 | #include <qpe/alarmserver.h> |
32 | 32 | ||
33 | // #include "otodoaccesssql.h" | 33 | // #include "otodoaccesssql.h" |
34 | #include <opie2/otodoaccess.h> | 34 | #include <opie2/otodoaccess.h> |
35 | #include <opie2/obackendfactory.h> | 35 | #include <opie2/obackendfactory.h> |
36 | #include <opie2/opimresolver.h> | 36 | #include <opie2/opimresolver.h> |
37 | #include <opie2/opimglobal.h> | ||
37 | 38 | ||
38 | namespace Opie { | 39 | namespace Opie { |
39 | OPimTodoAccess::OPimTodoAccess( OPimTodoAccessBackend* end, enum Access ) | 40 | OPimTodoAccess::OPimTodoAccess( OPimTodoAccessBackend* end, enum Access ) |
40 | : QObject(), OPimAccessTemplate<OPimTodo>( end ), m_todoBackEnd( end ) | 41 | : QObject(), OPimAccessTemplate<OPimTodo>( end ), m_todoBackEnd( end ) |
41 | { | 42 | { |
42 | // if (end == 0l ) | 43 | // if (end == 0l ) |
43 | // m_todoBackEnd = new OPimTodoAccessBackendSQL( QString::null); | 44 | // m_todoBackEnd = new OPimTodoAccessBackendSQL( QString::null); |
44 | 45 | ||
45 | // Zecke: Du musst hier noch fr das XML-Backend einen Appnamen bergeben ! | 46 | // Zecke: Du musst hier noch fr das XML-Backend einen Appnamen bergeben ! |
46 | if (end == 0l ) | 47 | if (end == 0l ) |
47 | m_todoBackEnd = OBackendFactory<OPimTodoAccessBackend>::defaultBackend ("todo", QString::null); | 48 | m_todoBackEnd = OBackendFactory<OPimTodoAccessBackend>::defaultBackend (OPimGlobal::TODOLIST, QString::null); |
48 | 49 | ||
49 | setBackEnd( m_todoBackEnd ); | 50 | setBackEnd( m_todoBackEnd ); |
50 | } | 51 | } |
51 | OPimTodoAccess::~OPimTodoAccess() { | 52 | OPimTodoAccess::~OPimTodoAccess() { |
52 | // qWarning("~OPimTodoAccess"); | 53 | // qWarning("~OPimTodoAccess"); |
53 | } | 54 | } |
54 | void OPimTodoAccess::mergeWith( const QValueList<OPimTodo>& list ) { | 55 | void OPimTodoAccess::mergeWith( const QValueList<OPimTodo>& list ) { |
55 | QValueList<OPimTodo>::ConstIterator it; | 56 | QValueList<OPimTodo>::ConstIterator it; |
56 | for ( it = list.begin(); it != list.end(); ++it ) { | 57 | for ( it = list.begin(); it != list.end(); ++it ) { |
57 | replace( (*it) ); | 58 | replace( (*it) ); |
58 | } | 59 | } |
59 | } | 60 | } |
60 | OPimTodoAccess::List OPimTodoAccess::effectiveToDos( const QDate& start, | 61 | OPimTodoAccess::List OPimTodoAccess::effectiveToDos( const QDate& start, |
61 | const QDate& end, | 62 | const QDate& end, |
62 | bool includeNoDates ) { | 63 | bool includeNoDates ) { |
63 | QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates ); | 64 | QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates ); |