DtkSystemSettings  1.0.3
dtk library for systemsettings.
Dtk::Login::DLoginManager类 参考

登陆管理类 更多...

#include <dloginmanager.h>

类 Dtk::Login::DLoginManager 继承关系图:
Dtk::Login::DLoginManager 的协作图:

Public 槽

DExpected< void > activateSession (const QString &sessionId)
 将具有指定 ID 的会话带到前台
 
DExpected< void > activateSessionOnSeat (const QString &sessionId, const QString &seatId)
 将指定ID, 指定seat的会话带到前台
 
DExpected< LoginExecStatus > canHalt ()
 获取当前用户下计算机是否支持停止 更多...
 
DExpected< LoginExecStatus > canHibernate ()
 获取当前用户下计算机是否支持休眠 更多...
 
DExpected< LoginExecStatus > canHybridSleep ()
 获取当前用户下计算机是否支持混合睡眠 更多...
 
DExpected< LoginExecStatus > canPowerOff ()
 获取当前用户下计算机是否支持关机 更多...
 
DExpected< LoginExecStatus > canReboot ()
 获取当前用户下计算机是否支持重启 更多...
 
DExpected< LoginExecStatus > canSuspend ()
 获取当前用户下计算机是否支持挂起 更多...
 
DExpected< LoginExecStatus > canSuspendThenHibernate ()
 获取当前用户下计算机是否支持挂起然后休眠 更多...
 
DExpected< bool > cancelScheduledShutdown ()
 取消一个预定的关机 更多...
 
DExpected< LoginSeatPtr > findSeatById (const QString &seatId)
 获取seat对象 更多...
 
DExpected< LoginSessionPtr > findSessionById (const QString &sessionId)
 获取session对象 更多...
 
DExpected< LoginSessionPtr > findSessionByPID (quint32 PID)
 通过进程号pid获取session对象 更多...
 
DExpected< LoginUserPtr > findUserById (quint32 UID)
 通过uid获取User对象 更多...
 
DExpected< LoginUserPtr > findUserByPID (quint32 PID)
 通过进程id获取User信息 更多...
 
DExpected< void > halt (bool interactive=false)
 计算机暂停操作, 暂停(不关闭电源关闭) 更多...
 
DExpected< void > hibernate (bool interactive=false)
 计算机执行休眠操作, 休眠(将内存中数据保存到磁盘并将机器关闭) 更多...
 
DExpected< void > hybridSleep (bool interactive=false)
 计算机执行混合睡眠, 混合睡眠模式, 即系统既休眠又挂起 更多...
 
DExpected< int > inhibit (int what, const QString &who, const QString &why, LoginInhibitMode mode)
 创建一个抑制锁, 抑制锁:一个程序可以阻止或延迟系统休眠或关机 更多...
 
DExpected< void > killSession (const QString &sessionId, LoginSessionRole who, qint32 signalNumber)
 可用于向会话的一个或所有进程发送 Unix 信号, 作为参数, 它接受会话 id、字符串“ leader”或“ all”和一个信号编号。 如果“ leader”通过, 则只有会话“ leader”被终止。如果“ all”通过, 则会话的所有进程都将被终止。 更多...
 
DExpected< void > killUser (quint32 UID, qint32 signalNumber)
 可用于向用户的所有进程发送 Unix 信号。作为参数, 它需要用户 ID 和信号编号 更多...
 
DExpected< LoginInhibitorList > listInhibitors ()
 列出所有当前有效的抑制器。 更多...
 
DExpected< QStringList > listSeats ()
 列出所有的seat 更多...
 
DExpected< QStringList > listSessions ()
 列出所有的Session 更多...
 
DExpected< QList< quint32 > > listUsers ()
 列出所有的User 更多...
 
DExpected< void > lockSession (const QString &sessionId)
 要求具有指定 ID 的会话激活屏幕锁定 更多...
 
DExpected< void > powerOff (bool interactive=false)
 关机 更多...
 
DExpected< void > reboot (bool interactive=false)
 重启 更多...
 
DExpected< void > scheduleShutdown (LoginShutdownType type, const QDateTime &usec)
 在一定时间后定时关机 更多...
 
