summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--library/qpeapplication.cpp189
1 files changed, 133 insertions, 56 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index f65f3ab..2432b65 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -88,3 +88,4 @@
-class QPEApplicationData {
+class QPEApplicationData
+{
public:
@@ -101,11 +102,16 @@ public:
QPoint presspos;
- bool rightpressed : 1; // AEH why not use uint foobar :1; if it's tt style -zecke
+bool rightpressed :
+ 1; // AEH why not use uint foobar :1; if it's tt style -zecke
int kbgrabber;
- bool kbregrab : 1;
- bool notbusysent : 1;
+bool kbregrab :
+ 1;
+bool notbusysent :
+ 1;
QString appName;
- struct QCopRec {
+ struct QCopRec
+ {
QCopRec( const QCString &ch, const QCString &msg,
const QByteArray &d ) :
- channel( ch ), message( msg ), data( d ) { }
+ channel( ch ), message( msg ), data( d )
+ { }
@@ -115,7 +121,11 @@ public:
};
- bool preloaded : 1;
- bool forceshow : 1;
- bool nomaximize : 1;
+bool preloaded :
+ 1;
+bool forceshow :
+ 1;
+bool nomaximize :
+ 1;
QWidget* qpe_main_widget;
- bool keep_running : 1;
+bool keep_running :
+ 1;
QList<QCopRec> qcopq;
@@ -127,5 +137,7 @@ public:
}
- void sendQCopQ() {
+ void sendQCopQ()
+ {
QCopRec * r;
#ifndef QT_NO_COP
+
for ( QListIterator<QCopRec> it( qcopq ); ( r = it.current() ); ++it )
@@ -133,8 +145,11 @@ public:
#endif
+
qcopq.clear();
}
- static void show_mx(QWidget* mw, bool nomaximize) {
+ static void show_mx(QWidget* mw, bool nomaximize)
+ {
if ( mw->layout() && mw->inherits("QDialog") ) {
QPEApplication::showDialog((QDialog*)mw,nomaximize);
- } else {
+ }
+ else {
#ifdef Q_WS_QWS
@@ -144,2 +159,3 @@ public:
#endif
+
mw->show();
@@ -177,4 +193,6 @@ public:
#ifndef QT_NO_COP
+
sendQCopQ();
#endif
+
if ( preloaded ) {
@@ -182,3 +200,4 @@ public:
show_mx(mw,nomax);
- } else if ( keep_running ) {
+ }
+ else if ( keep_running ) {
show_mx(mw,nomax);
@@ -202,3 +221,4 @@ public:
}
- } else {
+ }
+ else {
lib->unload();
@@ -224,3 +244,4 @@ public:
}
- } else {
+ }
+ else {
lib->unload();
@@ -234,3 +255,4 @@ public:
-class ResourceMimeFactory : public QMimeSourceFactory {
+class ResourceMimeFactory : public QMimeSourceFactory
+{
public:
@@ -450,3 +472,4 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t )
AppLnk::setBigIconSize( 28 );
- }else if ( dw > 600 ) {
+ }
+ else if ( dw > 600 ) {
setFont( QFont( "helvetica", 12 ) );
@@ -454,3 +477,4 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t )
AppLnk::setBigIconSize( 48 );
- }else if ( dw > 200 ) {
+ }
+ else if ( dw > 200 ) {
setFont( QFont( "helvetica", 12 ) );
@@ -549,2 +573,3 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t )
#ifdef QWS
+
if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {
@@ -554,2 +579,3 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t )
#endif
+
}
@@ -623,4 +649,10 @@ class HackDialog : public QDialog
public:
- void acceptIt() { accept(); }
- void rejectIt() { reject(); }
+ void acceptIt()
+ {
+ accept();
+ }
+ void rejectIt()
+ {
+ reject();
+ }
};
@@ -641,2 +673,3 @@ void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key )
#ifdef QWS
+
ke->simpleData.keycode = key;
@@ -649,3 +682,5 @@ public:
bool needsOk()
- { return ( getWState() & WState_Reserved1 ); }
+ {
+ return ( getWState() & WState_Reserved1 );
+ }
};
@@ -709,3 +744,4 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e )
}
- } else if ( ke->simpleData.keycode == Qt::Key_F30 ) {
+ }
+ else if ( ke->simpleData.keycode == Qt::Key_F30 ) {
// Use special "select" key to do whatever default action a widget has
@@ -853,6 +889,10 @@ void QPEApplication::setDefaultRotation( int r )
config.writeEntry( "Screen", getenv("QWS_DISPLAY") );
- } else {
+ }
+ else {
#ifndef QT_NO_COP
- { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); e << r; }
+ { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" );
+ e << r;
+ }
#endif
+
}
@@ -912,3 +952,4 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
applyStyle();
- } else if ( msg == "setDefaultRotation(int)" ) {
+ }
+ else if ( msg == "setDefaultRotation(int)" ) {
if ( type() == GuiServer ) {
@@ -918,15 +959,20 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
}
- } else if ( msg == "shutdown()" ) {
+ }
+ else if ( msg == "shutdown()" ) {
if ( type() == GuiServer )
shutdown();
- } else if ( msg == "quit()" ) {
+ }
+ else if ( msg == "quit()" ) {
if ( type() != GuiServer )
tryQuit();
- } else if ( msg == "forceQuit()" ) {
+ }
+ else if ( msg == "forceQuit()" ) {
if ( type() != GuiServer )
quit();
- } else if ( msg == "restart()" ) {
+ }
+ else if ( msg == "restart()" ) {
if ( type() == GuiServer )
restart();
- } else if ( msg == "grabKeyboard(QString)" ) {
+ }
+ else if ( msg == "grabKeyboard(QString)" ) {
QString who;
@@ -939,3 +985,4 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
d->kbgrabber = 2;
- } else if ( msg == "language(QString)" ) {
+ }
+ else if ( msg == "language(QString)" ) {
if ( type() == GuiServer ) {
@@ -952,3 +999,4 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
}
- } else if ( msg == "timeChange(QString)" ) {
+ }
+ else if ( msg == "timeChange(QString)" ) {
QString t;
@@ -961,3 +1009,4 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
emit timeChanged();
- } else if ( msg == "execute(QString)" ) {
+ }
+ else if ( msg == "execute(QString)" ) {
if ( type() == GuiServer ) {
@@ -967,3 +1016,4 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
}
- } else if ( msg == "execute(QString,QString)" ) {
+ }
+ else if ( msg == "execute(QString,QString)" ) {
if ( type() == GuiServer ) {
@@ -973,3 +1023,4 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
}
- } else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) {
+ }
+ else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) {
if ( type() == GuiServer ) {
@@ -981,3 +1032,4 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
}
- } else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) {
+ }
+ else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) {
if ( type() == GuiServer ) {
@@ -989,3 +1041,4 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
}
- } else if ( msg == "clockChange(bool)" ) {
+ }
+ else if ( msg == "clockChange(bool)" ) {
int tmp;
@@ -993,3 +1046,4 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
emit clockChanged( tmp );
- } else if ( msg == "weekChange(bool)" ) {
+ }
+ else if ( msg == "weekChange(bool)" ) {
int tmp;
@@ -997,3 +1051,4 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
emit weekChanged( tmp );
- } else if ( msg == "setDateFormat(DateFormat)" ) {
+ }
+ else if ( msg == "setDateFormat(DateFormat)" ) {
DateFormat tmp;
@@ -1001,3 +1056,4 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
emit dateFormatChanged( tmp );
- } else if ( msg == "setVolume(int,int)" ) {
+ }
+ else if ( msg == "setVolume(int,int)" ) {
int t, v;
@@ -1006,3 +1062,4 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
emit volumeChanged( muted );
- } else if ( msg == "volumeChange(bool)" ) {
+ }
+ else if ( msg == "volumeChange(bool)" ) {
stream >> muted;
@@ -1010,3 +1067,4 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
emit volumeChanged( muted );
- } else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
+ }
+ else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
int t, v;
@@ -1015,3 +1073,4 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data
emit micChanged( micMuted );
- } else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
+ }
+ else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
stream >> micMuted;
@@ -1032,3 +1091,4 @@ bool QPEApplication::raiseAppropriateWindow()
QWidget *top = d->qpe_main_widget;
- if ( !top ) top =mainWidget();
+ if ( !top )
+ top = mainWidget();
if ( top && d->keep_running ) {
@@ -1067,8 +1127,11 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
tryQuit();
- } else if ( msg == "quitIfInvisible()" ) {
+ }
+ else if ( msg == "quitIfInvisible()" ) {
if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() )
quit();
- } else if ( msg == "close()" ) {
+ }
+ else if ( msg == "close()" ) {
hideOrQuit();
- } else if ( msg == "disablePreload()" ) {
+ }
+ else if ( msg == "disablePreload()" ) {
d->preloaded = FALSE;
@@ -1076,3 +1139,4 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
/* so that quit will quit */
- } else if ( msg == "enablePreload()" ) {
+ }
+ else if ( msg == "enablePreload()" ) {
if (d->qpe_main_widget)
@@ -1081,3 +1145,4 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
/* so next quit won't quit */
- } else if ( msg == "raise()" ) {
+ }
+ else if ( msg == "raise()" ) {
d->keep_running = TRUE;
@@ -1088,3 +1153,4 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
e << d->appName;
- } else if ( msg == "flush()" ) {
+ }
+ else if ( msg == "flush()" ) {
emit flush();
@@ -1093,5 +1159,7 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
e << d->appName;
- } else if ( msg == "reload()" ) {
+ }
+ else if ( msg == "reload()" ) {
emit reload();
- } else if ( msg == "setDocument(QString)" ) {
+ }
+ else if ( msg == "setDocument(QString)" ) {
d->keep_running = TRUE;
@@ -1105,3 +1173,4 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
Global::setDocument( mw, doc );
- } else if ( msg == "nextView()" ) {
+ }
+ else if ( msg == "nextView()" ) {
qDebug("got nextView()");
@@ -1111,3 +1180,4 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
emit appMessage( msg, data);
- } else {
+ }
+ else {
emit appMessage( msg, data);
@@ -1410,3 +1480,4 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e )
}
- }else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
+ }
+ else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
QKeyEvent *ke = (QKeyEvent *)e;
@@ -1468,2 +1539,3 @@ void QPEApplication::ungrabKeyboard()
#endif
+
d->kbregrab = FALSE;
@@ -1492,2 +1564,3 @@ void QPEApplication::grabKeyboard()
#endif
+
d->kbgrabber = 2; // me
@@ -1504,2 +1577,3 @@ int QPEApplication::exec()
#endif
+
if ( d->keep_running )
@@ -1509,2 +1583,3 @@ int QPEApplication::exec()
#ifndef QT_NO_COP
+
{
@@ -1528,2 +1603,3 @@ void QPEApplication::tryQuit()
#ifndef QT_NO_COP
+
{
@@ -1552,2 +1628,3 @@ void QPEApplication::hideOrQuit()
#ifndef QT_NO_COP
+
{