summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/dir/resourcedir.cpp
Side-by-side diff
Diffstat (limited to 'kabc/plugins/dir/resourcedir.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/dir/resourcedir.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp
index c61664b..cc4afee 100644
--- a/kabc/plugins/dir/resourcedir.cpp
+++ b/kabc/plugins/dir/resourcedir.cpp
@@ -161,25 +161,25 @@ Ticket *ResourceDir::requestSaveTicket()
bool ResourceDir::doOpen()
{
QDir dir( mPath );
if ( !dir.exists() ) { // no directory available
return dir.mkdir( dir.path() );
} else {
QString testName = dir.entryList( QDir::Files )[0];
if ( testName.isNull() || testName.isEmpty() ) // no file in directory
return true;
QFile file( mPath + "/" + testName );
- if ( file.open( IO_ReadOnly ) )
+ if ( file.open( QIODevice::ReadOnly ) )
return true;
if ( file.size() == 0 )
return true;
bool ok = mFormat->checkFormat( &file );
file.close();
return ok;
}
}
void ResourceDir::doClose()
@@ -187,25 +187,25 @@ void ResourceDir::doClose()
}
bool ResourceDir::load()
{
QDir dir( mPath );
QStringList files = dir.entryList( QDir::Files );
QStringList::Iterator it;
bool ok = true;
for ( it = files.begin(); it != files.end(); ++it ) {
QFile file( mPath + "/" + (*it) );
- if ( !file.open( IO_ReadOnly ) ) {
+ if ( !file.open( QIODevice::ReadOnly ) ) {
addressBook()->error( i18n( "Unable to open file '%1' for reading" ).arg( file.name() ) );
ok = false;
continue;
}
if ( !mFormat->loadAll( addressBook(), this, &file ) )
ok = false;
file.close();
}
return ok;
@@ -214,25 +214,25 @@ bool ResourceDir::load()
bool ResourceDir::save( Ticket *ticket )
{
AddressBook::Iterator it;
bool ok = true;
#ifndef NO_DIRWATCH
mDirWatch.stopScan();
#endif
for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) {
if ( (*it).resource() != this || !(*it).changed() )
continue;
QFile file( mPath + "/" + (*it).uid() );
- if ( !file.open( IO_WriteOnly ) ) {
+ if ( !file.open( QIODevice::WriteOnly ) ) {
addressBook()->error( i18n( "Unable to open file '%1' for writing" ).arg( file.name() ) );
continue;
}
mFormat->save( *it, &file );
// mark as unchanged
(*it).setChanged( false );
file.close();
}
#ifndef NO_DIRWATCH
@@ -258,25 +258,25 @@ bool ResourceDir::lock( const QString &path )
if ( QFile::exists( lockName ) ) return false;
QString lockUniqueName;
lockUniqueName = p + KApplication::randomString( 8 );
url = lockUniqueName;
//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
// Create unique file
QFile file( mLockUniqueName );
- file.open( IO_WriteOnly );
+ file.open( QIODevice::WriteOnly );
file.close();
// Create lock file
int result = 0;
#ifndef _WIN32_
result = ::link( QFile::encodeName( mLockUniqueName ),
QFile::encodeName( lockName ) );
#endif
if ( result == 0 ) {
addressBook()->emitAddressBookLocked();
return true;
}