summaryrefslogtreecommitdiff
authorsandman <sandman>2002-11-17 02:32:39 (UTC)
committer sandman <sandman>2002-11-17 02:32:39 (UTC)
commit22108a3617e8b79acaddea61c1f7f6a0a5117306 (patch) (side-by-side diff)
tree84d896d80e1228b1c39b48cc732bb17cf9960053
parent9ed0a6022d4c3bcd8428096cdf28cad1e0355ab2 (diff)
downloadopie-22108a3617e8b79acaddea61c1f7f6a0a5117306.zip
opie-22108a3617e8b79acaddea61c1f7f6a0a5117306.tar.gz
opie-22108a3617e8b79acaddea61c1f7f6a0a5117306.tar.bz2
- another QT_QWS_EBX -> QT_QWS_SHARP
- since OZ is going to use opieatd/opiealarm, we can ditch the "custom atd" support
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
@@ -111,106 +111,97 @@ static void saveState()
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()) ) {
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 65fac84..efa65bc 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -1592,97 +1592,97 @@ int QPEApplication::exec()
}
/*!
\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