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

akonadi/contact

  • 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>
27using namespace Akonadi;
28
29#include <KConfig>
30#include <KLocalizedString>
31
32#include <QVBoxLayout>
33
34class ContactViewerDialog::Private
35{
36 public:
37 Private( ContactViewerDialog *parent )
38 : q( parent ), mViewer( 0 )
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(500, 600) );
47 if ( size.isValid() ) {
48 q->resize( size );
49 }
50 }
51
52 void writeConfig()
53 {
54 KConfig config( QLatin1String( "akonadi_contactrc" ) );
55 KConfigGroup group( &config, QLatin1String( "ContactViewer" ) );
56 group.writeEntry( "Size", q->size() );
57 group.sync();
58 }
59
60 ContactViewerDialog *q;
61 ContactViewer *mViewer;
62};
63
64ContactViewerDialog::ContactViewerDialog( QWidget *parent )
65 : KDialog( parent ), d( new Private( this ) )
66{
67 setCaption( i18n( "Show Contact" ) );
68 setButtons( Ok );
69
70 QWidget *mainWidget = new QWidget( this );
71 setMainWidget( mainWidget );
72
73 QVBoxLayout *layout = new QVBoxLayout( mainWidget );
74
75 d->mViewer = new ContactViewer;
76 layout->addWidget( d->mViewer );
77
78 ContactDefaultActions *actions = new ContactDefaultActions( this );
79 actions->connectToView( d->mViewer );
80
81 d->readConfig();
82}
83
84ContactViewerDialog::~ContactViewerDialog()
85{
86 d->writeConfig();
87 delete d;
88}
89
90Akonadi::Item ContactViewerDialog::contact() const
91{
92 return d->mViewer->contact();
93}
94
95ContactViewer* ContactViewerDialog::viewer() const
96{
97 return d->mViewer;
98}
99
100void ContactViewerDialog::setContact( const Akonadi::Item &contact )
101{
102 d->mViewer->setContact( contact );
103}
104
Akonadi::ContactDefaultActions
A convenience class that handles different contact related actions.
Definition: contactdefaultactions.h:87
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::ContactViewerDialog
A dialog for displaying a contact in Akonadi.
Definition: contactviewerdialog.h:66
Akonadi::ContactViewerDialog::contact
Akonadi::Item contact() const
Returns the contact that is currently displayed.
Definition: contactviewerdialog.cpp:90
Akonadi::ContactViewerDialog::viewer
ContactViewer * viewer() const
Returns the ContactViewer that is used by this dialog.
Definition: contactviewerdialog.cpp:95
Akonadi::ContactViewerDialog::~ContactViewerDialog
~ContactViewerDialog()
Destroys the contact viewer dialog.
Definition: contactviewerdialog.cpp:84
Akonadi::ContactViewerDialog::ContactViewerDialog
ContactViewerDialog(QWidget *parent=0)
Creates a new contact viewer dialog.
Definition: contactviewerdialog.cpp:64
Akonadi::ContactViewerDialog::setContact
void setContact(const Akonadi::Item &contact)
Sets the contact that shall be displayed in the dialog.
Definition: contactviewerdialog.cpp:100
Akonadi::ContactViewer
A viewer component for contacts in Akonadi.
Definition: contactviewer.h:77
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi/contact

Skip menu "akonadi/contact"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

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