DExpected< void > setUserLinger (quint32 UID, bool enable, bool interactive)
 启用或禁用用户滞留。如果启用, 将保留用户的运行时目录, 并且他们可以在注销时继续运行进程。如果禁用, 运行时目录会在他们注销后立即消失 更多...
 
DExpected< void > suspend (bool interactive=false)
 计算机执行挂起操作(系统状态保存到 RAM 并关闭 CPU) 更多...
 
DExpected< void > suspendThenHibernate (bool interactive=false)
 计算机系统被暂停, 随后使用RTC定时器唤醒并休眠 更多...
 
DExpected< void > terminateSession (const QString &sessionId)
 可用于强制终止一个特定会话 更多...
 
DExpected< void > terminateUser (quint32 uid)
 可用于强制终止用户的所有进程 更多...
 
DExpected< void > logout ()
 登出 更多...
 
DExpected< LoginSeatPtr > currentSeat ()
 当前的seat 更多...
 
DExpected< LoginSessionPtr > currentSession ()
 当前的session 更多...
 
DExpected< LoginUserPtr > currentUser ()
 当前的user 更多...
 

信号

void prepareForShutdown (bool value)
 PrepareForShutdown()和PrepareForSleep()信号在系统关闭之前(使用参数“ true” )或之后(使用参数“ false”)发送, 分别用于重新启动/关机和挂起/休眠。应用程序可以使用它来将数据保存在磁盘上、释放内存或执行其他应在关机/睡眠前不久完成的工作, 以及延迟抑制器。完成这项工作后, 他们应该释放他们的抑制锁, 以免进一步延迟操作。 更多...
 
void prepareForSleep (bool value)
 
void seatNew (const QString &seatId)
 每次创建或删除会话、用户登录或注销或添加或删除seat时都会发送UserRemovedSeatNewSessionNewSeatRemovedSessionRemovedUserNew信号 。它们每个都包含对象的 ID 和对象路径。
 
void seatRemoved (const QString &seatId)
 
void sessionNew (const QString &sessionId)
 
void sessionRemoved (const QString &sessionId)
 
void userNew (quint32 UID)
 
void userRemoved (quint32 UID)
 

Public 成员函数

 DLoginManager (QObject *parent=nullptr)
 构造获取login manager
 
QStringList killExcludeUsers () const
 读取 KillExcludeUsers 属性。 该属性将获取采用空格分割的用户列表, 在设置了 KillUserProcesses=yes 将会排除该用户会话范围内的进程。如果未设置 KillExcludeUsers=yes, 则默认排除“root”用户。 更多...
 
QStringList killOnlyUsers () const
 读取killOnlyUsers属性 检查KillOnlyUsers的取值。如果指定了这个设置, 只有这些用户的会话作用域中的进程将被杀死。否则, 用户将受到KillUserProcesses=yes设置的限制。 更多...
 
bool docked () const
 如果机器被连接到一个底座或者拓展坞(包含usbhub)上, Docked取值为true 更多...
 
bool idleHint () const
 反映系统的空闲提示状态。如果系统空闲则为True 更多...
 
bool killUserProcesses () const
 查看killUserProcesses当前配置, 当用户注销时是否应该杀死该用户的进程。 如果返回为true, 则该会话对应的作用域单元和该作用域内的所有进程将被终止。如果返回为 "false", 则该作用域被 "抛弃" 更多...
 
bool lidClosed () const
 当(笔记本电脑)的盖子关闭时, LidClosed为true。 更多...
 
bool preparingForShutdown () const
 在两个PrepareForShutdown和PrepareForSleep信号的间隔期间分别为真 更多...
 
bool preparingForSleep () const
 在两个PrepareForShutdown和PrepareForSleep信号的间隔期间分别为真 更多...
 
bool removeIPC () const
 返回一个属性设置, 当用户完全注销时, 属于用户的System V和POSIX IPC对象是否应被删除。 返回一个布尔参数。如果为true, 在用户的最后一个会话结束后, 用户不得消耗IPC资源。 这包括System V的信号、共享内存和消息队列, 以及POSIX共享内存和消息队列。 请注意, 根用户和其他系统用户的IPC对象不受此设置的影响。默认值为 "true"。 更多...
 
QString blockInhibited () const
 读取各个模式的当前活动锁: 更多...
 
QString delayInhibited () const
 读取各个模式的当前活动锁 更多...
 
