• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

akonadi/contact

  • akonadi
  • contact
emailaddressselection.cpp
1 /*
2  This file is part of Akonadi Contact.
3 
4  Copyright (c) 2010 KDAB
5  Author: Tobias Koenig <tokoe@kde.org>
6 
7  This library is free software; you can redistribute it and/or modify it
8  under the terms of the GNU Library General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version.
11 
12  This library is distributed in the hope that it will be useful, but WITHOUT
13  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15  License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to the
19  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  02110-1301, USA.
21 */
22 
23 #include "emailaddressselection.h"
24 #include "emailaddressselection_p.h"
25 
26 #include <kabc/contactgroup.h>
27 #include <kmime/kmime_header_parsing.h>
28 
29 using namespace Akonadi;
30 
31 EmailAddressSelection::Private::Private()
32  : QSharedData()
33 {
34 }
35 
36 EmailAddressSelection::Private::Private( const Private &other )
37  : QSharedData( other )
38 {
39  mName = other.mName;
40  mEmailAddress = other.mEmailAddress;
41  mItem = other.mItem;
42 }
43 
44 
45 EmailAddressSelection::EmailAddressSelection()
46  : d( new Private )
47 {
48 }
49 
50 EmailAddressSelection::EmailAddressSelection( const EmailAddressSelection &other )
51  : d( other.d )
52 {
53 }
54 
55 EmailAddressSelection& EmailAddressSelection::operator=( const EmailAddressSelection &other )
56 {
57  if ( this != &other ) {
58  d = other.d;
59  }
60 
61  return *this;
62 }
63 
64 EmailAddressSelection::~EmailAddressSelection()
65 {
66 }
67 
68 bool EmailAddressSelection::isValid() const
69 {
70  return d->mItem.isValid();
71 }
72 
73 QString EmailAddressSelection::name() const
74 {
75  return d->mName;
76 }
77 
78 QString EmailAddressSelection::email() const
79 {
80  return d->mEmailAddress;
81 }
82 
83 QString EmailAddressSelection::quotedEmail() const
84 {
85  if ( d->mItem.hasPayload<KABC::ContactGroup>() ) {
86  if ( d->mEmailAddress == d->mName ) {
87  return d->mName;
88  }
89  }
90 
91  KMime::Types::Mailbox mailbox;
92  mailbox.setAddress( d->mEmailAddress.toUtf8() );
93  mailbox.setName( d->mName );
94 
95  return mailbox.prettyAddress( KMime::Types::Mailbox::QuoteWhenNecessary );
96 }
97 
98 Akonadi::Item EmailAddressSelection::item() const
99 {
100  return d->mItem;
101 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:28:42 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi/contact

Skip menu "akonadi/contact"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal