summaryrefslogtreecommitdiffabout
path: root/kabc
Side-by-side diff
Diffstat (limited to 'kabc') (more/less context) (show whitespace changes)
-rw-r--r--kabc/address.h6
-rw-r--r--kabc/addressbook.cpp30
-rw-r--r--kabc/addressbook.h4
-rw-r--r--kabc/addressee.cpp2
-rw-r--r--kabc/addressee.h4
-rw-r--r--kabc/addresseedialog.cpp51
-rw-r--r--kabc/addresseedialog.h18
-rw-r--r--kabc/addresseelist.cpp12
-rw-r--r--kabc/addresseelist.h6
-rw-r--r--kabc/addresseeview.cpp47
-rw-r--r--kabc/addresseeview.h4
-rw-r--r--kabc/distributionlist.cpp6
-rw-r--r--kabc/distributionlist.h7
-rw-r--r--kabc/distributionlistdialog.cpp36
-rw-r--r--kabc/distributionlistdialog.h12
-rw-r--r--kabc/distributionlisteditor.cpp30
-rw-r--r--kabc/distributionlisteditor.h10
-rw-r--r--kabc/field.cpp10
-rw-r--r--kabc/field.h4
-rw-r--r--kabc/formatfactory.cpp2
-rw-r--r--kabc/formatfactory.h4
-rw-r--r--kabc/formats/binary/kabcformat_binaryE.pro2
-rw-r--r--kabc/formats/vcardformatplugin2.cpp20
-rw-r--r--kabc/kabc.pro8
-rw-r--r--kabc/kabcE.pro8
-rw-r--r--kabc/key.h6
-rw-r--r--kabc/phonenumber.h6
-rw-r--r--kabc/picture.cpp2
-rw-r--r--kabc/picture.h2
-rw-r--r--kabc/plugins/dir/dir.pro14
-rw-r--r--kabc/plugins/dir/dirE.pro4
-rw-r--r--kabc/plugins/dir/resourcedir.cpp8
-rw-r--r--kabc/plugins/dir/resourcedirconfig.cpp4
-rw-r--r--kabc/plugins/file/file.pro14
-rw-r--r--kabc/plugins/file/fileE.pro4
-rw-r--r--kabc/plugins/file/resourcefile.cpp10
-rw-r--r--kabc/plugins/file/resourcefileconfig.cpp4
-rw-r--r--kabc/plugins/ldap/ldapE.pro4
-rw-r--r--kabc/plugins/olaccess/olaccess.pro8
-rw-r--r--kabc/plugins/opie/opieE.pro6
-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
-rw-r--r--kabc/plugins/sharpdtm/sharpdtmE.pro8
-rw-r--r--kabc/secrecy.h4
-rw-r--r--kabc/sound.h2
-rw-r--r--kabc/tmpaddressbook.cpp2
-rw-r--r--kabc/vcard/AdrParam.cpp10
-rw-r--r--kabc/vcard/AdrValue.cpp9
-rw-r--r--kabc/vcard/AgentParam.cpp6
-rw-r--r--kabc/vcard/AgentValue.cpp6
-rw-r--r--kabc/vcard/ClassValue.cpp6
-rw-r--r--kabc/vcard/ContentLine.cpp36
-rw-r--r--kabc/vcard/DateParam.cpp6
-rw-r--r--kabc/vcard/DateValue.cpp30
-rw-r--r--kabc/vcard/EmailParam.cpp6
-rw-r--r--kabc/vcard/Entity.cpp12
-rw-r--r--kabc/vcard/Enum.cpp8
-rw-r--r--kabc/vcard/FloatValue.cpp8
-rw-r--r--kabc/vcard/GeoValue.cpp6
-rw-r--r--kabc/vcard/ImageParam.cpp6
-rw-r--r--kabc/vcard/ImageValue.cpp6
-rw-r--r--kabc/vcard/ImgValue.cpp6
-rw-r--r--kabc/vcard/LangValue.cpp24
-rw-r--r--kabc/vcard/NValue.cpp10
-rw-r--r--kabc/vcard/OrgValue.cpp10
-rw-r--r--kabc/vcard/Param.cpp16
-rw-r--r--kabc/vcard/PhoneNumberValue.cpp6
-rw-r--r--kabc/vcard/RToken.cpp6
-rw-r--r--kabc/vcard/SoundValue.cpp6
-rw-r--r--kabc/vcard/SourceParam.cpp6
-rw-r--r--kabc/vcard/TelParam.cpp6
-rw-r--r--kabc/vcard/TelValue.cpp6
-rw-r--r--kabc/vcard/TextBinParam.cpp6
-rw-r--r--kabc/vcard/TextBinValue.cpp6
-rw-r--r--kabc/vcard/TextListValue.cpp10
-rw-r--r--kabc/vcard/TextParam.cpp6
-rw-r--r--kabc/vcard/TextValue.cpp8
-rw-r--r--kabc/vcard/URIValue.cpp16
-rw-r--r--kabc/vcard/UTCValue.cpp6
-rw-r--r--kabc/vcard/VCardEntity.cpp12
-rw-r--r--kabc/vcard/VCardv.cpp33
-rw-r--r--kabc/vcard/Value.cpp6
-rw-r--r--kabc/vcard/include/VCardAdrParam.h16
-rw-r--r--kabc/vcard/include/VCardAdrValue.h46
-rw-r--r--kabc/vcard/include/VCardAgentParam.h4
-rw-r--r--kabc/vcard/include/VCardAgentValue.h2
-rw-r--r--kabc/vcard/include/VCardClassValue.h2
-rw-r--r--kabc/vcard/include/VCardContentLine.h18
-rw-r--r--kabc/vcard/include/VCardDateParam.h2
-rw-r--r--kabc/vcard/include/VCardDateValue.h2
-rw-r--r--kabc/vcard/include/VCardDefines.h6
-rw-r--r--kabc/vcard/include/VCardEmailParam.h8
-rw-r--r--kabc/vcard/include/VCardEntity.h14
-rw-r--r--kabc/vcard/include/VCardEnum.h8
-rw-r--r--kabc/vcard/include/VCardFloatValue.h2
-rw-r--r--kabc/vcard/include/VCardImageParam.h2
-rw-r--r--kabc/vcard/include/VCardImageValue.h2
-rw-r--r--kabc/vcard/include/VCardLangValue.h16
-rw-r--r--kabc/vcard/include/VCardNValue.h24
-rw-r--r--kabc/vcard/include/VCardOrgValue.h8
-rw-r--r--kabc/vcard/include/VCardParam.h22
-rw-r--r--kabc/vcard/include/VCardRToken.h4
-rw-r--r--kabc/vcard/include/VCardSoundValue.h2
-rw-r--r--kabc/vcard/include/VCardSourceParam.h12
-rw-r--r--kabc/vcard/include/VCardTelParam.h6
-rw-r--r--kabc/vcard/include/VCardTelValue.h2
-rw-r--r--kabc/vcard/include/VCardTextBinParam.h2
-rw-r--r--kabc/vcard/include/VCardTextBinValue.h2
-rw-r--r--kabc/vcard/include/VCardTextListValue.h8
-rw-r--r--kabc/vcard/include/VCardTextParam.h2
-rw-r--r--kabc/vcard/include/VCardURIValue.h16
-rw-r--r--kabc/vcard/include/VCardUTCValue.h2
-rw-r--r--kabc/vcard/include/VCardVCard.h18
-rw-r--r--kabc/vcard/include/VCardVCardEntity.h6
-rw-r--r--kabc/vcard/include/VCardValue.h6
-rw-r--r--kabc/vcard/include/generated/AdrParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/AdrValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/AgentParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/AgentValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/ClassValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/ContentLine-generated.h10
-rw-r--r--kabc/vcard/include/generated/DateParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/DateValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/EmailParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/FloatValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/GeoValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/Group-generated.h10
-rw-r--r--kabc/vcard/include/generated/ImageParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/ImageValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/ImgParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/ImgValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/LangValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/NValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/Name-generated.h10
-rw-r--r--kabc/vcard/include/generated/OrgValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/Param-generated.h10
-rw-r--r--kabc/vcard/include/generated/ParamName-generated.h10
-rw-r--r--kabc/vcard/include/generated/ParamValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/PhoneNumberValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/SoundValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/SourceParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/TelParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/TelValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/TextBinParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/TextBinValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/TextListValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/TextNSParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/TextParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/TextValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/URIValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/UTCValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/VCard-generated.h10
-rw-r--r--kabc/vcard/include/generated/VCardEntity-generated.h10
-rw-r--r--kabc/vcard/include/generated/Value-generated.h10
-rw-r--r--kabc/vcard/testread.cpp12
-rw-r--r--kabc/vcard/testwrite.cpp4
-rw-r--r--kabc/vcard21parser.cpp40
-rw-r--r--kabc/vcard21parser.h10
-rw-r--r--kabc/vcardformatimpl.cpp25
-rw-r--r--kabc/vcardformatplugin.cpp2
-rw-r--r--kabc/vcardparser/vcard.h4
-rw-r--r--kabc/vcardparser/vcardline.cpp6
-rw-r--r--kabc/vcardparser/vcardline.h8
-rw-r--r--kabc/vcardparser/vcardparser.cpp2
-rw-r--r--kabc/vcardparser/vcardtool.cpp2
169 files changed, 966 insertions, 731 deletions
diff --git a/kabc/address.h b/kabc/address.h
index 38ad20b..41794fe 100644
--- a/kabc/address.h
+++ b/kabc/address.h
@@ -1,264 +1,264 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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$
*/
#ifndef KABC_ADDRESS_H
#define KABC_ADDRESS_H
#include <qmap.h>
#include <qstring.h>
#include <qregexp.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
// template tags for address formatting localization
#define KABC_FMTTAG_realname QString("%n")
#define KABC_FMTTAG_REALNAME QString("%N")
#define KABC_FMTTAG_company QString("%cm")
#define KABC_FMTTAG_COMPANY QString("%CM")
#define KABC_FMTTAG_pobox QString("%p")
#define KABC_FMTTAG_street QString("%s")
#define KABC_FMTTAG_STREET QString("%S")
#define KABC_FMTTAG_zipcode QString("%z")
#define KABC_FMTTAG_location QString("%l")
#define KABC_FMTTAG_LOCATION QString("%L")
#define KABC_FMTTAG_region QString("%r")
#define KABC_FMTTAG_REGION QString("%R")
#define KABC_FMTTAG_newline QString("\\n")
#define KABC_FMTTAG_condcomma QString("%,")
#define KABC_FMTTAG_condwhite QString("%w")
#define KABC_FMTTAG_purgeempty QString("%0")
namespace KABC {
/**
@short Postal address information.
This class represents information about a postal address.
*/
class Address
{
friend QDataStream &operator<<( QDataStream &, const Address & );
friend QDataStream &operator>>( QDataStream &, Address & );
public:
/**
List of addresses.
*/
- typedef QValueList<Address> List;
- typedef QValueList<int> TypeList;
+ typedef Q3ValueList<Address> List;
+ typedef Q3ValueList<int> TypeList;
/**
Address types:
@li @p Dom - domestic
@li @p Intl - international
@li @p Postal - postal
@li @p Parcel - parcel
@li @p Home - home address
@li @p Work - address at work
@li @p Pref - preferred address
*/
enum Type { Dom = 1, Intl = 2, Postal = 4, Parcel = 8, Home = 16, Work = 32,
Pref = 64 };
/**
Constructor that creates an empty Address, which is initialized
with a unique id (see @ref id()).
*/
Address();
/**
This is like @ref Address() just above, with the difference
that you can specify the type.
*/
Address( int );
bool matchAddress( QRegExp* searchExp ) const;
bool operator==( const Address & ) const;
bool operator!=( const Address & ) const;
/**
Returns true, if the address is empty.
*/
bool isEmpty() const;
/**
Clears all entries of the address.
*/
void clear();
QStringList asList();
/**
Sets the unique id.
*/
void setId( const QString & );
/*
Returns the unique id.
*/
QString id() const;
/**
Sets the type of address. See enum for definiton of types.
@param type type, can be a bitwise or of multiple types.
*/
void setType( int type );
/**
Returns the type of address. Can be a bitwise or of multiple types.
*/
int type() const;
/**
Returns a translated string of all types the address has.
*/
QString typeLabel() const;
/**
Sets the post office box.
*/
void setPostOfficeBox( const QString & );
/**
Returns the post office box.
*/
QString postOfficeBox() const;
/**
Returns the translated label for post office box field.
*/
static QString postOfficeBoxLabel();
/**
Sets the extended address information.
*/
void setExtended( const QString & );
/**
Returns the extended address information.
*/
QString extended() const;
/**
Returns the translated label for extended field.
*/
static QString extendedLabel();
/**
Sets the street (including number).
*/
void setStreet( const QString & );
/**
Returns the street.
*/
QString street() const;
/**
Returns the translated label for street field.
*/
static QString streetLabel();
/**
Sets the locality, e.g. city.
*/
void setLocality( const QString & );
/**
Returns the locality.
*/
QString locality() const;
/**
Returns the translated label for locality field.
*/
static QString localityLabel();
/**
Sets the region, e.g. state.
*/
void setRegion( const QString & );
/**
Returns the region.
*/
QString region() const;
/**
Returns the translated label for region field.
*/
static QString regionLabel();
/**
Sets the postal code.
*/
void setPostalCode( const QString & );
/**
Returns the postal code.
*/
QString postalCode() const;
/**
Returns the translated label for postal code field.
*/
static QString postalCodeLabel();
/**
Sets the country.
*/
void setCountry( const QString & );
/**
Returns the country.
*/
QString country() const;
/**
Returns the translated label for country field.
*/
static QString countryLabel();
/**
Sets the delivery label. This is the literal text to be used as label.
*/
void setLabel( const QString & );
/**
Returns the delivery label.
*/
QString label() const;
/**
Returns the translated label for delivery label field.
*/
static QString labelLabel();
/**
Returns the list of available types.
*/
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index fe59fcb..c700897 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -1,829 +1,829 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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$
*/
/*US
#include <qfile.h>
#include <qregexp.h>
#include <qtimer.h>
#include <kapplication.h>
#include <kinstance.h>
#include <kstandarddirs.h>
#include "errorhandler.h"
*/
-#include <qptrlist.h>
-#include <qtextstream.h>
+#include <q3ptrlist.h>
+#include <q3textstream.h>
#include <qfile.h>
#include <qregexp.h>
#include <kglobal.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kdebug.h>
#include <libkcal/syncdefines.h>
#include <libkdepim/phoneaccess.h>
#include "addressbook.h"
#include "resource.h"
#include "vcardconverter.h"
#include "vcardparser/vcardtool.h"
//US #include "addressbook.moc"
using namespace KABC;
struct AddressBook::AddressBookData
{
Addressee::List mAddressees;
Addressee::List mRemovedAddressees;
Field::List mAllFields;
KConfig *mConfig;
KRES::Manager<Resource> *mManager;
//US ErrorHandler *mErrorHandler;
};
struct AddressBook::Iterator::IteratorData
{
Addressee::List::Iterator mIt;
};
struct AddressBook::ConstIterator::ConstIteratorData
{
Addressee::List::ConstIterator mIt;
};
AddressBook::Iterator::Iterator()
{
d = new IteratorData;
}
AddressBook::Iterator::Iterator( const AddressBook::Iterator &i )
{
d = new IteratorData;
d->mIt = i.d->mIt;
}
AddressBook::Iterator &AddressBook::Iterator::operator=( const AddressBook::Iterator &i )
{
if( this == &i ) return *this; // guard against self assignment
delete d; // delete the old data the Iterator was completely constructed before
d = new IteratorData;
d->mIt = i.d->mIt;
return *this;
}
AddressBook::Iterator::~Iterator()
{
delete d;
}
const Addressee &AddressBook::Iterator::operator*() const
{
return *(d->mIt);
}
Addressee &AddressBook::Iterator::operator*()
{
return *(d->mIt);
}
Addressee *AddressBook::Iterator::operator->()
{
return &(*(d->mIt));
}
AddressBook::Iterator &AddressBook::Iterator::operator++()
{
(d->mIt)++;
return *this;
}
AddressBook::Iterator &AddressBook::Iterator::operator++(int)
{
(d->mIt)++;
return *this;
}
AddressBook::Iterator &AddressBook::Iterator::operator--()
{
(d->mIt)--;
return *this;
}
AddressBook::Iterator &AddressBook::Iterator::operator--(int)
{
(d->mIt)--;
return *this;
}
bool AddressBook::Iterator::operator==( const Iterator &it )
{
return ( d->mIt == it.d->mIt );
}
bool AddressBook::Iterator::operator!=( const Iterator &it )
{
return ( d->mIt != it.d->mIt );
}
AddressBook::ConstIterator::ConstIterator()
{
d = new ConstIteratorData;
}
AddressBook::ConstIterator::ConstIterator( const AddressBook::ConstIterator &i )
{
d = new ConstIteratorData;
d->mIt = i.d->mIt;
}
AddressBook::ConstIterator &AddressBook::ConstIterator::operator=( const AddressBook::ConstIterator &i )
{
if( this == &i ) return *this; // guard for self assignment
delete d; // delete the old data because the Iterator was really constructed before
d = new ConstIteratorData;
d->mIt = i.d->mIt;
return *this;
}
AddressBook::ConstIterator::~ConstIterator()
{
delete d;
}
const Addressee &AddressBook::ConstIterator::operator*() const
{
return *(d->mIt);
}
const Addressee* AddressBook::ConstIterator::operator->() const
{
return &(*(d->mIt));
}
AddressBook::ConstIterator &AddressBook::ConstIterator::operator++()
{
(d->mIt)++;
return *this;
}
AddressBook::ConstIterator &AddressBook::ConstIterator::operator++(int)
{
(d->mIt)++;
return *this;
}
AddressBook::ConstIterator &AddressBook::ConstIterator::operator--()
{
(d->mIt)--;
return *this;
}
AddressBook::ConstIterator &AddressBook::ConstIterator::operator--(int)
{
(d->mIt)--;
return *this;
}
bool AddressBook::ConstIterator::operator==( const ConstIterator &it )
{
return ( d->mIt == it.d->mIt );
}
bool AddressBook::ConstIterator::operator!=( const ConstIterator &it )
{
return ( d->mIt != it.d->mIt );
}
AddressBook::AddressBook()
{
init(0, "contact");
}
AddressBook::AddressBook( const QString &config )
{
init(config, "contact");
}
AddressBook::AddressBook( const QString &config, const QString &family )
{
init(config, family);
}
// the default family is "contact"
void AddressBook::init(const QString &config, const QString &family )
{
blockLSEchange = false;
d = new AddressBookData;
QString fami = family;
- if (config != 0) {
+ if (!config.isEmpty()) {
if ( family == "syncContact" ) {
qDebug("creating sync config ");
fami = "contact";
KConfig* con = new KConfig( locateLocal("config", "syncContactrc") );
con->setGroup( "General" );
con->writeEntry( "ResourceKeys", QString("sync") );
con->writeEntry( "Standard", QString("sync") );
con->setGroup( "Resource_sync" );
con->writeEntry( "FileName", config );
con->writeEntry( "FileFormat", QString("vcard") );
con->writeEntry( "ResourceIdentifier", QString("sync") );
con->writeEntry( "ResourceName", QString("sync_res") );
if ( config.right(4) == ".xml" )
con->writeEntry( "ResourceType", QString("qtopia") );
else if ( config == "sharp" ) {
con->writeEntry( "ResourceType", QString("sharp") );
} else {
con->writeEntry( "ResourceType", QString("file") );
}
//con->sync();
d->mConfig = con;
}
else
d->mConfig = new KConfig( locateLocal("config", config) );
// qDebug("AddressBook::init 1 config=%s",config.latin1() );
}
else {
d->mConfig = 0;
// qDebug("AddressBook::init 1 config=0");
}
//US d->mErrorHandler = 0;
d->mManager = new KRES::Manager<Resource>( fami );
d->mManager->readConfig( d->mConfig );
if ( family == "syncContact" ) {
KRES::Manager<Resource> *manager = d->mManager;
KRES::Manager<Resource>::ActiveIterator it;
for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
(*it)->setAddressBook( this );
if ( !(*it)->open() )
error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) );
}
Resource *res = standardResource();
if ( !res ) {
qDebug("ERROR: no standard resource");
res = manager->createResource( "file" );
if ( res )
{
addResource( res );
}
else
qDebug(" No resource available!!!");
}
setStandardResource( res );
manager->writeConfig();
}
addCustomField( i18n( "Department" ), KABC::Field::Organization,
"X-Department", "KADDRESSBOOK" );
addCustomField( i18n( "Profession" ), KABC::Field::Organization,
"X-Profession", "KADDRESSBOOK" );
addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
"X-AssistantsName", "KADDRESSBOOK" );
addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
"X-ManagersName", "KADDRESSBOOK" );
addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
"X-SpousesName", "KADDRESSBOOK" );
addCustomField( i18n( "Office" ), KABC::Field::Personal,
"X-Office", "KADDRESSBOOK" );
addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
"X-IMAddress", "KADDRESSBOOK" );
addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
"X-Anniversary", "KADDRESSBOOK" );
//US added this field to become compatible with Opie/qtopia addressbook
// values can be "female" or "male" or "". An empty field represents undefined.
addCustomField( i18n( "Gender" ), KABC::Field::Personal,
"X-Gender", "KADDRESSBOOK" );
addCustomField( i18n( "Children" ), KABC::Field::Personal,
"X-Children", "KADDRESSBOOK" );
addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
"X-FreeBusyUrl", "KADDRESSBOOK" );
addCustomField( i18n( "ExternalID" ), KABC::Field::Personal,
"X-ExternalID", "KADDRESSBOOK" );
}
AddressBook::~AddressBook()
{
delete d->mConfig; d->mConfig = 0;
delete d->mManager; d->mManager = 0;
//US delete d->mErrorHandler; d->mErrorHandler = 0;
delete d; d = 0;
}
bool AddressBook::load()
{
clear();
KRES::Manager<Resource>::ActiveIterator it;
bool ok = true;
for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it )
if ( !(*it)->load() ) {
qDebug( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) );
ok = false;
} else {
qDebug( i18n("Resource loaded: '%1'").arg( (*it)->resourceName() ) );
}
// mark all addressees as unchanged
Addressee::List::Iterator addrIt;
for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) {
(*addrIt).setChanged( false );
QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" );
if ( !id.isEmpty() ) {
//qDebug("setId aa %s ", id.latin1());
(*addrIt).setIDStr(id );
}
}
blockLSEchange = true;
return ok;
}
bool AddressBook::save( Ticket *ticket )
{
kdDebug(5700) << "AddressBook::save()"<< endl;
if ( ticket->resource() ) {
deleteRemovedAddressees();
return ticket->resource()->save( ticket );
}
return false;
}
// exports all Addressees, which are syncable
void AddressBook::export2File( QString fileName, QString resourceName )
{
QFile outFile( fileName );
- if ( !outFile.open( IO_WriteOnly ) ) {
+ if ( !outFile.open( QIODevice::WriteOnly ) ) {
QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" );
KMessageBox::error( 0, text.arg( fileName ) );
return ;
}
- QTextStream t( &outFile );
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream t( &outFile );
+ t.setEncoding( Q3TextStream::UnicodeUTF8 );
Iterator it;
KABC::VCardConverter::Version version;
version = KABC::VCardConverter::v3_0;
for ( it = begin(); it != end(); ++it ) {
if ( (*it).resource() ) {
bool include = (*it).resource()->includeInSync();
if ( !resourceName.isEmpty() )
include = (resourceName == (*it).resource()->resourceName() );
if ( include ) {
//qDebug(QString ("Exporting resource %1 to file %2").arg( (*it).resource()->resourceName() ).arg( fileName ) );
if ( !(*it).IDStr().isEmpty() ) {
(*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() );
}
KABC::VCardConverter converter;
QString vcard;
//Resource *resource() const;
converter.addresseeToVCard( *it, vcard, version );
t << vcard << "\r\n";
}
}
}
t << "\r\n\r\n";
outFile.close();
}
// if QStringList uids is empty, all are exported
bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName )
{
KABC::VCardConverter converter;
QString datastream;
Iterator it;
bool all = uids.isEmpty();
for ( it = begin(); it != end(); ++it ) {
// for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
if ( ! all ) {
if ( ! ( uids.contains((*it).uid() ) ))
continue;
}
KABC::Addressee a = ( *it );
if ( a.isEmpty() )
continue;
if ( all && a.resource() && !a.resource()->includeInSync() )
continue;
a.simplifyEmails();
a.simplifyPhoneNumbers();
a.simplifyPhoneNumberTypes();
a.simplifyAddresses();
QString vcard;
QString vcardnew;
converter.addresseeToVCard( a, vcard );
int start = 0;
int next;
while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
int semi = vcard.find(";", next);
int dopp = vcard.find(":", next);
int sep;
if ( semi < dopp && semi >= 0 )
sep = semi ;
else
sep = dopp;
vcardnew +=vcard.mid( start, next - start);
vcardnew +=vcard.mid( next+5,sep -next -5 ).upper();
start = sep;
}
vcardnew += vcard.mid( start,vcard.length() );
vcard = "";
start = 0;
while ( (next = vcardnew.find("ADR", start) )>= 0 ) {
int sep = vcardnew.find(":", next);
vcard +=vcardnew.mid( start, next - start+3);
start = sep;
}
vcard += vcardnew.mid( start,vcardnew.length() );
vcard.replace ( QRegExp(";;;") , "" );
vcard.replace ( QRegExp(";;") , "" );
datastream += vcard;
}
QFile outFile(fileName);
- if ( outFile.open(IO_WriteOnly) ) {
+ if ( outFile.open(QIODevice::WriteOnly) ) {
datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
- QTextStream t( &outFile ); // use a text stream
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream t( &outFile ); // use a text stream
+ t.setEncoding( Q3TextStream::UnicodeUTF8 );
t <<datastream;
t << "\r\n\r\n";
outFile.close();
} else {
qDebug("Error open temp file ");
return false;
}
return true;
}
int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool removeOld, QString resource )
{
if ( removeOld )
setUntagged( true, resource );
KABC::Addressee::List list;
QFile file( fileName );
- file.open( IO_ReadOnly );
+ file.open( QIODevice::ReadOnly );
QByteArray rawData = file.readAll();
file.close();
QString data;
if ( replaceLabel ) {
data = QString::fromLatin1( rawData.data(), rawData.size() + 1 );
data.replace ( QRegExp("LABEL") , "ADR" );
data.replace ( QRegExp("CHARSET=ISO-8859-1") , "" );
} else
data = QString::fromUtf8( rawData.data(), rawData.size() + 1 );
KABC::VCardTool tool;
list = tool.parseVCards( data );
KABC::Addressee::List::Iterator it;
Resource * setRes = 0;
if ( !resource.isEmpty() ) {
KRES::Manager<Resource>::ActiveIterator it;
KRES::Manager<Resource> *manager = d->mManager;
for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
//qDebug("SaveAB::checking resource..." );
if ( (*it)->resourceName() == resource ) {
setRes = (*it);
qDebug("KA: AB: Inserting imported contacs to resource %s", resource.latin1());
break;
}
}
}
for ( it = list.begin(); it != list.end(); ++it ) {
QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" );
if ( !id.isEmpty() )
(*it).setIDStr(id );
(*it).setResource( setRes );
if ( replaceLabel )
(*it).removeVoice();
if ( removeOld )
(*it).setTagged( true );
insertAddressee( (*it), false, true );
}
if ( removeOld )
removeUntagged();
return list.count();
}
void AddressBook::setUntagged(bool setNonSyncTagged, QString resource) // = false , "")
{
Iterator ait;
if ( !resource.isEmpty() ) {
for ( ait = begin(); ait != end(); ++ait ) {
if ( (*ait).resource() && (*ait).resource()->resourceName() == resource ) {
(*ait).setTagged( false );
}
else
(*ait).setTagged( true );
}
} else {
for ( ait = begin(); ait != end(); ++ait ) {
if ( setNonSyncTagged ) {
if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) {
(*ait).setTagged( true );
} else
(*ait).setTagged( false );
} else
(*ait).setTagged( false );
}
}
}
void AddressBook::removeUntagged()
{
Iterator ait;
bool todelete = false;
Iterator todel;
for ( ait = begin(); ait != end(); ++ait ) {
if ( todelete )
removeAddressee( todel );
if (!(*ait).tagged()) {
todelete = true;
todel = ait;
} else
todelete = false;
}
if ( todelete )
removeAddressee( todel );
deleteRemovedAddressees();
}
void AddressBook::smplifyAddressees()
{
Iterator ait;
for ( ait = begin(); ait != end(); ++ait ) {
(*ait).simplifyEmails();
(*ait).simplifyPhoneNumbers();
(*ait).simplifyPhoneNumberTypes();
(*ait).simplifyAddresses();
}
}
void AddressBook::removeSyncInfo( QString syncProfile)
{
Iterator ait;
for ( ait = begin(); ait != end(); ++ait ) {
(*ait).removeID( syncProfile );
}
if ( syncProfile.isEmpty() ) {
Iterator it = begin();
Iterator it2 ;
while ( it != end() ) {
if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
it2 = it;
//qDebug("removing %s ",(*it).uid().latin1() );
++it;
removeAddressee( it2 );
} else {
//qDebug("skipping %s ",(*it).uid().latin1() );
++it;
}
}
} else {
Addressee lse;
lse = findByUid( "last-syncAddressee-"+ syncProfile );
if ( ! lse.isEmpty() )
removeAddressee( lse );
}
}
void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync )
{
Iterator ait;
for ( ait = begin(); ait != end(); ++ait ) {
QString id = (*ait).IDStr();
(*ait).setIDStr( ":");
(*ait).setExternalUID( id );
(*ait).setOriginalExternalUID( id );
if ( isPreSync )
(*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
else {
(*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
(*ait).setID( currentSyncDevice,id );
}
}
}
void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice )
{
setUntagged();
KABC::Addressee::List list;
QFile file( fileName );
- file.open( IO_ReadOnly );
+ file.open( QIODevice::ReadOnly );
QByteArray rawData = file.readAll();
file.close();
QString data;
data = QString::fromUtf8( rawData.data(), rawData.size() + 1 );
KABC::VCardTool tool;
list = tool.parseVCards( data );
KABC::Addressee::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
Iterator ait;
for ( ait = begin(); ait != end(); ++ait ) {
if ( !(*ait).tagged() ) {
if ( (*ait).containsAdr(*it)) {
(*ait).setTagged(true);
QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" );
(*it).setIDStr( ":");
(*it).setID( currentSyncDevice,id );
(*it).setExternalUID( id );
(*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
(*it).setUid( ( (*ait).uid() ));
break;
}
}
}
if ( ait == end() )
qDebug("ERROR:: no ext ID found for uid: %s", (*it).uid().latin1());
}
clear();
for ( it = list.begin(); it != list.end(); ++it ) {
insertAddressee( (*it) );
}
}
bool AddressBook::saveABphone( QString fileName )
{
//smplifyAddressees();
qDebug("saveABphone:: saving AB... ");
if ( ! export2PhoneFormat( QStringList() ,fileName ) )
return false;
qDebug("saveABphone:: writing to phone... ");
if ( !PhoneAccess::writeToPhone( fileName) ) {
return false;
}
qDebug("saveABphone:: re-reading from phone... ");
if ( !PhoneAccess::readFromPhone( fileName) ) {
return false;
}
return true;
}
bool AddressBook::saveAB()
{
bool ok = true;
deleteRemovedAddressees();
Iterator ait;
for ( ait = begin(); ait != end(); ++ait ) {
if ( !(*ait).IDStr().isEmpty() ) {
(*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() );
}
}
KRES::Manager<Resource>::ActiveIterator it;
KRES::Manager<Resource> *manager = d->mManager;
qDebug("SaveAB::saving..." );
for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
qDebug("SaveAB::checking resource..." );
if ( (*it)->readOnly() )
qDebug("SaveAB::resource is readonly." );
if ( (*it)->isOpen() )
qDebug("SaveAB::resource is open" );
if ( !(*it)->readOnly() && (*it)->isOpen() ) {
Ticket *ticket = requestSaveTicket( *it );
qDebug("SaveAB::StdAddressBook::save '%s'", (*it)->resourceName().latin1() );
if ( !ticket ) {
qDebug( i18n( "SaveAB::Unable to save to resource '%1'. It is locked." )
.arg( (*it)->resourceName() ) );
return false;
}
//if ( !save( ticket ) )
if ( ticket->resource() ) {
QString name = ticket->resource()->resourceName();
if ( ! ticket->resource()->save( ticket ) )
ok = false;
else
qDebug("SaveAB::resource saved '%s'", name.latin1() );
} else
ok = false;
}
}
return ok;
}
AddressBook::Iterator AddressBook::begin()
{
Iterator it = Iterator();
it.d->mIt = d->mAddressees.begin();
return it;
}
AddressBook::ConstIterator AddressBook::begin() const
{
ConstIterator it = ConstIterator();
it.d->mIt = d->mAddressees.begin();
return it;
}
AddressBook::Iterator AddressBook::end()
{
Iterator it = Iterator();
it.d->mIt = d->mAddressees.end();
return it;
}
AddressBook::ConstIterator AddressBook::end() const
{
ConstIterator it = ConstIterator();
it.d->mIt = d->mAddressees.end();
return it;
}
void AddressBook::clear()
{
d->mAddressees.clear();
}
Ticket *AddressBook::requestSaveTicket( Resource *resource )
{
kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl;
if ( !resource )
{
qDebug("AddressBook::requestSaveTicket no resource" );
resource = standardResource();
}
KRES::Manager<Resource>::ActiveIterator it;
for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) {
if ( (*it) == resource ) {
if ( (*it)->readOnly() || !(*it)->isOpen() )
return 0;
else
return (*it)->requestSaveTicket();
}
}
return 0;
}
//void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false);
void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeResource )
{
if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) {
//qDebug("block insert ");
return;
}
//qDebug("inserting.... %s ",a.uid().latin1() );
bool found = false;
Addressee::List::Iterator it;
for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) {
if ( a.uid() == (*it).uid() ) {
bool changed = false;
Addressee addr = a;
if ( addr != (*it) )
changed = true;
if ( takeResource ) {
Resource * res = (*it).resource();
(*it) = a;
(*it).setResource( res );
} else {
(*it) = a;
if ( (*it).resource() == 0 )
(*it).setResource( standardResource() );
}
if ( changed ) {
if ( setRev ) {
(*it).setRevision( QDateTime::currentDateTime() );
}
(*it).setChanged( true );
}
found = true;
} else {
if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
QString name = (*it).uid().mid( 19 );
Addressee b = a;
QString id = b.getID( name );
if ( ! id.isEmpty() ) {
@@ -1029,286 +1029,286 @@ void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool is
}
#if 0
// test only
for ( it = begin(); it != end(); ++it ) {
qDebug("uid %s ", (*it).uid().latin1());
}
#endif
}
#if 0
Addressee::List AddressBook::getExternLastSyncAddressees()
{
Addressee::List results;
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) {
if ( (*it).familyName().left(4) == "!E: " )
results.append( *it );
}
}
return results;
}
#endif
void AddressBook::resetTempSyncStat()
{
Iterator it;
for ( it = begin(); it != end(); ++it ) {
(*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL );
}
}
QStringList AddressBook:: uidList()
{
QStringList results;
Iterator it;
for ( it = begin(); it != end(); ++it ) {
results.append( (*it).uid() );
}
return results;
}
Addressee::List AddressBook::allAddressees()
{
return d->mAddressees;
}
Addressee::List AddressBook::findByName( const QString &name )
{
Addressee::List results;
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( name == (*it).realName() ) {
results.append( *it );
}
}
return results;
}
Addressee::List AddressBook::findByEmail( const QString &email )
{
Addressee::List results;
QStringList mailList;
Iterator it;
for ( it = begin(); it != end(); ++it ) {
mailList = (*it).emails();
for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) {
if ( email == (*ite) ) {
results.append( *it );
}
}
}
return results;
}
Addressee::List AddressBook::findByCategory( const QString &category )
{
Addressee::List results;
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( (*it).hasCategory( category) ) {
results.append( *it );
}
}
return results;
}
void AddressBook::dump() const
{
kdDebug(5700) << "AddressBook::dump() --- begin ---" << endl;
ConstIterator it;
for( it = begin(); it != end(); ++it ) {
(*it).dump();
}
kdDebug(5700) << "AddressBook::dump() --- end ---" << endl;
}
QString AddressBook::identifier()
{
QStringList identifier;
KRES::Manager<Resource>::ActiveIterator it;
for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) {
if ( !(*it)->identifier().isEmpty() )
identifier.append( (*it)->identifier() );
}
return identifier.join( ":" );
}
Field::List AddressBook::fields( int category )
{
if ( d->mAllFields.isEmpty() ) {
d->mAllFields = Field::allFields();
}
if ( category == Field::All ) return d->mAllFields;
Field::List result;
Field::List::ConstIterator it;
for( it = d->mAllFields.begin(); it != d->mAllFields.end(); ++it ) {
if ( (*it)->category() & category ) result.append( *it );
}
return result;
}
bool AddressBook::addCustomField( const QString &label, int category,
const QString &key, const QString &app )
{
if ( d->mAllFields.isEmpty() ) {
d->mAllFields = Field::allFields();
}
//US QString a = app.isNull() ? KGlobal::instance()->instanceName() : app;
QString a = app.isNull() ? KGlobal::getAppName() : app;
QString k = key.isNull() ? label : key;
Field *field = Field::createCustomField( label, category, k, a );
if ( !field ) return false;
d->mAllFields.append( field );
return true;
}
QDataStream &KABC::operator<<( QDataStream &s, const AddressBook &ab )
{
if (!ab.d) return s;
return s << ab.d->mAddressees;
}
QDataStream &KABC::operator>>( QDataStream &s, AddressBook &ab )
{
if (!ab.d) return s;
s >> ab.d->mAddressees;
return s;
}
bool AddressBook::addResource( Resource *resource )
{
if ( !resource->open() ) {
kdDebug(5700) << "AddressBook::addResource(): can't add resource" << endl;
return false;
}
resource->setAddressBook( this );
d->mManager->add( resource );
return true;
}
void AddressBook::removeResources()
{
//remove all possible resources. This should cleanup the configfile.
- QPtrList<KABC::Resource> mResources = resources();
+ Q3PtrList<KABC::Resource> mResources = resources();
- QPtrListIterator<KABC::Resource> it(mResources);
+ Q3PtrListIterator<KABC::Resource> it(mResources);
for ( ; it.current(); ++it ) {
KABC::Resource *res = it.current();
removeResource(res);
}
}
bool AddressBook::removeResource( Resource *resource )
{
resource->close();
if ( resource == standardResource() )
d->mManager->setStandardResource( 0 );
resource->setAddressBook( 0 );
d->mManager->remove( resource );
return true;
}
-QPtrList<Resource> AddressBook::resources()
+Q3PtrList<Resource> AddressBook::resources()
{
- QPtrList<Resource> list;
+ Q3PtrList<Resource> list;
// qDebug("AddressBook::resources() 1");
KRES::Manager<Resource>::ActiveIterator it;
for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it )
list.append( *it );
return list;
}
/*US
void AddressBook::setErrorHandler( ErrorHandler *handler )
{
delete d->mErrorHandler;
d->mErrorHandler = handler;
}
*/
void AddressBook::error( const QString& msg )
{
/*US
if ( !d->mErrorHandler ) // create default error handler
d->mErrorHandler = new ConsoleErrorHandler;
if ( d->mErrorHandler )
d->mErrorHandler->error( msg );
else
kdError(5700) << "no error handler defined" << endl;
*/
kdDebug(5700) << "msg" << endl;
qDebug(msg);
}
void AddressBook::deleteRemovedAddressees()
{
Addressee::List::Iterator it;
for ( it = d->mRemovedAddressees.begin(); it != d->mRemovedAddressees.end(); ++it ) {
Resource *resource = (*it).resource();
if ( resource && !resource->readOnly() && resource->isOpen() )
resource->removeAddressee( *it );
}
d->mRemovedAddressees.clear();
}
void AddressBook::setStandardResource( Resource *resource )
{
// qDebug("AddressBook::setStandardResource 1");
d->mManager->setStandardResource( resource );
}
Resource *AddressBook::standardResource()
{
return d->mManager->standardResource();
}
KRES::Manager<Resource> *AddressBook::resourceManager()
{
return d->mManager;
}
void AddressBook::cleanUp()
{
KRES::Manager<Resource>::ActiveIterator it;
for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) {
if ( !(*it)->readOnly() && (*it)->isOpen() )
(*it)->cleanUp();
}
}
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index a8a9fc1..56fce4d 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -1,351 +1,351 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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$
*/
#ifndef KABC_ADDRESSBOOK_H
#define KABC_ADDRESSBOOK_H
#include <qobject.h>
#include <kresources/manager.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include "addressee.h"
#include "field.h"
namespace KABC {
class ErrorHandler;
class Resource;
class Ticket;
/**
@short Address Book
This class provides access to a collection of address book entries.
*/
class AddressBook : public QObject
{
Q_OBJECT
friend QDataStream &operator<<( QDataStream &, const AddressBook & );
friend QDataStream &operator>>( QDataStream &, AddressBook & );
friend class StdAddressBook;
public:
/**
@short Address Book Iterator
This class provides an iterator for address book entries.
*/
class Iterator
{
public:
Iterator();
Iterator( const Iterator & );
~Iterator();
Iterator &operator=( const Iterator & );
const Addressee &operator*() const;
Addressee &operator*();
Addressee* operator->();
Iterator &operator++();
Iterator &operator++(int);
Iterator &operator--();
Iterator &operator--(int);
bool operator==( const Iterator &it );
bool operator!=( const Iterator &it );
struct IteratorData;
IteratorData *d;
};
/**
@short Address Book Const Iterator
This class provides a const iterator for address book entries.
*/
class ConstIterator
{
public:
ConstIterator();
ConstIterator( const ConstIterator & );
~ConstIterator();
ConstIterator &operator=( const ConstIterator & );
const Addressee &operator*() const;
const Addressee* operator->() const;
ConstIterator &operator++();
ConstIterator &operator++(int);
ConstIterator &operator--();
ConstIterator &operator--(int);
bool operator==( const ConstIterator &it );
bool operator!=( const ConstIterator &it );
struct ConstIteratorData;
ConstIteratorData *d;
};
/**
Constructs a address book object.
@param format File format class.
*/
AddressBook();
AddressBook( const QString &config );
AddressBook( const QString &config, const QString &family );
virtual ~AddressBook();
/**
Requests a ticket for saving the addressbook. Calling this function locks
the addressbook for all other processes. If the address book is already
locked the function returns 0. You need the returned @ref Ticket object
for calling the @ref save() function.
@see save()
*/
Ticket *requestSaveTicket( Resource *resource=0 );
/**
Load address book from file.
*/
bool load();
/**
Save address book. The address book is saved to the file, the Ticket
object has been requested for by @ref requestSaveTicket().
@param ticket a ticket object returned by @ref requestSaveTicket()
*/
bool save( Ticket *ticket );
bool saveAB( );
bool saveABphone( QString fileName );
void smplifyAddressees();
void removeSyncInfo( QString syncProfile);
void preparePhoneSync( QString currentSyncDevice, bool isPreSync );
void export2File( QString fileName, QString resourceName = "" );
bool export2PhoneFormat( QStringList uids ,QString fileName );
int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false, QString resource = "" );
void setUntagged( bool setNonSyncTagged = false, QString resource = "" );
void removeUntagged();
void findNewExtIds( QString fileName, QString currentSyncDevice );
/**
Returns a iterator for first entry of address book.
*/
Iterator begin();
/**
Returns a const iterator for first entry of address book.
*/
ConstIterator begin() const;
/**
Returns a iterator for first entry of address book.
*/
Iterator end();
/**
Returns a const iterator for first entry of address book.
*/
ConstIterator end() const;
/**
Removes all entries from address book.
*/
void clear();
/**
Insert an Addressee object into address book. If an object with the same
unique id already exists in the address book it it replaced by the new
one. If not the new object is appended to the address book.
*/
void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false);
/**
Removes entry from the address book.
*/
void removeAddressee( const Addressee & );
/**
This is like @ref removeAddressee() just above, with the difference that
the first element is a iterator, returned by @ref begin().
*/
void removeAddressee( const Iterator & );
/**
Find the specified entry in address book. Returns end(), if the entry
couldn't be found.
*/
Iterator find( const Addressee & );
/**
Find the entry specified by an unique id. Returns an empty Addressee
object, if the address book does not contain an entry with this id.
*/
Addressee findByUid( const QString & );
/**
Returns a list of all addressees in the address book. This list can
be sorted with @ref KABC::AddresseeList for example.
*/
Addressee::List allAddressees();
/**
Find all entries with the specified name in the address book. Returns
an empty list, if no entries could be found.
*/
Addressee::List findByName( const QString & );
/**
Find all entries with the specified email address in the address book.
Returns an empty list, if no entries could be found.
*/
Addressee::List findByEmail( const QString & );
/**
Find all entries wich have the specified category in the address book.
Returns an empty list, if no entries could be found.
*/
Addressee::List findByCategory( const QString & );
/**
Return a string identifying this addressbook.
*/
virtual QString identifier();
/**
Used for debug output.
*/
void dump() const;
void emitAddressBookLocked() { emit addressBookLocked( this ); }
void emitAddressBookUnlocked() { emit addressBookUnlocked( this ); }
void emitAddressBookChanged() { emit addressBookChanged( this ); }
/**
Return list of all Fields known to the address book which are associated
with the given field category.
*/
Field::List fields( int category = Field::All );
/**
Add custom field to address book.
@param label User visible label of the field.
@param category Ored list of field categories.
@param key Identifier used as key for reading and writing the field.
@param app String used as application key for reading and writing
the field.
*/
bool addCustomField( const QString &label, int category = Field::All,
const QString &key = QString::null,
const QString &app = QString::null );
/**
Add address book resource.
*/
bool addResource( Resource * );
/**
Remove address book resource.
*/
void removeResources();
bool removeResource( Resource * );
/**
Return pointer list of all resources.
*/
- QPtrList<Resource> resources();
+ Q3PtrList<Resource> resources();
/**
Set the @p ErrorHandler, that is used by @ref error() to
provide gui-independend error messages.
*/
void setErrorHandler( ErrorHandler * );
/**
Shows gui independend error messages.
*/
void error( const QString& );
/**
Query all resources to clean up their lock files
*/
void cleanUp();
// sync stuff
//Addressee::List getExternLastSyncAddressees();
void resetTempSyncStat();
QStringList uidList();
void removeSyncAddressees( bool removeDeleted = false );
void mergeAB( AddressBook *aBook, const QString& profile, bool isSubset );
const Addressee findByExternUid( const QString& uid , const QString& profile ) const;
bool containsExternalUid( const QString& uid );
void preExternSync( AddressBook* aBook, const QString& csd, bool isSubset );
void preOLSync( AddressBook* aBook, const QString& csd);
void postExternSync( AddressBook* aBook, const QString& csd , bool setID );
signals:
/**
Emitted, when the address book has changed on disk.
*/
void addressBookChanged( AddressBook * );
/**
Emitted, when the address book has been locked for writing.
*/
void addressBookLocked( AddressBook * );
/**
Emitted, when the address book has been unlocked.
*/
void addressBookUnlocked( AddressBook * );
protected:
void deleteRemovedAddressees();
void setStandardResource( Resource * );
Resource *standardResource();
KRES::Manager<Resource> *resourceManager();
void init(const QString &config, const QString &family);
private:
//US QPtrList<Resource> mDummy; // Remove in KDE 4
struct AddressBookData;
AddressBookData *d;
bool blockLSEchange;
};
QDataStream &operator<<( QDataStream &, const AddressBook & );
QDataStream &operator>>( QDataStream &, AddressBook & );
}
#endif
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index e8e440c..9994e29 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -202,385 +202,385 @@ ulong Addressee::getCsum4List( const QStringList & attList)
}
}
//QString dump = attList.join(",");
//qDebug("csum: %d %s", cSum,dump.latin1());
return cSum;
}
void Addressee::computeCsum(const QString &dev)
{
QStringList l;
//if ( !mData->name.isEmpty() ) l.append(mData->name);
if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName );
if ( !mData->familyName.isEmpty() ) l.append( mData->familyName );
if ( !mData->givenName.isEmpty() ) l.append(mData->givenName );
if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName );
if ( !mData->prefix.isEmpty() ) l.append( mData->prefix );
if ( !mData->suffix.isEmpty() ) l.append( mData->suffix );
if ( !mData->nickName.isEmpty() ) l.append( mData->nickName );
if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() );
if ( !mData->mailer.isEmpty() ) l.append( mData->mailer );
if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() );
if ( mData->geo.isValid() ) l.append( mData->geo.asString() );
if ( !mData->title .isEmpty() ) l.append( mData->title );
if ( !mData->role.isEmpty() ) l.append( mData->role );
if ( !mData->organization.isEmpty() ) l.append( mData->organization );
if ( !mData->note.isEmpty() ) l.append( mData->note );
if ( !mData->productId.isEmpty() ) l.append(mData->productId );
if ( !mData->sortString.isEmpty() ) l.append( mData->sortString );
if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString());
if ( !mData->logo.undefined() ) {
if ( !mData->logo.isIntern() )
l.append( mData->logo.url() );
else
l.append( QString::number(mData->logo.data().width()* mData->logo.data().height()));
} else {
l.append( "nologo");
}
if ( !mData->photo.undefined() ) {
if ( !mData->photo.isIntern() )
l.append( mData->photo.url() );
else
l.append( QString::number(mData->photo.data().width()* mData->photo.data().height()));
} else {
l.append( "nophoto");
}
#if 0
if ( !mData->sound.undefined() ) {
if ( !mData->sound.isIntern() )
l.append( mData->sound.url() );
else
l.append( QString(mData->sound.data().with()* mData->sound.data().height()));
} else {
l.append( "nosound");
}
#endif
//if ( !mData->agent.isEmpty() ) l.append( );
if ( mData->url.isValid() )
if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() );
KABC::PhoneNumber::List phoneNumbers;
KABC::PhoneNumber::List::Iterator phoneIter;
QStringList t;
for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
++phoneIter )
t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) );
t.sort();
uint iii;
for ( iii = 0; iii < t.count(); ++iii)
l.append( t[iii] );
t = mData->emails;
t.sort();
for ( iii = 0; iii < t.count(); ++iii)
l.append( t[iii] );
t = mData->categories;
t.sort();
for ( iii = 0; iii < t.count(); ++iii)
l.append( t[iii] );
t = mData->custom;
t.sort();
for ( iii = 0; iii < t.count(); ++iii)
if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) {
int find = t[iii].find (':')+1;
//qDebug("lennnn %d %d ", find, t[iii].length());
if ( find < t[iii].length())
l.append( t[iii] );
}
KABC::Address::List::Iterator addressIter;
for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
++addressIter ) {
t = (*addressIter).asList();
t.sort();
for ( iii = 0; iii < t.count(); ++iii)
l.append( t[iii] );
}
uint cs = getCsum4List(l);
#if 0
for ( iii = 0; iii < l.count(); ++iii)
qDebug("%d***%s***",iii,l[iii].latin1());
qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
#endif
setCsum( dev, QString::number (cs ));
}
bool Addressee::matchAddress( QRegExp* re ) const
{
KABC::Address::List::Iterator addressIter;
for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
++addressIter ) {
if ( (*addressIter).matchAddress( re ) )
return true;
}
return false;
}
bool Addressee::matchPhoneNumber( QRegExp* re ) const
{
KABC::PhoneNumber::List::Iterator phoneIter;
for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); ++phoneIter ) {
#if QT_VERSION >= 0x030000
if (re->search( (*phoneIter).number() ) == 0)
#else
if (re->match( (*phoneIter).number() ) == 0)
#endif
return true;
}
return false;
}
void Addressee::mergeOLContact( const Addressee& ad )
{
if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo;
if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo;
if ( !mData->sound.isIntern() ) {
if ( mData->sound.url().isEmpty() ) {
mData->sound = ad.mData->sound;
}
}
if ( !mData->agent.isIntern() ) {
if ( mData->agent.url().isEmpty() ) {
mData->agent = ad.mData->agent;
}
}
{
Key::List::Iterator itA;
for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) {
bool found = false;
Key::List::Iterator it;
for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
if ( (*it) == (*itA)) {
found = true;
break;
}
}
if ( ! found ) {
mData->keys.append( *itA );
}
}
}
KABC::Address addthis = otherAddress();
KABC::Address addother = ad.otherAddress();
if ( !addthis.isEmpty() && !addother.isEmpty() )
addthis.setType( addother.type() );
//qDebug("merge contact %s ", ad.uid().latin1());
setUid( ad.uid() );
setRevision( ad.revision() );
}
void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
{
// merge all standard non-outlook fields.
//if isSubSet (e.g. mobile phone sync) merge all fields
detach();
if ( isSubSet ) {
if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
- if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
+ if ( mData->additionalName.isEmpty() ) mData->additionalName = ad.mData->additionalName;
if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
if ( !mData->birthday.isValid() )
if ( ad.mData->birthday.isValid())
mData->birthday = ad.mData->birthday;
}
if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
QStringList t;
QStringList tAD;
uint iii;
// ********** phone numbers
if ( isSubSet ) {
PhoneNumber::List phoneAD = ad.phoneNumbers();
PhoneNumber::List::Iterator phoneItAD;
for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
bool found = false;
PhoneNumber::List::Iterator it;
for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
if ( ( *phoneItAD ).contains( (*it) ) ) {
found = true;
(*it).setType( ( *phoneItAD ).type() );
(*it).setNumber( ( *phoneItAD ).number() );
break;
}
}
// if ( isSubSet && ! found )
if ( ! found ) // LR try this one...
mData->phoneNumbers.append( *phoneItAD );
}
} else {
PhoneNumber::List phoneAD = ad.phoneNumbers();
PhoneNumber::List::Iterator phoneItAD;
for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
bool found = false;
PhoneNumber::List::Iterator it;
for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
if ( ( *phoneItAD ).contains( (*it) ) ) {
found = true;
(*it).setType( ( *phoneItAD ).type() );
(*it).setNumber( ( *phoneItAD ).number() );
break;
}
}
if ( ! found ) { // append numbers which do not have work or home type
if ( ! ( ( *phoneItAD ).type() & (PhoneNumber::Work | PhoneNumber::Home) ) )
mData->phoneNumbers.append( *phoneItAD );
}
}
}
if ( isSubSet ) {
// ************* emails;
t = mData->emails;
tAD = ad.mData->emails;
for ( iii = 0; iii < tAD.count(); ++iii)
if ( !t.contains(tAD[iii] ) )
mData->emails.append( tAD[iii] );
}
// ************* categories;
if ( isSubSet ) {
t = mData->categories;
tAD = ad.mData->categories;
for ( iii = 0; iii < tAD.count(); ++iii)
if ( !t.contains(tAD[iii] ) )
mData->categories.append( tAD[iii] );
}
QStringList::ConstIterator it;
for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) {
QString qualifiedName = (*it).left( (*it).find( ":" ));
bool found = false;
QStringList::ConstIterator itL;
for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) {
if ( (*itL).startsWith( qualifiedName ) ) {
found = true;
break;
}
}
if ( ! found ) {
mData->custom.append( *it );
}
}
if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo;
if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo;
if ( !mData->sound.isIntern() ) {
if ( mData->sound.url().isEmpty() ) {
mData->sound = ad.mData->sound;
}
}
if ( !mData->agent.isIntern() ) {
if ( mData->agent.url().isEmpty() ) {
mData->agent = ad.mData->agent;
}
}
{
Key::List::Iterator itA;
for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) {
bool found = false;
Key::List::Iterator it;
for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
if ( (*it) == (*itA)) {
found = true;
break;
}
}
if ( ! found ) {
mData->keys.append( *itA );
}
}
}
if ( isSubSet ) {
KABC::Address::List::Iterator addressIterA;
for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) {
bool found = false;
KABC::Address::List::Iterator addressIter;
for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
++addressIter ) {
if ( (*addressIter) == (*addressIterA)) {
found = true;
(*addressIter).setType( (*addressIterA).type() );
break;
}
}
if ( isSubSet && ! found ) {
mData->addresses.append( *addressIterA );
}
}
}
//qDebug("merge contact %s ", ad.uid().latin1());
setUid( ad.uid() );
setRevision( ad.revision() );
}
bool Addressee::removeVoice()
{
PhoneNumber::List phoneN = phoneNumbers();
PhoneNumber::List::Iterator phoneIt;
bool found = false;
for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
if ((*phoneIt).type() - PhoneNumber::Voice ) {
(*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
insertPhoneNumber( (*phoneIt) );
found = true;
}
}
}
return found;
}
bool Addressee::containsAdr(const Addressee& ad )
{
if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false;
if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false;
if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ;
if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ;
if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ;
if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ;
if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ;
// compare phone numbers
PhoneNumber::List phoneN = ad.phoneNumbers();
PhoneNumber::List::Iterator phoneIt;
bool found = false;
for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
bool found = false;
PhoneNumber::List phoneL = ad.phoneNumbers();
PhoneNumber::List::Iterator phoneItL;
for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) {
if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) {
found = true;
break;
}
}
if ( ! found )
return false;
}
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 0ea1803..30dcd5d 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -1,279 +1,279 @@
/*** Warning! This file has been generated by the script makeaddressee ***/
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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$
*/
#ifndef KABC_ADDRESSEE_H
#define KABC_ADDRESSEE_H
#include <qdatetime.h>
#include <qstring.h>
#include <qregexp.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <ksharedptr.h>
#include <kurl.h>
#include "address.h"
#include "agent.h"
#include "geo.h"
#include "key.h"
#include "phonenumber.h"
#include "picture.h"
#include "secrecy.h"
#include "sound.h"
#include "timezone.h"
namespace KABC {
class Resource;
/**
@short address book entry
This class represents an entry in the address book.
The data of this class is implicitly shared. You can pass this class by value.
If you need the name of a field for presenting it to the user you should use
the functions ending in Label(). They return a translated string which can be
used as label for the corresponding field.
About the name fields:
givenName() is the first name and familyName() the last name. In some
countries the family name comes first, that's the reason for the
naming. formattedName() is the full name with the correct formatting.
It is used as an override, when the correct formatting can't be generated
from the other name fields automatically.
realName() returns a fully formatted name(). It uses formattedName, if set,
otherwise it constucts the name from the name fields. As fallback, if
nothing else is set it uses name().
name() is the NAME type of RFC2426. It can be used as internal name for the
data enty, but shouldn't be used for displaying the data to the user.
*/
class Addressee
{
friend QDataStream &operator<<( QDataStream &, const Addressee & );
friend QDataStream &operator>>( QDataStream &, Addressee & );
public:
- typedef QValueList<Addressee> List;
+ typedef Q3ValueList<Addressee> List;
/**
Construct an empty address book entry.
*/
Addressee();
~Addressee();
Addressee( const Addressee & );
Addressee &operator=( const Addressee & );
bool operator==( const Addressee & ) const;
bool operator!=( const Addressee & ) const;
// sync stuff
void setTempSyncStat(int id);
int tempSyncStat() const;
void setIDStr( const QString & );
const QString IDStr() const;
void setID( const QString &, const QString & );
const QString getID( const QString & ) const;
void setCsum( const QString &, const QString & );
const QString getCsum( const QString & ) const ;
void removeID(const QString &);
void computeCsum(const QString &dev);
ulong getCsum4List( const QStringList & attList);
/**
Return, if the address book entry is empty.
*/
bool isEmpty() const;
void setExternalUID( const QString &id );
const QString externalUID() const;
void setOriginalExternalUID( const QString &id );
QString originalExternalUID() const;
void mergeContact( const Addressee& ad, bool isSubSet );
void mergeOLContact( const Addressee& ad );
void simplifyEmails();
void simplifyAddresses();
void simplifyPhoneNumbers();
void simplifyPhoneNumberTypes();
void makePhoneNumbersOLcompatible();
int hasPhoneNumberType( int type );
bool removeVoice();
bool containsAdr(const Addressee& addr );
/**
Set unique identifier.
*/
void setUid( const QString &uid );
/**
Return unique identifier.
*/
const QString uid() const;
/**
Return translated label for uid field.
*/
static QString uidLabel();
/**
Set name.
*/
void setName( const QString &name );
/**
Return name.
*/
QString name() const;
/**
Return translated label for name field.
*/
static QString nameLabel();
/**
Set formatted name.
*/
void setFormattedName( const QString &formattedName );
/**
Return formatted name.
*/
QString formattedName() const;
/**
Return translated label for formattedName field.
*/
static QString formattedNameLabel();
/**
Set family name.
*/
void setFamilyName( const QString &familyName );
/**
Return family name.
*/
QString familyName() const;
/**
Return translated label for familyName field.
*/
static QString familyNameLabel();
/**
Set given name.
*/
void setGivenName( const QString &givenName );
/**
Return given name.
*/
QString givenName() const;
/**
Return translated label for givenName field.
*/
static QString givenNameLabel();
/**
Set additional names.
*/
void setAdditionalName( const QString &additionalName );
/**
Return additional names.
*/
QString additionalName() const;
/**
Return translated label for additionalName field.
*/
static QString additionalNameLabel();
/**
Set honorific prefixes.
*/
void setPrefix( const QString &prefix );
/**
Return honorific prefixes.
*/
QString prefix() const;
/**
Return translated label for prefix field.
*/
static QString prefixLabel();
/**
Set honorific suffixes.
*/
void setSuffix( const QString &suffix );
/**
Return honorific suffixes.
*/
QString suffix() const;
/**
Return translated label for suffix field.
*/
static QString suffixLabel();
/**
Set nick name.
*/
void setNickName( const QString &nickName );
/**
Return nick name.
*/
QString nickName() const;
/**
Return translated label for nickName field.
*/
static QString nickNameLabel();
/**
Set birthday.
*/
void setBirthday( const QDateTime &birthday );
/**
Return birthday.
*/
QDateTime birthday() const;
/**
Return translated label for birthday field.
*/
static QString birthdayLabel();
/**
Return translated label for homeAddressStreet field.
*/
static QString homeAddressStreetLabel();
/**
Return translated label for homeAddressLocality field.
*/
static QString homeAddressLocalityLabel();
/**
Return translated label for homeAddressRegion field.
*/
static QString homeAddressRegionLabel();
/**
Return translated label for homeAddressPostalCode field.
*/
static QString homeAddressPostalCodeLabel();
diff --git a/kabc/addresseedialog.cpp b/kabc/addresseedialog.cpp
index 671787e..bda1b9e 100644
--- a/kabc/addresseedialog.cpp
+++ b/kabc/addresseedialog.cpp
@@ -1,351 +1,354 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#include <qlayout.h>
#include <qpushbutton.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qapplication.h>
#include <qregexp.h>
-#include <qvbox.h>
+#include <q3vbox.h>
#include <qlabel.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3VBoxLayout>
#include <klocale.h>
#include <kdebug.h>
#include <kglobalsettings.h>
#include "stdaddressbook.h"
#include "addresseedialog.h"
#include "KDGanttMinimizeSplitter.h"
//#include "addresseedialog.moc"
using namespace KABC;
-AddresseeItem::AddresseeItem( QListView *parent, const Addressee &addressee ) :
- QListViewItem( parent ),
+AddresseeItem::AddresseeItem( Q3ListView *parent, const Addressee &addressee ) :
+ Q3ListViewItem( parent ),
mAddressee( addressee )
{
setText( Name,addressee.realName());
setText( Email, addressee.preferredEmail() );
setText( Category, addressee.categories().join(";") );
}
QString AddresseeItem::key( int column, bool ) const
{
if (column == Email) {
QString value = text(Email);
int val = value.findRev("@");
return value.mid( val) + value.left( val );
}
return text(column).lower();
}
AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) :
KDialogBase( KDialogBase::Plain, i18n("Select Addressee"),
Ok|Cancel, No, parent ), mMultiple( multiple )
{
qDebug("NEW AddresseeDialog ");
KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this );
mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
setMainWidget( mMiniSplitter );
QWidget *listWidget = new QWidget( mMiniSplitter );
- QVBoxLayout *listLayout = new QVBoxLayout (listWidget) ;
+ Q3VBoxLayout *listLayout = new Q3VBoxLayout (listWidget) ;
//topLayout->addLayout( listLayout );
mAddresseeList = new KListView( listWidget );
mAddresseeList->addColumn( i18n("Name") );
mAddresseeList->addColumn( i18n("Email") );
mAddresseeList->addColumn( i18n("Category") );
mAddresseeList->setAllColumnsShowFocus( true );
mAddresseeList->setFullWidth( true );
listLayout->addWidget( mAddresseeList );
- connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ),
+ connect( mAddresseeList, SIGNAL( doubleClicked( Q3ListViewItem * ) ),
SLOT( slotOk() ) );
//QHBox* searchBox = new QHBox ( listWidget );
- QHBox * hb = new QHBox ( listWidget );
+ Q3HBox * hb = new Q3HBox ( listWidget );
listLayout->addWidget ( hb );
mAddresseeEdit = new QLineEdit( hb );
connect( mAddresseeEdit, SIGNAL( returnPressed() ),
SLOT( loadAddressBook() ) );
mAddresseeEdit->setFocus();
QPushButton *searchButton = new QPushButton( i18n("Search!"), hb );
connect ( searchButton, SIGNAL( clicked() ), SLOT( loadAddressBook() ) );
if ( mMultiple ) {
mSelectedList = new KListView( mMiniSplitter );
mSelectedList->addColumn( i18n("Selected Name") );
mSelectedList->addColumn( i18n("Email") );
mSelectedList->setAllColumnsShowFocus( true );
mSelectedList->setFullWidth( true );
//connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ),
// SLOT( removeSelected() ) );
- connect( mSelectedList, SIGNAL( clicked( QListViewItem * ) ),
+ connect( mSelectedList, SIGNAL( clicked( Q3ListViewItem * ) ),
SLOT( removeSelected() ) );
- connect( mSelectedList, SIGNAL( returnPressed( QListViewItem *) ),
+ connect( mSelectedList, SIGNAL( returnPressed( Q3ListViewItem *) ),
SLOT( removeSelected() ) );
#if 0
QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup );
connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) );
#endif
- connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ),
- SLOT( addSelected( QListViewItem * ) ) );
- connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ),
- SLOT( selectNextItem( QListViewItem * ) ) );
+ connect( mAddresseeList, SIGNAL( clicked( Q3ListViewItem * ) ),
+ SLOT( addSelected( Q3ListViewItem * ) ) );
+ connect( mAddresseeList, SIGNAL( returnPressed( Q3ListViewItem * ) ),
+ SLOT( selectNextItem( Q3ListViewItem * ) ) );
}
mAddressBook = StdAddressBook::self( true );
connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ),
SLOT( addressBookChanged() ) );
#if 0
connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ),
SLOT( addressBookChanged() ) );
#endif
loadAddressBook();
- QValueList<int> splitterSize;
+ Q3ValueList<int> splitterSize;
splitterSize.append( ( width() / 5 ) * 3 );
splitterSize.append( ( width() / 5 ) *2 );
mMiniSplitter->setSizes( splitterSize );
}
AddresseeDialog::~AddresseeDialog()
{
qDebug("DELETE AddresseeDialog ");
}
void AddresseeDialog::loadAddressBook()
{
mAddresseeList->clear();
mItemDict.clear();
if ( mAddresseeEdit->text().isEmpty() ) {
AddressBook::Iterator it;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
new AddresseeItem( mAddresseeList, (*it) );
}
return;
}
//mAddresseeEdit->completionObject()->clear();
QRegExp re;
re.setWildcard(true); // most people understand these better.
re.setCaseSensitive(false);
re.setPattern( "*"+ mAddresseeEdit->text() + "*");
AddressBook::Iterator it;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
QString name = (*it).realName();
name += (*it).preferredEmail();
name += (*it).categories().join(";");
#if QT_VERSION >= 0x030000
if (re.search(name) != -1)
#else
if (re.match(name) != -1)
#endif
AddresseeItem *item = new AddresseeItem( mAddresseeList, (*it) );
}
}
-void AddresseeDialog::addCompletionItem( const QString &str, QListViewItem *item )
+void AddresseeDialog::addCompletionItem( const QString &str, Q3ListViewItem *item )
{
if ( str.isEmpty() ) return;
mItemDict.insert( str, item );
//mAddresseeEdit->completionObject()->addItem( str );
}
void AddresseeDialog::selectItem( const QString &str )
{
if ( str.isEmpty() ) return;
- QListViewItem *item = mItemDict.find( str );
+ Q3ListViewItem *item = mItemDict.find( str );
if ( item ) {
mAddresseeList->blockSignals( true );
mAddresseeList->setSelected( item, true );
mAddresseeList->ensureItemVisible( item );
mAddresseeList->blockSignals( false );
}
}
-void AddresseeDialog::updateEdit( QListViewItem *item )
+void AddresseeDialog::updateEdit( Q3ListViewItem *item )
{
mAddresseeEdit->setText( item->text( 0 ) );
mAddresseeEdit->setSelection( 0, item->text( 0 ).length() );
}
-void AddresseeDialog::selectNextItem( QListViewItem *item )
+void AddresseeDialog::selectNextItem( Q3ListViewItem *item )
{
addSelected( item );
- QListViewItem *next = item->nextSibling();
+ Q3ListViewItem *next = item->nextSibling();
if ( next ) {
next->setSelected( true );
item->setSelected( false );
mAddresseeList->setCurrentItem( next );
}
}
-void AddresseeDialog::addSelected( QListViewItem *item )
+void AddresseeDialog::addSelected( Q3ListViewItem *item )
{
AddresseeItem *addrItem = (AddresseeItem *)( item );
if ( !addrItem ) return;
Addressee a = addrItem->addressee();
- QListViewItem *selectedItem = mSelectedDict.find( a.uid() );
+ Q3ListViewItem *selectedItem = mSelectedDict.find( a.uid() );
if ( !selectedItem ) {
selectedItem = new AddresseeItem( mSelectedList, a );
mSelectedDict.insert( a.uid(), selectedItem );
}
}
void AddresseeDialog::removeSelected()
{
- QListViewItem *item = mSelectedList->selectedItem();
+ Q3ListViewItem *item = mSelectedList->selectedItem();
AddresseeItem *addrItem = (AddresseeItem *)( item );
if ( !addrItem ) return;
- QListViewItem *next = item->nextSibling();
+ Q3ListViewItem *next = item->nextSibling();
mSelectedDict.remove( addrItem->addressee().uid() );
delete addrItem;
if ( next )
next->setSelected( true );
}
Addressee AddresseeDialog::addressee()
{
AddresseeItem *aItem = 0;
if ( mMultiple )
aItem = (AddresseeItem *)( mSelectedList->firstChild() );
else
aItem = (AddresseeItem *)( mAddresseeList->selectedItem() );
if (aItem) return aItem->addressee();
return Addressee();
}
Addressee::List AddresseeDialog::addressees()
{
Addressee::List al;
AddresseeItem *aItem = 0;
if ( mMultiple ) {
- QListViewItem *item = mSelectedList->firstChild();
+ Q3ListViewItem *item = mSelectedList->firstChild();
while( item ) {
aItem = (AddresseeItem *)( item );
if ( aItem ) al.append( aItem->addressee() );
item = item->nextSibling();
}
}
else
{
aItem = (AddresseeItem *)( mAddresseeList->selectedItem() );
if (aItem) al.append( aItem->addressee() );
}
return al;
}
Addressee AddresseeDialog::getAddressee( QWidget *parent )
{
AddresseeDialog *dlg = new AddresseeDialog( parent );
Addressee addressee;
#ifdef DESKTOP_VERSION
static int geoX = 0;
static int geoY = 0;
static int geoW = 0;
static int geoH = 0;
if ( !geoX && ! geoY && !geoW &&!geoH ) {
geoX = dlg->geometry().x();
geoY = dlg->geometry().y();
geoW = dlg->width();
geoH = dlg->height();
} else {
dlg->show();
dlg->setGeometry(geoX , geoY,geoW , geoH );
}
#endif
int result = dlg->exec();
#ifdef DESKTOP_VERSION
geoX = dlg->geometry().x();
geoY = dlg->geometry().y();
geoW = dlg->width();
geoH = dlg->height();
#endif
if ( result == QDialog::Accepted ) {
addressee = dlg->addressee();
}
delete dlg;
return addressee;
}
Addressee::List AddresseeDialog::getAddressees( QWidget *parent )
{
Addressee::List addressees;
static bool running = false;
if ( running ) return addressees;
running = true;
AddresseeDialog *dlg = new AddresseeDialog( parent, true );
#ifdef DESKTOP_VERSION
static int geoX = 0;
static int geoY = 0;
static int geoW = 0;
static int geoH = 0;
if ( !geoX && ! geoY && !geoW &&!geoH ) {
geoX = dlg->geometry().x();
geoY = dlg->geometry().y();
geoW = dlg->width();
geoH = dlg->height();
}
dlg->show();
dlg->setGeometry(geoX , geoY,geoW , geoH );
#else
dlg->showMaximized();
#endif
int result = dlg->exec();
#ifdef DESKTOP_VERSION
geoX = dlg->geometry().x();
geoY = dlg->geometry().y();
geoW = dlg->width();
geoH = dlg->height();
#endif
if ( result == QDialog::Accepted ) {
addressees = dlg->addressees();
}
delete dlg;
running = false;
return addressees;
}
void AddresseeDialog::addressBookChanged()
{
loadAddressBook();
}
diff --git a/kabc/addresseedialog.h b/kabc/addresseedialog.h
index 6fab62d..be7bbb4 100644
--- a/kabc/addresseedialog.h
+++ b/kabc/addresseedialog.h
@@ -1,161 +1,161 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#ifndef KABC_ADDRESSEEDIALOG_H
#define KABC_ADDRESSEEDIALOG_H
-#include <qdict.h>
+#include <q3dict.h>
#include <kdialogbase.h>
#include <klineedit.h>
#include <klistview.h>
#include "addressbook.h"
namespace KABC {
/**
@short Special ListViewItem, that is used by the AddresseeDialog.
*/
-class AddresseeItem : public QListViewItem
+class AddresseeItem : public Q3ListViewItem
{
public:
/**
Type of column
@li @p Name - Name in Addressee
@li @p Email - Email in Addressee
*/
enum columns { Name = 0, Email = 1,Category = 2 };
/**
Constructor.
@param parent The parent listview.
@param addressee The associated addressee.
*/
- AddresseeItem( QListView *parent, const Addressee &addressee );
+ AddresseeItem( Q3ListView *parent, const Addressee &addressee );
/**
Returns the addressee.
*/
Addressee addressee() const { return mAddressee; }
/**
Method used by QListView to sort the items.
*/
virtual QString key( int column, bool ascending ) const;
private:
Addressee mAddressee;
};
/**
@short Dialog for selecting address book entries.
This class provides a dialog for selecting entries from the standard KDE
address book. Use the getAddressee() function to open a modal dialog,
returning an address book entry.
In the dialog you can select an entry from the list with the mouse or type in
the first letters of the name or email address you are searching for. The
entry matching best is automatically selected. Use double click, pressing
return or pressing the ok button to return the selected addressee to the
application.
*/
class AddresseeDialog : public KDialogBase
{
Q_OBJECT
public:
/**
Construct addressbook entry select dialog.
@param parent parent widget
*/
AddresseeDialog( QWidget *parent=0, bool multiple=false );
/**
Destructor.
*/
virtual ~AddresseeDialog();
/**
Return the address chosen.
If it is a multiple select, this will return only the first address chosen
*/
Addressee addressee();
/**
Return the list of addresses chosen
*/
Addressee::List addressees();
/**
Select a single address book entry.
Open addressee select dialog and return the entry selected by the user.
If the user doesn't select an entry or presses cancel, the returned
addressee is empty.
*/
static Addressee getAddressee( QWidget *parent );
/**
Select multiple address book entries.
Open addressee select dialog and return the entries selected by the user.
If the user doesn't select an entry or presses cancel, the returned
addressee list is empty.
*/
static Addressee::List getAddressees( QWidget *parent );
private slots:
void selectItem( const QString & );
- void selectNextItem( QListViewItem *item );
- void updateEdit( QListViewItem *item );
- void addSelected( QListViewItem *item );
+ void selectNextItem( Q3ListViewItem *item );
+ void updateEdit( Q3ListViewItem *item );
+ void addSelected( Q3ListViewItem *item );
void removeSelected();
void loadAddressBook();
protected slots:
void addressBookChanged();
private:
- void addCompletionItem( const QString &str, QListViewItem *item );
+ void addCompletionItem( const QString &str, Q3ListViewItem *item );
bool mMultiple;
KListView *mAddresseeList;
QLineEdit *mAddresseeEdit;
KListView *mSelectedList;
AddressBook *mAddressBook;
- QDict<QListViewItem> mItemDict;
- QDict<QListViewItem> mSelectedDict;
+ Q3Dict<Q3ListViewItem> mItemDict;
+ Q3Dict<Q3ListViewItem> mSelectedDict;
class AddresseeDialogPrivate;
AddresseeDialogPrivate *d;
};
}
#endif
diff --git a/kabc/addresseelist.cpp b/kabc/addresseelist.cpp
index 097e162..e1ba1ce 100644
--- a/kabc/addresseelist.cpp
+++ b/kabc/addresseelist.cpp
@@ -1,292 +1,294 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Jost Schenck <jost@schenck.de>
2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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 <kdebug.h>
//US
-#include <qtl.h>
+#include <q3tl.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include "addresseelist.h"
#include "field.h"
using namespace KABC;
//
//
// Traits
//
//
bool SortingTraits::Uid::eq( const Addressee &a1, const Addressee &a2 )
{
// locale awareness doesn't make sense sorting ids
return ( QString::compare( a1.uid(), a2.uid() ) == 0 );
}
bool SortingTraits::Uid::lt( const Addressee &a1, const Addressee &a2 )
{
// locale awareness doesn't make sense sorting ids
return ( QString::compare( a1.uid(), a2.uid() ) < 0 );
}
bool SortingTraits::Name::eq( const Addressee &a1, const Addressee &a2 )
{
//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare
return ( QString::compare( a1.name(), a2.name() ) == 0 );
}
bool SortingTraits::Name::lt( const Addressee &a1, const Addressee &a2 )
{
//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare
return ( QString::compare( a1.name(), a2.name() ) < 0 );
}
bool SortingTraits::FormattedName::eq( const Addressee &a1, const Addressee &a2 )
{
//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare
return ( QString::compare( a1.formattedName(), a2.formattedName() ) == 0 );
}
bool SortingTraits::FormattedName::lt( const Addressee &a1, const Addressee &a2 )
{
//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare
return ( QString::compare( a1.formattedName(), a2.formattedName() ) < 0 );
}
bool SortingTraits::FamilyName::eq( const Addressee &a1, const Addressee &a2 )
{
//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare
return ( QString::compare( a1.familyName(), a2.familyName() ) == 0
&& QString::compare( a1.givenName(), a2.givenName() ) == 0 );
}
bool SortingTraits::FamilyName::lt( const Addressee &a1, const Addressee &a2 )
{
//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare
int family = QString::compare( a1.familyName(), a2.familyName() );
if ( 0 == family ) {
return ( QString::compare( a1.givenName(), a2.givenName() ) < 0 );
} else {
return family < 0;
}
}
bool SortingTraits::GivenName::eq( const Addressee &a1, const Addressee &a2 )
{
//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare
return ( QString::compare( a1.givenName(), a2.givenName() ) == 0
&& QString::compare( a1.familyName(), a2.familyName() ) == 0 );
}
bool SortingTraits::GivenName::lt( const Addressee &a1, const Addressee &a2 )
{
//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare
int given = QString::compare( a1.givenName(), a2.givenName() );
if ( 0 == given ) {
return ( QString::compare( a1.familyName(), a2.familyName() ) < 0 );
} else {
return given < 0;
}
}
//
//
// AddresseeList
//
//
AddresseeList::AddresseeList()
- : QValueList<Addressee>()
+ : Q3ValueList<Addressee>()
{
mReverseSorting = false;
mActiveSortingCriterion = FormattedName;
mActiveSortingField = 0;
}
AddresseeList::~AddresseeList()
{
}
AddresseeList::AddresseeList( const AddresseeList &l )
- : QValueList<Addressee>( l )
+ : Q3ValueList<Addressee>( l )
{
mReverseSorting = l.reverseSorting();
mActiveSortingCriterion = l.sortingCriterion();
}
-AddresseeList::AddresseeList( const QValueList<Addressee> &l )
- : QValueList<Addressee>( l )
+AddresseeList::AddresseeList( const Q3ValueList<Addressee> &l )
+ : Q3ValueList<Addressee>( l )
{
mReverseSorting = false;
}
void AddresseeList::dump() const
{
kdDebug(5700) << "AddresseeList {" << endl;
kdDebug(5700) << "reverse order: " << ( mReverseSorting ? "true" : "false" ) << endl;
QString crit;
if ( Uid == mActiveSortingCriterion ) {
crit = "Uid";
} else if ( Name == mActiveSortingCriterion ) {
crit = "Name";
} else if ( FormattedName == mActiveSortingCriterion ) {
crit = "FormattedName";
} else if ( FamilyName == mActiveSortingCriterion ) {
crit = "FamilyName";
} else if ( GivenName == mActiveSortingCriterion ) {
crit = "GivenName";
} else {
crit = "unknown -- update dump method";
}
kdDebug(5700) << "sorting criterion: " << crit << endl;
//US
//US for ( const_iterator it = begin(); it != end(); ++it )
for ( ConstIterator it = begin(); it != end(); ++it )
(*it).dump();
kdDebug(5700) << "}" << endl;
}
void AddresseeList::sortBy( SortingCriterion c )
{
mActiveSortingCriterion = c;
if ( Uid == c ) {
sortByTrait<SortingTraits::Uid>();
} else if ( Name == c ) {
sortByTrait<SortingTraits::Name>();
} else if ( FormattedName == c ) {
sortByTrait<SortingTraits::FormattedName>();
} else if ( FamilyName == c ) {
sortByTrait<SortingTraits::FamilyName>();
} else if ( GivenName==c ) {
sortByTrait<SortingTraits::GivenName>();
} else {
kdError(5700) << "AddresseeList sorting criterion passed for which a trait is not known. No sorting done." << endl;
}
}
void AddresseeList::sort()
{
sortBy( mActiveSortingCriterion );
}
template<class Trait>
void AddresseeList::sortByTrait()
{
// FIXME: better sorting algorithm, bubblesort is not acceptable for larger lists.
//
// for i := 1 to n - 1
// do for j := 1 to n - i
// do if A[j] > A[j+1]
// then temp := A[j]
// A[j] := A[j + 1]
// A[j + 1 ] := temp
//US iterator i1 = begin();
Iterator i1 = begin();
//US iterator endIt = end();
Iterator endIt = end();
--endIt;
if ( i1 == endIt ) // don't need sorting
return;
//US iterator i2 = endIt;
Iterator i2 = endIt;
while( i1 != endIt ) {
//US iterator j1 = begin();
Iterator j1 = begin();
//US iterator j2 = j1;
Iterator j2 = j1;
++j2;
while( j1 != i2 ) {
if ( !mReverseSorting && Trait::lt( *j2, *j1 )
|| mReverseSorting && Trait::lt( *j1, *j2 ) ) {
qSwap( *j1, *j2 );
}
++j1;
++j2;
}
++i1;
--i2;
}
}
void AddresseeList::sortByField( Field *field )
{
if ( field )
mActiveSortingField = field;
if ( !mActiveSortingField ) {
kdWarning(5700) << "sortByField called with no active sort field" << endl;
return;
}
if ( count() == 0 )
return;
quickSortByField( 0, count() - 1 );
}
void AddresseeList::quickSortByField( int left, int right )
{
int i = left;
int j = right;
int mid = ( left + right ) / 2;
//US iterator x = at( mid );
ConstIterator x = at( mid );
do {
if ( !mReverseSorting ) {
//US QString::localeAwareCompare was not available. Used compare instead.
while ( QString::compare( mActiveSortingField->value( *at( i ) ).upper(), mActiveSortingField->value( *x ).upper() ) < 0 )
i++;
//US QString::localeAwareCompare was not available. Used compare instead.
while ( QString::compare( mActiveSortingField->value( *at( j ) ).upper(), mActiveSortingField->value( *x ).upper() ) > 0 )
j--;
} else {
//US QString::localeAwareCompare was not available. Used compare instead.
while ( QString::compare( mActiveSortingField->value( *at( i ) ).upper(), mActiveSortingField->value( *x ).upper() ) > 0 )
i++;
//US QString::localeAwareCompare was not available. Used compare instead.
while ( QString::compare( mActiveSortingField->value( *at( j ) ).upper(), mActiveSortingField->value( *x ).upper() ) < 0 )
j--;
}
if ( i <= j ) {
qSwap( *at( i ), *at( j ) );
i++;
j--;
}
} while ( i <= j );
if ( left < j ) quickSortByField( left, j );
if ( right > i ) quickSortByField( i, right );
}
diff --git a/kabc/addresseelist.h b/kabc/addresseelist.h
index 2df252c..6106804 100644
--- a/kabc/addresseelist.h
+++ b/kabc/addresseelist.h
@@ -1,218 +1,218 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Jost Schenck <jost@schenck.de>
2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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$
*/
#ifndef KABC_ADDRESSEELIST_H
#define KABC_ADDRESSEELIST_H
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include "addressee.h"
namespace KABC {
class Field;
/**
* Each trait must implement one static function for equality, one for "less
* than". Class name should be the field name. A trait does not necessarily
* have to stick to just one field: a trait sorting by family name can e.g.
* sort addressees with equal family name by given name.
*
* If you want to implement reverse sorting, you do not have to write another
* trait, as AddresseeList takes care of that.
*/
namespace SortingTraits
{
class Uid
{
public:
static bool eq( const Addressee &, const Addressee & );
static bool lt( const Addressee &, const Addressee & );
};
class Name
{
public:
static bool eq( const Addressee &, const Addressee & );
static bool lt( const Addressee &, const Addressee & );
};
class FormattedName
{
public:
static bool eq( const Addressee &, const Addressee & );
static bool lt( const Addressee &, const Addressee & );
};
class FamilyName // fallback to given name
{
public:
static bool eq( const Addressee &, const Addressee & );
static bool lt( const Addressee &, const Addressee & );
};
class GivenName // fallback to family name
{
public:
static bool eq( const Addressee &, const Addressee & );
static bool lt( const Addressee &, const Addressee & );
};
}
/**
* Addressee attribute used for sorting.
*/
typedef enum { Uid, Name, FormattedName, FamilyName, GivenName } SortingCriterion;
/**
* @short a QValueList of Addressee, with sorting functionality
*
* This class extends the functionality of QValueList with
* sorting methods specific to the Addressee class. It can be used
* just like any other QValueList but is no template class.
*
* An AddresseeList does not automatically keep sorted when addressees
* are added or removed or the sorting order is changed, as this would
* slow down larger operations by sorting after every step. So after
* such operations you have to call {@link #sort} or {@link #sortBy} to
* create a defined order again.
*
* Iterator usage is inherited by QValueList and extensively documented
* there. Please remember that the state of an iterator is undefined
* after any sorting operation.
*
* For the enumeration Type SortingCriterion, which specifies the
* field by the collection will be sorted, the following values exist:
* Uid, Name, FormattedName, FamilyName, GivenName.
*
* @author Jost Schenck jost@schenck.de
*/
-class AddresseeList : public QValueList<Addressee>
+class AddresseeList : public Q3ValueList<Addressee>
{
public:
AddresseeList();
~AddresseeList();
AddresseeList( const AddresseeList & );
- AddresseeList( const QValueList<Addressee> & );
+ AddresseeList( const Q3ValueList<Addressee> & );
/**
* Debug output.
*/
void dump() const;
/**
* Determines the direction of sorting. On change, the list
* will <em>not</em> automatically be resorted.
* @param r <tt>true</tt> if sorting should be done reverse, <tt>false</tt> otherwise
*/
void setReverseSorting( bool r = true ) { mReverseSorting = r; }
/**
* Returns the direction of sorting.
* @return <tt>true</tt> if sorting is done reverse, <tt>false</tt> otherwise
*/
bool reverseSorting() const { return mReverseSorting; }
/**
* Sorts this list by a specific criterion.
* @param c the criterion by which should be sorted
*/
void sortBy( SortingCriterion c );
/**
* Sorts this list by a specific field. If no parameter is given, the
* last used Field object will be used.
* @param field pointer to the Field object to be sorted by
*/
void sortByField( Field *field = 0 );
/**
* Sorts this list by its active sorting criterion. This normally is the
* criterion of the last sortBy operation or <tt>FormattedName</tt> if up
* to now there has been no sortBy operation.
*
* Please note that the sorting trait of the last {@link #sortByTrait}
* method call is not remembered and thus the action can not be repeated
* by this method.
*/
void sort();
/**
* Templated sort function. You normally will not want to use this but
* {@link #sortBy} and {@link #sort} instead as the existing sorting
* criteria completely suffice for most cases.
*
* However, if you do want to use some special sorting criterion, you can
* write a trait class that will be provided to this templated method.
* This trait class has to have a class declaration like the following:
* <pre>
* class MySortingTrait {
* public:
* // eq returns true if a1 and a2 are equal
* static bool eq(KABC::Addressee a1, KABC::Addressee a2);
* // lt returns true is a1 is "less than" a2
* static bool lt(KABC::Addressee a1, KABC::Addressee a2);
* };
* </pre>
* You can then pass this class to the sortByTrait method like this:
* <pre>
* myAddresseelist.sortByTrait&lt;MySortingTrait&gt;();
* </pre>
* Please note that the {@link #sort} method can not be used to repeat the
* sorting of the last <tt>sortByTrait</tt> action.
*
* Right now this method uses the bubble sort algorithm. This should be
* replaced for a better one when I have time.
*/
template<class Trait> void sortByTrait();
/**
* Returns the active sorting criterion, ie the sorting criterion that
* will be used by a {@link #sort} call.
*/
SortingCriterion sortingCriterion() const { return mActiveSortingCriterion; }
/**
* Returns the active sorting field, ie a pointer to the Field object
* which was used for the last {@link #sortByField} operation.
*/
Field* sortingField() const { return mActiveSortingField; }
private:
void quickSortByField( int, int );
bool mReverseSorting;
SortingCriterion mActiveSortingCriterion;
Field* mActiveSortingField;
};
}
#endif
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index cde19a1..425e67c 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -1,739 +1,744 @@
/*
This file is part of libkdepim.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#include <kabc/address.h>
#include <kabc/addressee.h>
#include <kabc/phonenumber.h>
#include <kglobal.h>
//US#include <kglobalsettings.h>
#include <kiconloader.h>
#include <klocale.h>
//US #include <kstringhandler.h>
-#include <qscrollview.h>
+#include <q3scrollview.h>
#include <qregexp.h>
#include <qfile.h>
-#include <qvbox.h>
+#include <q3vbox.h>
#include <qlabel.h>
#include <qwidget.h>
#include <qlayout.h>
#include <qapplication.h>
#include <qpushbutton.h>
#ifdef DESKTOP_VERSION
-#include <qpaintdevicemetrics.h>
+#include <q3paintdevicemetrics.h>
#include <qprinter.h>
#include <qpainter.h>
#endif
+#include <QDesktopWidget>
-#include <qstylesheet.h>
+#include <q3stylesheet.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <QPixmap>
+#include <Q3VBoxLayout>
#include "externalapphandler.h"
#include <kabc/addresseeview.h>
//US #ifndef DESKTOP_VERSION
//US #include <qtopia/qcopenvelope_qws.h>
//US #include <qpe/qpeapplication.h>
//US #endif
//US static int kphoneInstalled = 0;
using namespace KABC;
bool AddresseeView::sFullDetailsMode = false;
AddresseeView::AddresseeView( QWidget *parent, const char *name )
- : QTextBrowser( parent, name )
+ : Q3TextBrowser( parent, name )
{
//US setWrapPolicy( QTextEdit::AtWordBoundary );
setLinkUnderline( false );
// setVScrollBarMode( QScrollView::AlwaysOff );
//setHScrollBarMode( QScrollView::AlwaysOff );
//US QStyleSheet *sheet = styleSheet();
//US QStyleSheetItem *link = sheet->item( "a" );
//US link->setColor( KGlobalSettings::linkColor() );
}
void AddresseeView::printMe()
{
#ifdef DESKTOP_VERSION
QPrinter printer;
if (!printer.setup() )
return;
QPainter p;
p.begin ( &printer );
- QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
+ Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer );
float dx, dy;
int wid = (m.width() * 9)/10;
dx = (float) wid/(float)contentsWidth ();
dy = (float)(m.height()) / (float)contentsHeight ();
float scale;
// scale to fit the width or height of the paper
if ( dx < dy )
scale = dx;
else
scale = dy;
p.translate( m.width()/10,0 );
p.scale( scale, scale );
drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
p.end();
#endif
}
void AddresseeView::setSource(const QString& n)
{
//qDebug("********AddresseeView::setSource %s", n.latin1());
if ( n == "allDetails" ) {
sFullDetailsMode = true;
setAddressee( mCurrentContact );
} else if ( n == "notAllDetails" ) {
sFullDetailsMode = false;
setAddressee( mCurrentContact );
} else if ( n.left( 6 ) == "mailto" )
ExternalAppHandler::instance()->mailToOneContact( n.mid(7) );
else if ( n.left( 7 ) == "phoneto" )
ExternalAppHandler::instance()->callByPhone( n.mid(8) );
else if ( n.left( 5 ) == "faxto" )
ExternalAppHandler::instance()->callByFax( n.mid(6) );
else if ( n.left( 5 ) == "smsto" )
ExternalAppHandler::instance()->callBySMS( n.mid(6) );
else if ( n.left( 7 ) == "pagerto" )
ExternalAppHandler::instance()->callByPager( n.mid(8) );
else if ( n.left( 5 ) == "sipto" )
ExternalAppHandler::instance()->callBySIP( n.mid(6) );
}
void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
{
bool kemailAvail = ExternalAppHandler::instance()->isEmailAppAvailable();
// mAddressee = addr;
// clear view
//setText( QString::null );
mCurrentContact = mAddressee;
if ( mAddressee.isEmpty() ) {
setText( QString::null);
return;
}
#if 0
QString name = ( mAddressee.assembledName().isEmpty() ?
mAddressee.formattedName() : mAddressee.assembledName() );
#endif
QString name = mAddressee.realName();
QString assName = mAddressee.assembledName();
if ( assName.isEmpty() )
assName = name;
QString dynamicPart;
dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(),true );
QStringList emails = mAddressee.emails();
QStringList::ConstIterator emailIt;
QString type = i18n( "Email" );
emailIt = emails.begin();
if ( emailIt != emails.end() ) {
if ( kemailAvail ) {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
.arg( type )
.arg( assName )
.arg( *emailIt )
.arg( *emailIt );
++emailIt;
} else {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( type )
.arg( *emailIt );
++emailIt;
}
}
if ( mAddressee.birthday().date().isValid() ) {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n ("Birthday") )
.arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) );
}
dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(), false );
for ( ; emailIt != emails.end(); ++emailIt ) {
if ( kemailAvail ) {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
.arg( type )
.arg( name )
.arg( *emailIt )
.arg( *emailIt );
} else {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( type )
.arg( *emailIt );
}
}
KABC::Address::List addresses = mAddressee.addresses();
KABC::Address::List::ConstIterator addrIt;
for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) {
if ( true /*(*addrIt).label().isEmpty()*/ ) {
QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace();
//US formattedAddress = formattedAddress.replace( '\n', "<br>" );
//qDebug("adresss %s ",formattedAddress.latin1() );
formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" );
//qDebug("AddresseeView::setAddressee has to be verified.");
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( KABC::Address::typeLabel( (*addrIt).type() ) )
.arg( formattedAddress );
} else {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( KABC::Address::typeLabel( (*addrIt).type() ) )
//US .arg( (*addrIt).label().replace( '\n', "<br>" ) );
.arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ );
}
}
QString notes;
if ( sFullDetailsMode ) {
notes = QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\"><a href=\"notAllDetails\">%4</a></td></tr>" )
.arg( i18n("Details") )
.arg( i18n("Hide!") );
QString tempX = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
if ( !tempX.isEmpty() ) {
if ( tempX == "male" || tempX == "female" ) {
notes += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "" ) )
.arg( i18n(tempX) );
}
}
tempX = mAddressee.secrecy().asString();
notes += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( "" )
.arg( tempX );
tempX = mAddressee.categories().join(" - ");
if ( !tempX.isEmpty() ) {
notes += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "Category" ) )
.arg( tempX );
}
tempX = mAddressee.custom( "KADDRESSBOOK", "X-Profession" );
if ( !tempX.isEmpty() ) {
notes += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "Profession" ) )
.arg( tempX );
}
tempX = mAddressee.custom( "KADDRESSBOOK", "X-Office" );
if ( !tempX.isEmpty() ) {
notes += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "Office" ) )
.arg( tempX );
}
tempX = mAddressee.custom( "KADDRESSBOOK", "X-Department" );
if ( !tempX.isEmpty() ) {
notes += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "Department" ) )
.arg( tempX );
}
tempX = mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" );
if ( !tempX.isEmpty() ) {
notes += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "Manager" ) )
.arg( tempX );
}
tempX = mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" );
if ( !tempX.isEmpty() ) {
notes += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "Assistant" ) )
.arg( tempX );
}
if ( !mAddressee.url().url().isEmpty() ) {
notes += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "Homepage" ) )
.arg( mAddressee.url().url() );
}
tempX = mAddressee.nickName();
if ( !tempX.isEmpty() ) {
notes += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "Nickname" ) )
.arg( tempX );
}
tempX = mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" );
if ( !tempX.isEmpty() ) {
notes += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "Messanger" ) )
.arg( tempX );
}
tempX = mAddressee.custom( "KADDRESSBOOK", "X-Anniversary" );
if ( !tempX.isEmpty() ) {
QDate dt = KGlobal::locale()->readDate( tempX, "%Y-%m-%d");
if ( dt.isValid () ) {
tempX = KGlobal::locale()->formatDate(dt, true);
notes += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "Anniversary" ) )
.arg( tempX );
}
}
tempX = mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" );
if ( !tempX.isEmpty() ) {
notes += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "Spouse" ) )
.arg( tempX );
}
tempX = mAddressee.custom( "KADDRESSBOOK", "X-Children" );
if ( !tempX.isEmpty() ) {
notes += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "Children" ) )
.arg( tempX );
}
if ( !mAddressee.note().isEmpty() ) {
notes += QString(
"<tr>"
"<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label
"<td align=\"left\">%2</td>" // note
"</tr>" ).arg( i18n( "Notes" ) )
//US .arg( mAddressee.note().replace( '\n', "<br>" ) );
.arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) );
//qDebug("AddresseeView::setAddressee has to be verified.");
}
} else {
notes = QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\"><a href=\"allDetails\">%4</a></td></tr>" )
.arg( i18n("Details") )
.arg( i18n("Show!") );
}
QString aRole = "";
QString aOrga = "";
if ( true /*!mAddressee.role().isEmpty()*/ ) {
aRole = "<tr>"
"<td align=\"left\">" + mAddressee.role() + "</td>"
"</tr>";
}
if ( true /*!mAddressee.organization().isEmpty()*/ ) {
aOrga = "<tr>"
"<td align=\"left\">" + mAddressee.organization() + "</td>"
"</tr>";
}
mText = "";
QString picString = "";
KABC::Picture picture = mAddressee.photo();
if (picture.undefined() ) picture = mAddressee.logo();
bool picAvailintern = false;
bool picAvailUrl = false;
if (! picture.undefined() ) {
picAvailintern = (picture.isIntern() && !picture.data().isNull());
picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() );
}
if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) {
picString = "<img src=\"myimage\" width=\"50\" height=\"70\">";
if ( picAvailintern ) {
- QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() );
+ Q3MimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() );
int wid = picture.data().width();
int hei = picture.data().height();
if ( wid > 128 || hei > 128 ) {
if ( wid > hei ) {
hei = (hei*128)/wid;
wid = 128;
} else {
wid = (wid*128)/hei;
hei = 128;
}
}
picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei);
} else {
if ( picAvailUrl ) {
QPixmap picPix( picture.url() );
- QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix );
+ Q3MimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix );
int wid = picPix.width();
int hei = picPix.height();
if ( wid > 128 || hei > 128 ) {
if ( wid > hei ) {
hei = (hei*128)/wid;
wid = 128;
} else {
wid = (wid*128)/hei;
hei = 128;
}
}
picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei);
} else {
if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) {
static bool setDefaultImageChildren = false;
if ( !setDefaultImageChildren ) {
- QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) );
+ Q3MimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) );
setDefaultImageChildren = true;
}
picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">";
} else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) {
static bool setDefaultImagepouses = false;
if ( !setDefaultImagepouses ) {
- QMimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) );
+ Q3MimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) );
setDefaultImagepouses = true;
}
picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">";
} else {
QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
if ( gen == "male" ) {
static bool setDefaultImageMale = false;
if ( !setDefaultImageMale ) {
- QMimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) );
+ Q3MimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) );
setDefaultImageMale = true;
}
picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">";
} else if ( gen == "female" ) {
static bool setDefaultImageFemale = false;
if ( !setDefaultImageFemale ) {
- QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) );
+ Q3MimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) );
setDefaultImageFemale = true;
}
picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">";
} else {
static bool setDefaultImage = false;
if ( !setDefaultImage ) {
//qDebug("Setting default pixmap ");
- QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) );
+ Q3MimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) );
setDefaultImage = true;
}
picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">";
}
}
}
}
mText = QString::fromLatin1(
"<html>"
"<body text=\"%1\" bgcolor=\"%2\">" // text and background color
"<table>"
"<tr>"
"<td rowspan=\"3\" align=\"right\" valign=\"top\">"
"%3"
"</td>"
"<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name
"</tr>"
"%5" // role
"%6" // organization
"<td colspan=\"2\">&nbsp;</td>"
"%7" // dynamic part
"%8" // notes
"</table>"
"</body>"
"</html>")
//US
.arg( /*KGlobalSettings::textColor().name()*/ "black" )
//US
.arg( /*KGlobalSettings::baseColor().name()*/ "white" )
.arg( picString )
.arg( name )
.arg( aRole )
.arg( aOrga )
.arg( dynamicPart )
.arg( notes );
} else { // no picture!
mText = "<table width=\"100%\">\n";
//mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
#ifdef DESKTOP_VERSION
mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>";
mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>";
#else
mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>";
mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>";
#endif
mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
mText += "<table><td colspan=\"2\">&nbsp;</td>";
/*
mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>"
"<td align=\"left\"><b>%2</b></td></tr>" )
.arg( i18n(" ") )
.arg( name );
*/
if ( ! mAddressee.role().isEmpty() )
mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n(" ") )
.arg( mAddressee.role());
if ( ! mAddressee.organization().isEmpty() )
mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n(" ") )
.arg( mAddressee.organization());
mText += dynamicPart;
mText += notes;
mText += "</table>";
}
// at last display it...
setText( mText );
}
QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones_unsorted ,bool preferred )
{
ExternalAppHandler* eah = ExternalAppHandler::instance();
bool kphoneAvail = eah->isPhoneAppAvailable();
bool kfaxAvail = eah->isFaxAppAvailable();
bool ksmsAvail = eah->isSMSAppAvailable();
bool kpagerAvail = eah->isPagerAppAvailable();
bool ksipAvail = eah->isSIPAppAvailable();
QString dynamicPart;
KABC::PhoneNumber::List::ConstIterator phoneIt;
QString extension;
int phonetype;
QString sms;
KABC::PhoneNumber::List::Iterator it;
KABC::PhoneNumber::List phones ;
PhoneNumber::TypeList tList = PhoneNumber::supportedTypeList();
int i = 0;
int max = tList.count();
while ( i < max-1 ) {
for ( it = phones_unsorted.begin(); it != phones_unsorted.end(); ++it ) {
if ( (*it).type() == tList[i] ) {
phones.append( (*it ) );
break;
}
}
++i;
}
for ( it = phones_unsorted.begin(); it != phones_unsorted.end(); ++it ) {
if ( (*it).type() == tList[ max-1 ] )
phones.append( (*it ) );
}
for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) {
phonetype = (*phoneIt).type();
bool con = false;
if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) con = true;
if ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell ) con = !preferred;;
if ( con )
continue;
if (ksmsAvail &&
(
((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) ||
((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell)
)
)
{
sms = QString("<a href=\"smsto:%1 \">(sms)</a>" )
.arg( (*phoneIt).number() );
}
else
sms = "";
extension = QString::null;
if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) {
if (kfaxAvail) extension = "faxto:";
}
else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) {
if (kpagerAvail) extension = "pagerto:";
}
#if 0
else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) {
if (ksipAvail) extension = "sipto:";
}
#endif
else if (kphoneAvail) {
extension = "phoneto:";
}
else
extension = QString::null;
if ( !extension.isEmpty() ) {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" )
.arg( KABC::PhoneNumber::typeLabel( phonetype ) )
.arg( extension )
.arg( (*phoneIt).number() )
.arg( (*phoneIt).number() )
.arg( sms );
} else {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2 %3</td></tr>" )
.arg( KABC::PhoneNumber::typeLabel( phonetype ) )
.arg( (*phoneIt).number() )
.arg( sms );
}
}
return dynamicPart;
}
/*
KABC::Addressee AddresseeView::addressee() const
{
return mAddressee;
}
*/
void AddresseeView::addTag(const QString & tag,const QString & text)
{
if ( text.isEmpty() )
return;
- int number=text.contains("\n");
+ int number=text.count("\n");
QString str = "<" + tag + ">";
QString tmpText=text;
QString tmpStr=str;
if(number !=-1)
{
if (number > 0) {
int pos=0;
QString tmp;
for(int i=0;i<=number;i++) {
pos=tmpText.find("\n");
tmp=tmpText.left(pos);
tmpText=tmpText.right(tmpText.length()-pos-1);
tmpStr+=tmp+"<br>";
}
}
else tmpStr += tmpText;
tmpStr+="</" + tag + ">";
mText.append(tmpStr);
}
else
{
str += text + "</" + tag + ">";
mText.append(str);
}
}
AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name,
true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false)
{
findButton( Close )->setText( i18n("Cancel Sync"));
findButton( Ok )->setText( i18n("Remote"));
findButton( User1 )->setText( i18n("Local"));
QWidget* topframe = new QWidget( this );
setMainWidget( topframe );
- QBoxLayout* bl;
+ Q3BoxLayout* bl;
if ( QApplication::desktop()->width() < 640 ) {
- bl = new QVBoxLayout( topframe );
+ bl = new Q3VBoxLayout( topframe );
} else {
- bl = new QHBoxLayout( topframe );
+ bl = new Q3HBoxLayout( topframe );
}
- QVBox* subframe = new QVBox( topframe );
+ Q3VBox* subframe = new Q3VBox( topframe );
bl->addWidget(subframe );
QLabel* lab = new QLabel( i18n("Local Addressee"), subframe );
if ( takeloc )
- lab->setBackgroundColor(Qt::green.light() );
+ lab->setBackgroundColor(QColor(Qt::green).light() );
AddresseeView * av = new AddresseeView( subframe );
av->setAddressee( loc );
- subframe = new QVBox( topframe );
+ subframe = new Q3VBox( topframe );
bl->addWidget(subframe );
lab = new QLabel( i18n("Remote Addressee"), subframe );
if ( !takeloc )
- lab->setBackgroundColor(Qt::green.light() );
+ lab->setBackgroundColor(QColor(Qt::green).light() );
av = new AddresseeView( subframe );
av->setAddressee( rem );
QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote()));
QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local()));
#ifndef DESKTOP_VERSION
showMaximized();
#else
resize ( 640, 400 );
#endif
}
int AddresseeChooser::executeD( bool local )
{
mSyncResult = 3;
if ( local )
findButton( User1 )->setFocus();
else
findButton( Ok )->setFocus();
exec();
return mSyncResult;
}
void AddresseeChooser::slot_remote()
{
mSyncResult = 2;
accept();
}
void AddresseeChooser::slot_local()
{
mSyncResult = 1;
accept();
}
diff --git a/kabc/addresseeview.h b/kabc/addresseeview.h
index a4de085..f7ce2e0 100644
--- a/kabc/addresseeview.h
+++ b/kabc/addresseeview.h
@@ -1,82 +1,82 @@
/*
This file is part of libkdepim.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#ifndef KPIM_ADDRESSEEVIEW_H
#define KPIM_ADDRESSEEVIEW_H
#include <kabc/addressee.h>
#include <kdialogbase.h>
//US #include <ktextbrowser.h>
-#include <qtextbrowser.h>
+#include <q3textbrowser.h>
namespace KABC {
//US class AddresseeView : public KTextBrowser
-class AddresseeView : public QTextBrowser
+class AddresseeView : public Q3TextBrowser
{
public:
AddresseeView( QWidget *parent = 0, const char *name = 0 );
/**
Sets the addressee object. The addressee is displayed immediately.
@param addr The addressee object.
*/
void setAddressee( const KABC::Addressee& addr );
void setSource(const QString& n);
/**
Returns the current addressee object.
*/
//KABC::Addressee addressee() const;
void printMe();
static bool sFullDetailsMode;
private:
Addressee mCurrentContact;
//KABC::Addressee mAddressee;
QString mText;
QString getPhoneNumbers( KABC::PhoneNumber::List phones, bool preferred );
void addTag(const QString & tag,const QString & text);
//class AddresseeViewPrivate;
//AddresseeViewPrivate *d;
};
class AddresseeChooser : public KDialogBase
{
Q_OBJECT
public:
AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent = 0, const char *name = 0 );
int executeD( bool local );
private:
int mSyncResult;
private slots:
void slot_remote();
void slot_local();
};
}
#endif
diff --git a/kabc/distributionlist.cpp b/kabc/distributionlist.cpp
index d34ba0b..cf5afa6 100644
--- a/kabc/distributionlist.cpp
+++ b/kabc/distributionlist.cpp
@@ -1,269 +1,271 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#include <ksimpleconfig.h>
#include <kstandarddirs.h>
#include <kdebug.h>
#include "distributionlist.h"
+//Added by qt3to4:
+#include <Q3ValueList>
using namespace KABC;
DistributionList::DistributionList( DistributionListManager *manager,
const QString &name ) :
mManager( manager ), mName( name )
{
mManager->insert( this );
}
DistributionList::~DistributionList()
{
mManager->remove( this );
}
void DistributionList::setName( const QString &name )
{
mName = name;
}
QString DistributionList::name() const
{
return mName;
}
void DistributionList::insertEntry( const Addressee &a, const QString &email )
{
QString em = email;
if (em.isNull() )
em = a.preferredEmail();
Entry e( a, em );
- QValueList<Entry>::Iterator it;
+ Q3ValueList<Entry>::Iterator it;
for( it = mEntries.begin(); it != mEntries.end(); ++it ) {
if ( (*it).addressee.uid() == a.uid() ) {
/**
We have to check if both email addresses contains no data,
a simple 'email1 == email2' wont work here
*/
if ( ( (*it).email.isNull() && em.isEmpty() ) ||
( (*it).email.isEmpty() && em.isNull() ) ||
( (*it).email == em ) ) {
//*it = e;
return;
}
}
}
mEntries.append( e );
}
void DistributionList::removeEntry( const Addressee &a, const QString &email )
{
- QValueList<Entry>::Iterator it;
+ Q3ValueList<Entry>::Iterator it;
for( it = mEntries.begin(); it != mEntries.end(); ++it ) {
if ( (*it).addressee.uid() == a.uid() && (*it).email == email ) {
mEntries.remove( it );
return;
}
}
}
QStringList DistributionList::emails() const
{
QStringList emails;
Entry::List::ConstIterator it;
for( it = mEntries.begin(); it != mEntries.end(); ++it ) {
Addressee a = (*it).addressee;
QString email = (*it).email.isEmpty() ? a.fullEmail() :
a.fullEmail( (*it).email );
if ( !email.isEmpty() ) {
emails.append( email );
}
}
return emails;
}
DistributionList::Entry::List DistributionList::entries() const
{
return mEntries;
}
DistributionListManager::DistributionListManager( AddressBook *ab ) :
mAddressBook( ab )
{
}
DistributionListManager::~DistributionListManager()
{
}
DistributionList *DistributionListManager::list( const QString &name )
{
DistributionList *list;
for( list = mLists.first(); list; list = mLists.next() ) {
if ( list->name() == name ) return list;
}
return 0;
}
void DistributionListManager::insert( DistributionList *l )
{
DistributionList *list;
for( list = mLists.first(); list; list = mLists.next() ) {
if ( list->name() == l->name() ) {
mLists.remove( list );
break;
}
}
mLists.append( l );
}
void DistributionListManager::remove( DistributionList *l )
{
DistributionList *list;
for( list = mLists.first(); list; list = mLists.next() ) {
if ( list->name() == l->name() ) {
mLists.remove( list );
return;
}
}
}
QStringList DistributionListManager::listNames()
{
QStringList names;
DistributionList *list;
for( list = mLists.first(); list; list = mLists.next() ) {
names.append( list->name() );
}
return names;
}
bool DistributionListManager::load()
{
KSimpleConfig cfg( locateLocal( "data", "kabc/distlists" ) );
/*US
QMap<QString,QString> entryMap = cfg.entryMap( mAddressBook->identifier() );
if ( entryMap.isEmpty() ) {
kdDebug(5700) << "No distlists for '" << mAddressBook->identifier() << "'" << endl;
return false;
}
cfg.setGroup( mAddressBook->identifier() );
QMap<QString,QString>::ConstIterator it;
for( it = entryMap.begin(); it != entryMap.end(); ++it ) {
QString name = it.key();
*/
cfg.setGroup( mAddressBook->identifier() );
//US we work in microkde with a list of distributionlists
QStringList distlists = cfg.readListEntry( "__Lists__List__" );
if ( distlists.isEmpty() ) {
qDebug("no distlist for AB ");
return false;
}
QStringList::ConstIterator it;
for( it = distlists.begin(); it != distlists.end(); ++it ) {
QString name = *it;
QStringList value = cfg.readListEntry( name );
DistributionList *list = new DistributionList( this, name );
QStringList::ConstIterator it2 = value.begin();
while( it2 != value.end() ) {
QString id = *it2++;
QString email = *it2;
Addressee a = mAddressBook->findByUid( id );
if ( !a.isEmpty() ) {
list->insertEntry( a, email );
}
if ( it2 == value.end() ) break;
++it2;
}
}
return true;
}
bool DistributionListManager::save()
{
KSimpleConfig cfg( locateLocal( "data", "kabc/distlists" ) );
cfg.deleteGroup( mAddressBook->identifier() );
cfg.setGroup( mAddressBook->identifier() );
DistributionList *list;
for( list = mLists.first(); list; list = mLists.next() ) {
kdDebug(5700) << " Saving '" << list->name() << "'" << endl;
QStringList value;
DistributionList::Entry::List entries = list->entries();
DistributionList::Entry::List::ConstIterator it;
for( it = entries.begin(); it != entries.end(); ++it ) {
value.append( (*it).addressee.uid() );
if (( *it).email.isEmpty())
value.append( " " );
else
value.append( (*it).email );
// qDebug("uid *%s* email *%s* ", (*it).addressee.uid().latin1(),(*it).email.latin1() );
}
cfg.writeEntry( list->name(), value );
}
//US for microKDE we have not yet sophisticated methods to load maps.
// Because of that we store also a list of all distributionlists.
QStringList namelist;
for( list = mLists.first(); list; list = mLists.next() ) {
namelist.append( list->name() );
}
cfg.writeEntry( "__Lists__List__", namelist );
cfg.sync();
return true;
}
#if 0
DistributionListWatcher* DistributionListWatcher::mSelf = 0;
DistributionListWatcher::DistributionListWatcher()
: QObject( 0, "DistributionListWatcher" )
{
diff --git a/kabc/distributionlist.h b/kabc/distributionlist.h
index c81e543..8d21a17 100644
--- a/kabc/distributionlist.h
+++ b/kabc/distributionlist.h
@@ -1,212 +1,215 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#ifndef KABC_DISTRIBUTIONLIST_H
#define KABC_DISTRIBUTIONLIST_H
//#include <kdirwatch.h>
#include "addressbook.h"
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3PtrList>
namespace KABC {
class DistributionListManager;
/**
@short Distribution list of email addresses
This class represents a list of email addresses. Each email address is
associated with an address book entry. If the address book entry changes, the
entry in the distribution list is automatically updated.
*/
class DistributionList
{
public:
/**
@short Distribution List Entry
This class represents an entry of a distribution list. It consists of an
addressee and an email address. If the email address is null, the
preferred email address of the addressee is used.
*/
struct Entry
{
- typedef QValueList<Entry> List;
+ typedef Q3ValueList<Entry> List;
Entry() {}
Entry( const Addressee &_addressee, const QString &_email ) :
addressee( _addressee ), email( _email ) {}
Addressee addressee;
QString email;
};
/**
Create distribution list object.
@param manager Managing object of this list.
@param name Name of this list.
*/
DistributionList( DistributionListManager *manager, const QString &name );
/**
Destructor.
*/
~DistributionList();
/**
Set name of this list. The name is used as key by the
DistributinListManager.
*/
void setName( const QString & );
/**
Get name of this list.
*/
QString name() const;
/**
Insert an entry into this distribution list. If the entry already exists
nothing happens.
*/
void insertEntry( const Addressee &, const QString &email=QString::null );
/**
Remove an entry from this distribution list. If the entry doesn't exist
nothing happens.
*/
void removeEntry( const Addressee &, const QString &email=QString::null );
/**
Return list of email addresses, which belong to this distributon list.
These addresses can be directly used by e.g. a mail client.
*/
QStringList emails() const;
/**
Return list of entries belonging to this distribution list. This function
is mainly useful for a distribution list editor.
*/
Entry::List entries() const;
private:
DistributionListManager *mManager;
QString mName;
Entry::List mEntries;
};
/**
@short Manager of distribution lists
This class represents a collection of distribution lists, which are associated
with a given address book.
*/
class DistributionListManager
{
public:
/**
Create manager for given address book.
*/
DistributionListManager( AddressBook * );
/**
Destructor.
*/
~DistributionListManager();
/**
Return distribution list with given name.
*/
DistributionList *list( const QString &name );
/**
Insert distribution list. If a list with this name already exists, nothing
happens.
*/
void insert( DistributionList * );
/**
Remove distribution list. If a list with this name doesn't exist, nothing
happens.
*/
void remove( DistributionList * );
/**
Return names of all distribution lists managed by this manager.
*/
QStringList listNames();
/**
Load distribution lists form disk.
*/
bool load();
/**
Save distribution lists to disk.
*/
bool save();
private:
AddressBook *mAddressBook;
- QPtrList<DistributionList> mLists;
+ Q3PtrList<DistributionList> mLists;
};
/**
@short Watchdog for distribution lists
This class provides a @ref changed() signal that i emitted when the
distribution lists has changed in some way.
Exapmle:
<pre>
KABC::DistributionListWatcher *watchdog = KABC::DistributionListWatcher::self()
connect( watchdog, SIGNAL( changed() ), SLOT( doSomething() ) );
</pre>
*/
/*
class DistributionListWatcher : public QObject
{
Q_OBJECT_XX
public:
static DistributionListWatcher *self();
signals:
void changed();
protected:
DistributionListWatcher();
~DistributionListWatcher();
private:
static DistributionListWatcher* mSelf;
KDirWatch *mDirWatch;
};
*/
}
#endif
diff --git a/kabc/distributionlistdialog.cpp b/kabc/distributionlistdialog.cpp
index d2e1144..82883e6 100644
--- a/kabc/distributionlistdialog.cpp
+++ b/kabc/distributionlistdialog.cpp
@@ -1,376 +1,382 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
-#include <qlistview.h>
+#include <q3listview.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qcombobox.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+#include <Q3Frame>
+#include <Q3VBoxLayout>
#include <klineeditdlg.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
+#include <Q3Button>
#include <qradiobutton.h>
#include <klocale.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include "addressbook.h"
#include "addresseedialog.h"
#include "distributionlist.h"
#include "distributionlistdialog.h"
//US #include "distributionlistdialog.moc"
using namespace KABC;
DistributionListDialog::DistributionListDialog( AddressBook *addressBook, QWidget *parent)
: KDialogBase( parent, "", true, i18n("Configure Distribution Lists"), Ok, Ok, true)
{
mEditor = new DistributionListEditorWidget( addressBook, this );
setMainWidget( mEditor );
connect( this, SIGNAL( okClicked() ), mEditor, SLOT( save() ) );
}
DistributionListDialog::~DistributionListDialog()
{
}
EmailSelector::EmailSelector( const QStringList &emails, const QString &current,
QWidget *parent ) :
KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok,
parent )
{
- QFrame *topFrame = plainPage();
- QBoxLayout *topLayout = new QVBoxLayout( topFrame );
+ Q3Frame *topFrame = plainPage();
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame );
- mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"),
+ mButtonGroup = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Email Addresses"),
topFrame );
topLayout->addWidget( mButtonGroup );
QStringList::ConstIterator it;
for( it = emails.begin(); it != emails.end(); ++it ) {
QRadioButton *button = new QRadioButton( *it, mButtonGroup );
if ( (*it) == current ) {
button->setDown( true );
}
}
}
QString EmailSelector::selected()
{
- QButton *button = mButtonGroup->selected();
+ QAbstractButton *button = mButtonGroup->selected();
if ( button ) return button->text();
return QString::null;
}
QString EmailSelector::getEmail( const QStringList &emails, const QString &current,
QWidget *parent )
{
EmailSelector *dlg = new EmailSelector( emails, current, parent );
dlg->exec();
QString result = dlg->selected();
delete dlg;
return result;
}
-class EntryItem : public QListViewItem
+class EntryItem : public Q3ListViewItem
{
public:
- EntryItem( QListView *parent, const Addressee &addressee,
+ EntryItem( Q3ListView *parent, const Addressee &addressee,
const QString &email=QString::null ) :
- QListViewItem( parent ),
+ Q3ListViewItem( parent ),
mAddressee( addressee ),
mEmail( email )
{
setText( 0, addressee.realName() );
if( email.isEmpty() ) {
setText( 1, addressee.preferredEmail() );
setText( 2, i18n("Yes") );
} else {
setText( 1, email );
setText( 2, i18n("No") );
}
}
Addressee addressee() const
{
return mAddressee;
}
QString email() const
{
return mEmail;
}
private:
Addressee mAddressee;
QString mEmail;
};
DistributionListEditorWidget::DistributionListEditorWidget( AddressBook *addressBook, QWidget *parent) :
QWidget( parent ),
mAddressBook( addressBook )
{
kdDebug(5700) << "DistributionListEditor()" << endl;
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
topLayout->setSpacing( KDialog::spacingHint() );
- QBoxLayout *nameLayout = new QHBoxLayout( topLayout) ;
+ Q3BoxLayout *nameLayout = new Q3HBoxLayout( topLayout) ;
mNameCombo = new QComboBox( this );
nameLayout->addWidget( mNameCombo );
connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateEntryView() ) );
mNewButton = new QPushButton( i18n("New List..."), this );
nameLayout->addWidget( mNewButton );
connect( mNewButton, SIGNAL( clicked() ), SLOT( newList() ) );
mEditButton = new QPushButton( i18n("Rename List..."), this );
nameLayout->addWidget( mEditButton );
connect( mEditButton, SIGNAL( clicked() ), SLOT( editList() ) );
mRemoveButton = new QPushButton( i18n("Remove List"), this );
nameLayout->addWidget( mRemoveButton );
connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeList() ) );
- QGridLayout *gridLayout = new QGridLayout( topLayout, 3, 3 );
+ Q3GridLayout *gridLayout = new Q3GridLayout( topLayout, 3, 3 );
gridLayout->setColStretch(1, 1);
QLabel *listLabel = new QLabel( i18n("Available addresses:"), this );
gridLayout->addWidget( listLabel, 0, 0 );
mListLabel = new QLabel( this );
gridLayout->addMultiCellWidget( mListLabel, 0, 0, 1, 2 );
- mAddresseeView = new QListView( this );
+ mAddresseeView = new Q3ListView( this );
mAddresseeView->addColumn( i18n("Name") );
mAddresseeView->addColumn( i18n("Preferred Email") );
mAddresseeView->setAllColumnsShowFocus( true );
gridLayout->addWidget( mAddresseeView, 1, 0 );
connect( mAddresseeView, SIGNAL( selectionChanged() ),
SLOT( slotSelectionAddresseeViewChanged() ) );
- connect( mAddresseeView, SIGNAL( doubleClicked( QListViewItem * ) ),
+ connect( mAddresseeView, SIGNAL( doubleClicked( Q3ListViewItem * ) ),
SLOT( addEntry() ) );
mAddEntryButton = new QPushButton( i18n("Add Entry"), this );
mAddEntryButton->setEnabled(false);
gridLayout->addWidget( mAddEntryButton, 2, 0 );
connect( mAddEntryButton, SIGNAL( clicked() ), SLOT( addEntry() ) );
- mEntryView = new QListView( this );
+ mEntryView = new Q3ListView( this );
mEntryView->addColumn( i18n("Name") );
mEntryView->addColumn( i18n("Email") );
mEntryView->addColumn( i18n("Use Preferred") );
mEntryView->setEnabled(false);
mEntryView->setAllColumnsShowFocus( true );
gridLayout->addMultiCellWidget( mEntryView, 1, 1, 1, 2 );
connect( mEntryView, SIGNAL( selectionChanged() ),
SLOT( slotSelectionEntryViewChanged() ) );
mChangeEmailButton = new QPushButton( i18n("Change Email..."), this );
gridLayout->addWidget( mChangeEmailButton, 2, 1 );
connect( mChangeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) );
mRemoveEntryButton = new QPushButton( i18n("Remove Entry"), this );
gridLayout->addWidget( mRemoveEntryButton, 2, 2 );
connect( mRemoveEntryButton, SIGNAL( clicked() ), SLOT( removeEntry() ) );
mManager = new DistributionListManager( mAddressBook );
mManager->load();
updateAddresseeView();
updateNameCombo();
}
DistributionListEditorWidget::~DistributionListEditorWidget()
{
kdDebug(5700) << "~DistributionListEditor()" << endl;
delete mManager;
}
void DistributionListEditorWidget::save()
{
mManager->save();
}
void DistributionListEditorWidget::slotSelectionEntryViewChanged()
{
EntryItem *entryItem = static_cast<EntryItem *>( mEntryView->selectedItem() );
bool state=entryItem;
mChangeEmailButton->setEnabled(state);
mRemoveEntryButton->setEnabled(state);
}
void DistributionListEditorWidget::newList()
{
KLineEditDlg dlg(i18n("Please enter name:"), QString::null, this);
dlg.setCaption(i18n("New Distribution List"));
if (!dlg.exec()) return;
new DistributionList( mManager, dlg.text() );
mNameCombo->clear();
mNameCombo->insertStringList( mManager->listNames() );
mNameCombo->setCurrentItem( mNameCombo->count() - 1 );
updateEntryView();
slotSelectionAddresseeViewChanged();
}
void DistributionListEditorWidget::editList()
{
QString oldName = mNameCombo->currentText();
KLineEditDlg dlg(i18n("Please change name:"), oldName, this);
dlg.setCaption(i18n("Distribution List"));
if (!dlg.exec()) return;
DistributionList *list = mManager->list( oldName );
list->setName( dlg.text() );
mNameCombo->clear();
mNameCombo->insertStringList( mManager->listNames() );
mNameCombo->setCurrentItem( mNameCombo->count() - 1 );
updateEntryView();
slotSelectionAddresseeViewChanged();
}
void DistributionListEditorWidget::removeList()
{
int result = KMessageBox::warningContinueCancel( this,
i18n("Delete distribution list '%1'?") .arg( mNameCombo->currentText() ),
QString::null, i18n("Delete") );
if ( result != KMessageBox::Continue ) return;
delete mManager->list( mNameCombo->currentText() );
mNameCombo->removeItem( mNameCombo->currentItem() );
updateEntryView();
slotSelectionAddresseeViewChanged();
}
void DistributionListEditorWidget::addEntry()
{
AddresseeItem *addresseeItem =
static_cast<AddresseeItem *>( mAddresseeView->selectedItem() );
if( !addresseeItem ) {
kdDebug(5700) << "DLE::addEntry(): No addressee selected." << endl;
return;
}
DistributionList *list = mManager->list( mNameCombo->currentText() );
if ( !list ) {
kdDebug(5700) << "DLE::addEntry(): No dist list '" << mNameCombo->currentText() << "'" << endl;
return;
}
list->insertEntry( addresseeItem->addressee() );
updateEntryView();
slotSelectionAddresseeViewChanged();
}
void DistributionListEditorWidget::removeEntry()
{
DistributionList *list = mManager->list( mNameCombo->currentText() );
if ( !list ) return;
EntryItem *entryItem =
static_cast<EntryItem *>( mEntryView->selectedItem() );
if ( !entryItem ) return;
list->removeEntry( entryItem->addressee(), entryItem->email() );
delete entryItem;
}
void DistributionListEditorWidget::changeEmail()
{
DistributionList *list = mManager->list( mNameCombo->currentText() );
if ( !list ) return;
EntryItem *entryItem =
static_cast<EntryItem *>( mEntryView->selectedItem() );
if ( !entryItem ) return;
QString email = EmailSelector::getEmail( entryItem->addressee().emails(),
entryItem->email(), this );
list->removeEntry( entryItem->addressee(), entryItem->email() );
list->insertEntry( entryItem->addressee(), email );
updateEntryView();
}
void DistributionListEditorWidget::updateEntryView()
{
if ( mNameCombo->currentText().isEmpty() ) {
mListLabel->setText( i18n("Selected addressees:") );
} else {
mListLabel->setText( i18n("Selected addresses in '%1':")
.arg( mNameCombo->currentText() ) );
}
mEntryView->clear();
DistributionList *list = mManager->list( mNameCombo->currentText() );
if ( !list ) {
mEditButton->setEnabled(false);
mRemoveButton->setEnabled(false);
mChangeEmailButton->setEnabled(false);
mRemoveEntryButton->setEnabled(false);
mAddresseeView->setEnabled(false);
mEntryView->setEnabled(false);
return;
} else {
mEditButton->setEnabled(true);
mRemoveButton->setEnabled(true);
mAddresseeView->setEnabled(true);
mEntryView->setEnabled(true);
}
DistributionList::Entry::List entries = list->entries();
DistributionList::Entry::List::ConstIterator it;
for( it = entries.begin(); it != entries.end(); ++it ) {
new EntryItem( mEntryView, (*it).addressee, (*it).email );
}
EntryItem *entryItem = static_cast<EntryItem *>( mEntryView->selectedItem() );
bool state=entryItem;
mChangeEmailButton->setEnabled(state);
mRemoveEntryButton->setEnabled(state);
}
void DistributionListEditorWidget::updateAddresseeView()
{
mAddresseeView->clear();
AddressBook::Iterator it;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
diff --git a/kabc/distributionlistdialog.h b/kabc/distributionlistdialog.h
index b6d3c80..3627431 100644
--- a/kabc/distributionlistdialog.h
+++ b/kabc/distributionlistdialog.h
@@ -1,140 +1,142 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#ifndef KABC_DISTRIBUTIONLISTDIALOG_H
#define KABC_DISTRIBUTIONLISTDIALOG_H
#include <qwidget.h>
+//Added by qt3to4:
+#include <QLabel>
#include <kdialogbase.h>
-class QListView;
+class Q3ListView;
class QLabel;
class QComboBox;
-class QButtonGroup;
+class Q3ButtonGroup;
namespace KABC {
class AddressBook;
class DistributionListEditorWidget;
class DistributionListManager;
/**
@short Frontend to create distribution lists
Creating a new DistributionListDialog does automatically
load all addressees and distribution lists from the config
files. The changes will be saved when clicking the 'OK'
button.
Example:
<pre>
KABC::DistributionListDialog *dlg = new
KABC::DistributionListDialog( KABC::StdAddressBook::self(), this );
dlg->exec();
</pre>
*/
class DistributionListDialog : public KDialogBase
{
Q_OBJECT
public:
/**
Constructor.
@param ab The addressbook, the addressees should be used from
@param parent The parent widget
*/
DistributionListDialog( AddressBook *ab, QWidget *parent );
/**
Destructor.
*/
virtual ~DistributionListDialog();
private:
DistributionListEditorWidget *mEditor;
struct Data;
Data *d;
};
/**
@short Helper class
*/
class EmailSelector : public KDialogBase
{
public:
EmailSelector( const QStringList &emails, const QString &current,
QWidget *parent );
QString selected();
static QString getEmail( const QStringList &emails, const QString &current,
QWidget *parent );
private:
- QButtonGroup *mButtonGroup;
+ Q3ButtonGroup *mButtonGroup;
};
/**
@short Helper class
*/
class DistributionListEditorWidget : public QWidget
{
Q_OBJECT
public:
DistributionListEditorWidget( AddressBook *, QWidget *parent );
virtual ~DistributionListEditorWidget();
private slots:
void newList();
void editList();
void removeList();
void addEntry();
void removeEntry();
void changeEmail();
void updateEntryView();
void updateAddresseeView();
void updateNameCombo();
void slotSelectionEntryViewChanged();
void slotSelectionAddresseeViewChanged();
void save();
private:
QComboBox *mNameCombo;
QLabel *mListLabel;
- QListView *mEntryView;
- QListView *mAddresseeView;
+ Q3ListView *mEntryView;
+ Q3ListView *mAddresseeView;
AddressBook *mAddressBook;
DistributionListManager *mManager;
QPushButton *mNewButton, *mEditButton, *mRemoveButton;
QPushButton *mChangeEmailButton, *mRemoveEntryButton, *mAddEntryButton;
struct Data;
Data *d;
};
}
#endif
diff --git a/kabc/distributionlisteditor.cpp b/kabc/distributionlisteditor.cpp
index 9f5840b..ca5ecb7 100644
--- a/kabc/distributionlisteditor.cpp
+++ b/kabc/distributionlisteditor.cpp
@@ -1,322 +1,326 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
-#include <qlistview.h>
+#include <q3listview.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#ifdef DESKTOP_VERSION
#include <qinputdialog.h>
#else
#include <qtcompat/qinputdialog.h>
#endif
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <qradiobutton.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3Frame>
+#include <Q3VBoxLayout>
#include <klocale.h>
#include <kdebug.h>
#include "addressbook.h"
#include "addresseedialog.h"
#include "distributionlist.h"
#include "distributionlisteditor.h"
//US #include "distributionlisteditor.moc"
using namespace KABC;
EmailSelectDialog::EmailSelectDialog( const QStringList &emails, const QString &current,
QWidget *parent ) :
KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok,
parent )
{
- QFrame *topFrame = plainPage();
- QBoxLayout *topLayout = new QVBoxLayout( topFrame );
+ Q3Frame *topFrame = plainPage();
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame );
- mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"),
+ mButtonGroup = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Email Addresses"),
topFrame );
topLayout->addWidget( mButtonGroup );
QStringList::ConstIterator it;
for( it = emails.begin(); it != emails.end(); ++it ) {
QRadioButton *button = new QRadioButton( *it, mButtonGroup );
if ( (*it) == current ) {
button->setDown( true );
}
}
}
QString EmailSelectDialog::selected()
{
- QButton *button = mButtonGroup->selected();
+ QAbstractButton *button = mButtonGroup->selected();
if ( button ) return button->text();
return QString::null;
}
QString EmailSelectDialog::getEmail( const QStringList &emails, const QString &current,
QWidget *parent )
{
EmailSelectDialog *dlg = new EmailSelectDialog( emails, current, parent );
dlg->exec();
QString result = dlg->selected();
delete dlg;
return result;
}
-class EditEntryItem : public QListViewItem
+class EditEntryItem : public Q3ListViewItem
{
public:
- EditEntryItem( QListView *parent, const Addressee &addressee,
+ EditEntryItem( Q3ListView *parent, const Addressee &addressee,
const QString &email=QString::null ) :
- QListViewItem( parent ),
+ Q3ListViewItem( parent ),
mAddressee( addressee ),
mEmail( email )
{
setText( 0, addressee.realName() );
if( email.isEmpty() ) {
setText( 1, addressee.preferredEmail() );
setText( 2, i18n("Yes") );
} else {
setText( 1, email );
setText( 2, i18n("No") );
}
}
Addressee addressee() const
{
return mAddressee;
}
QString email() const
{
return mEmail;
}
private:
Addressee mAddressee;
QString mEmail;
};
DistributionListEditor::DistributionListEditor( AddressBook *addressBook, QWidget *parent) :
QWidget( parent ),
mAddressBook( addressBook )
{
kdDebug(5700) << "DistributionListEditor()" << endl;
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
topLayout->setMargin( KDialog::marginHint() );
topLayout->setSpacing( KDialog::spacingHint() );
- QBoxLayout *nameLayout = new QHBoxLayout( topLayout) ;
+ Q3BoxLayout *nameLayout = new Q3HBoxLayout( topLayout) ;
mNameCombo = new QComboBox( this );
nameLayout->addWidget( mNameCombo );
connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateEntryView() ) );
newButton = new QPushButton( i18n("New List"), this );
nameLayout->addWidget( newButton );
connect( newButton, SIGNAL( clicked() ), SLOT( newList() ) );
removeButton = new QPushButton( i18n("Remove List"), this );
nameLayout->addWidget( removeButton );
connect( removeButton, SIGNAL( clicked() ), SLOT( removeList() ) );
- mEntryView = new QListView( this );
+ mEntryView = new Q3ListView( this );
mEntryView->addColumn( i18n("Name") );
mEntryView->addColumn( i18n("Email") );
mEntryView->addColumn( i18n("Use Preferred") );
topLayout->addWidget( mEntryView );
connect(mEntryView,SIGNAL(selectionChanged ()),this, SLOT(slotSelectionEntryViewChanged()));
changeEmailButton = new QPushButton( i18n("Change Email"), this );
topLayout->addWidget( changeEmailButton );
connect( changeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) );
removeEntryButton = new QPushButton( i18n("Remove Entry"), this );
topLayout->addWidget( removeEntryButton );
connect( removeEntryButton, SIGNAL( clicked() ), SLOT( removeEntry() ) );
addEntryButton = new QPushButton( i18n("Add Entry"), this );
topLayout->addWidget( addEntryButton );
connect( addEntryButton, SIGNAL( clicked() ), SLOT( addEntry() ) );
- mAddresseeView = new QListView( this );
+ mAddresseeView = new Q3ListView( this );
mAddresseeView->addColumn( i18n("Name") );
mAddresseeView->addColumn( i18n("Preferred Email") );
topLayout->addWidget( mAddresseeView );
connect(mAddresseeView,SIGNAL(selectionChanged ()),this, SLOT(slotSelectionAddresseeViewChanged()));
mManager = new DistributionListManager( mAddressBook );
mManager->load();
updateAddresseeView();
updateNameCombo();
removeButton->setEnabled(!mManager->listNames().isEmpty());
}
DistributionListEditor::~DistributionListEditor()
{
kdDebug(5700) << "~DistributionListEditor()" << endl;
mManager->save();
delete mManager;
}
void DistributionListEditor::slotSelectionEntryViewChanged()
{
//US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() );
EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() );
bool state = (entryItem != 0L);
changeEmailButton->setEnabled(state);
removeEntryButton->setEnabled(state);
}
void DistributionListEditor::newList()
{
bool ok = false;
QString name = QInputDialog::getText( i18n("New Distribution List"),
i18n("Please enter name:"),
QLineEdit::Normal, QString::null, &ok,
this );
if ( !ok || name.isEmpty() ) return;
new DistributionList( mManager, name );
mNameCombo->insertItem( name );
removeButton->setEnabled(true);
updateEntryView();
}
void DistributionListEditor::removeList()
{
delete mManager->list( mNameCombo->currentText() );
mNameCombo->removeItem( mNameCombo->currentItem() );
removeButton->setEnabled(!mManager->listNames().isEmpty());
addEntryButton->setEnabled( !mNameCombo->currentText().isEmpty());
updateEntryView();
}
void DistributionListEditor::addEntry()
{
/*US
AddresseeItem *addresseeItem =
dynamic_cast<AddresseeItem *>( mAddresseeView->selectedItem() );
*/
AddresseeItem *addresseeItem =
(AddresseeItem *)( mAddresseeView->selectedItem() );
if( !addresseeItem ) {
kdDebug(5700) << "DLE::addEntry(): No addressee selected." << endl;
return;
}
DistributionList *list = mManager->list( mNameCombo->currentText() );
if ( !list ) {
kdDebug(5700) << "DLE::addEntry(): No dist list '" << mNameCombo->currentText() << "'" << endl;
return;
}
list->insertEntry( addresseeItem->addressee() );
updateEntryView();
slotSelectionAddresseeViewChanged();
}
void DistributionListEditor::removeEntry()
{
DistributionList *list = mManager->list( mNameCombo->currentText() );
if ( !list ) return;
//US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() );
EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() );
if ( !entryItem ) return;
list->removeEntry( entryItem->addressee(), entryItem->email() );
delete entryItem;
}
void DistributionListEditor::changeEmail()
{
DistributionList *list = mManager->list( mNameCombo->currentText() );
if ( !list ) return;
//US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() );
EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() );
if ( !entryItem ) return;
QString email = EmailSelectDialog::getEmail( entryItem->addressee().emails(),
entryItem->email(), this );
list->removeEntry( entryItem->addressee(), entryItem->email() );
list->insertEntry( entryItem->addressee(), email );
updateEntryView();
}
void DistributionListEditor::updateEntryView()
{
DistributionList *list = mManager->list( mNameCombo->currentText() );
if ( !list ) return;
mEntryView->clear();
DistributionList::Entry::List entries = list->entries();
DistributionList::Entry::List::ConstIterator it;
for( it = entries.begin(); it != entries.end(); ++it ) {
new EditEntryItem( mEntryView, (*it).addressee, (*it).email );
}
//US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() );
EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() );
bool state = (entryItem != 0L);
changeEmailButton->setEnabled(state);
removeEntryButton->setEnabled(state);
}
void DistributionListEditor::updateAddresseeView()
{
mAddresseeView->clear();
AddressBook::Iterator it;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
new AddresseeItem( mAddresseeView, *it );
}
}
void DistributionListEditor::updateNameCombo()
{
mNameCombo->insertStringList( mManager->listNames() );
updateEntryView();
}
void DistributionListEditor::slotSelectionAddresseeViewChanged()
{
//US AddresseeItem *addresseeItem = dynamic_cast<AddresseeItem *>( mAddresseeView->selectedItem() );
AddresseeItem *addresseeItem = (AddresseeItem *)( mAddresseeView->selectedItem() );
bool state = (addresseeItem != 0L);
addEntryButton->setEnabled( state && !mNameCombo->currentText().isEmpty());
}
diff --git a/kabc/distributionlisteditor.h b/kabc/distributionlisteditor.h
index e0b4221..e672a14 100644
--- a/kabc/distributionlisteditor.h
+++ b/kabc/distributionlisteditor.h
@@ -1,86 +1,86 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#ifndef KABC_DISTRIBUTIONLISTEDITOR_H
#define KABC_DISTRIBUTIONLISTEDITOR_H
#include <qwidget.h>
#include <kdialogbase.h>
-class QListView;
+class Q3ListView;
class QComboBox;
-class QButtonGroup;
+class Q3ButtonGroup;
namespace KABC {
class AddressBook;
class DistributionListManager;
class EmailSelectDialog : public KDialogBase
{
public:
EmailSelectDialog( const QStringList &emails, const QString &current,
QWidget *parent );
QString selected();
static QString getEmail( const QStringList &emails, const QString &current,
QWidget *parent );
private:
- QButtonGroup *mButtonGroup;
+ Q3ButtonGroup *mButtonGroup;
};
/**
@obsolete
*/
class DistributionListEditor : public QWidget
{
Q_OBJECT
public:
DistributionListEditor( AddressBook *, QWidget *parent );
virtual ~DistributionListEditor();
private slots:
void newList();
void removeList();
void addEntry();
void removeEntry();
void changeEmail();
void updateEntryView();
void updateAddresseeView();
void updateNameCombo();
void slotSelectionEntryViewChanged();
void slotSelectionAddresseeViewChanged();
private:
QComboBox *mNameCombo;
- QListView *mEntryView;
- QListView *mAddresseeView;
+ Q3ListView *mEntryView;
+ Q3ListView *mAddresseeView;
AddressBook *mAddressBook;
DistributionListManager *mManager;
QPushButton *newButton, *removeButton;
QPushButton *changeEmailButton,*removeEntryButton,*addEntryButton;
};
}
#endif
diff --git a/kabc/field.cpp b/kabc/field.cpp
index 7c6d7a9..203f696 100644
--- a/kabc/field.cpp
+++ b/kabc/field.cpp
@@ -1,584 +1,586 @@
/*** Warning! This file has been generated by the script makeaddressee ***/
/*
This file is part of libkabc.
Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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 <klocale.h>
#include <kconfig.h>
#include <kconfigbase.h>
#include <kglobal.h>
#include "field.h"
#include "resource.h"
+//Added by qt3to4:
+#include <Q3ValueList>
using namespace KABC;
class Field::FieldImpl
{
public:
FieldImpl( int fieldId, int category = 0,
const QString &label = QString::null,
const QString &key = QString::null,
const QString &app = QString::null )
: mFieldId( fieldId ), mCategory( category ), mLabel( label ),
mKey( key ), mApp( app ) {}
enum FieldId
{
CustomField,
FormattedName,
FamilyName,
GivenName,
AdditionalName,
Prefix,
Suffix,
NickName,
Birthday,
Category,
HomeAddressStreet,
HomeAddressLocality,
HomeAddressRegion,
HomeAddressPostalCode,
HomeAddressCountry,
HomeAddressLabel,
BusinessAddressStreet,
BusinessAddressLocality,
BusinessAddressRegion,
BusinessAddressPostalCode,
BusinessAddressCountry,
BusinessAddressLabel,
HomePhone,
BusinessPhone,
MobilePhone,
HomeFax,
BusinessFax,
Isdn,
Pager,
Email,
Mailer,
Title,
Role,
Organization,
Note,
Url,
Resource,
Sip,
MobileWorkPhone,
OtherPhone
};
int fieldId() { return mFieldId; }
int category() { return mCategory; }
QString label() { return mLabel; }
QString key() { return mKey; }
QString app() { return mApp; }
private:
int mFieldId;
int mCategory;
QString mLabel;
QString mKey;
QString mApp;
};
Field::List Field::mAllFields;
Field::List Field::mDefaultFields;
Field::List Field::mCustomFields;
Field::Field( FieldImpl *impl )
{
mImpl = impl;
}
Field::~Field()
{
delete mImpl;
}
QString Field::label()
{
switch ( mImpl->fieldId() ) {
case FieldImpl::FormattedName:
return Addressee::formattedNameLabel();
case FieldImpl::FamilyName:
return Addressee::familyNameLabel();
case FieldImpl::GivenName:
return Addressee::givenNameLabel();
case FieldImpl::AdditionalName:
return Addressee::additionalNameLabel();
case FieldImpl::Prefix:
return Addressee::prefixLabel();
case FieldImpl::Suffix:
return Addressee::suffixLabel();
case FieldImpl::NickName:
return Addressee::nickNameLabel();
case FieldImpl::Birthday:
return Addressee::birthdayLabel();
case FieldImpl::HomeAddressStreet:
return Addressee::homeAddressStreetLabel();
case FieldImpl::HomeAddressLocality:
return Addressee::homeAddressLocalityLabel();
case FieldImpl::HomeAddressRegion:
return Addressee::homeAddressRegionLabel();
case FieldImpl::HomeAddressPostalCode:
return Addressee::homeAddressPostalCodeLabel();
case FieldImpl::HomeAddressCountry:
return Addressee::homeAddressCountryLabel();
case FieldImpl::HomeAddressLabel:
return Addressee::homeAddressLabelLabel();
case FieldImpl::BusinessAddressStreet:
return Addressee::businessAddressStreetLabel();
case FieldImpl::BusinessAddressLocality:
return Addressee::businessAddressLocalityLabel();
case FieldImpl::BusinessAddressRegion:
return Addressee::businessAddressRegionLabel();
case FieldImpl::BusinessAddressPostalCode:
return Addressee::businessAddressPostalCodeLabel();
case FieldImpl::BusinessAddressCountry:
return Addressee::businessAddressCountryLabel();
case FieldImpl::BusinessAddressLabel:
return Addressee::businessAddressLabelLabel();
case FieldImpl::HomePhone:
return Addressee::homePhoneLabel();
case FieldImpl::BusinessPhone:
return Addressee::businessPhoneLabel();
case FieldImpl::MobilePhone:
return Addressee::mobilePhoneLabel();
case FieldImpl::MobileWorkPhone:
return Addressee::mobileWorkPhoneLabel();
case FieldImpl::HomeFax:
return Addressee::homeFaxLabel();
case FieldImpl::BusinessFax:
return Addressee::businessFaxLabel();
case FieldImpl::Isdn:
return Addressee::isdnLabel();
case FieldImpl::Pager:
return Addressee::pagerLabel();
case FieldImpl::Email:
return Addressee::emailLabel();
case FieldImpl::Mailer:
return Addressee::mailerLabel();
case FieldImpl::Title:
return Addressee::titleLabel();
case FieldImpl::Role:
return Addressee::roleLabel();
case FieldImpl::Organization:
return Addressee::organizationLabel();
case FieldImpl::Note:
return Addressee::noteLabel();
case FieldImpl::Url:
return Addressee::urlLabel();
case FieldImpl::Resource:
return Addressee::resourceLabel();
case FieldImpl::Category:
return Addressee::categoryLabel();
case FieldImpl::Sip:
return Addressee::sipLabel();
case FieldImpl::OtherPhone:
return Addressee::otherPhoneLabel();
case FieldImpl::CustomField:
return mImpl->label();
default:
return i18n("Unknown Field");
}
}
int Field::category()
{
return mImpl->category();
}
QString Field::categoryLabel( int category )
{
switch ( category ) {
case All:
return i18n("All");
case Frequent:
return i18n("Frequent");
case Address:
return i18n("Address");
case Email:
return i18n("Email");
case Personal:
return i18n("Personal");
case Organization:
return i18n("Organization");
case CustomCategory:
return i18n("Custom");
default:
return i18n("Undefined");
}
}
QString Field::value( const KABC::Addressee &a )
{
switch ( mImpl->fieldId() ) {
case FieldImpl::FormattedName:
return a.formattedName();
case FieldImpl::FamilyName:
return a.familyName();
case FieldImpl::GivenName:
return a.givenName();
case FieldImpl::AdditionalName:
return a.additionalName();
case FieldImpl::Prefix:
return a.prefix();
case FieldImpl::Suffix:
return a.suffix();
case FieldImpl::NickName:
return a.nickName();
case FieldImpl::Mailer:
return a.mailer();
case FieldImpl::Title:
return a.title();
case FieldImpl::Role:
return a.role();
case FieldImpl::Organization:
return a.organization();
case FieldImpl::Note:
return a.note();
case FieldImpl::Email:
return a.preferredEmail();
case FieldImpl::Birthday:
if ( a.birthday().isValid() ) {
//the generated code had the following format: return a.birthday().date().toString( Qt::ISODate );
// But Qt::IsoDate was not specified.
// QString _oldFormat = KGlobal::locale()->dateFormat();
// KGlobal::locale()->setDateFormat("%Y-%m-%d"); // = Qt::ISODate
QString dt = KGlobal::locale()->formatDate(a.birthday().date(), false, KLocale::ISODate);
// KGlobal::locale()->setDateFormat(_oldFormat);
return dt;
}
else
return QString::null;
case FieldImpl::Url:
return a.url().prettyURL();
//US
case FieldImpl::Resource:
return a.resource()->resourceName();
case FieldImpl::Category:
return a.categories().join(",");
case FieldImpl::HomePhone:
return a.phoneNumber( PhoneNumber::Home| PhoneNumber::Pref ).number();
case FieldImpl::BusinessPhone:
return a.phoneNumber( PhoneNumber::Work| PhoneNumber::Pref ).number();
case FieldImpl::MobilePhone:
return a.phoneNumber( PhoneNumber::Cell ).number();
case FieldImpl::MobileWorkPhone:
return a.phoneNumber( PhoneNumber::Car ).number();
case FieldImpl::HomeFax:
return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number();
case FieldImpl::BusinessFax:
return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number();
case FieldImpl::Isdn:
return a.phoneNumber( PhoneNumber::Isdn ).number();
case FieldImpl::Pager:
return a.phoneNumber( PhoneNumber::Pager ).number();
case FieldImpl::Sip:
return a.phoneNumber( PhoneNumber::Pcs | PhoneNumber::Pref ).number();
case FieldImpl::OtherPhone:
return a.phoneNumber( PhoneNumber::Voice ).number();
case FieldImpl::HomeAddressStreet:
return a.address( Address::Home ).street();
case FieldImpl::HomeAddressLocality:
return a.address( Address::Home ).locality();
case FieldImpl::HomeAddressRegion:
return a.address( Address::Home ).region();
case FieldImpl::HomeAddressPostalCode:
return a.address( Address::Home ).postalCode();
case FieldImpl::HomeAddressCountry:
return a.address( Address::Home ).country();
case FieldImpl::BusinessAddressStreet:
return a.address( Address::Work ).street();
case FieldImpl::BusinessAddressLocality:
return a.address( Address::Work ).locality();
case FieldImpl::BusinessAddressRegion:
return a.address( Address::Work ).region();
case FieldImpl::BusinessAddressPostalCode:
return a.address( Address::Work ).postalCode();
case FieldImpl::BusinessAddressCountry:
return a.address( Address::Work ).country();
case FieldImpl::CustomField:
return a.custom( mImpl->app(), mImpl->key() );
default:
return QString::null;
}
}
bool Field::setValue( KABC::Addressee &a, const QString &value )
{
switch ( mImpl->fieldId() ) {
case FieldImpl::FormattedName:
a.setFormattedName( value );
return true;
case FieldImpl::FamilyName:
a.setFamilyName( value );
return true;
case FieldImpl::GivenName:
a.setGivenName( value );
return true;
case FieldImpl::AdditionalName:
a.setAdditionalName( value );
return true;
case FieldImpl::Prefix:
a.setPrefix( value );
return true;
case FieldImpl::Suffix:
a.setSuffix( value );
return true;
case FieldImpl::NickName:
a.setNickName( value );
return true;
case FieldImpl::Mailer:
a.setMailer( value );
return true;
case FieldImpl::Title:
a.setTitle( value );
return true;
case FieldImpl::Role:
a.setRole( value );
return true;
case FieldImpl::Organization:
a.setOrganization( value );
return true;
case FieldImpl::Note:
a.setNote( value );
return true;
case FieldImpl::Birthday:
//US
//the generated code had the following format: return a.setBirthday( QDate::fromString( value, Qt::ISODate ) );
// But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ?
{
QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate
- a.setBirthday(dt);
+ a.setBirthday((QDateTime)dt);
}
return true;
case FieldImpl::CustomField:
a.insertCustom( mImpl->app(), mImpl->key(), value );
//US never copy the resourcename back to the adressee.
case FieldImpl::Resource:
default:
return false;
}
}
bool Field::isCustom()
{
return mImpl->fieldId() == FieldImpl::CustomField;
}
Field::List Field::allFields()
{
if ( mAllFields.isEmpty() ) {
createField( FieldImpl::FormattedName, Frequent );
createField( FieldImpl::FamilyName, Frequent );
createField( FieldImpl::GivenName, Frequent );
createField( FieldImpl::AdditionalName );
createField( FieldImpl::Prefix );
createField( FieldImpl::Suffix );
createField( FieldImpl::NickName, Personal );
createField( FieldImpl::Birthday, Personal );
createField( FieldImpl::Category );
createField( FieldImpl::HomeAddressStreet, Address|Personal );
createField( FieldImpl::HomeAddressLocality, Address|Personal );
createField( FieldImpl::HomeAddressRegion, Address|Personal );
createField( FieldImpl::HomeAddressPostalCode, Address|Personal );
createField( FieldImpl::HomeAddressCountry, Address|Personal );
createField( FieldImpl::HomeAddressLabel, Address|Personal );
createField( FieldImpl::BusinessAddressStreet, Address|Organization );
createField( FieldImpl::BusinessAddressLocality, Address|Organization );
createField( FieldImpl::BusinessAddressRegion, Address|Organization );
createField( FieldImpl::BusinessAddressPostalCode, Address|Organization );
createField( FieldImpl::BusinessAddressCountry, Address|Organization );
createField( FieldImpl::BusinessAddressLabel, Address|Organization );
createField( FieldImpl::HomePhone, Personal|Frequent );
createField( FieldImpl::BusinessPhone, Organization|Frequent );
createField( FieldImpl::MobilePhone, Frequent );
createField( FieldImpl::MobileWorkPhone, Frequent );
createField( FieldImpl::HomeFax );
createField( FieldImpl::BusinessFax );
createField( FieldImpl::Isdn );
createField( FieldImpl::Pager );
createField( FieldImpl::Email, Email|Frequent );
createField( FieldImpl::Mailer, Email );
createField( FieldImpl::Title, Organization );
createField( FieldImpl::Role, Organization );
createField( FieldImpl::Organization, Organization );
createField( FieldImpl::Note );
createField( FieldImpl::Url );
createField( FieldImpl::Resource );
createField( FieldImpl::Sip );
createField( FieldImpl::OtherPhone );
}
return mAllFields;
}
Field::List Field::defaultFields()
{
if ( mDefaultFields.isEmpty() ) {
createDefaultField( FieldImpl::GivenName );
createDefaultField( FieldImpl::FamilyName );
createDefaultField( FieldImpl::Email );
}
return mDefaultFields;
}
void Field::createField( int id, int category )
{
mAllFields.append( new Field( new FieldImpl( id, category ) ) );
}
void Field::createDefaultField( int id, int category )
{
mDefaultFields.append( new Field( new FieldImpl( id, category ) ) );
}
void Field::deleteFields()
{
Field::List::ConstIterator it;
for( it = mAllFields.begin(); it != mAllFields.end(); ++it ) {
delete (*it);
}
mAllFields.clear();
for( it = mDefaultFields.begin(); it != mDefaultFields.end(); ++it ) {
delete (*it);
}
mDefaultFields.clear();
for( it = mCustomFields.begin(); it != mCustomFields.end(); ++it ) {
delete (*it);
}
mCustomFields.clear();
}
void Field::saveFields( const QString &identifier,
const Field::List &fields )
{
KConfig *cfg = KGlobal::config();
KConfigGroupSaver( cfg, "KABCFields" );
saveFields( cfg, identifier, fields );
}
void Field::saveFields( KConfig *cfg, const QString &identifier,
const Field::List &fields )
{
- QValueList<int> fieldIds;
+ Q3ValueList<int> fieldIds;
//US
// qDebug("Field::saveFields to %s %s", cfg->getFileName().latin1(), identifier.latin1());
int custom = 0;
Field::List::ConstIterator it;
for( it = fields.begin(); it != fields.end(); ++it ) {
//US
// qDebug("Field::saveFields field:%i", (*it)->mImpl->fieldId());
fieldIds.append( (*it)->mImpl->fieldId() );
if( (*it)->isCustom() ) {
QStringList customEntry;
customEntry << (*it)->mImpl->label();
customEntry << (*it)->mImpl->key();
customEntry << (*it)->mImpl->app();
cfg->writeEntry( "KABC_CustomEntry_" + identifier + "_" +
QString::number( custom++ ), customEntry );
}
}
cfg->writeEntry( identifier, fieldIds );
}
Field::List Field::restoreFields( const QString &identifier )
{
//US
// qDebug("Field::restoreFields, identifier: %s", identifier.latin1());
KConfig *cfg = KGlobal::config();
KConfigGroupSaver( cfg, "KABCFields" );
cfg->setGroup( "KABCFields" );
Field::List l = restoreFields( cfg, identifier );
return l;
}
Field::List Field::restoreFields( KConfig *cfg, const QString &identifier )
{
- QValueList<int> fieldIds = cfg->readIntListEntry( identifier);
+ Q3ValueList<int> fieldIds = cfg->readIntListEntry( identifier);
//US
// qDebug("Field::restoreFields from %s, identifier: %s", cfg->getFileName().latin1(), identifier.latin1());
Field::List fields;
int custom = 0;
- QValueList<int>::ConstIterator it;
+ Q3ValueList<int>::ConstIterator it;
for( it = fieldIds.begin(); it != fieldIds.end(); ++it ) {
FieldImpl *f = 0;
if ( (*it) == FieldImpl::CustomField ) {
QStringList customEntry = cfg->readListEntry( "KABC_CustomEntry_" +
identifier + "_" +
QString::number( custom++ ) );
f = new FieldImpl( *it, CustomCategory, customEntry[ 0 ],
customEntry[ 1 ], customEntry[ 2 ] );
} else {
f = new FieldImpl( *it );
}
fields.append( new Field( f ) );
}
return fields;
}
bool Field::equals( Field *field )
{
bool sameId = ( mImpl->fieldId() == field->mImpl->fieldId() );
if ( !sameId ) return false;
if ( mImpl->fieldId() != FieldImpl::CustomField ) return true;
return mImpl->key() == field->mImpl->key();
}
Field *Field::createCustomField( const QString &label, int category,
const QString &key, const QString &app )
{
Field *field = new Field( new FieldImpl( FieldImpl::CustomField,
category | CustomCategory,
label, key, app ) );
//US
// qDebug("Field::createCustomField label %s", label.latin1() );
mCustomFields.append( field );
return field;
}
diff --git a/kabc/field.h b/kabc/field.h
index 9e06597..55cc705 100644
--- a/kabc/field.h
+++ b/kabc/field.h
@@ -1,178 +1,178 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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$
*/
#ifndef KABC_FIELD_H
#define KABC_FIELD_H
#include <qstring.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include "addressee.h"
class KConfig;
namespace KABC {
class Field
{
class FieldImpl;
friend class FieldImpl;
public:
- typedef QValueList<Field *> List;
+ typedef Q3ValueList<Field *> List;
/**
* @li @p All -
* @li @p Frequent -
* @li @p Address -
* @li @p Email -
* @li @p Personal -
* @li @p Organization -
* @li @p CustomCategory -
*/
enum FieldCategory
{
All = 0x0,
Frequent = 0x01,
Address = 0x02,
Email = 0x04,
Personal = 0x08,
Organization = 0x10,
CustomCategory = 0x20
};
/**
* Returns the translated label for this field.
*/
virtual QString label();
/**
* Returns the ored categories the field belongs to.
*/
virtual int category();
/**
* Returns the translated label for field category.
*/
static QString categoryLabel( int category );
/**
* Returns a string representation of the value the field has in the given
* Addressee. Returns QString::null, if it is not possible to convert the
* value to a string.
*/
virtual QString value( const KABC::Addressee & );
/**
* Sets the value of the field in the given Addressee. Returns true on success
* or false, if the given string couldn't be converted to a valid value.
*/
virtual bool setValue( KABC::Addressee &, const QString & );
/**
* Returns, if the field is a user-defined field.
*/
virtual bool isCustom();
/**
* Returns, if the field is equal with @param field.
*/
virtual bool equals( Field *field );
/**
* Returns a list of all fields.
*/
static Field::List allFields();
/**
* Returns a list of the default fields.
*/
static Field::List defaultFields();
/**
* Creates a custom field.
*
* @param label The label for this field
* @param category The category of this field
* @param key Unique key for this field
* @param app Unique app name for this field
*/
static Field *createCustomField( const QString &label, int category,
const QString &key, const QString &app );
/**
* Delete all fields from list.
*/
static void deleteFields();
/**
* Save the field settings to a config file.
*
* @param cfg The config file object
* @param identifier The unique identifier
* @param fields The list of the fields
*/
static void saveFields( KConfig *cfg, const QString &identifier,
const Field::List &fields );
/**
* This is the same as above, with the difference, that
* the list is stored in KGlobal::config() in group "KABCFields".
*/
static void saveFields( const QString &identifier,
const Field::List &fields );
/**
* Load the field settings from a config file.
*
* @param cfg The config file object
* @param identifier The unique identifier
*/
static Field::List restoreFields( KConfig *cfg, const QString &identifier );
/**
* This is the same as above, with the difference, that
* the list is loaded from KGlobal::config() from group "KABCFields".
*/
static Field::List restoreFields( const QString &identifier );
protected:
static void createField( int id, int category = 0 );
static void createDefaultField( int id, int category = 0 );
private:
Field( FieldImpl * );
virtual ~Field();
FieldImpl *mImpl;
static Field::List mAllFields;
static Field::List mDefaultFields;
static Field::List mCustomFields;
};
}
#endif
diff --git a/kabc/formatfactory.cpp b/kabc/formatfactory.cpp
index 3ae1c27..cbb97a2 100644
--- a/kabc/formatfactory.cpp
+++ b/kabc/formatfactory.cpp
@@ -1,181 +1,181 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#include <kdebug.h>
#include <klocale.h>
#include <ksimpleconfig.h>
#include <kstandarddirs.h>
#include <kstaticdeleter.h>
#include <qfile.h>
#include <qstringlist.h>
#include "vcardformatplugin.h"
#include "formatfactory.h"
using namespace KABC;
FormatFactory *FormatFactory::mSelf = 0;
static KStaticDeleter<FormatFactory> factoryDeleter;
FormatFactory *FormatFactory::self()
{
if ( !mSelf ) {
//US factoryDeleter.setObject( mSelf, new FormatFactory );
mSelf = factoryDeleter.setObject( new FormatFactory );
}
return mSelf;
}
FormatFactory::FormatFactory()
{
mFormatList.setAutoDelete( true );
// dummy entry for default format
FormatInfo *info = new FormatInfo;
info->library = "<NoLibrary>";
info->nameLabel = i18n( "vCard" );
info->descriptionLabel = i18n( "vCard Format" );
mFormatList.insert( "vcard", info );
#if 0
US lets enter all resources directly instead of using teh desktopfiles.
QStringList list = KGlobal::dirs()->findAllResources( "data" ,"kabc/formats/*.desktop", true, true );
for ( QStringList::ConstIterator it = list.begin(); it != list.end(); ++it )
{
//US KSimpleConfig config( *it, true );
KConfig config( *it );
if ( !config.hasGroup( "Misc" ) || !config.hasGroup( "Plugin" ) )
continue;
info = new FormatInfo;
config.setGroup( "Plugin" );
QString type = config.readEntry( "Type" );
info->library = config.readEntry( "X-KDE-Library" );
config.setGroup( "Misc" );
info->nameLabel = config.readEntry( "Name" );
info->descriptionLabel = config.readEntry( "Comment", i18n( "No description available." ) );
mFormatList.insert( type, info );
}
#endif
//US we already have vcard as default format.
info = new FormatInfo;
info->library = i18n("microkabcformat_binary");
info->nameLabel = i18n( "Binary" );
info->descriptionLabel = i18n( "No description available." );
mFormatList.insert( "binary", info );
}
FormatFactory::~FormatFactory()
{
mFormatList.clear();
}
QStringList FormatFactory::formats()
{
QStringList retval;
// make sure 'vcard' is the first entry
retval << "vcard";
- QDictIterator<FormatInfo> it( mFormatList );
+ Q3DictIterator<FormatInfo> it( mFormatList );
for ( ; it.current(); ++it )
if ( it.currentKey() != "vcard" )
retval << it.currentKey();
return retval;
}
FormatInfo *FormatFactory::info( const QString &type )
{
if ( type.isEmpty() )
return 0;
else
return mFormatList[ type ];
}
FormatPlugin *FormatFactory::format( const QString& type )
{
FormatPlugin *format = 0;
if ( type.isEmpty() )
return 0;
if ( type == "vcard" ) {
format = new VCardFormatPlugin;
format->setType( type );
format->setNameLabel( i18n( "vCard" ) );
format->setDescriptionLabel( i18n( "vCard Format" ) );
return format;
}
FormatInfo *fi = mFormatList[ type ];
if (!fi)
return 0;
QString libName = fi->library;
#ifndef DESKTOP_VERSION
KLibrary *library = openLibrary( libName );
if ( !library )
return 0;
void *format_func = library->symbol( "format");
if ( format_func ) {
format = ((FormatPlugin* (*)())format_func)();
format->setType( type );
format->setNameLabel( fi->nameLabel );
format->setDescriptionLabel( fi->descriptionLabel );
} else {
kdDebug( 5700 ) << "'" << libName << "' is not a format plugin." << endl;
return 0;
}
#endif
return format;
}
#ifndef DESKTOP_VERSION
KLibrary *FormatFactory::openLibrary( const QString& libName )
{
KLibrary *library = 0;
QString path = KLibLoader::findLibrary( QFile::encodeName( libName ) );
if ( path.isEmpty() ) {
kdDebug( 5700 ) << "No format plugin library was found!" << endl;
return 0;
}
library = KLibLoader::self()->library( QFile::encodeName( path ) );
if ( !library ) {
kdDebug( 5700 ) << "Could not load library '" << libName << "'" << endl;
return 0;
}
return library;
}
#endif
diff --git a/kabc/formatfactory.h b/kabc/formatfactory.h
index 9612374..de15b17 100644
--- a/kabc/formatfactory.h
+++ b/kabc/formatfactory.h
@@ -1,104 +1,104 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#ifndef KABC_FORMATFACTORY_H
#define KABC_FORMATFACTORY_H
-#include <qdict.h>
+#include <q3dict.h>
#include <qstring.h>
#include <kconfig.h>
#ifndef DESKTOP_VERSION
#include <klibloader.h>
#endif
#include "formatplugin.h"
namespace KABC {
struct FormatInfo
{
QString library;
QString nameLabel;
QString descriptionLabel;
};
/**
* Class for loading format plugins.
*
* Example:
*
* <pre>
* KABC::FormatFactory *factory = KABC::FormatFactory::self();
*
* QStringList list = factory->formats();
* QStringList::Iterator it;
* for ( it = list.begin(); it != list.end(); ++it ) {
* KABC::FormatPlugin *format = factory->format( (*it) );
* // do something with format
* }
* </pre>
*/
class FormatFactory
{
public:
/**
Destructor.
*/
~FormatFactory();
/**
* Returns the global format factory.
*/
static FormatFactory *self();
/**
* Returns a pointer to a format object or a null pointer
* if format type doesn't exist.
*
* @param type The type of the format, returned by @ref formats()
*/
FormatPlugin *format( const QString &type );
/**
* Returns a list of all available format types.
*/
QStringList formats();
/**
* Returns the info structure for a special type.
*/
FormatInfo *info( const QString &type );
protected:
FormatFactory();
private:
#ifndef DESKTOP_VERSION
KLibrary *openLibrary( const QString& libName );
#endif
static FormatFactory *mSelf;
- QDict<FormatInfo> mFormatList;
+ Q3Dict<FormatInfo> mFormatList;
};
}
#endif
diff --git a/kabc/formats/binary/kabcformat_binaryE.pro b/kabc/formats/binary/kabcformat_binaryE.pro
index 2d9594d..c71197e 100644
--- a/kabc/formats/binary/kabcformat_binaryE.pro
+++ b/kabc/formats/binary/kabcformat_binaryE.pro
@@ -1,21 +1,21 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#release debug
TARGET = microkabcformat_binary
#INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../qtcompat
INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../qtcompat
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc
DESTDIR = $(QPEDIR)/lib
-LIBS += -lmicrokde -lmicrokabc
+LIBS += -lxmicrokde -lxmicrokabc
LIBS += -L$(QPEDIR)/lib
DEFINES += KAB_EMBEDDED
INTERFACES = \
HEADERS = \
binaryformat.h
SOURCES = \
binaryformat.cpp
diff --git a/kabc/formats/vcardformatplugin2.cpp b/kabc/formats/vcardformatplugin2.cpp
index 41b0c9a..fbebe92 100644
--- a/kabc/formats/vcardformatplugin2.cpp
+++ b/kabc/formats/vcardformatplugin2.cpp
@@ -1,124 +1,124 @@
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include "vcardformatplugin2.h"
#include "address.h"
#include "addressee.h"
#include "vcardparser/vcardtool.h"
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qfile.h>
using namespace KABC;
extern "C"
{
FormatPlugin *format()
{
return new VCardFormatPlugin2();
}
}
VCardFormatPlugin2::VCardFormatPlugin2()
{
}
VCardFormatPlugin2::~VCardFormatPlugin2()
{
}
bool VCardFormatPlugin2::load( Addressee &addressee, QFile *file )
{
qDebug("VCardFormatPlugin2::load");
QString data;
- QTextStream t( file );
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream t( file );
+ t.setEncoding( Q3TextStream::UnicodeUTF8 );
data = t.read();
VCardTool tool;
Addressee::List l = tool.parseVCards( data );
if ( ! l.first().isEmpty() ) {
addressee = l.first();
return true;
}
return false;
}
bool VCardFormatPlugin2::loadAll( AddressBook *addressBook, Resource *resource, QFile *file )
{
qDebug("VCardFormatPlugin2::loadAll");
QString data;
- QTextStream t( file );
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream t( file );
+ t.setEncoding( Q3TextStream::UnicodeUTF8 );
data = t.read();
VCardTool tool;
Addressee::List l = tool.parseVCards( data );
Addressee::List::Iterator itr;
for ( itr = l.begin(); itr != l.end(); ++itr) {
Addressee addressee = *itr;
addressee.setResource( resource );
addressBook->insertAddressee( addressee );
}
return true;
}
void VCardFormatPlugin2::save( const Addressee &addressee, QFile *file )
{
qDebug("VCardFormatPlugin2::save");
VCardTool tool;
Addressee::List vcardlist;
vcardlist.append( addressee );
- QTextStream t( file );
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream t( file );
+ t.setEncoding( Q3TextStream::UnicodeUTF8 );
t << tool.createVCards( vcardlist );
}
void VCardFormatPlugin2::saveAll( AddressBook *ab, Resource *resource, QFile *file )
{
qDebug("VCardFormatPlugin2::saveAll");
VCardTool tool;
Addressee::List vcardlist;
AddressBook::Iterator it;
for ( it = ab->begin(); it != ab->end(); ++it ) {
if ( (*it).resource() == resource ) {
(*it).setChanged( false );
vcardlist.append( *it );
}
}
- QTextStream t( file );
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream t( file );
+ t.setEncoding( Q3TextStream::UnicodeUTF8 );
t << tool.createVCards( vcardlist );
}
bool VCardFormatPlugin2::checkFormat( QFile *file ) const
{
QString line;
- file->readLine( line, 1024 );
+ char tmp[1024]; file->readLine( tmp, 1024 ); line = tmp;
line = line.stripWhiteSpace();
if ( line == "BEGIN:VCARD" )
return true;
else
return false;
}
diff --git a/kabc/kabc.pro b/kabc/kabc.pro
index 17ebff8..846ed8a 100644
--- a/kabc/kabc.pro
+++ b/kabc/kabc.pro
@@ -1,218 +1,222 @@
TEMPLATE = lib
CONFIG += qt warn_on
#release debug
DESTDIR=../bin
-TARGET = microkabc
+TARGET = xmicrokabc
include( ../variables.pri )
INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim ../qtcompat ../microkde/kdeui ..
-#LIBS += -lmicrokde -lldap
+#LIBS += -lxmicrokde -lldap
LIBS += -L$(QPEDIR)/lib
DEFINES += KAB_EMBEDDED DESKTOP_VERSION
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
INTERFACES = \
HEADERS = \
resource.h \
stdaddressbook.h \
agent.h \
geo.h \
key.h \
field.h \
plugin.h \
address.h \
addresseelist.h \
addresseeview.h \
formatfactory.h \
formatplugin.h \
phonenumber.h \
distributionlist.h \
distributionlistdialog.h \
distributionlisteditor.h \
vcardformatplugin.h \
formats/vcardformatplugin2.h \
picture.h \
secrecy.h \
sound.h \
addressbook.h \
timezone.h \
tmpaddressbook.h \
addressee.h \
addresseedialog.h \
vcardconverter.h \
vcard21parser.h \
vcardformatimpl.h \
plugins/file/resourcefile.h \
plugins/file/resourcefileconfig.h \
plugins/dir/resourcedir.h \
plugins/dir/resourcedirconfig.h \
vcardparser/vcardline.h \
vcardparser/vcard.h \
vcardparser/vcardtool.h \
vcardparser/vcardparser.h \
vcard/include/VCardAdrParam.h \
vcard/include/VCardAdrValue.h \
vcard/include/VCardAgentParam.h \
vcard/include/VCardContentLine.h \
vcard/include/VCardDateParam.h \
vcard/include/VCardDateValue.h \
vcard/include/VCardEmailParam.h \
vcard/include/VCardGeoValue.h \
vcard/include/VCardGroup.h \
vcard/include/VCardImageParam.h \
vcard/include/VCardImageValue.h \
vcard/include/VCardLangValue.h \
vcard/include/VCardNValue.h \
vcard/include/VCardParam.h \
vcard/include/VCardPhoneNumberValue.h \
vcard/include/VCardSourceParam.h \
vcard/include/VCardTelParam.h \
vcard/include/VCardTextParam.h \
vcard/include/VCardTextValue.h \
vcard/include/VCardTextBinParam.h \
vcard/include/VCardURIValue.h \
vcard/include/VCardVCard.h \
vcard/include/VCardEntity.h \
vcard/include/VCardValue.h \
vcard/include/VCardSoundValue.h \
vcard/include/VCardAgentValue.h \
vcard/include/VCardTelValue.h \
vcard/include/VCardTextBinValue.h \
vcard/include/VCardOrgValue.h \
vcard/include/VCardUTCValue.h \
vcard/include/VCardClassValue.h \
vcard/include/VCardFloatValue.h \
vcard/include/VCardTextListValue.h \
vcard/include/generated/AdrParam-generated.h \
vcard/include/generated/AdrValue-generated.h \
vcard/include/generated/AgentParam-generated.h \
vcard/include/generated/ContentLine-generated.h \
vcard/include/generated/DateParam-generated.h \
vcard/include/generated/DateValue-generated.h \
vcard/include/generated/EmailParam-generated.h \
vcard/include/generated/GeoValue-generated.h \
vcard/include/generated/Group-generated.h \
vcard/include/generated/ImageParam-generated.h \
vcard/include/generated/ImageValue-generated.h \
vcard/include/generated/LangValue-generated.h \
vcard/include/generated/NValue-generated.h \
vcard/include/generated/Param-generated.h \
vcard/include/generated/PhoneNumberValue-generated.h \
vcard/include/generated/SourceParam-generated.h \
vcard/include/generated/TelParam-generated.h \
vcard/include/generated/TextParam-generated.h \
vcard/include/generated/TextNSParam-generated.h \
vcard/include/generated/TextValue-generated.h \
vcard/include/generated/TextBinParam-generated.h \
vcard/include/generated/URIValue-generated.h \
vcard/include/generated/VCard-generated.h \
vcard/include/generated/VCardEntity-generated.h \
vcard/include/generated/Value-generated.h \
vcard/include/generated/SoundValue-generated.h \
vcard/include/generated/AgentValue-generated.h \
vcard/include/generated/TelValue-generated.h \
vcard/include/generated/TextBinValue-generated.h \
vcard/include/generated/OrgValue-generated.h \
vcard/include/generated/UTCValue-generated.h \
vcard/include/generated/ClassValue-generated.h \
vcard/include/generated/FloatValue-generated.h \
vcard/include/generated/TextListValue-generated.h
# plugins/ldap/resourceldap.h \
# plugins/ldap/resourceldapconfig.h \
#formats/binary/binaryformat.h \
#vcard/include/VCardTextNSParam.h \
SOURCES = \
distributionlist.cpp \
distributionlistdialog.cpp \
distributionlisteditor.cpp \
vcardformatplugin.cpp \
formats/vcardformatplugin2.cpp \
formatfactory.cpp \
resource.cpp \
stdaddressbook.cpp \
plugin.cpp \
agent.cpp \
geo.cpp \
key.cpp \
field.cpp \
addresseeview.cpp \
address.cpp \
phonenumber.cpp \
picture.cpp \
secrecy.cpp \
sound.cpp \
addressbook.cpp \
timezone.cpp \
tmpaddressbook.cpp \
addressee.cpp \
addresseelist.cpp \
addresseedialog.cpp \
vcardconverter.cpp \
vcard21parser.cpp \
vcardformatimpl.cpp \
plugins/file/resourcefile.cpp \
plugins/file/resourcefileconfig.cpp \
plugins/dir/resourcedir.cpp \
plugins/dir/resourcedirconfig.cpp \
vcardparser/vcardline.cpp \
vcardparser/vcard.cpp \
vcardparser/vcardtool.cpp \
vcardparser/vcardparser.cpp \
vcard/AdrParam.cpp \
vcard/AdrValue.cpp \
vcard/AgentParam.cpp \
vcard/ContentLine.cpp \
vcard/DateParam.cpp \
vcard/DateValue.cpp \
vcard/EmailParam.cpp \
vcard/Entity.cpp \
vcard/Enum.cpp \
vcard/GeoValue.cpp \
vcard/ImageParam.cpp \
vcard/ImageValue.cpp \
vcard/LangValue.cpp \
vcard/NValue.cpp \
vcard/Param.cpp \
vcard/PhoneNumberValue.cpp \
vcard/RToken.cpp \
vcard/SourceParam.cpp \
vcard/TelParam.cpp \
vcard/TextParam.cpp \
vcard/TextValue.cpp \
vcard/TextBinParam.cpp \
vcard/URIValue.cpp \
vcard/VCardv.cpp \
vcard/VCardEntity.cpp \
vcard/Value.cpp \
vcard/SoundValue.cpp \
vcard/AgentValue.cpp \
vcard/TelValue.cpp \
vcard/TextBinValue.cpp \
vcard/OrgValue.cpp \
vcard/UTCValue.cpp \
vcard/ClassValue.cpp \
vcard/FloatValue.cpp \
vcard/TextListValue.cpp
# plugins/ldap/resourceldap.cpp \
# plugins/ldap/resourceldapconfig.cpp \
#formats/binary/binaryformat.cpp \
+#The following line was inserted by qt3to4
+QT += xml qt3support
+#The following line was inserted by qt3to4
+QT +=
diff --git a/kabc/kabcE.pro b/kabc/kabcE.pro
index 1d28a4d..6045b68 100644
--- a/kabc/kabcE.pro
+++ b/kabc/kabcE.pro
@@ -1,196 +1,198 @@
TEMPLATE = lib
CONFIG += qt warn_on
-TARGET = microkabc
+TARGET = xmicrokabc
INCLUDEPATH += . $(KDEPIMDIR) vcard/include vcard/include/generated $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/libkdepim $(KDEPIMDIR)/qtcompat $(QPEDIR)/include
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR = $(QPEDIR)/lib
-LIBS += -lmicrokde
-LIBS += -lmicrokdepim
+LIBS += -lxmicrokde
+LIBS += -lxmicrokdepim
#LIBS += -lldap
LIBS += -L$(QPEDIR)/lib
DEFINES += KAB_EMBEDDED
#enable the following line if you want to get debugoutput while loading adresses
#DEFINES += VCARD_DEBUG
INTERFACES = \
HEADERS = \
address.h \
addressbook.h \
addressee.h \
addresseedialog.h \
addresseelist.h \
addresseeview.h \
agent.h \
distributionlist.h \
distributionlistdialog.h \
distributionlisteditor.h \
field.h \
formatfactory.h \
formatplugin.h \
geo.h \
key.h \
phonenumber.h \
picture.h \
plugin.h \
resource.h \
secrecy.h \
sound.h \
stdaddressbook.h \
timezone.h \
tmpaddressbook.h \
vcardconverter.h \
vcard21parser.h \
vcardformatimpl.h \
vcardformatplugin.h \
vcardparser/vcardline.h \
vcardparser/vcard.h \
vcardparser/vcardtool.h \
vcardparser/vcardparser.h \
vcard/include/VCardAdrParam.h \
vcard/include/VCardAdrValue.h \
vcard/include/VCardAgentParam.h \
vcard/include/VCardContentLine.h \
vcard/include/VCardDateParam.h \
vcard/include/VCardDateValue.h \
vcard/include/VCardEmailParam.h \
vcard/include/VCardGeoValue.h \
vcard/include/VCardGroup.h \
vcard/include/VCardImageParam.h \
vcard/include/VCardImageValue.h \
vcard/include/VCardLangValue.h \
vcard/include/VCardNValue.h \
vcard/include/VCardParam.h \
vcard/include/VCardPhoneNumberValue.h \
vcard/include/VCardSourceParam.h \
vcard/include/VCardTelParam.h \
vcard/include/VCardTextParam.h \
vcard/include/VCardTextNSParam.h \
vcard/include/VCardTextValue.h \
vcard/include/VCardTextBinParam.h \
vcard/include/VCardURIValue.h \
vcard/include/VCardVCard.h \
vcard/include/VCardEntity.h \
vcard/include/VCardValue.h \
vcard/include/VCardSoundValue.h \
vcard/include/VCardAgentValue.h \
vcard/include/VCardTelValue.h \
vcard/include/VCardTextBinValue.h \
vcard/include/VCardOrgValue.h \
vcard/include/VCardUTCValue.h \
vcard/include/VCardClassValue.h \
vcard/include/VCardFloatValue.h \
vcard/include/VCardTextListValue.h \
vcard/include/generated/AdrParam-generated.h \
vcard/include/generated/AdrValue-generated.h \
vcard/include/generated/AgentParam-generated.h \
vcard/include/generated/ContentLine-generated.h \
vcard/include/generated/DateParam-generated.h \
vcard/include/generated/DateValue-generated.h \
vcard/include/generated/EmailParam-generated.h \
vcard/include/generated/GeoValue-generated.h \
vcard/include/generated/Group-generated.h \
vcard/include/generated/ImageParam-generated.h \
vcard/include/generated/ImageValue-generated.h \
vcard/include/generated/LangValue-generated.h \
vcard/include/generated/NValue-generated.h \
vcard/include/generated/Param-generated.h \
vcard/include/generated/PhoneNumberValue-generated.h \
vcard/include/generated/SourceParam-generated.h \
vcard/include/generated/TelParam-generated.h \
vcard/include/generated/TextParam-generated.h \
vcard/include/generated/TextNSParam-generated.h \
vcard/include/generated/TextValue-generated.h \
vcard/include/generated/TextBinParam-generated.h \
vcard/include/generated/URIValue-generated.h \
vcard/include/generated/VCard-generated.h \
vcard/include/generated/VCardEntity-generated.h \
vcard/include/generated/Value-generated.h \
vcard/include/generated/SoundValue-generated.h \
vcard/include/generated/AgentValue-generated.h \
vcard/include/generated/TelValue-generated.h \
vcard/include/generated/TextBinValue-generated.h \
vcard/include/generated/OrgValue-generated.h \
vcard/include/generated/UTCValue-generated.h \
vcard/include/generated/ClassValue-generated.h \
vcard/include/generated/FloatValue-generated.h \
vcard/include/generated/TextListValue-generated.h
SOURCES = \
address.cpp \
addressbook.cpp \
addressee.cpp \
addresseedialog.cpp \
addresseelist.cpp \
addresseeview.cpp \
agent.cpp \
distributionlist.cpp \
distributionlistdialog.cpp \
distributionlisteditor.cpp \
field.cpp \
formatfactory.cpp \
geo.cpp \
key.cpp \
phonenumber.cpp \
picture.cpp \
plugin.cpp \
resource.cpp \
secrecy.cpp \
sound.cpp \
stdaddressbook.cpp \
timezone.cpp \
tmpaddressbook.cpp \
vcardconverter.cpp \
vcard21parser.cpp \
vcardformatimpl.cpp \
vcardformatplugin.cpp \
vcardparser/vcardline.cpp \
vcardparser/vcard.cpp \
vcardparser/vcardtool.cpp \
vcardparser/vcardparser.cpp \
vcard/AdrParam.cpp \
vcard/AdrValue.cpp \
vcard/AgentParam.cpp \
vcard/ContentLine.cpp \
vcard/DateParam.cpp \
vcard/DateValue.cpp \
vcard/EmailParam.cpp \
vcard/Entity.cpp \
vcard/Enum.cpp \
vcard/GeoValue.cpp \
vcard/ImageParam.cpp \
vcard/ImageValue.cpp \
vcard/LangValue.cpp \
vcard/NValue.cpp \
vcard/Param.cpp \
vcard/PhoneNumberValue.cpp \
vcard/RToken.cpp \
vcard/SourceParam.cpp \
vcard/TelParam.cpp \
vcard/TextParam.cpp \
vcard/TextValue.cpp \
vcard/TextBinParam.cpp \
vcard/URIValue.cpp \
vcard/VCardv.cpp \
vcard/VCardEntity.cpp \
vcard/Value.cpp \
vcard/SoundValue.cpp \
vcard/AgentValue.cpp \
vcard/TelValue.cpp \
vcard/TextBinValue.cpp \
vcard/OrgValue.cpp \
vcard/UTCValue.cpp \
vcard/ClassValue.cpp \
vcard/FloatValue.cpp \
vcard/TextListValue.cpp
# plugins/ldap/resourceldap.cpp \
# plugins/ldap/resourceldapconfig.cpp \
+#The following line was inserted by qt3to4
+QT += qt3support
diff --git a/kabc/key.h b/kabc/key.h
index 6ea5b47..313eb7d 100644
--- a/kabc/key.h
+++ b/kabc/key.h
@@ -1,155 +1,155 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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$
*/
#ifndef KABC_KEY_H
#define KABC_KEY_H
-#include <qvaluelist.h>
+#include <q3valuelist.h>
namespace KABC {
/**
* @short A class to store an encryption key.
*/
class Key
{
friend QDataStream &operator<<( QDataStream &, const Key & );
friend QDataStream &operator>>( QDataStream &, Key & );
public:
- typedef QValueList<Key> List;
- typedef QValueList<int> TypeList;
+ typedef Q3ValueList<Key> List;
+ typedef Q3ValueList<int> TypeList;
/**
* Key types
*
* @li X509 - X509 key
* @li PGP - Pretty Good Privacy key
* @li Custom - Custom or IANA conform key
*/
enum Types {
X509,
PGP,
Custom
};
/**
* Constructor.
*
* @param text The text data.
* @param type The key type, @see Types.
*/
Key( const QString &text = QString::null, int type = PGP );
/**
* Destructor.
*/
~Key();
bool operator==( const Key & ) const;
bool operator!=( const Key & ) const;
/**
* Sets the unique identifier.
*/
void setId( const QString &id );
/**
* Returns the unique identifier.
*/
QString id() const;
/**
* Sets binary data.
*/
void setBinaryData( const QByteArray &binary );
/**
* Returns the binary data.
*/
QByteArray binaryData() const;
/**
* Sets text data.
*/
void setTextData( const QString &text );
/**
* Returns the text data.
*/
QString textData() const;
/**
* Returns whether the key contains binary or text data.
*/
bool isBinary() const;
/**
* Sets the type, @see Type.
*/
void setType( int type );
/**
* Sets custom type string.
*/
void setCustomTypeString( const QString &custom );
/**
* Returns the type, @see Type.
*/
int type() const;
/**
* Returns the custom type string.
*/
QString customTypeString() const;
/**
* Returns a list of all available key types.
*/
static TypeList typeList();
/**
* Returns a translated label for a given key type.
*/
static QString typeLabel( int type );
private:
QByteArray mBinaryData;
QString mId;
QString mTextData;
QString mCustomTypeString;
int mIsBinary;
int mType;
};
QDataStream &operator<<( QDataStream &, const Key & );
QDataStream &operator>>( QDataStream &, Key & );
}
#endif
diff --git a/kabc/phonenumber.h b/kabc/phonenumber.h
index feeba6c..6bc89d3 100644
--- a/kabc/phonenumber.h
+++ b/kabc/phonenumber.h
@@ -1,173 +1,173 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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$
*/
#ifndef KABC_PHONENUMBER_H
#define KABC_PHONENUMBER_H
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <qstring.h>
namespace KABC {
/**
@short Phonenumber information.
This class provides phone number information. A phone number is classified by
a type. The following types are available, it's possible to use multiple types
@ref Types for a number by combining them through a logical or.
*/
class PhoneNumber
{
friend QDataStream &operator<<( QDataStream &, const PhoneNumber & );
friend QDataStream &operator>>( QDataStream &, PhoneNumber & );
public:
- typedef QValueList<PhoneNumber> List;
- typedef QValueList<int> TypeList;
+ typedef Q3ValueList<PhoneNumber> List;
+ typedef Q3ValueList<int> TypeList;
/**
@li @p Home - Home number
@li @p Work - Office number
@li @p Msg - Messaging
@li @p Pref - Preferred number
@li @p Voice - Voice
@li @p Fax - Fax machine
@li @p Cell - Cell phone
@li @p Video - Video phone
@li @p Bbs - Mailbox
@li @p Modem - Modem
@li @p Car - Car phone
@li @p Isdn - ISDN connection
@li @p Pcs - Personal Communication Service
@li @p Pager - Pager
*/
enum Types { Home = 1, Work = 2, Msg = 4, Pref = 8, Voice = 16, Fax = 32,
Cell = 64, Video = 128, Bbs = 256, Modem = 512, Car = 1024,
Isdn = 2048, Pcs = 4096, Pager = 8192 };
/**
Create an empty phone number object.
*/
PhoneNumber();
/**
Create a phonenumber object.
@param number Number
@param type Type as defined in enum. Multiple types can be
specified by combining them by a logical or.
*/
PhoneNumber( const QString &number, int type = Home );
/**
Destructor.
*/
~PhoneNumber();
bool operator==( const PhoneNumber & ) const;
bool operator!=( const PhoneNumber & ) const;
bool contains( const PhoneNumber &p );
/**
Sets the unique identifier.
*/
void setId( const QString &id );
/**
Returns the unique identifier.
*/
QString id() const;
/**
Sets the number.
*/
void setNumber( const QString & );
/**
Returns the number.
*/
QString number() const;
/**
Sets the type. Multiple types can be specified by combining them by
a logical or.
*/
void setType( int );
/**
Returns the type. Can be a multiple types combined by a logical or.
*/
int type() const;
/**
Returns a translated string of all types the address has.
*/
QString typeLabel() const;
/**
Returns the translated label for phone number depending on its type.
*/
QString label() const;
/**
Returns a list of all available types
*/
static TypeList typeList();
/**
Returns the translated label for phone number type.
*/
static QString typeLabel( int type );
/**
Returns the translated label for phone number type.
@obsolete
*/
static QString label( int type );
static TypeList supportedTypeList();
static QStringList supportedTypeListNames();
static int typeListIndex4Type(int type );
bool simplifyNumber();
void simplifyType();
void makeCompat();
int getCompatType( int type );
private:
void init();
QString mId;
int mType;
QString mNumber;
};
QDataStream &operator<<( QDataStream &, const PhoneNumber & );
QDataStream &operator>>( QDataStream &, PhoneNumber & );
}
#endif
diff --git a/kabc/picture.cpp b/kabc/picture.cpp
index 57aa297..0c59937 100644
--- a/kabc/picture.cpp
+++ b/kabc/picture.cpp
@@ -1,167 +1,169 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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 "picture.h"
+//Added by qt3to4:
+#include <QPixmap>
using namespace KABC;
Picture::Picture()
: mIntern( false )
{
mUndefined = true;
}
Picture::Picture( const QString &url )
: mUrl( url ), mIntern( false )
{
mUndefined = false;
}
Picture::Picture( const QImage &data )
: mData( data ), mIntern( true )
{
mUndefined = false;
}
Picture::~Picture()
{
}
bool Picture::operator==( const Picture &p ) const
{
//qDebug("compare PIC ");
if ( mUndefined && p.mUndefined ) {
//qDebug("compare PIC true 1 ");
return true;
}
if ( mUndefined || p.mUndefined ) {
//qDebug("compare PIC false 1");
return false;
}
// now we should deal with two defined pics!
if ( mIntern != p.mIntern ) {
//qDebug("compare PIC false 2");
return false;
}
if ( mIntern ) {
//qDebug("mIntern ");
if ( mData.isNull() && p.mData.isNull() ) {
//qDebug("compare PIC true 2 ");
return true;
}
if ( mData.isNull() || p.mData.isNull() ){
//qDebug("compare PIC false 3-1");
return false;
}
if ( mData != p.mData ) {
//qDebug("compare PIC false 3");
return false;
}
} else {
if ( mUrl != p.mUrl ) {
//qDebug("compare PIC false 4");
return false;
}
}
//qDebug("compare PIC true ");
return true;
}
bool Picture::operator!=( const Picture &p ) const
{
return !( p == *this );
}
void Picture::setUrl( const QString &url )
{
mUrl = url;
mIntern = false;
mUndefined = false;
}
void Picture::setData( const QImage &data )
{
mData = data;
mIntern = true;
mUndefined = false;
}
void Picture::setType( const QString &type )
{
mType = type;
}
bool Picture::isIntern() const
{
return mIntern;
}
QString Picture::url() const
{
return mUrl;
}
QImage Picture::data() const
{
return mData;
}
QPixmap Picture::pixmap() const
{
QPixmap p;
p.convertFromImage ( mData );
return p;
}
QString Picture::type() const
{
return mType;
}
bool Picture::undefined() const
{
return mUndefined;
}
QString Picture::asString() const
{
if ( mIntern )
return "intern picture";
else
return mUrl;
}
QDataStream &KABC::operator<<( QDataStream &s, const Picture &picture )
{
return s << picture.mIntern << picture.mUrl << picture.mType << picture.mData;
}
QDataStream &KABC::operator>>( QDataStream &s, Picture &picture )
{
s >> picture.mIntern >> picture.mUrl >> picture.mType >> picture.mData;
return s;
}
diff --git a/kabc/picture.h b/kabc/picture.h
index 714d1e2..1b63610 100644
--- a/kabc/picture.h
+++ b/kabc/picture.h
@@ -1,134 +1,136 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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$
*/
#ifndef KABC_PICTURE_H
#define KABC_PICTURE_H
#include <qimage.h>
+//Added by qt3to4:
+#include <QPixmap>
namespace KABC {
class Picture
{
friend QDataStream &operator<<( QDataStream &, const Picture & );
friend QDataStream &operator>>( QDataStream &, Picture & );
public:
/**
* Consturctor. Creates an empty object.
*/
Picture();
/**
* Consturctor.
*
* @param url A URL that describes the position of the picture file.
*/
Picture( const QString &url );
/**
* Consturctor.
*
* @param data The raw data of the picture.
*/
Picture( const QImage &data );
/**
* Destructor.
*/
~Picture();
bool undefined() const;
bool operator==( const Picture & ) const;
bool operator!=( const Picture & ) const;
/**
* Sets a URL for the location of the picture file. When using this
* function, @ref isIntern() will return 'false' until you use
* @ref setData().
*
* @param url The location URL of the picture file.
*/
void setUrl( const QString &url );
/**
* Sets the raw data of the picture. When using this function,
* @ref isIntern() will return 'true' until you use @ref setUrl().
*
* @param data The raw data of the picture.
*/
void setData( const QImage &data );
/**
* Sets the type of the picture.
*/
void setType( const QString &type );
/**
* Returns whether the picture is described by a URL (extern) or
* by the raw data (intern).
* When this method returns 'true' you can use @ref data() to
* get the raw data. Otherwise you can request the URL of this
* picture by @ref url() and load the raw data from that location.
*/
bool isIntern() const;
/**
* Returns the location URL of this picture.
*/
QString url() const;
/**
* Returns the raw data of this picture.
*/
QImage data() const;
QPixmap pixmap() const;
/**
* Returns the type of this picture.
*/
QString type() const;
/**
* Returns string representation of the picture.
*/
QString asString() const;
private:
QString mUrl;
QString mType;
QImage mData;
bool mUndefined;
int mIntern;
};
QDataStream &operator<<( QDataStream &, const Picture & );
QDataStream &operator>>( QDataStream &, Picture & );
}
#endif
diff --git a/kabc/plugins/dir/dir.pro b/kabc/plugins/dir/dir.pro
index 3e18594..9b3b894 100644
--- a/kabc/plugins/dir/dir.pro
+++ b/kabc/plugins/dir/dir.pro
@@ -1,36 +1,40 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#release debug
include( ../../../variables.pri )
-TARGET = microkabc_dir
+TARGET = xmicrokabc_dir
INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat
DESTDIR = ../../../bin
-#LIBS += -lmicrokde -lmicrokabc
+#LIBS += -lxmicrokde -lxmicrokabc
#LIBS += -L$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
resourcedir.h \
resourcedirconfig.h
SOURCES = \
resourcedir.cpp \
resourcedirconfig.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 += qt3support
+#The following line was inserted by qt3to4
+QT += xml
diff --git a/kabc/plugins/dir/dirE.pro b/kabc/plugins/dir/dirE.pro
index cda4e2f..75332a0 100644
--- a/kabc/plugins/dir/dirE.pro
+++ b/kabc/plugins/dir/dirE.pro
@@ -1,21 +1,21 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#release debug
-TARGET = microkabc_dir
+TARGET = xmicrokabc_dir
INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR = $(QPEDIR)/lib
-LIBS += -lmicrokde -lmicrokabc
+LIBS += -lxmicrokde -lxmicrokabc
LIBS += -L$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
resourcedir.h \
resourcedirconfig.h
SOURCES = \
resourcedir.cpp \
resourcedirconfig.cpp
diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp
index c61664b..cc4afee 100644
--- a/kabc/plugins/dir/resourcedir.cpp
+++ b/kabc/plugins/dir/resourcedir.cpp
@@ -1,381 +1,381 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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 <sys/types.h>
#include <sys/stat.h>
#ifndef _WIN32_
#include <unistd.h>
#endif
#include <qregexp.h>
#include <qtimer.h>
#include <qwidget.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
//US #include <kgenericfactory.h>
#include <kglobal.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kurlrequester.h>
#include <kmessagebox.h>
#include "addressbook.h"
#include "formatfactory.h"
#include "resourcedirconfig.h"
#include "stdaddressbook.h"
//US
#include <qdir.h>
#define NO_DIRWATCH
#include "resourcedir.h"
//#define ALLOW_LOCKING
using namespace KABC;
extern "C"
#ifdef _WIN32_
__declspec(dllexport)
#else
{
#endif
//US void *init_kabc_dir()
void *init_microkabc_dir()
{
return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>();
}
#ifndef _WIN32_
}
#endif
ResourceDir::ResourceDir( const KConfig *config )
: Resource( config )
{
QString path;
KConfig *cfg = (KConfig *)config;
if ( cfg ) {
#ifdef _WIN32_
// we use plugins on win32. the group is stored in a static variable
// such that group info not available on win32 plugins
// to fix that, it would be a looooot of work
if ( !cfg->tempGroup().isEmpty() )
cfg->setGroup( cfg->tempGroup() );
#endif
//US path = config->readEntry( "FilePath" );
path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() );
//US mFormatName = config->readEntry( "FileFormat" );
mFormatName = cfg->readEntry( "FileFormat", "vcard" );
} else {
path = StdAddressBook::directoryName();
mFormatName = "vcard";
}
FormatFactory *factory = FormatFactory::self();
mFormat = factory->format( mFormatName );
if ( !mFormat ) {
mFormatName = "vcard";
mFormat = factory->format( mFormatName );
}
/*US
//US qDebug("ResourceDir::ResourceDir initialized with format %s ", mFormatName.latin1());
if (mFormatName == "vcard")
mFormat = new VCardFormatPlugin2();
else if (mFormatName == "binary")
mFormat = new BinaryFormat();
else
qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1());
*/
#ifndef NO_DIRWATCH
connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) );
connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) );
connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) );
#endif
setPath( path );
}
ResourceDir::~ResourceDir()
{
delete mFormat;
mFormat = 0;
}
void ResourceDir::writeConfig( KConfig *config )
{
config->setGroup( "Resource_" + identifier() );
Resource::writeConfig( config );
config->writeEntry( "FilePath", mPath );
config->writeEntry( "FileFormat", mFormatName );
}
Ticket *ResourceDir::requestSaveTicket()
{
if ( !addressBook() ) return 0;
#ifdef ALLOW_LOCKING
if ( !lock( mPath ) ) {
return 0;
}
#endif
return createTicket( this );
}
bool ResourceDir::doOpen()
{
QDir dir( mPath );
if ( !dir.exists() ) { // no directory available
return dir.mkdir( dir.path() );
} else {
QString testName = dir.entryList( QDir::Files )[0];
if ( testName.isNull() || testName.isEmpty() ) // no file in directory
return true;
QFile file( mPath + "/" + testName );
- if ( file.open( IO_ReadOnly ) )
+ if ( file.open( QIODevice::ReadOnly ) )
return true;
if ( file.size() == 0 )
return true;
bool ok = mFormat->checkFormat( &file );
file.close();
return ok;
}
}
void ResourceDir::doClose()
{
}
bool ResourceDir::load()
{
QDir dir( mPath );
QStringList files = dir.entryList( QDir::Files );
QStringList::Iterator it;
bool ok = true;
for ( it = files.begin(); it != files.end(); ++it ) {
QFile file( mPath + "/" + (*it) );
- if ( !file.open( IO_ReadOnly ) ) {
+ if ( !file.open( QIODevice::ReadOnly ) ) {
addressBook()->error( i18n( "Unable to open file '%1' for reading" ).arg( file.name() ) );
ok = false;
continue;
}
if ( !mFormat->loadAll( addressBook(), this, &file ) )
ok = false;
file.close();
}
return ok;
}
bool ResourceDir::save( Ticket *ticket )
{
AddressBook::Iterator it;
bool ok = true;
#ifndef NO_DIRWATCH
mDirWatch.stopScan();
#endif
for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) {
if ( (*it).resource() != this || !(*it).changed() )
continue;
QFile file( mPath + "/" + (*it).uid() );
- if ( !file.open( IO_WriteOnly ) ) {
+ if ( !file.open( QIODevice::WriteOnly ) ) {
addressBook()->error( i18n( "Unable to open file '%1' for writing" ).arg( file.name() ) );
continue;
}
mFormat->save( *it, &file );
// mark as unchanged
(*it).setChanged( false );
file.close();
}
#ifndef NO_DIRWATCH
mDirWatch.startScan();
#endif
delete ticket;
#ifdef ALLOW_LOCKING
unlock( mPath );
#endif
return ok;
}
bool ResourceDir::lock( const QString &path )
{
#ifdef ALLOW_LOCKING
QString p = path;
//US change the implementation how the lockfilename is getting created
//US p.replace( QRegExp("/"), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + p + ".lock" );
KURL url(p);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
if ( QFile::exists( lockName ) ) return false;
QString lockUniqueName;
lockUniqueName = p + KApplication::randomString( 8 );
url = lockUniqueName;
//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
// 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;
#else
return true;
#endif
}
void ResourceDir::unlock( const QString &path )
{
#ifdef ALLOW_LOCKING
QString p = path;
//US change the implementation how the lockfilename is getting created
//US p.replace( QRegExp( "/" ), "_" );
//US QString lockName = locate( "data", "kabc/lock/" + p + ".lock" );
KURL url(p);
QString lockName = locate( "data", "kabc/lock/" + url.fileName() + ".lock" );
::unlink( QFile::encodeName( lockName ) );
QFile::remove( mLockUniqueName );
addressBook()->emitAddressBookUnlocked();
#else
return;
#endif
}
void ResourceDir::setPath( const QString &path )
{
#ifndef NO_DIRWATCH
mDirWatch.stopScan();
mDirWatch.removeDir( mPath );
mPath = path;
mDirWatch.addDir( mPath, true );
mDirWatch.startScan();
#else
mPath = path;
#endif
//US simulate KDirWatch event
//US pathChanged();
}
QString ResourceDir::path() const
{
return mPath;
}
void ResourceDir::setFormat( const QString &format )
{
mFormatName = format;
if ( mFormat )
delete mFormat;
FormatFactory *factory = FormatFactory::self();
mFormat = factory->format( mFormatName );
/*US
qDebug("ResourceDir::setFormat initialized with format %s ", format.latin1());
if (mFormatName == "vcard")
mFormat = new VCardFormatPlugin2();
else if (mFormatName == "binary")
mFormat = new BinaryFormat();
else
qDebug("ResourceDir::setFormat format unknown !!! %s ", format.latin1());
*/
}
QString ResourceDir::format() const
{
return mFormatName;
}
void ResourceDir::pathChanged()
{
if ( !addressBook() )
return;
QString text( i18n( "Dir resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( mPath ) );
if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) {
load();
addressBook()->emitAddressBookChanged();
}
}
void ResourceDir::removeAddressee( const Addressee& addr )
{
QFile::remove( mPath + "/" + addr.uid() );
}
void ResourceDir::cleanUp()
{
unlock( mPath );
}
//US #include "resourcedir.moc"
diff --git a/kabc/plugins/dir/resourcedirconfig.cpp b/kabc/plugins/dir/resourcedirconfig.cpp
index 98d18fe..8fa48d0 100644
--- a/kabc/plugins/dir/resourcedirconfig.cpp
+++ b/kabc/plugins/dir/resourcedirconfig.cpp
@@ -1,123 +1,125 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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>
//US #include "formatfactory.h"
#include "resourcedir.h"
#include "stdaddressbook.h"
#include "resourcedirconfig.h"
using namespace KABC;
ResourceDirConfig::ResourceDirConfig( QWidget* parent, const char* name )
: KRES::ConfigWidget( parent, name )
{
- QGridLayout *mainLayout = new QGridLayout( this, 2, 2, 0,
+ Q3GridLayout *mainLayout = new Q3GridLayout( this, 2, 2, 0,
KDialog::spacingHint() );
QLabel *label = new QLabel( i18n( "Format:" ), this );
mFormatBox = new KComboBox( this );
mainLayout->addWidget( label, 0, 0 );
mainLayout->addWidget( mFormatBox, 0, 1 );
label = new QLabel( i18n( "Location:" ), this );
mFileNameEdit = new KURLRequester( this );
//US mFileNameEdit->setMode( KFile::Directory );
mainLayout->addWidget( label, 1, 0 );
mainLayout->addWidget( mFileNameEdit, 1, 1 );
/*US lets hardcode the formats instead of using a factory
FormatFactory *factory = FormatFactory::self();
QStringList formats = factory->formats();
QStringList::Iterator it;
for ( it = formats.begin(); it != formats.end(); ++it ) {
FormatInfo *info = factory->info( *it );
if ( info ) {
mFormatTypes << (*it);
mFormatBox->insertItem( info->nameLabel );
}
}
*/
mFormatTypes << "vcard";
mFormatTypes << "binary";
mFormatBox->insertItem( "vcard" );
mFormatBox->insertItem( "binary" );
mInEditMode = false;
}
void ResourceDirConfig::setEditMode( bool value )
{
mFormatBox->setEnabled( !value );
mInEditMode = value;
}
void ResourceDirConfig::loadSettings( KRES::Resource *res )
{
//US ResourceDir *resource = dynamic_cast<ResourceDir*>( res );
ResourceDir *resource = (ResourceDir*)( res );
if ( !resource ) {
kdDebug(5700) << "ResourceDirConfig::loadSettings(): cast failed" << endl;
return;
}
mFormatBox->setCurrentItem( mFormatTypes.findIndex( resource->format() ) );
mFileNameEdit->setURL( resource->path() );
if ( mFileNameEdit->url().isEmpty() )
mFileNameEdit->setURL( KABC::StdAddressBook::directoryName() );
}
void ResourceDirConfig::saveSettings( KRES::Resource *res )
{
//US ResourceDir *resource = dynamic_cast<ResourceDir*>( res );
ResourceDir *resource = (ResourceDir*)( res );
if ( !resource ) {
kdDebug(5700) << "ResourceDirConfig::loadSettings(): cast failed" << endl;
return;
}
if ( mInEditMode )
resource->setFormat( mFormatTypes[ mFormatBox->currentItem() ] );
resource->setPath( mFileNameEdit->url() );
}
//US #include "resourcedirconfig.moc"
diff --git a/kabc/plugins/file/file.pro b/kabc/plugins/file/file.pro
index 2d17313..e4f1270 100644
--- a/kabc/plugins/file/file.pro
+++ b/kabc/plugins/file/file.pro
@@ -1,37 +1,41 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#release debug
include( ../../../variables.pri )
-TARGET = microkabc_file
+TARGET = xmicrokabc_file
INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat
DESTDIR = ../../../bin
-#LIBS += -lmicrokde -lmicrokabc
+#LIBS += -lxmicrokde -lxmicrokabc
#LIBS += -L$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
resourcefile.h \
resourcefileconfig.h
SOURCES = \
resourcefile.cpp \
resourcefileconfig.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 += qt3support
+#The following line was inserted by qt3to4
+QT += xml
diff --git a/kabc/plugins/file/fileE.pro b/kabc/plugins/file/fileE.pro
index 16707e5..5044cd9 100644
--- a/kabc/plugins/file/fileE.pro
+++ b/kabc/plugins/file/fileE.pro
@@ -1,21 +1,21 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#release debug
-TARGET = microkabc_file
+TARGET = xmicrokabc_file
INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR = $(QPEDIR)/lib
-LIBS += -lmicrokde -lmicrokabc
+LIBS += -lxmicrokde -lxmicrokabc
LIBS += -L$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
resourcefile.h \
resourcefileconfig.h
SOURCES = \
resourcefile.cpp \
resourcefileconfig.cpp
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index dad4571..3ed850c 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -12,474 +12,474 @@
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 <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>
#include <kmessagebox.h>
#include <kglobalsettings.h>
#include "formatfactory.h"
#include "resource.h"
#include "resourcefileconfig.h"
#include "stdaddressbook.h"
#define NO_DIRWATCH
#include "resourcefile.h"
//#define ALLOW_LOCKING
using namespace KABC;
extern "C"
#ifdef _WIN32_
__declspec(dllexport)
#else
{
#endif
//US void *init_kabc_file()
void *init_microkabc_file()
{
return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>();
}
#ifndef _WIN32_
}
#endif
ResourceFile::ResourceFile( const KConfig *config )
: Resource( config ) , mFormat( 0 )
{
QString fileName, formatName, default_fileName;
default_fileName = StdAddressBook::fileName();
mLastBackupDate = -1;
KConfig *cfg = (KConfig *)config;
if ( cfg ) {
#ifdef _WIN32_
// we use plugins on win32. the group is stored in a static variable
// such that group info not available on win32 plugins
// to fix that, it would be a looooot of work
if ( !cfg->tempGroup().isEmpty() )
cfg->setGroup( cfg->tempGroup() );
#endif
fileName = cfg->readEntry( "FileName", default_fileName );
formatName = cfg->readEntry( "FileFormat", "vcard" );
mFamily = cfg->readEntry( "ResourceName", "std" );
mLastBackupDate = cfg->readNumEntry( "LastBackupDate", 0 );
} else {
fileName = default_fileName;
formatName = "vcard";
}
init( fileName, formatName );
}
ResourceFile::ResourceFile( const QString &fileName ,
const QString &formatName )
: Resource( 0 )
{
// qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1());
mLastBackupDate = -1;
init( fileName, formatName );
}
void ResourceFile::init( const QString &fileName, const QString &formatName )
{
mFormatName = formatName;
FormatFactory *factory = FormatFactory::self();
mFormat = factory->format( mFormatName );
if ( !mFormat ) {
mFormatName = "vcard";
mFormat = factory->format( mFormatName );
}
#ifndef NO_DIRWATCH
connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
#endif
QString localKdeDir;
localKdeDir = readEnvPath("LOCALMICROKDEHOME");
if ( ! localKdeDir.isEmpty() ) {
qDebug("LOCALMICROKDEHOME is set to: %s",localKdeDir.latin1() );
QFileInfo fi ( fileName );
QString localname = localKdeDir + "/apps/kabc/" + fi.fileName ();
QFileInfo fi2 ( localname );
if ( ! fi2.exists() || mFamily == "sync_res" ) {
if ( fi.exists() && mFamily == "sync_res") {
qDebug("LOCAL mode SYNC mode using absolute file path ");
setFileName( fileName );
return;
} else {
KMessageBox::error(0,i18n("Addressbook resource file not found:\n '%1'.\nIn LOCAL mode only resource files in\n'%2'\nare supported.\n(i.e. in the dir ./apps/kabc/ relative to the kapi(.exe) binary.)\n\nIf you are starting KA/Pi for the very first time\nyou will get this error message as well.\nIt will create the missing file automatically for you.").arg(localname).arg(localKdeDir+"/apps/kabc/") );
setFileName( localname );
return;
}
} else {
qDebug("Local resource file found. Changing filename to: %s",localname.latin1() );
setFileName( localname );
return;
}
}
setFileName( fileName );
}
ResourceFile::~ResourceFile()
{
delete mFormat;
mFormat = 0;
}
void ResourceFile::writeConfig( KConfig *config )
{
config->setGroup( "Resource_" + identifier() );
Resource::writeConfig( config );
config->writeEntry( "FileName", fileName() );
config->writeEntry( "FileFormat", mFormatName );
// qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1());
}
Ticket *ResourceFile::requestSaveTicket()
{
kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl;
if ( !addressBook() ) return 0;
#ifdef ALLOW_LOCKING
if ( !lock( mFileName ) ) {
qDebug("unablt to lock file ");
return 0;
}
#endif
return createTicket( this );
}
bool ResourceFile::doOpen()
{
QFile file( fileName() );
qDebug("ResourceFile::openfile %s ", fileName().latin1());
if ( !file.exists() ) {
// try to create the file
- bool ok = file.open( IO_WriteOnly );
+ bool ok = file.open( QIODevice::WriteOnly );
if ( ok )
file.close();
return ok;
} else {
- if ( !file.open( IO_ReadWrite ) )
+ if ( !file.open( QIODevice::ReadWrite ) )
return false;
if ( file.size() < 10 ) {
file.close();
return true;
}
bool ok = mFormat->checkFormat( &file );
file.close();
return ok;
}
}
void ResourceFile::doClose()
{
}
bool ResourceFile::load()
{
QFile file( fileName() );
- if ( !file.open( IO_ReadOnly ) ) {
+ if ( !file.open( QIODevice::ReadOnly ) ) {
addressBook()->error( i18n( "Unable to open file '%1'." ).arg( fileName() ) );
return false;
}
// qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1());
return mFormat->loadAll( addressBook(), this, &file );
}
bool ResourceFile::save( Ticket *ticket )
{
// qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1());
// create backup file
QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() );
/*US we use a simpler method to create a backupfile
(void) KSaveFile::backupFile( mFileName, QString::null
,extension );
KSaveFile saveFile( mFileName );
bool ok = false;
if ( saveFile.status() == 0 && saveFile.file() )
{
mFormat->saveAll( addressBook(), this, saveFile.file() );
ok = saveFile.close();
}
*/
//US ToDo: write backupfile
#ifndef NO_DIRWATCH
mDirWatch.stopScan();
#endif
if ( mLastBackupDate >= 0 && mFamily != "sync_res") {
KConfig conf (locateLocal("config","microkdeglobalrc"));
conf.setGroup( "BackupSettings" );
bool b_enabled = conf.readBoolEntry( "BackupEnabled" );
if ( b_enabled ) {
int num = conf.readNumEntry( "BackupNumbers" );
int d_count = conf.readNumEntry( "BackupDayCount" );
bool stdDir = conf.readBoolEntry( "BackupUseDefaultDir" );
QString bupDir = conf.readEntry( "BackupDatadir" );
QDate reference ( 2000,1,1 );
int daysTo = reference.daysTo ( QDate::currentDate() );
bool saveDate = false;
if ( daysTo - d_count >= mLastBackupDate ) {
qDebug("KA: Last backup was %d days ago ", daysTo - mLastBackupDate );
if ( stdDir )
bupDir = KGlobalSettings::backupDataDir();
int retval = KApplication::createBackup( fileName(), bupDir, num );
if ( retval == 0 ) {
qDebug("KO: Backup cancelled. Will try again tomorrow ");
// retval == 0 : backup skipped for today, try again tomorrow
mLastBackupDate = daysTo - d_count+1;
saveDate = true;
} else if ( retval == 1 ){
qDebug("KO: Backup created.");
// backup ok
mLastBackupDate = daysTo;
saveDate = true;
} else if ( retval == 2 ){
qDebug("KO: Backup globally cancelled.");
// backup globally cancelled
b_enabled = false;
}
if ( !b_enabled ) {
conf.writeEntry( "mBackupEnabled", false );
}
if ( saveDate ) {
KConfig config ( locateLocal("config","kabcrc") );
config.setGroup( "Resource_" + identifier() );
config.writeEntry( "LastBackupDate", mLastBackupDate );
}
}
}
}
QFile info;
info.setName( fileName() );
- bool ok = info.open( IO_WriteOnly );
+ bool ok = info.open( QIODevice::WriteOnly );
if ( ok ) {
mFormat->saveAll( addressBook(), this, &info );
info.close();
ok = true;
}
else {
}
if ( !ok )
addressBook()->error( i18n( "Unable to save file '%1'." ).arg( fileName() ) );
#ifndef NO_DIRWATCH
mDirWatch.startScan();
#endif
delete ticket;
#ifdef ALLOW_LOCKING
unlock( mFileName );
#endif
return ok;
}
bool ResourceFile::lock( const QString &fileName )
{
#ifdef ALLOW_LOCKING
QString fn = fileName;
//US change the implementation how the lockfilename is getting created
//US fn.replace( QRegExp("/"), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
if (QFile::exists( lockName )) 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;
#else
return true;
#endif
}
void ResourceFile::unlock( const QString &fileName )
{
#ifdef ALLOW_LOCKING
QString fn = fileName;
//US change the implementation how the lockfilename is getting created
//US fn.replace( QRegExp( "/" ), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
//US QString lockName = fn + ".lock";
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
QFile::remove( lockName );
QFile::remove( mLockUniqueName );
addressBook()->emitAddressBookUnlocked();
#else
return;
#endif
}
void ResourceFile::setFileName( const QString &fileName )
{
#ifndef NO_DIRWATCH
mDirWatch.stopScan();
mDirWatch.removeFile( mFileName );
mFileName = fileName;
mDirWatch.addFile( mFileName );
mDirWatch.startScan();
#else
mFileName2 = fileName;
#endif
//US simulate KDirWatch event
//US fileChanged();
}
QString ResourceFile::fileName() const
{
return mFileName2;
}
void ResourceFile::setFormat( const QString &format )
{
mFormatName = format;
delete mFormat;
FormatFactory *factory = FormatFactory::self();
mFormat = factory->format( mFormatName );
/*US
//qDebug("ResourceFile::setFormat initialized with format %s ", format.latin1());
if (mFormatName == "vcard") {
mFormat = new VCardFormatPlugin2();
// qDebug("ResourceFile::setFormat format %s", mFormatName.latin1());
}
else if (mFormatName == "binary") {
mFormat = new BinaryFormat();
// qDebug("ResourceFile::setFormat format %s", mFormatName.latin1());
}
else
qDebug("ResourceFile::setFormat format unknown !!! %s ", format.latin1());
*/
}
QString ResourceFile::format() const
{
return mFormatName;
}
void ResourceFile::fileChanged()
{
// There is a small theoretical chance that KDirWatch calls us before
// we are fully constructed
if (!addressBook())
return;
QString text( i18n( "File resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( fileName() ) );
if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) {
load();
addressBook()->emitAddressBookChanged();
}
}
void ResourceFile::removeAddressee( const Addressee &addr )
{
QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) );
QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/logos/" ) + addr.uid() ) );
QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/sounds/" ) + addr.uid() ) );
}
void ResourceFile::cleanUp()
{
unlock( fileName() );
}
//US #include "resourcefile.moc"
diff --git a/kabc/plugins/file/resourcefileconfig.cpp b/kabc/plugins/file/resourcefileconfig.cpp
index b63775d..70b0bac 100644
--- a/kabc/plugins/file/resourcefileconfig.cpp
+++ b/kabc/plugins/file/resourcefileconfig.cpp
@@ -1,144 +1,146 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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>
#include <qfileinfo.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
#include <kdebug.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kdialog.h>
#ifndef _WIN32_
#include <unistd.h>
#endif
//US #include "formatfactory.h"
#include <qfile.h>
#include "resourcefile.h"
#include "stdaddressbook.h"
#include "resourcefileconfig.h"
using namespace KABC;
ResourceFileConfig::ResourceFileConfig( QWidget* parent, const char* name )
: ConfigWidget( parent, name )
{
//qDebug("ResourceFileConfig::ResourceFileConfig");
- QGridLayout *mainLayout = new QGridLayout( this, 2, 2, 0,
+ Q3GridLayout *mainLayout = new Q3GridLayout( this, 2, 2, 0,
KDialog::spacingHint() );
QLabel *label = new QLabel( i18n( "Format:" ), this );
mFormatBox = new KComboBox( this );
mainLayout->addWidget( label, 0, 0 );
mainLayout->addWidget( mFormatBox, 0, 1 );
label = new QLabel( i18n( "Location:" ), this );
mFileNameEdit = new KURLRequester( this );
connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ),
SLOT( checkFilePermissions( const QString & ) ) );
mainLayout->addWidget( label, 1, 0 );
mainLayout->addWidget( mFileNameEdit, 1, 1 );
/*US lets hardcode the formats instead of using a factory
FormatFactory *factory = FormatFactory::self();
QStringList formats = factory->formats();
QStringList::Iterator it;
for ( it = formats.begin(); it != formats.end(); ++it ) {
FormatInfo *info = factory->info( *it );
if ( info ) {
mFormatTypes << (*it);
mFormatBox->insertItem( info->nameLabel );
}
}
*/
mFormatTypes << "vcard";
mFormatTypes << "binary";
mFormatBox->insertItem( "vcard" );
mFormatBox->insertItem( "binary" );
mInEditMode = false;
}
void ResourceFileConfig::setEditMode( bool value )
{
mFormatBox->setEnabled( !value );
mInEditMode = value;
}
void ResourceFileConfig::loadSettings( KRES::Resource *res )
{
//US ResourceFile *resource = dynamic_cast<ResourceFile*>( res );
ResourceFile *resource = (ResourceFile*)( res );
if ( !resource ) {
kdDebug(5700) << "ResourceFileConfig::loadSettings(): cast failed" << endl;
return;
}
mFormatBox->setCurrentItem( mFormatTypes.findIndex( resource->format() ) );
mFileNameEdit->setURL( resource->fileName() );
if ( mFileNameEdit->url().isEmpty() )
mFileNameEdit->setURL( KABC::StdAddressBook::fileName() );
}
void ResourceFileConfig::saveSettings( KRES::Resource *res )
{
//US ResourceFile *resource = dynamic_cast<ResourceFile*>( res );
ResourceFile *resource = (ResourceFile*)( res );
if ( !resource ) {
kdDebug(5700) << "ResourceFileConfig::saveSettings(): cast failed" << endl;
return;
}
if ( !mInEditMode )
resource->setFormat( mFormatTypes[ mFormatBox->currentItem() ] );
resource->setFileName( mFileNameEdit->url() );
}
void ResourceFileConfig::checkFilePermissions( const QString& fileName )
{
// If file exist but is not writeable...
#ifdef _WIN32_
QFileInfo fi ( QFile::encodeName( fileName ) );
if ( fi.exists() )
emit setReadOnly(!fi.isReadable() );
#else
if ( access( QFile::encodeName( fileName ), F_OK ) == 0 )
emit setReadOnly( access( QFile::encodeName( fileName ), W_OK ) < 0 );
#endif
}
//US #include "resourcefileconfig.moc"
diff --git a/kabc/plugins/ldap/ldapE.pro b/kabc/plugins/ldap/ldapE.pro
index 57b6f84..c56d24d 100644
--- a/kabc/plugins/ldap/ldapE.pro
+++ b/kabc/plugins/ldap/ldapE.pro
@@ -1,21 +1,21 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#release debug
-TARGET = microkabc_ldap
+TARGET = xmicrokabc_ldap
INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR = $(QPEDIR)/lib
-LIBS += -lmicrokde -lmicrokabc
+LIBS += -lxmicrokde -lxmicrokabc
LIBS += -L$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
resourceldap.h \
resourceldapconfig.h
SOURCES = \
resourceldap.cpp \
resourceldapconfig.cpp
diff --git a/kabc/plugins/olaccess/olaccess.pro b/kabc/plugins/olaccess/olaccess.pro
index 9b95015..ad7e1ef 100644
--- a/kabc/plugins/olaccess/olaccess.pro
+++ b/kabc/plugins/olaccess/olaccess.pro
@@ -1,35 +1,35 @@
TEMPLATE = lib
CONFIG += qt warn_on
-TARGET = microkabc_olaccess
+TARGET = xmicrokabc_olaccess
include( ../../../variables.pri )
INCLUDEPATH += ../../.. ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat
INTERFACES = \
DESTDIR = ../../../bin
HEADERS = \
resourceolaccess.h \
resourceolaccessconfig.h \
olaccessconverter.h
SOURCES = \
resourceolaccess.cpp \
resourceolaccessconfig.cpp \
olaccessconverter.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
}
diff --git a/kabc/plugins/opie/opieE.pro b/kabc/plugins/opie/opieE.pro
index b7ecbc0..aa6b8ea 100644
--- a/kabc/plugins/opie/opieE.pro
+++ b/kabc/plugins/opie/opieE.pro
@@ -1,31 +1,31 @@
TEMPLATE = lib
CONFIG += qt warn_on
#release debug
-TARGET = microkabc_opie
+TARGET = xmicrokabc_opie
INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include $(OPIEDIR)/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 += -L$(OPIEDIR)/lib
LIBS += -lopie
LIBS += -lqpe
LIBS += -lqte
INTERFACES = \
HEADERS = \
resourceopie.h \
resourceopieconfig.h \
opieconverter.h \
SOURCES = \
resourceopie.cpp \
resourceopieconfig.cpp \
opieconverter.cpp \
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
@@ -1,673 +1,675 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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$
*/
//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
goto startover;
}
}
return dummy.join(";");
}
// FROM TT timeconversion.cpp GPLed
QDate QtopiaConverter::fromString( const QString &datestr )
{
if (datestr.isEmpty() )
return QDate();
int monthPos = datestr.find('.');
int yearPos = datestr.find('.', monthPos+1 );
if ( monthPos == -1 || yearPos == -1 ) {
return QDate();
}
int d = datestr.left( monthPos ).toInt();
int m = datestr.mid( monthPos+1, yearPos - monthPos - 1 ).toInt();
int y = datestr.mid( yearPos+1 ).toInt();
QDate date ( y,m,d );
return date;
}
QDate QtopiaConverter::dateFromString( const QString& s )
{
QDate date;
if ( s.isEmpty() )
return date;
// Be backward compatible to old Opie format:
// Try to load old format. If it fails, try new ISO-Format!
date = fromString ( s );
if ( date.isValid() )
return date;
// Read ISO-Format (YYYYMMDD)
int year = s.mid(0, 4).toInt();
int month = s.mid(4,2).toInt();
int day = s.mid(6,2).toInt();
// do some quick sanity checking
if ( year < 1900 || year > 3000 )
return date;
if ( month < 0 || month > 12 )
return date;
if ( day < 0 || day > 31 )
return date;
date.setYMD( year, month, day );
if ( !date.isValid() )
return QDate();
return date;
}
QString QtopiaConverter::dateToString( const QDate &d )
{
if ( d.isNull() || !d.isValid() )
return QString::null;
// ISO format in year, month, day (YYYYMMDD); e.g. 20021231
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 );
// Handle multiple mail addresses
QString DefaultEmail = el.attribute( "DefaultEmail" );
if ( !DefaultEmail.isEmpty() )
adr.insertEmail( DefaultEmail, true ); // preferred
QStringList Emails = QStringList::split(" ",el.attribute("Emails"));
int i;
for (i = 0;i < Emails.count();++i) {
if ( Emails[i] != DefaultEmail )
adr.insertEmail( Emails[i], false );
}
KABC::PhoneNumber homePhoneNum( el.attribute( "HomePhone" ),
KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref);
KABC::PhoneNumber homeFax( el.attribute( "HomeFax" ),
KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax );
KABC::PhoneNumber homeMobile( el.attribute( "HomeMobile" ),
KABC::PhoneNumber::Cell );
if ( !homePhoneNum.number().isEmpty() )
adr.insertPhoneNumber( homePhoneNum );
if ( !homeFax.number().isEmpty() )
adr.insertPhoneNumber( homeFax );
if ( !homeMobile.number().isEmpty() )
adr.insertPhoneNumber( homeMobile );
KABC::Address business( KABC::Address::Work );
business.setStreet( el.attribute( "BusinessStreet" ) );
business.setLocality( el.attribute( "BusinessCity" ) );
business.setRegion( el.attribute( "BusinessState" ) );
business.setPostalCode( el.attribute( "BusinessZip" ) );
business.setCountry( el.attribute( "BusinessCountry" ) );
if ( !business.isEmpty() )
adr.insertAddress( business );
KABC::Address home( KABC::Address::Home );
home.setStreet( el.attribute( "HomeStreet" ) );
home.setLocality( el.attribute( "HomeCity" ) );
home.setRegion( el.attribute( "HomeState" ) );
home.setPostalCode( el.attribute( "HomeZip" ) );
home.setCountry( el.attribute( "HomeCountry" ) );
if ( !home.isEmpty() )
adr.insertAddress( home );
adr.setNickName( el.attribute( "Nickname" ) );
adr.setNote( el.attribute( "Notes" ) );
{
QStringList categories = QStringList::split(";", el.attribute("Categories" ) );
QString cat;
QStringList added;
for ( uint i = 0; i < categories.count(); i++ ) {
cat = m_edit->categoryById( categories[ i ], "Contacts" );
// if name is not empty and we did not add the
// cat try to repair broken files
if ( !cat.isEmpty() && !added.contains( cat ) ) {
adr.insertCategory( cat );
added << cat;
}
}
}
if ( !el.attribute( "Department" ).isEmpty() )
adr.insertCustom( "KADDRESSBOOK", "X-Department", el.attribute( "Department" ) );
if ( !el.attribute( "HomeWebPage" ).isEmpty() )
adr.insertCustom( "opie", "HomeWebPage", el.attribute( "HomeWebPage" ) );
if ( !el.attribute( "Spouse" ).isEmpty() )
adr.insertCustom( "KADDRESSBOOK", "X-SpousesName", el.attribute( "Spouse" ) );
if ( !el.attribute( "Gender" ).isEmpty() ) {
if ( el.attribute( "Gender" ) == "1" )
adr.insertCustom( "KADDRESSBOOK", "X-Gender", "male" );
else if ( el.attribute( "Gender" ) == "2" )
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() )<< "\" ";
KABC::PhoneNumber businessMobile = ab.phoneNumber(KABC::PhoneNumber::Work | KABC::PhoneNumber::Cell );
*stream << "BusinessMobile=\"" << escape( businessMobile.number() ) << "\" ";
*stream << "DefaultEmail=\"" << escape( ab.preferredEmail() ) << "\" ";
QStringList list = ab.emails();
if ( list.count() > 0 ) {
QStringList::Iterator it = list.begin();
*stream << "Emails=\"" << escape( *it );
while (++it != list.end())
*stream << ' ' << escape( *it );
*stream << "\" ";
}
KABC::PhoneNumber homePhoneNum = ab.phoneNumber(KABC::PhoneNumber::Home );
*stream << "HomePhone=\"" << escape( homePhoneNum.number() ) << "\" ";
KABC::PhoneNumber homeFax = ab.phoneNumber( KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax );
*stream << "HomeFax=\"" << escape( homeFax.number() ) << "\" ";
KABC::PhoneNumber homeMobile = ab.phoneNumber( KABC::PhoneNumber::Cell );
*stream << "HomeMobile=\"" << escape( homeMobile.number() ) << "\" ";
KABC::Address business = ab.address(KABC::Address::Work );
*stream << "BusinessStreet=\"" << escape( business.street() ) << "\" ";
*stream << "BusinessCity=\"" << escape( business.locality() ) << "\" ";
*stream << "BusinessZip=\"" << escape( business.postalCode() ) << "\" ";
*stream << "BusinessCountry=\"" << escape( business.country() ) << "\" ";
*stream << "BusinessState=\"" << escape( business.region() ) << "\" ";
//stream << "BusinessPager=\"" << << "\" ";
*stream << "Office=\"" << escape( ab.custom( "KADDRESSBOOK", "X-Office" ) ) << "\" ";
*stream << "Profession=\"" << escape( ab.custom( "KADDRESSBOOK", "X-Profession" ) ) << "\" ";
*stream << "Assistant=\"" << escape( ab.custom( "KADDRESSBOOK", "X-AssistantsName") ) << "\" ";
*stream << "Manager=\"" << escape( ab.custom( "KADDRESSBOOK", "X-ManagersName" ) ) << "\" ";
KABC::Address home = ab.address( KABC::Address::Home );
*stream << "HomeStreet=\"" << escape( home.street() ) << "\" ";
*stream << "HomeCity=\"" << escape( home.locality() ) << "\" ";
*stream << "HomeState=\"" << escape( home.region() ) << "\" ";
*stream << "HomeZip=\"" << escape( home.postalCode() ) << "\" ";
*stream << "HomeCountry=\"" << escape( home.country() ) << "\" ";
*stream << "HomeWebPage=\"" << escape( ab.custom( "opie", "HomeWebPage" ) ) << "\" ";
*stream << "Spouse=\"" << escape( ab.custom( "KADDRESSBOOK", "X-SpousesName") ) << "\" ";
QString gen = "0";
if ( ab.custom( "KADDRESSBOOK", "X-Gender") == "male" )
gen = "1";
else if ( ab.custom( "KADDRESSBOOK", "X-Gender") == "female" )
gen = "2";
*stream << "Gender=\"" << escape( gen ) << "\" ";
if ( ab.birthday().date().isValid() )
*stream << "Birthday=\"" << escape( dateToString(ab.birthday().date() ) ) << "\" ";
{
QDate ann = KGlobal::locale()->readDate( ab.custom("KADDRESSBOOK", "X-Anniversary" ),
"%Y-%m-%d");
if (ann.isValid() ) {
*stream << "Anniversary=\"" << escape( dateToString( ann ) ) << "\" ";
}
}
*stream << "Nickname=\"" << escape( ab.nickName() ) << "\" ";
*stream << "Children=\"" << escape( ab.custom("KADDRESSBOOK", "X-Children" ) ) << "\" ";
*stream << "Notes=\"" << escape( ab.note() ) << "\" ";
*stream << "Categories=\"" << categoriesToNumber( ab.categories(), "Contacts") << "\" ";
QString uid = ab.uid();
*stream << "Uid=\"" << uid << "\" ";
//*stream << map.toString( "addressbook", uid );
*stream << " />" << "\n";
return true;
}
#if 0
KTempFile* AddressBook::fromKDE( KSync::AddressBookSyncee *syncee, ExtraMap& map )
{
}
QStringList AddressBook::attributes()const {
QStringList lst;
lst << "FirstName";
lst << "MiddleName";
lst << "LastName";
lst << "Suffix";
lst << "FileAs";
lst << "JobTitle";
lst << "Department";
lst << "Company";
lst << "BusinessPhone";
lst << "BusinessFax";
lst << "BusinessMobile";
lst << "DefaultEmail";
lst << "Emails";
lst << "HomePhone";
lst << "HomeFax";
lst << "HomeMobile";
lst << "BusinessStreet";
lst << "BusinessCity";
lst << "BusinessZip";
lst << "BusinessCountry";
lst << "BusinessState";
lst << "Office";
lst << "Profession";
lst << "Assistant";
lst << "Manager";
lst << "HomeStreet";
lst << "HomeCity";
lst << "HomeState";
lst << "HomeZip";
lst << "HomeCountry";
lst << "HomeWebPage";
lst << "Spouse";
lst << "Gender";
lst << "Anniversary";
lst << "Nickname";
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
*/
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;
}
return list;
}
void CategoryEdit::updateKDE( const QString& configFile, const QStringList& cats ) {
KConfig conf(configFile);
conf.setGroup("General");
QStringList avail = conf.readListEntry("Custom Categories");
for (QStringList::ConstIterator it = cats.begin(); it != cats.end(); ++it ) {
if (!avail.contains( (*it) ) )
avail << (*it);
}
conf.writeEntry("Custom Categories", avail );
}
OpieCategories::OpieCategories()
{
}
OpieCategories::OpieCategories(const QString &id, const QString &name, const QString &app )
{
m_name = name;
m_id = id;
m_app = app;
}
OpieCategories::OpieCategories(const OpieCategories &op )
{
(*this) = op;
}
QString OpieCategories::id() const
{
return m_id;
}
QString OpieCategories::name() const
{
return m_name;
}
QString OpieCategories::app() const
{
return m_app;
}
OpieCategories &OpieCategories::operator=(const OpieCategories &op )
{
m_name = op.m_name;
m_app = op.m_app;
m_id = op.m_id;
return (*this);
}
bool operator== (const OpieCategories& a, const OpieCategories &b )
{
if ( a.id() == b.id() && a.name() == b.name() && a.app() == b.app() )
return true;
return false;
}
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
@@ -1,133 +1,136 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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$
*/
#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
@@ -1,336 +1,336 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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 <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_
__declspec(dllexport)
#else
{
#endif
void *init_microkabc_qtopia()
{
return new KRES::PluginFactory<ResourceQtopia,ResourceQtopiaConfig>();
}
#ifndef _WIN32_
}
#endif
ResourceQtopia::ResourceQtopia( const KConfig *config )
: Resource( config ), mConverter (0)
{
// we can not choose the filename. Therefore use the default to display
QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml";
init( fileName );
}
ResourceQtopia::ResourceQtopia( const QString &fileName )
: Resource( 0 )
{
init( fileName );
}
void ResourceQtopia::init( const QString &fileName )
{
#ifdef _USE_DIRWATCH_
connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
#endif
setFileName( fileName );
}
ResourceQtopia::~ResourceQtopia()
{
if (mConverter != 0)
delete mConverter;
}
void ResourceQtopia::writeConfig( KConfig *config )
{
Resource::writeConfig( config );
}
Ticket *ResourceQtopia::requestSaveTicket()
{
kdDebug(5700) << "ResourceQtopia::requestSaveTicket()" << endl;
qDebug("ResourceQtopia::requestSaveTicket: %s", fileName().latin1());
if ( !addressBook() ) return 0;
if ( !lock( fileName() ) ) {
kdDebug(5700) << "ResourceQtopia::requestSaveTicket(): Unable to lock file '"
<< fileName() << "'" << endl;
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 ) ) {
+ 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;
}
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());
QString fn = fileName;
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
QFile::remove( lockName );
QFile::remove( mLockUniqueName );
addressBook()->emitAddressBookUnlocked();
}
void ResourceQtopia::setFileName( const QString &newFileName )
{
#ifdef _USE_DIRWATCH_
mDirWatch.stopScan();
#endif
mDirWatch.removeFile( fileName() );
Resource::setFileName( newFileName );
mDirWatch.addFile( fileName() );
#ifdef _USE_DIRWATCH_
mDirWatch.startScan();
#endif
}
void ResourceQtopia::fileChanged()
{
// There is a small theoretical chance that KDirWatch calls us before
// we are fully constructed
if (!addressBook())
return;
QString text( i18n( "Qtopia resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( fileName() ) );
if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) {
load();
addressBook()->emitAddressBookChanged();
}
}
void ResourceQtopia::removeAddressee( const Addressee &addr )
{
}
void ResourceQtopia::cleanUp()
{
unlock( fileName() );
}
//US #include "resourceqtopia.moc"
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
@@ -1,107 +1,109 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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() );
if ( mFileNameEdit->url().isEmpty() )
mFileNameEdit->setURL( QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml" );
//US Qtopia resources are ReadOnly by definition
emit setPersistentReadOnly( true );
//US we can not choose the filename for the qtopia backend => make it readonly.
mFileNameEdit->setEnabled( false );
}
void ResourceQtopiaConfig::saveSettings( KRES::Resource *res )
{
//US ResourceFile *resource = dynamic_cast<ResourceFile*>( res );
ResourceQtopia *resource = (ResourceQtopia*)( res );
if ( !resource ) {
kdDebug(5700) << "ResourceQtopiaConfig::saveSettings(): cast failed" << endl;
return;
}
resource->setFileName( mFileNameEdit->url() );
}
void ResourceQtopiaConfig::checkFilePermissions( const QString& fileName )
{
// If file exist but is not writeable...
/*US
if ( access( QFile::encodeName( fileName ), F_OK ) == 0 )
emit setReadOnly( access( QFile::encodeName( fileName ), W_OK ) < 0 );
*/
}
//US #include "resourceopieconfig.moc"
diff --git a/kabc/plugins/sharpdtm/sharpdtmE.pro b/kabc/plugins/sharpdtm/sharpdtmE.pro
index 23b0b76..7fc8ba8 100644
--- a/kabc/plugins/sharpdtm/sharpdtmE.pro
+++ b/kabc/plugins/sharpdtm/sharpdtmE.pro
@@ -1,35 +1,35 @@
TEMPLATE = lib
CONFIG += qt warn_on
-TARGET = microkabc_sharpdtm
+TARGET = xmicrokabc_sharpdtm
INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/kabc $(SHARPDTMSDK)/include $(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 += -lmicrokdepim
+LIBS += -lxmicrokde
+LIBS += -lxmicrokabc
+LIBS += -lxmicrokdepim
LIBS += -lmicroqtcompat
LIBS += -L$(QPEDIR)/lib
LIBS += -ljpeg
LIBS += -lqpe
LIBS += -lqte
LIBS += -lzdtm
LIBS += -lsl
INTERFACES = \
HEADERS = \
resourcesharpdtm.h \
resourcesharpdtmconfig.h \
sharpdtmconverter.h
SOURCES = \
resourcesharpdtm.cpp \
resourcesharpdtmconfig.cpp \
sharpdtmconverter.cpp
diff --git a/kabc/secrecy.h b/kabc/secrecy.h
index b2ff565..0fe956e 100644
--- a/kabc/secrecy.h
+++ b/kabc/secrecy.h
@@ -1,102 +1,102 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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$
*/
#ifndef KABC_SECRECY_H
#define KABC_SECRECY_H
-#include <qvaluelist.h>
+#include <q3valuelist.h>
namespace KABC {
class Secrecy
{
friend QDataStream &operator<<( QDataStream &, const Secrecy & );
friend QDataStream &operator>>( QDataStream &, Secrecy & );
public:
- typedef QValueList<int> TypeList;
+ typedef Q3ValueList<int> TypeList;
/**
* Secrecy types
*
* @li Public - for public access
* @li Private - only private access
* @li Confidential - access for confidential persons
*/
enum Types {
Public,
Private,
Confidential,
Invalid
};
/**
* Constructor.
*
* @param type The secrecy type, @see Types.
*/
Secrecy( int type = Public );
bool operator==( const Secrecy & ) const;
bool operator!=( const Secrecy & ) const;
/**
Returns if the Secrecy object has a valid value.
*/
bool isValid() const;
/**
* Sets the type, @see Types.
*/
void setType( int type );
/**
* Returns the type, @see Types.
*/
int type() const;
/**
* Returns a list of all available secrecy types.
*/
static TypeList typeList();
/**
* Returns a translated label for a given secrecy type.
*/
static QString typeLabel( int type );
/**
* For debug.
*/
QString asString() const;
private:
int mType;
};
}
#endif
diff --git a/kabc/sound.h b/kabc/sound.h
index 0ec5ec8..9777054 100644
--- a/kabc/sound.h
+++ b/kabc/sound.h
@@ -1,123 +1,123 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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$
*/
#ifndef KABC_SOUND_H
#define KABC_SOUND_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <qstring.h>
namespace KABC {
class Sound
{
friend QDataStream &operator<<( QDataStream &, const Sound & );
friend QDataStream &operator>>( QDataStream &, Sound & );
public:
/**
* Consturctor. Creates an empty object.
*/
Sound();
/**
* Consturctor.
*
* @param url A URL that describes the position of the sound file.
*/
Sound( const QString &url );
/**
* Consturctor.
*
* @param data The raw data of the sound.
*/
Sound( const QByteArray &data );
/**
* Destructor.
*/
~Sound();
bool operator==( const Sound & ) const;
bool operator!=( const Sound & ) const;
/**
* Sets a URL for the location of the sound file. When using this
* function, @ref isIntern() will return 'false' until you use
* @ref setData().
*
* @param url The location URL of the sound file.
*/
void setUrl( const QString &url );
/**
* Sets the raw data of the sound. When using this function,
* @ref isIntern() will return 'true' until you use @ref setUrl().
*
* @param data The raw data of the sound.
*/
void setData( const QByteArray &data );
/**
* Returns whether the sound is described by a URL (extern) or
* by the raw data (intern).
* When this method returns 'true' you can use @ref data() to
* get the raw data. Otherwise you can request the URL of this
* sound by @ref url() and load the raw data from that location.
*/
bool isIntern() const;
/**
* Returns the location URL of this sound.
*/
QString url() const;
/**
* Returns the raw data of this sound.
*/
QByteArray data() const;
/**
* Returns string representation of the sound.
*/
QString asString() const;
private:
QString mUrl;
QByteArray mData;
int mIntern;
};
QDataStream &operator<<( QDataStream &, const Sound & );
QDataStream &operator>>( QDataStream &, Sound & );
}
#endif
diff --git a/kabc/tmpaddressbook.cpp b/kabc/tmpaddressbook.cpp
index cfa57e3..5152e00 100644
--- a/kabc/tmpaddressbook.cpp
+++ b/kabc/tmpaddressbook.cpp
@@ -1,49 +1,49 @@
/*
This file is part of libkabc.
Copyright (c) 2004 Ulf Schenk
This library is free software; you can redistribute it and/or
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 <qptrlist.h>
+#include <q3ptrlist.h>
#include "tmpaddressbook.h"
using namespace KABC;
#include "resource.h"
TmpAddressBook::TmpAddressBook()
: AddressBook(0, "tmpcontact")
{
}
TmpAddressBook::TmpAddressBook( const QString &config )
: AddressBook( config, "tmpcontact" )
{
}
TmpAddressBook::~TmpAddressBook()
{
removeResources();
}
diff --git a/kabc/vcard/AdrParam.cpp b/kabc/vcard/AdrParam.cpp
index fa46499..33d358c 100644
--- a/kabc/vcard/AdrParam.cpp
+++ b/kabc/vcard/AdrParam.cpp
@@ -1,126 +1,128 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardRToken.h>
#include <VCardAdrParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
AdrParam::AdrParam()
: Param()
{
}
AdrParam::AdrParam(const AdrParam & x)
: Param(x),
adrTypeList_ (x.adrTypeList_)
{
}
-AdrParam::AdrParam(const QCString & s)
+AdrParam::AdrParam(const Q3CString & s)
: Param(s)
{
}
AdrParam &
AdrParam::operator = (AdrParam & x)
{
if (*this == x) return *this;
adrTypeList_ = x.adrTypeList();
textParam_ = x.textParam();
Param::operator = (x);
return *this;
}
AdrParam &
-AdrParam::operator = (const QCString & s)
+AdrParam::operator = (const Q3CString & s)
{
Param::operator = (s);
adrTypeList_.clear();
textParam_.truncate(0);
return *this;
}
bool
AdrParam::operator == (AdrParam & x)
{
parse();
if (!x.textParam().isEmpty())
return (x.textParam_ == textParam_);
if (x.adrTypeList().count() != adrTypeList_.count())
return false;
- QStrListIterator it(x.adrTypeList_);
+ Q3StrListIterator it(x.adrTypeList_);
for (; it.current(); ++it)
if (!adrTypeList_.find(it.current()))
return false;
return true;
}
AdrParam::~AdrParam()
{
}
void
AdrParam::_parse()
{
adrTypeList_.clear();
if (strRep_.left(4) != "TYPE") {
textParam_ = strRep_;
return;
}
if (!strRep_.contains('='))
return;
RTokenise(strRep_, ",", adrTypeList_);
}
void
AdrParam::_assemble()
{
if (!textParam_.isEmpty()) {
strRep_ = textParam_;
return;
}
- QStrListIterator it(adrTypeList_);
+ Q3StrListIterator it(adrTypeList_);
for (; it.current(); ++it) {
strRep_ += it.current();
if (it.current() != adrTypeList_.last())
strRep_ += ',';
}
}
diff --git a/kabc/vcard/AdrValue.cpp b/kabc/vcard/AdrValue.cpp
index 7ecef33..51ca12a 100644
--- a/kabc/vcard/AdrValue.cpp
+++ b/kabc/vcard/AdrValue.cpp
@@ -1,140 +1,143 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardRToken.h>
#include <VCardAdrValue.h>
#include <VCardValue.h>
#include <VCardDefines.h>
+//Added by qt3to4:
+#include <Q3StrList>
+#include <Q3CString>
using namespace VCARD;
AdrValue::AdrValue()
: Value()
{
}
AdrValue::AdrValue(const AdrValue & x)
: Value(x),
poBox_ (x.poBox_),
extAddress_ (x.extAddress_),
street_ (x.street_),
locality_ (x.locality_),
region_ (x.region_),
postCode_ (x.postCode_),
countryName_ (x.countryName_)
{
}
-AdrValue::AdrValue(const QCString & s)
+AdrValue::AdrValue(const Q3CString & s)
: Value(s)
{
}
AdrValue &
AdrValue::operator = (AdrValue & x)
{
if (*this == x) return *this;
poBox_ = x.poBox_;
extAddress_ = x.extAddress_;
street_ = x.street_;
locality_ = x.locality_;
region_ = x.region_;
postCode_ = x.postCode_;
countryName_ = x.countryName_;
Value::operator = (x);
return *this;
}
AdrValue &
-AdrValue::operator = (const QCString & s)
+AdrValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
AdrValue::operator == (AdrValue & x)
{
parse();
x.parse();
return (
poBox_ == x.poBox_ &&
extAddress_ == x.extAddress_ &&
street_ == x.street_ &&
locality_ == x.locality_ &&
region_ == x.region_ &&
postCode_ == x.postCode_ &&
countryName_ == x.countryName_);
}
AdrValue::~AdrValue()
{
}
AdrValue *
AdrValue::clone()
{
return new AdrValue( *this );
}
void
AdrValue::_parse()
{
vDebug("AdrValue::_parse()");
- QStrList l;
+ Q3StrList l;
RTokenise(strRep_, ";", l);
for (unsigned int i = 0; i < l.count(); i++) {
switch (i) {
case 0: poBox_ = l.at(0); break;
case 1: extAddress_ = l.at(1); break;
case 2: street_ = l.at(2); break;
case 3: locality_ = l.at(3); break;
case 4: region_ = l.at(4); break;
case 5: postCode_ = l.at(5); break;
case 6: countryName_ = l.at(6); break;
default: break;
}
}
}
void
AdrValue::_assemble()
{
vDebug("AdrValue::_assemble");
strRep_ = poBox_;
strRep_ += ";" + extAddress_;
strRep_ += ";" + street_;
strRep_ += ";" + locality_;
strRep_ += ";" + region_;
strRep_ += ";" + postCode_;
strRep_ += ";" + countryName_;
}
diff --git a/kabc/vcard/AgentParam.cpp b/kabc/vcard/AgentParam.cpp
index 5625e00..aae35ac 100644
--- a/kabc/vcard/AgentParam.cpp
+++ b/kabc/vcard/AgentParam.cpp
@@ -1,103 +1,105 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardAgentParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
AgentParam::AgentParam()
: Param()
{
}
AgentParam::AgentParam(const AgentParam & x)
: Param(x),
refer_ (x.refer_),
uri_ (x.uri_)
{
}
-AgentParam::AgentParam(const QCString & s)
+AgentParam::AgentParam(const Q3CString & s)
: Param(s)
{
}
AgentParam &
AgentParam::operator = (AgentParam & x)
{
if (*this == x) return *this;
refer_ = x.refer_;
uri_ = x.uri_;
Param::operator = (x);
return *this;
}
AgentParam &
-AgentParam::operator = (const QCString & s)
+AgentParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
AgentParam::operator == (AgentParam & x)
{
parse();
if (refer_)
return (x.refer() && uri_ == x.uri_);
return !x.refer();
}
AgentParam::~AgentParam()
{
}
void
AgentParam::_parse()
{
if (strRep_.isEmpty()) {
refer_ = false;
return;
}
refer_ = true;
uri_ = strRep_;
}
void
AgentParam::_assemble()
{
if (!refer_) {
strRep_.truncate(0);
return;
}
strRep_ = uri_.asString();
return;
}
diff --git a/kabc/vcard/AgentValue.cpp b/kabc/vcard/AgentValue.cpp
index bccde80..14e73b1 100644
--- a/kabc/vcard/AgentValue.cpp
+++ b/kabc/vcard/AgentValue.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardAgentValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
AgentValue::AgentValue()
: Value()
{
}
AgentValue::AgentValue(const AgentValue & x)
: Value(x)
{
}
-AgentValue::AgentValue(const QCString & s)
+AgentValue::AgentValue(const Q3CString & s)
: Value(s)
{
}
AgentValue &
AgentValue::operator = (AgentValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
AgentValue &
-AgentValue::operator = (const QCString & s)
+AgentValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
AgentValue::operator == (AgentValue & x)
{
x.parse();
return false;
}
AgentValue::~AgentValue()
{
}
void
AgentValue::_parse()
{
}
void
AgentValue::_assemble()
{
}
diff --git a/kabc/vcard/ClassValue.cpp b/kabc/vcard/ClassValue.cpp
index f01e5a6..c088d7c 100644
--- a/kabc/vcard/ClassValue.cpp
+++ b/kabc/vcard/ClassValue.cpp
@@ -1,120 +1,122 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardClassValue.h>
#include <VCardValue.h>
#include <kdebug.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
ClassValue::ClassValue()
: Value()
{
}
ClassValue::ClassValue(const ClassValue & x)
: Value(x),
classType_(x.classType_)
{
}
-ClassValue::ClassValue(const QCString & s)
+ClassValue::ClassValue(const Q3CString & s)
: Value(s)
{
}
ClassValue &
ClassValue::operator = (ClassValue & x)
{
if (*this == x) return *this;
x.parse();
classType_ = x.classType_;
Value::operator = (x);
return *this;
}
ClassValue &
-ClassValue::operator = (const QCString & s)
+ClassValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
ClassValue::operator == (ClassValue & x)
{
x.parse();
return ( classType_ == x.classType_ );
}
ClassValue::~ClassValue()
{
}
ClassValue *
ClassValue::clone()
{
return new ClassValue( *this );
}
void
ClassValue::_parse()
{
if (qstricmp(strRep_, "PUBLIC") == 0)
classType_ = Public;
else if (qstricmp(strRep_, "PRIVATE") == 0)
classType_ = Private;
else if (qstricmp(strRep_, "CONFIDENTIAL") == 0)
classType_ = Confidential;
else classType_ = Other;
}
void
ClassValue::_assemble()
{
switch (classType_) {
case Public:
strRep_ = "PUBLIC";
break;
case Private:
strRep_ = "PRIVATE";
break;
case Confidential:
strRep_ = "CONFIDENTIAL";
break;
default:
break;
}
}
diff --git a/kabc/vcard/ContentLine.cpp b/kabc/vcard/ContentLine.cpp
index 0a2f97d..1d4886c 100644
--- a/kabc/vcard/ContentLine.cpp
+++ b/kabc/vcard/ContentLine.cpp
@@ -1,355 +1,355 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <qcstring.h>
-#include <qstrlist.h>
+#include <q3cstring.h>
+#include <q3strlist.h>
#include <qregexp.h>
#include <kdebug.h>
#include <VCardAdrParam.h>
#include <VCardAgentParam.h>
#include <VCardDateParam.h>
#include <VCardEmailParam.h>
#include <VCardImageParam.h>
#include <VCardSourceParam.h>
#include <VCardTelParam.h>
#include <VCardTextBinParam.h>
#include <VCardTextParam.h>
#include <VCardAdrValue.h>
#include <VCardAgentValue.h>
#include <VCardDateValue.h>
#include <VCardImageValue.h>
#include <VCardTextValue.h>
#include <VCardTextBinValue.h>
#include <VCardLangValue.h>
#include <VCardNValue.h>
#include <VCardURIValue.h>
#include <VCardSoundValue.h>
#include <VCardClassValue.h>
#include <VCardFloatValue.h>
#include <VCardOrgValue.h>
#include <VCardTelValue.h>
#include <VCardTextListValue.h>
#include <VCardUTCValue.h>
#include <VCardGeoValue.h>
#include <VCardRToken.h>
#include <VCardContentLine.h>
#include <VCardEntity.h>
#include <VCardEnum.h>
#include <VCardDefines.h>
using namespace VCARD;
ContentLine::ContentLine()
: Entity(),
value_(0),
paramType_( ParamUnknown ),
valueType_( ValueUnknown ),
entityType_( EntityUnknown )
{
paramList_.setAutoDelete( TRUE );
}
ContentLine::ContentLine(const ContentLine & x)
: Entity(x),
group_ (x.group_),
name_ (x.name_),
/*US paramList_(x.paramList_),*/
value_(x.value_->clone()),
paramType_(x.paramType_),
valueType_(x.valueType_),
entityType_(x.entityType_)
{
paramList_.setAutoDelete( TRUE );
ParamListIterator it(x.paramList_);
for (; it.current(); ++it)
{
Param *p = new Param;
p->setName( it.current()->name() );
p->setValue( it.current()->value() );
paramList_.append(p);
}
}
-ContentLine::ContentLine(const QCString & s)
+ContentLine::ContentLine(const Q3CString & s)
: Entity(s),
value_(0),
paramType_( ParamUnknown ),
valueType_( ValueUnknown ),
entityType_( EntityUnknown )
{
paramList_.setAutoDelete( TRUE );
}
ContentLine &
ContentLine::operator = (ContentLine & x)
{
if (*this == x) return *this;
ParamListIterator it(x.paramList_);
for (; it.current(); ++it)
{
Param *p = new Param;
p->setName( it.current()->name() );
p->setValue( it.current()->value() );
paramList_.append(p);
}
value_ = x.value_->clone();
Entity::operator = (x);
return *this;
}
ContentLine &
-ContentLine::operator = (const QCString & s)
+ContentLine::operator = (const Q3CString & s)
{
Entity::operator = (s);
delete value_;
value_ = 0;
return *this;
}
bool
ContentLine::operator == (ContentLine & x)
{
x.parse();
- QPtrListIterator<Param> it(x.paramList());
+ Q3PtrListIterator<Param> it(x.paramList());
if (!paramList_.find(it.current()))
return false;
return true;
}
ContentLine::~ContentLine()
{
delete value_;
value_ = 0;
}
void
ContentLine::_parse()
{
vDebug("parse");
// Unfold folded lines
// NLR
- strRep_ = strRep_.replace( QRegExp( "\\r" ), "" );
+ strRep_ = strRep_.replace( "\\r" , "" );
// Unqote newlines
- strRep_ = strRep_.replace( QRegExp( "\\\\n" ), "\n" );
+ strRep_ = strRep_.replace( "\\\\n", "\n" );
//NLR
- strRep_ = strRep_.replace( QRegExp( "\\\\r" ), "\r" );
+ strRep_ = strRep_.replace( "\\\\r" , "\r" );
int split = strRep_.find(':');
if (split == -1) { // invalid content line
vDebug("No ':'");
return;
}
- QCString firstPart(strRep_.left(split));
- QCString valuePart(strRep_.mid(split + 1));
+ Q3CString firstPart(strRep_.left(split));
+ Q3CString valuePart(strRep_.mid(split + 1));
split = firstPart.find('.');
if (split != -1) {
group_ = firstPart.left(split);
firstPart = firstPart.mid(split + 1);
}
vDebug("Group == " + group_);
vDebug("firstPart == " + firstPart);
vDebug("valuePart == " + valuePart);
// Now we have the group, the name and param list together and the value.
- QStrList l;
+ Q3StrList l;
RTokenise(firstPart, ";", l);
if (l.count() == 0) {// invalid - no name !
vDebug("No name for this content line !");
return;
}
name_ = l.at(0);
// Now we have the name, so the rest of 'l' is the params.
// Remove the name part.
l.remove(0u);
entityType_ = EntityNameToEntityType(name_);
paramType_ = EntityTypeToParamType(entityType_);
unsigned int i = 0;
// For each parameter, create a new parameter of the correct type.
- QStrListIterator it(l);
+ Q3StrListIterator it(l);
for (; it.current(); ++it, i++) {
- QCString str = *it;
+ Q3CString str = *it;
split = str.find("=");
if (split < 0 ) {
vDebug("No '=' in paramter.");
continue;
}
- QCString paraName = str.left(split);
- QCString paraValue = str.mid(split + 1);
+ Q3CString paraName = str.left(split);
+ Q3CString paraValue = str.mid(split + 1);
- QStrList paraValues;
+ Q3StrList paraValues;
RTokenise(paraValue, ",", paraValues);
- QStrListIterator it2( paraValues );
+ Q3StrListIterator it2( paraValues );
for(; it2.current(); ++it2) {
Param *p = new Param;
p->setName( paraName );
p->setValue( *it2 );
paramList_.append(p);
}
}
// Create a new value of the correct type.
valueType_ = EntityTypeToValueType(entityType_);
// kdDebug(5710) << "valueType: " << valueType_ << endl;
switch (valueType_) {
case ValueSound: value_ = new SoundValue; break;
case ValueAgent: value_ = new AgentValue; break;
case ValueAddress: value_ = new AdrValue; break;
case ValueTel: value_ = new TelValue; break;
case ValueTextBin: value_ = new TextBinValue; break;
case ValueOrg: value_ = new OrgValue; break;
case ValueN: value_ = new NValue; break;
case ValueUTC: value_ = new UTCValue; break;
case ValueURI: value_ = new URIValue; break;
case ValueClass: value_ = new ClassValue; break;
case ValueFloat: value_ = new FloatValue; break;
case ValueImage: value_ = new ImageValue; break;
case ValueDate: value_ = new DateValue; break;
case ValueTextList: value_ = new TextListValue; break;
case ValueGeo: value_ = new GeoValue; break;
case ValueText:
case ValueUnknown:
default: value_ = new TextValue; break;
}
*value_ = valuePart;
}
void
ContentLine::_assemble()
{
//strRep_.truncate(0);
QString line;
if (!group_.isEmpty())
line = group_ + '.';
line += name_;
ParamListIterator it(paramList_);
for (; it.current(); ++it)
line += ";" + it.current()->asString();
if (value_ != 0)
line += ":" + value_->asString();
line = line.replace( QRegExp( "\r" ), "\\r" );
line = line.replace( QRegExp( "\n" ), "\\n" );
// Fold lines longer than 72 chars
const int maxLen = 72;
uint cursor = 0;
QString cut;
while( line.length() > ( cursor + 1 ) * maxLen ) {
cut += line.mid( cursor * maxLen, maxLen );
cut += "\r\n ";
++cursor;
}
cut += line.mid( cursor * maxLen );
strRep_ = cut.latin1();
//qDebug("ContentLine::_assemble()\n%s*****", strRep_.data());
#if 0
vDebug("Assemble (argl) - my name is \"" + name_ + "\"");
strRep_.truncate(0);
- QCString line;
+ Q3CString line;
if (!group_.isEmpty())
line += group_ + '.';
line += name_;
vDebug("Adding parameters");
ParamListIterator it(paramList_);
for (; it.current(); ++it)
line += ";" + it.current()->asString();
vDebug("Adding value");
if (value_ != 0)
line += ":" + value_->asString();
else
vDebug("No value");
// Quote newlines
line = line.replace( QRegExp( "\n" ), "\\n" );
// Fold lines longer than 72 chars
const int maxLen = 72;
uint cursor = 0;
while( line.length() > ( cursor + 1 ) * maxLen ) {
strRep_ += line.mid( cursor * maxLen, maxLen );
strRep_ += "\r\n ";
++cursor;
}
strRep_ += line.mid( cursor * maxLen );
qDebug("ContentLine::_assemble()\n%s*****", strRep_.data());
#endif
}
void
ContentLine::clear()
{
group_.truncate(0);
name_.truncate(0);
paramList_.clear();
delete value_;
value_ = 0;
}
diff --git a/kabc/vcard/DateParam.cpp b/kabc/vcard/DateParam.cpp
index 52af089..52fb828 100644
--- a/kabc/vcard/DateParam.cpp
+++ b/kabc/vcard/DateParam.cpp
@@ -1,82 +1,84 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardDateParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
DateParam::DateParam()
: Param()
{
}
DateParam::DateParam(const DateParam & x)
: Param(x)
{
}
-DateParam::DateParam(const QCString & s)
+DateParam::DateParam(const Q3CString & s)
: Param(s)
{
}
DateParam &
DateParam::operator = (DateParam & x)
{
if (*this == x) return *this;
Param::operator = (x);
return *this;
}
DateParam &
-DateParam::operator = (const QCString & s)
+DateParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
DateParam::operator == (DateParam & x)
{
x.parse();
return false;
}
DateParam::~DateParam()
{
}
void
DateParam::_parse()
{
}
void
DateParam::_assemble()
{
}
diff --git a/kabc/vcard/DateValue.cpp b/kabc/vcard/DateValue.cpp
index c5c5c85..87c7007 100644
--- a/kabc/vcard/DateValue.cpp
+++ b/kabc/vcard/DateValue.cpp
@@ -1,434 +1,436 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <qregexp.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <kdebug.h>
#include <VCardDefines.h>
#include <VCardDateValue.h>
#include <VCardValue.h>
using namespace VCARD;
DateValue::DateValue()
: Value()
{
vDebug("DateValue::DateValue()");
}
DateValue::DateValue(
unsigned int year,
unsigned int month,
unsigned int day,
unsigned int hour,
unsigned int minute,
unsigned int second,
double secFrac,
bool zonePositive,
unsigned int zoneHour,
unsigned int zoneMinute)
: Value (),
year_ (year),
month_ (month),
day_ (day),
hour_ (hour),
minute_ (minute),
second_ (second),
zoneHour_ (zoneHour),
zoneMinute_ (zoneMinute),
secFrac_ (secFrac),
zonePositive_ (zonePositive),
hasTime_(true)
{
parsed_ = true;
assembled_ = false;
}
DateValue::DateValue(const QDate & d)
: Value (),
year_ (d.year()),
month_ (d.month()),
day_ (d.day()),
hasTime_(false)
{
parsed_ = true;
assembled_ = false;
}
DateValue::DateValue(const QDateTime & d)
: Value (),
year_ (d.date().year()),
month_ (d.date().month()),
day_ (d.date().day()),
hour_ (d.time().hour()),
minute_ (d.time().minute()),
second_ (d.time().second()),
hasTime_(true)
{
parsed_ = true;
assembled_ = false;
}
DateValue::DateValue(const DateValue & x)
: Value(x)
{
year_ = x.year_;
month_ = x.month_;
day_ = x.day_;
hour_ = x.hour_;
minute_ = x.minute_;
second_ = x.second_;
zoneHour_ = x.zoneHour_;
zoneMinute_ = x.zoneMinute_;
secFrac_ = x.secFrac_;
hasTime_ = x.hasTime_;
}
-DateValue::DateValue(const QCString & s)
+DateValue::DateValue(const Q3CString & s)
: Value(s)
{
}
DateValue &
DateValue::operator = (DateValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
DateValue &
-DateValue::operator = (const QCString & s)
+DateValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
DateValue::operator == (DateValue & x)
{
x.parse();
return false;
}
DateValue::~DateValue()
{
}
DateValue *
DateValue::clone()
{
return new DateValue( *this );
}
void
DateValue::_parse()
{
vDebug("DateValue::_parse()");
// date = date-full-year ["-"] date-month ["-"] date-mday
// time = time-hour [":"] time-minute [":"] time-second [":"]
// [time-secfrac] [time-zone]
int timeSep = strRep_.find('T');
- QCString dateStr;
- QCString timeStr;
+ Q3CString dateStr;
+ Q3CString timeStr;
if (timeSep == -1) {
dateStr = strRep_;
vDebug("Has date string \"" + dateStr + "\"");
} else {
dateStr = strRep_.left(timeSep);
vDebug("Has date string \"" + dateStr + "\"");
timeStr = strRep_.mid(timeSep + 1);
vDebug("Has time string \"" + timeStr + "\"");
}
/////////////////////////////////////////////////////////////// DATE
- dateStr.replace(QRegExp("-"), "");
+ dateStr.replace("-", "");
kdDebug(5710) << "dateStr: " << dateStr << endl;
year_ = dateStr.left(4).toInt();
month_ = dateStr.mid(4, 2).toInt();
day_ = dateStr.right(2).toInt();
if (timeSep == -1) {
hasTime_ = false;
return; // No time, done.
}
else
hasTime_ = true;
/////////////////////////////////////////////////////////////// TIME
/////////////////////////////////////////////////////////////// ZONE
int zoneSep = timeStr.find('Z');
if (zoneSep != -1 && timeStr.length() - zoneSep > 3) {
- QCString zoneStr(timeStr.mid(zoneSep + 1));
+ Q3CString zoneStr(timeStr.mid(zoneSep + 1));
vDebug("zoneStr == " + zoneStr);
zonePositive_ = (zoneStr[0] == '+');
zoneHour_ = zoneStr.mid(1, 2).toInt();
zoneMinute_ = zoneStr.right(2).toInt();
timeStr.remove(zoneSep, timeStr.length() - zoneSep);
}
//////////////////////////////////////////////////// SECOND FRACTION
int secFracSep = timeStr.findRev(',');
if (secFracSep != -1 && zoneSep != -1) { // zoneSep checked to avoid errors.
- QCString quirkafleeg = "0." + timeStr.mid(secFracSep + 1, zoneSep);
+ Q3CString quirkafleeg = "0." + timeStr.mid(secFracSep + 1, zoneSep);
secFrac_ = quirkafleeg.toDouble();
}
/////////////////////////////////////////////////////////////// HMS
- timeStr.replace(QRegExp(":"), "");
+ timeStr.replace(":", "");
hour_ = timeStr.left(2).toInt();
minute_ = timeStr.mid(2, 2).toInt();
second_ = timeStr.mid(4, 2).toInt();
}
void
DateValue::_assemble()
{
vDebug("DateValue::_assemble");
- QCString year;
- QCString month;
- QCString day;
+ Q3CString year;
+ Q3CString month;
+ Q3CString day;
year.setNum( year_ );
month.setNum( month_ );
day.setNum( day_ );
if ( month.length() < 2 ) month.prepend( "0" );
if ( day.length() < 2 ) day.prepend( "0" );
strRep_ = year + '-' + month + '-' + day;
if ( hasTime_ ) {
- QCString hour;
- QCString minute;
- QCString second;
+ Q3CString hour;
+ Q3CString minute;
+ Q3CString second;
hour.setNum( hour_ );
minute.setNum( minute_ );
second.setNum( second_ );
if ( hour.length() < 2 ) hour.prepend( "0" );
if ( minute.length() < 2 ) minute.prepend( "0" );
if ( second.length() < 2 ) second.prepend( "0" );
strRep_ += 'T' + hour + ':' + minute + ':' + second + 'Z';
}
}
unsigned int
DateValue::year()
{
parse();
return year_;
}
unsigned int
DateValue::month()
{
parse();
return month_;
}
unsigned int
DateValue::day()
{
parse();
return day_;
}
unsigned int
DateValue::hour()
{
parse();
return hour_;
}
unsigned int
DateValue::minute()
{
parse();
return minute_;
}
unsigned int
DateValue::second()
{
parse();
return second_;
}
double
DateValue::secondFraction()
{
parse();
return secFrac_;
}
bool
DateValue::zonePositive()
{
parse();
return zonePositive_;
}
unsigned int
DateValue::zoneHour()
{
parse();
return zoneHour_;
}
unsigned int
DateValue::zoneMinute()
{
parse();
return zoneMinute_;
}
void
DateValue::setYear(unsigned int i)
{
year_ = i;
assembled_ = false;
}
void
DateValue::setMonth(unsigned int i)
{
month_ = i;
assembled_ = false;
}
void
DateValue::setDay(unsigned int i)
{
day_ = i;
assembled_ = false;
}
void
DateValue::setHour(unsigned int i)
{
hour_ = i;
assembled_ = false;
}
void
DateValue::setMinute(unsigned int i)
{
minute_ = i;
assembled_ = false;
}
void
DateValue::setSecond(unsigned int i)
{
second_ = i;
assembled_ = false;
}
void
DateValue::setSecondFraction(double d)
{
secFrac_ = d;
assembled_ = false;
}
void
DateValue::setZonePositive(bool b)
{
zonePositive_ = b;
assembled_ = false;
}
void
DateValue::setZoneHour(unsigned int i)
{
zoneHour_ = i;
assembled_ = false;
}
void
DateValue::setZoneMinute(unsigned int i)
{
zoneMinute_ = i;
assembled_ = false;
}
QDate
DateValue::qdate()
{
parse();
QDate d(year_, month_, day_);
return d;
}
QTime
DateValue::qtime()
{
parse();
QTime t(hour_, minute_, second_);
// t.setMs(1 / secFrac_);
return t;
}
QDateTime
DateValue::qdt()
{
parse();
QDateTime dt;
dt.setDate(qdate());
dt.setTime(qtime());
return dt;
}
bool
DateValue::hasTime()
{
parse();
return hasTime_;
}
diff --git a/kabc/vcard/EmailParam.cpp b/kabc/vcard/EmailParam.cpp
index 8c87477..877af60 100644
--- a/kabc/vcard/EmailParam.cpp
+++ b/kabc/vcard/EmailParam.cpp
@@ -1,116 +1,118 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardEmailParam.h>
#include <VCardParam.h>
#include <VCardDefines.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
EmailParam::EmailParam()
: Param()
{
vDebug("ctor");
}
EmailParam::EmailParam(const EmailParam & x)
: Param(x),
emailType_ (x.emailType_),
pref_ (x.pref_)
{
}
-EmailParam::EmailParam(const QCString & s)
+EmailParam::EmailParam(const Q3CString & s)
: Param(s)
{
}
EmailParam &
EmailParam::operator = (EmailParam & x)
{
if (*this == x) return *this;
emailType_ = x.emailType();
pref_ = x.pref_;
Param::operator = (x);
return *this;
}
EmailParam &
-EmailParam::operator = (const QCString & s)
+EmailParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
EmailParam::operator == (EmailParam & x)
{
parse();
if (pref_)
return (x.pref_ && x.emailType() == emailType_);
return !x.pref();
}
EmailParam::~EmailParam()
{
}
void
EmailParam::_parse()
{
#if 0
Param::parseToList();
SubParamListIterator it(subParamList_);
pref_ = true;
emailType_ = "";
for (; it.current(); ++it) {
if (qstricmp(it.current()->name(), "TYPE") == 0) {
emailType_ = it.current()->value();
continue;
}
if (qstricmp(it.current()->name(), "PREF") == 0) {
pref_ = true;
}
}
#endif
}
void
EmailParam::_assemble()
{
strRep_ = "TYPE=";
strRep_ += emailType_;
if (pref_)
strRep_ += ",PREF";
}
diff --git a/kabc/vcard/Entity.cpp b/kabc/vcard/Entity.cpp
index b7d09e0..e38fa11 100644
--- a/kabc/vcard/Entity.cpp
+++ b/kabc/vcard/Entity.cpp
@@ -1,134 +1,136 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardEntity.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
Entity::Entity()
: parsed_ (false),
assembled_ (true)
{
// empty
}
Entity::Entity(const Entity & e)
: strRep_ (e.strRep_),
parsed_ (e.parsed_),
assembled_ (e.assembled_)
{
// empty
}
-Entity::Entity(const QCString & s)
+Entity::Entity(const Q3CString & s)
: strRep_ (s),
parsed_ (false),
assembled_ (true)
{
// empty
}
Entity &
Entity::operator = (const Entity & e)
{
if (this == &e) return *this;
strRep_ = e.strRep_;
parsed_ = e.parsed_;
assembled_ = e.assembled_;
return *this;
}
Entity &
-Entity::operator = (const QCString & s)
+Entity::operator = (const Q3CString & s)
{
strRep_ = s;
parsed_ = false;
assembled_ = true;
return *this;
}
bool
Entity::operator == (Entity & e)
{
return asString() == e.asString();
}
bool
Entity::operator != (Entity & e)
{
return !(*this == e);
}
bool
-Entity::operator == (const QCString & s)
+Entity::operator == (const Q3CString & s)
{
return asString() == s;
}
bool
-Entity::operator != (const QCString & s)
+Entity::operator != (const Q3CString & s)
{
return !(*this == s);
}
Entity::~Entity()
{
// empty
}
- QCString
+ Q3CString
Entity::asString()
{
// vDebug("Entity::asString()");
assemble();
return strRep_;
}
void
Entity::parse()
{
// vDebug( "Entity::parse()" );
if (!parsed_) _parse();
parsed_ = true;
assembled_ = false;
}
void
Entity::assemble()
{
// vDebug( "Entity::assemble()" );
if (assembled_) return;
parse();
_assemble();
assembled_ = true;
}
diff --git a/kabc/vcard/Enum.cpp b/kabc/vcard/Enum.cpp
index cc48b5a..036324c 100644
--- a/kabc/vcard/Enum.cpp
+++ b/kabc/vcard/Enum.cpp
@@ -1,425 +1,425 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <qcstring.h>
+#include <q3cstring.h>
#include <ctype.h>
#include <VCardEnum.h>
using namespace VCARD;
// There are 31 possible types, not including extensions.
- const QCString
+ const Q3CString
VCARD::paramNames [] =
{
"NAME",
"PROFILE",
"SOURCE",
"FN",
"N",
"NICKNAME",
"PHOTO",
"BDAY",
"ADR",
"LABEL",
"TEL",
"EMAIL",
"MAILER",
"TZ",
"GEO",
"TITLE",
"ROLE",
"LOGO",
"AGENT",
"ORG",
"CATEGORIES",
"NOTE",
"PRODID",
"REV",
"SORT-STRING",
"SOUND",
"UID",
"URL",
"VERSION",
"CLASS",
"KEY"
};
const ParamType
VCARD::paramTypesTable[] = {
ParamNone, // NAME
ParamNone, // PROFILE
ParamSource, // SOURCE
ParamText, // FN
ParamText, // N
ParamText, // NICKNAME
ParamImage, // PHOTO (inline/refer)
ParamDate, // BDAY ("VALUE = "date-time/date)
ParamAddrText, // ADR (adr-param/text-param)
ParamAddrText, // LABEL (adr-param/text-param)
ParamTel, // TEL
ParamEmail, // EMAIL
ParamText, // MAILER
ParamNone, // TZ
ParamNone, // GEO
ParamText, // TITLE
ParamText, // ROLE
ParamImage, // LOGO
ParamAgent, // AGENT
ParamText, // ORG
ParamText, // CATEGORIES
ParamText, // NOTE
ParamNone, // PRODID
ParamDate, // REV
ParamText, // SORT-STRING
ParamSound, // SOUND
ParamNone, // UID
ParamNone, // URL
ParamNone, // VERSION
ParamNone, // CLASS
ParamTextBin, // KEY
ParamTextNS // X
};
ParamType
VCARD::EntityTypeToParamType(EntityType e)
{
ParamType t(ParamUnknown);
switch (e) {
//---------------------------------------------------------------//
case EntityAgent: t = ParamAgent; break;
//---------------------------------------------------------------//
case EntitySound: t = ParamSound; break;
//---------------------------------------------------------------//
case EntitySource: t = ParamSource; break;
//---------------------------------------------------------------//
case EntityTelephone: t = ParamTel; break;
//---------------------------------------------------------------//
case EntityEmail: t = ParamEmail; break;
//---------------------------------------------------------------//
case EntityKey: t = ParamTextBin; break;
//---------------------------------------------------------------//
case EntityExtension: t = ParamTextNS; break;
//---------------------------------------------------------------//
case EntityAddress:
case EntityLabel: t = ParamAddrText; break;
//---------------------------------------------------------------//
case EntityBirthday:
case EntityRevision: t = ParamDate; break;
//---------------------------------------------------------------//
case EntityPhoto:
case EntityLogo: t = ParamImage; break;
//---------------------------------------------------------------//
case EntityOrganisation:
case EntityTitle:
case EntityRole:
case EntityFullName:
case EntityMailer:
case EntityN:
case EntitySortString:
case EntityNickname:
case EntityCategories:
case EntityNote: t = ParamText; break;
//---------------------------------------------------------------//
case EntityProductID:
case EntityTimeZone:
case EntityUID:
case EntityURL:
case EntityClass:
case EntityGeo:
case EntityName:
case EntityVersion:
case EntityProfile:
default: t = ParamNone; break;
//---------------------------------------------------------------//
}
return t;
}
ValueType
VCARD::EntityTypeToValueType(EntityType e)
{
ValueType t(ValueUnknown);
switch (e) {
//---------------------------------------------------------------//
case EntitySound: t = ValueSound; break;
//---------------------------------------------------------------//
case EntityAgent: t = ValueAgent; break;
//---------------------------------------------------------------//
case EntityAddress: t = ValueAddress; break;
//---------------------------------------------------------------//
case EntityTelephone: t = ValueTel; break;
//---------------------------------------------------------------//
case EntityKey: t = ValueTextBin; break;
//---------------------------------------------------------------//
case EntityOrganisation: t = ValueOrg; break;
//---------------------------------------------------------------//
case EntityN: t = ValueN; break;
//---------------------------------------------------------------//
case EntityTimeZone: t = ValueUTC; break;
//---------------------------------------------------------------//
case EntityClass: t = ValueClass; break;
//---------------------------------------------------------------//
case EntityGeo: t = ValueGeo; break;
//---------------------------------------------------------------//
case EntitySource:
case EntityURL: t = ValueURI; break;
//---------------------------------------------------------------//
case EntityPhoto:
case EntityLogo: t = ValueImage; break;
//---------------------------------------------------------------//
case EntityBirthday:
case EntityRevision: t = ValueDate; break;
//---------------------------------------------------------------//
case EntityCategories:
case EntityNickname: t = ValueTextList; break;
//---------------------------------------------------------------//
case EntityLabel:
case EntityExtension:
case EntityEmail:
case EntityTitle:
case EntityRole:
case EntityFullName:
case EntityMailer:
case EntityProductID:
case EntityName:
case EntitySortString:
case EntityVersion:
case EntityProfile:
case EntityUID:
case EntityNote:
default: t = ValueText; break;
//---------------------------------------------------------------//
}
return t;
}
- QCString
+ Q3CString
VCARD::EntityTypeToParamName(EntityType e)
{
if ( e > EntityUnknown ) e = EntityUnknown;
return paramNames[ int( e ) ];
}
EntityType
-VCARD::EntityNameToEntityType(const QCString & s)
+VCARD::EntityNameToEntityType(const Q3CString & s)
{
if (s.isEmpty()) return EntityUnknown;
EntityType t(EntityUnknown);
switch (s[0]) {
case 'A':
if (s == "ADR")
t = EntityAddress;
else if (s == "AGENT")
t = EntityAgent;
break;
case 'B':
if (s == "BDAY")
t = EntityBirthday;
break;
case 'C':
if (s == "CATEGORIES")
t = EntityCategories;
else if (s == "CLASS")
t = EntityClass;
break;
case 'E':
if (s == "EMAIL")
t = EntityEmail;
break;
case 'F':
if (s == "FN")
t = EntityFullName;
break;
case 'G':
if (s == "GEO")
t = EntityGeo;
break;
case 'K':
if (s == "KEY")
t = EntityKey;
break;
case 'L':
if (s == "LABEL")
t = EntityLabel;
else if (s == "LOGO")
t = EntityLogo;
break;
case 'M':
if (s == "MAILER")
t = EntityMailer;
break;
case 'N':
if (s == "N")
t = EntityN;
else if (s == "NAME")
t = EntityName;
else if (s == "NICKNAME")
t = EntityNickname;
else if (s == "NOTE")
t = EntityNote;
break;
case 'O':
if (s == "ORG")
t = EntityOrganisation;
break;
case 'P':
if (s == "PHOTO")
t = EntityPhoto;
else if (s == "PRODID")
t = EntityProductID;
else if (s == "PROFILE")
t = EntityProfile;
break;
case 'R':
if (s == "REV")
t = EntityRevision;
else if (s == "ROLE")
t = EntityRole;
break;
case 'S':
if (s == "SORT-STRING")
t = EntitySortString;
else if (s == "SOUND")
t = EntitySound;
else if (s == "SOURCE")
t = EntitySource;
break;
case 'T':
if (s == "TEL")
t = EntityTelephone;
else if (s == "TITLE")
t = EntityTitle;
else if (s == "TZ")
t = EntityTimeZone;
break;
case 'U':
if (s == "UID")
t = EntityUID;
else if (s == "URL")
t = EntityURL;
case 'V':
if (s == "VERSION")
t = EntityVersion;
break;
case 'X':
if (s.left(2) == "X-")
t = EntityExtension;
break;
default:
t = EntityUnknown;
}
return t;
}
// The copyright notice below refers to the base64 codec functions used below,
// which are modified from the original sources.
/*
* Original version Copyright 1988 by The Leland Stanford Junior University
* Copyright 1998 by the University of Washington
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notices appear in all copies and that both the
* above copyright notices and this permission notice appear in supporting
* documentation, and that the name of the University of Washington or The
* Leland Stanford Junior University not be used in advertising or publicity
* pertaining to distribution of the software without specific, written prior
* permission. This software is made available "as is", and
* THE UNIVERSITY OF WASHINGTON AND THE LELAND STANFORD JUNIOR UNIVERSITY
* DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO THIS SOFTWARE,
* INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF
* WASHINGTON OR THE LELAND STANFORD JUNIOR UNIVERSITY BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, TORT (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
static char B64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
// the mime base64 disctionary used for decoding
static signed char b64dec[] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 20
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 30
-1, -1, -1,-19, -1, -1, -1,-16, -4, -4, // 40 -19 == '+' -16 == '/'
-4, -4, -4, -4, -4, -4, -4, -4, -1, -1, // 50 -4 == '0'
-1, 0, -1, -1, -1, 65, 65, 65, 65, 65, // 60 0 == '=' 65 == 'A'
65, 65, 65, 65, 65, 65, 65, 65, 65, 65, // 70
65, 65, 65, 65, 65, 65, 65, 65, 65, 65, // 80
65, -1, -1, -1, -1, -1, -1, 71, 71, 71, // 90 71 == 'a'
71, 71, 71, 71, 71, 71, 71, 71, 71, 71, // 100
71, 71, 71, 71, 71, 71, 71, 71, 71, 71, // 110
71, 71, 71, -1, -1, -1, -1, -1, -1, -1, // 120
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 130
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 140
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 150
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 160
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 170
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 180
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 190
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 200
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 210
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 220
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 230
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 240
-1, -1, -1, -1, -1, -1, -1 // 250
};
char *
diff --git a/kabc/vcard/FloatValue.cpp b/kabc/vcard/FloatValue.cpp
index 15bb664..7065081 100644
--- a/kabc/vcard/FloatValue.cpp
+++ b/kabc/vcard/FloatValue.cpp
@@ -1,120 +1,122 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardFloatValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
FloatValue::FloatValue()
: Value()
{
}
FloatValue::FloatValue(float f)
: Value (),
value_ (f)
{
parsed_ = true;
}
FloatValue::FloatValue(const FloatValue & x)
: Value(x)
{
value_ = x.value_;
}
-FloatValue::FloatValue(const QCString & s)
+FloatValue::FloatValue(const Q3CString & s)
: Value(s)
{
}
FloatValue &
FloatValue::operator = (FloatValue & x)
{
if (*this == x) return *this;
x.parse();
value_ = x.value_;
Value::operator = (x);
return *this;
}
FloatValue &
-FloatValue::operator = (const QCString & s)
+FloatValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
FloatValue::operator == (FloatValue & x)
{
x.parse();
return (value_ == x.value_);
}
FloatValue::~FloatValue()
{
}
void
FloatValue::_parse()
{
bool negative(false);
if (strRep_[0] == '-' || strRep_[1] == '+') {
if (strRep_[0] == '-')
negative = true;
strRep_.remove(0, 1);
}
value_ = strRep_.toFloat();
if (negative)
value_ = -value_;
}
void
FloatValue::_assemble()
{
- strRep_ = QCString().setNum(value_);
+ strRep_ = Q3CString().setNum(value_);
}
float
FloatValue::value()
{
parse();
return value_;
}
void
FloatValue::setValue(float f)
{
parsed_ = true;
value_ = f;
}
diff --git a/kabc/vcard/GeoValue.cpp b/kabc/vcard/GeoValue.cpp
index e02b402..ba57a6b 100644
--- a/kabc/vcard/GeoValue.cpp
+++ b/kabc/vcard/GeoValue.cpp
@@ -1,100 +1,102 @@
/*
This file is part of libvcard.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#include <VCardGeoValue.h>
#include <VCardValue.h>
#include <kdebug.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
GeoValue::GeoValue()
: Value()
{
}
GeoValue::GeoValue(const GeoValue & x)
: Value(x), latitude_(x.latitude_), longitude_(x.longitude_)
{
}
-GeoValue::GeoValue(const QCString & s)
+GeoValue::GeoValue(const Q3CString & s)
: Value(s)
{
}
GeoValue &
GeoValue::operator = (GeoValue & x)
{
if (*this == x) return *this;
latitude_ = x.latitude_;
longitude_ = x.longitude_;
Value::operator = (x);
return *this;
}
GeoValue &
-GeoValue::operator = (const QCString & s)
+GeoValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
GeoValue::operator == (GeoValue & x)
{
x.parse();
if ( latitude_ != x.latitude_ ) return false;
if ( longitude_ != x.longitude_ ) return false;
return true;
}
GeoValue::~GeoValue()
{
}
GeoValue *
GeoValue::clone()
{
return new GeoValue( *this );
}
void
GeoValue::_parse()
{
int semiColon = strRep_.find( ";" );
if ( semiColon == -1 ) // invalid
return;
latitude_ = strRep_.left( semiColon ).toFloat();
longitude_ = strRep_.mid( semiColon + 1, strRep_.length() - semiColon ).toFloat();
}
void
GeoValue::_assemble()
{
strRep_.sprintf( "%.6f;%.6f", latitude_, longitude_ );
}
diff --git a/kabc/vcard/ImageParam.cpp b/kabc/vcard/ImageParam.cpp
index c9cf6fd..6da317d 100644
--- a/kabc/vcard/ImageParam.cpp
+++ b/kabc/vcard/ImageParam.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardImageParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
ImageParam::ImageParam()
: Param()
{
}
ImageParam::ImageParam(const ImageParam & x)
: Param(x)
{
}
-ImageParam::ImageParam(const QCString & s)
+ImageParam::ImageParam(const Q3CString & s)
: Param(s)
{
}
ImageParam &
ImageParam::operator = (ImageParam & x)
{
if (*this == x) return *this;
Param::operator = (x);
return *this;
}
ImageParam &
-ImageParam::operator = (const QCString & s)
+ImageParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
ImageParam::operator == (ImageParam & x)
{
x.parse();
return false;
}
ImageParam::~ImageParam()
{
}
void
ImageParam::_parse()
{
}
void
ImageParam::_assemble()
{
}
diff --git a/kabc/vcard/ImageValue.cpp b/kabc/vcard/ImageValue.cpp
index 4630fac..678a81c 100644
--- a/kabc/vcard/ImageValue.cpp
+++ b/kabc/vcard/ImageValue.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardImageValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
ImageValue::ImageValue()
: Value()
{
}
ImageValue::ImageValue(const ImageValue & x)
: Value(x)
{
}
-ImageValue::ImageValue(const QCString & s)
+ImageValue::ImageValue(const Q3CString & s)
: Value(s)
{
}
ImageValue &
ImageValue::operator = (ImageValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
ImageValue &
-ImageValue::operator = (const QCString & s)
+ImageValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
ImageValue::operator == (ImageValue & x)
{
x.parse();
return false;
}
ImageValue::~ImageValue()
{
}
void
ImageValue::_parse()
{
}
void
ImageValue::_assemble()
{
}
diff --git a/kabc/vcard/ImgValue.cpp b/kabc/vcard/ImgValue.cpp
index 7b961f8..1b289df 100644
--- a/kabc/vcard/ImgValue.cpp
+++ b/kabc/vcard/ImgValue.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardImgValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
ImgValue::ImgValue()
: Value()
{
}
ImgValue::ImgValue(const ImgValue & x)
: Value(x)
{
}
-ImgValue::ImgValue(const QCString & s)
+ImgValue::ImgValue(const Q3CString & s)
: Value(s)
{
}
ImgValue &
ImgValue::operator = (ImgValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
ImgValue &
-ImgValue::operator = (const QCString & s)
+ImgValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
ImgValue::operator == (ImgValue & x)
{
x.parse();
return false;
}
ImgValue::~ImgValue()
{
}
void
ImgValue::_parse()
{
}
void
ImgValue::_assemble()
{
}
diff --git a/kabc/vcard/LangValue.cpp b/kabc/vcard/LangValue.cpp
index edf1804..52a0204 100644
--- a/kabc/vcard/LangValue.cpp
+++ b/kabc/vcard/LangValue.cpp
@@ -1,127 +1,131 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardRToken.h>
#include <VCardLangValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3StrList>
using namespace VCARD;
LangValue::LangValue()
: Value()
{
}
LangValue::LangValue(const LangValue & x)
: Value(x)
{
}
-LangValue::LangValue(const QCString & s)
+LangValue::LangValue(const Q3CString & s)
: Value(s)
{
}
LangValue &
LangValue::operator = (LangValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
LangValue &
-LangValue::operator = (const QCString & s)
+LangValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
LangValue::operator == (LangValue & x)
{
x.parse();
return false;
}
LangValue::~LangValue()
{
}
void
LangValue::_parse()
{
- QStrList l;
+ Q3StrList l;
RTokenise(strRep_, "-", l);
if (l.count() == 0) return;
primary_ = l.at(0);
l.remove(0u);
subtags_ = l;
}
void
LangValue::_assemble()
{
strRep_ = primary_;
- QStrListIterator it(subtags_);
+ Q3StrListIterator it(subtags_);
- for (; it.current(); ++it)
- strRep_ += QCString('-') + it.current();
+ for (; it.current(); ++it) {
+ strRep_ += Q3CString('-'); strRep_ += it.current();
+ }
}
- QCString
+ Q3CString
LangValue::primary()
{
parse();
return primary_;
}
- QStrList
+ Q3StrList
LangValue::subtags()
{
parse();
return subtags_;
}
void
-LangValue::setPrimary(const QCString & s)
+LangValue::setPrimary(const Q3CString & s)
{
parse();
primary_ = s;
}
void
-LangValue::setSubTags(const QStrList & l)
+LangValue::setSubTags(const Q3StrList & l)
{
parse();
subtags_ = l;
}
diff --git a/kabc/vcard/NValue.cpp b/kabc/vcard/NValue.cpp
index cdec621..6c0f365 100644
--- a/kabc/vcard/NValue.cpp
+++ b/kabc/vcard/NValue.cpp
@@ -1,128 +1,130 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <qstrlist.h>
+#include <q3strlist.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <VCardRToken.h>
#include <VCardNValue.h>
#include <VCardValue.h>
#include <VCardDefines.h>
using namespace VCARD;
NValue::NValue()
: Value()
{
vDebug("ctor");
}
NValue::NValue(const NValue & x)
: Value(x),
family_ (x.family_),
given_ (x.given_),
middle_ (x.middle_),
prefix_ (x.prefix_),
suffix_ (x.suffix_)
{
}
-NValue::NValue(const QCString & s)
+NValue::NValue(const Q3CString & s)
: Value(s)
{
vDebug("ctor");
}
NValue &
NValue::operator = (NValue & x)
{
if (*this == x) return *this;
family_ = x.family_;
given_ = x.given_;
middle_ = x.middle_;
prefix_ = x.prefix_;
suffix_ = x.suffix_;
Value::operator = (x);
return *this;
}
NValue &
-NValue::operator = (const QCString & s)
+NValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
NValue::operator == (NValue & x)
{
x.parse();
return (
family_ == x.family_ &&
given_ == x.given_ &&
middle_ == x.middle_ &&
prefix_ == x.prefix_ &&
suffix_ == x.suffix_);
}
NValue::~NValue()
{
}
NValue *
NValue::clone()
{
return new NValue( *this );
}
void
NValue::_parse()
{
- QStrList l;
+ Q3StrList l;
RTokenise(strRep_, ";", l);
for (unsigned int i = 0; i < l.count(); i++) {
switch (i) {
case 0: family_ = l.at(0); break;
case 1: given_ = l.at(1); break;
case 2: middle_ = l.at(2); break;
case 3: prefix_ = l.at(3); break;
case 4: suffix_ = l.at(4); break;
default: break;
}
}
}
void
NValue::_assemble()
{
strRep_ = family_;
strRep_ += ";" + given_;
strRep_ += ";" + middle_;
strRep_ += ";" + prefix_;
strRep_ += ";" + suffix_;
}
diff --git a/kabc/vcard/OrgValue.cpp b/kabc/vcard/OrgValue.cpp
index c3134c8..a6a32dd 100644
--- a/kabc/vcard/OrgValue.cpp
+++ b/kabc/vcard/OrgValue.cpp
@@ -1,107 +1,109 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardRToken.h>
#include <VCardOrgValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
OrgValue::OrgValue()
: Value()
{
}
OrgValue::OrgValue(const OrgValue & x)
: Value(x)
{
}
-OrgValue::OrgValue(const QCString & s)
+OrgValue::OrgValue(const Q3CString & s)
: Value(s)
{
}
OrgValue &
OrgValue::operator = (OrgValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
OrgValue &
-OrgValue::operator = (const QCString & s)
+OrgValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
OrgValue::operator == (OrgValue & x)
{
x.parse();
return false;
}
OrgValue::~OrgValue()
{
}
void
OrgValue::_parse()
{
RTokenise(strRep_, ";", valueList_);
}
void
OrgValue::_assemble()
{
bool first(true);
- QStrListIterator it(valueList_);
+ Q3StrListIterator it(valueList_);
for (; it.current(); ++it) {
if (!first) strRep_ += ';';
strRep_ += it.current();
first = false;
}
}
unsigned int
OrgValue::numValues()
{
parse();
return valueList_.count();
}
- QCString
+ Q3CString
OrgValue::value(unsigned int i)
{
parse();
return valueList_.at(i);
}
diff --git a/kabc/vcard/Param.cpp b/kabc/vcard/Param.cpp
index c513613..bd6b299 100644
--- a/kabc/vcard/Param.cpp
+++ b/kabc/vcard/Param.cpp
@@ -1,129 +1,131 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardParam.h>
#include <VCardEntity.h>
#include <VCardRToken.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
Param::Param()
: Entity(),
name_(""),
value_("")
{
}
Param::Param(const Param & x)
: Entity(x),
name_(x.name_),
value_(x.value_)
{
}
-Param::Param(const QCString & s)
+Param::Param(const Q3CString & s)
: Entity(s),
name_(""),
value_("")
{
}
Param &
Param::operator = (Param & x)
{
if (*this == x) return *this;
Entity::operator = (x);
name_ = x.name_;
value_ = x.value_;
return *this;
}
Param &
-Param::operator = (const QCString & s)
+Param::operator = (const Q3CString & s)
{
Entity::operator = (s);
return *this;
}
bool
Param::operator == (Param & x)
{
x.parse();
return false;
}
Param::~Param()
{
}
void
Param::_parse()
{
}
void
Param::_assemble()
{
strRep_ = name_ + "=" + value_;
}
-Param::Param(const QCString &name, const QCString &value)
+Param::Param(const Q3CString &name, const Q3CString &value)
: Entity(),
name_(name),
value_(value)
{
parsed_ = true;
assembled_ = false;
}
void
-Param::setName(const QCString & name)
+Param::setName(const Q3CString & name)
{
name_ = name;
assembled_ = false;
}
void
-Param::setValue(const QCString & value)
+Param::setValue(const Q3CString & value)
{
value_ = value;
assembled_ = false;
}
- QCString
+ Q3CString
Param::name()
{
return name_;
}
- QCString
+ Q3CString
Param::value()
{
return value_;
}
diff --git a/kabc/vcard/PhoneNumberValue.cpp b/kabc/vcard/PhoneNumberValue.cpp
index 17b1400..57aa336 100644
--- a/kabc/vcard/PhoneNumberValue.cpp
+++ b/kabc/vcard/PhoneNumberValue.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardPhoneNumberValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
PhoneNumberValue::PhoneNumberValue()
: Value()
{
}
PhoneNumberValue::PhoneNumberValue(const PhoneNumberValue & x)
: Value(x)
{
}
-PhoneNumberValue::PhoneNumberValue(const QCString & s)
+PhoneNumberValue::PhoneNumberValue(const Q3CString & s)
: Value(s)
{
}
PhoneNumberValue &
PhoneNumberValue::operator = (PhoneNumberValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
PhoneNumberValue &
-PhoneNumberValue::operator = (const QCString & s)
+PhoneNumberValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
PhoneNumberValue::operator == (PhoneNumberValue & x)
{
x.parse();
return false;
}
PhoneNumberValue::~PhoneNumberValue()
{
}
void
PhoneNumberValue::_parse()
{
}
void
PhoneNumberValue::_assemble()
{
}
diff --git a/kabc/vcard/RToken.cpp b/kabc/vcard/RToken.cpp
index 2a85820..8fc0558 100644
--- a/kabc/vcard/RToken.cpp
+++ b/kabc/vcard/RToken.cpp
@@ -1,88 +1,88 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <string.h>
#include <stddef.h>
-#include <qcstring.h>
-#include <qstrlist.h>
+#include <q3cstring.h>
+#include <q3strlist.h>
namespace VCARD
{
Q_UINT32
-RTokenise(const char * str, const char * delim, QStrList & l)
+RTokenise(const char * str, const char * delim, Q3StrList & l)
{
// FIXME no stderr !
l.clear();
if (!delim || !str || strlen(delim) == 0 || strlen(str) == 0) return 0;
char * len = (char *)(str + strlen(str)); // End of string.
register char * rstart = new char[strlen(str) + 1];
register char * r = rstart;
register const char * i = str; // Cursor.
while (i <= len) {
if (*i == '\\') { // Escaped chars go straight through.
*r++ = *i++;
if (i <= len)
*r++ = *i++;
continue;
}
if (strchr(delim, *i) != 0) {
// We hit a delimiter. If we have some text, make a new token.
// This has the effect that multiple delimiters are collapsed.
// cs: We mustn't collapse multiple delimiters, otherwise we
// lose empty fields.
*r = '\0';
// if (r != rstart) {
l.append(rstart);
// }
r = rstart;
++i;
continue;
}
*r++ = *i++;
}
// Catch last token
// if (r != rstart) {
*r = '\0';
l.append(rstart);
// }
r = 0;
delete [] rstart;
return l.count();
}
}
diff --git a/kabc/vcard/SoundValue.cpp b/kabc/vcard/SoundValue.cpp
index 81040d1..4d098d2 100644
--- a/kabc/vcard/SoundValue.cpp
+++ b/kabc/vcard/SoundValue.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardSoundValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
SoundValue::SoundValue()
: Value()
{
}
SoundValue::SoundValue(const SoundValue & x)
: Value(x)
{
}
-SoundValue::SoundValue(const QCString & s)
+SoundValue::SoundValue(const Q3CString & s)
: Value(s)
{
}
SoundValue &
SoundValue::operator = (SoundValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
SoundValue &
-SoundValue::operator = (const QCString & s)
+SoundValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
SoundValue::operator == (SoundValue & x)
{
x.parse();
return false;
}
SoundValue::~SoundValue()
{
}
void
SoundValue::_parse()
{
}
void
SoundValue::_assemble()
{
}
diff --git a/kabc/vcard/SourceParam.cpp b/kabc/vcard/SourceParam.cpp
index cd51cbd..8f02113 100644
--- a/kabc/vcard/SourceParam.cpp
+++ b/kabc/vcard/SourceParam.cpp
@@ -1,112 +1,114 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardSourceParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
SourceParam::SourceParam()
: Param(),
type_(SourceParam::TypeUnknown)
{
}
SourceParam::SourceParam(const SourceParam & x)
: Param(x),
type_ (x.type_),
par_ (x.par_),
val_ (x.val_)
{
}
-SourceParam::SourceParam(const QCString & s)
+SourceParam::SourceParam(const Q3CString & s)
: Param(s),
type_(SourceParam::TypeUnknown)
{
}
SourceParam &
SourceParam::operator = (SourceParam & x)
{
if (*this == x) return *this;
type_ = x.type();
par_ = x.par();
val_ = x.val();
Param::operator = (x);
return *this;
}
SourceParam &
-SourceParam::operator = (const QCString & s)
+SourceParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
SourceParam::operator == (SourceParam & x)
{
x.parse();
return false;
}
SourceParam::~SourceParam()
{
}
void
SourceParam::_parse()
{
int i = strRep_.find('=');
if (i == -1) // Invalid
return;
par_ = strRep_.left(i);
val_ = strRep_.right(strRep_.length() - i - 1);
if (qstricmp(par_, "VALUE") == 0 && qstricmp(val_, "uri") == 0)
type_ = TypeValue;
else if (qstricmp(par_, "CONTEXT") == 0 && qstricmp(val_, "word") == 0)
type_ = TypeContext;
else if (qstrnicmp(par_, "X-", 2) == 0) {
type_ = TypeX;
}
else type_ = TypeUnknown;
}
void
SourceParam::_assemble()
{
if (type_ == TypeValue)
strRep_ = "VALUE=uri";
else if (type_ == TypeContext)
strRep_ = "CONTEXT=word";
else if (type_ == TypeX)
strRep_ = par_ + "=" + val_;
else strRep_ = "";
}
diff --git a/kabc/vcard/TelParam.cpp b/kabc/vcard/TelParam.cpp
index 9d9fe4d..4bc8b6a 100644
--- a/kabc/vcard/TelParam.cpp
+++ b/kabc/vcard/TelParam.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardTelParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
TelParam::TelParam()
: Param()
{
}
TelParam::TelParam(const TelParam & x)
: Param(x)
{
}
-TelParam::TelParam(const QCString & s)
+TelParam::TelParam(const Q3CString & s)
: Param(s)
{
}
TelParam &
TelParam::operator = (TelParam & x)
{
if (*this == x) return *this;
Param::operator = (x);
return *this;
}
TelParam &
-TelParam::operator = (const QCString & s)
+TelParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
TelParam::operator == (TelParam & x)
{
x.parse();
return false;
}
TelParam::~TelParam()
{
}
void
TelParam::_parse()
{
}
void
TelParam::_assemble()
{
}
diff --git a/kabc/vcard/TelValue.cpp b/kabc/vcard/TelValue.cpp
index 349f99a..d9cbf3e 100644
--- a/kabc/vcard/TelValue.cpp
+++ b/kabc/vcard/TelValue.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardTelValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
TelValue::TelValue()
: Value()
{
}
TelValue::TelValue(const TelValue & x)
: Value(x)
{
}
-TelValue::TelValue(const QCString & s)
+TelValue::TelValue(const Q3CString & s)
: Value(s)
{
}
TelValue &
TelValue::operator = (TelValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
TelValue &
-TelValue::operator = (const QCString & s)
+TelValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
TelValue::operator == (TelValue & x)
{
x.parse();
return false;
}
TelValue::~TelValue()
{
}
void
TelValue::_parse()
{
}
void
TelValue::_assemble()
{
}
diff --git a/kabc/vcard/TextBinParam.cpp b/kabc/vcard/TextBinParam.cpp
index 66f2946..2866c12 100644
--- a/kabc/vcard/TextBinParam.cpp
+++ b/kabc/vcard/TextBinParam.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardTextBinParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
TextBinParam::TextBinParam()
: Param()
{
}
TextBinParam::TextBinParam(const TextBinParam & x)
: Param(x)
{
}
-TextBinParam::TextBinParam(const QCString & s)
+TextBinParam::TextBinParam(const Q3CString & s)
: Param(s)
{
}
TextBinParam &
TextBinParam::operator = (TextBinParam & x)
{
if (*this == x) return *this;
Param::operator = (x);
return *this;
}
TextBinParam &
-TextBinParam::operator = (const QCString & s)
+TextBinParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
TextBinParam::operator == (TextBinParam & x)
{
x.parse();
return false;
}
TextBinParam::~TextBinParam()
{
}
void
TextBinParam::_parse()
{
}
void
TextBinParam::_assemble()
{
}
diff --git a/kabc/vcard/TextBinValue.cpp b/kabc/vcard/TextBinValue.cpp
index c584009..a3a96ae 100644
--- a/kabc/vcard/TextBinValue.cpp
+++ b/kabc/vcard/TextBinValue.cpp
@@ -1,104 +1,106 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <kmdcodec.h>
#include <VCardTextBinValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
TextBinValue::TextBinValue()
: Value()
{
}
TextBinValue::TextBinValue(const TextBinValue & x)
: Value(x)
{
mIsBinary_ = x.mIsBinary_;
mData_ = x.mData_;
mUrl_ = x.mUrl_;
}
-TextBinValue::TextBinValue(const QCString & s)
+TextBinValue::TextBinValue(const Q3CString & s)
: Value(s)
{
}
TextBinValue &
TextBinValue::operator = (TextBinValue & x)
{
if (*this == x) return *this;
mIsBinary_ = x.mIsBinary_;
mData_ = x.mData_;
mUrl_ = x.mUrl_;
Value::operator = (x);
return *this;
}
TextBinValue &
-TextBinValue::operator = (const QCString & s)
+TextBinValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
TextBinValue::operator == (TextBinValue & x)
{
x.parse();
if ( mIsBinary_ != x.mIsBinary_ ) return false;
if ( mData_ != x.mData_ ) return false;
if ( mUrl_ != x.mUrl_ ) return false;
return true;
}
TextBinValue::~TextBinValue()
{
}
TextBinValue *
TextBinValue::clone()
{
return new TextBinValue( *this );
}
void
TextBinValue::_parse()
{
}
void
TextBinValue::_assemble()
{
if ( mIsBinary_ ) {
strRep_ = KCodecs::base64Encode( mData_ );
} else
strRep_ = mUrl_.utf8();
}
diff --git a/kabc/vcard/TextListValue.cpp b/kabc/vcard/TextListValue.cpp
index c4ac1e3..919f4f7 100644
--- a/kabc/vcard/TextListValue.cpp
+++ b/kabc/vcard/TextListValue.cpp
@@ -1,107 +1,109 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardRToken.h>
#include <VCardTextListValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
TextListValue::TextListValue()
: Value()
{
}
TextListValue::TextListValue(const TextListValue & x)
: Value(x)
{
}
-TextListValue::TextListValue(const QCString & s)
+TextListValue::TextListValue(const Q3CString & s)
: Value(s)
{
}
TextListValue &
TextListValue::operator = (TextListValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
TextListValue &
-TextListValue::operator = (const QCString & s)
+TextListValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
TextListValue::operator == (TextListValue & x)
{
x.parse();
return false;
}
TextListValue::~TextListValue()
{
}
void
TextListValue::_parse()
{
RTokenise(strRep_, ";", valueList_);
}
void
TextListValue::_assemble()
{
bool first(true);
- QStrListIterator it(valueList_);
+ Q3StrListIterator it(valueList_);
for (; it.current(); ++it) {
if (!first) strRep_ += ';';
strRep_ += it.current();
first = false;
}
}
unsigned int
TextListValue::numValues()
{
parse();
return valueList_.count();
}
- QCString
+ Q3CString
TextListValue::value(unsigned int i)
{
parse();
return valueList_.at(i);
}
diff --git a/kabc/vcard/TextParam.cpp b/kabc/vcard/TextParam.cpp
index 7c68700..ce6661f 100644
--- a/kabc/vcard/TextParam.cpp
+++ b/kabc/vcard/TextParam.cpp
@@ -1,82 +1,84 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardTextParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
TextParam::TextParam()
: Param()
{
}
TextParam::TextParam(const TextParam & x)
: Param(x)
{
}
-TextParam::TextParam(const QCString & s)
+TextParam::TextParam(const Q3CString & s)
: Param(s)
{
}
TextParam &
TextParam::operator = (TextParam & x)
{
if (*this == x) return *this;
Param::operator = (x);
return *this;
}
TextParam &
-TextParam::operator = (const QCString & s)
+TextParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
TextParam::operator == (TextParam & x)
{
x.parse();
return false;
}
TextParam::~TextParam()
{
}
void
TextParam::_parse()
{
}
void
TextParam::_assemble()
{
}
diff --git a/kabc/vcard/TextValue.cpp b/kabc/vcard/TextValue.cpp
index 09934fa..d0d2996 100644
--- a/kabc/vcard/TextValue.cpp
+++ b/kabc/vcard/TextValue.cpp
@@ -1,86 +1,88 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardTextValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
TextValue::TextValue()
: Value()
{
}
TextValue::TextValue(const TextValue & x)
: Value(x)
{
}
-TextValue::TextValue(const QCString & s)
+TextValue::TextValue(const Q3CString & s)
: Value(s)
{
}
TextValue &
TextValue::operator = (TextValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
TextValue &
-TextValue::operator = (const QCString & s)
+TextValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
TextValue::operator == (TextValue & x)
{
- return strRep_ = x.strRep_;
+ return strRep_ == x.strRep_;
}
TextValue::~TextValue()
{
}
TextValue *
TextValue::clone()
{
return new TextValue( *this );
}
void
TextValue::_parse()
{
}
void
TextValue::_assemble()
{
}
diff --git a/kabc/vcard/URIValue.cpp b/kabc/vcard/URIValue.cpp
index c1d1022..26da7f4 100644
--- a/kabc/vcard/URIValue.cpp
+++ b/kabc/vcard/URIValue.cpp
@@ -1,133 +1,135 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardURIValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
URIValue::URIValue()
: Value()
{
}
-URIValue::URIValue(const QCString & scheme, const QCString & schemeSpecificPart)
+URIValue::URIValue(const Q3CString & scheme, const Q3CString & schemeSpecificPart)
: Value(),
scheme_ (scheme),
schemeSpecificPart_ (schemeSpecificPart)
{
parsed_ = true;
}
URIValue::URIValue(const URIValue & x)
: Value (x),
scheme_ (x.scheme_),
schemeSpecificPart_ (x.schemeSpecificPart_)
{
}
-URIValue::URIValue(const QCString & s)
+URIValue::URIValue(const Q3CString & s)
: Value(s)
{
}
URIValue &
URIValue::operator = (URIValue & x)
{
if (*this == x) return *this;
scheme_ = x.scheme_;
schemeSpecificPart_ = x.schemeSpecificPart_;
Value::operator = (x);
return *this;
}
URIValue &
-URIValue::operator = (const QCString & s)
+URIValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
URIValue::operator == (URIValue & x)
{
x.parse();
return (
(scheme_ == x.scheme_) &&
(schemeSpecificPart_ == x.schemeSpecificPart_));
return false;
}
URIValue::~URIValue()
{
}
void
URIValue::_parse()
{
int split = strRep_.find(':');
if (split == -1)
return;
scheme_ = strRep_.left(split);
schemeSpecificPart_ = strRep_.mid(split + 1);
}
void
URIValue::_assemble()
{
strRep_ = scheme_ + ':' + schemeSpecificPart_;
}
- QCString
+ Q3CString
URIValue::scheme()
{
parse();
return scheme_;
}
- QCString
+ Q3CString
URIValue::schemeSpecificPart()
{
parse();
return schemeSpecificPart_;
}
void
-URIValue::setScheme(const QCString & s)
+URIValue::setScheme(const Q3CString & s)
{
parse();
scheme_ = s;
}
void
-URIValue::setSchemeSpecificPart(const QCString & s)
+URIValue::setSchemeSpecificPart(const Q3CString & s)
{
parse();
schemeSpecificPart_ = s;
}
diff --git a/kabc/vcard/UTCValue.cpp b/kabc/vcard/UTCValue.cpp
index 374306c..f35d986 100644
--- a/kabc/vcard/UTCValue.cpp
+++ b/kabc/vcard/UTCValue.cpp
@@ -1,110 +1,112 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardUTCValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
UTCValue::UTCValue()
: Value()
{
}
UTCValue::UTCValue(const UTCValue & x)
: Value(x), positive_(x.positive_), hour_(x.hour_), minute_(x.minute_)
{
}
-UTCValue::UTCValue(const QCString & s)
+UTCValue::UTCValue(const Q3CString & s)
: Value(s)
{
}
UTCValue &
UTCValue::operator = (UTCValue & x)
{
if (*this == x) return *this;
positive_ = x.positive_;
hour_ = x.hour_;
minute_ = x.minute_;
Value::operator = (x);
return *this;
}
UTCValue &
-UTCValue::operator = (const QCString & s)
+UTCValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
UTCValue::operator == (UTCValue & x)
{
x.parse();
if (positive_ != x.positive_) return false;
if (hour_ != x.hour_) return false;
if (minute_ != x.minute_) return false;
return true;
}
UTCValue::~UTCValue()
{
}
UTCValue *
UTCValue::clone()
{
return new UTCValue( *this );
}
void
UTCValue::_parse()
{
if ( strRep_.isEmpty() )
return;
positive_ = ( strRep_[0] == '+' );
int colon = strRep_.find( ':' );
if ( colon == -1 ) // Not valid.
return;
hour_ = strRep_.mid( 1, 2 ).toInt();
minute_ = strRep_.right( 2 ).toInt();
}
void
UTCValue::_assemble()
{
strRep_.sprintf( "%c%.2i:%.2i", (positive_ ? '+' : '-'), hour_, minute_ );
}
diff --git a/kabc/vcard/VCardEntity.cpp b/kabc/vcard/VCardEntity.cpp
index a2ff327..bae5385 100644
--- a/kabc/vcard/VCardEntity.cpp
+++ b/kabc/vcard/VCardEntity.cpp
@@ -1,175 +1,177 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <qregexp.h>
#include <qdatetime.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <VCardDefines.h>
#include <VCardVCardEntity.h>
using namespace VCARD;
VCardEntity::VCardEntity()
: Entity()
{
cardList_.setAutoDelete( TRUE );
}
VCardEntity::VCardEntity(const VCardEntity & x)
: Entity(x)
{
cardList_.setAutoDelete( TRUE );
}
-VCardEntity::VCardEntity(const QCString & s)
+VCardEntity::VCardEntity(const Q3CString & s)
: Entity(s)
{
cardList_.setAutoDelete( TRUE );
}
VCardEntity &
VCardEntity::operator = (VCardEntity & x)
{
if (*this == x) return *this;
Entity::operator = (x);
return *this;
}
VCardEntity &
-VCardEntity::operator = (const QCString & s)
+VCardEntity::operator = (const Q3CString & s)
{
Entity::operator = (s);
return *this;
}
bool
VCardEntity::operator == (VCardEntity & x)
{
x.parse();
return false;
}
VCardEntity::~VCardEntity()
{
}
void
VCardEntity::_parse()
{
#if 0
QTime tim;
tim.start();
int num = 0;
// old code
vDebug("parse");
- QCString s(strRep_);
+ Q3CString s(strRep_);
int i = s.find(QRegExp("BEGIN:VCARD", false));
while (i != -1) {
i = s.find(QRegExp("BEGIN:VCARD", false), 11);
- QCString cardStr(s.left(i));
+ Q3CString cardStr(s.left(i));
VCard * v = new VCard(cardStr);
cardList_.append(v);
v->parse();
s.remove(0, i);
}
#else
// this code is up to 17 (!) times faster
int start = 0;
QTime tim;
tim.start();
int i = 11;
int len = strRep_.length();
int num = 0;
while (i < len ) {
while( i < len ) {
int add = 1;
if ( strRep_.at(i) == 'B' ) {
if ( i+add < len && strRep_.at(i+add++) == 'E')
if ( i+add < len && strRep_.at(i+add++) == 'G')
if ( i+add < len && strRep_.at(i+add++) == 'I')
if ( i+add < len && strRep_.at(i+add++) == 'N')
if ( i+add < len && strRep_.at(i+add++) == ':')
if ( i+add < len && strRep_.at(i+add++) == 'V')
if ( i+add < len && strRep_.at(i+add++) == 'C')
if ( i+add < len && strRep_.at(i+add++) == 'A')
if ( i+add < len && strRep_.at(i+add++) == 'R')
if ( i+add < len && strRep_.at(i+add++) == 'D')
if ( i+add < len && (strRep_.at(i+add) == '\r' || strRep_.at(i+add) == '\n' ))
break;
}
++i;
}
if ( i <= len ) {
++num;
char* dat = strRep_.data()+start;
- VCard * v = new VCard( QCString ( dat,i-start ) );
+ VCard * v = new VCard( Q3CString ( dat,i-start ) );
start = i;
cardList_.append(v);
v->parse();
}
i+= 11;
}
#endif
//qDebug("***time %d found %d", tim.elapsed(), num);
}
void
VCardEntity::_assemble()
{
VCardListIterator it(cardList_);
for (; it.current(); ++it)
strRep_ += it.current()->asString() + "\r\n"; // One CRLF for luck.
}
VCardList &
VCardEntity::cardList()
{
parse();
return cardList_;
}
void
VCardEntity::setCardList(const VCardList & l)
{
parse();
//US cardList_ = l;
VCardListIterator it(l);
for (; it.current(); ++it) {
VCard* v = new VCard(*it.current());
cardList_.append(v);
}
}
diff --git a/kabc/vcard/VCardv.cpp b/kabc/vcard/VCardv.cpp
index bad2ef1..5dd675d 100644
--- a/kabc/vcard/VCardv.cpp
+++ b/kabc/vcard/VCardv.cpp
@@ -1,294 +1,295 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <qcstring.h>
-#include <qstrlist.h>
+#include <q3cstring.h>
+#include <q3strlist.h>
#include <qstringlist.h>
#include <qstring.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <VCardEntity.h>
#include <VCardVCard.h>
#include <VCardContentLine.h>
#include <VCardRToken.h>
#include <VCardDefines.h>
using namespace VCARD;
VCard::VCard()
: Entity()
{
contentLineList_.setAutoDelete( TRUE );
}
VCard::VCard(const VCard & x)
: Entity(x),
group_(x.group_)
{
contentLineList_.setAutoDelete( TRUE );
- QPtrListIterator<ContentLine> it(x.contentLineList_);
+ Q3PtrListIterator<ContentLine> it(x.contentLineList_);
for (; it.current(); ++it) {
ContentLine * c = new ContentLine(*it.current());
contentLineList_.append(c);
}
}
-VCard::VCard(const QCString & s)
+VCard::VCard(const Q3CString & s)
: Entity(s)
{
contentLineList_.setAutoDelete( TRUE );
}
VCard &
VCard::operator = (VCard & x)
{
if (*this == x) return *this;
group_ = x.group();
- QPtrListIterator<ContentLine> it(x.contentLineList_);
+ Q3PtrListIterator<ContentLine> it(x.contentLineList_);
for (; it.current(); ++it) {
ContentLine * c = new ContentLine(*it.current());
contentLineList_.append(c);
}
Entity::operator = (x);
return *this;
}
VCard &
-VCard::operator = (const QCString & s)
+VCard::operator = (const Q3CString & s)
{
Entity::operator = (s);
return *this;
}
bool
VCard::operator == (VCard & x)
{
x.parse();
return false;
}
VCard::~VCard()
{
}
void
VCard::_parse()
{
QStringList l;
- QStrList sl;
+ Q3StrList sl;
RTokenise(strRep_, "\r\n", sl);
if (sl.count() < 3) { // Invalid VCARD !
//qDebug("invalid vcard ");
return;
}
- l = QStringList::fromStrList( sl );
+ for(Q3StrList::iterator i=sl.begin();i!=sl.end();++i)
+ l.push_back(*i);
// Get the first line
QString beginLine = l[0].stripWhiteSpace();
// Remove extra blank lines
while (l.last().isEmpty())
l.remove(l.last());
// Now we know this is the last line
QString endLine = l.last();
// Trash the first and last lines as we have seen them.
l.remove(l.begin());
l.remove(l.last());
///////////////////////////////////////////////////////////////
// FIRST LINE
int split = beginLine.find(':');
if (split == -1) { // invalid, no BEGIN
vDebug("No split");
return;
}
QString firstPart(beginLine.left(split));
QString valuePart(beginLine.mid(split + 1));
split = firstPart.find('.');
if (split != -1) {
group_ = firstPart.left(split);
firstPart = firstPart.right(firstPart.length() - split - 1);
}
if (firstPart.left(5) != "BEGIN" ) { // No BEGIN !
qDebug("no BEGIN in vcard ");
return;
}
if (valuePart.left(5) != "VCARD") { // Not a vcard !
qDebug("not a VCARD ");
return;
}
///////////////////////////////////////////////////////////////
// CONTENT LINES
//
vDebug("Content lines");
// Handle folded lines.
QStringList refolded;
QStringList::Iterator it = l.begin();
QString cur;
for (; it != l.end(); ++it) {
cur = (*it);
++it;
while ( it!= l.end() && (*it).at(0) == ' ' && (*it).length()!= 1) {
cur += (*it).mid(1) ;
++it;
}
--it;
refolded.append(cur);
}
QStringList::Iterator it2 = refolded.begin();
for (; it2 != refolded.end(); ++it2) {
- ContentLine * cl = new ContentLine(QCString((*it2).latin1()));
+ ContentLine * cl = new ContentLine(Q3CString((*it2).latin1()));
cl->parse();
if (cl->value() == 0)
{
qDebug("Content line could not be parsed. Discarded: %s", (*it2).latin1());
delete cl;
}
else
contentLineList_.append(cl);
}
///////////////////////////////////////////////////////////////
// LAST LINE
// LR: sorry, but the remaining code in this method makes no sense
#if 0
split = endLine.find(':');
if (split == -1) // invalid, no END
return;
firstPart = endLine.left(split);
valuePart = endLine.right(firstPart.length() - split - 1);
split = firstPart.find('.');
if (split != -1) {
group_ = firstPart.left(split);
firstPart = firstPart.right(firstPart.length() - split - 1);
}
if (qstricmp(firstPart, "END") != 0) // No END !
return;
if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard !
return;
#endif
}
void
VCard::_assemble()
{
vDebug("Assembling vcard");
strRep_ = "BEGIN:VCARD\r\n";
strRep_ += "VERSION:3.0\r\n";
- QPtrListIterator<ContentLine> it(contentLineList_);
+ Q3PtrListIterator<ContentLine> it(contentLineList_);
for (; it.current(); ++it)
strRep_ += it.current()->asString() + "\r\n";
strRep_ += "END:VCARD\r\n";
}
bool
VCard::has(EntityType t)
{
parse();
return contentLine(t) == 0 ? false : true;
}
bool
-VCard::has(const QCString & s)
+VCard::has(const Q3CString & s)
{
parse();
return contentLine(s) == 0 ? false : true;
}
void
VCard::add(const ContentLine & cl)
{
parse();
ContentLine * c = new ContentLine(cl);
contentLineList_.append(c);
}
void
-VCard::add(const QCString & s)
+VCard::add(const Q3CString & s)
{
parse();
ContentLine * c = new ContentLine(s);
contentLineList_.append(c);
}
ContentLine *
VCard::contentLine(EntityType t)
{
parse();
- QPtrListIterator<ContentLine> it(contentLineList_);
+ Q3PtrListIterator<ContentLine> it(contentLineList_);
for (; it.current(); ++it)
if (it.current()->entityType() == t)
return it.current();
return 0;
}
ContentLine *
-VCard::contentLine(const QCString & s)
+VCard::contentLine(const Q3CString & s)
{
parse();
- QPtrListIterator<ContentLine> it(contentLineList_);
+ Q3PtrListIterator<ContentLine> it(contentLineList_);
for (; it.current(); ++it)
if (it.current()->entityType() == EntityNameToEntityType(s))
return it.current();
return 0;
}
diff --git a/kabc/vcard/Value.cpp b/kabc/vcard/Value.cpp
index 1978af2..3a4d406 100644
--- a/kabc/vcard/Value.cpp
+++ b/kabc/vcard/Value.cpp
@@ -1,82 +1,84 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardEntity.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
Value::Value()
: Entity()
{
}
Value::Value(const Value & x)
: Entity(x)
{
}
-Value::Value(const QCString & s)
+Value::Value(const Q3CString & s)
: Entity(s)
{
}
Value &
Value::operator = (Value & x)
{
if (*this == x) return *this;
Entity::operator = (x);
return *this;
}
Value &
-Value::operator = (const QCString & s)
+Value::operator = (const Q3CString & s)
{
Entity::operator = (s);
return *this;
}
bool
Value::operator == (Value & x)
{
x.parse();
return false;
}
Value::~Value()
{
}
void
Value::_parse()
{
}
void
Value::_assemble()
{
//US vDebug("Value::_assemble()");
qDebug("Value::_assemble()");
}
diff --git a/kabc/vcard/include/VCardAdrParam.h b/kabc/vcard/include/VCardAdrParam.h
index 89dcb64..6456624 100644
--- a/kabc/vcard/include/VCardAdrParam.h
+++ b/kabc/vcard/include/VCardAdrParam.h
@@ -1,64 +1,64 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef ADRPARAM_H
#define ADRPARAM_H
-#include <qcstring.h>
-#include <qstrlist.h>
+#include <q3cstring.h>
+#include <q3strlist.h>
#include <VCardParam.h>
namespace VCARD
{
class AdrParam : public Param
{
#include "AdrParam-generated.h"
- QStrList adrTypeList()
+ Q3StrList adrTypeList()
{ parse(); return adrTypeList_; }
- QCString textParam()
+ Q3CString textParam()
{ parse(); return textParam_; }
- void setAdrTypeList(const QStrList & l)
+ void setAdrTypeList(const Q3StrList & l)
{ adrTypeList_ = l; assembled_ = false; }
- void setTextParam(const QCString & s)
+ void setTextParam(const Q3CString & s)
{ textParam_ = s; assembled_ = false; }
enum AdrType {
AdrDom, AdrIntl, AdrPostal, AdrParcel, AdrHome, AdrWork, AdrPref,
AdrIANA, AdrX
};
private:
- QStrList adrTypeList_;
- QCString textParam_;
+ Q3StrList adrTypeList_;
+ Q3CString textParam_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardAdrValue.h b/kabc/vcard/include/VCardAdrValue.h
index 0731924..14ddb02 100644
--- a/kabc/vcard/include/VCardAdrValue.h
+++ b/kabc/vcard/include/VCardAdrValue.h
@@ -1,83 +1,85 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef ADRVALUE_H
#define ADRVALUE_H
-#include <qstrlist.h>
+#include <q3strlist.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <VCardValue.h>
namespace VCARD
{
class AdrValue : public Value
{
#include "AdrValue-generated.h"
AdrValue *clone();
- void setPOBox(const QCString & s)
+ void setPOBox(const Q3CString & s)
{ poBox_ = s; assembled_ = false; }
- void setExtAddress(const QCString & s)
+ void setExtAddress(const Q3CString & s)
{ extAddress_ = s; assembled_ = false; }
- void setStreet(const QCString & s)
+ void setStreet(const Q3CString & s)
{ street_ = s; assembled_ = false; }
- void setLocality(const QCString & s)
+ void setLocality(const Q3CString & s)
{ locality_ = s; assembled_ = false; }
- void setRegion(const QCString & s)
+ void setRegion(const Q3CString & s)
{ region_ = s; assembled_ = false; }
- void setPostCode(const QCString & s)
+ void setPostCode(const Q3CString & s)
{ postCode_ = s; assembled_ = false; }
- void setCountryName(const QCString & s)
+ void setCountryName(const Q3CString & s)
{ countryName_ = s; assembled_ = false; }
- QCString poBox() { parse(); return poBox_; }
- QCString extAddress() { parse(); return extAddress_; }
- QCString street() { parse(); return street_; }
- QCString locality() { parse(); return locality_; }
- QCString region() { parse(); return region_; }
- QCString postCode() { parse(); return postCode_; }
- QCString countryName() { parse(); return countryName_; }
+ Q3CString poBox() { parse(); return poBox_; }
+ Q3CString extAddress() { parse(); return extAddress_; }
+ Q3CString street() { parse(); return street_; }
+ Q3CString locality() { parse(); return locality_; }
+ Q3CString region() { parse(); return region_; }
+ Q3CString postCode() { parse(); return postCode_; }
+ Q3CString countryName() { parse(); return countryName_; }
private:
- QCString poBox_;
- QCString extAddress_;
- QCString street_;
- QCString locality_;
- QCString region_;
- QCString postCode_;
- QCString countryName_;
+ Q3CString poBox_;
+ Q3CString extAddress_;
+ Q3CString street_;
+ Q3CString locality_;
+ Q3CString region_;
+ Q3CString postCode_;
+ Q3CString countryName_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardAgentParam.h b/kabc/vcard/include/VCardAgentParam.h
index 72a05db..5733540 100644
--- a/kabc/vcard/include/VCardAgentParam.h
+++ b/kabc/vcard/include/VCardAgentParam.h
@@ -1,60 +1,60 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef AGENTPARAM_H
#define AGENTPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardParam.h>
#include <VCardURIValue.h>
namespace VCARD
{
class AgentParam : public Param
{
#include "AgentParam-generated.h"
bool refer()
{ parse(); return refer_; }
URIValue uri()
{ parse(); return uri_; }
void setRefer(bool b)
{ refer_ = b; assembled_ = false; }
- void setURI(const QCString & s)
+ void setURI(const Q3CString & s)
{ uri_ = s; assembled_ = false; }
private:
bool refer_;
URIValue uri_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardAgentValue.h b/kabc/vcard/include/VCardAgentValue.h
index f655836..b0d883b 100644
--- a/kabc/vcard/include/VCardAgentValue.h
+++ b/kabc/vcard/include/VCardAgentValue.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef AGENTVALUE_H
#define AGENTVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class AgentValue : public Value
{
#include "AgentValue-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardClassValue.h b/kabc/vcard/include/VCardClassValue.h
index ff133c2..c450169 100644
--- a/kabc/vcard/include/VCardClassValue.h
+++ b/kabc/vcard/include/VCardClassValue.h
@@ -1,56 +1,56 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef CLASSVALUE_H
#define CLASSVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
#include <kdebug.h>
namespace VCARD
{
class ClassValue : public Value
{
#include "ClassValue-generated.h"
enum ClassType {
Public, Private, Confidential, Other
};
ClassValue *clone();
void setType( int type ) { classType_ = type; assembled_ = false; parsed_ = true; }
int type() { parse(); return classType_; }
private:
int classType_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardContentLine.h b/kabc/vcard/include/VCardContentLine.h
index 1c5f5be..c3c5253 100644
--- a/kabc/vcard/include/VCardContentLine.h
+++ b/kabc/vcard/include/VCardContentLine.h
@@ -1,77 +1,79 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef CONTENTLINE_H
#define CONTENTLINE_H
-#include <qptrlist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <Q3CString>
#include "VCardEnum.h"
#include "VCardEntity.h"
#include "VCardParam.h"
#include "VCardValue.h"
namespace VCARD
{
class ContentLine : public Entity
{
#include "ContentLine-generated.h"
- QCString group() { parse(); return group_; }
- QCString name() { parse(); return name_; }
+ Q3CString group() { parse(); return group_; }
+ Q3CString name() { parse(); return name_; }
Value * value() { parse(); return value_; }
ParamList paramList() { parse(); return paramList_; }
ParamType paramType() { parse(); return paramType_; }
ValueType valueType() { parse(); return valueType_; }
EntityType entityType() { parse(); return entityType_; }
- void setGroup (const QCString & s)
+ void setGroup (const Q3CString & s)
{ group_ = s; assembled_ = false; }
- void setName (const QCString & s)
+ void setName (const Q3CString & s)
{ name_ = s; assembled_ = false; }
void setValue (Value *s)
{ value_ = s; assembled_ = false; }
void setParamList (const ParamList & l)
{ paramList_ = l; assembled_ = false; }
void clear ();
private:
- QCString group_;
- QCString name_;
- QPtrList<Param> paramList_;
+ Q3CString group_;
+ Q3CString name_;
+ Q3PtrList<Param> paramList_;
Value * value_;
ParamType paramType_;
ValueType valueType_;
EntityType entityType_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardDateParam.h b/kabc/vcard/include/VCardDateParam.h
index 21ac1f1..959b75b 100644
--- a/kabc/vcard/include/VCardDateParam.h
+++ b/kabc/vcard/include/VCardDateParam.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef DATEPARAM_H
#define DATEPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardParam.h>
namespace VCARD
{
class DateParam : public Param
{
#include "DateParam-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardDateValue.h b/kabc/vcard/include/VCardDateValue.h
index c248966..fc216c0 100644
--- a/kabc/vcard/include/VCardDateValue.h
+++ b/kabc/vcard/include/VCardDateValue.h
@@ -1,99 +1,99 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef DATEVALUE_H
#define DATEVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <qdatetime.h>
#include <VCardValue.h>
namespace VCARD
{
class DateValue : public Value
{
#include "DateValue-generated.h"
DateValue(
unsigned int year,
unsigned int month,
unsigned int day,
unsigned int hour = 0,
unsigned int minute = 0,
unsigned int second = 0,
double secFrac = 0,
bool zonePositive = true,
unsigned int zoneHour = 0,
unsigned int zoneMinute = 0);
DateValue(const QDate &);
DateValue(const QDateTime &);
DateValue *clone();
bool hasTime();
unsigned int year();
unsigned int month();
unsigned int day();
unsigned int hour();
unsigned int minute();
unsigned int second();
double secondFraction();
bool zonePositive();
unsigned int zoneHour();
unsigned int zoneMinute();
void setYear (unsigned int);
void setMonth (unsigned int);
void setDay (unsigned int);
void setHour (unsigned int);
void setMinute (unsigned int);
void setSecond (unsigned int);
void setSecondFraction (double);
void setZonePositive (bool);
void setZoneHour (unsigned int);
void setZoneMinute (unsigned int);
QDate qdate();
QTime qtime();
QDateTime qdt();
private:
unsigned int year_, month_, day_,
hour_, minute_, second_,
zoneHour_, zoneMinute_;
double secFrac_;
bool zonePositive_;
bool hasTime_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardDefines.h b/kabc/vcard/include/VCardDefines.h
index 557410f..5d4f2f4 100644
--- a/kabc/vcard/include/VCardDefines.h
+++ b/kabc/vcard/include/VCardDefines.h
@@ -1,53 +1,53 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VCARD_DEFINES_H
#define VCARD_DEFINES_H
#include <kdebug.h>
#ifdef VCARD_DEBUG
//US #define vDebug(a) kdDebug(5710) << a << endl;
#define vDebug(a) qDebug(a);
#else
#define vDebug(a)
#endif
#if 0
#ifndef NDEBUG
-# include <qcstring.h>
+# include <q3cstring.h>
# include <iostream>
# ifdef __GNUG__
# define vDebug(a) cerr << className() << ":" << __FUNCTION__ << " (" \
- << __LINE__ << "): " << QCString((a)).data() << endl;
+ << __LINE__ << "): " << Q3CString((a)).data() << endl;
# else
# define vDebug(a) cerr << className() << ": " \
- << QCString((a)).data() << endl;
+ << Q3CString((a)).data() << endl;
# endif
#else
# define vDebug(a)
#endif
#endif
#endif // Included this file
diff --git a/kabc/vcard/include/VCardEmailParam.h b/kabc/vcard/include/VCardEmailParam.h
index 98d1b30..ff07324 100644
--- a/kabc/vcard/include/VCardEmailParam.h
+++ b/kabc/vcard/include/VCardEmailParam.h
@@ -1,56 +1,56 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef EMAILPARAM_H
#define EMAILPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardParam.h>
namespace VCARD
{
class EmailParam : public Param
{
#include "EmailParam-generated.h"
- QCString emailType() { parse(); return emailType_; }
+ Q3CString emailType() { parse(); return emailType_; }
bool pref() { parse(); return pref_; }
- void setEmailType(const QCString & s)
+ void setEmailType(const Q3CString & s)
{ emailType_ = s; assembled_ = false; }
void setPref(bool b)
{ pref_ = b; assembled_ = false; }
private:
- QCString emailType_;
+ Q3CString emailType_;
bool pref_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardEntity.h b/kabc/vcard/include/VCardEntity.h
index 3c945b5..1a3d20f 100644
--- a/kabc/vcard/include/VCardEntity.h
+++ b/kabc/vcard/include/VCardEntity.h
@@ -1,67 +1,67 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef ENTITY_H
#define ENTITY_H
-#include <qcstring.h>
+#include <q3cstring.h>
namespace VCARD
{
class Entity
{
public:
Entity();
Entity(const Entity & e);
- Entity(const QCString & s);
+ Entity(const Q3CString & s);
virtual Entity & operator = (const Entity & e);
- virtual Entity & operator = (const QCString & s);
+ virtual Entity & operator = (const Q3CString & s);
virtual bool operator == (Entity & e);
virtual bool operator != (Entity & e);
- virtual bool operator == (const QCString & s);
- virtual bool operator != (const QCString & s);
+ virtual bool operator == (const Q3CString & s);
+ virtual bool operator != (const Q3CString & s);
virtual ~Entity();
- QCString asString();
+ Q3CString asString();
virtual void parse();
virtual void assemble();
virtual void _parse() = 0;
virtual void _assemble() = 0;
protected:
- QCString strRep_;
+ Q3CString strRep_;
bool parsed_;
bool assembled_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardEnum.h b/kabc/vcard/include/VCardEnum.h
index b4e4094..0c35e5e 100644
--- a/kabc/vcard/include/VCardEnum.h
+++ b/kabc/vcard/include/VCardEnum.h
@@ -1,120 +1,120 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef ENUM_H
#define ENUM_H
-#include <qcstring.h>
+#include <q3cstring.h>
namespace VCARD
{
-extern const QCString paramNames [];
+extern const Q3CString paramNames [];
enum EntityType {
EntityName,
EntityProfile,
EntitySource,
EntityFullName,
EntityN,
EntityNickname,
EntityPhoto,
EntityBirthday,
EntityAddress,
EntityLabel,
EntityTelephone,
EntityEmail,
EntityMailer,
EntityTimeZone,
EntityGeo,
EntityTitle,
EntityRole,
EntityLogo,
EntityAgent,
EntityOrganisation,
EntityCategories,
EntityNote,
EntityProductID,
EntityRevision,
EntitySortString,
EntitySound,
EntityUID,
EntityURL,
EntityVersion,
EntityClass,
EntityKey,
EntityExtension,
EntityUnknown
};
enum ValueType {
ValueSound,
ValueAgent,
ValueAddress,
ValueTel,
ValueTextBin,
ValueOrg,
ValueN,
ValueUTC,
ValueURI,
ValueClass,
ValueFloat,
ValueImage,
ValueDate,
ValueTextList,
ValueText,
ValueGeo,
ValueUnknown
};
enum ParamType {
ParamUnknown,
ParamNone,
ParamSource,
ParamText,
ParamImage,
ParamDate,
ParamAddrText,
ParamTel,
ParamEmail,
ParamMailer,
ParamAgent,
ParamTextBin,
ParamTextNS,
ParamSound
};
extern const ParamType paramTypesTable[];
ParamType EntityTypeToParamType(EntityType);
ValueType EntityTypeToValueType(EntityType);
-QCString EntityTypeToParamName(EntityType);
-EntityType EntityNameToEntityType(const QCString &);
+Q3CString EntityTypeToParamName(EntityType);
+EntityType EntityNameToEntityType(const Q3CString &);
char * encodeBase64(const char *, unsigned long, unsigned long &);
char * decodeBase64(const char *, unsigned long, unsigned long &);
}
#endif
diff --git a/kabc/vcard/include/VCardFloatValue.h b/kabc/vcard/include/VCardFloatValue.h
index 69fdc22..cac7a91 100644
--- a/kabc/vcard/include/VCardFloatValue.h
+++ b/kabc/vcard/include/VCardFloatValue.h
@@ -1,51 +1,51 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef FLOATVALUE_H
#define FLOATVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class FloatValue : public Value
{
#include "FloatValue-generated.h"
FloatValue(float);
float value();
void setValue(float);
private:
float value_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardImageParam.h b/kabc/vcard/include/VCardImageParam.h
index ce99ccc..2785331 100644
--- a/kabc/vcard/include/VCardImageParam.h
+++ b/kabc/vcard/include/VCardImageParam.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef IMGPARAM_H
#define IMGPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardParam.h>
namespace VCARD
{
class ImageParam : public Param
{
#include "ImageParam-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardImageValue.h b/kabc/vcard/include/VCardImageValue.h
index 6ce0371..3b64731 100644
--- a/kabc/vcard/include/VCardImageValue.h
+++ b/kabc/vcard/include/VCardImageValue.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef IMAGEVALUE_H
#define IMAGEVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class ImageValue : public Value
{
#include "ImageValue-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardLangValue.h b/kabc/vcard/include/VCardLangValue.h
index 991ceed..319de76 100644
--- a/kabc/vcard/include/VCardLangValue.h
+++ b/kabc/vcard/include/VCardLangValue.h
@@ -1,51 +1,51 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef LANGVALUE_H
#define LANGVALUE_H
-#include <qcstring.h>
-#include <qstrlist.h>
+#include <q3cstring.h>
+#include <q3strlist.h>
#include <VCardValue.h>
namespace VCARD
{
class LangValue : public Value
{
#include "LangValue-generated.h"
- QCString primary();
- QStrList subtags();
+ Q3CString primary();
+ Q3StrList subtags();
- void setPrimary(const QCString &);
- void setSubTags(const QStrList &);
+ void setPrimary(const Q3CString &);
+ void setSubTags(const Q3StrList &);
- QCString primary_;
- QStrList subtags_;
+ Q3CString primary_;
+ Q3StrList subtags_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardNValue.h b/kabc/vcard/include/VCardNValue.h
index 306821b..ffc5355 100644
--- a/kabc/vcard/include/VCardNValue.h
+++ b/kabc/vcard/include/VCardNValue.h
@@ -1,56 +1,58 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef NVALUE_H
#define NVALUE_H
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
namespace VCARD
{
class NValue : public Value
{
#include "NValue-generated.h"
NValue *clone();
- QCString family() { parse(); return family_; }
- QCString given() { parse(); return given_; }
- QCString middle() { parse(); return middle_; }
- QCString prefix() { parse(); return prefix_; }
- QCString suffix() { parse(); return suffix_; }
+ Q3CString family() { parse(); return family_; }
+ Q3CString given() { parse(); return given_; }
+ Q3CString middle() { parse(); return middle_; }
+ Q3CString prefix() { parse(); return prefix_; }
+ Q3CString suffix() { parse(); return suffix_; }
- void setFamily (const QCString & s) { family_ = s; assembled_ = false; }
- void setGiven (const QCString & s) { given_ = s; assembled_ = false; }
- void setMiddle (const QCString & s) { middle_ = s; assembled_ = false; }
- void setPrefix (const QCString & s) { prefix_ = s; assembled_ = false; }
- void setSuffix (const QCString & s) { suffix_ = s; assembled_ = false; }
+ void setFamily (const Q3CString & s) { family_ = s; assembled_ = false; }
+ void setGiven (const Q3CString & s) { given_ = s; assembled_ = false; }
+ void setMiddle (const Q3CString & s) { middle_ = s; assembled_ = false; }
+ void setPrefix (const Q3CString & s) { prefix_ = s; assembled_ = false; }
+ void setSuffix (const Q3CString & s) { suffix_ = s; assembled_ = false; }
private:
- QCString family_, given_, middle_, prefix_, suffix_;
+ Q3CString family_, given_, middle_, prefix_, suffix_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardOrgValue.h b/kabc/vcard/include/VCardOrgValue.h
index c4f3f25..2e5d32f 100644
--- a/kabc/vcard/include/VCardOrgValue.h
+++ b/kabc/vcard/include/VCardOrgValue.h
@@ -1,50 +1,50 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef ORGVALUE_H
#define ORGVALUE_H
-#include <qcstring.h>
-#include <qstrlist.h>
+#include <q3cstring.h>
+#include <q3strlist.h>
#include <VCardValue.h>
namespace VCARD
{
class OrgValue : public Value
{
#include "OrgValue-generated.h"
unsigned int numValues();
- QCString value(unsigned int);
+ Q3CString value(unsigned int);
private:
- QStrList valueList_;
+ Q3StrList valueList_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardParam.h b/kabc/vcard/include/VCardParam.h
index b61ce5c..b83fde1 100644
--- a/kabc/vcard/include/VCardParam.h
+++ b/kabc/vcard/include/VCardParam.h
@@ -1,59 +1,59 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PARAM_H
#define PARAM_H
-#include <qcstring.h>
-#include <qptrlist.h>
+#include <q3cstring.h>
+#include <q3ptrlist.h>
#include <VCardEntity.h>
namespace VCARD
{
class Param : public Entity
{
#include "Param-generated.h"
- Param(const QCString &name, const QCString &value);
+ Param(const Q3CString &name, const Q3CString &value);
- void setName(const QCString &);
- void setValue(const QCString &);
+ void setName(const Q3CString &);
+ void setValue(const Q3CString &);
- QCString name();
- QCString value();
+ Q3CString name();
+ Q3CString value();
private:
- QCString name_;
- QCString value_;
+ Q3CString name_;
+ Q3CString value_;
};
-typedef QPtrList<Param> ParamList;
-typedef QPtrListIterator<Param> ParamListIterator;
+typedef Q3PtrList<Param> ParamList;
+typedef Q3PtrListIterator<Param> ParamListIterator;
}
#endif
diff --git a/kabc/vcard/include/VCardRToken.h b/kabc/vcard/include/VCardRToken.h
index 2f95f1b..4a5adb2 100644
--- a/kabc/vcard/include/VCardRToken.h
+++ b/kabc/vcard/include/VCardRToken.h
@@ -1,38 +1,38 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef RTOKEN_H
#define RTOKEN_H
-#include <qstrlist.h>
+#include <q3strlist.h>
namespace VCARD
{
-Q_UINT32 RTokenise(const char * str, const char * delim, QStrList & l);
+Q_UINT32 RTokenise(const char * str, const char * delim, Q3StrList & l);
}
#endif
diff --git a/kabc/vcard/include/VCardSoundValue.h b/kabc/vcard/include/VCardSoundValue.h
index 994f55e..26f750b 100644
--- a/kabc/vcard/include/VCardSoundValue.h
+++ b/kabc/vcard/include/VCardSoundValue.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SOUNDVALUE_H
#define SOUNDVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class SoundValue : public Value
{
#include "SoundValue-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardSourceParam.h b/kabc/vcard/include/VCardSourceParam.h
index 887ea20..5218864 100644
--- a/kabc/vcard/include/VCardSourceParam.h
+++ b/kabc/vcard/include/VCardSourceParam.h
@@ -1,58 +1,58 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SOURCEPARAM_H
#define SOURCEPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardParam.h>
namespace VCARD
{
class SourceParam : public Param
{
#include "SourceParam-generated.h"
enum SourceParamType { TypeUnknown, TypeValue, TypeContext, TypeX };
SourceParamType type() { parse(); return type_;}
- QCString par() { parse(); return par_; }
- QCString val() { parse(); return val_; }
+ Q3CString par() { parse(); return par_; }
+ Q3CString val() { parse(); return val_; }
void setType(SourceParamType t) { type_ = t; assembled_ = false; }
- void setPar(const QCString & s) { par_ = s; assembled_ = false; }
- void setVal(const QCString & s) { val_ = s; assembled_ = false; }
+ void setPar(const Q3CString & s) { par_ = s; assembled_ = false; }
+ void setVal(const Q3CString & s) { val_ = s; assembled_ = false; }
private:
SourceParamType type_;
// May be "VALUE = uri" or "CONTEXT = word" or "x-name = *SAFE-CHAR"
- QCString par_, val_; // Sub-parameter, value
+ Q3CString par_, val_; // Sub-parameter, value
};
}
#endif
diff --git a/kabc/vcard/include/VCardTelParam.h b/kabc/vcard/include/VCardTelParam.h
index 27d7dcc..0c45a3a 100644
--- a/kabc/vcard/include/VCardTelParam.h
+++ b/kabc/vcard/include/VCardTelParam.h
@@ -1,51 +1,53 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TELPARAM_H
#define TELPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include <VCardParam.h>
namespace VCARD
{
class TelParam : public Param
{
#include "TelParam-generated.h"
enum TelType {
TelHome, TelWork, TelPref, TelVoice, TelFex, TelMsg, TelCell,
TelPager, TelBBS, TelModem, TelCar, TelISDN, TelVideo, TelPCS,
TelIANA, TelX
};
private:
- QPtrList<TelType> types_;
+ Q3PtrList<TelType> types_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardTelValue.h b/kabc/vcard/include/VCardTelValue.h
index 9cf5a98..a119e4a 100644
--- a/kabc/vcard/include/VCardTelValue.h
+++ b/kabc/vcard/include/VCardTelValue.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TELVALUE_H
#define TELVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class TelValue : public Value
{
#include "TelValue-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardTextBinParam.h b/kabc/vcard/include/VCardTextBinParam.h
index 31dec86..d186995 100644
--- a/kabc/vcard/include/VCardTextBinParam.h
+++ b/kabc/vcard/include/VCardTextBinParam.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TEXTBINPARAM_H
#define TEXTBINPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardParam.h>
namespace VCARD
{
class TextBinParam : public Param
{
#include "TextBinParam-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardTextBinValue.h b/kabc/vcard/include/VCardTextBinValue.h
index 8d44fdf..3924f2a 100644
--- a/kabc/vcard/include/VCardTextBinValue.h
+++ b/kabc/vcard/include/VCardTextBinValue.h
@@ -1,67 +1,67 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TEXTBINVALUE_H
#define TEXTBINVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class TextBinValue : public Value
{
#include "TextBinValue-generated.h"
TextBinValue *clone();
bool isBinary() { parse(); return mIsBinary_; }
QByteArray data() { parse(); return mData_; }
QString url() { parse(); return mUrl_; }
void setData( const QByteArray &data )
{
mData_ = data;
mIsBinary_ = true;
assembled_ = false;
}
void setUrl( const QString &url )
{
mUrl_ = url;
mIsBinary_ = false;
assembled_ = false;
}
private:
int mIsBinary_;
QByteArray mData_;
QString mUrl_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardTextListValue.h b/kabc/vcard/include/VCardTextListValue.h
index 8e47af5..ac42a29 100644
--- a/kabc/vcard/include/VCardTextListValue.h
+++ b/kabc/vcard/include/VCardTextListValue.h
@@ -1,51 +1,51 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TEXTLISTVALUE_H
#define TEXTLISTVALUE_H
-#include <qstrlist.h>
+#include <q3strlist.h>
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class TextListValue : public Value
{
#include "TextListValue-generated.h"
unsigned int numValues();
- QCString value(unsigned int);
+ Q3CString value(unsigned int);
private:
- QStrList valueList_;
+ Q3StrList valueList_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardTextParam.h b/kabc/vcard/include/VCardTextParam.h
index 08b5f57..2503337 100644
--- a/kabc/vcard/include/VCardTextParam.h
+++ b/kabc/vcard/include/VCardTextParam.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TEXTPARAM_H
#define TEXTPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardParam.h>
namespace VCARD
{
class TextParam : public Param
{
#include "TextParam-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardURIValue.h b/kabc/vcard/include/VCardURIValue.h
index 5fd7184..116e4c8 100644
--- a/kabc/vcard/include/VCardURIValue.h
+++ b/kabc/vcard/include/VCardURIValue.h
@@ -1,52 +1,54 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef URIVALUE_H
#define URIVALUE_H
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
namespace VCARD
{
class URIValue : public Value
{
#include "URIValue-generated.h"
- URIValue(const QCString & scheme, const QCString & schemeSpecificPart);
+ URIValue(const Q3CString & scheme, const Q3CString & schemeSpecificPart);
- QCString scheme();
- QCString schemeSpecificPart();
+ Q3CString scheme();
+ Q3CString schemeSpecificPart();
- void setScheme (const QCString &);
- void setSchemeSpecificPart (const QCString &);
+ void setScheme (const Q3CString &);
+ void setSchemeSpecificPart (const Q3CString &);
private:
- QCString scheme_;
- QCString schemeSpecificPart_;
+ Q3CString scheme_;
+ Q3CString schemeSpecificPart_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardUTCValue.h b/kabc/vcard/include/VCardUTCValue.h
index ff695e0..eb69829 100644
--- a/kabc/vcard/include/VCardUTCValue.h
+++ b/kabc/vcard/include/VCardUTCValue.h
@@ -1,58 +1,58 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef UTCVALUE_H
#define UTCVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class UTCValue : public Value
{
#include "UTCValue-generated.h"
UTCValue *clone();
void setPositive( int p ) { positive_ = p; assembled_ = false; }
void setHour( int h ) { hour_ = h; assembled_ = false; }
void setMinute( int m ) { minute_ = m; assembled_ = false; }
bool positive() { parse(); return positive_; }
unsigned int hour() { parse(); return hour_; }
unsigned int minute() { parse(); return minute_; }
private:
bool positive_;
unsigned int hour_;
unsigned int minute_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardVCard.h b/kabc/vcard/include/VCardVCard.h
index 5dec166..5b66074 100644
--- a/kabc/vcard/include/VCardVCard.h
+++ b/kabc/vcard/include/VCardVCard.h
@@ -1,63 +1,65 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VCARD_VCARD_H
#define VCARD_VCARD_H
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <VCardEnum.h>
#include <VCardEntity.h>
#include <VCardContentLine.h>
namespace VCARD
{
class VCard : public Entity
{
#include "VCard-generated.h"
bool has(EntityType);
- bool has(const QCString &);
+ bool has(const Q3CString &);
void add(const ContentLine &);
- void add(const QCString &);
+ void add(const Q3CString &);
ContentLine * contentLine(EntityType);
- ContentLine * contentLine(const QCString &);
+ ContentLine * contentLine(const Q3CString &);
- QCString group() { parse(); return group_; }
+ Q3CString group() { parse(); return group_; }
- QPtrList<ContentLine> contentLineList() { parse(); return contentLineList_; }
+ Q3PtrList<ContentLine> contentLineList() { parse(); return contentLineList_; }
private:
- QCString group_;
- QPtrList<ContentLine> contentLineList_;
+ Q3CString group_;
+ Q3PtrList<ContentLine> contentLineList_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardVCardEntity.h b/kabc/vcard/include/VCardVCardEntity.h
index 47ba370..8c824e7 100644
--- a/kabc/vcard/include/VCardVCardEntity.h
+++ b/kabc/vcard/include/VCardVCardEntity.h
@@ -1,56 +1,56 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VCARD_ENTITY_H
#define VCARD_ENTITY_H
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <VCardEnum.h>
#include <VCardVCard.h>
#include <VCardEntity.h>
namespace VCARD
{
-typedef QPtrList<VCard> VCardList;
-typedef QPtrListIterator<VCard> VCardListIterator;
+typedef Q3PtrList<VCard> VCardList;
+typedef Q3PtrListIterator<VCard> VCardListIterator;
class VCardEntity : public Entity
{
#include "VCardEntity-generated.h"
void setCardList(const VCardList & l);
VCardList & cardList();
private:
VCardList cardList_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardValue.h b/kabc/vcard/include/VCardValue.h
index 7cfe4a0..024397c 100644
--- a/kabc/vcard/include/VCardValue.h
+++ b/kabc/vcard/include/VCardValue.h
@@ -1,46 +1,46 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VALUE_H
#define VALUE_H
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <VCardEntity.h>
namespace VCARD
{
class Value : public Entity
{
#include "Value-generated.h"
virtual Value *clone() { return new Value( *this ); }
};
-typedef QPtrList<Value> ValueList;
-typedef QPtrListIterator<Value> ValueListIterator;
+typedef Q3PtrList<Value> ValueList;
+typedef Q3PtrListIterator<Value> ValueListIterator;
}
#endif
diff --git a/kabc/vcard/include/generated/AdrParam-generated.h b/kabc/vcard/include/generated/AdrParam-generated.h
index 3e265d8..a11d142 100644
--- a/kabc/vcard/include/generated/AdrParam-generated.h
+++ b/kabc/vcard/include/generated/AdrParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
AdrParam();
AdrParam(const AdrParam&);
-AdrParam(const QCString&);
+AdrParam(const Q3CString&);
AdrParam & operator = (AdrParam&);
-AdrParam & operator = (const QCString&);
+AdrParam & operator = (const Q3CString&);
bool operator ==(AdrParam&);
bool operator !=(AdrParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {AdrParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {AdrParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~AdrParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "AdrParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/AdrValue-generated.h b/kabc/vcard/include/generated/AdrValue-generated.h
index e1d93e4..c0a33a3 100644
--- a/kabc/vcard/include/generated/AdrValue-generated.h
+++ b/kabc/vcard/include/generated/AdrValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
AdrValue();
AdrValue(const AdrValue&);
-AdrValue(const QCString&);
+AdrValue(const Q3CString&);
AdrValue & operator = (AdrValue&);
-AdrValue & operator = (const QCString&);
+AdrValue & operator = (const Q3CString&);
bool operator ==(AdrValue&);
bool operator !=(AdrValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {AdrValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {AdrValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~AdrValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "AdrValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/AgentParam-generated.h b/kabc/vcard/include/generated/AgentParam-generated.h
index 6423867..d5ed988 100644
--- a/kabc/vcard/include/generated/AgentParam-generated.h
+++ b/kabc/vcard/include/generated/AgentParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
AgentParam();
AgentParam(const AgentParam&);
-AgentParam(const QCString&);
+AgentParam(const Q3CString&);
AgentParam & operator = (AgentParam&);
-AgentParam & operator = (const QCString&);
+AgentParam & operator = (const Q3CString&);
bool operator ==(AgentParam&);
bool operator !=(AgentParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {AgentParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {AgentParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~AgentParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "AgentParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/AgentValue-generated.h b/kabc/vcard/include/generated/AgentValue-generated.h
index 76bb81c..eef5277 100644
--- a/kabc/vcard/include/generated/AgentValue-generated.h
+++ b/kabc/vcard/include/generated/AgentValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
AgentValue();
AgentValue(const AgentValue&);
-AgentValue(const QCString&);
+AgentValue(const Q3CString&);
AgentValue & operator = (AgentValue&);
-AgentValue & operator = (const QCString&);
+AgentValue & operator = (const Q3CString&);
bool operator ==(AgentValue&);
bool operator !=(AgentValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {AgentValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {AgentValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~AgentValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "AgentValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ClassValue-generated.h b/kabc/vcard/include/generated/ClassValue-generated.h
index df4ed5f..b84c98f 100644
--- a/kabc/vcard/include/generated/ClassValue-generated.h
+++ b/kabc/vcard/include/generated/ClassValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
ClassValue();
ClassValue(const ClassValue&);
-ClassValue(const QCString&);
+ClassValue(const Q3CString&);
ClassValue & operator = (ClassValue&);
-ClassValue & operator = (const QCString&);
+ClassValue & operator = (const Q3CString&);
bool operator ==(ClassValue&);
bool operator !=(ClassValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {ClassValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {ClassValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~ClassValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "ClassValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ContentLine-generated.h b/kabc/vcard/include/generated/ContentLine-generated.h
index 9efe273..84d0822 100644
--- a/kabc/vcard/include/generated/ContentLine-generated.h
+++ b/kabc/vcard/include/generated/ContentLine-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
ContentLine();
ContentLine(const ContentLine&);
-ContentLine(const QCString&);
+ContentLine(const Q3CString&);
ContentLine & operator = (ContentLine&);
-ContentLine & operator = (const QCString&);
+ContentLine & operator = (const Q3CString&);
bool operator ==(ContentLine&);
bool operator !=(ContentLine& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {ContentLine a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {ContentLine a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~ContentLine();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "ContentLine"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/DateParam-generated.h b/kabc/vcard/include/generated/DateParam-generated.h
index ff1da58..029c1da 100644
--- a/kabc/vcard/include/generated/DateParam-generated.h
+++ b/kabc/vcard/include/generated/DateParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
DateParam();
DateParam(const DateParam&);
-DateParam(const QCString&);
+DateParam(const Q3CString&);
DateParam & operator = (DateParam&);
-DateParam & operator = (const QCString&);
+DateParam & operator = (const Q3CString&);
bool operator ==(DateParam&);
bool operator !=(DateParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {DateParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {DateParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~DateParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "DateParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/DateValue-generated.h b/kabc/vcard/include/generated/DateValue-generated.h
index a382823..70eecce 100644
--- a/kabc/vcard/include/generated/DateValue-generated.h
+++ b/kabc/vcard/include/generated/DateValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
DateValue();
DateValue(const DateValue&);
-DateValue(const QCString&);
+DateValue(const Q3CString&);
DateValue & operator = (DateValue&);
-DateValue & operator = (const QCString&);
+DateValue & operator = (const Q3CString&);
bool operator ==(DateValue&);
bool operator !=(DateValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {DateValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {DateValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~DateValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "DateValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/EmailParam-generated.h b/kabc/vcard/include/generated/EmailParam-generated.h
index 428a6fc..f498931 100644
--- a/kabc/vcard/include/generated/EmailParam-generated.h
+++ b/kabc/vcard/include/generated/EmailParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
EmailParam();
EmailParam(const EmailParam&);
-EmailParam(const QCString&);
+EmailParam(const Q3CString&);
EmailParam & operator = (EmailParam&);
-EmailParam & operator = (const QCString&);
+EmailParam & operator = (const Q3CString&);
bool operator ==(EmailParam&);
bool operator !=(EmailParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {EmailParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {EmailParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~EmailParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "EmailParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/FloatValue-generated.h b/kabc/vcard/include/generated/FloatValue-generated.h
index cac55cf..c04b85f 100644
--- a/kabc/vcard/include/generated/FloatValue-generated.h
+++ b/kabc/vcard/include/generated/FloatValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
FloatValue();
FloatValue(const FloatValue&);
-FloatValue(const QCString&);
+FloatValue(const Q3CString&);
FloatValue & operator = (FloatValue&);
-FloatValue & operator = (const QCString&);
+FloatValue & operator = (const Q3CString&);
bool operator ==(FloatValue&);
bool operator !=(FloatValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {FloatValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {FloatValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~FloatValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "FloatValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/GeoValue-generated.h b/kabc/vcard/include/generated/GeoValue-generated.h
index 594f3ad..ab659bf 100644
--- a/kabc/vcard/include/generated/GeoValue-generated.h
+++ b/kabc/vcard/include/generated/GeoValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
GeoValue();
GeoValue(const GeoValue&);
-GeoValue(const QCString&);
+GeoValue(const Q3CString&);
GeoValue & operator = (GeoValue&);
-GeoValue & operator = (const QCString&);
+GeoValue & operator = (const Q3CString&);
bool operator ==(GeoValue&);
bool operator !=(GeoValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {GeoValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {GeoValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~GeoValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "GeoValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/Group-generated.h b/kabc/vcard/include/generated/Group-generated.h
index f39302d..ae16e3d 100644
--- a/kabc/vcard/include/generated/Group-generated.h
+++ b/kabc/vcard/include/generated/Group-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
Group();
Group(const Group&);
-Group(const QCString&);
+Group(const Q3CString&);
Group & operator = (Group&);
-Group & operator = (const QCString&);
+Group & operator = (const Q3CString&);
bool operator ==(Group&);
bool operator !=(Group& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {Group a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {Group a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~Group();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "Group"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ImageParam-generated.h b/kabc/vcard/include/generated/ImageParam-generated.h
index 81edfd2..91b09a4 100644
--- a/kabc/vcard/include/generated/ImageParam-generated.h
+++ b/kabc/vcard/include/generated/ImageParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
ImageParam();
ImageParam(const ImageParam&);
-ImageParam(const QCString&);
+ImageParam(const Q3CString&);
ImageParam & operator = (ImageParam&);
-ImageParam & operator = (const QCString&);
+ImageParam & operator = (const Q3CString&);
bool operator ==(ImageParam&);
bool operator !=(ImageParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {ImageParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {ImageParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~ImageParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "ImageParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ImageValue-generated.h b/kabc/vcard/include/generated/ImageValue-generated.h
index 5a2c493..d71282e 100644
--- a/kabc/vcard/include/generated/ImageValue-generated.h
+++ b/kabc/vcard/include/generated/ImageValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
ImageValue();
ImageValue(const ImageValue&);
-ImageValue(const QCString&);
+ImageValue(const Q3CString&);
ImageValue & operator = (ImageValue&);
-ImageValue & operator = (const QCString&);
+ImageValue & operator = (const Q3CString&);
bool operator ==(ImageValue&);
bool operator !=(ImageValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {ImageValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {ImageValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~ImageValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "ImageValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ImgParam-generated.h b/kabc/vcard/include/generated/ImgParam-generated.h
index 46a6ca0..461ca6d 100644
--- a/kabc/vcard/include/generated/ImgParam-generated.h
+++ b/kabc/vcard/include/generated/ImgParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
ImgParam();
ImgParam(const ImgParam&);
-ImgParam(const QCString&);
+ImgParam(const Q3CString&);
ImgParam & operator = (ImgParam&);
-ImgParam & operator = (const QCString&);
+ImgParam & operator = (const Q3CString&);
bool operator ==(ImgParam&);
bool operator !=(ImgParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {ImgParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {ImgParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~ImgParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
virtual const char * className() const { return "ImgParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ImgValue-generated.h b/kabc/vcard/include/generated/ImgValue-generated.h
index d75d545..80ee646 100644
--- a/kabc/vcard/include/generated/ImgValue-generated.h
+++ b/kabc/vcard/include/generated/ImgValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
ImgValue();
ImgValue(const ImgValue&);
-ImgValue(const QCString&);
+ImgValue(const Q3CString&);
ImgValue & operator = (ImgValue&);
-ImgValue & operator = (const QCString&);
+ImgValue & operator = (const Q3CString&);
bool operator ==(ImgValue&);
bool operator !=(ImgValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {ImgValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {ImgValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~ImgValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
virtual const char * className() const { return "ImgValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/LangValue-generated.h b/kabc/vcard/include/generated/LangValue-generated.h
index 23e138b..434f762 100644
--- a/kabc/vcard/include/generated/LangValue-generated.h
+++ b/kabc/vcard/include/generated/LangValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
LangValue();
LangValue(const LangValue&);
-LangValue(const QCString&);
+LangValue(const Q3CString&);
LangValue & operator = (LangValue&);
-LangValue & operator = (const QCString&);
+LangValue & operator = (const Q3CString&);
bool operator ==(LangValue&);
bool operator !=(LangValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {LangValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {LangValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~LangValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "LangValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/NValue-generated.h b/kabc/vcard/include/generated/NValue-generated.h
index 082c253..086810f 100644
--- a/kabc/vcard/include/generated/NValue-generated.h
+++ b/kabc/vcard/include/generated/NValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
NValue();
NValue(const NValue&);
-NValue(const QCString&);
+NValue(const Q3CString&);
NValue & operator = (NValue&);
-NValue & operator = (const QCString&);
+NValue & operator = (const Q3CString&);
bool operator ==(NValue&);
bool operator !=(NValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {NValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {NValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~NValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "NValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/Name-generated.h b/kabc/vcard/include/generated/Name-generated.h
index 0e69abd..a3bcb25 100644
--- a/kabc/vcard/include/generated/Name-generated.h
+++ b/kabc/vcard/include/generated/Name-generated.h
@@ -1,22 +1,24 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
V_Name();
V_Name(const V_Name&);
-V_Name(const QCString&);
+V_Name(const Q3CString&);
V_Name & operator = (V_Name&);
-V_Name & operator = (const QCString&);
+V_Name & operator = (const Q3CString&);
bool operator ==(V_Name&);
bool operator !=(V_Name& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {V_Name a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {V_Name a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~V_Name();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/OrgValue-generated.h b/kabc/vcard/include/generated/OrgValue-generated.h
index 51eb1b7..275f56f 100644
--- a/kabc/vcard/include/generated/OrgValue-generated.h
+++ b/kabc/vcard/include/generated/OrgValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
OrgValue();
OrgValue(const OrgValue&);
-OrgValue(const QCString&);
+OrgValue(const Q3CString&);
OrgValue & operator = (OrgValue&);
-OrgValue & operator = (const QCString&);
+OrgValue & operator = (const Q3CString&);
bool operator ==(OrgValue&);
bool operator !=(OrgValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {OrgValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {OrgValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~OrgValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "OrgValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/Param-generated.h b/kabc/vcard/include/generated/Param-generated.h
index cf4666a..1a35166 100644
--- a/kabc/vcard/include/generated/Param-generated.h
+++ b/kabc/vcard/include/generated/Param-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
Param();
Param(const Param&);
-Param(const QCString&);
+Param(const Q3CString&);
Param & operator = (Param&);
-Param & operator = (const QCString&);
+Param & operator = (const Q3CString&);
bool operator ==(Param&);
bool operator !=(Param& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {Param a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {Param a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~Param();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "Param"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ParamName-generated.h b/kabc/vcard/include/generated/ParamName-generated.h
index ef673c3..b45022e 100644
--- a/kabc/vcard/include/generated/ParamName-generated.h
+++ b/kabc/vcard/include/generated/ParamName-generated.h
@@ -1,22 +1,24 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
V_ParamName();
V_ParamName(const V_ParamName&);
-V_ParamName(const QCString&);
+V_ParamName(const Q3CString&);
V_ParamName & operator = (V_ParamName&);
-V_ParamName & operator = (const QCString&);
+V_ParamName & operator = (const Q3CString&);
bool operator ==(V_ParamName&);
bool operator !=(V_ParamName& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {V_ParamName a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {V_ParamName a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~V_ParamName();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ParamValue-generated.h b/kabc/vcard/include/generated/ParamValue-generated.h
index e73500f..956c8da 100644
--- a/kabc/vcard/include/generated/ParamValue-generated.h
+++ b/kabc/vcard/include/generated/ParamValue-generated.h
@@ -1,22 +1,24 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
V_ParamValue();
V_ParamValue(const V_ParamValue&);
-V_ParamValue(const QCString&);
+V_ParamValue(const Q3CString&);
V_ParamValue & operator = (V_ParamValue&);
-V_ParamValue & operator = (const QCString&);
+V_ParamValue & operator = (const Q3CString&);
bool operator ==(V_ParamValue&);
bool operator !=(V_ParamValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {V_ParamValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {V_ParamValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~V_ParamValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/PhoneNumberValue-generated.h b/kabc/vcard/include/generated/PhoneNumberValue-generated.h
index 1320f18..0d206f4 100644
--- a/kabc/vcard/include/generated/PhoneNumberValue-generated.h
+++ b/kabc/vcard/include/generated/PhoneNumberValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
PhoneNumberValue();
PhoneNumberValue(const PhoneNumberValue&);
-PhoneNumberValue(const QCString&);
+PhoneNumberValue(const Q3CString&);
PhoneNumberValue & operator = (PhoneNumberValue&);
-PhoneNumberValue & operator = (const QCString&);
+PhoneNumberValue & operator = (const Q3CString&);
bool operator ==(PhoneNumberValue&);
bool operator !=(PhoneNumberValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {PhoneNumberValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {PhoneNumberValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~PhoneNumberValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "PhoneNumberValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/SoundValue-generated.h b/kabc/vcard/include/generated/SoundValue-generated.h
index a9ab2e8..2cc9c0d 100644
--- a/kabc/vcard/include/generated/SoundValue-generated.h
+++ b/kabc/vcard/include/generated/SoundValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
SoundValue();
SoundValue(const SoundValue&);
-SoundValue(const QCString&);
+SoundValue(const Q3CString&);
SoundValue & operator = (SoundValue&);
-SoundValue & operator = (const QCString&);
+SoundValue & operator = (const Q3CString&);
bool operator ==(SoundValue&);
bool operator !=(SoundValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {SoundValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {SoundValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~SoundValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "SoundValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/SourceParam-generated.h b/kabc/vcard/include/generated/SourceParam-generated.h
index 75fefb8..537e093 100644
--- a/kabc/vcard/include/generated/SourceParam-generated.h
+++ b/kabc/vcard/include/generated/SourceParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
SourceParam();
SourceParam(const SourceParam&);
-SourceParam(const QCString&);
+SourceParam(const Q3CString&);
SourceParam & operator = (SourceParam&);
-SourceParam & operator = (const QCString&);
+SourceParam & operator = (const Q3CString&);
bool operator ==(SourceParam&);
bool operator !=(SourceParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {SourceParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {SourceParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~SourceParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "SourceParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TelParam-generated.h b/kabc/vcard/include/generated/TelParam-generated.h
index 3ee77cc..8d9ba0f 100644
--- a/kabc/vcard/include/generated/TelParam-generated.h
+++ b/kabc/vcard/include/generated/TelParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TelParam();
TelParam(const TelParam&);
-TelParam(const QCString&);
+TelParam(const Q3CString&);
TelParam & operator = (TelParam&);
-TelParam & operator = (const QCString&);
+TelParam & operator = (const Q3CString&);
bool operator ==(TelParam&);
bool operator !=(TelParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TelParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TelParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TelParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TelParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TelValue-generated.h b/kabc/vcard/include/generated/TelValue-generated.h
index 3213e1c..b72fa7d 100644
--- a/kabc/vcard/include/generated/TelValue-generated.h
+++ b/kabc/vcard/include/generated/TelValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TelValue();
TelValue(const TelValue&);
-TelValue(const QCString&);
+TelValue(const Q3CString&);
TelValue & operator = (TelValue&);
-TelValue & operator = (const QCString&);
+TelValue & operator = (const Q3CString&);
bool operator ==(TelValue&);
bool operator !=(TelValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TelValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TelValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TelValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TelValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TextBinParam-generated.h b/kabc/vcard/include/generated/TextBinParam-generated.h
index d075c10..2e433b0 100644
--- a/kabc/vcard/include/generated/TextBinParam-generated.h
+++ b/kabc/vcard/include/generated/TextBinParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TextBinParam();
TextBinParam(const TextBinParam&);
-TextBinParam(const QCString&);
+TextBinParam(const Q3CString&);
TextBinParam & operator = (TextBinParam&);
-TextBinParam & operator = (const QCString&);
+TextBinParam & operator = (const Q3CString&);
bool operator ==(TextBinParam&);
bool operator !=(TextBinParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TextBinParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TextBinParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TextBinParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TextBinParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TextBinValue-generated.h b/kabc/vcard/include/generated/TextBinValue-generated.h
index e9553ac..bc3ad61 100644
--- a/kabc/vcard/include/generated/TextBinValue-generated.h
+++ b/kabc/vcard/include/generated/TextBinValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TextBinValue();
TextBinValue(const TextBinValue&);
-TextBinValue(const QCString&);
+TextBinValue(const Q3CString&);
TextBinValue & operator = (TextBinValue&);
-TextBinValue & operator = (const QCString&);
+TextBinValue & operator = (const Q3CString&);
bool operator ==(TextBinValue&);
bool operator !=(TextBinValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TextBinValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TextBinValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TextBinValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TextBinValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TextListValue-generated.h b/kabc/vcard/include/generated/TextListValue-generated.h
index 9f46124..9df8a46 100644
--- a/kabc/vcard/include/generated/TextListValue-generated.h
+++ b/kabc/vcard/include/generated/TextListValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TextListValue();
TextListValue(const TextListValue&);
-TextListValue(const QCString&);
+TextListValue(const Q3CString&);
TextListValue & operator = (TextListValue&);
-TextListValue & operator = (const QCString&);
+TextListValue & operator = (const Q3CString&);
bool operator ==(TextListValue&);
bool operator !=(TextListValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TextListValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TextListValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TextListValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TextListValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TextNSParam-generated.h b/kabc/vcard/include/generated/TextNSParam-generated.h
index d7f58ca..8842bd6 100644
--- a/kabc/vcard/include/generated/TextNSParam-generated.h
+++ b/kabc/vcard/include/generated/TextNSParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TextNSParam();
TextNSParam(const TextNSParam&);
-TextNSParam(const QCString&);
+TextNSParam(const Q3CString&);
TextNSParam & operator = (TextNSParam&);
-TextNSParam & operator = (const QCString&);
+TextNSParam & operator = (const Q3CString&);
bool operator ==(TextNSParam&);
bool operator !=(TextNSParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TextNSParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TextNSParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TextNSParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TextNSParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TextParam-generated.h b/kabc/vcard/include/generated/TextParam-generated.h
index 154e1bf..e56a8a5 100644
--- a/kabc/vcard/include/generated/TextParam-generated.h
+++ b/kabc/vcard/include/generated/TextParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TextParam();
TextParam(const TextParam&);
-TextParam(const QCString&);
+TextParam(const Q3CString&);
TextParam & operator = (TextParam&);
-TextParam & operator = (const QCString&);
+TextParam & operator = (const Q3CString&);
bool operator ==(TextParam&);
bool operator !=(TextParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TextParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TextParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TextParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TextParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TextValue-generated.h b/kabc/vcard/include/generated/TextValue-generated.h
index e1c4dcc..3f205e0 100644
--- a/kabc/vcard/include/generated/TextValue-generated.h
+++ b/kabc/vcard/include/generated/TextValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TextValue();
TextValue(const TextValue&);
-TextValue(const QCString&);
+TextValue(const Q3CString&);
TextValue & operator = (TextValue&);
-TextValue & operator = (const QCString&);
+TextValue & operator = (const Q3CString&);
bool operator ==(TextValue&);
bool operator !=(TextValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TextValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TextValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TextValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TextValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/URIValue-generated.h b/kabc/vcard/include/generated/URIValue-generated.h
index dbcb5c1..464178f 100644
--- a/kabc/vcard/include/generated/URIValue-generated.h
+++ b/kabc/vcard/include/generated/URIValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
URIValue();
URIValue(const URIValue&);
-URIValue(const QCString&);
+URIValue(const Q3CString&);
URIValue & operator = (URIValue&);
-URIValue & operator = (const QCString&);
+URIValue & operator = (const Q3CString&);
bool operator ==(URIValue&);
bool operator !=(URIValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {URIValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {URIValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~URIValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "URIValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/UTCValue-generated.h b/kabc/vcard/include/generated/UTCValue-generated.h
index 46e447b..1a34b5c 100644
--- a/kabc/vcard/include/generated/UTCValue-generated.h
+++ b/kabc/vcard/include/generated/UTCValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
UTCValue();
UTCValue(const UTCValue&);
-UTCValue(const QCString&);
+UTCValue(const Q3CString&);
UTCValue & operator = (UTCValue&);
-UTCValue & operator = (const QCString&);
+UTCValue & operator = (const Q3CString&);
bool operator ==(UTCValue&);
bool operator !=(UTCValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {UTCValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {UTCValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~UTCValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "UTCValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/VCard-generated.h b/kabc/vcard/include/generated/VCard-generated.h
index 4d7d96d..d09c789 100644
--- a/kabc/vcard/include/generated/VCard-generated.h
+++ b/kabc/vcard/include/generated/VCard-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
VCard();
VCard(const VCard&);
-VCard(const QCString&);
+VCard(const Q3CString&);
VCard & operator = (VCard&);
-VCard & operator = (const QCString&);
+VCard & operator = (const Q3CString&);
bool operator ==(VCard&);
bool operator !=(VCard& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {VCard a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {VCard a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~VCard();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "VCard"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/VCardEntity-generated.h b/kabc/vcard/include/generated/VCardEntity-generated.h
index 9f2dfbc..cbbe8e1 100644
--- a/kabc/vcard/include/generated/VCardEntity-generated.h
+++ b/kabc/vcard/include/generated/VCardEntity-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
VCardEntity();
VCardEntity(const VCardEntity&);
-VCardEntity(const QCString&);
+VCardEntity(const Q3CString&);
VCardEntity & operator = (VCardEntity&);
-VCardEntity & operator = (const QCString&);
+VCardEntity & operator = (const Q3CString&);
bool operator ==(VCardEntity&);
bool operator !=(VCardEntity& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {VCardEntity a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {VCardEntity a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~VCardEntity();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "VCardEntity"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/Value-generated.h b/kabc/vcard/include/generated/Value-generated.h
index 7afac34..142e720 100644
--- a/kabc/vcard/include/generated/Value-generated.h
+++ b/kabc/vcard/include/generated/Value-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
Value();
Value(const Value&);
-Value(const QCString&);
+Value(const Q3CString&);
Value & operator = (Value&);
-Value & operator = (const QCString&);
+Value & operator = (const Q3CString&);
bool operator ==(Value&);
bool operator !=(Value& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {Value a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {Value a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~Value();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "Value"; }
// End of automatically generated code //
diff --git a/kabc/vcard/testread.cpp b/kabc/vcard/testread.cpp
index 919c661..4d66aaf 100644
--- a/kabc/vcard/testread.cpp
+++ b/kabc/vcard/testread.cpp
@@ -1,129 +1,131 @@
#include <iostream>
#include <stdlib.h>
#include <assert.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <VCard.h>
using namespace std;
int main(int argc, char * argv[])
{
if (argc != 2) {
cerr << "Usage: " << argv[0] << " <filename>" << endl;
exit(1);
}
QFile f(argv[1]);
- QCString str;
+ Q3CString str;
- if (!f.open(IO_ReadOnly)) {
+ if (!f.open(QIODevice::ReadOnly)) {
cerr << "Couldn't open file \"" << argv[1] << endl;
exit(1);
}
- QTextStream t(&f);
+ Q3TextStream t(&f);
while (!t.eof())
str += t.readLine().utf8() + '\n';
using namespace VCARD;
// Iterate through all vCards in the file.
cout << "--------- begin ----------" << endl;
cout << str.data();
cout << "--------- end ----------" << endl;
VCardEntity e(str);
VCardListIterator it(e.cardList());
for (; it.current(); ++it) {
cerr << "****************** VCARD ********************" << endl;
// Create a vcard using the string representation.
VCard & v (*it.current());
if (v.has(EntityEmail)) {
cerr << "Email parameter found" << endl;
- QCString s = v.contentLine(EntityEmail)->value()->asString();
+ Q3CString s = v.contentLine(EntityEmail)->value()->asString();
cerr << "Email value == " << s << endl;
}
if (v.has(EntityNickname)) {
cerr << "Nickname parameter found" << endl;
cerr << "Nickname value == " <<
v.contentLine(EntityNickname)->value()->asString() <<
endl;
}
if (v.has(EntityRevision)) {
cerr << "Revision parameter found" << endl;
DateValue * d =
(DateValue *)
v.contentLine(EntityRevision)->value();
assert(d != 0);
cerr << "Revision date: " << endl;
cerr << "Day : " << d->day() << endl;
cerr << "Month : " << d->month() << endl;
cerr << "Year : " << d->year() << endl;
if (d->hasTime()) {
cerr << "Revision date has a time component" << endl;
cerr << "Revision time: " << endl;
cerr << "Hour : " << d->hour() << endl;
cerr << "Minute : " << d->minute() << endl;
cerr << "Second : " << d->second() << endl;
}
else cerr << "Revision date does NOT have a time component" << endl;
}
if (v.has(EntityURL)) {
cerr << "URL Parameter found" << endl;
cerr << "URL Value == " <<
v.contentLine(EntityURL)->value()->asString() <<
endl;
URIValue * urlVal =
(URIValue *)v.contentLine(EntityURL)->value();
assert(urlVal != 0);
cerr << "URL scheme == " <<
urlVal->scheme() << endl;
cerr << "URL scheme specific part == " <<
urlVal->schemeSpecificPart() << endl;
}
if (v.has(EntityN)) {
cerr << "N Parameter found" << endl;
NValue * n =
(NValue *)(v.contentLine(EntityN)->value());
cerr << "Family name == " << n->family() << endl;
cerr << "Given name == " << n->given() << endl;
cerr << "Middle name == " << n->middle() << endl;
cerr << "Prefix == " << n->prefix() << endl;
cerr << "Suffix == " << n->suffix() << endl;
}
cerr << "***************** END VCARD ******************" << endl;
}
}
diff --git a/kabc/vcard/testwrite.cpp b/kabc/vcard/testwrite.cpp
index e4bbe7b..846e51a 100644
--- a/kabc/vcard/testwrite.cpp
+++ b/kabc/vcard/testwrite.cpp
@@ -1,41 +1,43 @@
#include <kaboutdata.h>
#include <kapplication.h>
#include <kdebug.h>
#include <klocale.h>
#include <kcmdlineargs.h>
#include <VCard.h>
+//Added by qt3to4:
+#include <Q3CString>
int main(int argc,char **argv)
{
KAboutData aboutData("testwrite",I18N_NOOP("TestWritevCard"),"0.1");
KCmdLineArgs::init(argc,argv,&aboutData);
KApplication app;
kdDebug() << "Test Write VCard" << endl;
using namespace VCARD;
VCard v;
ContentLine cl1;
cl1.setName(EntityTypeToParamName(EntityName));
cl1.setValue(new TextValue("Hans Wurst"));
v.add(cl1);
ContentLine cl2;
cl2.setName(EntityTypeToParamName(EntityTelephone));
cl2.setValue(new TelValue("12345"));
ParamList p;
p.append( new TelParam("home") );
p.append( new TelParam("fax") );
cl2.setParamList( p );
v.add(cl2);
- QCString str = v.asString();
+ Q3CString str = v.asString();
kdDebug() << "--- VCard begin ---" << endl
<< str
<< "--- VCard end ---" << endl;
}
diff --git a/kabc/vcard21parser.cpp b/kabc/vcard21parser.cpp
index 60d02b8..e24a9dc 100644
--- a/kabc/vcard21parser.cpp
+++ b/kabc/vcard21parser.cpp
@@ -1,607 +1,613 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Mark Westcott <mark@houseoffish.org>
This library is free software; you can redistribute it and/or
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 <qmap.h>
#include <qregexp.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <kmdcodec.h>
#include "vcard21parser.h"
#include "vcardconverter.h"
using namespace KABC;
bool VCardLineX::isValid() const
{
// Invalid: if it is "begin:vcard" or "end:vcard"
if ( name == VCARD_BEGIN_N || name == VCARD_END_N )
return false;
if ( name[0] == 'x' && name[1] == '-' ) // A custom x- line
return true;
// This is long but it makes it a bit faster (and saves me from using
// a tree which is probably the ideal situation, but a bit memory heavy)
- switch( name[0] ) {
+ switch( name[0].unicode() ) {
case 'a':
if ( name == VCARD_ADR && qualified &&
(qualifiers.contains(VCARD_ADR_DOM) ||
qualifiers.contains(VCARD_ADR_INTL) ||
qualifiers.contains(VCARD_ADR_POSTAL) ||
qualifiers.contains(VCARD_ADR_HOME) ||
qualifiers.contains(VCARD_ADR_WORK) ||
qualifiers.contains(VCARD_ADR_PREF)
) )
return true;
if ( name == VCARD_AGENT )
return true;
break;
case 'b':
if ( name == VCARD_BDAY )
return true;
break;
case 'c':
if ( name == VCARD_CATEGORIES )
return true;
if ( name == VCARD_CLASS && qualified &&
(qualifiers.contains(VCARD_CLASS_PUBLIC) ||
qualifiers.contains(VCARD_CLASS_PRIVATE) ||
qualifiers.contains(VCARD_CLASS_CONFIDENTIAL)
) )
return true;
break;
case 'e':
if ( name == VCARD_EMAIL && qualified &&
(qualifiers.contains(VCARD_EMAIL_INTERNET) ||
qualifiers.contains(VCARD_EMAIL_PREF) ||
qualifiers.contains(VCARD_EMAIL_X400)
) )
return true;
break;
case 'f':
if ( name == VCARD_FN )
return true;
break;
case 'g':
if ( name == VCARD_GEO )
return true;
break;
case 'k':
if ( name == VCARD_KEY && qualified &&
(qualifiers.contains(VCARD_KEY_X509) ||
qualifiers.contains(VCARD_KEY_PGP)
) )
return true;
break;
case 'l':
if ( name == VCARD_LABEL )
return true;
if ( name == VCARD_LOGO )
return true;
break;
case 'm':
if ( name == VCARD_MAILER )
return true;
break;
case 'n':
if ( name == VCARD_N )
return true;
if ( name == VCARD_NAME )
return true;
if ( name == VCARD_NICKNAME )
return true;
if ( name == VCARD_NOTE )
return true;
break;
case 'o':
if ( name == VCARD_ORG )
return true;
break;
case 'p':
if ( name == VCARD_PHOTO )
return true;
if ( name == VCARD_PROFILE )
return true;
if ( name == VCARD_PRODID )
return true;
break;
case 'r':
if ( name == VCARD_ROLE )
return true;
if ( name == VCARD_REV )
return true;
break;
case 's':
if ( name == VCARD_SOURCE )
return true;
if ( name == VCARD_SOUND )
return true;
break;
case 't':
if ( name == VCARD_TEL && qualified &&
(qualifiers.contains(VCARD_TEL_HOME) ||
qualifiers.contains(VCARD_TEL_WORK) ||
qualifiers.contains(VCARD_TEL_PREF) ||
qualifiers.contains(VCARD_TEL_VOICE) ||
qualifiers.contains(VCARD_TEL_FAX) ||
qualifiers.contains(VCARD_TEL_MSG) ||
qualifiers.contains(VCARD_TEL_CELL) ||
qualifiers.contains(VCARD_TEL_PAGER) ||
qualifiers.contains(VCARD_TEL_BBS) ||
qualifiers.contains(VCARD_TEL_MODEM) ||
qualifiers.contains(VCARD_TEL_CAR) ||
qualifiers.contains(VCARD_TEL_ISDN) ||
qualifiers.contains(VCARD_TEL_VIDEO) ||
qualifiers.contains(VCARD_TEL_PCS)
) )
return true;
if ( name == VCARD_TZ )
return true;
if ( name == VCARD_TITLE )
return true;
break;
case 'u':
if ( name == VCARD_URL )
return true;
if ( name == VCARD_UID )
return true;
break;
case 'v':
if ( name == VCARD_VERSION )
return true;
break;
default:
break;
}
return false;
}
VCard21Parser::VCard21Parser()
{
}
VCard21Parser::~VCard21Parser()
{
}
void VCard21Parser::readFromString(KABC::AddressBook *addressbook, const QString &data)
{
KABC::Addressee mAddressee = readFromString(data);
addressbook->insertAddressee(mAddressee);
}
KABC::Addressee VCard21Parser::readFromString( const QString &data)
{
KABC::Addressee addressee;
VCard21ParserImpl *mVCard = VCard21ParserImpl::parseVCard(data);
QString tmpStr;
// Check if parsing failed
if (mVCard == 0)
{
kdDebug() << "Parsing failed" << endl;
return addressee;
}
//set the addressees name and formated name
QStringList tmpList = mVCard->getValues(VCARD_N);
QString formattedName = "";
if (tmpList.count() > 0)
addressee.setFamilyName(tmpList[0]);
if (tmpList.count() > 1)
addressee.setGivenName(tmpList[1]);
if (tmpList.count() > 2)
addressee.setAdditionalName(tmpList[2]);
if (tmpList.count() > 3)
addressee.setPrefix(tmpList[3]);
if (tmpList.count() > 4)
addressee.setSuffix(tmpList[4]);
tmpStr = (mVCard->getValue(VCARD_FN));
if (!tmpStr.isEmpty())
addressee.setFormattedName(tmpStr);
//set the addressee's nick name
tmpStr = mVCard->getValue(VCARD_NICKNAME);
addressee.setNickName(tmpStr);
//set the addressee's organisation
tmpStr = mVCard->getValue(VCARD_ORG);
addressee.setOrganization(tmpStr);
//set the addressee's title
tmpStr = mVCard->getValue(VCARD_TITLE);
addressee.setTitle(tmpStr);
//set the addressee's email - we can only deal with two. The preferenced one and one other.
tmpStr = mVCard->getValue(VCARD_EMAIL, VCARD_EMAIL_INTERNET);
addressee.insertEmail(tmpStr, false);
tmpStr = mVCard->getValue(VCARD_EMAIL,VCARD_EMAIL_PREF);
addressee.insertEmail(tmpStr, true);
//set the addressee's url
tmpStr = mVCard->getValue(VCARD_URL);
if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_WORK);
if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_HOME);
if (!tmpStr.isEmpty()) {
addressee.setUrl(KURL(tmpStr));
}
//set the addressee's birthday
tmpStr = mVCard->getValue(VCARD_BDAY);
addressee.setBirthday(VCardStringToDate(tmpStr));
//set the addressee's phone numbers
- for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
+ for ( Q3ValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
if ( (*i).name == VCARD_TEL ) {
int type = 0;
if ( (*i).qualified ) {
if ( (*i).qualifiers.contains( VCARD_TEL_HOME ) )
type |= PhoneNumber::Home;
if ( (*i).qualifiers.contains( VCARD_TEL_WORK ) )
type |= PhoneNumber::Work;
if ( (*i).qualifiers.contains( VCARD_TEL_PREF ) )
type |= PhoneNumber::Pref;
if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) )
type |= PhoneNumber::Voice;
if ( (*i).qualifiers.contains( VCARD_TEL_FAX ) )
type |= PhoneNumber::Fax;
if ( (*i).qualifiers.contains( VCARD_TEL_MSG ) )
type |= PhoneNumber::Msg;
if ( (*i).qualifiers.contains( VCARD_TEL_CELL ) )
type |= PhoneNumber::Cell;
if ( (*i).qualifiers.contains( VCARD_TEL_PAGER ) )
type |= PhoneNumber::Pager;
if ( (*i).qualifiers.contains( VCARD_TEL_BBS ) )
type |= PhoneNumber::Bbs;
if ( (*i).qualifiers.contains( VCARD_TEL_MODEM ) )
type |= PhoneNumber::Modem;
if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) )
type |= PhoneNumber::Car;
if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) )
type |= PhoneNumber::Isdn;
if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) )
type |= PhoneNumber::Video;
if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) )
type |= PhoneNumber::Pcs;
}
addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) );
}
}
addressee.makePhoneNumbersOLcompatible();
//set the addressee's addresses
- for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
+ for ( Q3ValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
if ( (*i).name == VCARD_ADR ) {
int type = 0;
if ( (*i).qualified ) {
if ( (*i).qualifiers.contains( VCARD_ADR_DOM ) )
type |= Address::Dom;
if ( (*i).qualifiers.contains( VCARD_ADR_INTL ) )
type |= Address::Intl;
if ( (*i).qualifiers.contains( VCARD_ADR_POSTAL ) )
type |= Address::Postal;
if ( (*i).qualifiers.contains( VCARD_ADR_PARCEL ) )
type |= Address::Parcel;
if ( (*i).qualifiers.contains( VCARD_ADR_HOME ) )
type |= Address::Home;
if ( (*i).qualifiers.contains( VCARD_ADR_WORK ) )
type |= Address::Work;
if ( (*i).qualifiers.contains( VCARD_ADR_PREF ) )
type |= Address::Pref;
}
- addressee.insertAddress( readAddressFromQStringList( (*i).parameters, type ) );
+ QStringList tmp;
+ for(Q3ValueList<QString>::const_iterator ii=(*i).parameters.begin();ii!=(*i).parameters.end();++ii)
+ tmp.push_back(*ii);
+ addressee.insertAddress( readAddressFromQStringList( tmp, type ) );
}
}
//set the addressee's delivery label
tmpStr = mVCard->getValue(VCARD_LABEL);
if (!tmpStr.isEmpty()) {
qDebug("VCard21Parser::readFromString please verify if replace is correct");
//US tmpStr.replace("\r\n","\n");
tmpStr.replace( QRegExp("\r\n"), "\n" );
Address tmpAddress;
tmpAddress.setLabel(tmpStr);
addressee.insertAddress(tmpAddress);
}
//set the addressee's notes
tmpStr = mVCard->getValue(VCARD_NOTE);
qDebug("VCard21Parser::readFromString please verify if correct");
//US tmpStr.replace("\r\n","\n");
tmpStr.replace( QRegExp("\r\n"), "\n" );
addressee.setNote(tmpStr);
//set the addressee's timezone
tmpStr = mVCard->getValue(VCARD_TZ);
TimeZone tmpZone(tmpStr.toInt());
addressee.setTimeZone(tmpZone);
//set the addressee's geographical position
tmpList = mVCard->getValues(VCARD_GEO);
if (tmpList.count()==2)
{
tmpStr = tmpList[0];
float glat = tmpStr.toFloat();
tmpStr = tmpList[1];
float glong = tmpStr.toFloat();
Geo tmpGeo(glat,glong);
addressee.setGeo(tmpGeo);
}
//set the last revision date
tmpStr = mVCard->getValue(VCARD_REV);
addressee.setRevision(VCardStringToDate(tmpStr));
//set the role of the addressee
tmpStr = mVCard->getValue(VCARD_ROLE);
addressee.setRole(tmpStr);
return addressee;
}
KABC::Address VCard21Parser::readAddressFromQStringList ( const QStringList &data, const int type )
{
KABC::Address mAddress;
mAddress.setType( type );
if ( data.count() > 0 )
mAddress.setPostOfficeBox( data[0] );
if ( data.count() > 1 )
mAddress.setExtended( data[1] );
if ( data.count() > 2 )
mAddress.setStreet( data[2] );
if ( data.count() > 3 )
mAddress.setLocality( data[3] );
if ( data.count() > 4 )
mAddress.setRegion( data[4] );
if ( data.count() > 5 )
mAddress.setPostalCode( data[5] );
if ( data.count() > 6 )
mAddress.setCountry( data[6] );
return mAddress;
}
VCard21ParserImpl *VCard21ParserImpl::parseVCard( const QString& vc, int *err )
{
int _err = 0;
int _state = VC_STATE_BEGIN;
- QValueList<VCardLineX> *_vcdata;
- QValueList<QString> lines;
+ Q3ValueList<VCardLineX> *_vcdata;
+ QStringList lines;
- _vcdata = new QValueList<VCardLineX>;
+ _vcdata = new Q3ValueList<VCardLineX>;
lines = QStringList::split( QRegExp( "[\x0d\x0a]" ), vc );
// for each line in the vCard
for ( QStringList::Iterator j = lines.begin(); j != lines.end(); ++j ) {
VCardLineX _vcl;
// take spaces off the end - ugly but necessary hack
for ( int g = (*j).length()-1; g > 0 && (*j)[g].isSpace(); --g )
(*j)[g] = 0;
// first token:
// verify state, update if necessary
if ( _state & VC_STATE_BEGIN) {
if ( !qstricmp( (*j).latin1(), VCARD_BEGIN ) ) {
_state = VC_STATE_BODY;
continue;
} else {
_err = VC_ERR_NO_BEGIN;
break;
}
} else if ( _state & VC_STATE_BODY ) {
if ( !qstricmp( (*j).latin1(), VCARD_END ) ) {
_state |= VC_STATE_END;
break;
}
// split into two tokens
int colon = (*j).find( ':' );
if ( colon < 0 ) {
_err = VC_ERR_INVALID_LINE;
break;
}
QString key = (*j).left( colon );
QString value = (*j).mid( colon + 1 );
// check for qualifiers and
// set name, qualified, qualifier(s)
QStringList keyTokens = QStringList::split( ';', key );
bool qp = false, first_pass = true;
bool b64 = false;
if ( keyTokens.count() > 0 ) {
_vcl.qualified = false;
_vcl.name = keyTokens[ 0 ].lower();
for ( QStringList::Iterator z = keyTokens.begin(); z != keyTokens.end(); ++z ) {
QString zz = (*z).lower();
if ( zz == VCARD_QUOTED_PRINTABLE || zz == VCARD_ENCODING_QUOTED_PRINTABLE ) {
qp = true;
} else if ( zz == VCARD_BASE64 ) {
b64 = true;
} else if ( !first_pass ) {
_vcl.qualified = true;
_vcl.qualifiers.append( zz );
}
first_pass = false;
}
} else {
_err = VC_ERR_INVALID_LINE;
}
if ( _err != 0 )
break;
if ( _vcl.name == VCARD_VERSION )
_state |= VC_STATE_HAVE_VERSION;
if ( _vcl.name == VCARD_N || _vcl.name == VCARD_FN )
_state |= VC_STATE_HAVE_N;
// second token:
// split into tokens by ;
// add to parameters vector
if ( b64 ) {
if ( value.at( value.length() - 1 ) != '=' )
do {
value += *( ++j );
} while ( (*j).at( (*j).length() - 1 ) != '=' );
} else {
if ( qp ) { // join any split lines
while ( value.at( value.length() - 1 ) == '=' ) {
value.remove( value.length() - 1, 1 );
value.append(*( ++j ));
}
}
_vcl.parameters = QStringList::split( ';', value, true );
if ( qp ) { // decode the quoted printable
- for ( QStringList::Iterator z = _vcl.parameters.begin(); z != _vcl.parameters.end(); ++z )
- *z = KCodecs::quotedPrintableDecode( (*z).latin1() );
+ for ( QLinkedList<QString>::Iterator z = _vcl.parameters.begin(); z != _vcl.parameters.end(); ++z )
+ *z = KCodecs::quotedPrintableDecode( (Q3CString)(*z).latin1() );
}
}
} else {
_err = VC_ERR_INTERNAL;
break;
}
// validate VCardLineX
if ( !_vcl.isValid() ) {
_err = VC_ERR_INVALID_LINE;
break;
}
// add to vector
_vcdata->append( _vcl );
}
// errors to check at the last minute (exit state related)
if ( _err == 0 ) {
if ( !( _state & VC_STATE_END ) ) // we have to have an end!!
_err = VC_ERR_NO_END;
if ( !( _state & VC_STATE_HAVE_N ) || // we have to have the mandatories!
!( _state & VC_STATE_HAVE_VERSION ) )
_err = VC_ERR_MISSING_MANDATORY;
}
// set the error message if we can, and only return an object
// if the vCard was valid.
if ( err )
*err = _err;
if ( _err != 0 ) {
delete _vcdata;
return 0;
}
return new VCard21ParserImpl( _vcdata );
}
-VCard21ParserImpl::VCard21ParserImpl(QValueList<VCardLineX> *_vcd) : _vcdata(_vcd)
+VCard21ParserImpl::VCard21ParserImpl(Q3ValueList<VCardLineX> *_vcd) : _vcdata(_vcd)
{
}
QString VCard21ParserImpl::getValue(const QString& name, const QString& qualifier)
{
QString failed;
const QString lowname = name.lower();
const QString lowqualifier = qualifier.lower();
- for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
+ for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
if ((*i).name == lowname && (*i).qualified && (*i).qualifiers.contains(lowqualifier)) {
if ((*i).parameters.count() > 0)
return (*i).parameters[0];
else return failed;
}
}
return failed;
}
QString VCard21ParserImpl::getValue(const QString& name)
{
QString failed;
const QString lowname = name.lower();
- for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
+ for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
if ((*i).name == lowname && !(*i).qualified) {
if ((*i).parameters.count() > 0)
return (*i).parameters[0];
else return failed;
}
}
return failed;
}
QStringList VCard21ParserImpl::getValues(const QString& name)
{
const QString lowname = name.lower();
- for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
- if ((*i).name == lowname && !(*i).qualified)
- return (*i).parameters;
+ for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
+ if ((*i).name == lowname && !(*i).qualified) {
+ return QStringList( (*i).parameters );
+ }
}
// failed.
return QStringList();
}
QStringList VCard21ParserImpl::getValues(const QString& name, const QString& qualifier)
{
const QString lowname = name.lower();
const QString lowqualifier = qualifier.lower();
- for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
+ for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
if ((*i).name == lowname && (*i).qualified && (*i).qualifiers.contains(lowqualifier))
- return (*i).parameters;
+ return QStringList( (*i).parameters );
}
// failed.
return QStringList();
}
diff --git a/kabc/vcard21parser.h b/kabc/vcard21parser.h
index 77e69b6..80ba6ef 100644
--- a/kabc/vcard21parser.h
+++ b/kabc/vcard21parser.h
@@ -1,226 +1,226 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Mark Westcott <mark@houseoffish.org>
Copyright (c) 2000 George Staikos <staikos@kde.org>
This library is free software; you can redistribute it and/or
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$
*/
#ifndef KABC_VCARD21FORMAT_H
#define KABC_VCARD21FORMAT_H
#include <qdatetime.h>
#include <kdebug.h>
#include <qregexp.h>
#include <qstring.h>
#include <kurl.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include "addressee.h"
#include "addressbook.h"
#include "phonenumber.h"
#define VCARD_BEGIN "begin:vcard"
#define VCARD_END "end:vcard"
#define VCARD_BEGIN_N "begin"
#define VCARD_END_N "end"
#define VCARD_VERSION "version"
#define VCARD_FN "fn"
#define VCARD_N "n"
// optional
#define VCARD_NAME "name"
#define VCARD_NICKNAME "nickname"
#define VCARD_PHOTO "photo"
#define VCARD_BDAY "bday"
#define VCARD_ADR "adr"
// types
#define VCARD_ADR_DOM "dom"
#define VCARD_ADR_INTL "intl"
#define VCARD_ADR_POSTAL "postal"
#define VCARD_ADR_PARCEL "parcel"
#define VCARD_ADR_HOME "home"
#define VCARD_ADR_WORK "work"
#define VCARD_ADR_PREF "pref"
// values
#define VCARD_ADR_POBOX "PO Box"
#define VCARD_ADR_EXTADR "Extended Address"
#define VCARD_ADR_STREET "Street"
#define VCARD_ADR_LOCALITY "Locality"
#define VCARD_ADR_REGION "Region"
#define VCARD_ADR_POSTCODE "Postal Code"
#define VCARD_ADR_COUNTRY "Country Name"
#define VCARD_LABEL "label"
#define VCARD_PROFILE "profile"
#define VCARD_SOURCE "source"
#define VCARD_TEL "tel"
// types
#define VCARD_TEL_HOME "home"
#define VCARD_TEL_WORK "work"
#define VCARD_TEL_PREF "pref"
#define VCARD_TEL_VOICE "voice"
#define VCARD_TEL_FAX "fax"
#define VCARD_TEL_MSG "msg"
#define VCARD_TEL_CELL "cell"
#define VCARD_TEL_PAGER "pager"
#define VCARD_TEL_BBS "bbs"
#define VCARD_TEL_MODEM "modem"
#define VCARD_TEL_CAR "car"
#define VCARD_TEL_ISDN "isdn"
#define VCARD_TEL_VIDEO "video"
#define VCARD_TEL_PCS "pcs"
#define VCARD_TEL_SIP "sip"
#define VCARD_EMAIL "email"
// types
#define VCARD_EMAIL_PREF "pref"
#define VCARD_EMAIL_INTERNET "internet"
#define VCARD_EMAIL_X400 "x400"
#define VCARD_TZ "tz"
#define VCARD_GEO "geo"
#define VCARD_MAILER "mailer"
#define VCARD_TITLE "title"
#define VCARD_ROLE "role"
#define VCARD_LOGO "logo"
#define VCARD_AGENT "agent"
#define VCARD_ORG "org"
#define VCARD_CATEGORIES "categories"
#define VCARD_NOTE "note"
#define VCARD_PRODID "prodid"
#define VCARD_REV "rev"
#define VCARD_SOUND "sound"
#define VCARD_UID "uid"
#define VCARD_URL "url"
#define VCARD_CLASS "class"
#define VCARD_CLASS_PUBLIC "public"
#define VCARD_CLASS_PRIVATE "private"
#define VCARD_CLASS_CONFIDENTIAL "confidential"
#define VCARD_KEY "key"
// types
#define VCARD_KEY_X509 "x509"
#define VCARD_KEY_PGP "pgp"
#define VCARD_QUOTED_PRINTABLE "quoted-printable"
// this one is a temporary hack until we support TYPE=VALUE
#define VCARD_ENCODING_QUOTED_PRINTABLE "encoding=quoted-printable"
#define VCARD_BASE64 "base64"
#define VC_STATE_BEGIN 1
#define VC_STATE_BODY 2
#define VC_STATE_END 4
#define VC_STATE_HAVE_N 8
#define VC_STATE_HAVE_VERSION 16
#define VC_ERR_NO_BEGIN 1
#define VC_ERR_NO_END 2
#define VC_ERR_INVALID_LINE 3
#define VC_ERR_INTERNAL 4
#define VC_ERR_INVALID_NAME 5
#define VC_ERR_MISSING_MANDATORY 6
namespace KABC {
class AddressBook;
class VCard21Parser
{
public:
/**
* Constructor.
*/
VCard21Parser();
/**
* Destructor.
*/
virtual ~VCard21Parser();
/**
* Parses a string in vcard2.1 format and saves the single addressees
* to the address book.
*
* @param ab The address book.
* @param str The vcard string.
*/
void readFromString( KABC::AddressBook *ab, const QString &str );
/**
* FIXME: we need a writeToString method
* QString writeToString (KABC::AddressBook *);
*/
/**
* Parses a string in vcard2.1 format and returns the inherent addressee.
*/
KABC::Addressee readFromString( const QString &data);
/**
* Helper method to store a address.
*
* @param data A string list, that is filled with 'street', 'house number' ...
* @param type The type of the returned address.
*/
static KABC::Address readAddressFromQStringList (const QStringList &data, const int type);
};
}
/**
* @short Helper class
*/
class VCardLineX
{
public:
QString name;
bool qualified;
- QValueList<QString> qualifiers;
- QValueList<QString> parameters;
+ Q3ValueList<QString> qualifiers;
+ Q3ValueList<QString> parameters;
bool isValid() const;
};
/**
* @short Helper class
*/
class VCard21ParserImpl
{
friend class VCardLineX;
public:
VCard21ParserImpl() { };
virtual ~VCard21ParserImpl() { };
static VCard21ParserImpl *parseVCard(const QString& vc, int *err = NULL);
QString getValue(const QString& name, const QString& qualifier);
QString getValue(const QString& name);
QStringList getValues(const QString& name, const QString& qualifier);
QStringList getValues(const QString& name);
- QValueList<VCardLineX> *_vcdata;
+ Q3ValueList<VCardLineX> *_vcdata;
private:
- VCard21ParserImpl (QValueList<VCardLineX> *_vcd);
+ VCard21ParserImpl (Q3ValueList<VCardLineX> *_vcd);
};
#endif
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp
index 580c28b..2417874 100644
--- a/kabc/vcardformatimpl.cpp
+++ b/kabc/vcardformatimpl.cpp
@@ -1,1039 +1,1042 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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 <qfile.h>
#include <qregexp.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3PtrList>
#include <kdebug.h>
#include <kmdcodec.h>
#include <kstandarddirs.h>
#include <ktempfile.h>
#include <VCard.h>
#include "addressbook.h"
#include "vcardformatimpl.h"
using namespace KABC;
using namespace VCARD;
int VCardFormatImpl::debug = -1;
VCardFormatImpl::VCardFormatImpl()
{
debug = (getenv("KABC_DEBUG") != 0);
}
bool VCardFormatImpl::load( Addressee &addressee, QFile *file )
{
kdDebug(5700) << "VCardFormat::load()" << endl;
QByteArray fdata = file->readAll();
- QCString data(fdata.data(), fdata.size()+1);
+ Q3CString data(fdata.data(), fdata.size()+1);
VCardEntity e( data );
VCardListIterator it( e.cardList() );
if ( it.current() ) {
//US VCard v(*it.current());
//US loadAddressee( addressee, v );
loadAddressee( addressee, it.current() );
return true;
}
return false;
}
#include <kmessagebox.h>
bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file )
{
- QCString data(file->readAll().data(), file->size()+1);
+ Q3CString data(file->readAll().data(), file->size()+1);
VCardEntity e( data );
VCardListIterator it( e.cardList() );
for (; it.current(); ++it) {
//US VCard v(*it.current());
Addressee addressee;
//US loadAddressee( addressee, v );
loadAddressee( addressee, it.current() );
addressee.setResource( resource );
addressBook->insertAddressee( addressee );
if (debug == true)
{
printf("address %s loaded successfully\n", addressee.formattedName().latin1());
}
}
return true;
}
void VCardFormatImpl::save( const Addressee &addressee, QFile *file )
{
VCardEntity vcards;
VCardList vcardlist;
vcardlist.setAutoDelete( true );
VCard *v = new VCard;
saveAddressee( addressee, v, false );
vcardlist.append( v );
vcards.setCardList( vcardlist );
- QCString vcardData = vcards.asString();
+ Q3CString vcardData = vcards.asString();
file->writeBlock( (const char*)vcardData, vcardData.length() );
}
void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file )
{
AddressBook::Iterator it;
for ( it = ab->begin(); it != ab->end(); ++it ) {
if ( (*it).resource() == resource ) {
save((*it),file);
qApp->processEvents();
(*it).setChanged( false );
}
}
// for memory usage status test only
// KMessageBox::information ( 0, "Stoppppp", QString("Stop ") );
}
bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v )
{
- QPtrList<ContentLine> contentLines = v->contentLineList();
+ Q3PtrList<ContentLine> contentLines = v->contentLineList();
ContentLine *cl;
for( cl = contentLines.first(); cl; cl = contentLines.next() ) {
- QCString n = cl->name();
+ Q3CString n = cl->name();
if ( n.left( 2 ) == "X-" ) {
n = n.mid( 2 );
int posDash = n.find( "-" );
addressee.insertCustom( QString::fromUtf8( n.left( posDash ) ),
QString::fromUtf8( n.mid( posDash + 1 ) ),
QString::fromUtf8( cl->value()->asString() ) );
continue;
}
EntityType type = cl->entityType();
switch( type ) {
case EntityUID:
addressee.setUid( readTextValue( cl ) );
break;
case EntityEmail:
addressee.insertEmail( readTextValue( cl ) );
break;
case EntityName:
addressee.setName( readTextValue( cl ) );
break;
case EntityFullName:
addressee.setFormattedName( readTextValue( cl ) );
break;
case EntityURL:
addressee.setUrl( KURL( readTextValue( cl ) ) );
break;
case EntityNickname:
addressee.setNickName( readTextValue( cl ) );
break;
case EntityLabel:
// not yet supported by kabc
break;
case EntityMailer:
addressee.setMailer( readTextValue( cl ) );
break;
case EntityTitle:
addressee.setTitle( readTextValue( cl ) );
break;
case EntityRole:
addressee.setRole( readTextValue( cl ) );
break;
case EntityOrganisation:
addressee.setOrganization( readTextValue( cl ) );
break;
case EntityNote:
addressee.setNote( readTextValue( cl ) );
break;
case EntityProductID:
addressee.setProductId( readTextValue( cl ) );
break;
case EntitySortString:
addressee.setSortString( readTextValue( cl ) );
break;
case EntityN:
readNValue( cl, addressee );
break;
case EntityAddress:
addressee.insertAddress( readAddressValue( cl ) );
break;
case EntityTelephone:
addressee.insertPhoneNumber( readTelephoneValue( cl ) );
break;
case EntityCategories:
addressee.setCategories( QStringList::split( ",", readTextValue( cl ) ) );
break;
case EntityBirthday:
- addressee.setBirthday( readDateValue( cl ) );
+ addressee.setBirthday( (QDateTime) readDateValue( cl ) );
break;
case EntityRevision:
addressee.setRevision( readDateTimeValue( cl ) );
break;
case EntityGeo:
addressee.setGeo( readGeoValue( cl ) );
break;
case EntityTimeZone:
addressee.setTimeZone( readUTCValue( cl ) );
break;
case EntityVersion:
break;
case EntityClass:
addressee.setSecrecy( readClassValue( cl ) );
break;
case EntityKey:
addressee.insertKey( readKeyValue( cl ) );
break;
case EntityPhoto:
addressee.setPhoto( readPictureValue( cl, EntityPhoto, addressee ) );
break;
case EntityLogo:
addressee.setLogo( readPictureValue( cl, EntityLogo, addressee ) );
break;
case EntityAgent:
addressee.setAgent( readAgentValue( cl ) );
break;
case EntitySound:
addressee.setSound( readSoundValue( cl, addressee ) );
break;
default:
kdDebug(5700) << "VCardFormat::load(): Unsupported entity: "
<< int( type ) << ": " << cl->asString() << endl;
qDebug("VCardFormat::load(): Unsupported entity: %i: %s ", int(type), (const char*)cl->asString());
break;
}
}
for( cl = contentLines.first(); cl; cl = contentLines.next() ) {
EntityType type = cl->entityType();
if ( type == EntityLabel ) {
int type = readAddressParam( cl );
Address address = addressee.address( type );
if ( address.isEmpty() )
address.setType( type );
address.setLabel( QString::fromUtf8( cl->value()->asString() ) );
addressee.insertAddress( address );
}
}
addressee.makePhoneNumbersOLcompatible();
return true;
}
void VCardFormatImpl::saveAddressee( const Addressee &addressee, VCard *v, bool intern )
{
//US ContentLine cl;
//US QString value;
addTextValue( v, EntityName, addressee.name() );
addTextValue( v, EntityUID, addressee.uid() );
addTextValue( v, EntityFullName, addressee.formattedName() );
QStringList emails = addressee.emails();
QStringList::ConstIterator it4;
for( it4 = emails.begin(); it4 != emails.end(); ++it4 ) {
addTextValue( v, EntityEmail, *it4 );
}
QStringList customs = addressee.customs();
QStringList::ConstIterator it5;
for( it5 = customs.begin(); it5 != customs.end(); ++it5 ) {
addCustomValue( v, *it5 );
}
addTextValue( v, EntityURL, addressee.url().url() );
addNValue( v, addressee );
addTextValue( v, EntityNickname, addressee.nickName() );
addTextValue( v, EntityMailer, addressee.mailer() );
addTextValue( v, EntityTitle, addressee.title() );
addTextValue( v, EntityRole, addressee.role() );
addTextValue( v, EntityOrganisation, addressee.organization() );
addTextValue( v, EntityNote, addressee.note() );
addTextValue( v, EntityProductID, addressee.productId() );
addTextValue( v, EntitySortString, addressee.sortString() );
Address::List addresses = addressee.addresses();
Address::List::ConstIterator it3;
for( it3 = addresses.begin(); it3 != addresses.end(); ++it3 ) {
addAddressValue( v, *it3 );
addLabelValue( v, *it3 );
}
PhoneNumber::List phoneNumbers = addressee.phoneNumbers();
PhoneNumber::List::ConstIterator it2;
for( it2 = phoneNumbers.begin(); it2 != phoneNumbers.end(); ++it2 ) {
addTelephoneValue( v, *it2 );
}
Key::List keys = addressee.keys();
Key::List::ConstIterator it6;
for( it6 = keys.begin(); it6 != keys.end(); ++it6 ) {
addKeyValue( v, *it6 );
}
addTextValue( v, EntityCategories, addressee.categories().join(",") );
addDateValue( v, EntityBirthday, addressee.birthday().date() );
addDateTimeValue( v, EntityRevision, addressee.revision() );
addGeoValue( v, addressee.geo() );
addUTCValue( v, addressee.timeZone() );
addClassValue( v, addressee.secrecy() );
addPictureValue( v, EntityPhoto, addressee.photo(), addressee, intern );
addPictureValue( v, EntityLogo, addressee.logo(), addressee, intern );
addAgentValue( v, addressee.agent() );
addSoundValue( v, addressee.sound(), addressee, intern );
}
void VCardFormatImpl::addCustomValue( VCard *v, const QString &txt )
{
if ( txt.isEmpty() ) return;
ContentLine cl;
cl.setName( "X-" + txt.left( txt.find( ":" ) ).utf8() );
QString value = txt.mid( txt.find( ":" ) + 1 );
if ( value.isEmpty() )
return;
cl.setValue( new TextValue( value.utf8() ) );
v->add(cl);
}
void VCardFormatImpl::addTextValue( VCard *v, EntityType type, const QString &txt )
{
if ( txt.isEmpty() ) return;
ContentLine cl;
cl.setName( EntityTypeToParamName( type ) );
cl.setValue( new TextValue( txt.utf8() ) );
v->add(cl);
}
void VCardFormatImpl::addDateValue( VCard *vcard, EntityType type,
const QDate &date )
{
if ( !date.isValid() ) return;
ContentLine cl;
cl.setName( EntityTypeToParamName( type ) );
DateValue *v = new DateValue( date );
cl.setValue( v );
vcard->add(cl);
}
void VCardFormatImpl::addDateTimeValue( VCard *vcard, EntityType type,
const QDateTime &dateTime )
{
if ( !dateTime.isValid() ) return;
ContentLine cl;
cl.setName( EntityTypeToParamName( type ) );
DateValue *v = new DateValue( dateTime );
cl.setValue( v );
vcard->add(cl);
}
void VCardFormatImpl::addAddressValue( VCard *vcard, const Address &a )
{
if ( a.isEmpty() )
return;
ContentLine cl;
cl.setName( EntityTypeToParamName( EntityAddress ) );
AdrValue *v = new AdrValue;
v->setPOBox( a.postOfficeBox().utf8() );
v->setExtAddress( a.extended().utf8() );
v->setStreet( a.street().utf8() );
v->setLocality( a.locality().utf8() );
v->setRegion( a.region().utf8() );
v->setPostCode( a.postalCode().utf8() );
v->setCountryName( a.country().utf8() );
cl.setValue( v );
addAddressParam( &cl, a.type() );
vcard->add( cl );
}
void VCardFormatImpl::addLabelValue( VCard *vcard, const Address &a )
{
if ( a.label().isEmpty() ) return;
ContentLine cl;
cl.setName( EntityTypeToParamName( EntityLabel ) );
cl.setValue( new TextValue( a.label().utf8() ) );
addAddressParam( &cl, a.type() );
vcard->add( cl );
}
void VCardFormatImpl::addAddressParam( ContentLine *cl, int type )
{
ParamList params;
if ( type & Address::Dom ) params.append( new Param( "TYPE", "dom" ) );
if ( type & Address::Intl ) params.append( new Param( "TYPE", "intl" ) );
if ( type & Address::Parcel ) params.append( new Param( "TYPE", "parcel" ) );
if ( type & Address::Postal ) params.append( new Param( "TYPE", "postal" ) );
if ( type & Address::Work ) params.append( new Param( "TYPE", "work" ) );
if ( type & Address::Home ) params.append( new Param( "TYPE", "home" ) );
if ( type & Address::Pref ) params.append( new Param( "TYPE", "pref" ) );
cl->setParamList( params );
}
void VCardFormatImpl::addGeoValue( VCard *vcard, const Geo &geo )
{
if ( !geo.isValid() ) return;
ContentLine cl;
cl.setName( EntityTypeToParamName( EntityGeo ) );
GeoValue *v = new GeoValue;
v->setLatitude( geo.latitude() );
v->setLongitude( geo.longitude() );
cl.setValue( v );
vcard->add(cl);
}
void VCardFormatImpl::addUTCValue( VCard *vcard, const TimeZone &tz )
{
if ( !tz.isValid() ) return;
ContentLine cl;
cl.setName( EntityTypeToParamName( EntityTimeZone ) );
UTCValue *v = new UTCValue;
v->setPositive( tz.offset() >= 0 );
v->setHour( (tz.offset() / 60) * ( tz.offset() >= 0 ? 1 : -1 ) );
v->setMinute( (tz.offset() % 60) * ( tz.offset() >= 0 ? 1 : -1 ) );
cl.setValue( v );
vcard->add(cl);
}
void VCardFormatImpl::addClassValue( VCard *vcard, const Secrecy &secrecy )
{
ContentLine cl;
cl.setName( EntityTypeToParamName( EntityClass ) );
ClassValue *v = new ClassValue;
switch ( secrecy.type() ) {
case Secrecy::Public:
v->setType( (int)ClassValue::Public );
break;
case Secrecy::Private:
v->setType( (int)ClassValue::Private );
break;
case Secrecy::Confidential:
v->setType( (int)ClassValue::Confidential );
break;
}
cl.setValue( v );
vcard->add(cl);
}
Address VCardFormatImpl::readAddressValue( ContentLine *cl )
{
Address a;
AdrValue *v = (AdrValue *)cl->value();
a.setPostOfficeBox( QString::fromUtf8( v->poBox() ) );
a.setExtended( QString::fromUtf8( v->extAddress() ) );
a.setStreet( QString::fromUtf8( v->street() ) );
a.setLocality( QString::fromUtf8( v->locality() ) );
a.setRegion( QString::fromUtf8( v->region() ) );
a.setPostalCode( QString::fromUtf8( v->postCode() ) );
a.setCountry( QString::fromUtf8( v->countryName() ) );
a.setType( readAddressParam( cl ) );
return a;
}
int VCardFormatImpl::readAddressParam( ContentLine *cl )
{
int type = 0;
ParamList params = cl->paramList();
ParamListIterator it( params );
- QCString tmpStr;
+ Q3CString tmpStr;
for( ; it.current(); ++it ) {
if ( (*it)->name().upper() == "TYPE" ) {
tmpStr = (*it)->value().lower();
if ( tmpStr == "dom" ) type |= Address::Dom;
else if ( tmpStr == "intl" ) type |= Address::Intl;
else if ( tmpStr == "parcel" ) type |= Address::Parcel;
else if ( tmpStr == "postal" ) type |= Address::Postal;
else if ( tmpStr == "work" ) type |= Address::Work;
else if ( tmpStr == "home" ) type |= Address::Home;
else if ( tmpStr == "pref" ) type |= Address::Pref;
}
}
return type;
}
void VCardFormatImpl::addNValue( VCard *vcard, const Addressee &a )
{
ContentLine cl;
cl.setName(EntityTypeToParamName( EntityN ) );
NValue *v = new NValue;
v->setFamily( a.familyName().utf8() );
v->setGiven( a.givenName().utf8() );
v->setMiddle( a.additionalName().utf8() );
v->setPrefix( a.prefix().utf8() );
v->setSuffix( a.suffix().utf8() );
cl.setValue( v );
vcard->add(cl);
}
void VCardFormatImpl::readNValue( ContentLine *cl, Addressee &a )
{
NValue *v = (NValue *)cl->value();
a.setFamilyName( QString::fromUtf8( v->family() ) );
a.setGivenName( QString::fromUtf8( v->given() ) );
a.setAdditionalName( QString::fromUtf8( v->middle() ) );
a.setPrefix( QString::fromUtf8( v->prefix() ) );
a.setSuffix( QString::fromUtf8( v->suffix() ) );
}
void VCardFormatImpl::addTelephoneValue( VCard *v, const PhoneNumber &p )
{
if ( p.number().isEmpty() )
return;
ContentLine cl;
cl.setName(EntityTypeToParamName(EntityTelephone));
cl.setValue(new TelValue( p.number().utf8() ));
ParamList params;
if( p.type() & PhoneNumber::Home ) params.append( new Param( "TYPE", "home" ) );
if( p.type() & PhoneNumber::Work ) params.append( new Param( "TYPE", "work" ) );
if( p.type() & PhoneNumber::Msg ) params.append( new Param( "TYPE", "msg" ) );
if( p.type() & PhoneNumber::Pref ) params.append( new Param( "TYPE", "pref" ) );
if( p.type() & PhoneNumber::Voice ) params.append( new Param( "TYPE", "voice" ) );
if( p.type() & PhoneNumber::Fax ) params.append( new Param( "TYPE", "fax" ) );
if( p.type() & PhoneNumber::Cell ) params.append( new Param( "TYPE", "cell" ) );
if( p.type() & PhoneNumber::Video ) params.append( new Param( "TYPE", "video" ) );
if( p.type() & PhoneNumber::Bbs ) params.append( new Param( "TYPE", "bbs" ) );
if( p.type() & PhoneNumber::Modem ) params.append( new Param( "TYPE", "modem" ) );
if( p.type() & PhoneNumber::Car ) params.append( new Param( "TYPE", "car" ) );
if( p.type() & PhoneNumber::Isdn ) params.append( new Param( "TYPE", "isdn" ) );
if( p.type() & PhoneNumber::Pcs ) params.append( new Param( "TYPE", "pcs" ) );
if( p.type() & PhoneNumber::Pager ) params.append( new Param( "TYPE", "pager" ) );
cl.setParamList( params );
v->add(cl);
}
PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl )
{
PhoneNumber p;
TelValue *value = (TelValue *)cl->value();
p.setNumber( QString::fromUtf8( value->asString() ) );
int type = 0;
ParamList params = cl->paramList();
ParamListIterator it( params );
- QCString tmpStr;
+ Q3CString tmpStr;
for( ; it.current(); ++it ) {
if ( (*it)->name() == "TYPE" ) {
tmpStr = (*it)->value().lower();
if ( tmpStr == "home" ) type |= PhoneNumber::Home;
else if ( tmpStr == "work" ) type |= PhoneNumber::Work;
else if ( tmpStr == "msg" ) type |= PhoneNumber::Msg;
else if ( tmpStr == "pref" ) type |= PhoneNumber::Pref;
else if ( tmpStr == "voice" ) type |= PhoneNumber::Voice;
else if ( tmpStr == "fax" ) type |= PhoneNumber::Fax;
else if ( tmpStr == "cell" ) type |= PhoneNumber::Cell;
else if ( tmpStr == "video" ) type |= PhoneNumber::Video;
else if ( tmpStr == "bbs" ) type |= PhoneNumber::Bbs;
else if ( tmpStr == "modem" ) type |= PhoneNumber::Modem;
else if ( tmpStr == "car" ) type |= PhoneNumber::Car;
else if ( tmpStr == "isdn" ) type |= PhoneNumber::Isdn;
else if ( tmpStr == "pcs" ) type |= PhoneNumber::Pcs;
else if ( tmpStr == "pager" ) type |= PhoneNumber::Pager;
}
}
p.setType( type );
return p;
}
QString VCardFormatImpl::readTextValue( ContentLine *cl )
{
VCARD::Value *value = cl->value();
if ( value ) {
return QString::fromUtf8( value->asString() );
} else {
kdDebug(5700) << "No value: " << cl->asString() << endl;
qDebug("No value: %s", (const char*)(cl->asString()));
return QString::null;
}
}
QDate VCardFormatImpl::readDateValue( ContentLine *cl )
{
DateValue *dateValue = (DateValue *)cl->value();
if ( dateValue )
return dateValue->qdate();
else
return QDate();
}
QDateTime VCardFormatImpl::readDateTimeValue( ContentLine *cl )
{
DateValue *dateValue = (DateValue *)cl->value();
if ( dateValue )
return dateValue->qdt();
else
return QDateTime();
}
Geo VCardFormatImpl::readGeoValue( ContentLine *cl )
{
GeoValue *geoValue = (GeoValue *)cl->value();
if ( geoValue ) {
Geo geo( geoValue->latitude(), geoValue->longitude() );
return geo;
} else
return Geo();
}
TimeZone VCardFormatImpl::readUTCValue( ContentLine *cl )
{
UTCValue *utcValue = (UTCValue *)cl->value();
if ( utcValue ) {
TimeZone tz;
tz.setOffset(((utcValue->hour()*60)+utcValue->minute())*(utcValue->positive() ? 1 : -1));
return tz;
} else
return TimeZone();
}
Secrecy VCardFormatImpl::readClassValue( ContentLine *cl )
{
ClassValue *classValue = (ClassValue *)cl->value();
if ( classValue ) {
Secrecy secrecy;
switch ( classValue->type() ) {
case ClassValue::Public:
secrecy.setType( Secrecy::Public );
break;
case ClassValue::Private:
secrecy.setType( Secrecy::Private );
break;
case ClassValue::Confidential:
secrecy.setType( Secrecy::Confidential );
break;
}
return secrecy;
} else
return Secrecy();
}
void VCardFormatImpl::addKeyValue( VCARD::VCard *vcard, const Key &key )
{
ContentLine cl;
cl.setName( EntityTypeToParamName( EntityKey ) );
ParamList params;
if ( key.isBinary() ) {
cl.setValue( new TextValue( KCodecs::base64Encode( key.binaryData() ) ) );
params.append( new Param( "ENCODING", "b" ) );
} else {
cl.setValue( new TextValue( key.textData().utf8() ) );
}
switch ( key.type() ) {
case Key::X509:
params.append( new Param( "TYPE", "X509" ) );
break;
case Key::PGP:
params.append( new Param( "TYPE", "PGP" ) );
break;
case Key::Custom:
params.append( new Param( "TYPE", key.customTypeString().utf8() ) );
break;
}
cl.setParamList( params );
vcard->add( cl );
}
Key VCardFormatImpl::readKeyValue( VCARD::ContentLine *cl )
{
Key key;
bool isBinary = false;
TextValue *v = (TextValue *)cl->value();
ParamList params = cl->paramList();
ParamListIterator it( params );
for( ; it.current(); ++it ) {
if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" )
isBinary = true;
if ( (*it)->name() == "TYPE" ) {
if ( (*it)->value().isEmpty() )
continue;
if ( (*it)->value() == "X509" )
key.setType( Key::X509 );
else if ( (*it)->value() == "PGP" )
key.setType( Key::PGP );
else {
key.setType( Key::Custom );
key.setCustomTypeString( QString::fromUtf8( (*it)->value() ) );
}
}
}
if ( isBinary ) {
QByteArray data;
KCodecs::base64Decode( v->asString().stripWhiteSpace(), data );
key.setBinaryData( data );
} else {
key.setTextData( QString::fromUtf8( v->asString() ) );
}
return key;
}
void VCardFormatImpl::addAgentValue( VCARD::VCard *vcard, const Agent &agent )
{
if ( agent.isIntern() && !agent.addressee() )
return;
if ( !agent.isIntern() && agent.url().isEmpty() )
return;
ContentLine cl;
cl.setName( EntityTypeToParamName( EntityAgent ) );
ParamList params;
if ( agent.isIntern() ) {
QString vstr;
Addressee *addr = agent.addressee();
if ( addr ) {
writeToString( (*addr), vstr );
qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct");
/*US
vstr.replace( ":", "\\:" );
vstr.replace( ",", "\\," );
vstr.replace( ";", "\\;" );
vstr.replace( "\r\n", "\\n" );
*/
vstr.replace( QRegExp(":"), "\\:" );
vstr.replace( QRegExp(","), "\\," );
vstr.replace( QRegExp(";"), "\\;" );
vstr.replace( QRegExp("\r\n"), "\\n" );
cl.setValue( new TextValue( vstr.utf8() ) );
} else
return;
} else {
cl.setValue( new TextValue( agent.url().utf8() ) );
params.append( new Param( "VALUE", "uri" ) );
}
cl.setParamList( params );
vcard->add( cl );
}
Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl )
{
Agent agent;
bool isIntern = true;
TextValue *v = (TextValue *)cl->value();
ParamList params = cl->paramList();
ParamListIterator it( params );
for( ; it.current(); ++it ) {
if ( (*it)->name() == "VALUE" && (*it)->value() == "uri" )
isIntern = false;
}
if ( isIntern ) {
QString vstr = QString::fromUtf8( v->asString() );
qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct");
/*US
vstr.replace( "\\n", "\r\n" );
vstr.replace( "\\:", ":" );
vstr.replace( "\\,", "," );
vstr.replace( "\\;", ";" );
*/
vstr.replace( QRegExp("\\\\n"), "\r\n" );
vstr.replace( QRegExp("\\\\:"), ":" );
vstr.replace( QRegExp("\\\\,"), "," );
vstr.replace( QRegExp("\\\\;"), ";" );
Addressee *addr = new Addressee;
readFromString( vstr, *addr );
agent.setAddressee( addr );
} else {
agent.setUrl( QString::fromUtf8( v->asString() ) );
}
return agent;
}
#include <qstringlist.h>
void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType type, const Picture &pic, const Addressee &addr, bool intern )
{
ContentLine cl;
cl.setName( EntityTypeToParamName( type ) );
// qDebug( "IIIMMMMM %s",QImage::outputFormatList ().join("-").latin1() );
if ( pic.isIntern() && pic.data().isNull() )
return;
if ( !pic.isIntern() && pic.url().isEmpty() )
return;
ParamList params;
if ( pic.isIntern() ) {
QImage img = pic.data();
if ( intern ) { // only for vCard export we really write the data inline
QByteArray data;
- QDataStream s( data, IO_WriteOnly );
+ QDataStream s( &data, QIODevice::WriteOnly );
s.setVersion( 4 ); // to produce valid png files
s << img;
cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) );
params.append( new Param( "ENCODING", "b" ) );
if ( !pic.type().isEmpty() )
params.append( new Param( "TYPE", pic.type().utf8() ) );
} else { // save picture in cache
QString dir;
if ( type == EntityPhoto )
dir = "photos";
if ( type == EntityLogo )
dir = "logos";
QString imUrl = locateLocal( "data", "kabc/" + dir + "/" + addr.uid() );
KABC::Picture* ppic =(KABC::Picture*) &pic;
ppic->setUrl( imUrl );
img.save(imUrl, "PNG" );
cl.setValue( new TextValue( pic.url().utf8() ) );
params.append( new Param( "VALUE", "uri" ) );
}
} else {
cl.setValue( new TextValue( pic.url().utf8() ) );
params.append( new Param( "VALUE", "uri" ) );
}
cl.setParamList( params );
vcard->add( cl );
}
Picture VCardFormatImpl::readPictureValue( VCARD::ContentLine *cl, VCARD::EntityType type, const Addressee &addr )
{
Picture pic;
bool isInline = false;
QString picType;
TextValue *v = (TextValue *)cl->value();
ParamList params = cl->paramList();
ParamListIterator it( params );
for( ; it.current(); ++it ) {
if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" )
isInline = true;
if ( (*it)->name() == "TYPE" && !(*it)->value().isEmpty() )
picType = QString::fromUtf8( (*it)->value() );
}
if ( isInline ) {
QImage img;
if ( v->asString() == "<dummy>" ) { // no picture inline stored => picture is in cache
QString dir;
if ( type == EntityPhoto )
dir = "photos";
if ( type == EntityLogo )
dir = "logos";
img.load( locateLocal( "data", "kabc/" + dir + "/" + addr.uid() ) );
} else {
QByteArray data;
KCodecs::base64Decode( v->asString(), data );
img.loadFromData( data );
}
pic.setData( img );
pic.setType( picType );
} else {
pic.setUrl( QString::fromUtf8( v->asString() ) );
}
return pic;
}
void VCardFormatImpl::addSoundValue( VCARD::VCard *vcard, const Sound &sound, const Addressee &addr, bool intern )
{
ContentLine cl;
cl.setName( EntityTypeToParamName( EntitySound ) );
if ( sound.isIntern() && sound.data().isNull() )
return;
if ( !sound.isIntern() && sound.url().isEmpty() )
return;
ParamList params;
if ( sound.isIntern() ) {
QByteArray data = sound.data();
if ( intern ) { // only for vCard export we really write the data inline
cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) );
} else { // save sound in cache
QFile file( locateLocal( "data", "kabc/sounds/" + addr.uid() ) );
- if ( file.open( IO_WriteOnly ) ) {
+ if ( file.open( QIODevice::WriteOnly ) ) {
file.writeBlock( data );
}
cl.setValue( new TextValue( "<dummy>" ) );
}
params.append( new Param( "ENCODING", "b" ) );
} else {
cl.setValue( new TextValue( sound.url().utf8() ) );
params.append( new Param( "VALUE", "uri" ) );
}
cl.setParamList( params );
vcard->add( cl );
}
Sound VCardFormatImpl::readSoundValue( VCARD::ContentLine *cl, const Addressee &addr )
{
Sound sound;
bool isInline = false;
TextValue *v = (TextValue *)cl->value();
ParamList params = cl->paramList();
ParamListIterator it( params );
for( ; it.current(); ++it ) {
if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" )
isInline = true;
}
if ( isInline ) {
QByteArray data;
if ( v->asString() == "<dummy>" ) { // no sound inline stored => sound is in cache
QFile file( locateLocal( "data", "kabc/sounds/" + addr.uid() ) );
- if ( file.open( IO_ReadOnly ) ) {
+ if ( file.open( QIODevice::ReadOnly ) ) {
data = file.readAll();
file.close();
}
} else {
KCodecs::base64Decode( v->asString(), data );
}
sound.setData( data );
} else {
sound.setUrl( QString::fromUtf8( v->asString() ) );
}
return sound;
}
bool VCardFormatImpl::readFromString( const QString &vcard, Addressee &addressee )
{
VCardEntity e( vcard.utf8() );
VCardListIterator it( e.cardList() );
if ( it.current() ) {
//US VCard v(*it.current());
//US loadAddressee( addressee, v );
loadAddressee( addressee, it.current() );
return true;
}
return false;
}
bool VCardFormatImpl::writeToString( const Addressee &addressee, QString &vcard )
{
VCardEntity vcards;
VCardList vcardlist;
vcardlist.setAutoDelete( true );
VCard *v = new VCard;
saveAddressee( addressee, v, true );
vcardlist.append( v );
vcards.setCardList( vcardlist );
vcard = QString::fromUtf8( vcards.asString() );
return true;
}
diff --git a/kabc/vcardformatplugin.cpp b/kabc/vcardformatplugin.cpp
index 8db8c11..0b97a08 100644
--- a/kabc/vcardformatplugin.cpp
+++ b/kabc/vcardformatplugin.cpp
@@ -1,70 +1,70 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#include "vcardformatplugin.h"
#include "vcardformatimpl.h"
using namespace KABC;
VCardFormatPlugin::VCardFormatPlugin()
{
mImpl = new VCardFormatImpl;
}
VCardFormatPlugin::~VCardFormatPlugin()
{
delete mImpl;
}
bool VCardFormatPlugin::load( Addressee &addressee, QFile *file )
{
qDebug("VCardFormatPlugin::load");
return mImpl->load( addressee, file );
}
bool VCardFormatPlugin::loadAll( AddressBook *addressBook, Resource *resource, QFile *file )
{
// qDebug("VCardFormatPlugin::loadAll");
return mImpl->loadAll( addressBook, resource, file );
}
void VCardFormatPlugin::save( const Addressee &addressee, QFile *file )
{
qDebug("VCardFormatPlugin::save");
mImpl->save( addressee, file );
}
void VCardFormatPlugin::saveAll( AddressBook *addressBook, Resource *resource, QFile *file )
{
qDebug("VCardFormatPlugin::saveAll");
mImpl->saveAll( addressBook, resource, file );
}
bool VCardFormatPlugin::checkFormat( QFile *file ) const
{
QString line;
- file->readLine( line, 1024 );
+ char tmp[1024]; file->readLine( tmp, 1024 ); line = tmp;
line = line.stripWhiteSpace();
if ( line == "BEGIN:VCARD" )
return true;
else
return false;
}
diff --git a/kabc/vcardparser/vcard.h b/kabc/vcardparser/vcard.h
index 0bee441..85b50e4 100644
--- a/kabc/vcardparser/vcard.h
+++ b/kabc/vcardparser/vcard.h
@@ -1,91 +1,91 @@
/*
This file is part of libkabc.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#ifndef VCARDPARSER_VCARD_H
#define VCARDPARSER_VCARD_H
#include "vcardline.h"
#include <qmap.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
namespace KABC {
class VCard
{
public:
- typedef QValueList<VCard> List;
+ typedef Q3ValueList<VCard> List;
typedef QMap< QString, VCardLine::List > LineMap;
enum Version { v2_1, v3_0 };
VCard();
VCard( const VCard& );
~VCard();
VCard& operator=( const VCard& );
/**
* Removes all lines from the vCard.
*/
void clear();
/**
* Returns a list of all identifiers that exists in the
* vCard.
*/
QStringList identifiers() const;
/**
* Adds a VCardLine to the VCard
*/
void addLine( const VCardLine& line );
/**
* Returns all lines of the vcard with a special identifier.
*/
VCardLine::List lines( const QString& identifier ) const;
/**
* Returns only the first line of the vcard with a special identifier.
*/
VCardLine line( const QString& identifier ) const;
/**
* Set the version of the vCard.
*/
void setVersion( Version version );
/**
* Returns the version of this vCard.
*/
Version version() const;
private:
LineMap mLineMap;
class VCardPrivate;
VCardPrivate *d;
};
}
#endif
diff --git a/kabc/vcardparser/vcardline.cpp b/kabc/vcardparser/vcardline.cpp
index 8df2d32..c7254a0 100644
--- a/kabc/vcardparser/vcardline.cpp
+++ b/kabc/vcardparser/vcardline.cpp
@@ -1,175 +1,177 @@
/*
This file is part of libkabc.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#include "vcardline.h"
+//Added by qt3to4:
+#include <Q3CString>
using namespace KABC;
class VCardLine::VCardLinePrivate
{
public:
QString mGroup;
};
VCardLine::VCardLine()
: d( 0 )
{
}
VCardLine::VCardLine( const QString &identifier )
: d( 0 )
{
mIdentifier = identifier;
}
VCardLine::VCardLine( const QString &identifier, const QString &value )
: d( 0 )
{
mIdentifier = identifier;
- mValue.assign( value.data(), value.length() );
+ mValue = value;
}
VCardLine::VCardLine( const VCardLine& line )
: d( 0 )
{
mParamMap = line.mParamMap;
mValue = line.mValue;
mIdentifier = line.mIdentifier;
}
VCardLine::~VCardLine()
{
delete d;
d = 0;
}
VCardLine& VCardLine::operator=( const VCardLine& line )
{
if ( &line == this )
return *this;
mParamMap = line.mParamMap;
mValue = line.mValue;
mIdentifier = line.mIdentifier;
return *this;
}
void VCardLine::setIdentifier( const QString& identifier )
{
mIdentifier = identifier;
}
QString VCardLine::identifier() const
{
return mIdentifier;
}
void VCardLine::setValueString( const QString& value )
{
setValueCString( value.utf8() );
}
-void VCardLine::setValueCString( const QCString& value )
+void VCardLine::setValueCString( const Q3CString& value )
{
mValue.duplicate( value.data(), value.length() );
}
void VCardLine::setValueBytes( const QByteArray& value )
{
mValue = value;
}
QString VCardLine::valueString() const
{
return QString::fromUtf8( mValue.data(), mValue.size() );
}
QByteArray VCardLine::valueBytes() const
{
return mValue;
}
void VCardLine::setGroup( const QString& group )
{
if ( !d )
d = new VCardLinePrivate();
d->mGroup = group;
}
QString VCardLine::group() const
{
if ( d )
return d->mGroup;
else
return QString();
}
bool VCardLine::hasGroup() const
{
if ( !d )
return false;
else
return d->mGroup.isEmpty();
}
QStringList VCardLine::parameterList() const
{
//return mParamMap.keys();
//US method QMap::keys() not available yet. SO collect the data manually
//US return mParamMap->keys();
QStringList result;
QMap<QString, QStringList>::ConstIterator it;
for( it = mParamMap.begin(); it != mParamMap.end(); ++it ) {
result << it.key().latin1();
}
return result;
}
void VCardLine::addParameter( const QString& param, const QString& value )
{
QStringList &list = mParamMap[ param ];
if ( list.findIndex( value ) == -1 ) // not included yet
list.append( value );
}
QStringList VCardLine::parameters( const QString& param ) const
{
ParamMap::ConstIterator it = mParamMap.find( param );
if ( it == mParamMap.end() )
return QStringList();
else
return *it;
}
QString VCardLine::parameter( const QString& param ) const
{
ParamMap::ConstIterator it = mParamMap.find( param );
if ( it == mParamMap.end() )
return QString::null;
else {
if ( (*it).isEmpty() )
return QString::null;
else
return (*it).first();
}
}
diff --git a/kabc/vcardparser/vcardline.h b/kabc/vcardparser/vcardline.h
index 8dc9322..dc4bdec 100644
--- a/kabc/vcardparser/vcardline.h
+++ b/kabc/vcardparser/vcardline.h
@@ -1,119 +1,119 @@
/*
This file is part of libkabc.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
#ifndef VCARDLINE_H
#define VCARDLINE_H
#include <qstringlist.h>
-#include <qvaluelist.h>
-#include <qcstring.h>
+#include <q3valuelist.h>
+#include <q3cstring.h>
#include <qvariant.h>
#include <qmap.h>
#include <qstring.h>
namespace KABC {
class VCardLine
{
public:
- typedef QValueList<VCardLine> List;
+ typedef Q3ValueList<VCardLine> List;
typedef QMap<QString, QStringList> ParamMap;
VCardLine();
VCardLine( const QString &identifier );
VCardLine( const QString &identifier, const QString &value );
VCardLine( const VCardLine& );
~VCardLine();
VCardLine& operator=( const VCardLine& );
/**
* Sets the identifier of this line e.g. UID, FN, CLASS
*/
void setIdentifier( const QString& identifier );
/**
* Returns the identifier of this line.
*/
QString identifier() const;
/**
* Sets the value of of this line.
*/
void setValueString( const QString& value );
- void setValueCString( const QCString& value );
+ void setValueCString( const Q3CString& value );
void setValueBytes( const QByteArray& value );
/**
* Returns the value of this line.
*/
QString valueString() const;
QByteArray valueBytes() const;
/**
* Sets the group the line belongs to.
*/
void setGroup( const QString& group );
/**
* Returns the group the line belongs to.
*/
QString group() const;
/**
* Returns whether the line belongs to a group.
*/
bool hasGroup() const;
/**
* Returns all parameters.
*/
QStringList parameterList() const;
/**
* Add a new parameter to the line.
*/
void addParameter( const QString& param, const QString& value );
/**
* Returns the values of a special parameter.
* You can get a list of all parameters with paramList().
*/
QStringList parameters( const QString& param ) const;
/**
* Returns only the first value of a special parameter.
* You can get a list of all parameters with paramList().
*/
QString parameter( const QString& param ) const;
private:
ParamMap mParamMap;
QString mIdentifier;
QByteArray mValue;
class VCardLinePrivate;
VCardLinePrivate *d;
};
}
#endif
diff --git a/kabc/vcardparser/vcardparser.cpp b/kabc/vcardparser/vcardparser.cpp
index 11622a0..a319531 100644
--- a/kabc/vcardparser/vcardparser.cpp
+++ b/kabc/vcardparser/vcardparser.cpp
@@ -29,212 +29,212 @@
using namespace KABC;
VCardParser::VCardParser()
{
}
VCardParser::~VCardParser()
{
}
VCard::List VCardParser::parseVCards( const QString& text )
{
static QRegExp sep( "[\x0d\x0a]" );
VCard currentVCard;
VCard::List vCardList;
QString currentLine;
const QStringList lines = QStringList::split( sep, text );
QStringList::ConstIterator it;
bool inVCard = false;
QStringList::ConstIterator linesEnd( lines.end() );
for ( it = lines.begin(); it != linesEnd; ++it ) {
if ( (*it).isEmpty() ) // empty line
continue;
if ( (*it)[ 0 ] == ' ' || (*it)[ 0 ] == '\t' ) { // folded line => append to previous
currentLine += QString( *it ).remove( 0, 1 );
continue;
} else {
if ( inVCard && !currentLine.isEmpty() ) { // now parse the line
int colon = currentLine.find( ':' );
if ( colon == -1 ) { // invalid line
currentLine = (*it);
continue;
}
VCardLine vCardLine;
const QString key = currentLine.left( colon ).stripWhiteSpace();
QString value = currentLine.mid( colon + 1 );
QStringList params = QStringList::split( ';', key );
// check for group
if ( params[0].find( '.' ) != -1 ) {
const QStringList groupList = QStringList::split( '.', params[0] );
vCardLine.setGroup( groupList[0] );
vCardLine.setIdentifier( groupList[1] );
} else
vCardLine.setIdentifier( params[0] );
if ( params.count() > 1 ) { // find all parameters
QStringList::ConstIterator paramIt = params.begin();
for ( ++paramIt; paramIt != params.end(); ++paramIt ) {
QStringList pair = QStringList::split( '=', *paramIt );
if ( pair.count() == 1 ) {
// correct the fucking 2.1 'standard'
if ( pair[0].lower() == "quoted-printable" ) {
pair[0] = "encoding";
pair[1] = "quoted-printable";
} else if ( pair[0].lower() == "base64" ) {
pair[0] = "encoding";
pair[1] = "base64";
} else {
pair.prepend( "type" );
}
}
// This is pretty much a faster pair[1].contains( ',' )...
if ( pair[1].find( ',' ) != -1 ) { // parameter in type=x,y,z format
const QStringList args = QStringList::split( ',', pair[ 1 ] );
QStringList::ConstIterator argIt;
for ( argIt = args.begin(); argIt != args.end(); ++argIt )
vCardLine.addParameter( pair[0].lower(), *argIt );
} else
vCardLine.addParameter( pair[0].lower(), pair[1] );
}
}
params = vCardLine.parameterList();
if ( params.findIndex( "encoding" ) != -1 ) { // have to decode the data
QByteArray input, output;
if ( vCardLine.parameter( "encoding" ).lower() == "b" ||
vCardLine.parameter( "encoding" ).lower() == "base64" ) {
input = value.local8Bit();
KCodecs::base64Decode( input, output );
} else if ( vCardLine.parameter( "encoding" ).lower() == "quoted-printable" ) {
// join any qp-folded lines
while ( value.mid(value.length()-1,1) == "=" && it != linesEnd ) {
value = value.remove( value.length()-1, 1 ) + (*it);
++it;
}
input = value.local8Bit();
KCodecs::quotedPrintableDecode( input, output );
}
//PP our vcards are *supposed* to be in UTF-8
// if ( vCardLine.parameter( "charset" ).lower() == "utf-8" ) {
// vCardLine.setValue( QString::fromUtf8( output.data(), output.size() ) );
// } else
vCardLine.setValueBytes( output );
//PP our vcards are *supposed* to be in UTF-8
// } else if ( vCardLine.parameter( "charset" ).lower() == "utf-8" ) {
// vCardLine.setValue( QString::fromUtf8( value.ascii() ) );
} else
vCardLine.setValueString( value.replace( QRegExp("\\\\n"), "\n" ) );
currentVCard.addLine( vCardLine );
}
// we do not save the start and end tag as vcardline
if ( (*it).lower().startsWith( "begin:vcard" ) ) {
inVCard = true;
currentLine = "";
currentVCard.clear(); // flush vcard
continue;
}
if ( (*it).lower().startsWith( "end:vcard" ) ) {
inVCard = false;
vCardList.append( currentVCard );
currentLine = "";
currentVCard.clear(); // flush vcard
continue;
}
currentLine = (*it);
}
}
return vCardList;
}
QString VCardParser::createVCards( const VCard::List& list )
{
QString text;
QString textLine;
QString encodingType;
QStringList idents;
QStringList params;
QStringList values;
QStringList::ConstIterator identIt;
QStringList::Iterator paramIt;
QStringList::ConstIterator valueIt;
VCardLine::List lines;
VCardLine::List::ConstIterator lineIt;
VCard::List::ConstIterator cardIt;
bool hasEncoding;
// iterate over the cards
VCard::List::ConstIterator listEnd( list.end() );
for ( cardIt = list.begin(); cardIt != listEnd; ++cardIt ) {
text.append( "BEGIN:VCARD\r\n" );
idents = (*cardIt).identifiers();
for ( identIt = idents.begin(); identIt != idents.end(); ++identIt ) {
lines = (*cardIt).lines( (*identIt) );
// iterate over the lines
for ( lineIt = lines.begin(); lineIt != lines.end(); ++lineIt ) {
if ( !(*lineIt).valueString().isEmpty() ) {
if ( (*lineIt).hasGroup() )
textLine = (*lineIt).group() + "." + (*lineIt).identifier();
else
textLine = (*lineIt).identifier();
params = (*lineIt).parameterList();
hasEncoding = false;
if ( params.count() > 0 ) { // we have parameters
for ( paramIt = params.begin(); paramIt != params.end(); ++paramIt ) {
if ( (*paramIt) == "encoding" ) {
hasEncoding = true;
encodingType = (*lineIt).parameter( "encoding" ).lower();
}
values = (*lineIt).parameters( *paramIt );
for ( valueIt = values.begin(); valueIt != values.end(); ++valueIt ) {
textLine.append( ";" + (*paramIt).upper() );
if ( !(*valueIt).isEmpty() )
textLine.append( "=" + (*valueIt) );
}
}
}
if ( hasEncoding ) { // have to encode the data
QByteArray input, output;
input = (*lineIt).valueBytes();
if ( encodingType == "b" )
KCodecs::base64Encode( input, output );
else if ( encodingType == "quoted-printable" )
- KCodecs::quotedPrintableEncode( input, output );
+ KCodecs::quotedPrintableEncode( input, output, true );
textLine.append( ":" + QString( output ) );
} else
textLine.append( ":" + (*lineIt).valueString().replace( QRegExp("\n"), "\\n" ) );
if ( textLine.length() > FOLD_WIDTH ) { // we have to fold the line
for ( uint i = 0; i <= ( textLine.length() / FOLD_WIDTH ); ++i )
text.append( ( i == 0 ? "" : " " ) + textLine.mid( i * FOLD_WIDTH, FOLD_WIDTH ) + "\r\n" );
} else
text.append( textLine + "\r\n" );
}
}
}
text.append( "END:VCARD\r\n" );
text.append( "\r\n" );
}
return text;
}
diff --git a/kabc/vcardparser/vcardtool.cpp b/kabc/vcardparser/vcardtool.cpp
index 204326e..435c3b0 100644
--- a/kabc/vcardparser/vcardtool.cpp
+++ b/kabc/vcardparser/vcardtool.cpp
@@ -463,385 +463,385 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
}
}
// LOGO
else if ( identifier == "logo" )
addr.setLogo( parsePicture( *lineIt ) );
// MAILER
else if ( identifier == "mailer" )
addr.setMailer( (*lineIt).valueString() );
// N
else if ( identifier == "n" ) {
const QStringList nameParts = splitString( semicolonSep, (*lineIt).valueString() );
if ( nameParts.count() > 0 )
addr.setFamilyName( nameParts[ 0 ] );
if ( nameParts.count() > 1 )
addr.setGivenName( nameParts[ 1 ] );
if ( nameParts.count() > 2 )
addr.setAdditionalName( nameParts[ 2 ] );
if ( nameParts.count() > 3 )
addr.setPrefix( nameParts[ 3 ] );
if ( nameParts.count() > 4 )
addr.setSuffix( nameParts[ 4 ] );
}
// NAME
else if ( identifier == "name" )
addr.setName( (*lineIt).valueString() );
// NICKNAME
else if ( identifier == "nickname" )
addr.setNickName( (*lineIt).valueString() );
// NOTE
else if ( identifier == "note" )
addr.setNote( (*lineIt).valueString() );
// ORGANIZATION
else if ( identifier == "org" )
addr.setOrganization( (*lineIt).valueString() );
// PHOTO
else if ( identifier == "photo" )
addr.setPhoto( parsePicture( *lineIt ) );
// PROID
else if ( identifier == "prodid" )
addr.setProductId( (*lineIt).valueString() );
// REV
else if ( identifier == "rev" )
addr.setRevision( parseDateTime( (*lineIt).valueString() ) );
// ROLE
else if ( identifier == "role" )
addr.setRole( (*lineIt).valueString() );
// SORT-STRING
else if ( identifier == "sort-string" )
addr.setSortString( (*lineIt).valueString() );
// SOUND
else if ( identifier == "sound" )
addr.setSound( parseSound( *lineIt ) );
// TEL
else if ( identifier == "tel" ) {
PhoneNumber phone;
phone.setNumber( (*lineIt).valueString() );
int type = 0;
const QStringList types = (*lineIt).parameters( "type" );
for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it )
type += mPhoneTypeMap[(*it).upper()];
phone.setType( type );
addr.insertPhoneNumber( phone );
}
// TITLE
else if ( identifier == "title" )
addr.setTitle( (*lineIt).valueString() );
// TZ
else if ( identifier == "tz" ) {
TimeZone tz;
const QString date = (*lineIt).valueString();
int hours = date.mid( 1, 2).toInt();
int minutes = date.mid( 4, 2 ).toInt();
int offset = ( hours * 60 ) + minutes;
offset = offset * ( date[ 0 ] == '+' ? 1 : -1 );
tz.setOffset( offset );
addr.setTimeZone( tz );
}
// UID
else if ( identifier == "uid" )
addr.setUid( (*lineIt).valueString() );
// URL
else if ( identifier == "url" )
addr.setUrl( KURL( (*lineIt).valueString() ) );
// X-
else if ( identifier.startsWith( "x-" ) ) {
const QString key = (*lineIt).identifier().mid( 2 );
int dash = key.find( "-" );
addr.insertCustom( key.left( dash ), key.mid( dash + 1 ), (*lineIt).valueString() );
}
}
}
addr.makePhoneNumbersOLcompatible();
addrList.append( addr );
}
return addrList;
}
QDateTime VCardTool::parseDateTime( const QString &str )
{
QDateTime dateTime;
if ( str.find( '-' ) == -1 ) { // is base format (yyyymmdd)
dateTime.setDate( QDate( str.left( 4 ).toInt(), str.mid( 4, 2 ).toInt(),
str.mid( 6, 2 ).toInt() ) );
if ( str.find( 'T' ) ) // has time information yyyymmddThh:mm:ss
dateTime.setTime( QTime( str.mid( 11, 2 ).toInt(), str.mid( 14, 2 ).toInt(),
str.mid( 17, 2 ).toInt() ) );
} else { // is extended format yyyy-mm-dd
dateTime.setDate( QDate( str.left( 4 ).toInt(), str.mid( 5, 2 ).toInt(),
str.mid( 8, 2 ).toInt() ) );
if ( str.find( 'T' ) ) // has time information yyyy-mm-ddThh:mm:ss
dateTime.setTime( QTime( str.mid( 11, 2 ).toInt(), str.mid( 14, 2 ).toInt(),
str.mid( 17, 2 ).toInt() ) );
}
return dateTime;
}
QString VCardTool::createDateTime( const QDateTime &dateTime )
{
QString str;
if ( dateTime.date().isValid() ) {
str.sprintf( "%4d-%02d-%02d", dateTime.date().year(), dateTime.date().month(),
dateTime.date().day() );
if ( dateTime.time().isValid() ) {
QString tmp;
tmp.sprintf( "T%02d:%02d:%02dZ", dateTime.time().hour(), dateTime.time().minute(),
dateTime.time().second() );
str += tmp;
}
}
return str;
}
Picture VCardTool::parsePicture( const VCardLine &line )
{
Picture pic;
const QStringList params = line.parameterList();
if ( params.findIndex( "encoding" ) != -1 ) {
QImage img;
img.loadFromData( line.valueBytes() );
pic.setData( img );
} else if ( params.findIndex( "value" ) != -1 ) {
if ( line.parameter( "value" ).lower() == "uri" )
pic.setUrl( line.valueString() );
}
if ( params.findIndex( "type" ) != -1 )
pic.setType( line.parameter( "type" ) );
return pic;
}
VCardLine VCardTool::createPicture( const QString &identifier, const Picture &pic )
{
VCardLine line( identifier );
if ( pic.isIntern() ) {
if ( !pic.data().isNull() ) {
QByteArray input;
- QDataStream s( input, IO_WriteOnly );
+ QDataStream s( &input, QIODevice::WriteOnly );
s.setVersion( 4 );
s << pic.data();
line.setValueBytes( input );
line.addParameter( "encoding", "b" );
line.addParameter( "type", "image/png" );
}
} else if ( !pic.url().isEmpty() ) {
QByteArray ba;
line.setValueString( pic.url() );
line.addParameter( "value", "URI" );
}
return line;
}
Sound VCardTool::parseSound( const VCardLine &line )
{
Sound snd;
const QStringList params = line.parameterList();
if ( params.findIndex( "encoding" ) != -1 )
snd.setData( line.valueBytes() );
else if ( params.findIndex( "value" ) != -1 ) {
if ( line.parameter( "value" ).lower() == "uri" )
snd.setUrl( line.valueString() );
}
/* TODO: support sound types
if ( params.contains( "type" ) )
snd.setType( line.parameter( "type" ) );
*/
return snd;
}
VCardLine VCardTool::createSound( const Sound &snd )
{
VCardLine line( "SOUND" );
if ( snd.isIntern() ) {
if ( !snd.data().isEmpty() ) {
line.setValueBytes( snd.data() );
line.addParameter( "encoding", "b" );
// TODO: need to store sound type!!!
}
} else if ( !snd.url().isEmpty() ) {
line.setValueString( snd.url() );
line.addParameter( "value", "URI" );
}
return line;
}
Key VCardTool::parseKey( const VCardLine &line )
{
Key key;
const QStringList params = line.parameterList();
if ( params.findIndex( "encoding" ) != -1 )
key.setBinaryData( line.valueBytes() );
else
key.setTextData( line.valueString() );
if ( params.findIndex( "type" ) != -1 ) {
if ( line.parameter( "type" ).lower() == "x509" )
key.setType( Key::X509 );
else if ( line.parameter( "type" ).lower() == "pgp" )
key.setType( Key::PGP );
else {
key.setType( Key::Custom );
key.setCustomTypeString( line.parameter( "type" ) );
}
}
return key;
}
VCardLine VCardTool::createKey( const Key &key )
{
VCardLine line( "KEY" );
if ( key.isBinary() ) {
if ( !key.binaryData().isEmpty() ) {
line.setValueBytes( key.binaryData() );
line.addParameter( "encoding", "b" );
}
} else if ( !key.textData().isEmpty() )
line.setValueString( key.textData() );
if ( key.type() == Key::X509 )
line.addParameter( "type", "X509" );
else if ( key.type() == Key::PGP )
line.addParameter( "type", "PGP" );
else if ( key.type() == Key::Custom )
line.addParameter( "type", key.customTypeString() );
return line;
}
Secrecy VCardTool::parseSecrecy( const VCardLine &line )
{
Secrecy secrecy;
if ( line.valueString().lower() == "public" )
secrecy.setType( Secrecy::Public );
if ( line.valueString().lower() == "private" )
secrecy.setType( Secrecy::Private );
if ( line.valueString().lower() == "confidential" )
secrecy.setType( Secrecy::Confidential );
return secrecy;
}
VCardLine VCardTool::createSecrecy( const Secrecy &secrecy )
{
VCardLine line( "CLASS" );
int type = secrecy.type();
if ( type == Secrecy::Public )
line.setValueString( "PUBLIC" );
else if ( type == Secrecy::Private )
line.setValueString( "PRIVATE" );
else if ( type == Secrecy::Confidential )
line.setValueString( "CONFIDENTIAL" );
return line;
}
Agent VCardTool::parseAgent( const VCardLine &line )
{
Agent agent;
const QStringList params = line.parameterList();
if ( params.findIndex( "value" ) != -1 ) {
if ( line.parameter( "value" ).lower() == "uri" )
agent.setUrl( line.valueString() );
} else {
QString str = line.valueString();
str.replace( QRegExp("\\\\n"), "\r\n" );
str.replace( QRegExp("\\\\N"), "\r\n" );
str.replace( QRegExp("\\\\;"), ";" );
str.replace( QRegExp("\\\\:"), ":" );
str.replace( QRegExp("\\\\,"), "," );
const Addressee::List list = parseVCards( str );
if ( list.count() > 0 ) {
Addressee *addr = new Addressee;
*addr = list[ 0 ];
agent.setAddressee( addr );
}
}
return agent;
}
VCardLine VCardTool::createAgent( VCard::Version version, const Agent &agent )
{
VCardLine line( "AGENT" );
if ( agent.isIntern() ) {
if ( agent.addressee() != 0 ) {
Addressee::List list;
list.append( *agent.addressee() );
QString str = createVCards( list, version );
str.replace( QRegExp("\\r\\n"), "\\n" );
str.replace( QRegExp(";"), "\\;" );
str.replace( QRegExp(":"), "\\:" );
str.replace( QRegExp(","), "\\," );
line.setValueString( str );
}
} else if ( !agent.url().isEmpty() ) {
line.setValueString( agent.url() );
line.addParameter( "value", "URI" );
}
return line;
}
QStringList VCardTool::splitString( const QChar &sep, const QString &str )
{
QStringList list;
QString value( str );
int start = 0;
int pos = value.find( sep, start );
while ( pos != -1 ) {
if ( value[ pos - 1 ] != '\\' ) {
if ( pos > start && pos <= (int)value.length() )
list << value.mid( start, pos - start );