00001 #ifndef OPIE_QPE_APPLICATION_H
00002 #define OPIE_QPE_APPLICATION_H
00003
00008 #include <qapplication.h>
00009 #include <qevent.h>
00010 #include <qtopia/timestring.h>
00011 #include <unistd.h>
00012 #include <stdlib.h>
00013
00014 class QCopChannel;
00015 class QPEApplication : public QApplication {
00016 Q_OBJECT
00017 public:
00018 QPEApplication(int& argc, char** argv, Type=GuiClient );
00019 ~QPEApplication();
00020
00021
00022 static QString qpeDir();
00023 static QString documentDir();
00024 void applyStyle();
00025
00026 static int defaultRotation();
00027 static void setDefaultRotation( int r );
00028 static void grabKeyboard();
00029 static void ungrabKeyboard();
00030
00031 enum StylusMode {
00032 LeftOnly,
00033 RightOnHold
00034 };
00035 static void setStylusOperation( QWidget*, StylusMode );
00036 static StylusMode stylusOperation( QWidget* );
00037
00038 enum InputMethodHint {
00039 Normal,
00040 AlwaysOff,
00041 AlwaysOn
00042 };
00043 static void setInputMethodHint( QWidget*, InputMethodHint );
00044 static InputMethodHint inputMethodHint( QWidget* );
00045
00046 void showMainWidget( QWidget*, bool nomax = FALSE );
00047 void showMainDocumentWidget( QWidget*, bool nomax = FALSE );
00048
00049 static void showDialog( QDialog*, bool nomax = FALSE );
00050 static int execDialog ( QDialog*, bool nomax = FALSE );
00051 static void showWidget( QWidget*, bool nomax = FALSE );
00052
00053 static void setKeepRunning();
00054 bool keepRunning()const;
00055
00056 bool keyboardGrabbed()const;
00057 int exec();
00058
00059
00060 enum screenSaverHint {
00061 Disable = 0,
00062 DisableLightOff = 1,
00063 DisableSuspend = 2,
00064 Enable = 100
00065 };
00066
00067 int x11ClientMessage( QWidget*, XEvent*, bool );
00068
00069 signals:
00070 void clientMoused();
00071 void timeChanged();
00072 void clockChanged( bool pm );
00073 void micChanged( bool muted );
00074 void volumeChanged( bool muted );
00075 void appMessage( const QCString& msg, const QByteArray& data);
00076 void weekChanged( bool startOnMonday );
00077 void dateFormatChanged( DateFormat );
00078 void flush();
00079 void reload();
00080
00081 private:
00082 void initTranslations();
00083 void internalSetStyle(const QString&);
00084
00085 private slots:
00086 void hideOrQuit();
00087 void systemMessage( const QCString&, const QByteArray& );
00088 void pidMessage( const QCString&, const QByteArray& );
00089 void removeSenderFromStylusDict();
00090 protected:
00091 virtual void restart();
00092 virtual void shutdown();
00093 void prepareForTermination(bool willrestart);
00094 bool eventFilter( QObject*, QEvent* );
00095 void timerEvent( QTimerEvent* );
00096 void raiseAppropriateWindow();
00097 virtual void tryQuit();
00098
00099 private:
00100 class Private;
00101 Private* d;
00102 QCopChannel *m_sys;
00103 QCopChannel *m_pid;
00104 };
00105 enum Transformation { Rot0, Rot90, Rot180, Rot270 };
00106
00107 #endif