-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathlowres_greeter.cpp
123 lines (97 loc) · 2.74 KB
/
lowres_greeter.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/**
* ogon - Free Remote Desktop Services
* Qt Greeter - Lo-Res Greeter Window
*
* Copyright (c) 2013-2018 Thincast Technologies GmbH
*
* Authors:
* David Fort <contact@hardening-consulting.com>
* Martin Haimberger <martin.haimberger@thincast.com>
*
* This file may be used under the terms of the GNU Affero General
* Public License version 3 as published by the Free Software Foundation
* and appearing in the file LICENSE-AGPL included in the distribution
* of this file.
*
* Under the GNU Affero General Public License version 3 section 7 the
* copyright holders grant the additional permissions set forth in the
* ogon Core AGPL Exceptions version 1 as published by
* Thincast Technologies GmbH.
*
* For more information see the file LICENSE in the distribution of this file.
*/
#include <qpa/qplatformnativeinterface.h>
#include <qogon/qogon.h>
#include <QKeyEvent>
#include "lowres_greeter.h"
#include "abstract_greeter.h"
LowResGreeterWindow::LowResGreeterWindow(AbstractGreeter *controller, const QString &user,
const QString &domain) :
mGreeter(controller)
{
setupUi(this);
QString userContent;
if(domain.size())
userContent += domain + '\\';
if(user.size()) {
userContent += user;
passwordEntry->setFocus();
} else
loginEntry->setFocus();
loginEntry->setText(userContent);
statusLabel->setVisible(false);
}
LowResGreeterWindow::~LowResGreeterWindow() {
}
void LowResGreeterWindow::setupEffects() {
}
void LowResGreeterWindow::setStatus(const QString &toSet, bool visible) {
statusLabel->setVisible(visible);
statusLabel->setText(toSet);
}
QLineEdit *LowResGreeterWindow::getPasswordWidget() {
return passwordEntry;
}
void LowResGreeterWindow::setCurrentLanguage(const QString & lang) {
Q_UNUSED(lang);
}
void LowResGreeterWindow::show() {
showFullScreen();
}
void LowResGreeterWindow::hide() {
QWidget::hide();
}
void LowResGreeterWindow::close() {
QWidget::close();
}
void LowResGreeterWindow::onConnectionEstablished() {
}
void LowResGreeterWindow::onConnectionLost() {
}
void LowResGreeterWindow::onLoginSuccessful() {
}
void LowResGreeterWindow::onLoginFailed() {
this->passwordEntry->clear();
this->passwordEntry->setFocus();
}
void LowResGreeterWindow::changeEvent(QEvent *e) {
if(e->type() == QEvent::LanguageChange) {
//qDebug("language change");
retranslateUi(this);
} else {
QMainWindow::changeEvent(e);
}
}
void LowResGreeterWindow::keyPressEvent(QKeyEvent* event) {
if (event->key() == Qt::Key_Escape) {
mGreeter->cancelPressed();
return;
}
QWidget::keyPressEvent(event);
}
void LowResGreeterWindow::on_loginButton_clicked() {
mGreeter->loginPressed(loginEntry->text(), passwordEntry->text());
}
void LowResGreeterWindow::on_cancelButton_clicked() {
mGreeter->cancelPressed();
}