summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/qtopia/resourceqtopia.h
Unidiff
Diffstat (limited to 'kabc/plugins/qtopia/resourceqtopia.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.h152
1 files changed, 152 insertions, 0 deletions
diff --git a/kabc/plugins/qtopia/resourceqtopia.h b/kabc/plugins/qtopia/resourceqtopia.h
new file mode 100644
index 0000000..ea0b5ee
--- a/dev/null
+++ b/kabc/plugins/qtopia/resourceqtopia.h
@@ -0,0 +1,152 @@
1/*
2 This file is part of libkabc.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@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/*
22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk
24
25$Id$
26*/
27
28
29#ifndef KABC_RESOURCEQTOPIA_H
30#define KABC_RESOURCEQTOPIA_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 QTimer;
41//class FormatPlugin;
42
43namespace KABC {
44
45//US class FormatPlugin;
46class ResourceConfigWidget;
47class OpieConverter;
48/**
49 @internal
50*/
51class ResourceOpie : public Resource
52{
53 Q_OBJECT
54
55public:
56
57 /**
58 Constructor.
59
60 @param cfg The config object where custom resource settings are stored.
61 */
62 ResourceOpie( const KConfig *cfg );
63
64 /**
65 Construct file resource on file @arg fileName using format @arg formatName.
66 */
67 ResourceOpie( const QString &fileName );
68
69 /**
70 * Destructor.
71 */
72 ~ResourceOpie();
73
74 /**
75 Writes the config back.
76 */
77 virtual void writeConfig( KConfig *cfg );
78
79 /**
80 * Tries to open the file and checks for the proper format.
81 * This method should be called before @ref load().
82 */
83 virtual bool doOpen();
84
85 /**
86 * Closes the file again.
87 */
88 virtual void doClose();
89
90 /**
91 * Requests a save ticket, that is used by @ref save()
92 */
93 virtual Ticket *requestSaveTicket();
94
95 /**
96 * Loads all addressees from file to the address book.
97 * Returns true if all addressees could be loaded otherwise false.
98 */
99 virtual bool load();
100
101 /**
102 * Saves all addresses from address book to file.
103 * Returns true if all addressees could be saved otherwise false.
104 *
105 * @param ticket The ticket returned by @ref requestSaveTicket()
106 */
107 virtual bool save( Ticket *ticket );
108
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
119 /**
120 * Remove a addressee from its source.
121 * This method is mainly called by KABC::AddressBook.
122 */
123 virtual void removeAddressee( const Addressee& addr );
124
125 /**
126 * This method is called by an error handler if the application
127 * crashed
128 */
129 virtual void cleanUp();
130
131protected slots:
132 void fileChanged();
133
134protected:
135 void init( const QString &fileName );
136
137 bool lock( const QString &fileName );
138 void unlock( const QString &fileName );
139
140private:
141 OpieConverter* mConverter;
142
143 QString mFileName;
144
145 QString mLockUniqueName;
146
147 KDirWatch mDirWatch;
148};
149
150}
151
152#endif