34#include <tqstringlist.h>
41#include <tdestandarddirs.h>
42#include <ksimpleconfig.h>
45#include "knotehostdlg.h"
46#include "knotesglobalconfig.h"
49KNoteHostDlg::KNoteHostDlg( const TQString &caption, TQWidget *parent, const char *name )
50 : KDialogBase( parent, name, true, caption, Ok|Cancel, Ok, true )
52 TQVBox *page = makeVBoxMainWidget();
53 (void) new TQLabel( i18n( "Hostname or IP address:"), page );
55 m_hostCombo = new KHistoryCombo( true, page );
56 m_hostCombo->setMinimumWidth( fontMetrics().maxWidth() * 15 );
57 m_hostCombo->setDuplicatesEnabled( false );
60 m_hostCombo->setHistoryItems( KNotesGlobalConfig::knownHosts(), true );
61 m_hostCombo->setFocus();
63 connect( m_hostCombo->lineEdit(), TQ_SIGNAL( textChanged ( const TQString & ) ),
64 this, TQ_SLOT( slotTextChanged( const TQString & ) ) );
65 slotTextChanged( m_hostCombo->lineEdit()->text() );
68KNoteHostDlg::~KNoteHostDlg()
70 if ( result() == Accepted )
71 m_hostCombo->addToHistory( m_hostCombo->currentText().stripWhiteSpace() );
74 KNotesGlobalConfig::setKnownHosts( m_hostCombo->historyItems() );
76 KNotesGlobalConfig::writeConfig();
79void KNoteHostDlg::slotTextChanged( const TQString& text )
81 enableButtonOK( !text.isEmpty() );
84TQString KNoteHostDlg::host() const
86 return m_hostCombo->currentText();
90#include "knotehostdlg.moc"
|