23 #include <klocalizedstring.h> 25 #include <QtCore/QDataStream> 26 #include <QtCore/QSharedData> 30 class Secrecy::PrivateData :
public QSharedData
34 : mType( Secrecy::Invalid )
38 PrivateData(
const PrivateData &other )
39 : QSharedData( other )
47 Secrecy::Secrecy( Type type )
48 : d( new PrivateData )
53 Secrecy::Secrecy(
const Secrecy &other )
62 Secrecy &Secrecy::operator=(
const Secrecy &other )
64 if (
this != &other ) {
71 bool Secrecy::operator==(
const Secrecy &other )
const 73 return d->mType == other.d->mType;
76 bool Secrecy::operator!=(
const Secrecy &other )
const 78 return !( *
this == other );
81 bool Secrecy::isValid()
const 83 return d->mType != Invalid;
86 void Secrecy::setType( Type
type )
91 Secrecy::Type Secrecy::type()
const 96 Secrecy::TypeList Secrecy::typeList()
100 if ( list.isEmpty() ) {
101 list << Public << Private << Confidential;
107 QString Secrecy::typeLabel( Type
type )
111 return i18nc(
"access is for everyone",
"Public" );
114 return i18nc(
"access is by owner only",
"Private" );
117 return i18nc(
"access is by owner and a controlled group",
"Confidential" );
120 return i18nc(
"unknown secrecy type",
"Unknown type" );
125 QString Secrecy::toString()
const 129 str += QString::fromLatin1(
"Secrecy {\n" );
130 str += QString::fromLatin1(
" Type: %1\n" ).arg( typeLabel( d->mType ) );
131 str += QString::fromLatin1(
"}\n" );
138 return s << (uint)secrecy.d->mType;
148 secrecy.d->mType = Secrecy::Public;
151 secrecy.d->mType = Secrecy::Private;
154 secrecy.d->mType = Secrecy::Confidential;
157 secrecy.d->mType = Secrecy::Invalid;
QDataStream & operator<<(QDataStream &stream, const Address &address)
Serializes the address object into the stream.
QDataStream & operator>>(QDataStream &stream, Address &address)
Initializes the address object from the stream.
Class that holds a Calendar Url (FBURL/CALADRURI/CALURI)