-rw-r--r-- | kabc/picture.cpp | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/kabc/picture.cpp b/kabc/picture.cpp index 6a34b98..57aa297 100644 --- a/kabc/picture.cpp +++ b/kabc/picture.cpp @@ -40,42 +40,68 @@ Picture::Picture( const QString &url ) { mUndefined = false; } Picture::Picture( const QImage &data ) : mData( data ), mIntern( true ) { mUndefined = false; } Picture::~Picture() { } bool Picture::operator==( const Picture &p ) const { - if ( mIntern != p.mIntern ) return false; - + //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 ) { - if ( mData != p.mData ) + //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 ) - return false; + 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 ) |