summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/alarmserver.cpp11
-rw-r--r--library/qpeapplication.cpp2
2 files changed, 2 insertions, 11 deletions
diff --git a/library/alarmserver.cpp b/library/alarmserver.cpp
index 7e6e515..5e4dd18 100644
--- a/library/alarmserver.cpp
+++ b/library/alarmserver.cpp
@@ -1,401 +1,392 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qdir.h>
#include <qfile.h>
#include <qmessagebox.h>
#include <qtextstream.h>
#include <qpe/qpeapplication.h>
#include "global.h"
#include "resource.h"
#include <qpe/qcopenvelope_qws.h>
#include "alarmserver.h"
#include <qpe/timeconversion.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <unistd.h>
struct timerEventItem {
time_t UTCtime;
QCString channel, message;
int data;
bool operator==( const timerEventItem &right ) const
{
return ( UTCtime == right.UTCtime
&& channel == right.channel
&& message == right.message
&& data == right.data );
}
};
class TimerReceiverObject : public QObject
{
public:
TimerReceiverObject() { }
~TimerReceiverObject() { }
void resetTimer();
void setTimerEventItem();
void deleteTimer();
protected:
void timerEvent( QTimerEvent *te );
private:
QString atfilename;
};
TimerReceiverObject *timerEventReceiver = NULL;
QList<timerEventItem> timerEventList;
timerEventItem *nearestTimerEvent = NULL;
// set the timer to go off on the next event in the list
void setNearestTimerEvent()
{
nearestTimerEvent = NULL;
QListIterator<timerEventItem> it( timerEventList );
if ( *it )
nearestTimerEvent = *it;
for ( ; *it; ++it )
if ( (*it)->UTCtime < nearestTimerEvent->UTCtime )
nearestTimerEvent = *it;
if (nearestTimerEvent)
timerEventReceiver->resetTimer();
else
timerEventReceiver->deleteTimer();
}
//store current state to file
//Simple implementation. Should run on a timer.
static void saveState()
{
QString savefilename = Global::applicationFileName( "AlarmServer", "saveFile" );
if ( timerEventList.isEmpty() ) {
unlink( savefilename );
return;
}
QFile savefile(savefilename+".new");
if ( savefile.open(IO_WriteOnly) ) {
QDataStream ds( &savefile );
//save
QListIterator<timerEventItem> it( timerEventList );
for ( ; *it; ++it ) {
ds << it.current()->UTCtime;
ds << it.current()->channel;
ds << it.current()->message;
ds << it.current()->data;
}
savefile.close();
unlink( savefilename );
QDir d; d.rename(savefilename+".new",savefilename);
}
}
/*!
Sets up the alarm server. Restoring to previous state (session management).
*/
void AlarmServer::initialize()
{
//read autosave file and put events in timerEventList
QString savefilename = Global::applicationFileName( "AlarmServer", "saveFile" );
QFile savefile(savefilename);
if ( savefile.open(IO_ReadOnly) ) {
QDataStream ds( &savefile );
while ( !ds.atEnd() ) {
timerEventItem *newTimerEventItem = new timerEventItem;
ds >> newTimerEventItem->UTCtime;
ds >> newTimerEventItem->channel;
ds >> newTimerEventItem->message;
ds >> newTimerEventItem->data;
timerEventList.append( newTimerEventItem );
}
savefile.close();
if (!timerEventReceiver)
timerEventReceiver = new TimerReceiverObject;
setNearestTimerEvent();
}
}
static const char* atdir = "/var/spool/at/";
static bool triggerAtd( bool writeHWClock = FALSE )
{
QFile trigger(QString(atdir) + "trigger");
if ( trigger.open(IO_WriteOnly|IO_Raw) ) {
-
- const char* data =
-#ifdef QT_QWS_SHARP
- //custom atd only writes HW Clock if we write a 'W'
- ( writeHWClock ) ? "W\n" :
-#endif
- data = "\n";
- int len = strlen(data);
- int total_written = trigger.writeBlock(data,len);
- if ( total_written != len ) {
+ if ( trigger.writeBlock("\n",2) != 2 ) {
QMessageBox::critical( 0, QObject::tr( "Out of Space" ),
QObject::tr( "Unable to schedule alarm.\nFree some memory and try again." ) );
trigger.close();
QFile::remove( trigger.name() );
return FALSE;
}
return TRUE;
}
return FALSE;
}
void TimerReceiverObject::deleteTimer()
{
if ( !atfilename.isEmpty() ) {
unlink( atfilename );
atfilename = QString::null;
triggerAtd( FALSE );
}
}
void TimerReceiverObject::resetTimer()
{
const int maxsecs = 2147000;
int total_written;
QDateTime nearest = TimeConversion::fromUTC(nearestTimerEvent->UTCtime);
QDateTime now = QDateTime::currentDateTime();
if ( nearest < now )
nearest = now;
int secs = TimeConversion::secsTo( now, nearest );
if ( secs > maxsecs ) {
// too far for millisecond timing
secs = maxsecs;
}
// System timer (needed so that we wake from deep sleep),
// from the Epoch in seconds.
//
int at_secs = TimeConversion::toUTC(nearest);
// qDebug("reset timer to %d seconds from Epoch",at_secs);
QString fn = atdir + QString::number(at_secs) + "."
+ QString::number(getpid());
if ( fn != atfilename ) {
QFile atfile(fn+".new");
if ( atfile.open(IO_WriteOnly|IO_Raw) ) {
// just wake up and delete the at file
QString cmd = "#!/bin/sh\nrm " + fn;
total_written = atfile.writeBlock(cmd.latin1(),cmd.length());
if ( total_written != int(cmd.length()) ) {
QMessageBox::critical( 0, tr("Out of Space"),
tr("Unable to schedule alarm.\n"
"Please free up space and try again") );
atfile.close();
QFile::remove( atfile.name() );
return;
}
atfile.close();
unlink( atfilename );
QDir d; d.rename(fn+".new",fn);
chmod(fn.latin1(),0755);
atfilename = fn;
triggerAtd( FALSE );
} else {
qWarning("Cannot open atd file %s",fn.latin1());
}
}
// Qt timers (does the actual alarm)
// from now in milliseconds
//
qDebug("AlarmServer waiting %d seconds",secs);
startTimer( 1000 * secs + 500 );
}
void TimerReceiverObject::timerEvent( QTimerEvent * )
{
bool needSave = FALSE;
killTimers();
if (nearestTimerEvent) {
if ( nearestTimerEvent->UTCtime
<= TimeConversion::toUTC(QDateTime::currentDateTime()) ) {
#ifndef QT_NO_COP
QCopEnvelope e( nearestTimerEvent->channel,
nearestTimerEvent->message );
e << TimeConversion::fromUTC( nearestTimerEvent->UTCtime )
<< nearestTimerEvent->data;
#endif
timerEventList.remove( nearestTimerEvent );
needSave = TRUE;
}
setNearestTimerEvent();
} else {
resetTimer();
}
if ( needSave )
saveState();
}
/*!
\class AlarmServer alarmserver.h
\brief The AlarmServer class allows alarms to be scheduled and unscheduled.
Applications can schedule alarms with addAlarm() and can
unschedule alarms with deleteAlarm(). When the time for an alarm
to go off is reached the specified \link qcop.html QCop\endlink
message is sent on the specified channel (optionally with
additional data).
Scheduling an alarm using this class is important (rather just using
a QTimer) since the machine may be asleep and needs to get woken up using
the Linux kernel which implements this at the kernel level to minimize
battery usage while asleep.
\ingroup qtopiaemb
\sa QCopEnvelope
*/
/*!
Schedules an alarm to go off at (or soon after) time \a when. When
the alarm goes off, the \link qcop.html QCop\endlink \a message will
be sent to \a channel, with \a data as a parameter.
If this function is called with exactly the same data as a previous
call the subsequent call is ignored, so there is only ever one alarm
with a given set of parameters.
\sa deleteAlarm()
*/
void AlarmServer::addAlarm ( QDateTime when, const QCString& channel,
const QCString& message, int data)
{
if ( qApp->type() == QApplication::GuiServer ) {
bool needSave = FALSE;
// Here we are the server so either it has been directly called from
// within the server or it has been sent to us from a client via QCop
if (!timerEventReceiver)
timerEventReceiver = new TimerReceiverObject;
timerEventItem *newTimerEventItem = new timerEventItem;
newTimerEventItem->UTCtime = TimeConversion::toUTC( when );
newTimerEventItem->channel = channel;
newTimerEventItem->message = message;
newTimerEventItem->data = data;
// explore the case of already having the event in here...
QListIterator<timerEventItem> it( timerEventList );
for ( ; *it; ++it )
if ( *(*it) == *newTimerEventItem )
return;
// if we made it here, it is okay to add the item...
timerEventList.append( newTimerEventItem );
needSave = TRUE;
// quicker than using setNearestTimerEvent()
if ( nearestTimerEvent ) {
if (newTimerEventItem->UTCtime < nearestTimerEvent->UTCtime) {
nearestTimerEvent = newTimerEventItem;
timerEventReceiver->killTimers();
timerEventReceiver->resetTimer();
}
} else {
nearestTimerEvent = newTimerEventItem;
timerEventReceiver->resetTimer();
}
if ( needSave )
saveState();
} else {
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/System", "addAlarm(QDateTime,QCString,QCString,int)" );
e << when << channel << message << data;
#endif
}
}
/*!
Deletes previously scheduled alarms which match \a when, \a channel,
\a message, and \a data.
Passing null values for \a when, \a channel, or for the \link
qcop.html QCop\endlink \a message, acts as a wildcard meaning "any".
Similarly, passing -1 for \a data indicates "any".
If there is no matching alarm, nothing happens.
\sa addAlarm()
*/
void AlarmServer::deleteAlarm (QDateTime when, const QCString& channel, const QCString& message, int data)
{
if ( qApp->type() == QApplication::GuiServer) {
bool needSave = FALSE;
if ( timerEventReceiver != NULL ) {
timerEventReceiver->killTimers();
// iterate over the list of events
QListIterator<timerEventItem> it( timerEventList );
time_t deleteTime = TimeConversion::toUTC( when );
for ( ; *it; ++it ) {
// if its a match, delete it
if ( ( (*it)->UTCtime == deleteTime || when.isNull() )
&& ( channel.isNull() || (*it)->channel == channel )
&& ( message.isNull() || (*it)->message == message )
&& ( data==-1 || (*it)->data == data ) )
{
// if it's first, then we need to update the timer
if ( (*it) == nearestTimerEvent ) {
timerEventList.remove(*it);
setNearestTimerEvent();
} else {
timerEventList.remove(*it);
}
needSave = TRUE;
}
}
if ( nearestTimerEvent )
timerEventReceiver->resetTimer();
}
if ( needSave )
saveState();
} else {
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/System", "deleteAlarm(QDateTime,QCString,QCString,int)" );
e << when << channel << message << data;
#endif
}
}
/*!
Writes the system clock to the hardware clock.
*/
void Global::writeHWClock()
{
if ( !triggerAtd( TRUE ) ) {
// atd not running? set it ourselves
system("/sbin/hwclock --systohc"); // ##### UTC?
}
}
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 65fac84..efa65bc 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -1128,575 +1128,575 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
}
else if ( msg == "quitIfInvisible()" ) {
if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() )
quit();
}
else if ( msg == "close()" ) {
hideOrQuit();
}
else if ( msg == "disablePreload()" ) {
d->preloaded = FALSE;
d->keep_running = TRUE;
/* so that quit will quit */
}
else if ( msg == "enablePreload()" ) {
if (d->qpe_main_widget)
d->preloaded = TRUE;
d->keep_running = TRUE;
/* so next quit won't quit */
}
else if ( msg == "raise()" ) {
d->keep_running = TRUE;
d->notbusysent = FALSE;
raiseAppropriateWindow();
// Tell the system we're still chugging along...
QCopEnvelope e("QPE/System", "appRaised(QString)");
e << d->appName;
}
else if ( msg == "flush()" ) {
emit flush();
// we need to tell the desktop
QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" );
e << d->appName;
}
else if ( msg == "reload()" ) {
emit reload();
}
else if ( msg == "setDocument(QString)" ) {
d->keep_running = TRUE;
QDataStream stream( data, IO_ReadOnly );
QString doc;
stream >> doc;
QWidget *mw = mainWidget();
if ( !mw )
mw = d->qpe_main_widget;
if ( mw )
Global::setDocument( mw, doc );
}
else if ( msg == "nextView()" ) {
qDebug("got nextView()");
/*
if ( raiseAppropriateWindow() )
*/
emit appMessage( msg, data);
}
else {
emit appMessage( msg, data);
}
#endif
}
/*!
Sets widget \a mw as the mainWidget() and shows it. For small windows,
consider passing TRUE for \a nomaximize rather than the default FALSE.
\sa showMainDocumentWidget()
*/
void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize )
{
d->show(mw, nomaximize );
}
/*!
Sets widget \a mw as the mainWidget() and shows it. For small windows,
consider passing TRUE for \a nomaximize rather than the default FALSE.
This calls designates the application as
a \link docwidget.html document-oriented\endlink application.
The \a mw widget \e must have this slot: setDocument(const QString&).
\sa showMainWidget()
*/
void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize )
{
if ( mw && argc() == 2 )
Global::setDocument( mw, QString::fromUtf8(argv()[1]) );
d->show(mw, nomaximize );
}
/*!
If an application is started via a \link qcop.html QCop\endlink
message, the application will process the \link qcop.html
QCop\endlink message and then quit. If the application calls this
function while processing a \link qcop.html QCop\endlink message,
after processing its outstanding \link qcop.html QCop\endlink
messages the application will start 'properly' and show itself.
\sa keepRunning()
*/
void QPEApplication::setKeepRunning()
{
if ( qApp && qApp->inherits( "QPEApplication" ) ) {
QPEApplication * qpeApp = ( QPEApplication* ) qApp;
qpeApp->d->keep_running = TRUE;
}
}
/*!
Returns TRUE if the application will quit after processing the
current list of qcop messages; otherwise returns FALSE.
\sa setKeepRunning()
*/
bool QPEApplication::keepRunning() const
{
return d->keep_running;
}
/*!
\internal
*/
void QPEApplication::internalSetStyle( const QString &style )
{
#if QT_VERSION >= 300
if ( style == "QPE" ) {
setStyle( new QPEStyle );
}
else {
QStyle *s = QStyleFactory::create( style );
if ( s )
setStyle( s );
}
#else
if ( style == "Windows" ) {
setStyle( new QWindowsStyle );
}
else if ( style == "QPE" ) {
setStyle( new QPEStyle );
}
else if ( style == "Light" ) {
setStyle( new LightStyle );
}
#ifndef QT_NO_STYLE_PLATINUM
else if ( style == "Platinum" ) {
setStyle( new QPlatinumStyle );
}
#endif
#ifndef QT_NO_STYLE_MOTIF
else if ( style == "Motif" ) {
setStyle( new QMotifStyle );
}
#endif
#ifndef QT_NO_STYLE_MOTIFPLUS
else if ( style == "MotifPlus" ) {
setStyle( new QMotifPlusStyle );
}
#endif
else {
QStyle *sty = 0;
QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/";
if ( style. find ( ".so" ) > 0 )
path += style;
else
path = path + "lib" + style. lower ( ) + ".so"; // compatibility
static QLibrary *lastlib = 0;
static StyleInterface *lastiface = 0;
QLibrary *lib = new QLibrary ( path );
StyleInterface *iface = 0;
if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface )
sty = iface-> style ( );
if ( sty ) {
setStyle ( sty );
if ( lastiface )
lastiface-> release ( );
lastiface = iface;
if ( lastlib ) {
lastlib-> unload ( );
delete lastlib;
}
lastlib = lib;
}
else {
if ( iface )
iface-> release ( );
delete lib;
setStyle ( new QPEStyle ( ));
}
}
#endif
}
/*!
\internal
*/
void QPEApplication::prepareForTermination( bool willrestart )
{
if ( willrestart ) {
// Draw a big wait icon, the image can be altered in later revisions
// QWidget *d = QApplication::desktop();
QImage img = Resource::loadImage( "launcher/new_wait" );
QPixmap pix;
pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) );
QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize |
QWidget::WStyle_NoBorder | QWidget::WStyle_Tool );
lblWait->setPixmap( pix );
lblWait->setAlignment( QWidget::AlignCenter );
lblWait->show();
lblWait->showMaximized();
}
#ifndef SINGLE_APP
{ QCopEnvelope envelope( "QPE/System", "forceQuit()" );
}
processEvents(); // ensure the message goes out.
sleep( 1 ); // You have 1 second to comply.
#endif
}
/*!
\internal
*/
void QPEApplication::shutdown()
{
// Implement in server's QPEApplication subclass
}
/*!
\internal
*/
void QPEApplication::restart()
{
// Implement in server's QPEApplication subclass
}
static QPtrDict<void>* stylusDict = 0;
static void createDict()
{
if ( !stylusDict )
stylusDict = new QPtrDict<void>;
}
/*!
Returns the current StylusMode for widget \a w.
\sa setStylusOperation() StylusMode
*/
QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w )
{
if ( stylusDict )
return ( StylusMode ) ( int ) stylusDict->find( w );
return LeftOnly;
}
/*!
\enum QPEApplication::StylusMode
\value LeftOnly the stylus only generates LeftButton
events (the default).
\value RightOnHold the stylus generates RightButton events
if the user uses the press-and-hold gesture.
\sa setStylusOperation() stylusOperation()
*/
/*!
Causes widget \a w to receive mouse events according to the stylus
\a mode.
\sa stylusOperation() StylusMode
*/
void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode )
{
createDict();
if ( mode == LeftOnly ) {
stylusDict->remove
( w );
w->removeEventFilter( qApp );
}
else {
stylusDict->insert( w, ( void* ) mode );
connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) );
w->installEventFilter( qApp );
}
}
/*!
\reimp
*/
bool QPEApplication::eventFilter( QObject *o, QEvent *e )
{
if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) {
QMouseEvent * me = ( QMouseEvent* ) e;
StylusMode mode = (StylusMode)(int)stylusDict->find(o);
switch (mode) {
case RightOnHold:
switch ( me->type() ) {
case QEvent::MouseButtonPress:
if ( me->button() == LeftButton ) {
d->presstimer = startTimer(500); // #### pref.
d->presswidget = (QWidget*)o;
d->presspos = me->pos();
d->rightpressed = FALSE;
}
break;
case QEvent::MouseMove:
if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) {
killTimer(d->presstimer);
d->presstimer = 0;
}
break;
case QEvent::MouseButtonRelease:
if ( me->button() == LeftButton ) {
if ( d->presstimer ) {
killTimer(d->presstimer);
d->presstimer = 0;
}
if ( d->rightpressed && d->presswidget ) {
// Right released
postEvent( d->presswidget,
new QMouseEvent( QEvent::MouseButtonRelease, me->pos(),
RightButton, LeftButton + RightButton ) );
// Left released, off-widget
postEvent( d->presswidget,
new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1),
LeftButton, LeftButton ) );
postEvent( d->presswidget,
new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1),
LeftButton, LeftButton ) );
d->rightpressed = FALSE;
return TRUE; // don't send the real Left release
}
}
break;
default:
break;
}
break;
default:
;
}
}
else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
QKeyEvent *ke = (QKeyEvent *)e;
if ( ke->key() == Key_Enter ) {
if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) {
postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ',
ke->state(), " ", ke->isAutoRepeat(), ke->count() ) );
return TRUE;
}
}
}
return FALSE;
}
/*!
\reimp
*/
void QPEApplication::timerEvent( QTimerEvent *e )
{
if ( e->timerId() == d->presstimer && d->presswidget ) {
// Right pressed
postEvent( d->presswidget,
new QMouseEvent( QEvent::MouseButtonPress, d->presspos,
RightButton, LeftButton ) );
killTimer( d->presstimer );
d->presstimer = 0;
d->rightpressed = TRUE;
}
}
void QPEApplication::removeSenderFromStylusDict()
{
stylusDict->remove
( ( void* ) sender() );
if ( d->presswidget == sender() )
d->presswidget = 0;
}
/*!
\internal
*/
bool QPEApplication::keyboardGrabbed() const
{
return d->kbgrabber;
}
/*!
Reverses the effect of grabKeyboard(). This is called automatically
on program exit.
*/
void QPEApplication::ungrabKeyboard()
{
QPEApplicationData * d = ( ( QPEApplication* ) qApp ) ->d;
if ( d->kbgrabber == 2 ) {
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" );
e << QString::null;
#endif
d->kbregrab = FALSE;
d->kbgrabber = 0;
}
}
/*!
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.
\sa ungrabKeyboard()
*/
void QPEApplication::grabKeyboard()
{
QPEApplicationData * d = ( ( QPEApplication* ) qApp ) ->d;
if ( qApp->type() == QApplication::GuiServer )
d->kbgrabber = 0;
else {
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" );
e << d->appName;
#endif
d->kbgrabber = 2; // me
}
}
/*!
\reimp
*/
int QPEApplication::exec()
{
#ifndef QT_NO_COP
d->sendQCopQ();
#endif
if ( d->keep_running )
//|| d->qpe_main_widget && d->qpe_main_widget->isVisible() )
return QApplication::exec();
#ifndef QT_NO_COP
{
QCopEnvelope e( "QPE/System", "closing(QString)" );
e << d->appName;
}
#endif
processEvents();
return 0;
}
/*!
\internal
External request for application to quit. Quits if possible without
loosing state.
*/
void QPEApplication::tryQuit()
{
if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 )
return ; // Inside modal loop or konsole. Too hard to save state.
#ifndef QT_NO_COP
{
QCopEnvelope e( "QPE/System", "closing(QString)" );
e << d->appName;
}
#endif
processEvents();
quit();
}
/*!
\internal
User initiated quit. Makes the window 'Go Away'. If preloaded this means
hiding the window. If not it means quitting the application.
As this is user initiated we don't need to check state.
*/
void QPEApplication::hideOrQuit()
{
processEvents();
// If we are a preloaded application we don't actually quit, so emit
// a System message indicating we're quasi-closing.
if ( d->preloaded && d->qpe_main_widget )
#ifndef QT_NO_COP
{
QCopEnvelope e("QPE/System", "fastAppHiding(QString)" );
e << d->appName;
d->qpe_main_widget->hide();
}
#endif
else
quit();
}
-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
+#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SHARP)
// The libraries with the skiff package (and possibly others) have
// completely useless implementations of builtin new and delete that
// use about 50% of your CPU. Here we revert to the simple libc
// functions.
void* operator new[]( size_t size )
{
return malloc( size );
}
void* operator new( size_t size )
{
return malloc( size );
}
void operator delete[]( void* p )
{
free( p );
}
void operator delete[]( void* p, size_t /*size*/ )
{
free( p );
}
void operator delete( void* p )
{
free( p );
}
void operator delete( void* p, size_t /*size*/ )
{
free( p );
}
#endif
#if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP)
#include <qwidgetlist.h>
#ifdef QWS
#include <qgfx_qws.h>
extern QRect qt_maxWindowRect;
void qt_setMaxWindowRect(const QRect& r )
{
qt_maxWindowRect = qt_screen->mapFromDevice( r,
qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) );
// Re-resize any maximized windows
QWidgetList* l = QApplication::topLevelWidgets();
if ( l ) {
QWidget * w = l->first();
while ( w ) {
if ( w->isVisible() && w->isMaximized() ) {
w->showMaximized();
}
w = l->next();
}
delete l;
}
}
#endif
#endif