PowerAction handleHibernateKey () const
 读取休眠按键的定义(默认是休眠) 更多...
 
PowerAction handleLidSwitch () const
 读取笔记本合上盖子的行为 (默认是暂停) 更多...
 
PowerAction handleLidSwitchDocked () const
 读取笔记本连上底座或者拓展坞后合上盖子的行为 (默认是忽略) 更多...
 
PowerAction handleLidSwitchExternalPower () const
 读取笔记本连上底座或者拓展坞且链接电源后合上盖子的行为 (默认为空(完全忽略)) 更多...
 
PowerAction handlePowerKey () const
 读取电源按键的定义 (默认是关机) 更多...
 
PowerAction handleSuspendKey () const
 读取暂停按键的定义 (默认是暂停) 更多...
 
PowerAction idleAction () const
 读取系统空闲时采取的行动 (默认是忽略) 更多...
 
ScheduledShutdownValue scheduledShutdown () const
 读取scheduledShutdown的值, 返回两个参数, 第一个电源管理状态名, 第二个是unix时间戳(精确到微秒), 可以使用scheduleShutdown方法进行写入。 具体含义见同名方法 更多...
 
quint32 nAutoVTs () const
 读取默认配置分配多少个虚拟终端(VT), 默认为6 更多...
 
quint64 holdoffTimeoutUSec () const
 读取系统启动或恢复后, systemd暂不对lid事件做出反应的时间段 更多...
 
quint64 idleActionUSec () const
 配置系统空闲时采取的行动的动作延迟 更多...
 
QDateTime idleSinceHint () const
 空闲提示布尔值的最后一次更改的时间 更多...
 
quint64 idleSinceHintMonotonic () const
 空闲提示布尔值的最后一次更改的时间戳 更多...
 
quint64 inhibitDelayMaxUSec () const
 读取由于"delay"类型的抑制器锁处于活动状态而延迟系统关闭或睡眠请求的最大时间,默认为5s 5000000us 更多...
 
quint64 inhibitorsMax () const
 读取允许的最大并发抑制器数量, 默认8192 更多...
 
quint64 nCurrentInhibitors () const
 读取当前注册抑制器数量 更多...
 
quint64 nCurrentSessions () const
 读取当前注册的会话数量 更多...
 
quint64 runtimeDirectoryInodesMax () const
 设置每个登录用户的$XDG_RUNTIME_DIR运行时目录的大小限制。 更多...
 
quint64 runtimeDirectorySize () const
 读取每个登录用户的$XDG_RUNTIME_DIR运行时目录的大小限制。 更多...
 
quint64 sessionsMax () const
 读取要管理的并发用户会话的最大数量 更多...
 
quint64 userStopDelayUSec () const
 读取在用户完全注销后为其保留用户记录和每个用户服务user.service的时间 更多...
 

属性

QStringList killExcludeUsers
 
QStringList killOnlyUsers
 
bool docked
 
bool idleHint
 
bool killUserProcesses
 
bool lidClosed
 
bool preparingForShutdown
 
bool preparingForSleep
 
bool removeIPC
 
QString blockInhibited
 
QString delayInhibited
 
PowerAction handleHibernateKey
 
PowerAction handleLidSwitch
 
PowerAction handleLidSwitchDocked
 
PowerAction handleLidSwitchExternalPower
 
PowerAction handlePowerKey
 
PowerAction handleSuspendKey
 
PowerAction idleAction
 
ScheduledShutdownValue scheduledShutdown
 
quint32 nAutoVTs
 
quint64 holdoffTimeoutUSec
 
quint64 idleActionUSec
 
QDateTime idleSinceHint
 
quint64 idleSinceHintMonotonic
 
quint64 inhibitDelayMaxUSec
 
quint64 inhibitorsMax
 
quint64 nCurrentInhibitors
 
quint64 nCurrentSessions
 
quint64 runtimeDirectoryInodesMax
 
quint64 runtimeDirectorySize
 
quint64 sessionsMax
 
quint64 userStopDelayUSec
 

详细描述

登陆管理类

DLoginManager 中定义了登录管理对象的接口。

成员函数说明

◆ blockInhibited()

QString DLoginManager::blockInhibited ( ) const

读取各个模式的当前活动锁:

返回
例如:"handle-power-key"、"handle-suspend-key" 、"handle-lid-switch"

