summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/qtopia
Side-by-side diff
Diffstat (limited to 'kabc/plugins/qtopia') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/qtopia/qtopia.pro16
-rw-r--r--kabc/plugins/qtopia/qtopiaE.pro6
-rw-r--r--kabc/plugins/qtopia/qtopiaconverter.cpp24
-rw-r--r--kabc/plugins/qtopia/qtopiaconverter.h9
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.cpp14
-rw-r--r--kabc/plugins/qtopia/resourceqtopiaconfig.cpp4
6 files changed, 42 insertions, 31 deletions
diff --git a/kabc/plugins/qtopia/qtopia.pro b/kabc/plugins/qtopia/qtopia.pro
index 64d1abc..d91a2e3 100644
--- a/kabc/plugins/qtopia/qtopia.pro
+++ b/kabc/plugins/qtopia/qtopia.pro
@@ -1,43 +1,47 @@
TEMPLATE = lib
CONFIG += qt warn_on release
include( ../../../variables.pri )
-TARGET = microkabc_qtopia
+TARGET = xmicrokabc_qtopia
INCLUDEPATH += ../.. ../../.. ../../../kabc ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources
DESTDIR = ../../../bin
-#LIBS += -lmicrokde
-#LIBS += -lkamicrokabc
+#LIBS += -lxmicrokde
+#LIBS += -lxkamicrokabc
DEFINES += KAB_EMBEDDED DESKTOP_VERSION
INTERFACES = \
HEADERS = \
resourceqtopia.h \
resourceqtopiaconfig.h \
qtopiaconverter.h
SOURCES = \
resourceqtopia.cpp \
resourceqtopiaconfig.cpp \
qtopiaconverter.cpp
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
CONFIG += dll
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
-LIBS += ../../../bin/microkdepim.lib
-LIBS += ../../../bin/microkcal.lib
-LIBS += ../../../bin/microkde.lib
+LIBS += ../../../bin/xmicrokdepim.lib
+LIBS += ../../../bin/xmicrokcal.lib
+LIBS += ../../../bin/xmicrokde.lib
LIBS += ../../../bin/microkabc.lib
}
+#The following line was inserted by qt3to4
+QT += xml qt3support
+#The following line was inserted by qt3to4
+QT +=
diff --git a/kabc/plugins/qtopia/qtopiaE.pro b/kabc/plugins/qtopia/qtopiaE.pro
index 700057b..4b174b2 100644
--- a/kabc/plugins/qtopia/qtopiaE.pro
+++ b/kabc/plugins/qtopia/qtopiaE.pro
@@ -1,26 +1,26 @@
TEMPLATE = lib
CONFIG += qt warn_on
-TARGET = microkabc_qtopia
+TARGET = xmicrokabc_qtopia
INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR = $(QPEDIR)/lib
-LIBS += -lmicrokde
-LIBS += -lmicrokabc
+LIBS += -lxmicrokde
+LIBS += -lxmicrokabc
LIBS += -L$(QPEDIR)/lib
LIBS += -lqpe
INTERFACES = \
HEADERS = \
resourceqtopia.h \
resourceqtopiaconfig.h \
qtopiaconverter.h
SOURCES = \
resourceqtopia.cpp \
resourceqtopiaconfig.cpp \
qtopiaconverter.cpp
diff --git a/kabc/plugins/qtopia/qtopiaconverter.cpp b/kabc/plugins/qtopia/qtopiaconverter.cpp
index 9693a68..9b3903b 100644
--- a/kabc/plugins/qtopia/qtopiaconverter.cpp
+++ b/kabc/plugins/qtopia/qtopiaconverter.cpp
@@ -13,87 +13,89 @@
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$
*/
//US
#include "kglobal.h"
#include "klocale.h"
#include "qtopiaconverter.h"
#include <qfile.h>
#include <qdir.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
+//Added by qt3to4:
+#include <Q3ValueList>
//#include <.h>
#include <libkdepim/ksyncprofile.h>
using namespace KABC;
QtopiaConverter::QtopiaConverter()
{
m_edit = 0;
}
QtopiaConverter::~QtopiaConverter()
{
deinit();
}
bool QtopiaConverter::init()
{
QString fn = QDir::homeDirPath() +"/Settings/Categories.xml";
m_edit = new CategoryEdit( fn);
return true;
}
void QtopiaConverter::deinit()
{
if (m_edit)
{
delete m_edit;
m_edit = 0;
}
}
QString QtopiaConverter::categoriesToNumber( const QStringList &list, const QString &app )
{
startover:
QStringList dummy;
- QValueList<OpieCategories>::ConstIterator catIt;
- QValueList<OpieCategories> categories = m_edit->categories();
+ Q3ValueList<OpieCategories>::ConstIterator catIt;
+ Q3ValueList<OpieCategories> categories = m_edit->categories();
bool found = false;
for ( QStringList::ConstIterator listIt = list.begin(); listIt != list.end(); ++listIt ) {
/* skip empty category name */
if ( (*listIt).isEmpty() ) continue;
found = false;
for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
/*
* We currently do not take app into account
* if name matches and the id isn't already in dummy we'll add it
*/
if ( (*catIt).name() == (*listIt) && !dummy.contains(( *catIt).id() ) ) { // the same name
found= true;
dummy << (*catIt).id();
}
}
/* if not found and the category is not empty
*
* generate a new category and start over again
* ugly goto to reiterate
*/
if ( !found && !(*listIt).isEmpty() ){
m_edit->addCategory( app, (*listIt) ); // generate a new category
@@ -171,49 +173,49 @@ QString QtopiaConverter::dateToString( const QDate &d )
QString year = QString::number( d.year() );
QString month = QString::number( d.month() );
month = month.rightJustify( 2, '0' );
QString day = QString::number( d.day() );
day = day.rightJustify( 2, '0' );
QString str = year + month + day;
return str;
}
bool QtopiaConverter::qtopiaToAddressee( const QDomElement& el, Addressee &adr )
{
{ //LR
adr.setUid( el.attribute("Uid" ) );
adr.setFamilyName( el.attribute( "LastName" ) );
adr.setGivenName( el.attribute( "FirstName" ) );
adr.setAdditionalName( el.attribute( "MiddleName" ) );
adr.setSuffix( el.attribute( "Suffix" ) );
adr.setNickName( el.attribute( "Nickname" ) );
QDate date = dateFromString( el.attribute( "Birthday" ) );
if ( date.isValid() )
- adr.setBirthday( date );
+ adr.setBirthday( (QDateTime)date );
adr.setRole( el.attribute( "JobTitle" ) );
if ( !el.attribute( "FileAs" ).isEmpty() )
adr.setFormattedName( el.attribute( "FileAs" ) );
adr.setOrganization( el.attribute( "Company" ) );
KABC::PhoneNumber businessPhoneNum( el.attribute( "BusinessPhone" ),
KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref );
KABC::PhoneNumber businessFaxNum( el.attribute( "BusinessFax" ),
KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax );
KABC::PhoneNumber businessMobile( el.attribute( "BusinessMobile" ),
KABC::PhoneNumber::Car );
KABC::PhoneNumber businessPager( el.attribute( "BusinessPager" ),
KABC::PhoneNumber::Pager );
if ( !businessPhoneNum.number().isEmpty() )
adr.insertPhoneNumber( businessPhoneNum );
if ( !businessFaxNum.number().isEmpty() )
adr.insertPhoneNumber( businessFaxNum );
if ( !businessMobile.number().isEmpty() )
adr.insertPhoneNumber( businessMobile );
if ( !businessPager.number().isEmpty() )
adr.insertPhoneNumber( businessPager );
@@ -296,49 +298,49 @@ bool QtopiaConverter::qtopiaToAddressee( const QDomElement& el, Addressee &adr )
adr.insertCustom( "KADDRESSBOOK", "X-Gender", "female" );
}
QDate ann = dateFromString( el.attribute( "Anniversary" ) );
if ( ann.isValid() ) {
QString dt = KGlobal::locale()->formatDate(ann, true, KLocale::ISODate);
adr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt );
}
if ( !el.attribute( "Children" ).isEmpty() )
adr.insertCustom("KADDRESSBOOK", "X-Children", el.attribute("Children") );
if ( !el.attribute( "Office" ).isEmpty() )
adr.insertCustom("KADDRESSBOOK", "X-Office", el.attribute("Office") );
if ( !el.attribute( "Profession" ).isEmpty() )
adr.insertCustom("KADDRESSBOOK", "X-Profession", el.attribute("Profession") );
if ( !el.attribute( "Assistant" ).isEmpty() )
adr.insertCustom("KADDRESSBOOK", "X-AssistantsName", el.attribute("Assistant") );
if ( !el.attribute( "Manager" ).isEmpty() )
adr.insertCustom("KADDRESSBOOK", "X-ManagersName", el.attribute("Manager") );
}
return true;
}
-bool QtopiaConverter::addresseeToQtopia( const Addressee &ab, QTextStream *stream )
+bool QtopiaConverter::addresseeToQtopia( const Addressee &ab, Q3TextStream *stream )
{
*stream << "<Contact ";
*stream << "FirstName=\"" << escape(ab.givenName()) << "\" ";
*stream << "MiddleName=\"" << escape(ab.additionalName()) << "\" ";
*stream << "LastName=\"" << escape(ab.familyName()) << "\" ";
*stream << "Suffix=\"" << escape(ab.suffix()) << "\" ";
QString sortStr;
sortStr = ab.formattedName();
/* is formattedName is empty we use the assembled name as fallback */
if (sortStr.isEmpty() )
sortStr = ab.assembledName();
*stream << "FileAs=\"" << escape(sortStr) << "\" ";
*stream << "JobTitle=\"" << escape(ab.role()) << "\" ";
*stream << "Department=\"" << escape(ab.custom( "KADDRESSBOOK", "X-Department" )) << "\" ";
*stream << "Company=\"" << escape(ab.organization()) << "\" ";
KABC::PhoneNumber businessPhoneNum = ab.phoneNumber(KABC::PhoneNumber::Work );
*stream << "BusinessPhone=\"" << escape( businessPhoneNum.number() ) << "\" ";
KABC::PhoneNumber businessFaxNum = ab.phoneNumber(KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax );
*stream << "BusinessFax=\"" << escape( businessFaxNum.number() )<< "\" ";
@@ -463,102 +465,102 @@ QStringList AddressBook::attributes()const {
lst << "Children";
lst << "Notes";
lst << "Categories";
lst << "Uid";
lst << "Birthday";
return lst;
}
#endif
CategoryEdit::CategoryEdit(){
}
CategoryEdit::CategoryEdit(const QString &fileName){
parse( fileName );
}
CategoryEdit::~CategoryEdit(){
}
void CategoryEdit::save(const QString& fileName)const{
QFile file( fileName );
QString endl = "\n";
- if ( file.open( IO_WriteOnly ) ) {
- QTextStream stream( &file );
- stream.setEncoding( QTextStream::UnicodeUTF8 );
+ if ( file.open( QIODevice::WriteOnly ) ) {
+ Q3TextStream stream( &file );
+ stream.setEncoding( Q3TextStream::UnicodeUTF8 );
stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
stream << "<!DOCTYPE CategoryList>" << endl;
stream << "<Categories>" << endl;
- for ( QValueList<OpieCategories>::ConstIterator it = m_categories.begin();
+ for ( Q3ValueList<OpieCategories>::ConstIterator it = m_categories.begin();
it != m_categories.end(); ++it )
{
stream << "<Category id=\""<< ( (*it).id() ) << "\" ";
if ( !(*it).app().isEmpty() )
stream << " app=\""<< ( (*it).app() ) << "\" ";
stream << "name=\"" << ( (*it).name() ) << "\" ";
stream << " />" << endl;
}
stream << "</Categories>" << endl;
file.close();
}
}
int CategoryEdit::addCategory( const QString &name, int id ){
return addCategory( QString::null, name, id );
}
int CategoryEdit::addCategory( const QString &appName, const QString &name, int id ){
if ( id == 0 ) {
// code from tt
//generate uid
QDateTime dt = QDateTime::currentDateTime();
id = -1 * (int) dt.secsTo( QDateTime(QDate( 2000,1,1)) );
while ( ids.contains( id ) ){
id += -1;
if ( id > 0 )
id = -1;
}
}
ids.insert( id, TRUE );
OpieCategories categories(QString::number(id), name, appName);
//pending FIXME LR m_categories.remove( categories);
m_categories.append( categories);
return id;
}
/*
* we parse the simple Category File here
* We also keep track of global Cats
* and Of Organizer and Contact cats and then
* we will add them to the kde side...
*/
void CategoryEdit::parse( const QString &tempFile ){
clear();
QDomDocument doc( "mydocument" );
QFile f( tempFile );
- if ( !f.open( IO_ReadOnly ) )
+ if ( !f.open( QIODevice::ReadOnly ) )
return;
if ( !doc.setContent( &f ) ) {
f.close();
return;
}
f.close();
QStringList global, contact, organizer;
// print out the element names of all elements that are a direct child
// of the outermost element.
QDomElement docElem = doc.documentElement();
QDomNode n = docElem.firstChild();
if( docElem.nodeName() == QString::fromLatin1("Categories") ){
while( !n.isNull() ) {
QDomElement e = n.toElement(); // try to convert the node to an element.
if( !e.isNull() ) { // the node was really an element.
QString id = e.attribute("id" );
QString app = e.attribute("app" );
QString name = e.attribute("name");
/*
* see where it belongs default to global
@@ -566,49 +568,49 @@ void CategoryEdit::parse( const QString &tempFile ){
if (app == QString::fromLatin1("Calendar") || app == QString::fromLatin1("Todo List") )
organizer.append( name );
else if ( app == QString::fromLatin1("Contacts") )
contact.append( name );
else
global.append( name );
OpieCategories category( id, name, app );
m_categories.append( category ); // cheater
}
n = n.nextSibling();
}
}
updateKDE( "kaddressbookrc", global + contact );
updateKDE( "korganizerrc", global + organizer );
}
void CategoryEdit::clear()
{
ids.clear();
m_categories.clear();
}
QString CategoryEdit::categoryById( const QString &id, const QString &app )const
{
- QValueList<OpieCategories>::ConstIterator it;
+ Q3ValueList<OpieCategories>::ConstIterator it;
QString category;
QString fallback;
for( it = m_categories.begin(); it != m_categories.end(); ++it ){
if( id.stripWhiteSpace() == (*it).id().stripWhiteSpace() ){
if( app == (*it).app() ){
category = (*it).name();
break;
}else{
fallback = (*it).name();
}
}
}
return category.isEmpty() ? fallback : category;
}
QStringList CategoryEdit::categoriesByIds( const QStringList& ids,
const QString& app) {
QStringList list;
QStringList::ConstIterator it;
QString temp;
for ( it = ids.begin(); it != ids.end(); ++it ) {
temp = categoryById( (*it), app );
if (!temp.isEmpty() )
list << temp;
diff --git a/kabc/plugins/qtopia/qtopiaconverter.h b/kabc/plugins/qtopia/qtopiaconverter.h
index 744dd41..389926c 100644
--- a/kabc/plugins/qtopia/qtopiaconverter.h
+++ b/kabc/plugins/qtopia/qtopiaconverter.h
@@ -7,127 +7,130 @@
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
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$
*/
#ifndef KABC_QTOPIACONVERTER_H
#define KABC_QTOPIACONVERTER_H
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3TextStream>
#include "addressee.h"
#ifdef DESKTOP_VERSION
#include <qdom.h>
#else
#include <xml/qdom.h>
#endif
class Categories;
namespace KABC {
class OpieCategories {
public:
//friend class KSync::OpieSocket;
friend bool operator== ( const OpieCategories &a, const OpieCategories &b );
OpieCategories();
OpieCategories(const QString &id, const QString &name, const QString &app );
OpieCategories(const OpieCategories & );
~OpieCategories() {};
OpieCategories &operator=(const OpieCategories & );
QString id()const;
QString name()const;
QString app()const;
private:
QString m_name;
QString m_app;
QString m_id;
};
class CategoryEdit {
public:
CategoryEdit();
CategoryEdit(const QString &fileName);
~CategoryEdit();
void save(const QString&) const;
int addCategory( const QString &name, int id = 0 );
int addCategory(const QString &appName, const QString &name, int id = 0);
void parse( const QString &fileName );
QString categoryById(const QString &id, const QString &app )const;
QStringList categoriesByIds( const QStringList& ids, const QString& app );
void clear();
- QValueList<OpieCategories> categories()const { return m_categories; };
+ Q3ValueList<OpieCategories> categories()const { return m_categories; };
private:
/**
* this function will be used internally to update the kde categories...
*/
void updateKDE( const QString& app, const QStringList& categories );
QMap<int, bool> ids; // from tt Qtopia::UidGen
- QValueList<OpieCategories> m_categories;
+ Q3ValueList<OpieCategories> m_categories;
};
class QtopiaConverter
{
public:
/**
* Constructor.
*/
QtopiaConverter();
/**
* Destructor.
*/
virtual ~QtopiaConverter();
bool init();
void deinit();
/**
* Converts a vcard string to an addressee.
*
* @param contact The qtopia contact.
* @param addr The addressee.
*/
bool qtopiaToAddressee( const QDomElement& el, Addressee &adr );
/**
* Converts an addressee to a vcard string.
*
* @param addr The addressee.
* @param contact The qtopia contact.
*/
- bool addresseeToQtopia( const Addressee &ab, QTextStream *stream );
+ bool addresseeToQtopia( const Addressee &ab, Q3TextStream *stream );
private:
QString categoriesToNumber( const QStringList &list, const QString &app );
QString escape( const QString& s){ return s;};
CategoryEdit *m_edit;
QDate fromString( const QString& );
QDate dateFromString( const QString& );
QString dateToString( const QDate& );
};
}
#endif
diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp
index 79ddaea..a36eb8f 100644
--- a/kabc/plugins/qtopia/resourceqtopia.cpp
+++ b/kabc/plugins/qtopia/resourceqtopia.cpp
@@ -10,49 +10,49 @@
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
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>
#ifndef _WIN32_
#include <unistd.h>
#endif
#include <qdir.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qfileinfo.h>
#include <qregexp.h>
//US #include <qtimer.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
//US #include <ksavefile.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include "resourceqtopiaconfig.h"
#include "stdaddressbook.h"
#include "qtopiaconverter.h"
#include "resourceqtopia.h"
using namespace KABC;
extern "C"
#ifdef _WIN32_
@@ -135,101 +135,101 @@ bool ResourceQtopia::doOpen()
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 ) ) {
+ if ( !file.open(QIODevice::ReadOnly ) ) {
return false;
}
QDomDocument doc("mydocument" );
if ( !doc.setContent( &file ) ) {
file.close();
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 ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream ts( &file );
- QTextStream *stream = &ts;
- stream->setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream ts( &file );
+ Q3TextStream *stream = &ts;
+ stream->setEncoding( Q3TextStream::UnicodeUTF8 );
*stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE Addressbook ><AddressBook>" << endl;
*stream << " <Groups>" << endl;
*stream << " </Groups>" << endl;
*stream << " <Contacts> " << endl;
// for all entries
KABC::Addressee ab;
for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) {
KABC::Addressee addressee = (*it);
res = mConverter->addresseeToQtopia( addressee, stream );
if (!res == true)
{
qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1());
}
}
*stream << "</Contacts>" << endl;
*stream << "</AddressBook>" << endl;
file.close();
#ifdef _USE_DIRWATCH_
mDirWatch.startScan();
#endif
delete ticket;
unlock( fileName() );
return true;
}
@@ -239,49 +239,49 @@ bool ResourceQtopia::lock( const QString &lockfileName )
//disabled
return true;
qDebug("ResourceQtopia::lock: %s", fileName().latin1());
QString fn = lockfileName;
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
if (QFile::exists( lockName ))
{
qDebug("ResourceOpie::lock: lockfile %s already exists. (Delete it before continuing if nobody else is accessing the resourcefile %s)", lockName.latin1(), fileName().latin1());
return false;
}
QString lockUniqueName;
lockUniqueName = fn + KApplication::randomString( 8 );
url = lockUniqueName;
//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl;
// 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;
}
// TODO: check stat
return false;
}
void ResourceQtopia::unlock( const QString &fileName )
{
//disabled
return;
qDebug("ResourceQtopia::unlock() %s", fileName.latin1());
diff --git a/kabc/plugins/qtopia/resourceqtopiaconfig.cpp b/kabc/plugins/qtopia/resourceqtopiaconfig.cpp
index d5d6141..42fd428 100644
--- a/kabc/plugins/qtopia/resourceqtopiaconfig.cpp
+++ b/kabc/plugins/qtopia/resourceqtopiaconfig.cpp
@@ -6,68 +6,70 @@
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
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 <qlabel.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
#include <kdebug.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kdialog.h>
//#include <unistd.h>
#include <qdir.h>
#include <qfile.h>
#include "resourceqtopia.h"
#include "resourceqtopiaconfig.h"
using namespace KABC;
ResourceQtopiaConfig::ResourceQtopiaConfig( QWidget* parent, const char* name )
: ConfigWidget( parent, name )
{
- QGridLayout *mainLayout = new QGridLayout( this, 1, 2, 0,
+ Q3GridLayout *mainLayout = new Q3GridLayout( this, 1, 2, 0,
KDialog::spacingHint() );
QLabel *label = new QLabel( i18n( "Location:" ), this );
mFileNameEdit = new KURLRequester( this );
connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ),
SLOT( checkFilePermissions( const QString & ) ) );
mainLayout->addWidget( label, 0, 0 );
mainLayout->addWidget( mFileNameEdit, 0, 1 );
}
void ResourceQtopiaConfig::loadSettings( KRES::Resource *res )
{
//US ResourceFile *resource = dynamic_cast<ResourceFile*>( res );
ResourceQtopia *resource = (ResourceQtopia*)( res );
if ( !resource ) {
kdDebug(5700) << "ResourceQtopiaConfig::loadSettings(): cast failed" << endl;
return;
}
mFileNameEdit->setURL( resource->fileName() );