kabc
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" );
136 QDataStream &KABC::operator<<( QDataStream &s,
const Secrecy &secrecy )
138 return s << (uint)secrecy.d->mType;
141 QDataStream &KABC::operator>>( QDataStream &s, Secrecy &secrecy )
148 secrecy.d->mType = Secrecy::Public;
151 secrecy.d->mType = Secrecy::Private;
154 secrecy.d->mType = Secrecy::Confidential;
157 secrecy.d->mType = Secrecy::Invalid;
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:01:05 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.