26 #include <kabc/secrecy.h>
27 #include <kcombobox.h>
30 #include "secrecywidget.h"
32 SecrecyWidget::SecrecyWidget( TQWidget *parent, const char *name )
33 : TQWidget( parent, name )
35 TQVBoxLayout *layout = new TQVBoxLayout( this, KDialog::marginHint(),
36 KDialog::spacingHint() );
37 mSecrecyCombo = new KComboBox( this );
38 layout->addWidget( mSecrecyCombo );
40 const KABC::Secrecy::TypeList list = KABC::Secrecy::typeList();
41 KABC::Secrecy::TypeList::ConstIterator it;
42 for ( it = list.begin(); it != list.end(); ++it )
43 mSecrecyCombo->insertItem( KABC::Secrecy::typeLabel( *it ), *it );
45 connect( mSecrecyCombo, TQT_SIGNAL( activated( const TQString& ) ),
46 TQT_SIGNAL( changed() ) );
49 SecrecyWidget::~SecrecyWidget()
53 void SecrecyWidget::setReadOnly( bool readOnly )
55 mSecrecyCombo->setEnabled( !readOnly );
58 void SecrecyWidget::setSecrecy( const KABC::Secrecy &secrecy )
60 if ( secrecy.type() != KABC::Secrecy::Invalid )
61 mSecrecyCombo->setCurrentItem( secrecy.type() );
64 KABC::Secrecy SecrecyWidget::secrecy() const
66 KABC::Secrecy secrecy;
67 secrecy.setType( mSecrecyCombo->currentItem() );
72 #include "secrecywidget.moc"
|