From 7c12000481b535ce54951ef8a53b439814f8fcd6 Mon Sep 17 00:00:00 2001 From: llornkcor Date: Fri, 12 Jul 2002 04:53:07 +0000 Subject: try to fix taskbar icon foofaa --- (limited to 'core/applets/vmemo') diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 2c3edf1..b77e3b8 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp @@ -254,9 +254,11 @@ void VMemo::receive( const QCString &msg, const QByteArray &data ) if (msg == "toggleRecord()") { if (recording) { fromToggle = TRUE; - stopRecording(); + mouseReleaseEvent(NULL); +// stopRecording(); } else { fromToggle = TRUE; + // mousePressEvent(NULL); startRecording(); } } @@ -268,9 +270,21 @@ void VMemo::paintEvent( QPaintEvent* ) p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); } -void VMemo::mousePressEvent( QMouseEvent * ) +void VMemo::mousePressEvent( QMouseEvent * me) { - if(!recording) + // just to be safe + if (recording) { + recording = FALSE; + return; + } + /* No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions + mousePressEvent and mouseReleaseEvent with a NULL parameter. */ + if ( me->button() != LeftButton) + + // if (!systemZaurus && me != NULL) + return; + + if(!recording) startRecording(); else stopRecording(); @@ -347,14 +361,26 @@ bool VMemo::startRecording() { fileName.replace(QRegExp(":"),"."); fileName.replace(QRegExp(","),""); - if(openWAV(fileName.latin1()) == -1) { - // QString err("Could not open the output file\n"); - // err += fileName; - // QMessageBox::critical(0, "vmemo", err, "Abort"); - close(dsp); +// open tmp file here + char *pointer; + pointer=tmpnam(NULL); + qDebug("Opening tmp file %s",pointer); + + if(openWAV(pointer ) == -1) { + +// if(openWAV(fileName.latin1()) == -1) { + QString err("Could not open the temp file\n"); + err += fileName; + QMessageBox::critical(0, "vmemo", err, "Abort"); + ::close(dsp); return FALSE; } - + QString cmd; + cmd.sprintf("mv %s "+fileName,pointer); + +// move tmp file to regular file here + system(cmd.latin1()); + QArray cats(1); cats[0] = config.readNumEntry("Category", 0); @@ -647,5 +673,5 @@ int VMemo::setToggleButton(int tog) { void VMemo::timerBreak() { //stop stopRecording(); - QMessageBox::message("Vmemo","Vmemo recording has \ntimed out"); + QMessageBox::message("Vmemo","Vmemo recording has ended"); } -- cgit v0.9.0.2