• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kmail

  • sources
  • kde-4.12
  • kdepim
  • kmail
  • identity
identityaddvcarddialog.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2012, 2013 Montel Laurent <montel@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #include "identityaddvcarddialog.h"
19 
20 #include <kpimidentities/identitymanager.h>
21 
22 #include <KComboBox>
23 #include <KLocale>
24 #include <KSeparator>
25 
26 #include <QButtonGroup>
27 #include <QVBoxLayout>
28 #include <QRadioButton>
29 #include <QLabel>
30 
31 
32 IdentityAddVcardDialog::IdentityAddVcardDialog(KPIMIdentities::IdentityManager *manager, QWidget *parent)
33  :KDialog(parent)
34 {
35  setCaption( i18n( "Create own vCard" ) );
36  setButtons( Ok|Cancel );
37  setDefaultButton( Ok );
38  setModal( true );
39  QWidget *mainWidget = new QWidget( this );
40  QVBoxLayout *vlay = new QVBoxLayout( mainWidget );
41  vlay->setSpacing( KDialog::spacingHint() );
42  vlay->setMargin( KDialog::marginHint() );
43  setMainWidget( mainWidget );
44 
45  mButtonGroup = new QButtonGroup( this );
46 
47  // row 1: radio button
48  QRadioButton *radio = new QRadioButton( i18n("&With empty fields"), this );
49  radio->setChecked( true );
50  vlay->addWidget( radio );
51  mButtonGroup->addButton( radio, (int)Empty );
52 
53  // row 2: radio button
54  radio = new QRadioButton( i18n("&Duplicate existing vCard"), this );
55  vlay->addWidget( radio );
56  mButtonGroup->addButton( radio, (int)ExistingEntry );
57 
58  // row 3: combobox with existing identities and label
59  QHBoxLayout* hlay = new QHBoxLayout(); // inherits spacing
60  vlay->addLayout( hlay );
61  mComboBox = new KComboBox( this );
62  mComboBox->setEditable( false );
63 
64  mComboBox->addItems( manager->shadowIdentities() );
65  mComboBox->setEnabled( false );
66  QLabel *label = new QLabel( i18n("&Existing identities:"), this );
67  label->setBuddy( mComboBox );
68  label->setEnabled( false );
69  hlay->addWidget( label );
70  hlay->addWidget( mComboBox, 1 );
71 
72  vlay->addWidget(new KSeparator);
73  vlay->addStretch( 1 ); // spacer
74 
75  // enable/disable combobox and label depending on the third radio
76  // button's state:
77  connect( radio, SIGNAL(toggled(bool)),
78  label, SLOT(setEnabled(bool)) );
79  connect( radio, SIGNAL(toggled(bool)),
80  mComboBox, SLOT(setEnabled(bool)) );
81  resize(350, 130);
82 }
83 
84 IdentityAddVcardDialog::~IdentityAddVcardDialog()
85 {
86 }
87 
88 IdentityAddVcardDialog::DuplicateMode IdentityAddVcardDialog::duplicateMode() const
89 {
90  const int id = mButtonGroup->checkedId();
91  return static_cast<DuplicateMode>( id );
92 }
93 
94 QString IdentityAddVcardDialog::duplicateVcardFromIdentity() const
95 {
96  return mComboBox->currentText();
97 }
98 
99 #include "identityaddvcarddialog.moc"
identityaddvcarddialog.h
IdentityAddVcardDialog::~IdentityAddVcardDialog
~IdentityAddVcardDialog()
Definition: identityaddvcarddialog.cpp:84
IdentityAddVcardDialog::IdentityAddVcardDialog
IdentityAddVcardDialog(KPIMIdentities::IdentityManager *manager, QWidget *parent=0)
Definition: identityaddvcarddialog.cpp:32
QWidget
IdentityAddVcardDialog::DuplicateMode
DuplicateMode
Definition: identityaddvcarddialog.h:32
KDialog
IdentityAddVcardDialog::duplicateVcardFromIdentity
QString duplicateVcardFromIdentity() const
Definition: identityaddvcarddialog.cpp:94
IdentityAddVcardDialog::duplicateMode
DuplicateMode duplicateMode() const
Definition: identityaddvcarddialog.cpp:88
IdentityAddVcardDialog::Empty
Definition: identityaddvcarddialog.h:33
QLabel
KComboBox
IdentityAddVcardDialog::ExistingEntry
Definition: identityaddvcarddialog.h:34
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kmail

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

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



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