summaryrefslogblamecommitdiff
path: root/ui/qt5/useraccountwidget.hh
blob: 71a23b7ad75962a21f03b77b07734e5ccacb28f2 (plain) (tree)
























































                                                                               
/*
 * useraccountwidget.cc - Implementation of a widget for managing user accounts
 * horizon-qt5, the Qt 5 user interface for
 * Project Horizon
 *
 * Copyright (c) 2019 Adélie Linux and contributors.  All rights reserved.
 * This code is licensed under the AGPL 3.0 license, as noted in the
 * LICENSE-code file in the root directory of this repository.
 *
 * SPDX-License-Identifier: AGPL-3.0-only
 */

#ifndef USERACCOUNTWIDGET_HH
#define USERACCOUNTWIDGET_HH

#include <QCheckBox>
#include <QLineEdit>
#include <QPushButton>
#include <QWidget>

class UserAccountWidget : public QWidget {
    Q_OBJECT
public:
    /*! Constructs a new User Account widget. */
    UserAccountWidget(QWidget *parent = nullptr);

    /*! Returns the current text in the Account Name text entry. */
    QString accountText(void) const;
    /*! Sets the current text in the Account Name text entry. */
    void setAccountText(QString);
    /*! Returns the current text in the passphrase entry. */
    QString passphraseText(void) const;
    /*! Returns the current text in the Personal Name text entry. */
    QString personalText(void) const;
    /*! Sets the current text in the Personal Name text entry. */
    void setPersonalText(QString);

    /*! Returns whether the Admin tickbox is ticked or not. */
    bool isAdmin(void) const;
    /*! Changes whether the Admin tickbox is ticked or not. */
    void setAdmin(bool);

    /*! Returns whether the widget defines a valid account. */
    bool isValid(void) const;
signals:
    void validityChanged();
private:
    QLineEdit *accountName;
    QLineEdit *personalName;
    QLineEdit *passphrase;
    QPushButton *aviButton;
    QCheckBox *adminTick;
    /*! When set, auto-update of accountName from personalName is prevented. */
    bool acctEverTouched;
};

#endif  /* !USERACCOUNTWIDGET_HH */