8 files changed, 31 insertions, 12 deletions
diff --git a/libopie2/opiepim/backend/backends.pro b/libopie2/opiepim/backend/backends.pro index 4231a00..d4867ba 100644 --- a/libopie2/opiepim/backend/backends.pro +++ b/libopie2/opiepim/backend/backends.pro @@ -1,31 +1,33 @@ SOURCES += core/backends/ocontactaccessbackend_sql.cpp \ core/backends/ocontactaccessbackend_vcard.cpp \ core/backends/ocontactaccessbackend_xml.cpp \ core/backends/ocontactaccess.cpp \ core/backends/odatebookaccessbackend.cpp \ core/backends/odatebookaccessbackend_xml.cpp \ core/backends/otodoaccessbackend.cpp \ core/backends/otodoaccess.cpp \ core/backends/otodoaccesssql.cpp \ core/backends/otodoaccessvcal.cpp \ core/backends/otodoaccessxml.cpp \ core/backends/odatebookaccess.cpp \ - core/backends/odatebookaccessbackend_sql.cpp + core/backends/odatebookaccessbackend_sql.cpp \ + core/backends/private/xmltree.cc HEADERS += core/backends/obackendfactory.h \ core/backends/ocontactaccessbackend.h \ core/backends/ocontactaccessbackend_sql.h \ core/backends/ocontactaccessbackend_vcard.h \ core/backends/ocontactaccessbackend_xml.h \ core/backends/ocontactaccess.h \ core/backends/odatebookaccessbackend.h \ core/backends/odatebookaccessbackend_sql.h \ core/backends/odatebookaccessbackend_xml.h \ core/backends/opimaccessbackend.h \ core/backends/opimaccesstemplate.h \ core/backends/otodoaccessbackend.h \ core/backends/otodoaccess.h \ core/backends/otodoaccesssql.h \ core/backends/otodoaccessvcal.h \ core/backends/otodoaccessxml.h \ - core/backends/odatebookaccess.h + core/backends/odatebookaccess.h \ + core/backends/private/xmltree.h diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp index f121cc2..d16d692 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp @@ -33,33 +33,33 @@ #include "ocontactaccessbackend_sql.h" #include <qarray.h> #include <qdatetime.h> #include <qstringlist.h> #include <qpe/global.h> #include <qpe/recordfields.h> #include <opie2/opimcontactfields.h> #include <opie2/opimdateconversion.h> #include <opie2/osqldriver.h> #include <opie2/osqlresult.h> #include <opie2/osqlmanager.h> #include <opie2/osqlquery.h> - +using namespace Opie::DB; // If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead // vertical like "uid, type, value". // DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !! #define __STORE_HORIZONTAL_ // Distinct loading is not very fast. If I expect that every person has just // one (and always one) 'Last Name', I can request all uid's for existing lastnames, // which is faster.. // But this may not be true for all entries, like company contacts.. // The current AddressBook application handles this problem, but other may not.. (eilers) #define __USE_SUPERFAST_LOADQUERY /* diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.h b/libopie2/opiepim/backend/ocontactaccessbackend_sql.h index 58ae2ae..ba122ec 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.h +++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.h @@ -27,35 +27,39 @@ Boston, MA 02111-1307, USA. */ /* * SQL Backend for the OPIE-Contact Database. */ #ifndef _OPimContactAccessBackend_SQL_ #define _OPimContactAccessBackend_SQL_ #include <opie2/ocontactaccessbackend.h> #include <opie2/ocontactaccess.h> #include <qlist.h> #include <qdict.h> /* aren't in namespace Opie yet - alwin */ +namespace Opie { +namespace DB { class OSQLDriver; class OSQLResult; class OSQLResultItem; +} +} namespace Opie { /* the default xml implementation */ /** * This class is the SQL implementation of a Contact backend * it does implement everything available for OPimContact. * @see OPimAccessBackend for more information of available methods */ class OPimContactAccessBackend_SQL : public OPimContactAccessBackend { public: OPimContactAccessBackend_SQL ( const QString& appname, const QString& filename = QString::null ); ~OPimContactAccessBackend_SQL (); bool save(); @@ -78,32 +82,32 @@ class OPimContactAccessBackend_SQL : public OPimContactAccessBackend { QArray<int> matchRegexp( const QRegExp &r ) const; const uint querySettings(); bool hasQuerySettings (uint querySettings) const; // Currently only asc implemented.. QArray<int> sorted( bool asc, int , int , int ); bool add ( const OPimContact &newcontact ); bool replace ( const OPimContact &contact ); bool remove ( int uid ); bool reload(); private: - QArray<int> extractUids( OSQLResult& res ) const; + QArray<int> extractUids( Opie::DB::OSQLResult& res ) const; QMap<int, QString> requestNonCustom( int uid ) const; QMap<QString, QString> requestCustom( int uid ) const; void update(); protected: bool m_changed; QString m_fileName; QArray<int> m_uids; - OSQLDriver* m_driver; + Opie::DB::OSQLDriver* m_driver; }; } #endif diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp index 5d92b8f..f5e76d5 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp @@ -28,40 +28,41 @@ */ /* * XML Backend for the OPIE-Contact Database. */ #include <opie2/ocontactaccessbackend_xml.h> #include <qasciidict.h> #include <qfile.h> #include <qfileinfo.h> #include <qregexp.h> #include <qarray.h> #include <qmap.h> #include <qpe/global.h> -#include <opie2/xmltree.h> +#include "private/xmltree.h" #include <opie2/ocontactaccessbackend.h> #include <opie2/ocontactaccess.h> #include <stdlib.h> #include <errno.h> using namespace Opie; +using namespace Opie::Pim::Private; namespace Opie { OPimContactAccessBackend_XML::OPimContactAccessBackend_XML ( const QString& appname, const QString& filename ): m_changed( false ) { // Just m_contactlist should call delete if an entry // is removed. m_contactList.setAutoDelete( true ); m_uidToContact.setAutoDelete( false ); m_appName = appname; /* Set journalfile name ... */ m_journalName = getenv("HOME"); m_journalName +="/.abjournal" + appname; diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp index 2ee76cc..a779dc1 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp +++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp @@ -33,32 +33,34 @@ #include <stdio.h> #include <stdlib.h> #include <qarray.h> #include <qstringlist.h> #include <qpe/global.h> #include <opie2/osqldriver.h> #include <opie2/osqlmanager.h> #include <opie2/osqlquery.h> #include <opie2/opimrecurrence.h> #include <opie2/odatebookaccessbackend_sql.h> +using namespace Opie::DB; + namespace Opie { ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& , const QString& fileName ) : ODateBookAccessBackend(), m_driver( NULL ) { m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName; // Get the standart sql-driver from the OSQLManager.. OSQLManager man; m_driver = man.standard(); m_driver->setUrl( m_fileName ); initFields(); diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.h b/libopie2/opiepim/backend/odatebookaccessbackend_sql.h index cbfeb97..60d7f21 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.h +++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.h @@ -21,33 +21,37 @@ : = ...= . :.=- -. .:....=;==+<; 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. */ #ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H #define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H #include <qmap.h> #include <opie2/osqlresult.h> #include <opie2/odatebookaccessbackend.h> +namespace Opie { +namespace DB { class OSQLDriver; +} +} namespace Opie { /** * This is the default SQL implementation for DateBoook SQL storage * It fully implements the interface * @see ODateBookAccessBackend * @see OPimAccessBackend */ class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { public: ODateBookAccessBackend_SQL( const QString& appName, const QString& fileName = QString::null); ~ODateBookAccessBackend_SQL(); bool load(); bool reload(); @@ -64,30 +68,30 @@ public: QArray<UID> rawEvents()const; QArray<UID> rawRepeats()const; QArray<UID> nonRepeats()const; OPimEvent::ValueList directNonRepeats(); OPimEvent::ValueList directRawRepeats(); private: bool loadFile(); QString m_fileName; QArray<int> m_uids; QMap<int, QString> m_fieldMap; QMap<QString, int> m_reverseFieldMap; - OSQLDriver* m_driver; + Opie::DB::OSQLDriver* m_driver; class Private; Private *d; void initFields(); void update(); - QArray<int> extractUids( OSQLResult& res ) const; + QArray<int> extractUids( Opie::DB::OSQLResult& res ) const; }; } #endif diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp index 72232e5..d218090 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.cpp +++ b/libopie2/opiepim/backend/otodoaccesssql.cpp @@ -28,32 +28,34 @@ */ #include <qdatetime.h> #include <qpe/global.h> #include <opie2/osqldriver.h> #include <opie2/osqlresult.h> #include <opie2/osqlmanager.h> #include <opie2/osqlquery.h> #include <opie2/otodoaccesssql.h> #include <opie2/opimstate.h> #include <opie2/opimnotifymanager.h> #include <opie2/opimrecurrence.h> +using namespace Opie::DB; + using namespace Opie; /* * first some query * CREATE query * LOAD query * INSERT * REMOVE * CLEAR */ namespace { /** * CreateQuery for the Todolist Table */ class CreateQuery : public OSQLQuery { public: CreateQuery(); diff --git a/libopie2/opiepim/backend/otodoaccesssql.h b/libopie2/opiepim/backend/otodoaccesssql.h index e945863..0ae2591 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.h +++ b/libopie2/opiepim/backend/otodoaccesssql.h @@ -20,35 +20,39 @@ ++= -. .` .: 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. */ #ifndef OPIE_PIM_ACCESS_SQL_H #define OPIE_PIM_ACCESS_SQL_H #include <qasciidict.h> #include <opie2/otodoaccessbackend.h> +namespace Opie { +namespace DB { class OSQLDriver; class OSQLResult; class OSQLResultItem; +} +} namespace Opie { class OPimTodoAccessBackendSQL : public OPimTodoAccessBackend { public: OPimTodoAccessBackendSQL( const QString& file ); ~OPimTodoAccessBackendSQL(); bool load(); bool reload(); bool save(); QArray<int> allRecords()const; QArray<int> queryByExample( const OPimTodo& t, int settings, const QDateTime& d = QDateTime() ); OPimTodo find(int uid)const; OPimTodo find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const; @@ -58,31 +62,31 @@ public: bool replace( const OPimTodo& t ); QArray<int> overDue(); QArray<int> effectiveToDos( const QDate& start, const QDate& end, bool includeNoDates ); QArray<int> sorted(bool asc, int sortOrder, int sortFilter, int cat ); QBitArray supports()const; QArray<int> matchRegexp( const QRegExp &r ) const; void removeAllCompleted(); private: void update()const; void fillDict(); inline bool date( QDate& date, const QString& )const; - inline OPimTodo todo( const OSQLResult& )const; - inline OPimTodo todo( OSQLResultItem& )const; - inline QArray<int> uids( const OSQLResult& )const; + inline OPimTodo todo( const Opie::DB::OSQLResult& )const; + inline OPimTodo todo( Opie::DB::OSQLResultItem& )const; + inline QArray<int> uids( const Opie::DB::OSQLResult& )const; OPimTodo todo( int uid )const; QBitArray sup() const; QAsciiDict<int> m_dict; - OSQLDriver* m_driver; + Opie::DB::OSQLDriver* m_driver; QArray<int> m_uids; bool m_dirty : 1; }; } #endif |