◆ cancelScheduledShutdown

bool DLoginManager::cancelScheduledShutdown ( )
slot

取消一个预定的关机

参见
void DLoginManager::scheduleShutdown(const ShutdownType type, const QDateTime &usec)
返回值
true计划了关机操作并且被此操作取消
false未计划关机操作

◆ canHalt

ExecuteStatus DLoginManager::canHalt ( )
slot

获取当前用户下计算机是否支持停止

返回值
Na该操作不可用, 因为硬件、内核或驱动程序不支持它。
Yes表示支持该操作, 用户无需进一步认证即可执行该操作。
No表示该操作可用, 但不允许用户执行该操作。
Challenge返回, 操作可用, 但必须经过授权。
Unknown未知或者其他状态

◆ canHibernate

ExecuteStatus DLoginManager::canHibernate ( )
slot

获取当前用户下计算机是否支持休眠

注解
休眠:将内存中数据保存到磁盘并将机器关闭
返回值
Na该操作不可用, 因为硬件、内核或驱动程序不支持它。
Yes表示支持该操作, 用户无需进一步认证即可执行该操作。
No表示该操作可用, 但不允许用户执行该操作。
Challenge返回, 操作可用, 但必须经过授权。
Unknown未知或者其他状态

◆ canHybridSleep

ExecuteStatus DLoginManager::canHybridSleep ( )
slot

获取当前用户下计算机是否支持混合睡眠

注解
混合睡眠:即系统既休眠又挂起
返回值
Na该操作不可用, 因为硬件、内核或驱动程序不支持它。
Yes表示支持该操作, 用户无需进一步认证即可执行该操作。
No表示该操作可用, 但不允许用户执行该操作。
Challenge返回, 操作可用, 但必须经过授权。
Unknown未知或者其他状态

◆ canPowerOff

ExecuteStatus DLoginManager::canPowerOff ( )
slot

获取当前用户下计算机是否支持关机

返回值
Na该操作不可用, 因为硬件、内核或驱动程序不支持它。
Yes表示支持该操作, 用户无需进一步认证即可执行该操作。
No表示该操作可用, 但不允许用户执行该操作。
Challenge返回, 操作可用, 但必须经过授权。
Unknown未知或者其他状态

◆ canReboot

ExecuteStatus DLoginManager::canReboot ( )
slot

获取当前用户下计算机是否支持重启

返回值
Na该操作不可用, 因为硬件、内核或驱动程序不支持它。
Yes表示支持该操作, 用户无需进一步认证即可执行该操作。
No表示该操作可用, 但不允许用户执行该操作。
Challenge返回, 操作可用, 但必须经过授权。
Unknown未知或者其他状态

◆ canSuspend

ExecuteStatus DLoginManager::canSuspend ( )
slot

获取当前用户下计算机是否支持挂起

返回值
Na该操作不可用, 因为硬件、内核或驱动程序不支持它。
Yes表示支持该操作, 用户无需进一步认证即可执行该操作。
No表示该操作可用, 但不允许用户执行该操作。
Challenge返回, 操作可用, 但必须经过授权。
Unknown未知或者其他状态

◆ canSuspendThenHibernate

ExecuteStatus DLoginManager::canSuspendThenHibernate ( )
slot

获取当前用户下计算机是否支持挂起然后休眠

返回值
Na该操作不可用, 因为硬件、内核或驱动程序不支持它。
Yes表示支持该操作, 用户无需进一步认证即可执行该操作。
No表示该操作可用, 但不允许用户执行该操作。
Challenge返回, 操作可用, 但必须经过授权。
Unknown未知或者其他状态

◆ currentSeat

QSharedPointer< DLoginSeat > DLoginManager::currentSeat ( )
slot

当前的seat

返回
返回当前的seat对象

◆ currentSession

QSharedPointer< DLoginSeat > DLoginManager::currentSession ( )
slot

当前的session

返回
返回当前的seat对象

◆ currentUser

QSharedPointer< DLoginUser > DLoginManager::currentUser ( )
slot

当前的user

返回
返回当前的user对象

◆ delayInhibited()

QString DLoginManager::delayInhibited ( ) const

读取各个模式的当前活动锁

返回
例如:"sleep"

◆ docked()

bool DLoginManager::docked ( ) const

