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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
//Auto-generated by kalyptus. DO NOT EDIT.
package org.trinitydesktop.koala;
import org.trinitydesktop.qt.TQt;
import org.trinitydesktop.qt.TQMetaObject;
import org.trinitydesktop.qt.QtSupport;
import org.trinitydesktop.qt.TQWidget;
/**
This dialog asks the user to enter a password. The functions you're
probably interested in are the static methods, getPassword() and
getNewPassword().
<li><b>Usage example</b></li>
<pre>
String password;
int result = KPasswordDialog.getPassword(password, i18n("Prompt message"));
if (result == KPasswordDialog.Accepted)
use(password);
</pre>
\image html kpassworddialog.png "KDE Password Dialog"
<li><b>Security notes:</b></li>
Keeping passwords in memory can be a potential security hole. You should
handle this situation with care.
<li>
You may want to use disableCoreDump() to disable core dumps.
Core dumps are dangerous because they are an image of the process memory,
and thus include any passwords that were in memory.
</li>
@author Geert Jansen <jansen@kde.org>
@short A password input dialog.
*/
public class KPasswordDialog extends KDialogBase {
protected KPasswordDialog(Class dummy){super((Class) null);}
/**
This enum distinguishes the two operation modes of this dialog:
@short This enum distinguishes the two operation modes of this dialog:
*/
public static final int Password = 0;
public static final int NewPassword = 1;
public native TQMetaObject metaObject();
public native String className();
/**
Constructs a password dialog.
@param type : if NewPassword is given here, the dialog contains two
input fields, so that the user must confirm his password
and possible typos are detected immediately.
@param enableKeep : if true, a check box is shown in the dialog
which allows the user to keep his password input for later.
@param extraBttn : allows to show additional buttons, KDialogBase.
@param parent Passed to lower level constructor.
@param name Passed to lower level constructor
@short Constructs a password dialog.
*/
public KPasswordDialog(int type, boolean enableKeep, int extraBttn, TQWidget parent, String name) {
super((Class) null);
newKPasswordDialog(type,enableKeep,extraBttn,parent,name);
}
private native void newKPasswordDialog(int type, boolean enableKeep, int extraBttn, TQWidget parent, String name);
public KPasswordDialog(int type, boolean enableKeep, int extraBttn, TQWidget parent) {
super((Class) null);
newKPasswordDialog(type,enableKeep,extraBttn,parent);
}
private native void newKPasswordDialog(int type, boolean enableKeep, int extraBttn, TQWidget parent);
public KPasswordDialog(int type, boolean enableKeep, int extraBttn) {
super((Class) null);
newKPasswordDialog(type,enableKeep,extraBttn);
}
private native void newKPasswordDialog(int type, boolean enableKeep, int extraBttn);
/**
Construct a password dialog. Essentially the same as above but allows the
icon in the password dialog to be set via <code>iconName.</code>
@param type if NewPassword is given here, the dialog contains two
input fields, so that the user must confirm his password
and possible typos are detected immediately
@param enableKeep : if true, a check box is shown in the dialog
which allows the user to keep his password input for later.
@param extraBttn : allows to show additional buttons.
@param iconName the name of the icon to be shown in the dialog. If empty,
a default icon is used
@param parent Passed to lower level constructor.
@param name Passed to lower level constructor
@short Construct a password dialog.
*/
public KPasswordDialog(int type, boolean enableKeep, int extraBttn, String iconName, TQWidget parent, String name) {
super((Class) null);
newKPasswordDialog(type,enableKeep,extraBttn,iconName,parent,name);
}
private native void newKPasswordDialog(int type, boolean enableKeep, int extraBttn, String iconName, TQWidget parent, String name);
public KPasswordDialog(int type, boolean enableKeep, int extraBttn, String iconName, TQWidget parent) {
super((Class) null);
newKPasswordDialog(type,enableKeep,extraBttn,iconName,parent);
}
private native void newKPasswordDialog(int type, boolean enableKeep, int extraBttn, String iconName, TQWidget parent);
public KPasswordDialog(int type, boolean enableKeep, int extraBttn, String iconName) {
super((Class) null);
newKPasswordDialog(type,enableKeep,extraBttn,iconName);
}
private native void newKPasswordDialog(int type, boolean enableKeep, int extraBttn, String iconName);
/**
Sets the password prompt.
@short Sets the password prompt.
*/
public native void setPrompt(String prompt);
/**
Returns the password prompt.
@short Returns the password prompt.
*/
public native String prompt();
/**
Adds a line of information to the dialog.
@short Adds a line of information to the dialog.
*/
public native void addLine(String key, String value);
/**
Allow empty passwords? - Default: false
@short Allow empty passwords? - Default: false
*/
public native void setAllowEmptyPasswords(boolean allowed);
/**
Allow empty passwords?
@short Allow empty passwords?
*/
public native boolean allowEmptyPasswords();
/**
Minimum acceptable password length.
Default: If empty passwords are forbidden, 1;
Otherwise, 0.
@param minLength : The new minimum password length
@short Minimum acceptable password length.
*/
public native void setMinimumPasswordLength(int minLength);
/**
Minimum acceptable password length.
@short Minimum acceptable password length.
*/
public native int minimumPasswordLength();
/**
Maximum acceptable password length. Limited to 199.
Default: No limit, i.e. -1
@param maxLength : The new maximum password length.
@short Maximum acceptable password length.
*/
public native void setMaximumPasswordLength(int maxLength);
/**
Maximum acceptable password length.
@short Maximum acceptable password length.
*/
public native int maximumPasswordLength();
/**
Password length that is expected to be reasonably safe.
Default: 8 - the standard UNIX password length
@param reasonableLength : The new reasonable password length.
@short Password length that is expected to be reasonably safe.
*/
public native void setReasonablePasswordLength(int reasonableLength);
/**
Password length that is expected to be reasonably safe.
@short Password length that is expected to be reasonably safe.
*/
public native int reasonablePasswordLength();
/**
Set the password strength level below which a warning is given
Value is in the range 0 to 99. Empty passwords score 0;
non-empty passwords score up to 100, depending on their length and whether they
contain numbers, mixed case letters and punctuation.
Default: 1 - warn if the password has no discernable strength whatsoever
@param warningLevel : The level below which a warning should be given.
@short Set the password strength level below which a warning is given Value is in the range 0 to 99.
*/
public native void setPasswordStrengthWarningLevel(int warningLevel);
/**
Password strength level below which a warning is given
@short Password strength level below which a warning is given
*/
public native int passwordStrengthWarningLevel();
/**
Returns the password entered. The memory is freed in the destructor,
so you should make a copy.
@short Returns the password entered.
*/
public native String password();
/**
Clears the password input field. You might want to use this after the
user failed to enter the correct password.
@short Clears the password input field.
*/
public native void clearPassword();
/**
Returns true if the user wants to keep the password.
@short Returns true if the user wants to keep the password.
*/
public native boolean keep();
/**
Pops up the dialog, asks the user for a password, and returns it.
@param password The password is returned in this reference parameter.
@param prompt A prompt for the password. This can be a few lines of
information. The text is word broken to fit nicely in the dialog.
@param keep Enable/disable a checkbox controlling password keeping.
If you pass a null pointer, or a pointer to the value 0, the checkbox
is not shown. If you pass a pointer to a nonzero value, the checkbox
is shown and the result is stored in keep.
@return Result code: Accepted or Rejected.
@short Pops up the dialog, asks the user for a password, and returns it.
*/
public static native int getPassword(StringBuffer password, String prompt, int[] keep);
public static native int getPassword(StringBuffer password, String prompt);
/**
Pops up the dialog, asks the user for a password and returns it. The
user has to enter the password twice to make sure it was entered
correctly.
@param password The password is returned in this reference parameter.
@param prompt A prompt for the password. This can be a few lines of
information. The text is word broken to fit nicely in the dialog.
@return Result code: Accepted or Rejected.
@short Pops up the dialog, asks the user for a password and returns it.
*/
public static native int getNewPassword(StringBuffer password, String prompt);
/**
Static helper function that disables core dumps.
@short Static helper function that disables core dumps.
*/
public static native void disableCoreDumps();
/**
Virtual function that can be overridden to provide password
checking in derived classes. It should return <code>true</code> if the
password is valid, <code>false</code> otherwise.
@short Virtual function that can be overridden to provide password checking in derived classes.
*/
protected native boolean checkPassword(String arg1);
protected native void slotOk();
protected native void slotCancel();
protected native void slotKeep(boolean arg1);
/** Deletes the wrapped C++ instance */
protected native void finalize() throws InternalError;
/** Delete the wrapped C++ instance ahead of finalize() */
public native void dispose();
/** Has the wrapped C++ instance been deleted? */
public native boolean isDisposed();
}
|