source: src-qt4/PCDM/src/loginWidget.h @ ae41693

releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since ae41693 was ae41693, checked in by Ken Moore <ken@…>, 9 months ago

Couple new features for PCDM
1) Add option to require that the user type in the username instead of just selecting one from a list (does not recognize "root" or "toor", I made sure of that)
2) Move the backend system user detection to using "getent" after conversation with john @ ixsystems. That should properly pick up LDAP/ActiveDirectory users as well, whereas "pw" might not.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/* PCDM Login Manager:
2*  Written by Ken Moore (ken@pcbsd.org) 2012/2013
3*  Copyright(c) 2013 by the PC-BSD Project
4*  Available under the 3-clause BSD license
5*/
6
7/*
8 Sub-classed widget for a login entry box
9*/
10
11#ifndef LOGIN_WIDGET_H
12#define LOGIN_WIDGET_H
13
14#include <QWidget>
15#include <QFile>
16#include <QPushButton>
17#include <QToolButton>
18#include <QFormLayout>
19#include <QPixmap>
20#include <QDebug>
21#include <QLabel>
22#include <QComboBox>
23#include <QLineEdit>
24#include <QKeyEvent>
25#include <QAction>
26#include <QGroupBox>
27#include <QListWidget>
28#include <QAbstractItemView>
29
30class LoginWidget : public QGroupBox
31{
32        Q_OBJECT
33
34  public:
35        LoginWidget(QWidget* parent = 0);
36        ~LoginWidget();
37
38        //Get the currently selected items
39        QString currentUsername();
40        QString currentPassword();
41        QString currentDE();
42        void setCurrentUser(QString);
43        void setCurrentDE(QString);
44        void setUsernames(QStringList);
45        void setDesktops(QStringList, QStringList, QStringList);
46        void displayHostName(QString);
47        void changeButtonIcon(QString button, QString iconFile, QSize iconSize);
48        void setDesktopIconSize(QSize);
49        //Change the style sheet for all widget items (see QtStyle options for more)
50        void changeStyleSheet(QString item, QString style);
51       
52        void keyPressEvent(QKeyEvent *e);
53        void retranslateUi();
54        void resetFocus(QString item="");
55        void allowPasswordView(bool);
56        void allowUserSelection(bool);
57 
58  private:
59        QComboBox* listUsers;
60        QComboBox* listDE;
61        QListWidget* listUserBig;
62        QLineEdit *linePassword, *lineUsername;
63        QToolButton* pushLogin;
64        QToolButton* pushViewPassword;
65        QToolButton *pushUserIcon, *userIcon;
66        QLabel* deIcon;
67       
68
69        QStringList idL, desktopIcons, desktopInfo;
70        QSize desktopIconSize;
71        QString hostName;
72        bool userSelected, pwVisible, allowPWVisible, showUsers;
73
74        void updateWidget();
75
76  private slots:
77        void slotUserActivated();
78        //void slotUserClicked(QListWidgetItem*);
79        void slotUserHighlighted(int);
80        void slotUserSelected();
81        void slotUserUnselected();
82        void slotTryLogin();
83        void slotChooseUser(int);
84        void slotChangePWView();
85        void slotDesktopChanged(int);
86       
87  signals:
88        //Emits these signals whenever a login request is detected
89        void loginRequested(QString user, QString password);
90        void UserSelected(QString user);
91        void UserChanged(QString user);
92        void escapePressed();
93
94};
95#endif
Note: See TracBrowser for help on using the repository browser.