author | zautrix <zautrix> | 2005-10-27 08:51:03 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-27 08:51:03 (UTC) |
commit | ff68b29b914fc3fbc3aa777d3e3ceeb8a64ecc09 (patch) (unidiff) | |
tree | 0ed1f4c783ade8284a016cec611a61c586895261 /kabc/plugins/olaccess/resourceolaccess.h | |
parent | 15b9123c6c1f9096a4b1a7729c323433d408c8d7 (diff) | |
download | kdepimpi-ff68b29b914fc3fbc3aa777d3e3ceeb8a64ecc09.zip kdepimpi-ff68b29b914fc3fbc3aa777d3e3ceeb8a64ecc09.tar.gz kdepimpi-ff68b29b914fc3fbc3aa777d3e3ceeb8a64ecc09.tar.bz2 |
files added
Diffstat (limited to 'kabc/plugins/olaccess/resourceolaccess.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kabc/plugins/olaccess/resourceolaccess.h | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/kabc/plugins/olaccess/resourceolaccess.h b/kabc/plugins/olaccess/resourceolaccess.h new file mode 100644 index 0000000..64d06f9 --- a/dev/null +++ b/kabc/plugins/olaccess/resourceolaccess.h | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | This file is part of libkabc. | ||
3 | Copyright (c) 2004 Ulf Schenk | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Library General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Library General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Library General Public License | ||
16 | along with this library; see the file COPYING.LIB. If not, write to | ||
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | Enhanced Version of the file for platform independent KDE tools. | ||
23 | Copyright (c) 2004 Ulf Schenk | ||
24 | |||
25 | $Id$ | ||
26 | */ | ||
27 | |||
28 | |||
29 | #ifndef KABC_RESOURCESHARPDTM_H | ||
30 | #define KABC_RESOURCESHARPDTM_H | ||
31 | |||
32 | #include <kconfig.h> | ||
33 | #include <kdirwatch.h> | ||
34 | |||
35 | #include <sys/types.h> | ||
36 | |||
37 | #include "resource.h" | ||
38 | |||
39 | |||
40 | class SlZDataBase; | ||
41 | |||
42 | namespace KABC { | ||
43 | |||
44 | class ResourceConfigWidget; | ||
45 | class SharpDTMConverter; | ||
46 | |||
47 | /** | ||
48 | @internal | ||
49 | */ | ||
50 | class ResourceSharpDTM : public Resource | ||
51 | { | ||
52 | Q_OBJECT | ||
53 | |||
54 | public: | ||
55 | |||
56 | /** | ||
57 | Constructor. | ||
58 | |||
59 | @param cfg The config object where custom resource settings are stored. | ||
60 | */ | ||
61 | ResourceSharpDTM( const KConfig *cfg ); | ||
62 | |||
63 | /** | ||
64 | Construct file resource on file @arg fileName using format @arg formatName. | ||
65 | */ | ||
66 | ResourceSharpDTM( const QString &fileName ); | ||
67 | |||
68 | /** | ||
69 | * Destructor. | ||
70 | */ | ||
71 | ~ResourceSharpDTM(); | ||
72 | |||
73 | /** | ||
74 | Writes the config back. | ||
75 | */ | ||
76 | virtual void writeConfig( KConfig *cfg ); | ||
77 | |||
78 | /** | ||
79 | * Tries to open the file and checks for the proper format. | ||
80 | * This method should be called before @ref load(). | ||
81 | */ | ||
82 | virtual bool doOpen(); | ||
83 | |||
84 | /** | ||
85 | * Closes the file again. | ||
86 | */ | ||
87 | virtual void doClose(); | ||
88 | |||
89 | /** | ||
90 | * Requests a save ticket, that is used by @ref save() | ||
91 | */ | ||
92 | virtual Ticket *requestSaveTicket(); | ||
93 | |||
94 | /** | ||
95 | * Loads all addressees from file to the address book. | ||
96 | * Returns true if all addressees could be loaded otherwise false. | ||
97 | */ | ||
98 | virtual bool load(); | ||
99 | |||
100 | /** | ||
101 | * Saves all addresses from address book to file. | ||
102 | * Returns true if all addressees could be saved otherwise false. | ||
103 | * | ||
104 | * @param ticket The ticket returned by @ref requestSaveTicket() | ||
105 | */ | ||
106 | virtual bool save( Ticket *ticket ); | ||
107 | |||
108 | /** | ||
109 | * Remove a addressee from its source. | ||
110 | * This method is mainly called by KABC::AddressBook. | ||
111 | */ | ||
112 | virtual void removeAddressee( const Addressee& addr ); | ||
113 | |||
114 | /** | ||
115 | * Set name of file to be used for saving. | ||
116 | */ | ||
117 | virtual void setFileName( const QString & ); | ||
118 | |||
119 | /** | ||
120 | * This method is called by an error handler if the application | ||
121 | * crashed | ||
122 | */ | ||
123 | virtual void cleanUp(); | ||
124 | |||
125 | |||
126 | protected slots: | ||
127 | void fileChanged(); | ||
128 | |||
129 | protected: | ||
130 | void init( const QString &fileName ); | ||
131 | |||
132 | bool lock( const QString &fileName ); | ||
133 | void unlock( const QString &fileName ); | ||
134 | |||
135 | private: | ||
136 | SlZDataBase* mAccess; | ||
137 | SharpDTMConverter* mConverter; | ||
138 | |||
139 | QString mLockUniqueName; | ||
140 | |||
141 | KDirWatch mDirWatch; | ||
142 | }; | ||
143 | |||
144 | } | ||
145 | |||
146 | #endif | ||