kaddressbook Library API Documentation

addhostdialog.cpp

00001 /* 00002 This file is part of KAddressBook. 00003 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 00019 As a special exception, permission is given to link this program 00020 with any edition of Qt, and distribute the resulting executable, 00021 without including the source code for Qt in the source distribution. 00022 */ 00023 00024 #include <qlabel.h> 00025 #include <qlayout.h> 00026 #include <qpushbutton.h> 00027 #include <qspinbox.h> 00028 #include <qtooltip.h> 00029 00030 #include <kaccelmanager.h> 00031 #include <kbuttonbox.h> 00032 #include <klineedit.h> 00033 #include <klocale.h> 00034 00035 #include "addhostdialog.h" 00036 00037 AddHostDialog::AddHostDialog( QWidget* parent, const char* name ) 00038 : KDialogBase( Plain, i18n( "Add Host" ), Ok | Cancel, Ok, parent, name, true, true ) 00039 { 00040 QWidget *page = plainPage(); 00041 00042 QGridLayout *layout = new QGridLayout( page, 3, 5, 0, spacingHint() ); 00043 00044 mHostEdit = new KLineEdit( page ); 00045 layout->addMultiCellWidget( mHostEdit, 0, 0, 1, 2 ); 00046 connect( mHostEdit, SIGNAL( textChanged( const QString& ) ), 00047 SLOT( slotHostEditChanged( const QString& ) ) ); 00048 00049 QLabel *label = new QLabel( i18n( "Host:" ), page ); 00050 label->setBuddy( mHostEdit ); 00051 layout->addWidget( label, 0, 0 ); 00052 00053 mPortSpinBox = new QSpinBox( page ); 00054 mPortSpinBox->setMaxValue( 65535 ); 00055 mPortSpinBox->setValue( 389 ); 00056 layout->addWidget( mPortSpinBox, 1, 1 ); 00057 00058 label = new QLabel( i18n( "Port:" ), page ); 00059 QToolTip::add( label, i18n( "The port number of the directory server if it is using a non-standard port (389 is the standard)" ) ); 00060 label->setBuddy( mPortSpinBox ); 00061 layout->addWidget( label, 1, 0 ); 00062 00063 mBaseEdit = new KLineEdit( page ); 00064 layout->addMultiCellWidget( mBaseEdit, 2, 2, 1, 2 ); 00065 00066 label = new QLabel( i18n( "Base DN:" ), page ); 00067 QToolTip::add( label, i18n( "The base DN used for searching" ) ); 00068 label->setBuddy( mBaseEdit ); 00069 layout->addWidget( label, 2, 0 ); 00070 00071 mBindEdit = new KLineEdit( page ); 00072 layout->addMultiCellWidget( mBindEdit, 3, 3, 1, 2 ); 00073 00074 label = new QLabel( i18n( "Bind DN:" ), page ); 00075 QToolTip::add( label, i18n( "The bind DN used for searching" ) ); 00076 label->setBuddy( mBindEdit ); 00077 layout->addWidget( label, 3, 0 ); 00078 00079 mPwdBindEdit = new KLineEdit( page ); 00080 mPwdBindEdit->setEchoMode( QLineEdit::Password ); 00081 layout->addMultiCellWidget( mPwdBindEdit, 4, 4, 1, 2 ); 00082 00083 label = new QLabel( i18n( "Password:" ), page ); 00084 QToolTip::add( label, i18n( "The password used for searching" ) ); 00085 label->setBuddy( mPwdBindEdit ); 00086 layout->addWidget( label, 4, 0 ); 00087 00088 resize( QSize( 380, 150 ).expandedTo( sizeHint() ) ); 00089 enableButtonOK( !mHostEdit->text().isEmpty()); 00090 mHostEdit->setFocus(); 00091 00092 KAcceleratorManager::manage( this ); 00093 } 00094 00095 AddHostDialog::~AddHostDialog() 00096 { 00097 } 00098 00099 void AddHostDialog::slotHostEditChanged( const QString &text ) 00100 { 00101 enableButtonOK( !text.isEmpty() ); 00102 } 00103 00104 void AddHostDialog::setHost( const QString &host ) 00105 { 00106 mHostEdit->setText( host ); 00107 } 00108 00109 void AddHostDialog::setPort( int port ) 00110 { 00111 mPortSpinBox->setValue( port ); 00112 } 00113 00114 void AddHostDialog::setBaseDN( const QString &baseDN ) 00115 { 00116 mBaseEdit->setText( baseDN ); 00117 } 00118 00119 void AddHostDialog::setBindDN( const QString &bindDN ) 00120 { 00121 mBindEdit->setText( bindDN ); 00122 } 00123 00124 void AddHostDialog::setPwdBindDN( const QString &pwdBindDN ) 00125 { 00126 mPwdBindEdit->setText( pwdBindDN ); 00127 } 00128 00129 QString AddHostDialog::host() const 00130 { 00131 return mHostEdit->text().stripWhiteSpace(); 00132 } 00133 00134 int AddHostDialog::port() const 00135 { 00136 return mPortSpinBox->value(); 00137 } 00138 00139 QString AddHostDialog::baseDN() const 00140 { 00141 return mBaseEdit->text().stripWhiteSpace(); 00142 } 00143 00144 QString AddHostDialog::bindDN() const 00145 { 00146 return mBindEdit->text().stripWhiteSpace(); 00147 } 00148 00149 QString AddHostDialog::pwdBindDN() const 00150 { 00151 return mPwdBindEdit->text().stripWhiteSpace(); 00152 } 00153 00154 #include "addhostdialog.moc"
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:58:07 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003