summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/opie/resourceopie.cpp
Side-by-side diff
Diffstat (limited to 'kabc/plugins/opie/resourceopie.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/opie/resourceopie.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp
index 3b2a6b7..a7d271f 100644
--- a/kabc/plugins/opie/resourceopie.cpp
+++ b/kabc/plugins/opie/resourceopie.cpp
@@ -88,40 +88,40 @@ ResourceOpie::ResourceOpie( const QString &fileName )
init( fileName );
}
void ResourceOpie::init( const QString &fileName )
{
/*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods
connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
*/
//US opie addressbook is always readonly
- setReadOnly( true );
+//US setReadOnly( true );
setFileName( fileName );
}
ResourceOpie::~ResourceOpie()
{
if (mConverter != 0)
delete mConverter;
}
void ResourceOpie::writeConfig( KConfig *config )
{
//US opie addressbook is always readonly
- setReadOnly( true );
+//US setReadOnly( true );
Resource::writeConfig( config );
config->writeEntry( "FileName", mFileName );
// qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1());
}
Ticket *ResourceOpie::requestSaveTicket()
{
kdDebug(5700) << "ResourceOpie::requestSaveTicket()" << endl;
@@ -185,31 +185,41 @@ bool ResourceOpie::load()
OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KDEPim/Pi", mFileName );
OContactAccess* access = new OContactAccess("KDEPim/Pi", 0l, backend, false);
if ( !access ) {
qDebug("Unable to load file() %s", mFileName.latin1());
addressBook()->error( i18n( "Unable to load file '%1'." ).arg( mFileName ) );
return false;
}
access -> setReadAhead( 32 ); // Use ReadAhead-Cache if available
+ bool res = false;
if (mConverter == 0)
+ {
mConverter = new OpieConverter();
+ res = mConverter->init();
+ if ( !res )
+ {
+ qDebug("Unable to initialize opie converter. Most likely a problem with the category file");
+ addressBook()->error( i18n( "Unable to initialize opie converter. Most likely a problem with the category file" ) );
+ delete access;
+ return false;
+ }
+ }
OContactAccess::List::Iterator it;
OContactAccess::List allList = access->allRecords();
- bool res = false;
for ( it = allList.begin(); it != allList.end(); ++it )
{
OContact c = (*it);
KABC::Addressee addressee;
res = mConverter->opieToAddressee( c, addressee );
if ( !addressee.isEmpty() && res )
{
addressee.setResource( this );
addressBook()->insertAddressee( addressee );