summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-08 22:05:03 (UTC)
committer zautrix <zautrix>2005-04-08 22:05:03 (UTC)
commit9667e6f2589d5b2080cca928814f382761f8dda6 (patch) (side-by-side diff)
tree438bcb5c041de0804284cf457cbc97a367dadf37
parentc0f1d38e29ee0d0a1d1dcb5bda08089923926b41 (diff)
downloadkdepimpi-9667e6f2589d5b2080cca928814f382761f8dda6.zip
kdepimpi-9667e6f2589d5b2080cca928814f382761f8dda6.tar.gz
kdepimpi-9667e6f2589d5b2080cca928814f382761f8dda6.tar.bz2
utf8 kapi import fix
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt2
-rw-r--r--kabc/vcardparser/vcard.cpp2
-rw-r--r--kabc/vcardparser/vcardline.cpp12
-rw-r--r--kabc/vcardparser/vcardline.h7
-rw-r--r--kabc/vcardparser/vcardparser.cpp8
-rw-r--r--kabc/vcardparser/vcardtool.cpp86
-rw-r--r--kaddressbook/views/cardview.cpp9
7 files changed, 66 insertions, 60 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index bc0c62a..97c8154 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,19 +1,21 @@
Info about the changes in new versions of KDE-Pim/Pi
********** VERSION 2.0.26 ************
And again fixed some bugs.
Added two more fields to the KA/Pi view config:
A "Mobile (home)" and a "Mobile (work)" field.
+Fixed utf8 import (e.g. for Japaneese text) in KA/Pi.
+
********** VERSION 2.0.25 ************
And again fixed some bugs.
********** VERSION 2.0.24 ************
Fixed again a lot of small bugs.
Some performance optimizations in date navigator.
Month view displays now multi days events on top of each cell, such that it is more likely that all multi days items of one event are in the same row.
********** VERSION 2.0.23 ************
diff --git a/kabc/vcardparser/vcard.cpp b/kabc/vcardparser/vcard.cpp
index 24fd498..bc9f208 100644
--- a/kabc/vcardparser/vcard.cpp
+++ b/kabc/vcardparser/vcard.cpp
@@ -102,17 +102,17 @@ void VCard::setVersion( Version version )
line.setIdentifier( "3.0" );
mLineMap[ "VERSION" ].append( line );
}
VCard::Version VCard::version() const
{
LineMap::ConstIterator versionEntry = mLineMap.find( "VERSION" );
if ( versionEntry == mLineMap.end() )
return v3_0;
VCardLine line = ( *versionEntry )[ 0 ];
- if ( line.value() == "2.1" )
+ if ( line.valueString() == "2.1" )
return v2_1;
else
return v3_0;
}
diff --git a/kabc/vcardparser/vcardline.cpp b/kabc/vcardparser/vcardline.cpp
index 0972a35..8df2d32 100644
--- a/kabc/vcardparser/vcardline.cpp
+++ b/kabc/vcardparser/vcardline.cpp
@@ -73,37 +73,41 @@ VCardLine& VCardLine::operator=( const VCardLine& line )
}
void VCardLine::setIdentifier( const QString& identifier )
{
mIdentifier = identifier;
}
QString VCardLine::identifier() const
{
return mIdentifier;
}
-void VCardLine::setValue( const QString& value )
+void VCardLine::setValueString( const QString& value )
+{
+ setValueCString( value.utf8() );
+}
+void VCardLine::setValueCString( const QCString& value )
{
mValue.duplicate( value.data(), value.length() );
}
-void VCardLine::setValue( const QByteArray& value )
+void VCardLine::setValueBytes( const QByteArray& value )
{
mValue = value;
}
-QVariant VCardLine::value() const
+QString VCardLine::valueString() const
{
- return QVariant( QCString( mValue.data(), mValue.size()+1 ) );
+ return QString::fromUtf8( mValue.data(), mValue.size() );
}
QByteArray VCardLine::valueBytes() const
{
return mValue;
}
void VCardLine::setGroup( const QString& group )
{
if ( !d )
d = new VCardLinePrivate();
diff --git a/kabc/vcardparser/vcardline.h b/kabc/vcardparser/vcardline.h
index 6e74b38..8dc9322 100644
--- a/kabc/vcardparser/vcardline.h
+++ b/kabc/vcardparser/vcardline.h
@@ -49,31 +49,32 @@ class 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 setValue( const QString& value );
- void setValue( const QByteArray& value );
+ void setValueString( const QString& value );
+ void setValueCString( const QCString& value );
+ void setValueBytes( const QByteArray& value );
/**
* Returns the value of this line.
*/
- QVariant value() const;
+ 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;
diff --git a/kabc/vcardparser/vcardparser.cpp b/kabc/vcardparser/vcardparser.cpp
index 7fae011..11622a0 100644
--- a/kabc/vcardparser/vcardparser.cpp
+++ b/kabc/vcardparser/vcardparser.cpp
@@ -117,30 +117,30 @@ VCard::List VCardParser::parseVCards( const QString& text )
// 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.setValue( output );
+ 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.setValue( value.replace( QRegExp("\\\\n"), "\n" ) );
+ 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;
}
@@ -179,25 +179,25 @@ QString VCardParser::createVCards( const VCard::List& list )
// 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).value().asString().isEmpty() ) {
+ 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();
@@ -212,25 +212,25 @@ QString VCardParser::createVCards( const VCard::List& list )
}
}
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 );
textLine.append( ":" + QString( output ) );
} else
- textLine.append( ":" + (*lineIt).value().asString().replace( QRegExp("\n"), "\\n" ) );
+ 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" );
diff --git a/kabc/vcardparser/vcardtool.cpp b/kabc/vcardparser/vcardtool.cpp
index 0cf72c0..c3d92b6 100644
--- a/kabc/vcardparser/vcardtool.cpp
+++ b/kabc/vcardparser/vcardtool.cpp
@@ -358,25 +358,25 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
QStringList::ConstIterator identIt;
QStringList::ConstIterator identEnd( idents.end() );
for ( identIt = idents.begin(); identIt != identEnd; ++identIt ) {
const VCardLine::List lines = (*cardIt).lines( (*identIt) );
VCardLine::List::ConstIterator lineIt;
// iterate over the lines
for ( lineIt = lines.begin(); lineIt != lines.end(); ++lineIt ) {
identifier = (*lineIt).identifier().lower();
// ADR
if ( identifier == "adr" ) {
Address address;
- const QStringList addrParts = splitString( semicolonSep, (*lineIt).value().asString() );
+ const QStringList addrParts = splitString( semicolonSep, (*lineIt).valueString() );
if ( addrParts.count() > 0 )
address.setPostOfficeBox( addrParts[ 0 ] );
if ( addrParts.count() > 1 )
address.setExtended( addrParts[ 1 ] );
if ( addrParts.count() > 2 )
address.setStreet( addrParts[ 2 ] );
if ( addrParts.count() > 3 )
address.setLocality( addrParts[ 3 ] );
if ( addrParts.count() > 4 )
address.setRegion( addrParts[ 4 ] );
if ( addrParts.count() > 5 )
address.setPostalCode( addrParts[ 5 ] );
@@ -390,198 +390,198 @@ Addressee::List VCardTool::parseVCards( const QString& vcard )
type += mAddressTypeMap[ (*it).lower() ];
address.setType( type );
addr.insertAddress( address );
}
// AGENT
else if ( identifier == "agent" )
addr.setAgent( parseAgent( *lineIt ) );
// BDAY
else if ( identifier == "bday" )
- addr.setBirthday( parseDateTime( (*lineIt).value().asString() ) );
+ addr.setBirthday( parseDateTime( (*lineIt).valueString() ) );
// CATEGORIES
else if ( identifier == "categories" ) {
- const QStringList categories = splitString( commaSep, (*lineIt).value().asString() );
+ const QStringList categories = splitString( commaSep, (*lineIt).valueString() );
addr.setCategories( categories );
}
// CLASS
else if ( identifier == "class" )
addr.setSecrecy( parseSecrecy( *lineIt ) );
// EMAIL
else if ( identifier == "email" ) {
const QStringList types = (*lineIt).parameters( "type" );
- addr.insertEmail( (*lineIt).value().asString(), types.findIndex( "PREF" ) != -1 );
+ addr.insertEmail( (*lineIt).valueString(), types.findIndex( "PREF" ) != -1 );
}
// FN
else if ( identifier == "fn" )
- addr.setFormattedName( (*lineIt).value().asString() );
+ addr.setFormattedName( (*lineIt).valueString() );
// GEO
else if ( identifier == "geo" ) {
Geo geo;
- const QStringList geoParts = QStringList::split( ';', (*lineIt).value().asString(), true );
+ const QStringList geoParts = QStringList::split( ';', (*lineIt).valueString(), true );
geo.setLatitude( geoParts[ 0 ].toFloat() );
geo.setLongitude( geoParts[ 1 ].toFloat() );
addr.setGeo( geo );
}
// KEY
else if ( identifier == "key" )
addr.insertKey( parseKey( *lineIt ) );
// LABEL
else if ( identifier == "label" ) {
int type = 0;
const QStringList types = (*lineIt).parameters( "type" );
for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it )
type += mAddressTypeMap[ (*it).lower() ];
bool available = false;
KABC::Address::List addressList = addr.addresses();
KABC::Address::List::Iterator it;
for ( it = addressList.begin(); it != addressList.end(); ++it ) {
if ( (*it).type() == type ) {
- (*it).setLabel( (*lineIt).value().asString() );
+ (*it).setLabel( (*lineIt).valueString() );
addr.insertAddress( *it );
available = true;
break;
}
}
if ( !available ) { // a standalone LABEL tag
KABC::Address address( type );
- address.setLabel( (*lineIt).value().asString() );
+ address.setLabel( (*lineIt).valueString() );
addr.insertAddress( address );
}
}
// LOGO
else if ( identifier == "logo" )
addr.setLogo( parsePicture( *lineIt ) );
// MAILER
else if ( identifier == "mailer" )
- addr.setMailer( (*lineIt).value().asString() );
+ addr.setMailer( (*lineIt).valueString() );
// N
else if ( identifier == "n" ) {
- const QStringList nameParts = splitString( semicolonSep, (*lineIt).value().asString() );
+ 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).value().asString() );
+ addr.setName( (*lineIt).valueString() );
// NICKNAME
else if ( identifier == "nickname" )
- addr.setNickName( (*lineIt).value().asString() );
+ addr.setNickName( (*lineIt).valueString() );
// NOTE
else if ( identifier == "note" )
- addr.setNote( (*lineIt).value().asString() );
+ addr.setNote( (*lineIt).valueString() );
// ORGANIZATION
else if ( identifier == "org" )
- addr.setOrganization( (*lineIt).value().asString() );
+ addr.setOrganization( (*lineIt).valueString() );
// PHOTO
else if ( identifier == "photo" )
addr.setPhoto( parsePicture( *lineIt ) );
// PROID
else if ( identifier == "prodid" )
- addr.setProductId( (*lineIt).value().asString() );
+ addr.setProductId( (*lineIt).valueString() );
// REV
else if ( identifier == "rev" )
- addr.setRevision( parseDateTime( (*lineIt).value().asString() ) );
+ addr.setRevision( parseDateTime( (*lineIt).valueString() ) );
// ROLE
else if ( identifier == "role" )
- addr.setRole( (*lineIt).value().asString() );
+ addr.setRole( (*lineIt).valueString() );
// SORT-STRING
else if ( identifier == "sort-string" )
- addr.setSortString( (*lineIt).value().asString() );
+ addr.setSortString( (*lineIt).valueString() );
// SOUND
else if ( identifier == "sound" )
addr.setSound( parseSound( *lineIt ) );
// TEL
else if ( identifier == "tel" ) {
PhoneNumber phone;
- phone.setNumber( (*lineIt).value().asString() );
+ 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).value().asString() );
+ addr.setTitle( (*lineIt).valueString() );
// TZ
else if ( identifier == "tz" ) {
TimeZone tz;
- const QString date = (*lineIt).value().asString();
+ 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).value().asString() );
+ addr.setUid( (*lineIt).valueString() );
// URL
else if ( identifier == "url" )
- addr.setUrl( KURL( (*lineIt).value().asString() ) );
+ 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).value().asString() );
+ addr.insertCustom( key.left( dash ), key.mid( dash + 1 ), (*lineIt).valueString() );
}
}
}
addrList.append( addr );
}
return addrList;
}
QDateTime VCardTool::parseDateTime( const QString &str )
{
@@ -627,180 +627,180 @@ QString VCardTool::createDateTime( const QDateTime &dateTime )
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.value().asString() );
+ 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 );
s.setVersion( 4 );
s << pic.data();
- line.setValue( input );
+ line.setValueBytes( input );
line.addParameter( "encoding", "b" );
line.addParameter( "type", "image/png" );
}
} else if ( !pic.url().isEmpty() ) {
QByteArray ba;
- line.setValue( pic.url() );
+ 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.value().asString() );
+ 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.setValue( snd.data() );
+ line.setValueBytes( snd.data() );
line.addParameter( "encoding", "b" );
// TODO: need to store sound type!!!
}
} else if ( !snd.url().isEmpty() ) {
- line.setValue( snd.url() );
+ 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.value().asString() );
+ 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.setValue( key.binaryData() );
+ line.setValueBytes( key.binaryData() );
line.addParameter( "encoding", "b" );
}
} else if ( !key.textData().isEmpty() )
- line.setValue( key.textData() );
+ 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.value().asString().lower() == "public" )
+ if ( line.valueString().lower() == "public" )
secrecy.setType( Secrecy::Public );
- if ( line.value().asString().lower() == "private" )
+ if ( line.valueString().lower() == "private" )
secrecy.setType( Secrecy::Private );
- if ( line.value().asString().lower() == "confidential" )
+ 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.setValue( "PUBLIC" );
+ line.setValueString( "PUBLIC" );
else if ( type == Secrecy::Private )
- line.setValue( "PRIVATE" );
+ line.setValueString( "PRIVATE" );
else if ( type == Secrecy::Confidential )
- line.setValue( "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.value().asString() );
+ agent.setUrl( line.valueString() );
} else {
- QString str = line.value().asString();
+ 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 );
}
@@ -814,28 +814,28 @@ 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.setValue( str );
+ line.setValueString( str );
}
} else if ( !agent.url().isEmpty() ) {
- line.setValue( agent.url() );
+ 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;
diff --git a/kaddressbook/views/cardview.cpp b/kaddressbook/views/cardview.cpp
index 84d3116..b6e053f 100644
--- a/kaddressbook/views/cardview.cpp
+++ b/kaddressbook/views/cardview.cpp
@@ -927,42 +927,41 @@ CardViewItem *CardView::findItem(const QString &text, const QString &label,
*/
uint CardView::columnWidth()
{
return d->mDrawSeparators ?
d->mItemWidth + ( 2 * d->mItemSpacing ) + d->mSepWidth :
d->mItemWidth + d->mItemSpacing;
}
void CardView::drawContents(QPainter *p, int clipx, int clipy,
int clipw, int cliph)
{
- QScrollView::drawContents(p, clipx, clipy, clipw, cliph);
-
+ //QScrollView::drawContents(p, clipx, clipy, clipw, cliph);
if (d->mLayoutDirty)
calcLayout();
//kdDebug() << "CardView::drawContents: " << clipx << ", " << clipy
// << ", " << clipw << ", " << cliph << endl;
QColorGroup cg = viewport()->palette().active(); // allow setting costum colors in the viewport pale
-
+ int cX, cY;
+ contentsToViewport ( clipx, clipy, cX, cY );
QRect clipRect(clipx, clipy, clipw, cliph);
QRect cardRect;
QRect sepRect;
CardViewItem *item;
CardViewSeparator *sep;
-
// make sure the viewport is a pure background
- viewport()->erase(clipRect);
+ viewport()->erase( QRect ( cX, cY , clipw, cliph ) );
// Now tell the cards to draw, if they are in the clip region
QPtrListIterator<CardViewItem> iter(d->mItemList);
for (iter.toFirst(); iter.current(); ++iter)
{
item = *iter;
cardRect.setRect( item->d->x, item->d->y, d->mItemWidth, item->height() );
if (clipRect.intersects(cardRect) || clipRect.contains(cardRect))
{
//kdDebug() << "\trepainting card at: " << cardRect.x() << ", "
// << cardRect.y() << endl;