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

KPeople

  • frameworks
  • kpeople
  • src
  • widgets
personemailview.cpp
1 /*
2  Copyright 2014 Nilesh Suthar <nileshsuthar@live.in>
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 "personemailview.h"
20 
21 #include "abstractfieldwidgetfactory.h"
22 #include "plugins/emaildetailswidget.h"
23 #include "plugins/emails.h"
24 #include "global.h"
25 
26 #include <QVBoxLayout>
27 #include <QFormLayout>
28 
29 namespace KPeople
30 {
31 
32 class PersonEmailsViewPrivate
33 {
34 public:
35  PersonData *person;
36  QWidget *mainWidget;
37  Emails *emails;
38 };
39 
40 using namespace KPeople;
41 
42 PersonEmailsView::PersonEmailsView(QWidget *parent)
43  : QWidget(parent),
44  d_ptr(new PersonEmailsViewPrivate())
45 {
46  Q_D(PersonEmailsView);
47  setLayout(new QVBoxLayout(this));
48  d->mainWidget = new QWidget(this);
49  d->person = 0;
50  d->emails = new Emails();
51 
52 }
53 
54 PersonEmailsView::~PersonEmailsView()
55 {
56  delete d_ptr;
57 }
58 
59 void PersonEmailsView::setPerson(PersonData *person)
60 {
61  Q_D(PersonEmailsView);
62  if (d->person) {
63  disconnect(d->person, SIGNAL(dataChanged()), this, SLOT(reload()));
64  }
65 
66  d->person = person;
67  connect(d->person, SIGNAL(dataChanged()), this, SLOT(reload()));
68  reload();
69 }
70 
71 void PersonEmailsView::reload()
72 {
73  Q_D(PersonEmailsView);
74 
75  d->mainWidget->deleteLater();
76  d->mainWidget = d->emails->createDetailsWidget(d->person->person(), d->person->contacts(), this);
77  layout()->addWidget(d->mainWidget);
78 }
79 }
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.
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