kmail Library API Documentation

directoryservicesconfigurationdialogimpl.cpp

00001 #include <config.h>
00002 #include "directoryservicesconfigurationdialogimpl.h"
00003 #include "adddirectoryservicedialogimpl.h"
00004 #include "cryptplugwrapper.h"
00005 
00006 #include <qlistview.h>
00007 #include <qpushbutton.h>
00008 #include <klineedit.h>
00009 #include <qbuttongroup.h>
00010 
00011 /*
00012  *  Constructs a DirectoryServicesConfigurationDialogImpl which is a child of 'parent', with the
00013  *  name 'name' and widget flags set to 'f'
00014  */
00015 DirectoryServicesConfigurationDialogImpl::DirectoryServicesConfigurationDialogImpl( QWidget* parent,  const char* name, WFlags fl )
00016     : DirectoryServicesConfigurationDialog( parent, name, fl )
00017 {
00018     x500LV->setSorting( -1 );
00019 }
00020 
00021 
00022 /*
00023  *  Destroys the object and frees any allocated resources
00024  */
00025 DirectoryServicesConfigurationDialogImpl::~DirectoryServicesConfigurationDialogImpl()
00026 {
00027     // no need to delete child widgets, Qt does it all for us
00028 }
00029 
00030 
00035 void DirectoryServicesConfigurationDialogImpl::enableDisable( CryptPlugWrapper* cryptPlug )
00036 {
00037     // disable the whole page if the plugin does not support the use
00038     // of directory services
00039     setEnabled( cryptPlug->hasFeature( Feature_CertificateDirectoryService ) ||
00040                 cryptPlug->hasFeature( Feature_CRLDirectoryService ) );
00041 
00042     localRemoteCertBG->setEnabled( cryptPlug->hasFeature( Feature_CertificateDirectoryService ) );
00043     localRemoteCRLBG->setEnabled( cryptPlug->hasFeature( Feature_CRLDirectoryService ) );
00044 }
00045 
00046 
00047 /*
00048  * protected slot
00049  */
00050 void DirectoryServicesConfigurationDialogImpl::slotServiceChanged( QListViewItem* item )
00051 {
00052     if( item )
00053         removeServicePB->setEnabled( true );
00054     else
00055         removeServicePB->setEnabled( false );
00056 }
00057 
00058 
00059 /*
00060  * protected slot
00061  */
00062 void DirectoryServicesConfigurationDialogImpl::slotServiceSelected( QListViewItem* item )
00063 {
00064     AddDirectoryServiceDialogImpl* dlg = new AddDirectoryServiceDialogImpl( this );
00065     dlg->serverNameED->setText( item->text( 0 ) );
00066     dlg->portED->setText( item->text( 1 ) );
00067     dlg->descriptionED->setText( item->text( 2 ) );
00068     if( dlg->exec() == QDialog::Accepted ) {
00069         item->setText( 0, dlg->serverNameED->text() );
00070         item->setText( 1, dlg->portED->text() );
00071         item->setText( 2, dlg->descriptionED->text() );
00072     }
00073     delete dlg;
00074 }
00075 
00076 
00077 /*
00078  * protected slot
00079  */
00080 void DirectoryServicesConfigurationDialogImpl::slotAddService()
00081 {
00082     AddDirectoryServiceDialogImpl* dlg = new AddDirectoryServiceDialogImpl( this );
00083     if( dlg->exec() == QDialog::Accepted ) {
00084         (void)new QListViewItem( x500LV, x500LV->lastItem(),
00085                                  dlg->serverNameED->text(),
00086                                  dlg->portED->text(),
00087                                  dlg->descriptionED->text() );
00088     }
00089 }
00090 
00091 /*
00092  * protected slot
00093  */
00094 void DirectoryServicesConfigurationDialogImpl::slotDeleteService()
00095 {
00096     QListViewItem* item = x500LV->selectedItem();
00097     Q_ASSERT( item );
00098     if( !item )
00099         return;
00100     else
00101         delete item;
00102     x500LV->triggerUpdate();
00103     slotServiceChanged( x500LV->selectedItem() );
00104 }
00105 
00106 
00107 #include "directoryservicesconfigurationdialogimpl.moc"
KDE Logo
This file is part of the documentation for kmail Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:37:18 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003