Build with non-standard boost locations.
[kdepim.git] / messagecomposer / recipient.cpp
blobfc87f08ee67782712296c4975551e71c34a64dbd
1 /*
2 Copyright (c) 2010 Volker Krause <vkrause@kde.org>
3 Based in kmail/recipientseditor.h/cpp
4 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution.
26 #include "recipient.h"
28 #include <klocale.h>
30 // using namespace MessageComposer;
32 Recipient::Recipient( const QString &email, Recipient::Type type )
33 : mEmail( email ), mType( type )
37 void Recipient::setType( Type type )
39 mType = type;
42 Recipient::Type Recipient::type() const
44 return mType;
47 void Recipient::setEmail( const QString &email )
49 mEmail = email;
52 QString Recipient::email() const
54 return mEmail;
57 bool Recipient::isEmpty() const
59 return mEmail.isEmpty();
62 int Recipient::typeToId( Recipient::Type type )
64 return static_cast<int>( type );
67 Recipient::Type Recipient::idToType( int id )
69 return static_cast<Type>( id );
72 QString Recipient::typeLabel() const
74 return typeLabel( mType );
77 QString Recipient::typeLabel( Recipient::Type type )
79 switch( type ) {
80 case To:
81 return i18nc("@label:listbox Recipient of an email message.", "To");
82 case Cc:
83 return i18nc("@label:listbox Carbon Copy recipient of an email message.", "CC");
84 case Bcc:
85 return i18nc("@label:listbox Blind carbon copy recipient of an email message.", "BCC");
86 case Undefined:
87 break;
90 return i18nc("@label:listbox", "<placeholder>Undefined Recipient Type</placeholder>");
93 QStringList Recipient::allTypeLabels()
95 QStringList types;
96 types.append( typeLabel( To ) );
97 types.append( typeLabel( Cc ) );
98 types.append( typeLabel( Bcc ) );
99 return types;