From aae8af24992bf3b7b59fb425955153b86f31bb5d Mon Sep 17 00:00:00 2001
From: ulf69 <ulf69>
Date: Fri, 09 Jul 2004 08:12:00 +0000
Subject: IntDateFormat is now an enum instead of an ionteger value

---
(limited to 'kabc/plugins')

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
@@ -97,7 +97,7 @@ void ResourceOpie::init( const QString &fileName )
   connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
 */
   //US opie addressbook is always readonly
-  setReadOnly( true );
+//US  setReadOnly( true );
 
   setFileName( fileName );
  
@@ -112,7 +112,7 @@ ResourceOpie::~ResourceOpie()
 void ResourceOpie::writeConfig( KConfig *config )
 {
   //US opie addressbook is always readonly
-  setReadOnly( true );
+//US  setReadOnly( true );
 
   Resource::writeConfig( config );
 
@@ -194,13 +194,23 @@ bool ResourceOpie::load()
   
   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);
diff --git a/kabc/plugins/opie/resourceopieconfig.cpp b/kabc/plugins/opie/resourceopieconfig.cpp
index f4cc4f9..eef9cc9 100644
--- a/kabc/plugins/opie/resourceopieconfig.cpp
+++ b/kabc/plugins/opie/resourceopieconfig.cpp
@@ -62,15 +62,7 @@ ResourceOpieConfig::ResourceOpieConfig( QWidget* parent,  const char* name )
 
   mainLayout->addWidget( label, 0, 0 );
   mainLayout->addWidget( mFileNameEdit, 0, 1 );
-
-//US  mInEditMode = false;
-}
-/*US
-void ResourceOpieConfig::setEditMode( bool value )
-{
-  mInEditMode = value;
 }
-*/
 
 void ResourceOpieConfig::loadSettings( KRES::Resource *res  )
 {
@@ -85,6 +77,9 @@ void ResourceOpieConfig::loadSettings( KRES::Resource *res  )
   mFileNameEdit->setURL( resource->fileName() );
   if ( mFileNameEdit->url().isEmpty() )
     mFileNameEdit->setURL( QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml" );
+    
+  //US Opie resources are ReadOnly by definition
+  emit setPersistentReadOnly( true );
 }
 
 void ResourceOpieConfig::saveSettings( KRES::Resource *res )
diff --git a/kabc/plugins/opie/resourceopieconfig.h b/kabc/plugins/opie/resourceopieconfig.h
index 533b7f4..8cc192c 100644
--- a/kabc/plugins/opie/resourceopieconfig.h
+++ b/kabc/plugins/opie/resourceopieconfig.h
@@ -42,8 +42,6 @@ class ResourceOpieConfig : public KRES::ConfigWidget
 public:
   ResourceOpieConfig( QWidget* parent = 0, const char* name = 0 );
 
-//US  void setEditMode( bool value );
-
 public slots:
   void loadSettings( KRES::Resource *resource );
   void saveSettings( KRES::Resource *resource );
@@ -53,7 +51,6 @@ protected slots:
 
 private:
   KURLRequester* mFileNameEdit;
-//US  bool mInEditMode;
 };
 
 }
--
cgit v0.9.0.2