author | zautrix <zautrix> | 2005-01-14 11:37:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-14 11:37:40 (UTC) |
commit | 61c95ce0295f1397db6499c5b468a9fb3d32a0f4 (patch) (side-by-side diff) | |
tree | 2bceecc46d42a572adfad7d8e5000d1534642cbd /kabc/picture.cpp | |
parent | a46ecf5ed81460ec9a4e457798e1bf0fb74c5624 (diff) | |
download | kdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.zip kdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.tar.gz kdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.tar.bz2 |
made kapi saving faster
-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 @@ -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 ) - 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 ) { mData = data; mIntern = true; mUndefined = false; } void Picture::setType( const QString &type ) { |