You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
121 lines
2.4 KiB
121 lines
2.4 KiB
15 years ago
|
/*
|
||
|
This file is part of libkabc.
|
||
|
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
|
#include "picture.h"
|
||
|
|
||
|
using namespace KABC;
|
||
|
|
||
|
Picture::Picture()
|
||
|
: mIntern( false )
|
||
|
{
|
||
|
}
|
||
|
|
||
14 years ago
|
Picture::Picture( const TQString &url )
|
||
15 years ago
|
: mUrl( url ), mIntern( false )
|
||
|
{
|
||
|
}
|
||
|
|
||
14 years ago
|
Picture::Picture( const TQImage &data )
|
||
15 years ago
|
: mData( data ), mIntern( true )
|
||
|
{
|
||
|
}
|
||
|
|
||
|
Picture::~Picture()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
bool Picture::operator==( const Picture &p ) const
|
||
|
{
|
||
|
if ( mIntern != p.mIntern ) return false;
|
||
|
|
||
|
if ( mIntern ) {
|
||
|
if ( mData != p.mData )
|
||
|
return false;
|
||
|
} else {
|
||
|
if ( mUrl != p.mUrl )
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
bool Picture::operator!=( const Picture &p ) const
|
||
|
{
|
||
|
return !( p == *this );
|
||
|
}
|
||
|
|
||
14 years ago
|
void Picture::setUrl( const TQString &url )
|
||
15 years ago
|
{
|
||
|
mUrl = url;
|
||
|
mIntern = false;
|
||
|
}
|
||
|
|
||
14 years ago
|
void Picture::setData( const TQImage &data )
|
||
15 years ago
|
{
|
||
|
mData = data;
|
||
|
mIntern = true;
|
||
|
}
|
||
|
|
||
14 years ago
|
void Picture::setType( const TQString &type )
|
||
15 years ago
|
{
|
||
|
mType = type;
|
||
|
}
|
||
|
|
||
|
bool Picture::isIntern() const
|
||
|
{
|
||
|
return mIntern;
|
||
|
}
|
||
|
|
||
14 years ago
|
TQString Picture::url() const
|
||
15 years ago
|
{
|
||
|
return mUrl;
|
||
|
}
|
||
|
|
||
14 years ago
|
TQImage Picture::data() const
|
||
15 years ago
|
{
|
||
|
return mData;
|
||
|
}
|
||
|
|
||
14 years ago
|
TQString Picture::type() const
|
||
15 years ago
|
{
|
||
|
return mType;
|
||
|
}
|
||
|
|
||
14 years ago
|
TQString Picture::asString() const
|
||
15 years ago
|
{
|
||
|
if ( mIntern )
|
||
|
return "intern picture";
|
||
|
else
|
||
|
return mUrl;
|
||
|
}
|
||
|
|
||
14 years ago
|
TQDataStream &KABC::operator<<( TQDataStream &s, const Picture &picture )
|
||
15 years ago
|
{
|
||
|
return s << picture.mIntern << picture.mUrl << picture.mType;
|
||
|
// return s << picture.mIntern << picture.mUrl << picture.mType << picture.mData;
|
||
|
}
|
||
|
|
||
14 years ago
|
TQDataStream &KABC::operator>>( TQDataStream &s, Picture &picture )
|
||
15 years ago
|
{
|
||
|
s >> picture.mIntern >> picture.mUrl >> picture.mType;
|
||
|
// s >> picture.mIntern >> picture.mUrl >> picture.mType >> picture.mData;
|
||
|
return s;
|
||
|
}
|