Skip to content
Open
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
399 changes: 155 additions & 244 deletions src/greeter/greeterproxy.cpp

Large diffs are not rendered by default.

43 changes: 22 additions & 21 deletions src/greeter/greeterproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

class QLocalSocket;

class DDMInterfaceV2;
class LockScreen;

class GreeterProxy
Expand Down Expand Up @@ -43,6 +44,8 @@ class GreeterProxy
explicit GreeterProxy(QObject *parent = nullptr);
~GreeterProxy();

void connectDDM(DDMInterfaceV2 *interface);

//////////////////////
// Property getters //
//////////////////////
Expand Down Expand Up @@ -93,7 +96,9 @@ class GreeterProxy

/**
* @brief Get the number of failed login attempts (password incorrect)
*
* The value is reset to 0 when unlocked successfully
*
* QML elements should listen to this property to detect failed login/unlock attempts
*
* @return Number of failed attempts
Expand All @@ -102,6 +107,7 @@ class GreeterProxy

/**
* @brief Get whether the shutdown view is shown
*
* QML elements should listen to this property to show/hide the shutdown view
*
* @return true if shutdown view is shown
Expand All @@ -110,6 +116,7 @@ class GreeterProxy

/**
* @brief Get whether to show animation on lock/unlock
*
* QML elements should listen to this property to enable/disable animation
*
* @return true if show animation
Expand All @@ -118,6 +125,7 @@ class GreeterProxy

/**
* @brief Get whether there is an active user session
*
* QML elements should listen to this property to show/hide session related UI
*
* @return true if has active session
Expand All @@ -130,6 +138,7 @@ class GreeterProxy

/**
* @brief Set whether to show the shutdown view
*
* QML elements should set this property to show/hide the shutdown view
*
* @param show true to show shutdown view, false to hide
Expand All @@ -140,14 +149,9 @@ class GreeterProxy
// Public methods //
////////////////////

/**
* @brief Check if the DDM socket is connected
* @return true if connected
*/
bool isConnected() const;

/**
* @brief Set the LockScreen instance
*
* This is necessary for the GreeterProxy to control the lock screen visibility
*
* @param lockScreen LockScreen instance
Expand Down Expand Up @@ -176,6 +180,7 @@ public Q_SLOTS:
void hybridSleep();

/** @brief Login given user with given password for given desktop session.
*
* This function will call DDM to perform the login.
*
* Listen to org.freedesktop.login1.Manager.SessionNew signal to
Expand All @@ -189,6 +194,7 @@ public Q_SLOTS:
void login(const QString &user, const QString &password, int sessionIndex);

/** @brief Lock the current active session.
*
* This function will call DDM to perform the lock.
*
* Listen to org.freedesktop.login1.Session.Lock signal to detect
Expand All @@ -197,6 +203,7 @@ public Q_SLOTS:
void lock();

/** @brief Unlock given user with given password.
*
* This function will call DDM to perform the unlock.
*
* Listen to org.freedesktop.login1.Session.Unlock signal to
Expand All @@ -209,6 +216,7 @@ public Q_SLOTS:
void unlock(const QString &user, const QString &password);

/** @brief Logout the current active session.
*
* This function will call DDM to perform the logout.
*
* Listen to org.freedesktop.login1.Manager.SessionRemoved signal to
Expand All @@ -218,14 +226,13 @@ public Q_SLOTS:

private Q_SLOTS:

///////////////////////
// DDM Communication //
///////////////////////
//////////////////////
// Signals from DDM //
//////////////////////

void connected();
void disconnected();
void readyRead();
void error();
void capabilities(uint32_t capabilities);
void userLoggedIn(const QString &username, const QString &session);
void authenticationFailed(uint32_t error);

//////////////////////////////
// Logind session listeners //
Expand All @@ -244,8 +251,6 @@ private Q_SLOTS:
void onSessionUnlock();

Q_SIGNALS:
void informationMessage(const QString &message);

void switchUser();

void socketDisconnected();
Expand Down Expand Up @@ -295,6 +300,7 @@ private Q_SLOTS:

/**
* @brief Set the lock state
*
* This is the internal method to set the lock state (lockscreen
* visibility, etc.) directly without calling DDM and
* communicating with systemd-logind.
Expand All @@ -303,16 +309,11 @@ private Q_SLOTS:
*/
void setLock(bool isLocked);

/**
* @brief Update the DDM communication socket
*/
void updateAuthSocket();

/////////////////////
// Property values //
/////////////////////

QLocalSocket *m_socket{ nullptr };
DDMInterfaceV2 *m_ddmInterface{ nullptr };
LockScreen *m_lockScreen{ nullptr };

QString m_hostName{};
Expand Down
2 changes: 1 addition & 1 deletion src/greeter/usermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class UserModel : public QAbstractListModel
void currentUserNameChanged();
void updateTranslations(const QLocale &locale);
void countChanged();
void userLoggedIn(const QString &username, int sessionId);
void userLoggedIn(const QString &username, const QString &session);

private Q_SLOTS:
void onUserAdded(quint64 uid);
Expand Down
8 changes: 4 additions & 4 deletions src/modules/ddm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
find_package(TreelandProtocols REQUIRED)

ws_generate_local(server ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-ddm-v1.xml treeland-ddm-v1-protocol)
ws_generate_local(server ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-ddm-v2.xml treeland-ddm-v2-protocol)

impl_treeland(
NAME
module_ddm
SOURCE
${CMAKE_SOURCE_DIR}/src/modules/ddm/ddminterfacev1.h
${CMAKE_SOURCE_DIR}/src/modules/ddm/ddminterfacev1.cpp
${WAYLAND_PROTOCOLS_OUTPUTDIR}/treeland-ddm-v1-protocol.c
${CMAKE_SOURCE_DIR}/src/modules/ddm/ddminterfacev2.h
${CMAKE_SOURCE_DIR}/src/modules/ddm/ddminterfacev2.cpp
${WAYLAND_PROTOCOLS_OUTPUTDIR}/treeland-ddm-v2-protocol.c
INCLUDE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
136 changes: 0 additions & 136 deletions src/modules/ddm/ddminterfacev1.cpp

This file was deleted.

23 changes: 0 additions & 23 deletions src/modules/ddm/ddminterfacev1.h

This file was deleted.

Loading
Loading