summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/ocontactaccess.cpp
authoreilers <eilers>2002-10-16 10:52:40 (UTC)
committer eilers <eilers>2002-10-16 10:52:40 (UTC)
commitf9756ca203a06fa60413ef1a96416d87b9dc1a6b (patch) (unidiff)
tree0b67c3c485349a1c31ea82e7c12526b990654d58 /libopie2/opiepim/core/ocontactaccess.cpp
parent9eba62fc184260f1a0455a6dd057e2ccebf4bdac (diff)
downloadopie-f9756ca203a06fa60413ef1a96416d87b9dc1a6b.zip
opie-f9756ca203a06fa60413ef1a96416d87b9dc1a6b.tar.gz
opie-f9756ca203a06fa60413ef1a96416d87b9dc1a6b.tar.bz2
Added some docu to the interface and now using the cache infrastucture by zecke.. :)
Diffstat (limited to 'libopie2/opiepim/core/ocontactaccess.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp57
1 files changed, 11 insertions, 46 deletions
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp
index e8c0a45..2ca0283 100644
--- a/libopie2/opiepim/core/ocontactaccess.cpp
+++ b/libopie2/opiepim/core/ocontactaccess.cpp
@@ -21,6 +21,9 @@
21 * ===================================================================== 21 * =====================================================================
22 * History: 22 * History:
23 * $Log$ 23 * $Log$
24 * Revision 1.5 2002/10/16 10:52:40 eilers
25 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
26 *
24 * Revision 1.4 2002/10/14 16:21:54 eilers 27 * Revision 1.4 2002/10/14 16:21:54 eilers
25 * Some minor interface updates 28 * Some minor interface updates
26 * 29 *
@@ -62,8 +65,7 @@
62 65
63OContactAccess::OContactAccess ( const QString appname, const QString , 66OContactAccess::OContactAccess ( const QString appname, const QString ,
64 OContactAccessBackend* end, bool autosync ): 67 OContactAccessBackend* end, bool autosync ):
65 OPimAccessTemplate<OContact>( end ), 68 OPimAccessTemplate<OContact>( end )
66 m_changed ( false )
67{ 69{
68 /* take care of the backend. If there is no one defined, we 70 /* take care of the backend. If there is no one defined, we
69 * will use the XML-Backend as default (until we have a cute SQL-Backend..). 71 * will use the XML-Backend as default (until we have a cute SQL-Backend..).
@@ -94,15 +96,10 @@ OContactAccess::~OContactAccess ()
94 /* The user may forget to save the changed database, therefore try to 96 /* The user may forget to save the changed database, therefore try to
95 * do it for him.. 97 * do it for him..
96 */ 98 */
97 if ( m_changed ) 99 save();
98 save();
99 // delete m_backEnd; is done by template.. 100 // delete m_backEnd; is done by template..
100} 101}
101 102
102bool OContactAccess::load()
103{
104 return ( m_backEnd->load() );
105}
106 103
107bool OContactAccess::save () 104bool OContactAccess::save ()
108{ 105{
@@ -110,19 +107,15 @@ bool OContactAccess::save ()
110 * Data. This will remove added items which is unacceptable ! 107 * Data. This will remove added items which is unacceptable !
111 * Therefore: Reload database and merge the data... 108 * Therefore: Reload database and merge the data...
112 */ 109 */
113 if ( m_backEnd->wasChangedExternally() ) 110 if ( OPimAccessTemplate<OContact>::wasChangedExternally() )
114 reload(); 111 reload();
115 112
116 if ( m_changed ){ 113 bool status = OPimAccessTemplate<OContact>::save();
117 bool status = m_backEnd->save(); 114 if ( !status ) return false;
118 if ( !status ) return false;
119 115
120 m_changed = false; 116 /* Now tell everyone that new data is available.
121 /* Now tell everyone that new data is available. 117 */
122 */ 118 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
123 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
124
125 }
126 119
127 return true; 120 return true;
128} 121}
@@ -137,29 +130,6 @@ bool OContactAccess::hasQuerySettings ( int querySettings ) const
137 return ( m_backEnd->hasQuerySettings ( querySettings ) ); 130 return ( m_backEnd->hasQuerySettings ( querySettings ) );
138} 131}
139 132
140bool OContactAccess::add ( const OContact& newcontact )
141{
142 m_changed = true;
143 return ( m_backEnd->add ( newcontact ) );
144}
145
146bool OContactAccess::replace ( const OContact& contact )
147{
148 m_changed = true;
149 return ( m_backEnd->replace ( contact ) );
150}
151
152bool OContactAccess::remove ( const OContact& t )
153{
154 m_changed = true;
155 return ( m_backEnd->remove ( t.uid() ) );
156}
157
158bool OContactAccess::remove ( int uid )
159{
160 m_changed = true;
161 return ( m_backEnd->remove ( uid ) );
162}
163 133
164bool OContactAccess::wasChangedExternally()const 134bool OContactAccess::wasChangedExternally()const
165{ 135{
@@ -167,11 +137,6 @@ bool OContactAccess::wasChangedExternally()const
167} 137}
168 138
169 139
170bool OContactAccess::reload()
171{
172 return ( m_backEnd->reload() );
173}
174
175void OContactAccess::copMessage( const QCString &msg, const QByteArray & ) 140void OContactAccess::copMessage( const QCString &msg, const QByteArray & )
176{ 141{
177 if ( msg == "addressbookUpdated()" ){ 142 if ( msg == "addressbookUpdated()" ){