21 #include "ksslcertdlg.h"
26 #include <tqradiobutton.h>
27 #include <tqcheckbox.h>
28 #include <tqlistview.h>
32 #include <tdeapplication.h>
33 #include <tdeglobal.h>
34 #include <tdelocale.h>
35 #include <tdeglobalsettings.h>
36 #include <kpushbutton.h>
37 #include <kstdguiitem.h>
38 #include <kseparator.h>
42 class KSSLCertDlg::KSSLCertDlgPrivate {
46 TQPushButton *p_pb_dontsend;
51 : KDialog(parent, name, modal), d(new KSSLCertDlgPrivate) {
53 TQBoxLayout * grid =
new TQVBoxLayout(
this, KDialog::marginHint(),
54 KDialog::spacingHint() );
56 d->p_message =
new TQLabel(TQString::null,
this);
57 grid->addWidget(d->p_message);
60 _certs =
new TQListView(
this);
61 _certs->addColumn(i18n(
"Certificate"));
62 _certs->setResizeMode(TQListView::LastColumn);
63 TQFontMetrics fm( TDEGlobalSettings::generalFont() );
64 _certs->setMinimumHeight(4*fm.height());
65 grid->addWidget(_certs);
67 _save =
new TQCheckBox(i18n(
"Save selection for this host."),
this);
68 grid->addWidget(_save);
70 grid->addWidget(
new KSeparator(KSeparator::HLine,
this));
72 TQBoxLayout * h =
new TQHBoxLayout( grid );
75 _ok =
new KPushButton(i18n(
"Send certificate"),
this);
77 connect(_ok, TQ_SIGNAL(clicked()), TQ_SLOT(slotSend()));
79 d->p_pb_dontsend =
new KPushButton(i18n(
"Do not send a certificate"),
this);
80 h->addWidget(d->p_pb_dontsend);
81 connect(d->p_pb_dontsend, TQ_SIGNAL(clicked()), TQ_SLOT(slotDont()));
83 #ifndef TQT_NO_WIDGET_TOPEXTRA
84 setCaption(i18n(
"TDE SSL Certificate Dialog"));
99 _save->setChecked(saveChecked);
100 d->p_send_flag = sendChecked;
103 _ok->setDefault(
true);
105 d->p_pb_dontsend->setDefault(
true);
107 for (TQStringList::ConstIterator i = certs.begin(); i != certs.end(); ++i) {
111 new TQListViewItem(_certs, *i);
114 _certs->setSelected(_certs->firstChild(),
true);
119 return _save->isChecked();
124 return d->p_send_flag;
129 TQListViewItem *selected = _certs->selectedItem();
130 if (selected && d->p_send_flag)
131 return selected->text(0);
133 return TQString::null;
139 d->p_message->setText(i18n(
"The server <b>%1</b> requests a certificate.<p>"
140 "Select a certificate to use from the list below:")
145 void KSSLCertDlg::slotSend() {
146 d->p_send_flag =
true;
151 void KSSLCertDlg::slotDont() {
152 d->p_send_flag =
false;
157 TQDataStream& operator<<(TQDataStream& s,
const KSSLCertDlgRet& r) {
158 s << TQ_INT8(r.ok?1:0) << r.choice << TQ_INT8(r.save?1:0) << TQ_INT8(r.send?1:0);
163 TQDataStream& operator>>(TQDataStream& s, KSSLCertDlgRet& r) {
165 s >> tmp; r.ok = (tmp == 1);
167 s >> tmp; r.save = (tmp == 1);
168 s >> tmp; r.send = (tmp == 1);
173 #include "ksslcertdlg.moc"
KDE X.509 Certificate Dialog.
bool saveChoice()
Determine if the user wants to save the choice for the future.
virtual ~KSSLCertDlg()
Destroy this object and close the dialog.
void setup(TQStringList certs, bool saveChecked=false, bool sendChecked=true) TDE_DEPRECATED
Setup the dialog.
void setHost(const TQString &host)
Set the hostname that we are connecting to.
TQString getChoice()
Obtain the name of the certificate the user wants to send.
bool wantsToSend()
Determine if the user wants to send a certificate.
void setupDialog(const TQStringList &certs, bool saveChecked=false, bool sendChecked=true)
Setup the dialog.
KSSLCertDlg(TQWidget *parent=0L, const char *name=0L, bool modal=false)
Construct a KSSL certificate dialog.