/*
* Copyright (C) 2021, KylinSoft Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/&gt;.
*
*/

#ifndef __LOGIN1_DBUS_H__
#define __LOGIN1_DBUS_H__
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusConnectionInterface>
#include <QtDBus/QDBusMessage>
#include <QtDBus/QDBusReply>
#include <QCoreApplication>
#include <QDBusInterface>
#include <QTime>
#include <QDBusUnixFileDescriptor>

enum INHIBIT_TYPE
{
    INHIBIT_SLEEP = 0,
    INHIBIT_SHUTDOWN = 1
};

class login1dbusManager: public QObject
{
    Q_OBJECT
public:

    login1dbusManager();
    bool inhibit(INHIBIT_TYPE type);
    void unInhibit();
    ~login1dbusManager();
signals:
    void goingToSleep(bool);
    void shuttingDown(bool);
    void locking();
    void changeUserLocking(bool);
private slots:
    void changeUserLock();
    void changeUserUnLock();
    void login1PrepareForSleep(bool);
    void login1PrepareForShutdown(bool);
    void screenSaverLocked();
    void logoutSig();
    void screenSaverUnlocked();
private:
    bool isLockFlag = false;
    QDBusUnixFileDescriptor m_inhibitShutdownFD;
    QDBusUnixFileDescriptor m_inhibitSleepFD;
};
#endif