如果机器被连接到一个底座或者拓展坞(包含usbhub)上, Docked取值为true

返回
布尔值

◆ findSeatById

QSharedPointer< DLoginSeat > DLoginManager::findSeatById ( const QString &  seatId)
slot

获取seat对象

参数
[in]seatIdseatId, 例如:“seat0”
返回
seat对象

◆ findSessionById

QSharedPointer< DLoginSession > DLoginManager::findSessionById ( const QString &  sessionId)
slot

获取session对象

参数
[in]sessionId例如:“2”
返回
session对象

◆ findSessionByPID

QSharedPointer< DLoginSession > DLoginManager::findSessionByPID ( quint32  PID)
slot

通过进程号pid获取session对象

参数
[in]PID进程id
返回
session对象

◆ findUserById

QSharedPointer< DLoginUser > DLoginManager::findUserById ( quint32  UID)
slot

通过uid获取User对象

参数
[in]UID用户id
返回
user对象

◆ findUserByPID

QSharedPointer< DLoginUser > DLoginManager::findUserByPID ( quint32  PID)
slot

通过进程id获取User信息

参数
[in]PID进程id
返回
user对象

◆ halt

void DLoginManager::halt ( bool  interactive = false)
slot

计算机暂停操作, 暂停(不关闭电源关闭)

参数
[in]interactive一个交互式布尔参数可用于控制 polkit 是否应在需要时以交互方式要求用户提供认证凭证

◆ handleHibernateKey()

PowerAction DLoginManager::handleHibernateKey ( ) const

读取休眠按键的定义(默认是休眠)

返回
默认:"hibernate", 可以是关机或者睡眠等其他电源管理状态。

◆ handleLidSwitch()

PowerAction DLoginManager::handleLidSwitch ( ) const

读取笔记本合上盖子的行为 (默认是暂停)

返回
默认:"suspend", 可以是关机或者睡眠等其他电源管理状态。

◆ handleLidSwitchDocked()

PowerAction DLoginManager::handleLidSwitchDocked ( ) const

读取笔记本连上底座或者拓展坞后合上盖子的行为 (默认是忽略)

返回
默认:"ignore", 可以是关机或者睡眠等其他电源管理状态。

◆ handleLidSwitchExternalPower()

PowerAction DLoginManager::handleLidSwitchExternalPower ( ) const

读取笔记本连上底座或者拓展坞且链接电源后合上盖子的行为 (默认为空(完全忽略))

返回
默认:"", 可以是关机或者睡眠等其他电源管理状态。

◆ handlePowerKey()

PowerAction DLoginManager::handlePowerKey ( ) const

读取电源按键的定义 (默认是关机)

返回
默认:"poweroff", 可以是其他电源管理状态。

◆ handleSuspendKey()

PowerAction DLoginManager::handleSuspendKey ( ) const

读取暂停按键的定义 (默认是暂停)

返回
默认:"suspend", 可以是关机或者睡眠等其他电源管理状态。

◆ hibernate

void DLoginManager::hibernate ( bool  interactive = false)
slot

计算机执行休眠操作, 休眠(将内存中数据保存到磁盘并将机器关闭)

参数
[in]interactive一个交互式布尔参数可用于控制 polkit 是否应在需要时以交互方式要求用户提供认证凭证

◆ holdoffTimeoutUSec()

quint64 DLoginManager::holdoffTimeoutUSec ( ) const

读取系统启动或恢复后, systemd暂不对lid事件做出反应的时间段

返回
30000000 或者其他数字

◆ hybridSleep

void DLoginManager::hybridSleep ( bool  interactive = false)
slot

计算机执行混合睡眠, 混合睡眠模式, 即系统既休眠又挂起

参数
[in]interactive一个交互式布尔参数可用于控制 polkit 是否应在需要时以交互方式要求用户提供认证凭证

◆ idleAction()

PowerAction DLoginManager::idleAction ( ) const

读取系统空闲时采取的行动 (默认是忽略)

返回
默认:"ignore", 可以是关机或者睡眠等其他电源管理状态。

◆ idleActionUSec()

quint64 DLoginManager::idleActionUSec ( ) const

配置系统空闲时采取的行动的动作延迟

返回
18000000 或者其他数字

◆ idleHint()

bool DLoginManager::idleHint ( ) const

