summaryrefslogtreecommitdiffabout
path: root/kabc/resource.h
Unidiff
Diffstat (limited to 'kabc/resource.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/resource.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/kabc/resource.h b/kabc/resource.h
index 7d42f81..2024d2d 100644
--- a/kabc/resource.h
+++ b/kabc/resource.h
@@ -17,153 +17,155 @@
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#ifndef KABC_RESOURCE_H 28#ifndef KABC_RESOURCE_H
29#define KABC_RESOURCE_H 29#define KABC_RESOURCE_H
30 30
31#include <kresources/resource.h> 31#include <kresources/resource.h>
32 32
33 33
34#include "addressbook.h" 34#include "addressbook.h"
35 35
36class KSyncProfile; 36class KSyncProfile;
37 37
38namespace KABC { 38namespace KABC {
39 39
40/** 40/**
41 * @short Helper class for handling coordinated save of address books. 41 * @short Helper class for handling coordinated save of address books.
42 * 42 *
43 * This class is used as helper class for saving address book. 43 * This class is used as helper class for saving address book.
44 * @see requestSaveTicket(), save(). 44 * @see requestSaveTicket(), save().
45 */ 45 */
46class Ticket 46class Ticket
47{ 47{
48 friend class Resource; 48 friend class Resource;
49 public: 49 public:
50 Resource *resource() { return mResource; } 50 Resource *resource() { return mResource; }
51 51
52 private: 52 private:
53 Ticket( Resource *resource ) : mResource( resource ) {} 53 Ticket( Resource *resource ) : mResource( resource ) {}
54 54
55 Resource *mResource; 55 Resource *mResource;
56}; 56};
57 57
58/** 58/**
59 * @internal 59 * @internal
60 */ 60 */
61class Resource : public KRES::Resource 61class Resource : public KRES::Resource
62{ 62{
63private: 63private:
64 /** 64 /**
65 * make this constructor private to force everybody to use the other one 65 * make this constructor private to force everybody to use the other one
66 */ 66 */
67 Resource( const KConfig *config); 67 Resource( const KConfig *config);
68 68
69public: 69public:
70 /** 70 /**
71 * Constructor 71 * Constructor
72 */ 72 */
73 Resource( const KConfig *config, bool syncable ); 73 Resource( const KConfig *config, bool syncable );
74 74
75 /** 75 /**
76 * Destructor. 76 * Destructor.
77 */ 77 */
78 virtual ~Resource(); 78 virtual ~Resource();
79 79
80 /** 80 /**
81 * Sets the address book of the resource. 81 * Sets the address book of the resource.
82 */ 82 */
83 void setAddressBook( AddressBook* ); 83 void setAddressBook( AddressBook* );
84 84
85 /** 85 /**
86 * Returns a pointer to the addressbook. 86 * Returns a pointer to the addressbook.
87 */ 87 */
88 AddressBook *addressBook(); 88 AddressBook *addressBook();
89 89
90 /** 90 /**
91 * Writes the resource specific config to file. 91 * Writes the resource specific config to file.
92 */ 92 */
93 virtual void writeConfig( KConfig *config ); 93 virtual void writeConfig( KConfig *config );
94 94
95 /** 95 /**
96 * Open the resource and returns if it was successfully 96 * Open the resource and returns if it was successfully
97 */ 97 */
98 virtual bool doOpen(); 98 virtual bool doOpen();
99 99
100 100
101 /** 101 /**
102 * Request a ticket, you have to pass through @ref save() to 102 * Request a ticket, you have to pass through @ref save() to
103 * allow locking. 103 * allow locking.
104 */ 104 */
105 virtual Ticket *requestSaveTicket(); 105 virtual Ticket *requestSaveTicket();
106 106
107 /** 107 /**
108 * Load all addressees to the addressbook 108 * Load all addressees to the addressbook
109 */ 109 */
110 virtual bool load(); 110 virtual bool load();
111 111
112 /** 112 /**
113 * Save all addressees to the addressbook. 113 * Save all addressees to the addressbook.
114 * 114 *
115 * @param ticket The ticket you get by @ref requestSaveTicket() 115 * @param ticket The ticket you get by @ref requestSaveTicket()
116 */ 116 */
117 virtual bool save( Ticket *ticket ); 117 virtual bool save( Ticket *ticket );
118 118
119 /** 119 /**
120 * Removes a addressee from resource. This method is mainly 120 * Removes a addressee from resource. This method is mainly
121 * used by record-based resources like LDAP or SQL. 121 * used by record-based resources like LDAP or SQL.
122 */ 122 */
123 virtual void removeAddressee( const Addressee& addr ); 123 virtual void removeAddressee( const Addressee& addr );
124 124
125 125
126 /** 126 /**
127 * This method is called by an error handler if the application 127 * This method is called by an error handler if the application
128 * crashed 128 * crashed
129 */ 129 */
130 virtual void cleanUp(); 130 virtual void cleanUp();
131 131
132 /** 132 /**
133 * Set name of file to be used for saving. 133 * Set name of file to be used for saving.
134 */ 134 */
135 virtual void setFileName( const QString & ); 135 virtual void setFileName( const QString & );
136 136
137 /** 137 /**
138 * Return name of file used for loading and saving the address book. 138 * Return name of file used for loading and saving the address book.
139 */ 139 */
140 virtual QString fileName() const; 140 virtual QString fileName() const;
141 141
142 142
143 virtual bool isSyncable() const; 143 virtual bool isSyncable() const;
144 144
145 virtual KSyncProfile* getSyncProfile();
146
145 /** 147 /**
146 * Set the name of resource.You can override this method, 148 * Set the name of resource.You can override this method,
147 * but also remember to call Resource::setResourceName(). 149 * but also remember to call Resource::setResourceName().
148 */ 150 */
149 virtual void setResourceName( const QString &name ); 151 virtual void setResourceName( const QString &name );
150 152
151 153
152 154
153protected: 155protected:
154 Ticket *createTicket( Resource * ); 156 Ticket *createTicket( Resource * );
155 virtual void doClose(); 157 virtual void doClose();
156 158
157private: 159private:
158 AddressBook *mAddressBook; 160 AddressBook *mAddressBook;
159 KSyncProfile *mSyncProfile; 161 KSyncProfile *mSyncProfile;
160 QString mFileName; 162 QString mFileName;
161 163
162}; 164};
163 165
164 166
165} 167}
166 168
167 169
168 170
169#endif 171#endif