akonadi
22 #include "secrecyeditwidget.h"
24 #include <QVBoxLayout>
26 #include <kabc/addressee.h>
27 #include <kabc/secrecy.h>
28 #include <kcombobox.h>
30 SecrecyEditWidget::SecrecyEditWidget( QWidget *parent )
33 QVBoxLayout *layout =
new QVBoxLayout(
this );
34 layout->setMargin( 0 );
36 mSecrecyCombo =
new KComboBox(
this );
37 layout->addWidget( mSecrecyCombo );
39 const KABC::Secrecy::TypeList list = KABC::Secrecy::typeList();
40 KABC::Secrecy::TypeList::ConstIterator it;
43 KABC::Secrecy::TypeList::ConstIterator end(list.constEnd());
44 for ( it = list.constBegin(); it != end; ++it ) {
45 mSecrecyCombo->insertItem( *it, KABC::Secrecy::typeLabel( *it ) );
49 SecrecyEditWidget::~SecrecyEditWidget()
53 void SecrecyEditWidget::setReadOnly(
bool readOnly )
55 mSecrecyCombo->setEnabled( !readOnly );
58 void SecrecyEditWidget::loadContact(
const KABC::Addressee &contact )
60 if ( contact.secrecy().type() != KABC::Secrecy::Invalid ) {
61 mSecrecyCombo->setCurrentIndex( contact.secrecy().type() );
65 void SecrecyEditWidget::storeContact( KABC::Addressee &contact )
const
67 KABC::Secrecy secrecy;
68 secrecy.setType( (KABC::Secrecy::Type)mSecrecyCombo->currentIndex() );
70 contact.setSecrecy( secrecy );
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:27 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.