-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 @@ -32,58 +32,84 @@ 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 { - 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 ); } 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 ) { |