author | zautrix <zautrix> | 2005-01-14 11:37:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-14 11:37:40 (UTC) |
commit | 61c95ce0295f1397db6499c5b468a9fb3d32a0f4 (patch) (unidiff) | |
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 | |||
@@ -24,74 +24,100 @@ Copyright (c) 2004 Ulf Schenk | |||
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "picture.h" | 28 | #include "picture.h" |
29 | 29 | ||
30 | using namespace KABC; | 30 | using namespace KABC; |
31 | 31 | ||
32 | Picture::Picture() | 32 | Picture::Picture() |
33 | : mIntern( false ) | 33 | : mIntern( false ) |
34 | { | 34 | { |
35 | mUndefined = true; | 35 | mUndefined = true; |
36 | } | 36 | } |
37 | 37 | ||
38 | Picture::Picture( const QString &url ) | 38 | Picture::Picture( const QString &url ) |
39 | : mUrl( url ), mIntern( false ) | 39 | : mUrl( url ), mIntern( false ) |
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 ) |
82 | { | 108 | { |
83 | mData = data; | 109 | mData = data; |
84 | mIntern = true; | 110 | mIntern = true; |
85 | mUndefined = false; | 111 | mUndefined = false; |
86 | } | 112 | } |
87 | 113 | ||
88 | void Picture::setType( const QString &type ) | 114 | void Picture::setType( const QString &type ) |
89 | { | 115 | { |
90 | mType = type; | 116 | mType = type; |
91 | } | 117 | } |
92 | 118 | ||
93 | bool Picture::isIntern() const | 119 | bool Picture::isIntern() const |
94 | { | 120 | { |
95 | return mIntern; | 121 | return mIntern; |
96 | } | 122 | } |
97 | 123 | ||