~ubuntu-branches/ubuntu/vivid/kdepim/vivid

« back to all changes in this revision

Viewing changes to kmail/identityaddvcarddialog.cpp

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman, Jonathan Riddell, Rohan Garg, Scott Kitterman
  • Date: 2012-11-21 13:12:36 UTC
  • mfrom: (0.2.33)
  • Revision ID: package-import@ubuntu.com-20121121131236-32ijw9a2txrar80k
Tags: 4:4.9.80-0ubuntu1
[ Jonathan Riddell ]
* New upstream beta release

[ Rohan Garg ]
* Add nepomuk-core-dev to build-deps

[ Scott Kitterman ]
* Add new package, libpimcommon4
  - Add libpimcommon4.install
  - Add to debian/control, including kdepim-dbg and kdepim-dev depends
  - Add to kdepim-dev.install
* Remove usr/bin/backupmail and related files from kmail.install as they are
  not provided by upstream anymore
* Add usr/bin/pimsettingexporter and related files to kmail.install
* Add libnepomukwidgets-dev to build-depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (c) 2012 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 <QVBoxLayout>
 
23
#include <QRadioButton>
 
24
#include <QLabel>
 
25
#include <KComboBox>
 
26
#include <KLocale>
 
27
#include <QButtonGroup>
 
28
 
 
29
 
 
30
IdentityAddVcardDialog::IdentityAddVcardDialog(KPIMIdentities::IdentityManager *manager, QWidget *parent)
 
31
  :KDialog(parent)
 
32
{
 
33
  setCaption( i18n( "Create own vcard" ) );
 
34
  setButtons( Ok|Cancel );
 
35
  setDefaultButton( Ok );
 
36
  setModal( true );
 
37
  QWidget *mainWidget = new QWidget( this );
 
38
  QVBoxLayout *vlay = new QVBoxLayout( mainWidget );
 
39
  vlay->setSpacing( KDialog::spacingHint() );
 
40
  vlay->setMargin( KDialog::marginHint() );
 
41
  setMainWidget( mainWidget );
 
42
 
 
43
  mButtonGroup = new QButtonGroup( this );
 
44
 
 
45
  // row 1: radio button
 
46
  QRadioButton *radio = new QRadioButton( i18n("&With empty fields"), this );
 
47
  radio->setChecked( true );
 
48
  vlay->addWidget( radio );
 
49
  mButtonGroup->addButton( radio, (int)Empty );
 
50
 
 
51
  // row 2: radio button
 
52
  radio = new QRadioButton( i18n("&Duplicate existing vcard"), this );
 
53
  vlay->addWidget( radio );
 
54
  mButtonGroup->addButton( radio, (int)ExistingEntry );
 
55
 
 
56
  // row 3: combobox with existing identities and label
 
57
  QHBoxLayout* hlay = new QHBoxLayout(); // inherits spacing
 
58
  vlay->addLayout( hlay );
 
59
  mComboBox = new KComboBox( this );
 
60
  mComboBox->setEditable( false );
 
61
 
 
62
  mComboBox->addItems( manager->shadowIdentities() );
 
63
  mComboBox->setEnabled( false );
 
64
  QLabel *label = new QLabel( i18n("&Existing identities:"), this );
 
65
  label->setBuddy( mComboBox );
 
66
  label->setEnabled( false );
 
67
  hlay->addWidget( label );
 
68
  hlay->addWidget( mComboBox, 1 );
 
69
 
 
70
  vlay->addStretch( 1 ); // spacer
 
71
 
 
72
  // enable/disable combobox and label depending on the third radio
 
73
  // button's state:
 
74
  connect( radio, SIGNAL(toggled(bool)),
 
75
           label, SLOT(setEnabled(bool)) );
 
76
  connect( radio, SIGNAL(toggled(bool)),
 
77
           mComboBox, SLOT(setEnabled(bool)) );
 
78
 
 
79
}
 
80
 
 
81
IdentityAddVcardDialog::~IdentityAddVcardDialog()
 
82
{
 
83
}
 
84
 
 
85
IdentityAddVcardDialog::DuplicateMode IdentityAddVcardDialog::duplicateMode() const
 
86
{
 
87
  const int id = mButtonGroup->checkedId();
 
88
  return static_cast<DuplicateMode>( id );
 
89
}
 
90
 
 
91
QString IdentityAddVcardDialog::duplicateVcardFromIdentity() const
 
92
{
 
93
  return mComboBox->currentText();
 
94
}
 
95
 
 
96
#include "identityaddvcarddialog.moc"