author | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
commit | b9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff) | |
tree | 2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /kabc/plugins/dir/resourcedir.h | |
download | kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2 |
Initial revision
Diffstat (limited to 'kabc/plugins/dir/resourcedir.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kabc/plugins/dir/resourcedir.h | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/kabc/plugins/dir/resourcedir.h b/kabc/plugins/dir/resourcedir.h new file mode 100644 index 0000000..6e35695 --- a/dev/null +++ b/kabc/plugins/dir/resourcedir.h | |||
@@ -0,0 +1,115 @@ | |||
1 | /* | ||
2 | This file is part of libkabc. | ||
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | ||
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 | #ifndef KABC_RESOURCEDIR_H | ||
29 | #define KABC_RESOURCEDIR_H | ||
30 | |||
31 | #include <kconfig.h> | ||
32 | #include <kdirwatch.h> | ||
33 | |||
34 | #include <sys/types.h> | ||
35 | |||
36 | #include "resource.h" | ||
37 | |||
38 | class QTimer; | ||
39 | |||
40 | namespace KABC { | ||
41 | |||
42 | class FormatPlugin; | ||
43 | |||
44 | /** | ||
45 | @internal | ||
46 | */ | ||
47 | class ResourceDir : public Resource | ||
48 | { | ||
49 | Q_OBJECT | ||
50 | |||
51 | public: | ||
52 | ResourceDir( const KConfig* ); | ||
53 | ~ResourceDir(); | ||
54 | |||
55 | virtual void writeConfig( KConfig* ); | ||
56 | |||
57 | virtual bool doOpen(); | ||
58 | virtual void doClose(); | ||
59 | |||
60 | virtual Ticket *requestSaveTicket(); | ||
61 | |||
62 | virtual bool load(); | ||
63 | virtual bool save( Ticket * ); | ||
64 | |||
65 | /** | ||
66 | * Set path to be used for saving. | ||
67 | */ | ||
68 | void setPath( const QString & ); | ||
69 | |||
70 | /** | ||
71 | * Return path used for loading and saving the address book. | ||
72 | */ | ||
73 | QString path() const; | ||
74 | |||
75 | /** | ||
76 | * Set the format by name. | ||
77 | */ | ||
78 | void setFormat( const QString &format ); | ||
79 | |||
80 | /** | ||
81 | * Returns the format name. | ||
82 | */ | ||
83 | QString format() const; | ||
84 | |||
85 | /** | ||
86 | * Remove a addressee from its source. | ||
87 | * This method is mainly called by KABC::AddressBook. | ||
88 | */ | ||
89 | virtual void removeAddressee( const Addressee& addr ); | ||
90 | |||
91 | /** | ||
92 | * This method is called by an error handler if the application | ||
93 | * crashed | ||
94 | */ | ||
95 | virtual void cleanUp(); | ||
96 | |||
97 | protected slots: | ||
98 | void pathChanged(); | ||
99 | |||
100 | protected: | ||
101 | bool lock( const QString &path ); | ||
102 | void unlock( const QString &path ); | ||
103 | |||
104 | private: | ||
105 | FormatPlugin *mFormat; | ||
106 | |||
107 | KDirWatch mDirWatch; | ||
108 | |||
109 | QString mPath; | ||
110 | QString mFormatName; | ||
111 | QString mLockUniqueName; | ||
112 | }; | ||
113 | |||
114 | } | ||
115 | #endif | ||