/*
 * This file was generated by qdbusxml2cpp-fix version 0.8
 * Command line was: qdbusxml2cpp-fix -c Login1Manager -p /build/deepin-session/src/dde-session/dbusinterface/org_freedesktop_login1_Manager /build/deepin-session/src/dde-session/dbus/interface/org.freedesktop.login1.Manager.xml
 *
 * qdbusxml2cpp-fix is Copyright (C) 2016 Deepin Technology Co., Ltd.
 *
 * This is an auto-generated file.
 * This file may have been hand-edited. Look for HAND-EDIT comments
 * before re-generating it.
 */

#include "/build/deepin-session/src/dde-session/dbusinterface/org_freedesktop_login1_Manager.h"

DCORE_USE_NAMESPACE
/*
 * Implementation of interface class __Login1Manager
 */

class __Login1ManagerPrivate
{
public:
   __Login1ManagerPrivate() = default;

    // begin member variables
    QString BlockInhibited;
    QString DelayInhibited;
    bool Docked;
    bool EnableWallMessages;
    QString HandleHibernateKey;
    QString HandleLidSwitch;
    QString HandleLidSwitchDocked;
    QString HandlePowerKey;
    QString HandleSuspendKey;
    qulonglong HoldoffTimeoutUSec;
    QString IdleAction;
    qulonglong IdleActionUSec;
    bool IdleHint;
    qulonglong IdleSinceHint;
    qulonglong IdleSinceHintMonotonic;
    qulonglong InhibitDelayMaxUSec;
    qulonglong InhibitorsMax;
    QStringList KillExcludeUsers;
    QStringList KillOnlyUsers;
    bool KillUserProcesses;
    uint NAutoVTs;
    qulonglong NCurrentInhibitors;
    qulonglong NCurrentSessions;
    bool PreparingForShutdown;
    bool PreparingForSleep;
    bool RebootToFirmwareSetup;
    bool RemoveIPC;
    qulonglong RuntimeDirectorySize;
    qulonglong SessionsMax;
    qulonglong UserTasksMax;
    QString WallMessage;

public:
    QMap<QString, QDBusPendingCallWatcher *> m_processingCalls;
    QMap<QString, QList<QVariant>> m_waittingCalls;
};

