resourcefile.h
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KABC_RESOURCEFILE_H
#define KABC_RESOURCEFILE_H
#include <kconfig.h>
#include <kdirwatch.h>
#include <sys/types.h>
#include <kabc/resource.h>
namespace KABC {
class FormatPlugin;
class ResourceConfigWidget;
class Lock;
class KABC_EXPORT ResourceFile : public Resource
{
Q_OBJECT
public:
ResourceFile( const KConfig *cfg );
ResourceFile( const QString &fileName, const QString &formatName = "vcard" );
~ResourceFile();
virtual void writeConfig( KConfig *cfg );
virtual bool doOpen();
virtual void doClose();
virtual Ticket *requestSaveTicket();
virtual void releaseSaveTicket( Ticket* );
virtual bool load();
virtual bool asyncLoad();
virtual bool save( Ticket *ticket );
virtual bool asyncSave( Ticket *ticket );
void setFileName( const QString & );
QString fileName() const;
void setFormat( const QString &name );
QString format() const;
virtual void removeAddressee( const Addressee& addr );
private slots:
void emitLoadingFinished();
void emitLoadingError();
void emitSavingFinished();
void emitSavingError();
protected slots:
void fileChanged();
protected:
void init( const QString &fileName, const QString &format );
bool lock( const QString &fileName );
void unlock( const QString &fileName );
private:
QString mFileName;
QString mFormatName;
FormatPlugin *mFormat;
Lock *mLock;
KDirWatch mDirWatch;
bool mAsynchronous;
class ResourceFilePrivate;
ResourceFilePrivate *d;
};
}
#endif
KABC::Lock
This class provides locking functionality for a file, directory or an arbitrary string-represented re...
Definition: lock.h:35
KABC::Ticket
Helper class for handling coordinated save of address books.
Definition: resource.h:37
KABC::Addressee
address book entry
Definition: addressee.src.h:74
KConfig
KABC::FormatPlugin
Base class for address book formats.
Definition: formatplugin.h:42
KABC::ResourceFile
This resource allows access to a local file.
Definition: resourcefile.h:40

KDE Home | KDE Accessibility Home | Description of Access Keys