source: calamares/trunk/fuentes/src/modules/users/UsersPage.h @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 13 months ago

sync with github

File size: 2.9 KB
Line 
1/* === This file is part of Calamares - <https://github.com/calamares> ===
2 *
3 *   Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
4 *   Copyright 2017, Adriaan de Groot <groot@kde.org>
5 *
6 *   Portions from the Manjaro Installation Framework
7 *   by Roland Singer <roland@manjaro.org>
8 *   Copyright (C) 2007 Free Software Foundation, Inc.
9 *
10 *   Calamares is free software: you can redistribute it and/or modify
11 *   it under the terms of the GNU General Public License as published by
12 *   the Free Software Foundation, either version 3 of the License, or
13 *   (at your option) any later version.
14 *
15 *   Calamares is distributed in the hope that it will be useful,
16 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
17 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 *   GNU General Public License for more details.
19 *
20 *   You should have received a copy of the GNU General Public License
21 *   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24#ifndef USERSPAGE_H
25#define USERSPAGE_H
26
27#include "Typedefs.h"
28
29#include "CheckPWQuality.h"
30
31#include <QWidget>
32
33namespace Ui
34{
35class Page_UserSetup;
36}
37
38class UsersPage : public QWidget
39{
40    Q_OBJECT
41public:
42    explicit UsersPage( QWidget* parent = nullptr );
43    virtual ~UsersPage();
44
45    bool isReady();
46
47    QList< Calamares::job_ptr > createJobs( const QStringList& defaultGroupsList );
48
49    void onActivate();
50
51    void setWriteRootPassword( bool show );
52    void setAutologinDefault( bool checked );
53    void setReusePasswordDefault( bool checked );
54
55    /** @brief Process entries in the passwordRequirements config entry
56     *
57     * Called once for each item in the config entry, which should
58     * be a key-value pair. What makes sense as a value depends on
59     * the key. Supported keys are documented in users.conf.
60     */
61    void addPasswordCheck( const QString& key, const QVariant& value );
62
63protected slots:
64    void onFullNameTextEdited( const QString& );
65    void fillSuggestions();
66    void onUsernameTextEdited( const QString& );
67    void validateUsernameText( const QString& );
68    void onHostnameTextEdited( const QString& );
69    void validateHostnameText( const QString& );
70    void onPasswordTextChanged( const QString& );
71    void onRootPasswordTextChanged( const QString& );
72
73signals:
74    void checkReady( bool );
75
76private:
77    Ui::Page_UserSetup* ui;
78
79    PasswordCheckList m_passwordChecks;
80
81    const QRegExp USERNAME_RX = QRegExp( "^[a-z_][a-z0-9_-]*[$]?$" );
82    const QRegExp HOSTNAME_RX = QRegExp( "^[a-zA-Z0-9][-a-zA-Z0-9_]*$" );
83    const int USERNAME_MAX_LENGTH = 31;
84    const int HOSTNAME_MIN_LENGTH = 2;
85    const int HOSTNAME_MAX_LENGTH = 63;
86
87    bool m_readyFullName;
88    bool m_readyUsername;
89    bool m_customUsername;
90    bool m_readyHostname;
91    bool m_customHostname;
92    bool m_readyPassword;
93    bool m_readyRootPassword;
94
95    bool m_writeRootPassword;
96};
97
98#endif // USERSPAGE_H
Note: See TracBrowser for help on using the repository browser.