summaryrefslogtreecommitdiffstats
path: root/adept/notifier/app.h
blob: c543aaa4a5809ac24c72ef47e1add36543c27f34 (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
#ifndef EPT_NOTIFIER_H
#define EPT_NOTIFIER_H

#include <sys/types.h>
#include <ksystemtray.h>
#include <kuniqueapplication.h>
#include <kdirwatch.h>
#include <kprocess.h>

class QWidget;
class KAction;
// class KGlobalAccel;

// the status indicator in system tray
class TrayWindow : public KSystemTray
{
    Q_OBJECT
public:
    TrayWindow(QWidget *parent=0, const char *name=0);
	void setAvailableUpdates( int n );
    int updates() { return m_updates; }
	void contextMenuAboutToShow ( KPopupMenu * );
signals:
    void clicked();
    void aboutSelected();
protected:
    void mouseReleaseEvent( QMouseEvent * );
    int m_updates;
	KAction *m_quit, *m_about;
};

// the apport indicator in system tray
// gets shown where the app is started and
// existing apport reports are found.
// clicking starts apport-qt
class ApportTrayWindow : public KSystemTray
{
    Q_OBJECT
signals:
    void clicked();
protected:
    void mousePressEvent(QMouseEvent*);
};

// used for the reboot notifier
class RebootTrayWindow : public KSystemTray
{
    Q_OBJECT
signals:
    void clicked();
protected:
    void mousePressEvent(QMouseEvent*);
};



// application watching the current status
// it will update the icon and run 
class NotifierApp : public KUniqueApplication
{
    Q_OBJECT
public:
    NotifierApp(bool allowStyles=true, bool GUIenabled=true);
    ~NotifierApp();
    bool fileUpdated( const char *, time_t & );
    int upgradable();

protected slots:
// void menuActivated(int id);
    void clicked();
    void checkUpdates();
	void askQuit();
	void about();
    // for apport
    void crashWatcher();
    void apportCheckExited(KProcess*);
    void rebootWatcher(const QString& path);
    void rebootClicked();

protected:
    TrayWindow *m_tray;
    QTimer *m_timer;
    time_t m_updateStamp, m_statusStamp;
	bool m_okAutostart;
    // for apport crash handler
    KDirWatch* m_dirWatch;
    KDirWatch* m_rebootDirWatch;
    bool m_crashes;
    bool m_rebootRequired;
    bool m_rebootShown; //have we already shown the reboot notifier?
};

#endif