picture.cpp
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #include "picture.h"
00022 
00023 using namespace KABC;
00024 
00025 Picture::Picture()
00026   : mIntern( false )
00027 {
00028 }
00029 
00030 Picture::Picture( const QString &url )
00031   : mUrl( url ), mIntern( false )
00032 {
00033 }
00034 
00035 Picture::Picture( const QImage &data )
00036   : mData( data ), mIntern( true )
00037 {
00038 }
00039 
00040 Picture::~Picture()
00041 {
00042 }
00043 
00044 bool Picture::operator==( const Picture &p ) const
00045 {
00046   if ( mIntern != p.mIntern ) return false;
00047 
00048   if ( mIntern ) {
00049     if ( mData != p.mData )
00050       return false;
00051   } else {
00052     if ( mUrl != p.mUrl )
00053       return false;
00054   }
00055 
00056   return true;
00057 }
00058 
00059 bool Picture::operator!=( const Picture &p ) const
00060 {
00061   return !( p == *this );
00062 }
00063 
00064 void Picture::setUrl( const QString &url )
00065 {
00066   mUrl = url;
00067   mIntern = false;
00068 }
00069 
00070 void Picture::setData( const QImage &data )
00071 {
00072   mData = data;
00073   mIntern = true;
00074 }
00075 
00076 void Picture::setType( const QString &type )
00077 {
00078   mType = type;
00079 }
00080 
00081 bool Picture::isIntern() const
00082 {
00083   return mIntern;
00084 }
00085 
00086 QString Picture::url() const
00087 {
00088   return mUrl;
00089 }
00090 
00091 QImage Picture::data() const
00092 {
00093   return mData;
00094 }
00095 
00096 QString Picture::type() const
00097 {
00098   return mType;
00099 }
00100 
00101 QString Picture::asString() const
00102 {
00103   if ( mIntern )
00104     return "intern picture";
00105   else
00106     return mUrl;
00107 }
00108 
00109 QDataStream &KABC::operator<<( QDataStream &s, const Picture &picture )
00110 {
00111   return s << picture.mIntern << picture.mUrl << picture.mType;
00112 
00113 }
00114 
00115 QDataStream &KABC::operator>>( QDataStream &s, Picture &picture )
00116 {
00117   s >> picture.mIntern >> picture.mUrl >> picture.mType;
00118 
00119   return s;
00120 }
 
This file is part of the documentation for kabc Library Version 3.2.0.