author | jeremy <jeremy> | 2002-02-15 15:46:12 (UTC) |
---|---|---|
committer | jeremy <jeremy> | 2002-02-15 15:46:12 (UTC) |
commit | e6125036c4260fb9aeb40105c1ec58777678792b (patch) (side-by-side diff) | |
tree | fe6c6e1bf574560ec83d638ca61fe86fdb75011c | |
parent | 7c4ee87ab334a8e245d8345b378400bf787a7d5a (diff) | |
download | opie-e6125036c4260fb9aeb40105c1ec58777678792b.zip opie-e6125036c4260fb9aeb40105c1ec58777678792b.tar.gz opie-e6125036c4260fb9aeb40105c1ec58777678792b.tar.bz2 |
Adding support for the ipaq's rec button. Not totally functioning yet, but
getting there.
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 9c0025d..8875cdf 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp @@ -141,6 +141,10 @@ VMemo::VMemo( QWidget *parent, const char *name ) recording = FALSE; + myChannel = new QCopChannel( "QPE/VMemo", this ); + connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), + this, SLOT(receive(const QCString&, const QByteArray&)) ); + struct utsname name; /* check for embedix kernel running on the zaurus, if lineo change string, this break */ @@ -151,15 +155,70 @@ VMemo::VMemo( QWidget *parent, const char *name ) if(release.find("embedix",0,TRUE) !=-1) systemZaurus=TRUE; else + { + int fr; systemZaurus=FALSE; + + if ((fr = fork()) == -1) + { + qWarning("Fork failed"); } + else if (fr == 0) + { + int key, max; + fd_set fdr; + char buffer[10]; + key = open("/dev/touchscreen/key", O_RDONLY); + if (key == -1) + { + qWarning("Could not open key"); + exit(1); + } + + while(1) + { + FD_ZERO(&fdr); + FD_SET(key, &fdr); + max = key; + + qWarning("while"); + + read(key, buffer, 10); + if(*buffer == (char)129) + { + qWarning("REC = stop"); + QCopEnvelope( "QPE/VMemo", "toggleRecord()"); + activate_signal("toggleRecordNow()"); + } + else if(*buffer == (char)1) + { + qWarning("REC = start"); + QCopEnvelope( "QPE/VMemo", "toggleRecord()"); + activate_signal("toggleRecordNow()"); + } + } + } + else if(fr) + qWarning("parent: Fork = good"); + } + } + qWarning("VMemo done init"); } VMemo::~VMemo() { } +void VMemo::receive( const QCString &msg, const QByteArray &data ) +{ + QDataStream stream( data, IO_ReadOnly ); + qWarning(msg); + if ( msg == "toggleRecord()" ) { + qWarning("Hello"); + } +} + void VMemo::paintEvent( QPaintEvent* ) { QPainter p(this); |