• Skip to content
  • Skip to link menu
Brand

API Documentation

  1. KDE API Reference
  2. The KDE Frameworks
  3. KContacts
  • KDE Home
  • Contact Us

Quick Links

Skip menu "KContacts"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List
  • Dependencies
  • Related Pages

Class Picker

About

Address book API for KDE

Maintainer
Laurent Montel
Supported platforms
Android, FreeBSD, iOS, Linux, MacOSX, Windows
Community
IRC: #kde-devel on Freenode
Mailing list: kde-frameworks-devel
Use with CMake
find_package(KF5Contacts)
target_link_libraries(yourapp KF5::Contacts)
Use with QMake
QT += KContacts 
Clone
git clone git://anongit.kde.org/kcontacts.git
Browse source
KContacts on cgit.kde.org

KContacts

  • frameworks
  • frameworks
  • kcontacts
  • src
  • vcardparser
vcardline.cpp
1 /*
2  This file is part of the KContacts framework.
3  Copyright (c) 2003 Tobias Koenig <[email protected]>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include "vcardline.h"
22 
23 using namespace KContacts;
24 
25 VCardLine::VCardLine()
26 {
27 }
28 
29 VCardLine::VCardLine(const QString &identifier)
30 {
31  mIdentifier = identifier;
32 }
33 
34 VCardLine::VCardLine(const QString &identifier, const QVariant &value)
35 {
36  mIdentifier = identifier;
37  mValue = value;
38 }
39 
40 VCardLine::VCardLine(const VCardLine &line)
41 {
42  mParamMap = line.mParamMap;
43  mValue = line.mValue;
44  mIdentifier = line.mIdentifier;
45  mGroup = line.mGroup;
46 }
47 
48 VCardLine::~VCardLine()
49 {
50 }
51 
52 VCardLine &VCardLine::operator=(const VCardLine &line)
53 {
54  if (&line == this) {
55  return *this;
56  }
57 
58  mParamMap = line.mParamMap;
59  mValue = line.mValue;
60  mIdentifier = line.mIdentifier;
61  mGroup = line.mGroup;
62 
63  return *this;
64 }
65 
66 bool VCardLine::operator==(const VCardLine &other) const
67 {
68  return (mParamMap == other.parameterMap())
69  && (mValue == other.value())
70  && (mIdentifier == other.identifier())
71  && (mGroup == other.group());
72 }
73 
74 void VCardLine::setIdentifier(const QString &identifier)
75 {
76  mIdentifier = identifier;
77 }
78 
79 QString VCardLine::identifier() const
80 {
81  return mIdentifier;
82 }
83 
84 void VCardLine::setValue(const QVariant &value)
85 {
86  mValue = value;
87 }
88 
89 QVariant VCardLine::value() const
90 {
91  return mValue;
92 }
93 
94 void VCardLine::setGroup(const QString &group)
95 {
96  mGroup = group;
97 }
98 
99 QString VCardLine::group() const
100 {
101  return mGroup;
102 }
103 
104 bool VCardLine::hasGroup() const
105 {
106  return !mGroup.isEmpty();
107 }
108 
109 QStringList VCardLine::parameterList() const
110 {
111  return mParamMap.keys();
112 }
113 
114 void VCardLine::addParameter(const QString &param, const QString &value)
115 {
116  QStringList &list = mParamMap[ param ];
117  if (!list.contains(value)) { // not included yet
118  list.append(value);
119  }
120 }
121 
122 QStringList VCardLine::parameters(const QString &param) const
123 {
124  ParamMap::ConstIterator it = mParamMap.find(param);
125  if (it == mParamMap.end()) {
126  return QStringList();
127  } else {
128  return *it;
129  }
130 }
131 
132 QString VCardLine::parameter(const QString &param) const
133 {
134  ParamMap::ConstIterator it = mParamMap.find(param);
135  if (it == mParamMap.end()) {
136  return QString();
137  } else {
138  if ((*it).isEmpty()) {
139  return QString();
140  } else {
141  return (*it).first();
142  }
143  }
144 }
145 
146 VCardLine::ParamMap VCardLine::parameterMap() const
147 {
148  return mParamMap;
149 }
QMap
QStringList::contains
bool contains(const QString &str, Qt::CaseSensitivity cs) const
QList::append
void append(const T &value)
QString::isEmpty
bool isEmpty() const
QString
QStringList
KContacts
Definition: address.h:32
KRecentDirs::list
KIOFILEWIDGETS_EXPORT QStringList list(const QString &fileClass)
QVariant
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Fri Dec 6 2019 03:47:42 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

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