反映系统的空闲提示状态。如果系统空闲则为True

返回
布尔值

◆ idleSinceHint()

QDateTime DLoginManager::idleSinceHint ( ) const

空闲提示布尔值的最后一次更改的时间

返回
0 或者其他数字

◆ idleSinceHintMonotonic()

quint64 DLoginManager::idleSinceHintMonotonic ( ) const

空闲提示布尔值的最后一次更改的时间戳

返回
0 或者其他数字

◆ inhibit

int DLoginManager::inhibit ( int  what,
const QString &  who,
const QString &  why,
LoginInhibitMode  mode 
)
slot

创建一个抑制锁, 抑制锁:一个程序可以阻止或延迟系统休眠或关机

参见
freedesktop中关于抑制锁的介绍
参数
[in]what为一个32位无符号数, 应该使用命名空间InhibitBehavior中的常量相或而成, 其相当于使用“:”连接对应的字符串。"shutdown"(重启/关机/kexec), "sleep"(休眠), "idle"(空闲), "handle-power-key"(按下电源键), "handle-suspend-key"(按下休眠键), "handle-hibernate-key"(按下休眠键), "handle-lid-switch"(合上盖子)。 中的一个或多个, 用冒号分隔, 用于禁止关机/重启、挂起/休眠、自动空闲逻辑或硬件密钥处理。默认值是 "idle:sleep:shutdown"
[in]who应该是一个简短的人类可读字符串, 用于标识获取锁的应用程序, 若未设置, 则使用被执行的命令行字符串。
[in]why应该是一个简短的人类可读字符串, 用于标识获取锁的原因。
[in]mode应该是“ block”或“delay“它代表是否应将禁止视为强制性或是否应将操作延迟到某个最大时间。
注解
注释:人类可读字符串的定义是:对用户友好的字符串, 通常使用ASCII码中支持的字符, 使用英文语法描述当前程序名和原因
返回
该方法返回一个文件描述符。在此文件描述符及其所有副本关闭时释放锁

◆ inhibitDelayMaxUSec()

quint64 DLoginManager::inhibitDelayMaxUSec ( ) const

读取由于"delay"类型的抑制器锁处于活动状态而延迟系统关闭或睡眠请求的最大时间,默认为5s 5000000us

返回
5000000或者其他数字

◆ inhibitorsMax()

quint64 DLoginManager::inhibitorsMax ( ) const

读取允许的最大并发抑制器数量, 默认8192

返回
8192或者其他数字

◆ killExcludeUsers()

QStringList DLoginManager::killExcludeUsers ( ) const

读取 KillExcludeUsers 属性。 该属性将获取采用空格分割的用户列表, 在设置了 KillUserProcesses=yes 将会排除该用户会话范围内的进程。如果未设置 KillExcludeUsers=yes, 则默认排除“root”用户。

注解
注意, 返回的是一个QList,需要使用[]来获取列表中某个元素
返回
以空格分割的用户列表.

◆ killOnlyUsers()

QStringList DLoginManager::killOnlyUsers ( ) const

读取killOnlyUsers属性 检查KillOnlyUsers的取值。如果指定了这个设置, 只有这些用户的会话作用域中的进程将被杀死。否则, 用户将受到KillUserProcesses=yes设置的限制。

注解
注意, 返回的是一个QList,需要使用[]来获取列表中某个元素
返回
以空格分割的用户列表

◆ killSession

void DLoginManager::killSession ( const QString &  sessionId,
LoginSessionRole  who,
qint32  signalNumber 
)
slot

可用于向会话的一个或所有进程发送 Unix 信号, 作为参数, 它接受会话 id、字符串“ leader”或“ all”和一个信号编号。 如果“ leader”通过, 则只有会话“ leader”被终止。如果“ all”通过, 则会话的所有进程都将被终止。

参数
[in]sessionId会话id
[in]who“leader”或“all”
[in]signalNumber信号编号
注解
在shell中输入kill -l获取信号编号

◆ killUser

void DLoginManager::killUser ( quint32  UID,
qint32  signalNumber 
)
slot

可用于向用户的所有进程发送 Unix 信号。作为参数, 它需要用户 ID 和信号编号

参数
[in]uid用户id
[in]signalNumber信号编号
注解
在shell中输入kill -l获取信号编号

◆ killUserProcesses()

