• Skip to content
  • Skip to link menu
KDE API Documentation - emaildetailswidget.cpp Source File (KPeople)
  • KDE Home
  • Contact Us
 

KPeople

  • frameworks
  • kpeople
  • src
  • widgets
  • plugins
emaildetailswidget.cpp
1 /*
2  Copyright (C) 2013 David Edmundson <davidedmundson@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #include "emaildetailswidget.h"
20 
21 #include <QVBoxLayout>
22 #include <QLabel>
23 
24 #include <KPluginFactory>
25 #include <KLocalizedString>
26 #include <KPeople/PersonData>
27 
28 // K_PLUGIN_FACTORY( EmailDetailsWidgetFactory, registerPlugin<EmailDetailsWidget>(); )
29 // K_EXPORT_PLUGIN( EmailDetailsWidgetFactory("emaildetailswidgetplugin") )
30 
31 using namespace KPeople;
32 
33 QWidget *EmailFieldsPlugin::createDetailsWidget(const PersonData &person, QWidget *parent) const
34 {
35  if (person.allEmails().isEmpty()) {
36  return 0;
37  }
38  QWidget *widget = new QWidget(parent);
39  QVBoxLayout *layout = new QVBoxLayout(widget);
40  layout->setContentsMargins(0, 0, 0, 0);
41  Q_FOREACH (const QString &email, person.allEmails()) {
42  layout->addWidget(new QLabel(email));
43  }
44  widget->setLayout(layout);
45  return widget;
46 }
47 
48 QString EmailFieldsPlugin::label() const
49 {
50  return i18n("Email");
51 }
52 
53 int EmailFieldsPlugin::sortWeight() const
54 {
55  return 50;
56 }
57 
KPeople::PersonData
Allows to query the information about a given person.
Definition: persondata.h:44
KPeople
The KPeople namespace contains all the classes for Libkpeople.
KPeople::PersonData::allEmails
QStringList allEmails() const
Returns all e-mail addresses from the person.
Definition: persondata.cpp:183
This file is part of the KDE documentation.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Fri Feb 13 2015 15:16:39 by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KPeople

Skip menu "KPeople"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List

Class Picker

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