summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/ocontactaccess.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/core/ocontactaccess.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp
index b5f358b..e8c0a45 100644
--- a/libopie2/opiepim/core/ocontactaccess.cpp
+++ b/libopie2/opiepim/core/ocontactaccess.cpp
@@ -1,93 +1,95 @@
1/* 1/*
2 * Class to manage the Contacts. 2 * Class to manage the Contacts.
3 * 3 *
4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) 4 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
5 * 5 *
6 * ===================================================================== 6 * =====================================================================
7 *This program is free software; you can redistribute it and/or 7 *This program is free software; you can redistribute it and/or
8 *modify it under the terms of the GNU Library General Public 8 *modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
11 * ===================================================================== 11 * =====================================================================
12 * Info: This class could just work with a change in the header-file 12 * Info: This class could just work with a change in the header-file
13 * of the Contact class ! Therefore our libopie only compiles 13 * of the Contact class ! Therefore our libopie only compiles
14 * with our version of libqpe 14 * with our version of libqpe
15 * ===================================================================== 15 * =====================================================================
16 * ToDo: XML-Backend: Automatic reload if something was changed... 16 * ToDo: XML-Backend: Automatic reload if something was changed...
17 * 17 *
18 * 18 *
19 * ===================================================================== 19 * =====================================================================
20 * Version: $Id$ 20 * Version: $Id$
21 * ===================================================================== 21 * =====================================================================
22 * History: 22 * History:
23 * $Log$ 23 * $Log$
24 * Revision 1.4 2002/10/14 16:21:54 eilers
25 * Some minor interface updates
26 *
24 * Revision 1.3 2002/10/07 17:34:24 eilers 27 * Revision 1.3 2002/10/07 17:34:24 eilers
25 * added OBackendFactory for advanced backend access 28 * added OBackendFactory for advanced backend access
26 * 29 *
27 * Revision 1.2 2002/10/02 16:18:11 eilers 30 * Revision 1.2 2002/10/02 16:18:11 eilers
28 * debugged and seems to work almost perfectly .. 31 * debugged and seems to work almost perfectly ..
29 * 32 *
30 * Revision 1.1 2002/09/27 17:11:44 eilers 33 * Revision 1.1 2002/09/27 17:11:44 eilers
31 * Added API for accessing the Contact-Database ! It is compiling, but 34 * Added API for accessing the Contact-Database ! It is compiling, but
32 * please do not expect that anything is working ! 35 * please do not expect that anything is working !
33 * I will debug that stuff in the next time .. 36 * I will debug that stuff in the next time ..
34 * Please read README_COMPILE for compiling ! 37 * Please read README_COMPILE for compiling !
35 * 38 *
36 * 39 *
37 */ 40 */
38 41
39#include "ocontactaccess.h" 42#include "ocontactaccess.h"
40#include "obackendfactory.h" 43#include "obackendfactory.h"
41 44
42#include <qasciidict.h> 45#include <qasciidict.h>
43#include <qdatetime.h> 46#include <qdatetime.h>
44#include <qfile.h> 47#include <qfile.h>
45#include <qregexp.h> 48#include <qregexp.h>
46#include <qlist.h> 49#include <qlist.h>
47#include <qcopchannel_qws.h> 50#include <qcopchannel_qws.h>
48 51
49//#include <qpe/qcopenvelope_qws.h> 52//#include <qpe/qcopenvelope_qws.h>
50#include <qpe/global.h> 53#include <qpe/global.h>
51 54
52#include <errno.h> 55#include <errno.h>
53#include <fcntl.h> 56#include <fcntl.h>
54#include <unistd.h> 57#include <unistd.h>
55#include <stdlib.h> 58#include <stdlib.h>
56 59
57#include "ocontactaccessbackend_xml.h" 60#include "ocontactaccessbackend_xml.h"
58 61
59 62
60OContactAccess::OContactAccess ( const QString appname, const QString , 63OContactAccess::OContactAccess ( const QString appname, const QString ,
61 OContactAccessBackend* end, bool autosync ): 64 OContactAccessBackend* end, bool autosync ):
62 OPimAccessTemplate<OContact>( end ), 65 OPimAccessTemplate<OContact>( end ),
63 m_changed ( false ) 66 m_changed ( false )
64{ 67{
65 /* take care of the backend. If there is no one defined, we 68 /* take care of the backend. If there is no one defined, we
66 * will use the XML-Backend as default (until we have a cute SQL-Backend..). 69 * will use the XML-Backend as default (until we have a cute SQL-Backend..).
67 */ 70 */
68 if( end == 0 ) { 71 if( end == 0 ) {
69 // __asm__("int3");
70 qWarning ("Using BackendFactory !"); 72 qWarning ("Using BackendFactory !");
71 end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname ); 73 end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname );
72 } 74 }
73 // Set backend locally and in template 75 // Set backend locally and in template
74 m_backEnd = end; 76 m_backEnd = end;
75 OPimAccessTemplate<OContact>::setBackEnd (end); 77 OPimAccessTemplate<OContact>::setBackEnd (end);
76 78
77 79
78 /* Connect signal of external db change to function */ 80 /* Connect signal of external db change to function */
79 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); 81 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this );
80 connect( dbchannel, SIGNAL(received(const QCString &, const QByteArray &)), 82 connect( dbchannel, SIGNAL(received(const QCString &, const QByteArray &)),
81 this, SLOT(copMessage( const QCString &, const QByteArray &)) ); 83 this, SLOT(copMessage( const QCString &, const QByteArray &)) );
82 if ( autosync ){ 84 if ( autosync ){
83 QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); 85 QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this );
84 connect( syncchannel, SIGNAL(received(const QCString &, const QByteArray &)), 86 connect( syncchannel, SIGNAL(received(const QCString &, const QByteArray &)),
85 this, SLOT(copMessage( const QCString &, const QByteArray &)) ); 87 this, SLOT(copMessage( const QCString &, const QByteArray &)) );
86 } 88 }
87 89
88 90
89} 91}
90OContactAccess::~OContactAccess () 92OContactAccess::~OContactAccess ()
91{ 93{
92 /* The user may forget to save the changed database, therefore try to 94 /* The user may forget to save the changed database, therefore try to
93 * do it for him.. 95 * do it for him..