bool DLoginManager::killUserProcesses ( ) const

查看killUserProcesses当前配置, 当用户注销时是否应该杀死该用户的进程。 如果返回为true, 则该会话对应的作用域单元和该作用域内的所有进程将被终止。如果返回为 "false", 则该作用域被 "抛弃"

返回
布尔值

◆ lidClosed()

bool DLoginManager::lidClosed ( ) const

当(笔记本电脑)的盖子关闭时, LidClosed为true。

返回
布尔值

◆ listInhibitors

QList< Inhibitor > DLoginManager::listInhibitors ( )
slot

列出所有当前有效的抑制器。

返回
QList<Inhibitor>: 一个由what、who、why、 mode、uid(用户 ID)和pid(进程 ID)组成的结构数组。
注解
注意, 返回的是一个QList,需要使用[]来获取列表中某个元素
参见
DLoginManager::inhibit(const QString &what, const QString &who, const QString &why, const QString &mode)

◆ listSeats

QList< Seat > DLoginManager::listSeats ( )
slot

列出所有的seat

注解
注意, 返回的是一个QList,需要使用[]来获取列表中某个元素
返回
返回所有的seat, 以列表的形式。 例如'seat0'

◆ listSessions

QList< Session > DLoginManager::listSessions ( )
slot

列出所有的Session

注解
注意, 返回的是一个QList,需要使用[]来获取列表中某个元素
返回
返回所有的session, 以列表的形式。例如:'5'

◆ listUsers

QList< User > DLoginManager::listUsers ( )
slot

列出所有的User

注解
注意, 返回的是一个QList,需要使用[]来获取列表中某个元素
返回
列出所有的User, 以列表的形式。例如:1000

◆ lockSession

void DLoginManager::lockSession ( const QString &  sessionId)
slot

要求具有指定 ID 的会话激活屏幕锁定

参数
[in]sessionId会话id

◆ logout

void DLoginManager::logout ( )
slot

登出

注解
注意:此操作为危险操作, 会丢弃当前活动, 请确保运行前重要文件已经得到妥善处理

◆ nAutoVTs()

quint32 DLoginManager::nAutoVTs ( ) const

读取默认配置分配多少个虚拟终端(VT), 默认为6

返回
6 或者其他数字

◆ nCurrentInhibitors()

quint64 DLoginManager::nCurrentInhibitors ( ) const

读取当前注册抑制器数量

返回
数字

◆ nCurrentSessions()

quint64 DLoginManager::nCurrentSessions ( ) const

读取当前注册的会话数量

返回
数字

◆ powerOff

void DLoginManager::powerOff ( bool  interactive = false)
slot

关机

参数
[in]interactive一个交互式布尔参数可用于控制 polkit 是否应在需要时以交互方式要求用户提供认证凭证

◆ prepareForShutdown

void DLoginManager::prepareForShutdown ( bool  value)
signal

PrepareForShutdown()和PrepareForSleep()信号在系统关闭之前(使用参数“ true” )或之后(使用参数“ false”)发送, 分别用于重新启动/关机和挂起/休眠。应用程序可以使用它来将数据保存在磁盘上、释放内存或执行其他应在关机/睡眠前不久完成的工作, 以及延迟抑制器。完成这项工作后, 他们应该释放他们的抑制锁, 以免进一步延迟操作。

参数
[in]value布尔值

◆ prepareForSleep

void DLoginManager::prepareForSleep ( bool  value)
signal

◆ preparingForShutdown()

bool DLoginManager::preparingForShutdown ( ) const

在两个PrepareForShutdown和PrepareForSleep信号的间隔期间分别为真

返回
布尔值

◆ preparingForSleep()

bool DLoginManager::preparingForSleep ( ) const

在两个PrepareForShutdown和PrepareForSleep信号的间隔期间分别为真

返回
布尔值

◆ reboot

void DLoginManager::reboot ( bool  interactive = false)
slot

重启

参数
[in]interactive一个交互式布尔参数可用于控制 polkit 是否应在需要时以交互方式要求用户提供认证凭证

◆ removeIPC()

bool DLoginManager::removeIPC ( ) const

