summaryrefslogtreecommitdiff
path: root/libopie2/opiepim
authoreilers <eilers>2004-05-20 16:08:40 (UTC)
committer eilers <eilers>2004-05-20 16:08:40 (UTC)
commitb9a91a24c28a1d12fddd6a5a6d3162c303d3da2f (patch) (side-by-side diff)
tree60193edb7522478dab74045064e4438b606fe715 /libopie2/opiepim
parent190df1c5ca54fac9d4819ddca661da753139c191 (diff)
downloadopie-b9a91a24c28a1d12fddd6a5a6d3162c303d3da2f.zip
opie-b9a91a24c28a1d12fddd6a5a6d3162c303d3da2f.tar.gz
opie-b9a91a24c28a1d12fddd6a5a6d3162c303d3da2f.tar.bz2
Changing OPimAccessFactory::Default to defaultAccess
Changing OBackendFactory::Default to defaultBackend I hope this fixes all problems with reserved words.. Sorry for any inconveniences..
Diffstat (limited to 'libopie2/opiepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/obackendfactory.h2
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp2
-rw-r--r--libopie2/opiepim/core/odatebookaccess.cpp2
-rw-r--r--libopie2/opiepim/core/opimaccessfactory.h2
-rw-r--r--libopie2/opiepim/core/otodoaccess.cpp2
5 files changed, 5 insertions, 5 deletions
diff --git a/libopie2/opiepim/backend/obackendfactory.h b/libopie2/opiepim/backend/obackendfactory.h
index 993ecb4..4daf861 100644
--- a/libopie2/opiepim/backend/obackendfactory.h
+++ b/libopie2/opiepim/backend/obackendfactory.h
@@ -133,76 +133,76 @@ class OBackendFactory
/**
* Returns the style of the default database which is used to contact PIM data.
* @param type the type of the backend
* @see OPimGlobal
*/
static OPimGlobal::DatabaseStyle defaultDB( OPimGlobal::PimType type ){
QString group_name;
switch ( type ){
case OPimGlobal::TODOLIST:
group_name = "todo";
break;
case OPimGlobal::CONTACTLIST:
group_name = "contact";
break;
case OPimGlobal::DATEBOOK:
group_name = "datebook";
break;
default:
group_name = "unknown";
}
Config config( "pimaccess" );
config.setGroup ( group_name );
QString db_String = config.readEntry( "usebackend" );
QAsciiDict<int> dictDbTypes( OPimGlobal::_END_DatabaseStyle );
dictDbTypes.setAutoDelete( TRUE );
dictDbTypes.insert( "xml", new int (OPimGlobal::XML) );
dictDbTypes.insert( "sql", new int (OPimGlobal::SQL) );
dictDbTypes.insert( "vcard", new int (OPimGlobal::VCARD) );
int* db_find = dictDbTypes[ db_String ];
if ( !db_find )
return OPimGlobal::UNKNOWN;
return (OPimGlobal::DatabaseStyle) *db_find;
}
/**
* Returns the default backend implementation for backendName. Which one is used, is defined
* by the configfile "pimaccess.conf".
* @param backendName the type of the backend (use "todo", "contact" or "datebook" )
* @param appName The name of your application. It will be passed on to the backend
*/
- static T* Default( const QString backendName, const QString& appName ){
+ static T* defaultBackend( const QString backendName, const QString& appName ){
QAsciiDict<int> dictBackends( OPimGlobal::_END_PimType );
dictBackends.setAutoDelete ( TRUE );
dictBackends.insert( "todo", new int (OPimGlobal::TODOLIST) );
dictBackends.insert( "contact", new int (OPimGlobal::CONTACTLIST) );
dictBackends.insert( "datebook", new int(OPimGlobal::DATEBOOK) );
int* backend_find = dictBackends[ backendName ];
if ( !backend_find ) return NULL;
OPimGlobal::DatabaseStyle style = defaultDB( static_cast<OPimGlobal::PimType>( *backend_find ) );
qDebug( "OBackendFactory::Default -> Backend is %s, Database is %d", backendName.latin1(),
style );
return create( (OPimGlobal::PimType) *backend_find, style, appName );
}
private:
OBackendPrivate* d;
};
}
#endif
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp
index 67f267f..417a954 100644
--- a/libopie2/opiepim/core/ocontactaccess.cpp
+++ b/libopie2/opiepim/core/ocontactaccess.cpp
@@ -20,97 +20,97 @@
++= -. .` .: details.
: = ...= . :.=-
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = Library General Public License along with
-- :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
* =====================================================================
* ToDo: XML-Backend: Automatic reload if something was changed...
*
*
*/
#include "ocontactaccess.h"
#include "obackendfactory.h"
#include <qasciidict.h>
#include <qdatetime.h>
#include <qfile.h>
#include <qregexp.h>
#include <qlist.h>
#include <qcopchannel_qws.h>
//#include <qpe/qcopenvelope_qws.h>
#include <qpe/global.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <opie2/ocontactaccessbackend_xml.h>
#include <opie2/opimresolver.h>
namespace Opie {
OPimContactAccess::OPimContactAccess ( const QString appname, const QString ,
OPimContactAccessBackend* end, bool autosync ):
OPimAccessTemplate<OPimContact>( end )
{
/* take care of the backend. If there is no one defined, we
* will use the XML-Backend as default (until we have a cute SQL-Backend..).
*/
if( end == 0 ) {
qWarning ("Using BackendFactory !");
- end = OBackendFactory<OPimContactAccessBackend>::Default( "contact", appname );
+ end = OBackendFactory<OPimContactAccessBackend>::defaultBackend( "contact", appname );
}
// Set backend locally and in template
m_backEnd = end;
OPimAccessTemplate<OPimContact>::setBackEnd (end);
/* Connect signal of external db change to function */
QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this );
connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(copMessage(const QCString&,const QByteArray&)) );
if ( autosync ){
QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this );
connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(copMessage(const QCString&,const QByteArray&)) );
}
}
OPimContactAccess::~OPimContactAccess ()
{
/* The user may forget to save the changed database, therefore try to
* do it for him..
*/
save();
// delete m_backEnd; is done by template..
}
bool OPimContactAccess::save ()
{
/* If the database was changed externally, we could not save the
* Data. This will remove added items which is unacceptable !
* Therefore: Reload database and merge the data...
*/
if ( OPimAccessTemplate<OPimContact>::wasChangedExternally() )
reload();
bool status = OPimAccessTemplate<OPimContact>::save();
if ( !status ) return false;
/* Now tell everyone that new data is available.
*/
QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
return true;
}
const uint OPimContactAccess::querySettings()
diff --git a/libopie2/opiepim/core/odatebookaccess.cpp b/libopie2/opiepim/core/odatebookaccess.cpp
index 29298ea..5f471cf 100644
--- a/libopie2/opiepim/core/odatebookaccess.cpp
+++ b/libopie2/opiepim/core/odatebookaccess.cpp
@@ -1,93 +1,93 @@
/*
This file is part of the Opie Project
Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
=. Copyright (C) The Opie Team <opie-devel@handhelds.org>
.=l.
.>+-=
_;:, .> :=|. This program is free software; you can
.> <`_, > . <= redistribute it and/or modify it under
:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
.="- .-=="i, .._ License as published by the Free Software
- . .-<_> .<> Foundation; either version 2 of the License,
._= =} : or (at your option) any later version.
.%`+i> _;_.
.i_,=:_. -<s. This program is distributed in the hope that
+ . -:. = it will be useful, but WITHOUT ANY WARRANTY;
: .. .:, . . . without even the implied warranty of
=_ + =;=|` MERCHANTABILITY or FITNESS FOR A
_.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.= = ; Library General Public License for more
++= -. .` .: details.
: = ...= . :.=-
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = Library General Public License along with
-- :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <opie2/obackendfactory.h>
#include <opie2/odatebookaccess.h>
#include <opie2/opimresolver.h>
namespace Opie {
/**
* Simple constructor
* It takes a ODateBookAccessBackend as parent. If it is 0 the default implementation
* will be used!
* @param back The backend to be used or 0 for the default backend
* @param ac What kind of access is intended
*/
ODateBookAccess::ODateBookAccess( ODateBookAccessBackend* back, enum Access ac )
: OPimAccessTemplate<OPimEvent>( back )
{
if (!back )
- back = OBackendFactory<ODateBookAccessBackend>::Default("datebook", QString::null );
+ back = OBackendFactory<ODateBookAccessBackend>::defaultBackend("datebook", QString::null );
m_backEnd = back;
setBackEnd( m_backEnd );
}
ODateBookAccess::~ODateBookAccess() {
}
/**
* @return all events available
*/
ODateBookAccess::List ODateBookAccess::rawEvents()const {
QArray<int> ints = m_backEnd->rawEvents();
List lis( ints, this );
return lis;
}
/**
* @return all repeating events
*/
ODateBookAccess::List ODateBookAccess::rawRepeats()const {
QArray<int> ints = m_backEnd->rawRepeats();
List lis( ints, this );
return lis;
}
/**
* @return all non repeating events
*/
ODateBookAccess::List ODateBookAccess::nonRepeats()const {
QArray<int> ints = m_backEnd->nonRepeats();
List lis( ints, this );
return lis;
}
/**
* @return dates in the time span between from and to
* @param from Include all events from...
* @param to Include all events to...
*/
OEffectiveEvent::ValueList ODateBookAccess::effectiveEvents( const QDate& from, const QDate& to ) const {
return m_backEnd->effectiveEvents( from, to );
}
/**
* @return all events at a given datetime
*/
diff --git a/libopie2/opiepim/core/opimaccessfactory.h b/libopie2/opiepim/core/opimaccessfactory.h
index 7d32958..6aaa5e4 100644
--- a/libopie2/opiepim/core/opimaccessfactory.h
+++ b/libopie2/opiepim/core/opimaccessfactory.h
@@ -59,59 +59,59 @@ namespace Opie {
*/
template<class T>
class OPimAccessFactory
{
public:
// Maybe we should introduce a global class for storing such global enums
// (something like opimglobal.h) ? (eilers)
OPimAccessFactory() {};
/**
* Returns the selected PIM access-object.
* @param type Type of the selected database (addressbook, todolist or datebook)
* @param dbStyle Which database style should be used (xml, sql, vcard)
* @param appName "Name" of your application. This should be any constant string which is used
* by some backends for creating special files (i.e.journal files). Please keep the
* string unique for your application !
* @see OPimGlobal
*/
static T* create( OPimGlobal::PimType type, OPimGlobal::DatabaseStyle dbStyle, const QString& appName ){
switch ( type ){
case OPimGlobal::TODOLIST:
return dynamic_cast<T*>( new OPimTodoAccess( OBackendFactory<OPimTodoAccessBackend>::create( type, dbStyle, appName ) ) );
case OPimGlobal::CONTACTLIST:
return dynamic_cast<T*>( new OPimContactAccess( QString::null, QString::null, OBackendFactory<OPimContactAccessBackend>::create( type, dbStyle, appName ) ) );
case OPimGlobal::DATEBOOK:
return dynamic_cast<T*>( new ODateBookAccess( OBackendFactory<ODateBookAccessBackend>::create( type, dbStyle, appName ) ) );
default:
return 0l;
}
}
/**
* Returns the selected PIM access-object, using the default database style
* Which style is selected is defined in the configfile "pimaccess.conf" in
* the directory "Settings"
* @param type Type of the selected database (addressbook, todolist or datebook)
* @param appName "Name" of your application. This should be any constant string which is used
* by some backends for creating special files (i.e.journal files). Please keep the
* string unique for your application !
* @see OPimGlobal
*
*/
- static T* Default( typename OPimGlobal::PimType type, const QString& appName ){
+ static T* defaultAccess( typename OPimGlobal::PimType type, const QString& appName ){
return create( type, OPimGlobal::DEFAULT, appName );
}
};
}
#endif
diff --git a/libopie2/opiepim/core/otodoaccess.cpp b/libopie2/opiepim/core/otodoaccess.cpp
index 6fa0089..87a211f 100644
--- a/libopie2/opiepim/core/otodoaccess.cpp
+++ b/libopie2/opiepim/core/otodoaccess.cpp
@@ -1,95 +1,95 @@
/*
This file is part of the Opie Project
Copyright (C) The Main Author <main-author@whereever.org>
=. Copyright (C) The Opie Team <opie-devel@handhelds.org>
.=l.
.>+-=
_;:, .> :=|. This program is free software; you can
.> <`_, > . <= redistribute it and/or modify it under
:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
.="- .-=="i, .._ License as published by the Free Software
- . .-<_> .<> Foundation; either version 2 of the License,
._= =} : or (at your option) any later version.
.%`+i> _;_.
.i_,=:_. -<s. This program is distributed in the hope that
+ . -:. = it will be useful, but WITHOUT ANY WARRANTY;
: .. .:, . . . without even the implied warranty of
=_ + =;=|` MERCHANTABILITY or FITNESS FOR A
_.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.= = ; Library General Public License for more
++= -. .` .: details.
: = ...= . :.=-
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = Library General Public License along with
-- :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qdatetime.h>
#include <qpe/alarmserver.h>
// #include "otodoaccesssql.h"
#include <opie2/otodoaccess.h>
#include <opie2/obackendfactory.h>
#include <opie2/opimresolver.h>
namespace Opie {
OPimTodoAccess::OPimTodoAccess( OPimTodoAccessBackend* end, enum Access )
: QObject(), OPimAccessTemplate<OPimTodo>( end ), m_todoBackEnd( end )
{
// if (end == 0l )
// m_todoBackEnd = new OPimTodoAccessBackendSQL( QString::null);
// Zecke: Du musst hier noch fr das XML-Backend einen Appnamen bergeben !
if (end == 0l )
- m_todoBackEnd = OBackendFactory<OPimTodoAccessBackend>::Default ("todo", QString::null);
+ m_todoBackEnd = OBackendFactory<OPimTodoAccessBackend>::defaultBackend ("todo", QString::null);
setBackEnd( m_todoBackEnd );
}
OPimTodoAccess::~OPimTodoAccess() {
// qWarning("~OPimTodoAccess");
}
void OPimTodoAccess::mergeWith( const QValueList<OPimTodo>& list ) {
QValueList<OPimTodo>::ConstIterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
replace( (*it) );
}
}
OPimTodoAccess::List OPimTodoAccess::effectiveToDos( const QDate& start,
const QDate& end,
bool includeNoDates ) {
QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates );
List lis( ints, this );
return lis;
}
OPimTodoAccess::List OPimTodoAccess::effectiveToDos( const QDate& start,
bool includeNoDates ) {
return effectiveToDos( start, QDate::currentDate(),
includeNoDates );
}
OPimTodoAccess::List OPimTodoAccess::overDue() {
List lis( m_todoBackEnd->overDue(), this );
return lis;
}
/* sort order */
OPimTodoAccess::List OPimTodoAccess::sorted( bool ascending, int sort,int filter, int cat ) {
QArray<int> ints = m_todoBackEnd->sorted( ascending, sort,
filter, cat );
OPimTodoAccess::List list( ints, this );
return list;
}
void OPimTodoAccess::removeAllCompleted() {
m_todoBackEnd->removeAllCompleted();
}
QBitArray OPimTodoAccess::backendSupport( const QString& ) const{
return m_todoBackEnd->supports();
}
bool OPimTodoAccess::backendSupports( int attr, const QString& ar) const{
return backendSupport(ar).testBit( attr );
}
int OPimTodoAccess::rtti() const