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

akonadi

  • akonadi
  • contact
contactviewerdialog.cpp
1 /*
2  This file is part of Akonadi Contact.
3 
4  Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
5 
6  This library is free software; you can redistribute it and/or modify it
7  under the terms of the GNU Library General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or (at your
9  option) any later version.
10 
11  This library is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14  License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to the
18  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  02110-1301, USA.
20 */
21 
22 #include "contactviewerdialog.h"
23 #include "contactviewer.h"
24 #include "contactdefaultactions.h"
25 
26 #include <akonadi/item.h>
27 using namespace Akonadi;
28 
29 #include <KConfig>
30 #include <KLocalizedString>
31 
32 #include <QVBoxLayout>
33 
34 class ContactViewerDialog::Private
35 {
36  public:
37  Private( ContactViewerDialog *parent )
38  : q( parent )
39  {
40  }
41 
42  void readConfig()
43  {
44  KConfig config( QLatin1String( "akonadi_contactrc" ) );
45  KConfigGroup group( &config, QLatin1String( "ContactViewer" ) );
46  const QSize size = group.readEntry( "Size", QSize() );
47  if ( size.isValid() ) {
48  q->resize( size );
49  } else {
50  q->resize( 500, 600 );
51  }
52  }
53 
54  void writeConfig()
55  {
56  KConfig config( QLatin1String( "akonadi_contactrc" ) );
57  KConfigGroup group( &config, QLatin1String( "ContactViewer" ) );
58  group.writeEntry( "Size", q->size() );
59  group.sync();
60  }
61 
62  ContactViewerDialog *q;
63  ContactViewer *mViewer;
64 };
65 
66 ContactViewerDialog::ContactViewerDialog( QWidget *parent )
67  : KDialog( parent ), d( new Private( this ) )
68 {
69  setCaption( i18n( "Show Contact" ) );
70  setButtons( Ok );
71 
72  QWidget *mainWidget = new QWidget( this );
73  setMainWidget( mainWidget );
74 
75  QVBoxLayout *layout = new QVBoxLayout( mainWidget );
76 
77  d->mViewer = new ContactViewer;
78  layout->addWidget( d->mViewer );
79 
80  ContactDefaultActions *actions = new ContactDefaultActions( this );
81  actions->connectToView( d->mViewer );
82 
83  d->readConfig();
84 }
85 
86 ContactViewerDialog::~ContactViewerDialog()
87 {
88  d->writeConfig();
89  delete d;
90 }
91 
92 Akonadi::Item ContactViewerDialog::contact() const
93 {
94  return d->mViewer->contact();
95 }
96 
97 ContactViewer* ContactViewerDialog::viewer() const
98 {
99  return d->mViewer;
100 }
101 
102 void ContactViewerDialog::setContact( const Akonadi::Item &contact )
103 {
104  d->mViewer->setContact( contact );
105 }
106 
Akonadi::ContactViewerDialog::contact
Akonadi::Item contact() const
Returns the contact that is currently displayed.
Definition: contactviewerdialog.cpp:92
Akonadi::ContactViewerDialog::~ContactViewerDialog
~ContactViewerDialog()
Destroys the contact viewer dialog.
Definition: contactviewerdialog.cpp:86
Akonadi::ContactViewerDialog::ContactViewerDialog
ContactViewerDialog(QWidget *parent=0)
Creates a new contact viewer dialog.
Definition: contactviewerdialog.cpp:66
Akonadi::ContactViewerDialog::viewer
ContactViewer * viewer() const
Returns the ContactViewer that is used by this dialog.
Definition: contactviewerdialog.cpp:97
Akonadi::ContactDefaultActions::connectToView
void connectToView(QObject *view)
Tries to connect the well known signals of the view to the well known slots of this object...
Definition: contactdefaultactions.cpp:47
Akonadi::ContactDefaultActions
A convenience class that handles different contact related actions.
Definition: contactdefaultactions.h:86
Akonadi::ContactViewer
A viewer component for contacts in Akonadi.
Definition: contactviewer.h:76
Akonadi::ContactViewerDialog::setContact
void setContact(const Akonadi::Item &contact)
Sets the contact that shall be displayed in the dialog.
Definition: contactviewerdialog.cpp:102
Akonadi::ContactViewerDialog
A dialog for displaying a contact in Akonadi.
Definition: contactviewerdialog.h:65
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Nov 26 2013 09:03:16 by doxygen 1.8.5 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-4.11.3 API Reference

Skip menu "kdepimlibs-4.11.3 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