summaryrefslogtreecommitdiffstats
path: root/kio/kssl/ksslcertdlg.h
blob: 5bd7208327cefb7061d597a337c8c59126ff932a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/* This file is part of the KDE project
 *
 * Copyright (C) 2001-2003 George Staikos <staikos@kde.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef _KSSLCERTDLG_H
#define _KSSLCERTDLG_H

#include <tqstringlist.h>
#include <kdialog.h>

class QWidget;
class QCheckBox;
class QRadioButton;
class QListView;
class QPushButton;

/**
 * KDE X.509 Certificate Dialog
 *
 * This class is used to create and display a dialog which contains the user's
 * X.509 certificates and allows the user to present it during SSL sessions.
 *
 * @author George Staikos <staikos@kde.org>
 * @see KSSL
 * @short KDE X.509 Certificate Dialog
 */
class KIO_EXPORT KSSLCertDlg : public KDialog {
	Q_OBJECT
public:
	/**
	 *  Construct a KSSL certificate dialog
	 *
	 *  @param parent the parent widget
	 *  @param name the internal name of this instance
	 *  @param modal create a modal dialog if set to true
	 */
	KSSLCertDlg(TQWidget *parent=0L, const char *name=0L, bool modal=false);

	/**
	 *  Destroy this object and close the dialog
	 */
	virtual ~KSSLCertDlg();

	/**
	 *  Setup the dialog. Call this before you display the dialog.
	 *
	 *  @param certs the list of possible certificates
	 *  @param saveChecked save the checked item for the future
	 *  @param sendChecked send the checked item to the remote host
	 *  @deprecated
	 */
	void setup(TQStringList certs, bool saveChecked = false, bool sendChecked = true) KDE_DEPRECATED;

	/**
	 *  Setup the dialog. Call this before you display the dialog.
	 *
	 *  @param certs the list of possible certificates
	 *  @param saveChecked save the checked item for the future
	 *  @param sendChecked send the checked item to the remote host
	 */
	void setupDialog(const TQStringList& certs, bool saveChecked = false, bool sendChecked = true);

	/**
	 *  Obtain the name of the certificate the user wants to send
	 *
	 *  @return the name of the certificate
	 */
	TQString getChoice();

	/**
	 *  Determine if the user wants to send a certificate.
	 *
	 *  @return true if the user wants to send a certificate
	 */
	bool wantsToSend();

	/**
	 *  Determine if the user wants to save the choice for the future.
	 *
	 *  @return true if the user wants to save the choice.
	 */
	bool saveChoice();

	/**
	 *  Set the hostname that we are connecting to.
	 *
	 *  @param host the hostname
	 */
	void setHost(const TQString& host);

private slots:
	void slotSend();
	void slotDont();

private:
	class KSSLCertDlgPrivate;
	KSSLCertDlgPrivate *d;
	TQCheckBox *_save;
	TQRadioButton *_send, *_dont;
	TQListView *_certs;
	TQPushButton *_ok;
	TQString _host;
};


class KIO_EXPORT KSSLCertDlgRet {
public:
   bool ok;
   TQString choice;
   bool send;
   bool save;

protected:
   class KSSLCertDlgRetPrivate;
   KSSLCertDlgRetPrivate *d;
};

KIO_EXPORT TQDataStream& operator<<(TQDataStream& s, const KSSLCertDlgRet& r);
KIO_EXPORT TQDataStream& operator>>(TQDataStream& s, KSSLCertDlgRet& r);

#endif