-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/xxport/qtopia_xxport.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp index cf6b11a..79ddaea 100644 --- a/kabc/plugins/qtopia/resourceqtopia.cpp +++ b/kabc/plugins/qtopia/resourceqtopia.cpp @@ -118,97 +118,97 @@ Ticket *ResourceQtopia::requestSaveTicket() return 0; } return createTicket( this ); } bool ResourceQtopia::doOpen() { qDebug("ResourceQtopia::doOpen(): %s", fileName().latin1()); if (mConverter == 0) { mConverter = new QtopiaConverter(); bool res = mConverter->init(); if ( !res ) { QString msg("Unable to initialize qtopia converter. Most likely a problem with the category file"); qDebug(msg); return false; } } return true; } void ResourceQtopia::doClose() { qDebug("ResourceQtopia::doClose: %s", fileName().latin1()); // it seems so, that deletion of access deletes backend as well //delete backend; return; } bool ResourceQtopia::load() { QFile file( fileName() ); if ( !file.open(IO_ReadOnly ) ) { return false; } QDomDocument doc("mydocument" ); if ( !doc.setContent( &file ) ) { file.close(); - return true; + return false; } bool res; QDomElement docElem = doc.documentElement( ); QDomNode n = docElem.firstChild(); while ( !n.isNull() ) { QDomElement e = n.toElement(); if ( !e.isNull() ) { if ( e.tagName() == QString::fromLatin1( "Contacts" ) ) { QDomNode no = e.firstChild(); while ( !no.isNull() ) { QDomElement el = no.toElement(); if ( !el.isNull() ) { KABC::Addressee addressee; res = mConverter->qtopiaToAddressee( el, addressee ); if ( !addressee.isEmpty() && res ) { addressee.setResource( this ); addressBook()->insertAddressee( addressee ); } } no = no.nextSibling(); } } } n = n.nextSibling(); } return true; } bool ResourceQtopia::save( Ticket *ticket ) { #ifdef _USE_DIRWATCH_ mDirWatch.stopScan(); #endif KABC::AddressBook::Iterator it; bool res; QFile file( fileName() ); if (!file.open( IO_WriteOnly ) ) { return false; } QTextStream ts( &file ); QTextStream *stream = &ts; stream->setEncoding( QTextStream::UnicodeUTF8 ); *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE Addressbook ><AddressBook>" << endl; *stream << " <Groups>" << endl; *stream << " </Groups>" << endl; diff --git a/kaddressbook/xxport/qtopia_xxport.cpp b/kaddressbook/xxport/qtopia_xxport.cpp index fc4abbb..e3457a1 100644 --- a/kaddressbook/xxport/qtopia_xxport.cpp +++ b/kaddressbook/xxport/qtopia_xxport.cpp @@ -28,59 +28,59 @@ Copyright (c) 2004 Ulf Schenk $Id$ */ #include <qdir.h> #include "addressee.h" #include "xxportmanager.h" #include "qtopia_xxport.h" #include <kfiledialog.h> /*US class QtopiaXXPortFactory : public XXPortFactory { public: XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent, const char *name ) { return new QtopiaXXPort( ab, parent, name ); } }; */ extern "C" { void *init_microkaddrbk_qtopia_xxport() { return ( new QtopiaXXPortFactory() ); } } QtopiaXXPort::QtopiaXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name ) : XXPortResourceObject( ab, parent, name ) { defaultFileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; if ( mFactory && !mFactory->typeName( "qtopia" ).isEmpty() ) { createImportAction( i18n( "Import xml (Qtopia)..." ) ); createExportAction( i18n( "Export xml (Qtopia)..." ) ); } } bool QtopiaXXPort::exportContacts( const KABC::AddresseeList &list, const QString &identifier ) { QString fn =KFileDialog::getSaveFileName( defaultFileName, i18n("Import xml file"), 0 ); if ( fn == "" ) return false; - + return _exportContacts( list, identifier, fn ); } KABC::AddresseeList QtopiaXXPort::importContacts( const QString &identifier ) const { QString fn =KFileDialog::getOpenFileName( defaultFileName, i18n("Import xml file"), 0 ); if ( fn == "" ) return KABC::AddresseeList() ; return _importContacts( identifier, fn ); } |