Diffstat (limited to 'libopie2/opiepim/core/ocontactaccess.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/ocontactaccess.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp index 4f9b504..67f267f 100644 --- a/libopie2/opiepim/core/ocontactaccess.cpp +++ b/libopie2/opiepim/core/ocontactaccess.cpp | |||
@@ -31,48 +31,49 @@ | |||
31 | * ToDo: XML-Backend: Automatic reload if something was changed... | 31 | * ToDo: XML-Backend: Automatic reload if something was changed... |
32 | * | 32 | * |
33 | * | 33 | * |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include "ocontactaccess.h" | 36 | #include "ocontactaccess.h" |
37 | #include "obackendfactory.h" | 37 | #include "obackendfactory.h" |
38 | 38 | ||
39 | #include <qasciidict.h> | 39 | #include <qasciidict.h> |
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 | 56 | ||
56 | namespace Opie { | 57 | namespace Opie { |
57 | 58 | ||
58 | OPimContactAccess::OPimContactAccess ( const QString appname, const QString , | 59 | OPimContactAccess::OPimContactAccess ( const QString appname, const QString , |
59 | OPimContactAccessBackend* end, bool autosync ): | 60 | OPimContactAccessBackend* end, bool autosync ): |
60 | OPimAccessTemplate<OPimContact>( end ) | 61 | OPimAccessTemplate<OPimContact>( end ) |
61 | { | 62 | { |
62 | /* take care of the backend. If there is no one defined, we | 63 | /* take care of the backend. If there is no one defined, we |
63 | * will use the XML-Backend as default (until we have a cute SQL-Backend..). | 64 | * will use the XML-Backend as default (until we have a cute SQL-Backend..). |
64 | */ | 65 | */ |
65 | if( end == 0 ) { | 66 | if( end == 0 ) { |
66 | qWarning ("Using BackendFactory !"); | 67 | qWarning ("Using BackendFactory !"); |
67 | end = OBackendFactory<OPimContactAccessBackend>::Default( "contact", appname ); | 68 | end = OBackendFactory<OPimContactAccessBackend>::Default( "contact", appname ); |
68 | } | 69 | } |
69 | // Set backend locally and in template | 70 | // Set backend locally and in template |
70 | m_backEnd = end; | 71 | m_backEnd = end; |
71 | OPimAccessTemplate<OPimContact>::setBackEnd (end); | 72 | OPimAccessTemplate<OPimContact>::setBackEnd (end); |
72 | 73 | ||
73 | 74 | ||
74 | /* Connect signal of external db change to function */ | 75 | /* Connect signal of external db change to function */ |
75 | QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); | 76 | QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); |
76 | connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)), | 77 | connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)), |
77 | this, SLOT(copMessage(const QCString&,const QByteArray&)) ); | 78 | this, SLOT(copMessage(const QCString&,const QByteArray&)) ); |
78 | if ( autosync ){ | 79 | if ( autosync ){ |
@@ -128,25 +129,30 @@ OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortO | |||
128 | } | 129 | } |
129 | 130 | ||
130 | 131 | ||
131 | bool OPimContactAccess::wasChangedExternally()const | 132 | bool OPimContactAccess::wasChangedExternally()const |
132 | { | 133 | { |
133 | return ( m_backEnd->wasChangedExternally() ); | 134 | return ( m_backEnd->wasChangedExternally() ); |
134 | } | 135 | } |
135 | 136 | ||
136 | 137 | ||
137 | void OPimContactAccess::copMessage( const QCString &msg, const QByteArray & ) | 138 | void OPimContactAccess::copMessage( const QCString &msg, const QByteArray & ) |
138 | { | 139 | { |
139 | if ( msg == "addressbookUpdated()" ){ | 140 | if ( msg == "addressbookUpdated()" ){ |
140 | qWarning ("OPimContactAccess: Received addressbokUpdated()"); | 141 | qWarning ("OPimContactAccess: Received addressbokUpdated()"); |
141 | emit signalChanged ( this ); | 142 | emit signalChanged ( this ); |
142 | } else if ( msg == "flush()" ) { | 143 | } else if ( msg == "flush()" ) { |
143 | qWarning ("OPimContactAccess: Received flush()"); | 144 | qWarning ("OPimContactAccess: Received flush()"); |
144 | save (); | 145 | save (); |
145 | } else if ( msg == "reload()" ) { | 146 | } else if ( msg == "reload()" ) { |
146 | qWarning ("OPimContactAccess: Received reload()"); | 147 | qWarning ("OPimContactAccess: Received reload()"); |
147 | reload (); | 148 | reload (); |
148 | emit signalChanged ( this ); | 149 | emit signalChanged ( this ); |
149 | } | 150 | } |
150 | } | 151 | } |
151 | 152 | ||
153 | int OPimContactAccess::rtti() const | ||
154 | { | ||
155 | return OPimResolver::AddressBook; | ||
156 | } | ||
157 | |||
152 | } | 158 | } |