summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie/pim/ocontactaccess.cpp47
-rw-r--r--libopie/pim/ocontactaccess.h43
-rw-r--r--libopie/pim/ocontactaccessbackend_xml.h21
-rw-r--r--libopie/pim/opimaccesstemplate.h25
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.h21
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp47
-rw-r--r--libopie2/opiepim/core/ocontactaccess.h43
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h25
8 files changed, 98 insertions, 174 deletions
diff --git a/libopie/pim/ocontactaccess.cpp b/libopie/pim/ocontactaccess.cpp
index e8c0a45..2ca0283 100644
--- a/libopie/pim/ocontactaccess.cpp
+++ b/libopie/pim/ocontactaccess.cpp
@@ -23,2 +23,5 @@
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
@@ -64,4 +67,3 @@ OContactAccess::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{
@@ -96,3 +98,2 @@ OContactAccess::~OContactAccess ()
96 */ 98 */
97 if ( m_changed )
98 save(); 99 save();
@@ -101,6 +102,2 @@ OContactAccess::~OContactAccess ()
101 102
102bool OContactAccess::load()
103{
104 return ( m_backEnd->load() );
105}
106 103
@@ -112,10 +109,8 @@ bool OContactAccess::save ()
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();
118 if ( !status ) return false; 114 if ( !status ) return false;
119 115
120 m_changed = false;
121 /* Now tell everyone that new data is available. 116 /* Now tell everyone that new data is available.
@@ -124,4 +119,2 @@ bool OContactAccess::save ()
124 119
125 }
126
127 return true; 120 return true;
@@ -139,25 +132,2 @@ bool OContactAccess::hasQuerySettings ( int querySettings ) const
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
@@ -169,7 +139,2 @@ bool OContactAccess::wasChangedExternally()const
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 & )
diff --git a/libopie/pim/ocontactaccess.h b/libopie/pim/ocontactaccess.h
index adc66cf..da9c942 100644
--- a/libopie/pim/ocontactaccess.h
+++ b/libopie/pim/ocontactaccess.h
@@ -19,2 +19,5 @@
19 * $Log$ 19 * $Log$
20 * Revision 1.3 2002/10/16 10:52:40 eilers
21 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
22 *
20 * Revision 1.2 2002/10/14 16:21:54 eilers 23 * Revision 1.2 2002/10/14 16:21:54 eilers
@@ -93,34 +96,2 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
93 96
94 /** Add Contact to database.
95 * @param newcontact The contact to add.
96 * @return <i>true</i> if added successfully.
97 */
98 bool add (const OContact& newcontact);
99
100 /** Replace contact.
101 * Replaces given contact with contact with the user id <i>uid</i>.
102 * @param uid The user ID
103 * @param contact The new contact
104 * @return <i>true</i> if successful.
105 */
106 bool replace ( const OContact& contact );
107
108 /** Remove contact.
109 * Removes contact with the user id <i>uid</i>.
110 * @param The contact to remove
111 * @return <i>true</i> if successful.
112 */
113 bool remove ( const OContact& t );
114
115 /** Remove contact.
116 * Removes contact with the user id <i>uid</i>.
117 * @param The user id of the contact to remove
118 * @return <i>true</i> if successful.
119 */
120 bool remove ( int uid );
121
122 /** Load Database *
123 */
124 bool load();
125
126 /** 97 /**
@@ -131,9 +102,2 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
131 102
132 /** Reload database.
133 * You should execute this function if the external database
134 * was changed.
135 * This function will load the external database and afterwards
136 * rejoin the local changes. Therefore the local database will be set consistent.
137 */
138 bool reload();
139 103
@@ -160,3 +124,2 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
160 bool m_loading:1; 124 bool m_loading:1;
161 bool m_changed;
162 125
diff --git a/libopie/pim/ocontactaccessbackend_xml.h b/libopie/pim/ocontactaccessbackend_xml.h
index 50ea329..12a75ba 100644
--- a/libopie/pim/ocontactaccessbackend_xml.h
+++ b/libopie/pim/ocontactaccessbackend_xml.h
@@ -19,2 +19,5 @@
19 * $Log$ 19 * $Log$
20 * Revision 1.4 2002/10/16 10:52:40 eilers
21 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
22 *
20 * Revision 1.3 2002/10/14 16:21:54 eilers 23 * Revision 1.3 2002/10/14 16:21:54 eilers
@@ -58,3 +61,4 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
58 public: 61 public:
59 OContactAccessBackend_XML ( QString appname, QString filename = 0l ) 62 OContactAccessBackend_XML ( QString appname, QString filename = 0l ):
63 m_changed( false )
60 { 64 {
@@ -77,2 +81,6 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
77 bool save() { 81 bool save() {
82
83 if ( !m_changed )
84 return true;
85
78 QString strNewFile = m_fileName + ".new"; 86 QString strNewFile = m_fileName + ".new";
@@ -125,2 +133,4 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
125 removeJournal(); 133 removeJournal();
134
135 m_changed = false;
126 return true; 136 return true;
@@ -147,2 +157,3 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
147 m_contactList.clear(); 157 m_contactList.clear();
158 m_changed = false;
148 159
@@ -277,2 +288,5 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
277 addContact_p( newcontact ); 288 addContact_p( newcontact );
289
290 m_changed = true;
291
278 return true; 292 return true;
@@ -282,2 +296,4 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
282 { 296 {
297 m_changed = true;
298
283 bool found = false; 299 bool found = false;
@@ -302,2 +318,4 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
302 { 318 {
319 m_changed = true;
320
303 bool found = false; 321 bool found = false;
@@ -555,2 +573,3 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
555 protected: 573 protected:
574 bool m_changed;
556 QString m_journalName; 575 QString m_journalName;
diff --git a/libopie/pim/opimaccesstemplate.h b/libopie/pim/opimaccesstemplate.h
index 3e1f393..50cb1e4 100644
--- a/libopie/pim/opimaccesstemplate.h
+++ b/libopie/pim/opimaccesstemplate.h
@@ -39,4 +39,7 @@ public:
39 39
40 /** 40 /** Reload database.
41 * reload from the backend 41 * You should execute this function if the external database
42 * was changed.
43 * This function will load the external database and afterwards
44 * rejoin the local changes. Therefore the local database will be set consistent.
42 */ 45 */
@@ -44,4 +47,5 @@ public:
44 47
45 /** 48 /** Save contacts database.
46 * save to the backend 49 * Save is more a "commit". After calling this function, all changes are public available.
50 * @return true if successful
47 */ 51 */
@@ -51,2 +55,4 @@ public:
51 * if the resource was changed externally 55 * if the resource was changed externally
56 * You should use the signal handling instead of polling possible changes !
57 * zecke: Do you implement a signal for otodoaccess ?
52 */ 58 */
@@ -61,3 +67,3 @@ public:
61 /** 67 /**
62 * queryByExample) 68 * queryByExample.
63 * @see otodoaccess, ocontactaccess 69 * @see otodoaccess, ocontactaccess
@@ -85,2 +91,4 @@ public:
85 * add T to the backend 91 * add T to the backend
92 * @param t The item to add.
93 * @return <i>true</i> if added successfully.
86 */ 94 */
@@ -91,2 +99,4 @@ public:
91 * remove T from the backend 99 * remove T from the backend
100 * @param t The item to remove
101 * @return <i>true</i> if successful.
92 */ 102 */
@@ -96,2 +106,4 @@ public:
96 * remove the OPimRecord with uid 106 * remove the OPimRecord with uid
107 * @param uid The ID of the item to remove
108 * @return <i>true</i> if successful.
97 */ 109 */
@@ -101,2 +113,4 @@ public:
101 * replace T from backend 113 * replace T from backend
114 * @param t The item to replace
115 * @return <i>true</i> if successful.
102 */ 116 */
@@ -144,2 +158,3 @@ template <class T>
144bool OPimAccessTemplate<T>::reload() { 158bool OPimAccessTemplate<T>::reload() {
159 invalidateCache(); // zecke: I think this should be added (se)
145 return m_backEnd->reload(); 160 return m_backEnd->reload();
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
index 50ea329..12a75ba 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.h
@@ -19,2 +19,5 @@
19 * $Log$ 19 * $Log$
20 * Revision 1.4 2002/10/16 10:52:40 eilers
21 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
22 *
20 * Revision 1.3 2002/10/14 16:21:54 eilers 23 * Revision 1.3 2002/10/14 16:21:54 eilers
@@ -58,3 +61,4 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
58 public: 61 public:
59 OContactAccessBackend_XML ( QString appname, QString filename = 0l ) 62 OContactAccessBackend_XML ( QString appname, QString filename = 0l ):
63 m_changed( false )
60 { 64 {
@@ -77,2 +81,6 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
77 bool save() { 81 bool save() {
82
83 if ( !m_changed )
84 return true;
85
78 QString strNewFile = m_fileName + ".new"; 86 QString strNewFile = m_fileName + ".new";
@@ -125,2 +133,4 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
125 removeJournal(); 133 removeJournal();
134
135 m_changed = false;
126 return true; 136 return true;
@@ -147,2 +157,3 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
147 m_contactList.clear(); 157 m_contactList.clear();
158 m_changed = false;
148 159
@@ -277,2 +288,5 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
277 addContact_p( newcontact ); 288 addContact_p( newcontact );
289
290 m_changed = true;
291
278 return true; 292 return true;
@@ -282,2 +296,4 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
282 { 296 {
297 m_changed = true;
298
283 bool found = false; 299 bool found = false;
@@ -302,2 +318,4 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
302 { 318 {
319 m_changed = true;
320
303 bool found = false; 321 bool found = false;
@@ -555,2 +573,3 @@ class OContactAccessBackend_XML : public OContactAccessBackend {
555 protected: 573 protected:
574 bool m_changed;
556 QString m_journalName; 575 QString m_journalName;
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
@@ -23,2 +23,5 @@
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
@@ -64,4 +67,3 @@ OContactAccess::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{
@@ -96,3 +98,2 @@ OContactAccess::~OContactAccess ()
96 */ 98 */
97 if ( m_changed )
98 save(); 99 save();
@@ -101,6 +102,2 @@ OContactAccess::~OContactAccess ()
101 102
102bool OContactAccess::load()
103{
104 return ( m_backEnd->load() );
105}
106 103
@@ -112,10 +109,8 @@ bool OContactAccess::save ()
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();
118 if ( !status ) return false; 114 if ( !status ) return false;
119 115
120 m_changed = false;
121 /* Now tell everyone that new data is available. 116 /* Now tell everyone that new data is available.
@@ -124,4 +119,2 @@ bool OContactAccess::save ()
124 119
125 }
126
127 return true; 120 return true;
@@ -139,25 +132,2 @@ bool OContactAccess::hasQuerySettings ( int querySettings ) const
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
@@ -169,7 +139,2 @@ bool OContactAccess::wasChangedExternally()const
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 & )
diff --git a/libopie2/opiepim/core/ocontactaccess.h b/libopie2/opiepim/core/ocontactaccess.h
index adc66cf..da9c942 100644
--- a/libopie2/opiepim/core/ocontactaccess.h
+++ b/libopie2/opiepim/core/ocontactaccess.h
@@ -19,2 +19,5 @@
19 * $Log$ 19 * $Log$
20 * Revision 1.3 2002/10/16 10:52:40 eilers
21 * Added some docu to the interface and now using the cache infrastucture by zecke.. :)
22 *
20 * Revision 1.2 2002/10/14 16:21:54 eilers 23 * Revision 1.2 2002/10/14 16:21:54 eilers
@@ -93,34 +96,2 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
93 96
94 /** Add Contact to database.
95 * @param newcontact The contact to add.
96 * @return <i>true</i> if added successfully.
97 */
98 bool add (const OContact& newcontact);
99
100 /** Replace contact.
101 * Replaces given contact with contact with the user id <i>uid</i>.
102 * @param uid The user ID
103 * @param contact The new contact
104 * @return <i>true</i> if successful.
105 */
106 bool replace ( const OContact& contact );
107
108 /** Remove contact.
109 * Removes contact with the user id <i>uid</i>.
110 * @param The contact to remove
111 * @return <i>true</i> if successful.
112 */
113 bool remove ( const OContact& t );
114
115 /** Remove contact.
116 * Removes contact with the user id <i>uid</i>.
117 * @param The user id of the contact to remove
118 * @return <i>true</i> if successful.
119 */
120 bool remove ( int uid );
121
122 /** Load Database *
123 */
124 bool load();
125
126 /** 97 /**
@@ -131,9 +102,2 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
131 102
132 /** Reload database.
133 * You should execute this function if the external database
134 * was changed.
135 * This function will load the external database and afterwards
136 * rejoin the local changes. Therefore the local database will be set consistent.
137 */
138 bool reload();
139 103
@@ -160,3 +124,2 @@ class OContactAccess: public QObject, public OPimAccessTemplate<OContact>
160 bool m_loading:1; 124 bool m_loading:1;
161 bool m_changed;
162 125
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h
index 3e1f393..50cb1e4 100644
--- a/libopie2/opiepim/core/opimaccesstemplate.h
+++ b/libopie2/opiepim/core/opimaccesstemplate.h
@@ -39,4 +39,7 @@ public:
39 39
40 /** 40 /** Reload database.
41 * reload from the backend 41 * You should execute this function if the external database
42 * was changed.
43 * This function will load the external database and afterwards
44 * rejoin the local changes. Therefore the local database will be set consistent.
42 */ 45 */
@@ -44,4 +47,5 @@ public:
44 47
45 /** 48 /** Save contacts database.
46 * save to the backend 49 * Save is more a "commit". After calling this function, all changes are public available.
50 * @return true if successful
47 */ 51 */
@@ -51,2 +55,4 @@ public:
51 * if the resource was changed externally 55 * if the resource was changed externally
56 * You should use the signal handling instead of polling possible changes !
57 * zecke: Do you implement a signal for otodoaccess ?
52 */ 58 */
@@ -61,3 +67,3 @@ public:
61 /** 67 /**
62 * queryByExample) 68 * queryByExample.
63 * @see otodoaccess, ocontactaccess 69 * @see otodoaccess, ocontactaccess
@@ -85,2 +91,4 @@ public:
85 * add T to the backend 91 * add T to the backend
92 * @param t The item to add.
93 * @return <i>true</i> if added successfully.
86 */ 94 */
@@ -91,2 +99,4 @@ public:
91 * remove T from the backend 99 * remove T from the backend
100 * @param t The item to remove
101 * @return <i>true</i> if successful.
92 */ 102 */
@@ -96,2 +106,4 @@ public:
96 * remove the OPimRecord with uid 106 * remove the OPimRecord with uid
107 * @param uid The ID of the item to remove
108 * @return <i>true</i> if successful.
97 */ 109 */
@@ -101,2 +113,4 @@ public:
101 * replace T from backend 113 * replace T from backend
114 * @param t The item to replace
115 * @return <i>true</i> if successful.
102 */ 116 */
@@ -144,2 +158,3 @@ template <class T>
144bool OPimAccessTemplate<T>::reload() { 158bool OPimAccessTemplate<T>::reload() {
159 invalidateCache(); // zecke: I think this should be added (se)
145 return m_backEnd->reload(); 160 return m_backEnd->reload();