summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/opie/resourceopie.h
Unidiff
Diffstat (limited to 'kabc/plugins/opie/resourceopie.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/opie/resourceopie.h40
1 files changed, 22 insertions, 18 deletions
diff --git a/kabc/plugins/opie/resourceopie.h b/kabc/plugins/opie/resourceopie.h
index 9db9485..ca30fee 100644
--- a/kabc/plugins/opie/resourceopie.h
+++ b/kabc/plugins/opie/resourceopie.h
@@ -34,18 +34,16 @@ $Id$
34 34
35#include <sys/types.h> 35#include <sys/types.h>
36 36
37#include "resource.h" 37#include "resource.h"
38 38
39 39
40//class QTimer; 40class OContactAccess;
41//class FormatPlugin;
42 41
43namespace KABC { 42namespace KABC {
44 43
45//US class FormatPlugin;
46class ResourceConfigWidget; 44class ResourceConfigWidget;
47class OpieConverter; 45class OpieConverter;
48/** 46/**
49 @internal 47 @internal
50*/ 48*/
51class ResourceOpie : public Resource 49class ResourceOpie : public Resource
@@ -56,18 +54,18 @@ public:
56 54
57 /** 55 /**
58 Constructor. 56 Constructor.
59 57
60 @param cfg The config object where custom resource settings are stored. 58 @param cfg The config object where custom resource settings are stored.
61 */ 59 */
62 ResourceOpie( const KConfig *cfg ); 60 ResourceOpie( const KConfig *cfg, bool syncable );
63 61
64 /** 62 /**
65 Construct file resource on file @arg fileName using format @arg formatName. 63 Construct file resource on file @arg fileName using format @arg formatName.
66 */ 64 */
67 ResourceOpie( const QString &fileName ); 65 ResourceOpie( const QString &fileName, bool syncable );
68 66
69 /** 67 /**
70 * Destructor. 68 * Destructor.
71 */ 69 */
72 ~ResourceOpie(); 70 ~ResourceOpie();
73 71
@@ -83,13 +81,13 @@ public:
83 virtual bool doOpen(); 81 virtual bool doOpen();
84 82
85 /** 83 /**
86 * Closes the file again. 84 * Closes the file again.
87 */ 85 */
88 virtual void doClose(); 86 virtual void doClose();
89 87
90 /** 88 /**
91 * Requests a save ticket, that is used by @ref save() 89 * Requests a save ticket, that is used by @ref save()
92 */ 90 */
93 virtual Ticket *requestSaveTicket(); 91 virtual Ticket *requestSaveTicket();
94 92
95 /** 93 /**
@@ -103,50 +101,56 @@ public:
103 * Returns true if all addressees could be saved otherwise false. 101 * Returns true if all addressees could be saved otherwise false.
104 * 102 *
105 * @param ticket The ticket returned by @ref requestSaveTicket() 103 * @param ticket The ticket returned by @ref requestSaveTicket()
106 */ 104 */
107 virtual bool save( Ticket *ticket ); 105 virtual bool save( Ticket *ticket );
108 106
109 /**
110 * Set name of file to be used for saving.
111 */
112 void setFileName( const QString & );
113
114 /**
115 * Return name of file used for loading and saving the address book.
116 */
117 QString fileName() const;
118 107
119 /** 108 /**
120 * Remove a addressee from its source. 109 * Remove a addressee from its source.
121 * This method is mainly called by KABC::AddressBook. 110 * This method is mainly called by KABC::AddressBook.
122 */ 111 */
123 virtual void removeAddressee( const Addressee& addr ); 112 virtual void removeAddressee( const Addressee& addr );
124 113
125 /** 114 /**
115 * Set name of file to be used for saving.
116 */
117 virtual void setFileName( const QString & );
118
119 /**
126 * This method is called by an error handler if the application 120 * This method is called by an error handler if the application
127 * crashed 121 * crashed
128 */ 122 */
129 virtual void cleanUp(); 123 virtual void cleanUp();
130 124
125 /**
126 * This method returns the number of elements that are currently in the resource.
127 */
128 virtual int count() const;
129
130 /**
131 * This method removes all elements from the resource!! (Not from the addressbook)
132 */
133 virtual bool clear();
134
135
131protected slots: 136protected slots:
132 void fileChanged(); 137 void fileChanged();
133 138
134protected: 139protected:
135 void init( const QString &fileName ); 140 void init( const QString &fileName );
136 141
137 bool lock( const QString &fileName ); 142 bool lock( const QString &fileName );
138 void unlock( const QString &fileName ); 143 void unlock( const QString &fileName );
139 144
140private: 145private:
146 OContactAccess* mAccess;
141 OpieConverter* mConverter; 147 OpieConverter* mConverter;
142
143 QString mFileName;
144 148
145 QString mLockUniqueName; 149 QString mLockUniqueName;
146 150
147 KDirWatch mDirWatch; 151 KDirWatch mDirWatch;
148}; 152};
149 153
150} 154}
151 155
152#endif 156#endif