• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/kssl
 

tdeio/kssl

  • tdeio
  • kssl
ksslcertdlg.cpp
1/* This file is part of the KDE project
2 *
3 * Copyright (C) 2001-2003 George Staikos <staikos@kde.org>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#include "ksslcertdlg.h"
22
23#include <kssl.h>
24
25#include <tqlayout.h>
26#include <tqradiobutton.h>
27#include <tqcheckbox.h>
28#include <tqlistview.h>
29#include <tqframe.h>
30#include <tqlabel.h>
31
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>
39#include <kdebug.h>
40
41
42class KSSLCertDlg::KSSLCertDlgPrivate {
43private:
44 friend class KSSLCertDlg;
45 TQLabel *p_message;
46 TQPushButton *p_pb_dontsend;
47 bool p_send_flag;
48};
49
50KSSLCertDlg::KSSLCertDlg(TQWidget *parent, const char *name, bool modal)
51 : KDialog(parent, name, modal), d(new KSSLCertDlgPrivate) {
52
53 TQBoxLayout * grid = new TQVBoxLayout( this, KDialog::marginHint(),
54 KDialog::spacingHint() );
55
56 d->p_message = new TQLabel(TQString::null, this);
57 grid->addWidget(d->p_message);
58 setHost(_host);
59
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);
66
67 _save = new TQCheckBox(i18n("Save selection for this host."), this);
68 grid->addWidget(_save);
69
70 grid->addWidget(new KSeparator(KSeparator::HLine, this));
71
72 TQBoxLayout * h = new TQHBoxLayout( grid );
73 h->insertStretch(0);
74
75 _ok = new KPushButton(i18n("Send certificate"), this);
76 h->addWidget(_ok);
77 connect(_ok, TQ_SIGNAL(clicked()), TQ_SLOT(slotSend()));
78
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()));
82
83#ifndef TQT_NO_WIDGET_TOPEXTRA
84 setCaption(i18n("TDE SSL Certificate Dialog"));
85#endif
86}
87
88
89KSSLCertDlg::~KSSLCertDlg() {
90 delete d;
91}
92
93
94void KSSLCertDlg::setup(TQStringList certs, bool saveChecked, bool sendChecked) {
95 setupDialog(certs, saveChecked, sendChecked);
96}
97
98void KSSLCertDlg::setupDialog(const TQStringList& certs, bool saveChecked, bool sendChecked) {
99 _save->setChecked(saveChecked);
100 d->p_send_flag = sendChecked;
101
102 if (sendChecked)
103 _ok->setDefault(true); // "do send" is the "default action".
104 else
105 d->p_pb_dontsend->setDefault(true); // "do not send" is the "default action".
106
107 for (TQStringList::ConstIterator i = certs.begin(); i != certs.end(); ++i) {
108 if ((*i).isEmpty())
109 continue;
110
111 new TQListViewItem(_certs, *i);
112 }
113
114 _certs->setSelected(_certs->firstChild(), true);
115}
116
117
118bool KSSLCertDlg::saveChoice() {
119 return _save->isChecked();
120}
121
122
123bool KSSLCertDlg::wantsToSend() {
124 return d->p_send_flag;
125}
126
127
128TQString KSSLCertDlg::getChoice() {
129 TQListViewItem *selected = _certs->selectedItem();
130 if (selected && d->p_send_flag)
131 return selected->text(0);
132 else
133 return TQString::null;
134}
135
136
137void KSSLCertDlg::setHost(const TQString& host) {
138 _host = host;
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:")
141 .arg(_host));
142}
143
144
145void KSSLCertDlg::slotSend() {
146 d->p_send_flag = true;
147 accept();
148}
149
150
151void KSSLCertDlg::slotDont() {
152 d->p_send_flag = false;
153 reject();
154}
155
156
157TQDataStream& 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);
159 return s;
160}
161
162
163TQDataStream& operator>>(TQDataStream& s, KSSLCertDlgRet& r) {
164TQ_INT8 tmp;
165 s >> tmp; r.ok = (tmp == 1);
166 s >> r.choice;
167 s >> tmp; r.save = (tmp == 1);
168 s >> tmp; r.send = (tmp == 1);
169 return s;
170}
171
172
173#include "ksslcertdlg.moc"
174
KSSLCertDlg
KDE X.509 Certificate Dialog.
Definition: ksslcertdlg.h:43
KSSLCertDlg::saveChoice
bool saveChoice()
Determine if the user wants to save the choice for the future.
Definition: ksslcertdlg.cpp:118
KSSLCertDlg::~KSSLCertDlg
virtual ~KSSLCertDlg()
Destroy this object and close the dialog.
Definition: ksslcertdlg.cpp:89
KSSLCertDlg::setup
void setup(TQStringList certs, bool saveChecked=false, bool sendChecked=true) TDE_DEPRECATED
Setup the dialog.
Definition: ksslcertdlg.cpp:94
KSSLCertDlg::setHost
void setHost(const TQString &host)
Set the hostname that we are connecting to.
Definition: ksslcertdlg.cpp:137
KSSLCertDlg::getChoice
TQString getChoice()
Obtain the name of the certificate the user wants to send.
Definition: ksslcertdlg.cpp:128
KSSLCertDlg::wantsToSend
bool wantsToSend()
Determine if the user wants to send a certificate.
Definition: ksslcertdlg.cpp:123
KSSLCertDlg::setupDialog
void setupDialog(const TQStringList &certs, bool saveChecked=false, bool sendChecked=true)
Setup the dialog.
Definition: ksslcertdlg.cpp:98
KSSLCertDlg::KSSLCertDlg
KSSLCertDlg(TQWidget *parent=0L, const char *name=0L, bool modal=false)
Construct a KSSL certificate dialog.
Definition: ksslcertdlg.cpp:50

tdeio/kssl

Skip menu "tdeio/kssl"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/kssl

Skip menu "tdeio/kssl"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/kssl by doxygen 1.9.4
This website is maintained by Timothy Pearson.