__Login1Manager::__Login1Manager(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
    : DDBusExtendedAbstractInterface(service, path, staticInterfaceName(), connection, parent)
    , d_ptr(new __Login1ManagerPrivate)
{
    connect(this, &__Login1Manager::propertyChanged, this, &__Login1Manager::onPropertyChanged);

}

__Login1Manager::~__Login1Manager()
{
    qDeleteAll(d_ptr->m_processingCalls.values());
    delete d_ptr;
}

void __Login1Manager::onPropertyChanged(const QString &propName, const QVariant &value)
{
    if (propName == QStringLiteral("BlockInhibited"))
    {
        const QString &BlockInhibited = qvariant_cast<QString>(value);
        if (d_ptr->BlockInhibited != BlockInhibited)
        {
            d_ptr->BlockInhibited = BlockInhibited;
            Q_EMIT BlockInhibitedChanged(d_ptr->BlockInhibited);
        }
        return;
    }

    if (propName == QStringLiteral("DelayInhibited"))
    {
        const QString &DelayInhibited = qvariant_cast<QString>(value);
        if (d_ptr->DelayInhibited != DelayInhibited)
        {
            d_ptr->DelayInhibited = DelayInhibited;
            Q_EMIT DelayInhibitedChanged(d_ptr->DelayInhibited);
        }
        return;
    }

    if (propName == QStringLiteral("Docked"))
    {
        const bool &Docked = qvariant_cast<bool>(value);
        if (d_ptr->Docked != Docked)
        {
            d_ptr->Docked = Docked;
            Q_EMIT DockedChanged(d_ptr->Docked);
        }
        return;
    }

    if (propName == QStringLiteral("EnableWallMessages"))
    {
        const bool &EnableWallMessages = qvariant_cast<bool>(value);
        if (d_ptr->EnableWallMessages != EnableWallMessages)
        {
            d_ptr->EnableWallMessages = EnableWallMessages;
            Q_EMIT EnableWallMessagesChanged(d_ptr->EnableWallMessages);
        }
        return;
    }

    if (propName == QStringLiteral("HandleHibernateKey"))
    {
        const QString &HandleHibernateKey = qvariant_cast<QString>(value);
        if (d_ptr->HandleHibernateKey != HandleHibernateKey)
        {
            d_ptr->HandleHibernateKey = HandleHibernateKey;
            Q_EMIT HandleHibernateKeyChanged(d_ptr->HandleHibernateKey);
        }
        return;
    }

    if (propName == QStringLiteral("HandleLidSwitch"))
    {
        const QString &HandleLidSwitch = qvariant_cast<QString>(value);
        if (d_ptr->HandleLidSwitch != HandleLidSwitch)
        {
            d_ptr->HandleLidSwitch = HandleLidSwitch;
            Q_EMIT HandleLidSwitchChanged(d_ptr->HandleLidSwitch);
        }
        return;
    }

    if (propName == QStringLiteral("HandleLidSwitchDocked"))
    {
        const QString &HandleLidSwitchDocked = qvariant_cast<QString>(value);
        if (d_ptr->HandleLidSwitchDocked != HandleLidSwitchDocked)
        {
            d_ptr->HandleLidSwitchDocked = HandleLidSwitchDocked;
            Q_EMIT HandleLidSwitchDockedChanged(d_ptr->HandleLidSwitchDocked);
        }
        return;
    }

    if (propName == QStringLiteral("HandlePowerKey"))
    {
        const QString &HandlePowerKey = qvariant_cast<QString>(value);
        if (d_ptr->HandlePowerKey != HandlePowerKey)
        {
            d_ptr->HandlePowerKey = HandlePowerKey;
            Q_EMIT HandlePowerKeyChanged(d_ptr->HandlePowerKey);
        }
        return;
    }

    if (propName == QStringLiteral("HandleSuspendKey"))
    {
        const QString &HandleSuspendKey = qvariant_cast<QString>(value);
        if (d_ptr->HandleSuspendKey != HandleSuspendKey)
        {
            d_ptr->HandleSuspendKey = HandleSuspendKey;
            Q_EMIT HandleSuspendKeyChanged(d_ptr->HandleSuspendKey);
        }
        return;
    }

    if (propName == QStringLiteral("HoldoffTimeoutUSec"))
    {
        const qulonglong &HoldoffTimeoutUSec = qvariant_cast<qulonglong>(value);
        if (d_ptr->HoldoffTimeoutUSec != HoldoffTimeoutUSec)
        {
            d_ptr->HoldoffTimeoutUSec = HoldoffTimeoutUSec;
            Q_EMIT HoldoffTimeoutUSecChanged(d_ptr->HoldoffTimeoutUSec);
        }
        return;
    }

    if (propName == QStringLiteral("IdleAction"))
    {
        const QString &IdleAction = qvariant_cast<QString>(value);
        if (d_ptr->IdleAction != IdleAction)
        {
            d_ptr->IdleAction = IdleAction;
            Q_EMIT IdleActionChanged(d_ptr->IdleAction);
        }
        return;
    }

    if (propName == QStringLiteral("IdleActionUSec"))
    {
        const qulonglong &IdleActionUSec = qvariant_cast<qulonglong>(value);
        if (d_ptr->IdleActionUSec != IdleActionUSec)
        {
            d_ptr->IdleActionUSec = IdleActionUSec;
            Q_EMIT IdleActionUSecChanged(d_ptr->IdleActionUSec);
        }
        return;
    }

    if (propName == QStringLiteral("IdleHint"))
    {
        const bool &IdleHint = qvariant_cast<bool>(value);
        if (d_ptr->IdleHint != IdleHint)
        {
            d_ptr->IdleHint = IdleHint;
            Q_EMIT IdleHintChanged(d_ptr->IdleHint);
        }
        return;
    }

    if (propName == QStringLiteral("IdleSinceHint"))
    {
        const qulonglong &IdleSinceHint = qvariant_cast<qulonglong>(value);
        if (d_ptr->IdleSinceHint != IdleSinceHint)
        {
            d_ptr->IdleSinceHint = IdleSinceHint;
            Q_EMIT IdleSinceHintChanged(d_ptr->IdleSinceHint);
        }
        return;
    }

    if (propName == QStringLiteral("IdleSinceHintMonotonic"))
    {
        const qulonglong &IdleSinceHintMonotonic = qvariant_cast<qulonglong>(value);
        if (d_ptr->IdleSinceHintMonotonic != IdleSinceHintMonotonic)
        {
            d_ptr->IdleSinceHintMonotonic = IdleSinceHintMonotonic;
            Q_EMIT IdleSinceHintMonotonicChanged(d_ptr->IdleSinceHintMonotonic);
        }
        return;
    }

    if (propName == QStringLiteral("InhibitDelayMaxUSec"))
    {
        const qulonglong &InhibitDelayMaxUSec = qvariant_cast<qulonglong>(value);
        if (d_ptr->InhibitDelayMaxUSec != InhibitDelayMaxUSec)
        {
            d_ptr->InhibitDelayMaxUSec = InhibitDelayMaxUSec;
            Q_EMIT InhibitDelayMaxUSecChanged(d_ptr->InhibitDelayMaxUSec);
        }
        return;
    }

    if (propName == QStringLiteral("InhibitorsMax"))
    {
        const qulonglong &InhibitorsMax = qvariant_cast<qulonglong>(value);
        if (d_ptr->InhibitorsMax != InhibitorsMax)
        {
            d_ptr->InhibitorsMax = InhibitorsMax;
            Q_EMIT InhibitorsMaxChanged(d_ptr->InhibitorsMax);
        }
        return;
    }

    if (propName == QStringLiteral("KillExcludeUsers"))
    {
        const QStringList &KillExcludeUsers = qvariant_cast<QStringList>(value);
        if (d_ptr->KillExcludeUsers != KillExcludeUsers)
        {
            d_ptr->KillExcludeUsers = KillExcludeUsers;
            Q_EMIT KillExcludeUsersChanged(d_ptr->KillExcludeUsers);
        }
        return;
    }

    if (propName == QStringLiteral("KillOnlyUsers"))
    {
        const QStringList &KillOnlyUsers = qvariant_cast<QStringList>(value);
        if (d_ptr->KillOnlyUsers != KillOnlyUsers)
        {
            d_ptr->KillOnlyUsers = KillOnlyUsers;
            Q_EMIT KillOnlyUsersChanged(d_ptr->KillOnlyUsers);
        }
        return;
    }

    if (propName == QStringLiteral("KillUserProcesses"))
    {
        const bool &KillUserProcesses = qvariant_cast<bool>(value);
        if (d_ptr->KillUserProcesses != KillUserProcesses)
        {
            d_ptr->KillUserProcesses = KillUserProcesses;
            Q_EMIT KillUserProcessesChanged(d_ptr->KillUserProcesses);
        }
        return;
    }

    if (propName == QStringLiteral("NAutoVTs"))
    {
        const uint &NAutoVTs = qvariant_cast<uint>(value);
        if (d_ptr->NAutoVTs != NAutoVTs)
        {
            d_ptr->NAutoVTs = NAutoVTs;
            Q_EMIT NAutoVTsChanged(d_ptr->NAutoVTs);
        }
        return;
    }

    if (propName == QStringLiteral("NCurrentInhibitors"))
    {
        const qulonglong &NCurrentInhibitors = qvariant_cast<qulonglong>(value);
        if (d_ptr->NCurrentInhibitors != NCurrentInhibitors)
        {
            d_ptr->NCurrentInhibitors = NCurrentInhibitors;
            Q_EMIT NCurrentInhibitorsChanged(d_ptr->NCurrentInhibitors);
        }
        return;
    }

    if (propName == QStringLiteral("NCurrentSessions"))
    {
        const qulonglong &NCurrentSessions = qvariant_cast<qulonglong>(value);
        if (d_ptr->NCurrentSessions != NCurrentSessions)
        {
            d_ptr->NCurrentSessions = NCurrentSessions;
            Q_EMIT NCurrentSessionsChanged(d_ptr->NCurrentSessions);
        }
        return;
    }

    if (propName == QStringLiteral("PreparingForShutdown"))
    {
        const bool &PreparingForShutdown = qvariant_cast<bool>(value);
        if (d_ptr->PreparingForShutdown != PreparingForShutdown)
        {
            d_ptr->PreparingForShutdown = PreparingForShutdown;
            Q_EMIT PreparingForShutdownChanged(d_ptr->PreparingForShutdown);
        }
        return;
    }

    if (propName == QStringLiteral("PreparingForSleep"))
    {
        const bool &PreparingForSleep = qvariant_cast<bool>(value);
        if (d_ptr->PreparingForSleep != PreparingForSleep)
        {
            d_ptr->PreparingForSleep = PreparingForSleep;
            Q_EMIT PreparingForSleepChanged(d_ptr->PreparingForSleep);
        }
        return;
    }

    if (propName == QStringLiteral("RebootToFirmwareSetup"))
    {
        const bool &RebootToFirmwareSetup = qvariant_cast<bool>(value);
        if (d_ptr->RebootToFirmwareSetup != RebootToFirmwareSetup)
        {
            d_ptr->RebootToFirmwareSetup = RebootToFirmwareSetup;
            Q_EMIT RebootToFirmwareSetupChanged(d_ptr->RebootToFirmwareSetup);
        }
        return;
    }

    if (propName == QStringLiteral("RemoveIPC"))
    {
        const bool &RemoveIPC = qvariant_cast<bool>(value);
        if (d_ptr->RemoveIPC != RemoveIPC)
        {
            d_ptr->RemoveIPC = RemoveIPC;
            Q_EMIT RemoveIPCChanged(d_ptr->RemoveIPC);
        }
        return;
    }

    if (propName == QStringLiteral("RuntimeDirectorySize"))
    {
        const qulonglong &RuntimeDirectorySize = qvariant_cast<qulonglong>(value);
        if (d_ptr->RuntimeDirectorySize != RuntimeDirectorySize)
        {
            d_ptr->RuntimeDirectorySize = RuntimeDirectorySize;
            Q_EMIT RuntimeDirectorySizeChanged(d_ptr->RuntimeDirectorySize);
        }
        return;
    }

    if (propName == QStringLiteral("SessionsMax"))
    {
        const qulonglong &SessionsMax = qvariant_cast<qulonglong>(value);
        if (d_ptr->SessionsMax != SessionsMax)
        {
            d_ptr->SessionsMax = SessionsMax;
            Q_EMIT SessionsMaxChanged(d_ptr->SessionsMax);
        }
        return;
    }

    if (propName == QStringLiteral("UserTasksMax"))
    {
        const qulonglong &UserTasksMax = qvariant_cast<qulonglong>(value);
        if (d_ptr->UserTasksMax != UserTasksMax)
        {
            d_ptr->UserTasksMax = UserTasksMax;
            Q_EMIT UserTasksMaxChanged(d_ptr->UserTasksMax);
        }
        return;
    }

    if (propName == QStringLiteral("WallMessage"))
    {
        const QString &WallMessage = qvariant_cast<QString>(value);
        if (d_ptr->WallMessage != WallMessage)
        {
            d_ptr->WallMessage = WallMessage;
            Q_EMIT WallMessageChanged(d_ptr->WallMessage);
        }
        return;
    }

    qWarning() << "property not handle: " << propName;
    return;
}

QString __Login1Manager::blockInhibited()
{
    return qvariant_cast<QString>(internalPropGet("BlockInhibited", &d_ptr->BlockInhibited));
}

QString __Login1Manager::delayInhibited()
{
    return qvariant_cast<QString>(internalPropGet("DelayInhibited", &d_ptr->DelayInhibited));
}

bool __Login1Manager::docked()
{
    return qvariant_cast<bool>(internalPropGet("Docked", &d_ptr->Docked));
}

bool __Login1Manager::enableWallMessages()
{
    return qvariant_cast<bool>(internalPropGet("EnableWallMessages", &d_ptr->EnableWallMessages));
}

void __Login1Manager::setEnableWallMessages(bool value)
{

   internalPropSet("EnableWallMessages", QVariant::fromValue(value), &d_ptr->EnableWallMessages);
}

QString __Login1Manager::handleHibernateKey()
{
    return qvariant_cast<QString>(internalPropGet("HandleHibernateKey", &d_ptr->HandleHibernateKey));
}

QString __Login1Manager::handleLidSwitch()
{
    return qvariant_cast<QString>(internalPropGet("HandleLidSwitch", &d_ptr->HandleLidSwitch));
}

QString __Login1Manager::handleLidSwitchDocked()
{
    return qvariant_cast<QString>(internalPropGet("HandleLidSwitchDocked", &d_ptr->HandleLidSwitchDocked));
}

QString __Login1Manager::handlePowerKey()
{
    return qvariant_cast<QString>(internalPropGet("HandlePowerKey", &d_ptr->HandlePowerKey));
}

QString __Login1Manager::handleSuspendKey()
{
    return qvariant_cast<QString>(internalPropGet("HandleSuspendKey", &d_ptr->HandleSuspendKey));
}

qulonglong __Login1Manager::holdoffTimeoutUSec()
{
    return qvariant_cast<qulonglong>(internalPropGet("HoldoffTimeoutUSec", &d_ptr->HoldoffTimeoutUSec));
}

QString __Login1Manager::idleAction()
{
    return qvariant_cast<QString>(internalPropGet("IdleAction", &d_ptr->IdleAction));
}

qulonglong __Login1Manager::idleActionUSec()
{
    return qvariant_cast<qulonglong>(internalPropGet("IdleActionUSec", &d_ptr->IdleActionUSec));
}

bool __Login1Manager::idleHint()
{
    return qvariant_cast<bool>(internalPropGet("IdleHint", &d_ptr->IdleHint));
}

qulonglong __Login1Manager::idleSinceHint()
{
    return qvariant_cast<qulonglong>(internalPropGet("IdleSinceHint", &d_ptr->IdleSinceHint));
}

qulonglong __Login1Manager::idleSinceHintMonotonic()
{
    return qvariant_cast<qulonglong>(internalPropGet("IdleSinceHintMonotonic", &d_ptr->IdleSinceHintMonotonic));
}

qulonglong __Login1Manager::inhibitDelayMaxUSec()
{
    return qvariant_cast<qulonglong>(internalPropGet("InhibitDelayMaxUSec", &d_ptr->InhibitDelayMaxUSec));
}

qulonglong __Login1Manager::inhibitorsMax()
{
    return qvariant_cast<qulonglong>(internalPropGet("InhibitorsMax", &d_ptr->InhibitorsMax));
}

QStringList __Login1Manager::killExcludeUsers()
{
    return qvariant_cast<QStringList>(internalPropGet("KillExcludeUsers", &d_ptr->KillExcludeUsers));
}

QStringList __Login1Manager::killOnlyUsers()
{
    return qvariant_cast<QStringList>(internalPropGet("KillOnlyUsers", &d_ptr->KillOnlyUsers));
}

bool __Login1Manager::killUserProcesses()
{
    return qvariant_cast<bool>(internalPropGet("KillUserProcesses", &d_ptr->KillUserProcesses));
}

uint __Login1Manager::nAutoVTs()
{
    return qvariant_cast<uint>(internalPropGet("NAutoVTs", &d_ptr->NAutoVTs));
}

qulonglong __Login1Manager::nCurrentInhibitors()
{
    return qvariant_cast<qulonglong>(internalPropGet("NCurrentInhibitors", &d_ptr->NCurrentInhibitors));
}

qulonglong __Login1Manager::nCurrentSessions()
{
    return qvariant_cast<qulonglong>(internalPropGet("NCurrentSessions", &d_ptr->NCurrentSessions));
}

bool __Login1Manager::preparingForShutdown()
{
    return qvariant_cast<bool>(internalPropGet("PreparingForShutdown", &d_ptr->PreparingForShutdown));
}

bool __Login1Manager::preparingForSleep()
{
    return qvariant_cast<bool>(internalPropGet("PreparingForSleep", &d_ptr->PreparingForSleep));
}

bool __Login1Manager::rebootToFirmwareSetup()
{
    return qvariant_cast<bool>(internalPropGet("RebootToFirmwareSetup", &d_ptr->RebootToFirmwareSetup));
}

bool __Login1Manager::removeIPC()
{
    return qvariant_cast<bool>(internalPropGet("RemoveIPC", &d_ptr->RemoveIPC));
}

qulonglong __Login1Manager::runtimeDirectorySize()
{
    return qvariant_cast<qulonglong>(internalPropGet("RuntimeDirectorySize", &d_ptr->RuntimeDirectorySize));
}

qulonglong __Login1Manager::sessionsMax()
{
    return qvariant_cast<qulonglong>(internalPropGet("SessionsMax", &d_ptr->SessionsMax));
}

qulonglong __Login1Manager::userTasksMax()
{
    return qvariant_cast<qulonglong>(internalPropGet("UserTasksMax", &d_ptr->UserTasksMax));
}

QString __Login1Manager::wallMessage()
{
    return qvariant_cast<QString>(internalPropGet("WallMessage", &d_ptr->WallMessage));
}

void __Login1Manager::setWallMessage(const QString &value)
{

   internalPropSet("WallMessage", QVariant::fromValue(value), &d_ptr->WallMessage);
}

void __Login1Manager::CallQueued(const QString &callName, const QList<QVariant> &args)
{
    if (d_ptr->m_waittingCalls.contains(callName))
    {
        d_ptr->m_waittingCalls[callName] = args;
        return;
    }
    if (d_ptr->m_processingCalls.contains(callName))
    {
        d_ptr->m_waittingCalls.insert(callName, args);
    } else {
        QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(asyncCallWithArgumentList(callName, args));
        connect(watcher, &QDBusPendingCallWatcher::finished, this, &__Login1Manager::onPendingCallFinished);
        d_ptr->m_processingCalls.insert(callName, watcher);
    }
}

void __Login1Manager::onPendingCallFinished(QDBusPendingCallWatcher *w)
{
    w->deleteLater();
    const auto callName = d_ptr->m_processingCalls.key(w);
    Q_ASSERT(!callName.isEmpty());
    if (callName.isEmpty())
        return;
    d_ptr->m_processingCalls.remove(callName);
    if (!d_ptr->m_waittingCalls.contains(callName))
        return;
    const auto args = d_ptr->m_waittingCalls.take(callName);
    CallQueued(callName, args);
}
