locknull.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "locknull.h"
00023
00024 #include <klocale.h>
00025 #include <kdebug.h>
00026
00027 using namespace KABC;
00028
00029 LockNull::LockNull( bool allowAccess )
00030 : Lock( QString::null ), mAllowAccess( allowAccess )
00031 {
00032 }
00033
00034 LockNull::~LockNull()
00035 {
00036 unlock();
00037 }
00038
00039 bool LockNull::lock()
00040 {
00041 if ( !mAllowAccess ) return false;
00042
00043 kdWarning() << "LockNull::lock() force success. Doesn't actually lock."
00044 << endl;
00045
00046 emit locked();
00047
00048 return true;
00049 }
00050
00051 bool LockNull::unlock()
00052 {
00053 emit unlocked();
00054 return true;
00055 }
00056
00057 QString LockNull::error() const
00058 {
00059 if ( mAllowAccess )
00060 return i18n("LockNull: All locks succeed but no actual locking is done.");
00061 else
00062 return i18n("LockNull: All locks fail.");
00063 }
|