Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion misc/wayland-sessions/treeland-user.desktop.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Desktop Entry]
Name=Treeland
Name=Treeland User
Comment=This session is DDE single wayland
Exec=${CMAKE_INSTALL_FULL_BINDIR}/treeland-user-wrapper
TryExec=${CMAKE_INSTALL_FULL_BINDIR}/treeland
Expand Down
13 changes: 13 additions & 0 deletions src/greeter/greeterproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class GreeterProxyPrivate
bool canHibernate{ false };
bool canHybridSleep{ false };
bool isLocked{ false };
bool isLoggedIn{ false };
};

GreeterProxy::GreeterProxy(QObject *parent)
Expand All @@ -109,6 +110,11 @@ GreeterProxy::GreeterProxy(QObject *parent)
connect(d->socket, &QLocalSocket::readyRead, this, &GreeterProxy::readyRead);
connect(d->socket, &QLocalSocket::errorOccurred, this, &GreeterProxy::error);

connect(this, &GreeterProxy::loginSucceeded, this, [this]([[maybe_unused]] QString user) {
d->isLoggedIn = true;
Q_EMIT isLoggedInChanged();
});

d->ddmDisplayManager = new org::deepin::DisplayManager("org.deepin.DisplayManager",
"/org/deepin/DisplayManager",
QDBusConnection::systemBus());
Expand Down Expand Up @@ -157,6 +163,11 @@ bool GreeterProxy::isLocked() const
return d->isLocked;
}

bool GreeterProxy::isLoggedIn() const
{
return d->isLoggedIn;
}

bool GreeterProxy::canPowerOff() const
{
return d->canPowerOff;
Expand Down Expand Up @@ -287,6 +298,8 @@ static QString getSessionPathByUser(UserPtr userInfo);
void GreeterProxy::logout()
{
qCDebug(treelandGreeter) << "Logout.";
d->isLoggedIn = false;
Q_EMIT isLoggedInChanged();
auto user = userModel()->currentUser();
QThreadPool::globalInstance()->start([user]() {
const auto path = getSessionPathByUser(user);
Expand Down
3 changes: 3 additions & 0 deletions src/greeter/greeterproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class GreeterProxy : public QObject
Q_PROPERTY(SessionModel* sessionModel READ sessionModel WRITE setSessionModel NOTIFY sessionModelChanged)
Q_PROPERTY(UserModel* userModel READ userModel WRITE setUserModel NOTIFY userModelChanged)
Q_PROPERTY(bool isLocked READ isLocked NOTIFY isLockedChanged)
Q_PROPERTY(bool isLoggedIn READ isLoggedIn NOTIFY isLoggedInChanged)

public:
explicit GreeterProxy(QObject *parent = nullptr);
Expand All @@ -60,6 +61,7 @@ class GreeterProxy : public QObject
bool canHybridSleep() const;

bool isConnected() const;
bool isLoggedIn() const;

SessionModel *sessionModel() const;
void setSessionModel(SessionModel *model);
Expand Down Expand Up @@ -106,6 +108,7 @@ private Q_SLOTS:
void loginSucceeded(const QString &user);
void switchToGreeter();
void isLockedChanged();
void isLoggedInChanged();

private:
bool localValidation(const QString &user, const QString &password) const;
Expand Down
2 changes: 1 addition & 1 deletion src/greeter/sessionmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void SessionModel::populate(Session::Type type, const QStringList &dirPaths)
}
// add to sessions list
// TODO: only show support sessions(X-DDE-SINGLE-WAYLAND)
if (si->isSingleMode() && execAllowed) {
if (execAllowed) {
d->displayNames.append(si->displayName());
d->sessions.push_back(si);
} else {
Expand Down
28 changes: 28 additions & 0 deletions src/plugins/lockscreen/qml/ControlAction.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,34 @@ RowLayout {
property bool powerVisible: powerList.visible
required property Item rootItem
signal lock()

// TODO: Design the interface of session selection
D.Button {
id: sessionItem
Layout.alignment: Qt.AlignHCenter
visible: !GreeterModel.proxy.isLoggedIn

contentItem: D.IconLabel {
text: SessionModel.data(SessionModel.index(GreeterModel.currentSession, 0), SessionModel.NameRole)
color: "white"
}

SessionList {
id: sessionList
x: (sessionItem.width - sessionList.width) / 2 - 10
y: -sessionList.height - 10
}

background: RoundBlur {
radius: parent.width / 2
color: Qt.rgba(1.0, 1.0, 1.0, 0.3)
}

onClicked: {
sessionList.open()
}
}

function showUserList()
{
userItem.expand = true
Expand Down
16 changes: 14 additions & 2 deletions src/plugins/lockscreen/qml/SessionList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import Treeland
import LockScreen

Popup {
id: popup
modal: true
width: 220
height: 140
height: 280
background: RoundBlur {
radius: 12
}
Expand All @@ -29,8 +30,18 @@ Popup {
y: 10
clip: true
model: SessionModel

ScrollBar.vertical: ScrollBar {
id: verticalScrollBar
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
policy: ScrollBar.AlwaysOn
}

delegate: Item {
required property string name
required property int index
width: parent.width
height: 60
MouseArea {
Expand All @@ -45,7 +56,8 @@ Popup {
}
onClicked: (mouse) => {
mouse.accepted = false
updateCurrentSession(list.currentIndex)
updateCurrentSession(index)
popup.close()
}
}

Expand Down