summaryrefslogtreecommitdiffstats
path: root/kdesktop/dbus/screensaver/dbusscreensaverservice.h
blob: 03713a4b1ba724a506b5532aed1cf52632596d63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 * dbusscreensaverservice.h
 *
 *  (C) 2024 Emanoil Kotsev
 *  deloptes (AT) gmail.com
 *
 * tdebase Copyright (C) 2009 tdebase development team
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation.
 *
 * 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, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
#ifndef KDESKTOP_LOCK_DBUS_SCREENSAVER_DBUSSCREENSAVERSERVICE_H_
#define KDESKTOP_LOCK_DBUS_SCREENSAVER_DBUSSCREENSAVERSERVICE_H_

#include <tqmap.h>
#include <tqdbusconnection.h>

#include "dbus/interfaces/screensaverNode.h"
#include "dbus/interfaces/dbusbaseNode.h"
#include "screensaverInterfaceImpl.h"

class ScreenSaverService: public org::freedesktop::screensaverNode
{
    friend class TDEDbusScreenSaver;

public:
    ScreenSaverService(TQT_DBusConnection&);
    virtual ~ScreenSaverService();

protected:
    virtual TQT_DBusObjectBase* createInterface(const TQString&);
    ScreenSaverInterfaceImpl *screenSaverInterface;

private:
    TQMap<TQString, TQT_DBusObjectBase*> m_interfaces;
    TQT_DBusConnection m_connection;
};

class RootNodeService: public DBusBaseNode
{
public:
    RootNodeService(TQT_DBusConnection&);
    virtual ~RootNodeService();
protected:
    virtual TQT_DBusObjectBase* createInterface(const TQString&);
private:
    TQMap<TQString, TQT_DBusObjectBase*> m_interfaces;
    TQT_DBusConnection m_connection;
};

class OrgNodeService: public DBusBaseNode
{
public:
    OrgNodeService(TQT_DBusConnection&);
    virtual ~OrgNodeService();
protected:
    virtual TQT_DBusObjectBase* createInterface(const TQString&);
private:
    TQMap<TQString, TQT_DBusObjectBase*> m_interfaces;
    TQT_DBusConnection m_connection;
};

class FreeDesktopNodeService: public DBusBaseNode
{
public:
    FreeDesktopNodeService(TQT_DBusConnection&);
    virtual ~FreeDesktopNodeService();
protected:
    virtual TQT_DBusObjectBase* createInterface(const TQString&);
private:
    TQMap<TQString, TQT_DBusObjectBase*> m_interfaces;
    TQT_DBusConnection m_connection;
};

class TDEDbusScreenSaver
{

public:
    TDEDbusScreenSaver();
    virtual ~TDEDbusScreenSaver();

    /*!
     * This function return information about connection status to the DBUS daemon.
     * \return boolean with the state of the connection to D-Bus
     * \retval true if connected
     * \retval false if disconnected
     */
    bool isConnectedToDBUS();

private:
    /*!
     * This function initialize the connection to the D-Bus daemon.
     * \return boolean with the result of the operation
     * \retval true if successfully configured D-Bus connection
     * \retval false if unsuccessful
     */
    bool configureService();

    /*!
     * This function is to close the connection to D-Bus
     * \return boolean with the result of the operation
     * \retval true if successfully unset D-Bus connection
     * \retval false if unsuccessful
     */
    bool unconfigureService();

private:
    TQT_DBusConnection m_connection;

    RootNodeService *rootService;
    OrgNodeService   *orgService;
    FreeDesktopNodeService *freeDesktopNodeService;
    ScreenSaverService *screenSaverService;

};

#endif /* KDESKTOP_LOCK_DBUS_SCREENSAVER_DBUSSCREENSAVERSERVICE_H_ */