author | llornkcor <llornkcor> | 2002-09-20 14:39:04 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-20 14:39:04 (UTC) |
commit | 504e00e215999d5aea32781c9f3067682e255e7c (patch) (unidiff) | |
tree | d3bca71a65bb2f8f0068e520d8cd1b239b2e52f6 | |
parent | ba0e9195f95ecb65216851b9b74fd776d307adc3 (diff) | |
download | opie-504e00e215999d5aea32781c9f3067682e255e7c.zip opie-504e00e215999d5aea32781c9f3067682e255e7c.tar.gz opie-504e00e215999d5aea32781c9f3067682e255e7c.tar.bz2 |
remove keyPress with null param check
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 2130438..ba17732 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -227,133 +227,133 @@ VMemo::VMemo( QWidget *parent, const char *_name ) | |||
227 | 227 | ||
228 | qDebug("toggleKey %d", toggleKey); | 228 | qDebug("toggleKey %d", toggleKey); |
229 | 229 | ||
230 | if(release.find("embedix",0,TRUE) !=-1) | 230 | if(release.find("embedix",0,TRUE) !=-1) |
231 | systemZaurus=TRUE; | 231 | systemZaurus=TRUE; |
232 | else | 232 | else |
233 | systemZaurus=FALSE; | 233 | systemZaurus=FALSE; |
234 | 234 | ||
235 | myChannel = new QCopChannel( "QPE/VMemo", this ); | 235 | myChannel = new QCopChannel( "QPE/VMemo", this ); |
236 | connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), | 236 | connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), |
237 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 237 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
238 | 238 | ||
239 | if( toggleKey != -1 ) { | 239 | if( toggleKey != -1 ) { |
240 | // QPEApplication::grabKeyboard(); | 240 | // QPEApplication::grabKeyboard(); |
241 | QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); | 241 | QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); |
242 | // e << 4096; // Key_Escape | 242 | // e << 4096; // Key_Escape |
243 | // e << Key_F5; //4148 | 243 | // e << Key_F5; //4148 |
244 | e << toggleKey; | 244 | e << toggleKey; |
245 | e << QString("QPE/VMemo"); | 245 | e << QString("QPE/VMemo"); |
246 | e << QString("toggleRecord()"); | 246 | e << QString("toggleRecord()"); |
247 | } | 247 | } |
248 | if(toggleKey == 1) | 248 | if(toggleKey == 1) |
249 | usingIcon=TRUE; | 249 | usingIcon=TRUE; |
250 | else | 250 | else |
251 | usingIcon=FALSE; | 251 | usingIcon=FALSE; |
252 | if( vmCfg.readNumEntry("hideIcon",0) == 1) | 252 | if( vmCfg.readNumEntry("hideIcon",0) == 1) |
253 | hide(); | 253 | hide(); |
254 | } | 254 | } |
255 | } | 255 | } |
256 | 256 | ||
257 | VMemo::~VMemo() { | 257 | VMemo::~VMemo() { |
258 | } | 258 | } |
259 | 259 | ||
260 | void VMemo::receive( const QCString &msg, const QByteArray &data ) { | 260 | void VMemo::receive( const QCString &msg, const QByteArray &data ) { |
261 | qDebug("receive"); | 261 | qDebug("receive"); |
262 | QDataStream stream( data, IO_ReadOnly ); | 262 | QDataStream stream( data, IO_ReadOnly ); |
263 | 263 | ||
264 | if (msg == "toggleRecord()") { | 264 | if (msg == "toggleRecord()") { |
265 | 265 | ||
266 | if (recording) { | 266 | if (recording) { |
267 | fromToggle = TRUE; | 267 | fromToggle = TRUE; |
268 | mouseReleaseEvent(NULL); | 268 | mouseReleaseEvent(NULL); |
269 | stopRecording(); | 269 | stopRecording(); |
270 | } else { | 270 | } else { |
271 | fromToggle = TRUE; | 271 | fromToggle = TRUE; |
272 | // mousePressEvent(NULL); | 272 | // mousePressEvent(NULL); |
273 | startRecording(); | 273 | startRecording(); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | void VMemo::paintEvent( QPaintEvent* ) { | 278 | void VMemo::paintEvent( QPaintEvent* ) { |
279 | QPainter p(this); | 279 | QPainter p(this); |
280 | p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); | 280 | p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); |
281 | } | 281 | } |
282 | 282 | ||
283 | void VMemo::mousePressEvent( QMouseEvent * me) { | 283 | void VMemo::mousePressEvent( QMouseEvent * me) { |
284 | // just to be safe | 284 | // just to be safe |
285 | if (recording) { | 285 | if (recording) { |
286 | recording = FALSE; | 286 | recording = FALSE; |
287 | return; | 287 | return; |
288 | } | 288 | } |
289 | /* No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions | 289 | /* No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions |
290 | mousePressEvent and mouseReleaseEvent with a NULL parameter. */ | 290 | mousePressEvent and mouseReleaseEvent with a NULL parameter. */ |
291 | if ( me->button() != LeftButton && me != NULL /*&& !systemZaurus*/) { | 291 | // if ( me->button() != LeftButton && me != NULL /*&& !systemZaurus*/) { |
292 | 292 | ||
293 | // if (!systemZaurus && me != NULL) | 293 | // if (!systemZaurus && me != NULL) |
294 | return; | 294 | // return; |
295 | } | 295 | // } |
296 | 296 | ||
297 | if(!recording) | 297 | if(!recording) |
298 | startRecording(); | 298 | startRecording(); |
299 | else | 299 | else |
300 | stopRecording(); | 300 | stopRecording(); |
301 | } | 301 | } |
302 | 302 | ||
303 | void VMemo::mouseReleaseEvent( QMouseEvent * ) { | 303 | void VMemo::mouseReleaseEvent( QMouseEvent * ) { |
304 | // if(usingIcon && !recording) | 304 | // if(usingIcon && !recording) |
305 | // stopRecording(); | 305 | // stopRecording(); |
306 | } | 306 | } |
307 | 307 | ||
308 | bool VMemo::startRecording() { | 308 | bool VMemo::startRecording() { |
309 | 309 | ||
310 | if ( recording) | 310 | if ( recording) |
311 | return FALSE; | 311 | return FALSE; |
312 | 312 | ||
313 | Config config( "Vmemo" ); | 313 | Config config( "Vmemo" ); |
314 | config.setGroup( "System" ); | 314 | config.setGroup( "System" ); |
315 | 315 | ||
316 | useAlerts = config.readBoolEntry("Alert",1); | 316 | useAlerts = config.readBoolEntry("Alert",1); |
317 | if(useAlerts) { | 317 | if(useAlerts) { |
318 | 318 | ||
319 | msgLabel = new QLabel( 0, "alertLabel" ); | 319 | msgLabel = new QLabel( 0, "alertLabel" ); |
320 | msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); | 320 | msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); |
321 | msgLabel->show(); | 321 | msgLabel->show(); |
322 | } | 322 | } |
323 | 323 | ||
324 | // if(useAlerts) | 324 | // if(useAlerts) |
325 | // QMessageBox::message("VMemo","Really Record?");//) ==1) | 325 | // QMessageBox::message("VMemo","Really Record?");//) ==1) |
326 | // return; | 326 | // return; |
327 | // } else { | 327 | // } else { |
328 | // if (!systemZaurus ) | 328 | // if (!systemZaurus ) |
329 | // QSound::play(Resource::findSound("vmemob")); | 329 | // QSound::play(Resource::findSound("vmemob")); |
330 | // } | 330 | // } |
331 | qDebug("Start recording engines"); | 331 | qDebug("Start recording engines"); |
332 | recording = TRUE; | 332 | recording = TRUE; |
333 | 333 | ||
334 | if (openDSP() == -1) { | 334 | if (openDSP() == -1) { |
335 | // QMessageBox::critical(0, "vmemo", "Could not open dsp device.\n"+errorMsg, "Abort"); | 335 | // QMessageBox::critical(0, "vmemo", "Could not open dsp device.\n"+errorMsg, "Abort"); |
336 | // delete msgLabel; | 336 | // delete msgLabel; |
337 | recording = FALSE; | 337 | recording = FALSE; |
338 | msgLabel=0; | 338 | msgLabel=0; |
339 | delete msgLabel; | 339 | delete msgLabel; |
340 | 340 | ||
341 | return FALSE; | 341 | return FALSE; |
342 | } | 342 | } |
343 | 343 | ||
344 | config.setGroup("Defaults"); | 344 | config.setGroup("Defaults"); |
345 | 345 | ||
346 | QDateTime dt = QDateTime::currentDateTime(); | 346 | QDateTime dt = QDateTime::currentDateTime(); |
347 | 347 | ||
348 | QString fName; | 348 | QString fName; |
349 | config.setGroup( "System" ); | 349 | config.setGroup( "System" ); |
350 | fName = QPEApplication::documentDir() ; | 350 | fName = QPEApplication::documentDir() ; |
351 | fileName = config.readEntry("RecLocation", fName); | 351 | fileName = config.readEntry("RecLocation", fName); |
352 | 352 | ||
353 | int s; | 353 | int s; |
354 | s=fileName.find(':'); | 354 | s=fileName.find(':'); |
355 | if(s) | 355 | if(s) |
356 | fileName=fileName.right(fileName.length()-s-2); | 356 | fileName=fileName.right(fileName.length()-s-2); |
357 | qDebug("pathname will be "+fileName); | 357 | qDebug("pathname will be "+fileName); |
358 | 358 | ||
359 | if( fileName.left(1).find('/') == -1) | 359 | if( fileName.left(1).find('/') == -1) |