kabc
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:

Signals | |
void | locked () |
void | unlocked () |
Public Member Functions | |
Lock (const QString &identifier) | |
~Lock () | |
virtual QString | error () const |
virtual bool | lock () |
QString | lockFileName () const |
virtual bool | unlock () |
Static Public Member Functions | |
static QString | locksDir () |
static bool | readLockFile (const QString &filename, int &pid, QString &app) |
static bool | writeLockFile (const QString &filename) |
Detailed Description
This class provides locking functionality for a file, directory or an arbitrary string-represented resource.
Constructor & Destructor Documentation
Lock::Lock | ( | const QString & | identifier | ) |
Lock::~Lock | ( | ) |
Member Function Documentation
QString Lock::error | ( | ) | const [virtual] |
Returns the lastest error message.
Reimplemented in KABC::LockNull.
bool Lock::lock | ( | ) | [virtual] |
void KABC::Lock::locked | ( | ) | [signal] |
Emitted after the lock has been locked.
QString Lock::lockFileName | ( | ) | const |
Returns the path of the lock file.
The file will be located in the directory returned by locksDir() and have the file extension .lock
QString Lock::locksDir | ( | ) | [static] |
bool Lock::readLockFile | ( | const QString & | filename, |
int & | pid, | ||
QString & | app | ||
) | [static] |
Reads the process ID and the application name from a lock file.
- Parameters:
-
filename The lock file to read from. Full path or relative to current working directory pid The variable the process ID will be read into app The variable the application name will be read into
- Returns:
false
iffilename
could not be read, otherwisetrue
, even when reading the values fails
bool Lock::unlock | ( | ) | [virtual] |
void KABC::Lock::unlocked | ( | ) | [signal] |
Emitted after the lock has been unlocked.
bool Lock::writeLockFile | ( | const QString & | filename | ) | [static] |
The documentation for this class was generated from the following files: