kabc Library API Documentation

KABC::Lock Class Reference

This class provides locking functionality for a file, directory or an arbitrary string-represented resource. More...

#include <lock.h>

Inheritance diagram for KABC::Lock:

QObject KABC::LockNull List of all members.

Signals

void locked ()
void unlocked ()

Public Member Functions

 Lock (const QString &identifier)
 ~Lock ()
virtual bool lock ()
virtual bool unlock ()
virtual QString error () const
QString lockFileName () const

Static Public Member Functions

static bool readLockFile (const QString &filename, int &pid, QString &app)
static bool writeLockFile (const QString &filename)
static QString locksDir ()

Detailed Description

This class provides locking functionality for a file, directory or an arbitrary string-represented resource.

Definition at line 35 of file lock.h.


Constructor & Destructor Documentation

Lock::Lock const QString identifier  ) 
 

Constructor.

Parameters:
identifier An identifier for the resource to be locked, e.g. a file name.

Definition at line 38 of file lock.cpp.

References QString::replace().

Lock::~Lock  ) 
 

Destruct lock object.

This also removes the lock on the resource.

Definition at line 44 of file lock.cpp.

References unlock().


Member Function Documentation

bool Lock::lock  )  [virtual]
 

Lock resource.

Reimplemented in KABC::LockNull.

Definition at line 80 of file lock.cpp.

References QString::arg(), QFile::encodeName(), endl(), QFile::exists(), kdDebug(), kdWarning(), locateLocal(), lockFileName(), readLockFile(), QFile::remove(), QString::replace(), and writeLockFile().

Referenced by LockWidget::lock(), and KABC::ResourceDir::requestSaveTicket().

bool Lock::unlock  )  [virtual]
 

Unlock resource.

Reimplemented in KABC::LockNull.

Definition at line 135 of file lock.cpp.

References QString::arg(), endl(), kdDebug(), lockFileName(), QString::number(), readLockFile(), and QFile::remove().

Referenced by LockWidget::unlock(), and ~Lock().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kabc Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Feb 8 08:04:02 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003