Commit 0c73320b authored by jpetrell's avatar jpetrell

[developermode] Expose username. Contributes to JB#30044

parent b162ec41
......@@ -36,6 +36,8 @@
#include <QFile>
#include <QDir>
#include <QDBusReply>
#include <getdef.h>
#include <pwd.h>
/* Symbolic constants */
#define PROGRESS_INDETERMINATE (-1)
......@@ -239,12 +241,21 @@ DeveloperModeSettings::DeveloperModeSettings(QObject *parent)
, m_wlanIpAddress("-")
, m_usbInterface(USB_NETWORK_FALLBACK_INTERFACE)
, m_usbIpAddress(USB_NETWORK_FALLBACK_IP)
, m_username("nemo")
, m_developerModeEnabled(false)
, m_remoteLoginEnabled(false) // TODO: Read (from password manager?)
, m_workerWorking(false)
, m_workerStatus(Idle)
, m_workerProgress(PROGRESS_INDETERMINATE)
{
int uid = getdef_num("UID_MIN", -1);
struct passwd *pwd;
if ((pwd = getpwuid(uid)) != NULL) {
m_username = QString(pwd->pw_name);
} else {
qWarning() << "Failed to return username using getpwuid()";
}
m_worker->moveToThread(&m_worker_thread);
/* Messages to worker */
......@@ -294,6 +305,12 @@ DeveloperModeSettings::usbIpAddress() const
return m_usbIpAddress;
}
QString
DeveloperModeSettings::username() const
{
return m_username;
}
bool
DeveloperModeSettings::developerModeEnabled() const
{
......
......@@ -55,6 +55,10 @@ class DeveloperModeSettings : public QObject
READ usbIpAddress
NOTIFY usbIpAddressChanged)
Q_PROPERTY(QString username
READ username
CONSTANT)
Q_PROPERTY(bool developerModeEnabled
READ developerModeEnabled
NOTIFY developerModeEnabledChanged)
......@@ -90,6 +94,7 @@ public:
QString wlanIpAddress() const;
QString usbIpAddress() const;
QString username() const;
bool developerModeEnabled() const;
bool remoteLoginEnabled() const;
bool workerWorking() const;
......@@ -129,6 +134,7 @@ private:
QString m_wlanIpAddress;
QString m_usbInterface;
QString m_usbIpAddress;
QString m_username;
bool m_developerModeEnabled;
bool m_remoteLoginEnabled;
bool m_workerWorking;
......
......@@ -7,7 +7,7 @@ QT += qml dbus systeminfo
QT -= gui
CONFIG += link_pkgconfig
PKGCONFIG += profile mlite5 timed-qt5
PKGCONFIG += profile mlite5 timed-qt5 libshadowutils
system(qdbusxml2cpp -p mceiface.h:mceiface.cpp mce.xml)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment