summaryrefslogtreecommitdiff
path: root/libopie/pim
Side-by-side diff
Diffstat (limited to 'libopie/pim') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/obackendfactory.h17
-rw-r--r--libopie/pim/otodoaccess.cpp9
2 files changed, 20 insertions, 6 deletions
diff --git a/libopie/pim/obackendfactory.h b/libopie/pim/obackendfactory.h
index 599fbf2..f11f029 100644
--- a/libopie/pim/obackendfactory.h
+++ b/libopie/pim/obackendfactory.h
@@ -1,88 +1,101 @@
/*
* Class to manage Backends.
*
* Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
*
* =====================================================================
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later
* version.
* =====================================================================
* ToDo: Use plugins
* =====================================================================
* Version: $Id$
* =====================================================================
* History:
* $Log$
+ * Revision 1.2 2002/10/08 09:27:36 eilers
+ * Fixed libopie.pro to include the new pim-API.
+ * The SQL-Stuff is currently deactivated. Otherwise everyone who wants to
+ * compile itself would need to install libsqlite, libopiesql...
+ * Therefore, the backend currently uses XML only..
+ *
* Revision 1.1 2002/10/07 17:35:01 eilers
* added OBackendFactory for advanced backend access
*
*
* =====================================================================
*/
#ifndef __OPIE_BACKENDFACTORY_H_
#define __OPIE_BACKENDFACTORY_H_
#include <qstring.h>
#include <qasciidict.h>
#include <qpe/config.h>
#include "otodoaccessxml.h"
#include "ocontactaccessbackend_xml.h"
-#include "otodoaccesssql.h"
+#ifdef __USE_SQL
+#include "otodoaccesssql.h"
+#endif
template<class T>
class OBackendFactory
{
public:
OBackendFactory() {};
enum BACKENDS {
TODO,
CONTACT,
DATE
};
static T* Default( const QString backendName, const QString& appName ){
Config config( "pimaccess" );
config.setGroup ( backendName );
QString backend = config.readEntry( "usebackend" );
QAsciiDict<int> dict ( 3 );
dict.setAutoDelete ( TRUE );
dict.insert( "todo", new int (TODO) );
dict.insert( "contact", new int (CONTACT) );
qWarning ("TODO is: %d", TODO);
qWarning ("CONTACT is: %d", CONTACT);
switch ( *dict.take( backendName ) ){
case TODO:
+#ifdef __USE_SQL
if ( backend == "sql" )
return (T*) new OTodoAccessBackendSQL("");
-
+#else
+ if ( backend == "sql" )
+ qWarning ("OBackendFactory:: sql Backend not implemented! Using XML instead!");
+#endif
+
return (T*) new OTodoAccessXML( appName );
case CONTACT:
if ( backend == "sql" )
qWarning ("OBackendFactory:: sql Backend not implemented! Using XML instead!");
return (T*) new OContactAccessBackend_XML( appName );
case DATE:
qWarning ("OBackendFactory:: DATE-Backend not implemented!");
return NULL;
default:
return NULL;
}
}
};
#endif
diff --git a/libopie/pim/otodoaccess.cpp b/libopie/pim/otodoaccess.cpp
index 4468812..80424d9 100644
--- a/libopie/pim/otodoaccess.cpp
+++ b/libopie/pim/otodoaccess.cpp
@@ -1,40 +1,41 @@
#include <qdatetime.h>
#include <qpe/alarmserver.h>
#include "otodoaccesssql.h"
#include "otodoaccess.h"
#include "obackendfactory.h"
OTodoAccess::OTodoAccess( OTodoAccessBackend* end )
: QObject(), OPimAccessTemplate<OTodo>( end ), m_todoBackEnd( end )
{
- if (end == 0l )
- m_todoBackEnd = new OTodoAccessBackendSQL( QString::null);
+// if (end == 0l )
+// m_todoBackEnd = new OTodoAccessBackendSQL( QString::null);
- // if (end == 0l )
- // m_todoBackEnd = OBackendFactory<OTodoAccessBackend>::Default ("todo", QString::null);
+ // Zecke: Du musst hier noch für das XML-Backend einen Appnamen übergeben !
+ if (end == 0l )
+ m_todoBackEnd = OBackendFactory<OTodoAccessBackend>::Default ("todo", QString::null);
setBackEnd( m_todoBackEnd );
}
OTodoAccess::~OTodoAccess() {
// qWarning("~OTodoAccess");
}
void OTodoAccess::mergeWith( const QValueList<OTodo>& list ) {
QValueList<OTodo>::ConstIterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
replace( (*it) );
}
}
OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start,
const QDate& end,
bool includeNoDates ) {
QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates );
List lis( ints, this );
return lis;
}
OTodoAccess::List OTodoAccess::effectiveToDos( const QDate& start,
bool includeNoDates ) {
return effectiveToDos( start, QDate::currentDate(),
includeNoDates );