-rw-r--r-- | kabc/converter/opie/opieE.pro | 2 | ||||
-rw-r--r-- | kabc/plugins/opie/resourceopie.cpp | 7 |
2 files changed, 2 insertions, 7 deletions
diff --git a/kabc/converter/opie/opieE.pro b/kabc/converter/opie/opieE.pro index e026f2a..131c398 100644 --- a/kabc/converter/opie/opieE.pro +++ b/kabc/converter/opie/opieE.pro @@ -1,26 +1,26 @@ TEMPLATE = lib -INCLUDEPATH += . ../.. ../../../microkde ../../../microkde/kdecore $(OPIEDIR)/include $(OPEDIR)/include +INCLUDEPATH += . ../.. ../../../microkde ../../../microkde/kdecore $(OPIEDIR)/include #CONFIG += staticlib OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) #for static linkage, put it here #DESTDIR=../../lib/$(PLATFORM) #for dynamic linkage, put it here DESTDIR=$(QPEDIR)/lib LIBS += -lmicrokde LIBS += -lmicrokabc LIBS += -L$(QPEDIR)/lib LIBS += -L$(OPIEDIR)/lib LIBS += -lopie LIBS += -lqpe LIBS += -lqte TARGET = microkabc_opieconverter # Input HEADERS += \ diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp index a7d271f..3a40ea2 100644 --- a/kabc/plugins/opie/resourceopie.cpp +++ b/kabc/plugins/opie/resourceopie.cpp @@ -12,64 +12,62 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <qdir.h> #include <qfile.h> #include <qfileinfo.h> #include <qregexp.h> -#include <qtimer.h> #include <kapplication.h> #include <kconfig.h> #include <kdebug.h> #include <klocale.h> //US #include <ksavefile.h> #include <kstandarddirs.h> //US #include "formatfactory.h" //US #include <qpe/qpeapplication.h> #include <opie/ocontactaccess.h> #include <opie/ocontactaccessbackend_xml.h> -#include "resource.h" #include "resourceopieconfig.h" #include "stdaddressbook.h" #include "opieconverter.h" #include "resourceopie.h" using namespace KABC; extern "C" { void *init_microkabc_opie() { return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig>(); } } ResourceOpie::ResourceOpie( const KConfig *config ) : Resource( config ), mConverter (0) { QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; KConfig *cfg = (KConfig *)config; if ( cfg ) { fileName = cfg->readEntry( "FileName", fileName ); @@ -90,51 +88,48 @@ ResourceOpie::ResourceOpie( const QString &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 //US setReadOnly( true ); setFileName( fileName ); } ResourceOpie::~ResourceOpie() { if (mConverter != 0) delete mConverter; } void ResourceOpie::writeConfig( KConfig *config ) { - //US opie addressbook is always readonly -//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; if ( !addressBook() ) return 0; if ( !lock( mFileName ) ) { kdDebug(5700) << "ResourceOpie::requestSaveTicket(): Unable to lock file '" << mFileName << "'" << endl; return 0; } return createTicket( this ); } bool ResourceOpie::doOpen() @@ -192,49 +187,49 @@ bool ResourceOpie::load() 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(); for ( it = allList.begin(); it != allList.end(); ++it ) { - OContact c = (*it); + const OContact c = (*it); KABC::Addressee addressee; res = mConverter->opieToAddressee( c, addressee ); if ( !addressee.isEmpty() && res ) { addressee.setResource( this ); addressBook()->insertAddressee( addressee ); } // qDebug("found %s", c.fullName().latin1()); } delete access; // it seems so, that deletion of access deletes backend as well //delete backend; return true; } bool ResourceOpie::save( Ticket *ticket ) { qDebug("ResourceOpie::save() has to be fixed - %s", mFileName.latin1()); |