mirror of
https://bitbucket.org/smil3y/kde-playground.git
synced 2025-02-23 10:22:50 +00:00
kgreeter: implement hide users and show manual login
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
38b7db4199
commit
12906c1bb1
2 changed files with 40 additions and 16 deletions
|
@ -133,6 +133,7 @@ KGreeter::KGreeter(QWidget *parent)
|
|||
}
|
||||
}
|
||||
}
|
||||
m_ui.useredit->setText(ldmdefaultuser);
|
||||
const QString ldmdefaultsession = QString::fromUtf8(lightdm_greeter_get_default_session_hint(m_ldmgreeter));
|
||||
if (!ldmdefaultsession.isEmpty()) {
|
||||
for (int i = 0; i < m_ui.sessionsbox->count(); i++) {
|
||||
|
@ -151,6 +152,7 @@ KGreeter::KGreeter(QWidget *parent)
|
|||
break;
|
||||
}
|
||||
}
|
||||
m_ui.useredit->setText(lastuser);
|
||||
const QString lastsession = kgreeterstate.value("state/lastsession").toString();
|
||||
for (int i = 0; i < m_ui.sessionsbox->count(); i++) {
|
||||
if (m_ui.sessionsbox->itemData(i).toString() == lastsession) {
|
||||
|
@ -176,7 +178,16 @@ KGreeter::KGreeter(QWidget *parent)
|
|||
|
||||
connect(m_ui.loginbutton, SIGNAL(pressed()), this, SLOT(slotLogin()));
|
||||
|
||||
m_ui.passedit->setFocus();
|
||||
if (lightdm_greeter_get_hide_users_hint(m_ldmgreeter)
|
||||
|| lightdm_greeter_get_show_manual_login_hint(m_ldmgreeter)) {
|
||||
m_ui.userlabel->setVisible(false);
|
||||
m_ui.usersbox->setVisible(false);
|
||||
m_ui.useredit->setFocus();
|
||||
} else {
|
||||
m_ui.userlabel2->setVisible(false);
|
||||
m_ui.useredit->setVisible(false);
|
||||
m_ui.passedit->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void KGreeter::paintEvent(QPaintEvent *event)
|
||||
|
@ -202,6 +213,9 @@ void KGreeter::paintEvent(QPaintEvent *event)
|
|||
|
||||
QByteArray KGreeter::getUser() const
|
||||
{
|
||||
if (m_ui.useredit->isVisible()) {
|
||||
return m_ui.useredit->text().toUtf8();
|
||||
}
|
||||
return m_ui.usersbox->currentText().toUtf8();
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -41,8 +41,8 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<item row="4" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -109,36 +109,46 @@
|
|||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="usersbox"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="userlabel">
|
||||
<property name="text">
|
||||
<string>User:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="passedit">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>User:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="sessionsbox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Session:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="sessionsbox"/>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="useredit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="userlabel2">
|
||||
<property name="text">
|
||||
<string>User:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
|
Loading…
Add table
Reference in a new issue