Qtopia library API Documentation

QPEApplication Class Reference

The QPEApplication class implements various system services that are available to all Qtopia applications. More...

#include <qpeapplication.h>

Inheritance diagram for QPEApplication:

Inheritance graph
[legend]
Collaboration diagram for QPEApplication:

Collaboration graph
[legend]
List of all members.

Public Types

enum  StylusMode { LeftOnly, RightOnHold }
enum  InputMethodHint { Normal, AlwaysOff, AlwaysOn }
enum  screenSaverHint { Disable = 0, DisableLightOff = 1, DisableSuspend = 2, Enable = 100 }

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 ()

Public Member Functions

 QPEApplication (int &argc, char **argv, Type=GuiClient)
 ~QPEApplication ()
void applyStyle ()
void reset ()
void showMainWidget (QWidget *, bool nomax=FALSE)
void showMainDocumentWidget (QWidget *, bool nomax=FALSE)
bool keepRunning () const
bool keyboardGrabbed () const
int exec ()

Static Public Member Functions

QString qpeDir ()
QString documentDir ()
int defaultRotation ()
void setDefaultRotation (int r)
void setCurrentRotation (int r)
void setCurrentMode (int x, int y, int depth)
void grabKeyboard ()
void ungrabKeyboard ()
void setStylusOperation (QWidget *, StylusMode)
StylusMode stylusOperation (QWidget *)
void setInputMethodHint (QWidget *, InputMethodHint)
InputMethodHint inputMethodHint (QWidget *)
void showDialog (QDialog *, bool nomax=FALSE)
int execDialog (QDialog *, bool nomax=FALSE)
void showWidget (QWidget *, bool nomax=FALSE)
void setKeepRunning ()

Protected Member Functions

bool qwsEventFilter (QWSEvent *)
void internalSetStyle (const QString &style)
void prepareForTermination (bool willrestart)
virtual void restart ()
virtual void shutdown ()
bool eventFilter (QObject *, QEvent *)
void timerEvent (QTimerEvent *)
bool raiseAppropriateWindow ()
virtual void tryQuit ()
virtual void polish (QWidget *)

Detailed Description

The QPEApplication class implements various system services that are available to all Qtopia applications.

Simply by using QPEApplication instead of QApplication, a standard Qt application becomes a Qtopia application. It automatically follows style changes, quits and raises, and in the case of document-oriented applications, changes the currently displayed document in response to the environment.

To create a document-oriented application use showMainDocumentWidget(); to create a non-document-oriented application use showMainWidget(). The keepRunning() function indicates whether the application will continue running after it's processed the last QCop message. This can be changed using setKeepRunning().

A variety of signals are emitted when certain events occur, for example, timeChanged(), clockChanged(), weekChanged(), dateFormatChanged() and volumeChanged(). If the application receives a QCop message on the application's QPE/Application/{appname} channel, the appMessage() signal is emitted. There are also flush() and reload() signals, which are emitted when synching begins and ends respectively - upon these signals, the application should save and reload any data files that are involved in synching. Most of these signals will initially be received and unfiltered through the appMessage() signal.

This class also provides a set of useful static functions. The qpeDir() and documentDir() functions return the respective paths. The grabKeyboard() and ungrabKeyboard() functions are used to control whether the application takes control of the device's physical buttons (e.g. application launch keys). The stylus' mode of operation is set with setStylusOperation() and retrieved with stylusOperation(). There are also setInputMethodHint() and inputMethodHint() functions.

Definition at line 79 of file qpeapplication.h.


Member Enumeration Documentation

enum QPEApplication::StylusMode
 

LeftOnly the stylus only generates LeftButton events (the default). RightOnHold the stylus generates RightButton events if the user uses the press-and-hold gesture.

See also:
setStylusOperation() stylusOperation()

Definition at line 97 of file qpeapplication.h.

Referenced by eventFilter(), and stylusOperation().

enum QPEApplication::InputMethodHint
 

Normal the application sometimes needs text input (the default). AlwaysOff the application never needs text input. AlwaysOn the application always needs text input.

Definition at line 105 of file qpeapplication.h.

Referenced by inputMethodHint().


Constructor & Destructor Documentation

QPEApplication::QPEApplication int &  argc,
char **  argv,
Type  t = GuiClient
 

Constructs a QPEApplication just as you would construct a QApplication, passing argc, argv, and t.

For applications, t should be the default, GuiClient. Only the Qtopia server passes GuiServer.

Definition at line 597 of file qpeapplication.cpp.

References QDataStream::atEnd(), QFile::close(), QObject::connect(), QApplication::desktop(), QFile::handle(), QObject::installEventFilter(), QIODevice::isOpen(), QApplication::lastWindowClosed(), QFile::open(), QFile::remove(), QCString::replace(), AppLnk::setBigIconSize(), QPixmapCache::setCacheLimit(), QMimeSourceFactory::setDefaultFactory(), QToolTip::setEnabled(), QApplication::setFont(), and AppLnk::setSmallIconSize().

QPEApplication::~QPEApplication  ) 
 

Destroys the QPEApplication.

Definition at line 1019 of file qpeapplication.cpp.

References ungrabKeyboard().


Member Function Documentation

QString QPEApplication::qpeDir  )  [static]
 

Returns $OPIEDIR/.

Definition at line 1035 of file qpeapplication.cpp.

