summaryrefslogtreecommitdiff
path: root/x11/libqpe-x11/qpe/qpeapplication.h
blob: 5521998f22442bf9ade03d60f9fa2e51d8ccf174 (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
#ifndef OPIE_QPE_APPLICATION_H
#define OPIE_QPE_APPLICATION_H

/**
 * LGPLed
 */

#include <qapplication.h>
#include <qevent.h>
#include <qtopia/timestring.h>
#include <unistd.h>
#include <stdlib.h>

class QCopChannel;
class QPEApplication : public QApplication {
    Q_OBJECT
public:
    QPEApplication(int& argc,  char** argv, Type=GuiClient );
    ~QPEApplication();


    static QString qpeDir();
    static QString documentDir();
    void applyStyle();

    static int defaultRotation();
    static void setDefaultRotation( int r );
    static void grabKeyboard();
    static void ungrabKeyboard();

    enum StylusMode {
        LeftOnly,
        RightOnHold
    };
    static void setStylusOperation( QWidget*, StylusMode );
    static StylusMode stylusOperation( QWidget* );

    enum InputMethodHint {
	Normal,
	AlwaysOff,
	AlwaysOn
    };
    static void setInputMethodHint( QWidget*, InputMethodHint );
    static InputMethodHint inputMethodHint( QWidget* );

    void showMainWidget( QWidget*, bool nomax = FALSE );
    void showMainDocumentWidget( QWidget*, bool nomax = FALSE );

    static void showDialog( QDialog*, bool nomax = FALSE );
    static int execDialog ( QDialog*, bool nomax = FALSE );
    static void showWidget( QWidget*, bool nomax = FALSE );

    static void setKeepRunning();
    bool keepRunning()const;

    bool keyboardGrabbed()const;
    int exec();

// QWS bits
    enum screenSaverHint {
	Disable = 0,
	DisableLightOff = 1,
	DisableSuspend = 2,
	Enable = 100
    };
    /* reimplemented for internal purposes */
    int x11ClientMessage( QWidget*, XEvent*, bool );

signals:
    void clientMoused();
    void timeChanged();
    void clockChanged( bool pm );
    void micChanged( bool muted );
    void volumeChanged( bool muted );
    void appMessage( const QCString& msg, const QByteArray& data);
    void weekChanged( bool startOnMonday );
    void dateFormatChanged( DateFormat );
    void flush();
    void reload();

private:
    void initTranslations();
    void internalSetStyle(const QString&);

private slots:
    void hideOrQuit();
    void systemMessage( const QCString&, const QByteArray& );
    void pidMessage( const QCString&, const QByteArray& );
    void removeSenderFromStylusDict();
protected:
    virtual void restart();
    virtual void shutdown();
    void prepareForTermination(bool willrestart);
    bool eventFilter( QObject*, QEvent* );
    void timerEvent( QTimerEvent* );
    void raiseAppropriateWindow();
    virtual void tryQuit();

private:
    class Private;
    Private* d;
    QCopChannel *m_sys;
    QCopChannel *m_pid;
};
enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */

#endif