-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 ) | |||
40 | { | 40 | { |
41 | mUndefined = false; | 41 | mUndefined = false; |
42 | } | 42 | } |
43 | 43 | ||
44 | Picture::Picture( const QImage &data ) | 44 | Picture::Picture( const QImage &data ) |
45 | : mData( data ), mIntern( true ) | 45 | : mData( data ), mIntern( true ) |
46 | { | 46 | { |
47 | mUndefined = false; | 47 | mUndefined = false; |
48 | } | 48 | } |
49 | 49 | ||
50 | Picture::~Picture() | 50 | Picture::~Picture() |
51 | { | 51 | { |
52 | } | 52 | } |
53 | 53 | ||
54 | bool Picture::operator==( const Picture &p ) const | 54 | bool Picture::operator==( const Picture &p ) const |
55 | { | 55 | { |
56 | if ( mIntern != p.mIntern ) return false; | 56 | //qDebug("compare PIC "); |
57 | 57 | if ( mUndefined && p.mUndefined ) { | |
58 | //qDebug("compare PIC true 1 "); | ||
59 | return true; | ||
60 | } | ||
61 | if ( mUndefined || p.mUndefined ) { | ||
62 | //qDebug("compare PIC false 1"); | ||
63 | return false; | ||
64 | } | ||
65 | // now we should deal with two defined pics! | ||
66 | if ( mIntern != p.mIntern ) { | ||
67 | //qDebug("compare PIC false 2"); | ||
68 | return false; | ||
69 | } | ||
58 | if ( mIntern ) { | 70 | if ( mIntern ) { |
59 | if ( mData != p.mData ) | 71 | //qDebug("mIntern "); |
72 | if ( mData.isNull() && p.mData.isNull() ) { | ||
73 | //qDebug("compare PIC true 2 "); | ||
74 | return true; | ||
75 | } | ||
76 | if ( mData.isNull() || p.mData.isNull() ){ | ||
77 | //qDebug("compare PIC false 3-1"); | ||
78 | |||
79 | return false; | ||
80 | } | ||
81 | if ( mData != p.mData ) { | ||
82 | //qDebug("compare PIC false 3"); | ||
60 | return false; | 83 | return false; |
84 | } | ||
61 | } else { | 85 | } else { |
62 | if ( mUrl != p.mUrl ) | 86 | if ( mUrl != p.mUrl ) { |
63 | return false; | 87 | //qDebug("compare PIC false 4"); |
88 | return false; | ||
89 | } | ||
64 | } | 90 | } |
65 | 91 | //qDebug("compare PIC true "); | |
66 | return true; | 92 | return true; |
67 | } | 93 | } |
68 | 94 | ||
69 | bool Picture::operator!=( const Picture &p ) const | 95 | bool Picture::operator!=( const Picture &p ) const |
70 | { | 96 | { |
71 | return !( p == *this ); | 97 | return !( p == *this ); |
72 | } | 98 | } |
73 | 99 | ||
74 | void Picture::setUrl( const QString &url ) | 100 | void Picture::setUrl( const QString &url ) |
75 | { | 101 | { |
76 | mUrl = url; | 102 | mUrl = url; |
77 | mIntern = false; | 103 | mIntern = false; |
78 | mUndefined = false; | 104 | mUndefined = false; |
79 | } | 105 | } |
80 | 106 | ||
81 | void Picture::setData( const QImage &data ) | 107 | void Picture::setData( const QImage &data ) |