Referenced by MimeType::appsFolderName(), Resource::findPixmap(), Resource::findSound(), and FontDatabase::loadRenderers().

QString QPEApplication::documentDir  )  [static]
 

Returns the user's current Document directory. There is a trailing "/". .. well, it does now,, and there's no trailing '/'

Definition at line 1048 of file qpeapplication.cpp.

void QPEApplication::grabKeyboard  )  [static]
 

Grabs the physical keyboard keys, e.g. the application's launching keys. Instead of launching applications when these keys are pressed the signals emitted are sent to this application instead. Some games programs take over the launch keys in this way to make interaction easier.

See also:
ungrabKeyboard()

Definition at line 1935 of file qpeapplication.cpp.

void QPEApplication::ungrabKeyboard  )  [static]
 

Reverses the effect of grabKeyboard(). This is called automatically on program exit.

Definition at line 1921 of file qpeapplication.cpp.

Referenced by ~QPEApplication().

void QPEApplication::setStylusOperation QWidget w,
StylusMode  mode
[static]
 

Causes widget w to receive mouse events according to the stylus mode.

See also:
stylusOperation() StylusMode

Definition at line 1795 of file qpeapplication.cpp.

References QObject::connect(), QObject::destroyed(), QObject::installEventFilter(), and QObject::removeEventFilter().

Referenced by FileSelector::FileSelector().

QPEApplication::StylusMode QPEApplication::stylusOperation QWidget w  )  [static]
 

Returns the current StylusMode for widget w.

See also:
setStylusOperation() StylusMode

Definition at line 1771 of file qpeapplication.cpp.

References StylusMode.

void QPEApplication::setInputMethodHint QWidget w,
InputMethodHint  mode
[static]
 

Hints to the system that widget w has use for text input methods as specified by mode.

See also:
inputMethodHint() InputMethodHint

Definition at line 823 of file qpeapplication.cpp.

QPEApplication::InputMethodHint QPEApplication::inputMethodHint QWidget w  )  [static]
 

Returns the currently set hint to the system as to whether widget w has any use for text input methods.

See also:
setInputMethodHint() InputMethodHint

Definition at line 802 of file qpeapplication.cpp.

References InputMethodHint.

void QPEApplication::showMainWidget QWidget mw,
bool  nomaximize = FALSE
 

Sets widget mw as the mainWidget() and shows it. For small windows, consider passing TRUE for nomaximize rather than the default FALSE.

See also:
showMainDocumentWidget()

Definition at line 1572 of file qpeapplication.cpp.

References QApplication::setMainWidget().

void QPEApplication::showMainDocumentWidget QWidget mw,
bool  nomaximize = FALSE
 

Sets widget mw as the mainWidget() and shows it. For small windows, consider passing TRUE for nomaximize rather than the default FALSE.

This calls designates the application as a document-oriented application.

The mw widget must have this slot: setDocument(const QString&).

See also:
showMainWidget()

Definition at line 1589 of file qpeapplication.cpp.

References QApplication::argc(), QApplication::argv(), and QApplication::setMainWidget().

void QPEApplication::setKeepRunning  )  [static]
 

If an application is started via a QCop message, the application will process the QCop message and then quit. If the application calls this function while processing a QCop message, after processing its outstanding QCop messages the application will start 'properly' and show itself.

See also:
keepRunning()

Definition at line 1610 of file qpeapplication.cpp.

References d, and QObject::inherits().

bool QPEApplication::keepRunning  )  const
 

Returns TRUE if the application will quit after processing the current list of qcop messages; otherwise returns FALSE.

See also:
setKeepRunning()

Definition at line 1624 of file qpeapplication.cpp.

int QPEApplication::exec  ) 
 

Reimplemented from QApplication.

Definition at line 1943 of file qpeapplication.cpp.

References QApplication::exec(), and QApplication::processEvents().

void QPEApplication::appMessage const QCString msg,
const QByteArray data
[signal]
 

This signal is emitted when a message is received on this application's QPE/Application/appname QCop channel.

The slot to which you connect this signal uses msg and data in the following way:

     void MyWidget::receive( const QCString& msg, const QByteArray& data )
     {
       QDataStream stream( data, IO_ReadOnly );
       if ( msg == "someMessage(int,int,int)" ) {
            int a,b,c;
            stream >> a >> b >> c;
            ...
       } else if ( msg == "otherMessage(QString)" ) {
           ...
       }
    }

See also:
qcop.html Note that messages received here may be processed by qpe application and emitted as signals, such as flush() and reload().

bool QPEApplication::eventFilter QObject o,
QEvent e
[protected]
 

Reimplemented from QObject.

Definition at line 1814 of file qpeapplication.cpp.

References QMouseEvent::button(), QKeyEvent::count(), QKeyEvent::isAutoRepeat(), QKeyEvent::key(), QObject::killTimer(), QMouseEvent::pos(), QApplication::postEvent(), QObject::startTimer(), QKeyEvent::state(), StylusMode, and QEvent::type().

void QPEApplication::timerEvent QTimerEvent e  )  [protected]
 

Reimplemented from QObject.

Definition at line 1887 of file qpeapplication.cpp.

References QObject::killTimer(), QApplication::postEvent(), and QTimerEvent::timerId().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for OPIE Version 1.5.5.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:10 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001