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

akonadi

  • sources
  • kde-4.12
  • kdepimlibs
  • 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 EmailAddressSelection::EmailAddressSelection()
45  : d( new Private )
46 {
47 }
48 
49 EmailAddressSelection::EmailAddressSelection( const EmailAddressSelection &other )
50  : d( other.d )
51 {
52 }
53 
54 EmailAddressSelection& EmailAddressSelection::operator=( const EmailAddressSelection &other )
55 {
56  if ( this != &other ) {
57  d = other.d;
58  }
59 
60  return *this;
61 }
62 
63 EmailAddressSelection::~EmailAddressSelection()
64 {
65 }
66 
67 bool EmailAddressSelection::isValid() const
68 {
69  return d->mItem.isValid();
70 }
71 
72 QString EmailAddressSelection::name() const
73 {
74  return d->mName;
75 }
76 
77 QString EmailAddressSelection::email() const
78 {
79  return d->mEmailAddress;
80 }
81 
82 QString EmailAddressSelection::quotedEmail() const
83 {
84  if ( d->mItem.hasPayload<KABC::ContactGroup>() ) {
85  if ( d->mEmailAddress == d->mName ) {
86  return d->mName;
87  }
88  }
89 
90  KMime::Types::Mailbox mailbox;
91  mailbox.setAddress( d->mEmailAddress.toUtf8() );
92  mailbox.setName( d->mName );
93 
94  return mailbox.prettyAddress( KMime::Types::Mailbox::QuoteWhenNecessary );
95 }
96 
97 Akonadi::Item EmailAddressSelection::item() const
98 {
99  return d->mItem;
100 }
Akonadi::EmailAddressSelection::item
Akonadi::Item item() const
Returns the Akonadi item that is associated with the selected email address.
Definition: emailaddressselection.cpp:97
Akonadi::EmailAddressSelection
An selection of an email address and corresponding name.
Definition: emailaddressselection.h:49
Akonadi::EmailAddressSelection::name
QString name() const
Returns the name that is associated with the selected email address.
Definition: emailaddressselection.cpp:72
Akonadi::EmailAddressSelection::EmailAddressSelection
EmailAddressSelection()
Creates a new email address selection.
Definition: emailaddressselection.cpp:44
Akonadi::EmailAddressSelection::operator=
EmailAddressSelection & operator=(const EmailAddressSelection &other)
Replaces this email address selection with the other selection.
Definition: emailaddressselection.cpp:54
Akonadi::EmailAddressSelection::isValid
bool isValid() const
Returns whether the selection is valid.
Definition: emailaddressselection.cpp:67
Akonadi::EmailAddressSelection::~EmailAddressSelection
~EmailAddressSelection()
Destroys the email address selection.
Definition: emailaddressselection.cpp:63
Akonadi::EmailAddressSelection::email
QString email() const
Returns the address part of the selected email address.
Definition: emailaddressselection.cpp:77
Akonadi::EmailAddressSelection::quotedEmail
QString quotedEmail() const
Returns the name and email address together, properly quoted if needed.
Definition: emailaddressselection.cpp:82
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



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