-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 44 | ||||
-rw-r--r-- | core/applets/vmemo/vmemo.h | 2 |
2 files changed, 27 insertions, 19 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index b5239eb..035965e 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp @@ -262,12 +262,14 @@ void VMemo::receive( const QCString &msg, const QByteArray &data ) { QDataStream stream( data, IO_ReadOnly ); + if (msg == "toggleRecord()") { - if (recording) { - fromToggle = TRUE; - mouseReleaseEvent(NULL); -// stopRecording(); - } else { - fromToggle = TRUE; - // mousePressEvent(NULL); - startRecording(); - } + + if (recording) { + fromToggle = TRUE; + mouseReleaseEvent(NULL); + stopRecording(); + } else { + fromToggle = TRUE; + // mousePressEvent(NULL); + startRecording(); + } } @@ -361,3 +363,2 @@ bool VMemo::startRecording() { fileName+=fName; - qDebug("filename is "+fileName); // No spaces in the filename @@ -368,2 +369,3 @@ bool VMemo::startRecording() { + qDebug("filename is "+fileName); // open tmp file here @@ -382,3 +384,3 @@ bool VMemo::startRecording() { } - record(); + if( record() ) { @@ -400,4 +402,6 @@ bool VMemo::startRecording() { l.writeLink(); - return TRUE; + } else + return FALSE; + } @@ -506,4 +510,5 @@ int VMemo::openWAV(const char *filename) { -void VMemo::record(void) { - int length=0, result, value; +bool VMemo::record() { + + int length=0, result, value; QString msg; @@ -514,4 +519,4 @@ void VMemo::record(void) { int sRate=config.readNumEntry("SizeLimit", 30); - - t_timer->start( sRate * 1000+1000, TRUE); + if(sRate > 0) + t_timer->start( sRate * 1000+1000, TRUE); @@ -539,4 +544,5 @@ void VMemo::record(void) { QMessageBox::message(tr("Note"),tr("error recording")); - recording=FALSE;; + recording=FALSE; break; + return FALSE; } @@ -560,2 +566,4 @@ void VMemo::record(void) { QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); + break; + return FALSE; } @@ -599,3 +607,3 @@ void VMemo::record(void) { QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute - +return TRUE; } diff --git a/core/applets/vmemo/vmemo.h b/core/applets/vmemo/vmemo.h index 167af2a..9ee08ff 100644 --- a/core/applets/vmemo/vmemo.h +++ b/core/applets/vmemo/vmemo.h @@ -40,3 +40,3 @@ bool usingIcon, useADPCM; public slots: - void record(); + bool record(); void mousePressEvent( QMouseEvent * ); |