/usr/include/KF5/KWidgetsAddons/knewpassworddialog.h is in libkf5widgetsaddons-dev 5.18.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | // vi: ts=8 sts=4 sw=4
/* This file is part of the KDE libraries
Copyright (C) 1998 Pietro Iglio <iglio@fub.it>
Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
Copyright (C) 2004,2005 Andrew Coles <andrew_coles@yahoo.co.uk>
Copyright (C) 2006,2007 Olivier Goffart <ogoffart @ 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 version 2 as published by the Free Software Foundation.
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 KNEWPASSWORDDIALOG_H
#define KNEWPASSWORDDIALOG_H
#include <QDialog>
#include <kwidgetsaddons_export.h>
class QWidget;
/**
* @short A password input dialog.
*
* This dialog asks the user to enter a new password.
*
* The password has to be entered twice to check if the passwords
* match. A hint about the strength of the entered password is also
* shown.
*
* \section usage Usage Example
* \subsection asynchronous Asynchronous
*
* \code
* KNewPasswordDialog *dlg = new KNewPasswordDialog( parent );
* dlg->setPrompt( i18n( "Enter a password" ) );
* connect( dlg, SIGNAL( newPassword(QString) ) , this, SLOT( setPassword(QString) ) );
* connect( dlg, SIGNAL( rejected() ) , this, SLOT( slotCancel() ) );
* dlg->show();
* \endcode
*
* \subsection synchronous Synchronous
*
* \code
* KNewPasswordDialog dlg( parent );
* dlg.setPrompt( i18n( "Enter a password" ) );
* if( dlg.exec() )
* setPassword( dlg.password() );
* \endcode
*
* \image html knewpassworddialog.png "KDE New Password Dialog"
*
* @author Geert Jansen <jansen@kde.org>
* @author Olivier Goffart <ogoffart@kde.org>
*/
class KWIDGETSADDONS_EXPORT KNewPasswordDialog
: public QDialog
{
Q_OBJECT
public:
/**
* Constructs a password dialog.
*
* @param parent Passed to lower level constructor.
*/
explicit KNewPasswordDialog(QWidget *parent = 0);
/**
* Destructs the password dialog.
*/
virtual ~KNewPasswordDialog();
/**
* Sets the password prompt.
*/
void setPrompt(const QString &prompt);
/**
* Returns the password prompt.
*/
QString prompt() const;
/**
* Sets the pixmap that appears next to the prompt in the dialog. The default pixmap represent a simple key.
*
* the recommended size is KIconLoader::SizeHuge
*/
void setPixmap(const QPixmap &);
/**
* Returns the pixmap that appears next to the prompt in the dialog
*/
QPixmap pixmap() const;
/**
* Allow empty passwords? - Default: true
*
* same as setMinimumPasswordLength( allowed ? 0 : 1 )
*/
void setAllowEmptyPasswords(bool allowed);
/**
* Allow empty passwords?
*
* @return true if minimumPasswordLength() == 0
*/
bool allowEmptyPasswords() const;
/**
* Minimum acceptable password length.
*
* Default: 0
*
* @param minLength The new minimum password length
*/
void setMinimumPasswordLength(int minLength);
/**
* Minimum acceptable password length.
*/
int minimumPasswordLength() const;
/**
* Maximum acceptable password length.
*
* @param maxLength The new maximum password length.
*/
void setMaximumPasswordLength(int maxLength);
/**
* Maximum acceptable password length.
*/
int maximumPasswordLength() const;
/**
* Password length that is expected to be reasonably safe.
*
* Used to compute the strength level
*
* Default: 8 - the standard UNIX password length
*
* @param reasonableLength The new reasonable password length.
*/
void setReasonablePasswordLength(int reasonableLength);
/**
* Password length that is expected to be reasonably safe.
*/
int reasonablePasswordLength() const;
/**
* 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.
*/
void setPasswordStrengthWarningLevel(int warningLevel);
/**
* Password strength level below which a warning is given
*/
int passwordStrengthWarningLevel() const;
/**
* When the verification password does not match, the background color
* of the verification field is set to @p color. As soon as the passwords match,
* the original color of the verification field is restored.
*
* Default: the background color from the current theme.
* @since 5.17
*/
void setBackgroundWarningColor(const QColor &color);
/**
* The color used as warning for the verification password field's background.
*/
QColor backgroundWarningColor() const;
/**
* Returns the password entered.
* @note Only has meaningful data after accept has been called
* if you want to access the password from a subclass use
* checkAndGetPassword()
*/
QString password() const;
/**
* @internal
*/
void accept() Q_DECL_OVERRIDE;
protected:
/**
* Virtual function that can be overridden to provide password
* checking in derived classes. It should return @p true if the
* password is valid, @p false otherwise.
*/
virtual bool checkPassword(const QString &);
/**
* Checks input password.
* If the password is right, returns true
* and fills pwd with the password.
* Otherwise returns false and pwd will be null.
* @since 4.2
*/
bool checkAndGetPassword(QString *pwd);
Q_SIGNALS:
/**
* The dialog has been accepted, and the new password is @p password
*/
void newPassword(const QString &password);
private:
class KNewPasswordDialogPrivate;
KNewPasswordDialogPrivate *const d;
Q_PRIVATE_SLOT(d, void _k_passwordStatusChanged())
};
#endif // KNEWPASSWORDDIALOG_H
|