返回一个属性设置, 当用户完全注销时, 属于用户的System V和POSIX IPC对象是否应被删除。 返回一个布尔参数。如果为true, 在用户的最后一个会话结束后, 用户不得消耗IPC资源。 这包括System V的信号、共享内存和消息队列, 以及POSIX共享内存和消息队列。 请注意, 根用户和其他系统用户的IPC对象不受此设置的影响。默认值为 "true"。

返回
布尔值

◆ runtimeDirectoryInodesMax()

quint64 DLoginManager::runtimeDirectoryInodesMax ( ) const

设置每个登录用户的$XDG_RUNTIME_DIR运行时目录的大小限制。

注解
这个大小只是一个安全限制。由于每个运行时目录是一个tmpfs文件系统, 它只消耗所需的内存
返回
数字

◆ runtimeDirectorySize()

quint64 DLoginManager::runtimeDirectorySize ( ) const

读取每个登录用户的$XDG_RUNTIME_DIR运行时目录的大小限制。

返回
数字

◆ scheduledShutdown()

ScheduledShutdownValue DLoginManager::scheduledShutdown ( ) const

读取scheduledShutdown的值, 返回两个参数, 第一个电源管理状态名, 第二个是unix时间戳(精确到微秒), 可以使用scheduleShutdown方法进行写入。 具体含义见同名方法

返回
包含关机类型和时间的结构体

◆ scheduleShutdown

void DLoginManager::scheduleShutdown ( LoginShutdownType  type,
const QDateTime &  usec 
)
slot

在一定时间后定时关机

参数
[in]type关机操作类型, 可以是"poweroff"、"dry-poweroff"、"reboot"、"dry-reboot"、"halt "和 "dry-halt "之一
[in]usecUnix时间戳, 从1970.1.1零点开始到现在的微秒时间

◆ seatRemoved

void DLoginManager::seatRemoved ( const QString &  seatId)
signal
参见
DLoginManager::SeatNew(const QString &seatId)

◆ sessionNew

void DLoginManager::sessionNew ( const QString &  sessionId)
signal
参见
DLoginManager::SeatNew(const QString &seatId)

◆ sessionRemoved

void DLoginManager::sessionRemoved ( const QString &  sessionId)
signal
参见
DLoginManager::SeatNew(const QString &seatId)

◆ sessionsMax()

quint64 DLoginManager::sessionsMax ( ) const

读取要管理的并发用户会话的最大数量

返回
数字

◆ setUserLinger

void DLoginManager::setUserLinger ( quint32  UID,
bool  enable,
bool  interactive 
)
slot

启用或禁用用户滞留。如果启用, 将保留用户的运行时目录, 并且他们可以在注销时继续运行进程。如果禁用, 运行时目录会在他们注销后立即消失

参数
[in]uid用户id
[in]enable一个是否启用/禁用的布尔值
[in]interactive一个交互式布尔参数可用于控制 polkit 是否应在需要时以交互方式要求用户提供认证凭证
注解
请注意, 用户滞留状态会持久性地保存在磁盘上。

◆ suspend

void DLoginManager::suspend ( bool  interactive = false)
slot

计算机执行挂起操作(系统状态保存到 RAM 并关闭 CPU)

参数
[in]interactive一个交互式布尔参数可用于控制 polkit 是否应在需要时以交互方式要求用户提供认证凭证

◆ suspendThenHibernate

void DLoginManager::suspendThenHibernate ( bool  interactive = false)
slot

计算机系统被暂停, 随后使用RTC定时器唤醒并休眠

参数
[in]interactive一个交互式布尔参数可用于控制 polkit 是否应在需要时以交互方式要求用户提供认证凭证

◆ terminateSession

void DLoginManager::terminateSession ( const QString &  sessionId)
slot

可用于强制终止一个特定会话

参数
[in]sessionId会话编号

◆ terminateUser

void DLoginManager::terminateUser ( quint32  uid)
slot

可用于强制终止用户的所有进程

参数
[in]uid用户编号

◆ userNew

void DLoginManager::userNew ( quint32  UID)
signal
参见
DLoginManager::SeatNew(const QString &seatId)

◆ userRemoved

void DLoginManager::userRemoved ( quint32  UID)
signal

◆ userStopDelayUSec()

quint64 DLoginManager::userStopDelayUSec ( ) const

读取在用户完全注销后为其保留用户记录和每个用户服务user.service的时间

返回
数字

该类的文档由以下文件生成: