~ubuntu-branches/ubuntu/saucy/kopete/saucy-proposed

« back to all changes in this revision

Viewing changes to libkopete/kopeteidletimer.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-06-21 02:22:39 UTC
  • Revision ID: package-import@ubuntu.com-20130621022239-63l3zc8p0nf26pt6
Tags: upstream-4.10.80
ImportĀ upstreamĀ versionĀ 4.10.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    kopeteidletimer.h  -  Kopete Idle Timer
 
3
 
 
4
    Copyright (c) 2002      by Hendrik vom Lehn      <hvl@linux-4-ever.de>
 
5
    Copyright (c) 2003      by Olivier Goffart       <ogoffart@kde.org>
 
6
    Copyright (c) 2008      by Roman Jarosz          <kedgedev@centrum.cz>
 
7
    Kopete    (c) 2002-2008 by the Kopete developers <kopete-devel@kde.org>
 
8
 
 
9
    *************************************************************************
 
10
    *                                                                       *
 
11
    * This library is free software; you can redistribute it and/or         *
 
12
    * modify it under the terms of the GNU Lesser General Public            *
 
13
    * License as published by the Free Software Foundation; either          *
 
14
    * version 2 of the License, or (at your option) any later version.      *
 
15
    *                                                                       *
 
16
    *************************************************************************
 
17
*/
 
18
#ifndef KOPETEIDLETIMER_H
 
19
#define KOPETEIDLETIMER_H
 
20
 
 
21
#include <QtCore/QObject>
 
22
 
 
23
#include "kopete_export.h"
 
24
 
 
25
namespace Kopete
 
26
{
 
27
 
 
28
/**
 
29
 * IdleTimer handles global idle time and allows to register idle timeout notifications
 
30
 *
 
31
 * IdleTimer is a singleton, you may uses it with @ref IdleTimer::self()
 
32
 */
 
33
class KOPETE_EXPORT IdleTimer : public QObject
 
34
{
 
35
Q_OBJECT
 
36
 
 
37
public:
 
38
        /**
 
39
         * Get the only instance of IdleTimer
 
40
         * @return IdleTimer single instance
 
41
         */
 
42
        static IdleTimer *self();
 
43
 
 
44
        ~IdleTimer();
 
45
 
 
46
        /**
 
47
         * @brief Time in seconds the user has been idle
 
48
         */
 
49
        int idleTime();
 
50
 
 
51
public Q_SLOTS:
 
52
        /**
 
53
         * @brief Register new timeout notification
 
54
         * \param idleSeconds the idle notification time period
 
55
         * \param receiver the object that receives the timeout notification.
 
56
         * \param memberActive the slot that is called when user has changed its state from idle to active.
 
57
         * \param memberIdle the slot that is called when user was idle for @param idleSeconds seconds.
 
58
         */
 
59
        void registerTimeout( int idleSeconds, QObject * receiver,
 
60
                              const char * memberActive, const char * memberIdle );
 
61
 
 
62
        /**
 
63
         * removes all registered timeout notifications for this object
 
64
         */
 
65
        void unregisterTimeout( QObject *receiver );
 
66
 
 
67
private slots:
 
68
        void updateIdleTime();
 
69
 
 
70
private:
 
71
        IdleTimer();
 
72
 
 
73
        static IdleTimer *instance;
 
74
 
 
75
        class Private;
 
76
        Private * const d;
 
77
};
 
78
 
 
79
}
 
80
 
 
81
#endif