summaryrefslogtreecommitdiffabout
path: root/kabc
Side-by-side diff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp2
-rw-r--r--kabc/plugins/file/resourcefile.cpp8
-rw-r--r--kabc/stdaddressbook.cpp2
3 files changed, 6 insertions, 6 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 97bd3ef..0838157 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -242,25 +242,25 @@ void AddressBook::init(const QString &config)
}
AddressBook::~AddressBook()
{
delete d->mConfig; d->mConfig = 0;
delete d->mManager; d->mManager = 0;
//US delete d->mErrorHandler; d->mErrorHandler = 0;
delete d; d = 0;
}
bool AddressBook::load()
{
- kdDebug(5700) << "AddressBook::load()" << endl;
+
clear();
KRES::Manager<Resource>::ActiveIterator it;
bool ok = true;
for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it )
if ( !(*it)->load() ) {
error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) );
ok = false;
}
// mark all addressees as unchanged
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index 80af841..3920f69 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -185,41 +185,41 @@ bool ResourceFile::doOpen()
file.close();
return ok;
}
}
void ResourceFile::doClose()
{
}
bool ResourceFile::load()
{
- kdDebug(5700) << "ResourceFile::load(): '" << mFileName << "'" << endl;
+
QFile file( mFileName );
if ( !file.open( IO_ReadOnly ) ) {
addressBook()->error( i18n( "Unable to open file '%1'." ).arg( mFileName ) );
return false;
}
// qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1());
return mFormat->loadAll( addressBook(), this, &file );
}
bool ResourceFile::save( Ticket *ticket )
{
// qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1());
- kdDebug(5700) << "ResourceFile::save()" << endl;
+
// create backup file
QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() );
/*US we use a simpler method to create a backupfile
(void) KSaveFile::backupFile( mFileName, QString::null
,extension );
KSaveFile saveFile( mFileName );
bool ok = false;
if ( saveFile.status() == 0 && saveFile.file() )
@@ -248,36 +248,36 @@ bool ResourceFile::save( Ticket *ticket )
delete ticket;
unlock( mFileName );
return ok;
qDebug("ResourceFile::save has to be changed");
return true;
}
bool ResourceFile::lock( const QString &fileName )
{
- kdDebug(5700) << "ResourceFile::lock()" << endl;
+
QString fn = fileName;
//US change the implementation how the lockfilename is getting created
//US fn.replace( QRegExp("/"), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
- kdDebug(5700) << "-- lock name: " << lockName << endl;
+
if (QFile::exists( lockName )) return false;
QString lockUniqueName;
lockUniqueName = fn + KApplication::randomString( 8 );
url = lockUniqueName;
//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl;
// Create unique file
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp
index 075f12f..1e00cc6 100644
--- a/kabc/stdaddressbook.cpp
+++ b/kabc/stdaddressbook.cpp
@@ -143,25 +143,25 @@ void StdAddressBook::init( bool )
if ( !(*it)->open() )
error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) );
}
Resource *res = standardResource();
if ( !res ) {
res = manager->createResource( "file" );
if ( res )
{
addResource( res );
}
else
- kdDebug(5700) << "No resource available!!!" << endl;
+ qDebug(" No resource available!!!");
}
setStandardResource( res );
manager->writeConfig();
load();
}
bool StdAddressBook::save()
{
kdDebug(5700) << "StdAddressBook::save()" << endl;