KWidgetsAddons

knewpasswordwidget.h
1 // vi: ts=8 sts=4 sw=4
2 /* This file is part of the KDE libraries
3  Copyright (C) 1998 Pietro Iglio <[email protected]>
4  Copyright (C) 1999,2000 Geert Jansen <[email protected]>
5  Copyright (C) 2004,2005 Andrew Coles <[email protected]>
6  Copyright (C) 2006,2007 Olivier Goffart <ogoffart @ kde.org>
7  Copyright (C) 2015 Elvis Angelaccio <[email protected]>
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Library General Public
11  License version 2 as published by the Free Software Foundation.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 */
23 #ifndef KNEWPASSWORDWIDGET_H
24 #define KNEWPASSWORDWIDGET_H
25 
26 #include <QWidget>
27 
28 #include <kwidgetsaddons_export.h>
29 
73 class KWIDGETSADDONS_EXPORT KNewPasswordWidget : public QWidget
74 {
75  Q_OBJECT
76  Q_PROPERTY(PasswordStatus passwordStatus READ passwordStatus)
77  Q_PROPERTY(bool allowEmptyPasswords READ allowEmptyPasswords WRITE setAllowEmptyPasswords)
78  Q_PROPERTY(int minimumPasswordLength READ minimumPasswordLength WRITE setMinimumPasswordLength)
79  Q_PROPERTY(int maximumPasswordLength READ maximumPasswordLength WRITE setMaximumPasswordLength)
80  Q_PROPERTY(int reasonablePasswordLength READ reasonablePasswordLength WRITE setReasonablePasswordLength)
81  Q_PROPERTY(int passwordStrengthWarningLevel READ passwordStrengthWarningLevel WRITE setPasswordStrengthWarningLevel)
82  Q_PROPERTY(QColor backgroundWarningColor READ backgroundWarningColor WRITE setBackgroundWarningColor)
83  Q_PROPERTY(bool passwordStrengthMeterVisible READ isPasswordStrengthMeterVisible WRITE setPasswordStrengthMeterVisible)
87  Q_PROPERTY(bool revealPasswordAvailable READ isRevealPasswordAvailable WRITE setRevealPasswordAvailable)
88 
89 
90 public:
91 
96  {
102  };
104 
105 
110  explicit KNewPasswordWidget(QWidget *parent = nullptr);
111 
115  virtual ~KNewPasswordWidget();
116 
120  PasswordStatus passwordStatus() const;
121 
127  bool allowEmptyPasswords() const;
128 
132  int minimumPasswordLength() const;
133 
137  int maximumPasswordLength() const;
138 
142  int reasonablePasswordLength() const;
143 
147  int passwordStrengthWarningLevel() const;
148 
152  QColor backgroundWarningColor() const;
153 
157  bool isPasswordStrengthMeterVisible() const;
158 
163  bool isRevealPasswordAvailable() const;
164 
170  QString password() const;
171 
172 public Q_SLOTS:
173 
179  void setAllowEmptyPasswords(bool allowed);
180 
188  void setMinimumPasswordLength(int minLength);
189 
195  void setMaximumPasswordLength(int maxLength);
196 
207  void setReasonablePasswordLength(int reasonableLength);
208 
218  void setPasswordStrengthWarningLevel(int warningLevel);
219 
225  void setBackgroundWarningColor(const QColor &color);
226 
231  void setPasswordStrengthMeterVisible(bool visible);
232 
242  void setRevealPasswordAvailable(bool reveal);
243 
244 Q_SIGNALS:
245 
249  void passwordStatusChanged();
250 
251 private:
252  class KNewPasswordWidgetPrivate;
253  KNewPasswordWidgetPrivate *const d;
254 
255  Q_PRIVATE_SLOT(d, void _k_passwordChanged())
256  Q_PRIVATE_SLOT(d, void _k_toggleEchoMode())
257  Q_DISABLE_COPY(KNewPasswordWidget)
258 };
259 
260 #endif // KNEWPASSWORDWIDGET_H
261 
Q_ENUM(...)
A password input widget.
Password and verification password don&#39;t match.
Passwords match and the strength level is good.
Both passwords fields empty, but minimum length > 0.
Q_PROPERTY(...)
Passwords match but the strength level is not enough.
PasswordStatus
Status of the password being typed in the widget.
Password length is too low.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 30 2020 22:51:40 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.