-rw-r--r-- | kabc/picture.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/kabc/picture.cpp b/kabc/picture.cpp index 6a34b98..57aa297 100644 --- a/kabc/picture.cpp +++ b/kabc/picture.cpp @@ -50,22 +50,48 @@ Picture::Picture( const QImage &data ) 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 ) + 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 ); |