summaryrefslogtreecommitdiff
path: root/noncore/tools
Unidiff
Diffstat (limited to 'noncore/tools') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp7
-rw-r--r--noncore/tools/euroconv/main.cpp2
-rw-r--r--noncore/tools/formatter/formatter.cpp3
3 files changed, 7 insertions, 5 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp
index 41c99a8..ecbf12f 100644
--- a/noncore/tools/clock/clock.cpp
+++ b/noncore/tools/clock/clock.cpp
@@ -388,116 +388,117 @@ void Clock::slotSnooze()
388 int warn = 0; 388 int warn = 0;
389 QTime t = QTime::currentTime(); 389 QTime t = QTime::currentTime();
390 QDateTime whenl( when.date(), t.addSecs( snoozeTime * 60 ) ); 390 QDateTime whenl( when.date(), t.addSecs( snoozeTime * 60 ) );
391 when = whenl; 391 when = whenl;
392 AlarmServer::addAlarm( when, 392 AlarmServer::addAlarm( when,
393 "QPE/Application/clock", 393 "QPE/Application/clock",
394 "alarm(QDateTime,int)", warn ); 394 "alarm(QDateTime,int)", warn );
395 395
396} 396}
397 397
398//toggles alarm on/off 398//toggles alarm on/off
399void Clock::slotToggleAlarm() 399void Clock::slotToggleAlarm()
400{ 400{
401 Config config( "qpe" ); 401 Config config( "qpe" );
402 config.setGroup( "Time" ); 402 config.setGroup( "Time" );
403 if ( alarmBool ) 403 if ( alarmBool )
404 { 404 {
405 config.writeEntry( "clockAlarmSet", "FALSE" ); 405 config.writeEntry( "clockAlarmSet", "FALSE" );
406 alarmOffBtn->setText( tr( "Alarm Is Off" ) ); 406 alarmOffBtn->setText( tr( "Alarm Is Off" ) );
407 snoozeBtn->hide(); 407 snoozeBtn->hide();
408 alarmBool = FALSE; 408 alarmBool = FALSE;
409 alarmOff(); 409 alarmOff();
410 } 410 }
411 else 411 else
412 { 412 {
413 config.writeEntry( "clockAlarmSet", "TRUE" ); 413 config.writeEntry( "clockAlarmSet", "TRUE" );
414 alarmOffBtn->setText( tr( "Alarm Is On" ) ); 414 alarmOffBtn->setText( tr( "Alarm Is On" ) );
415 snoozeBtn->show(); 415 snoozeBtn->show();
416 alarmBool = TRUE; 416 alarmBool = TRUE;
417 alarmOn(); 417 alarmOn();
418 } 418 }
419 config.write(); 419 config.write();
420} 420}
421 421
422void Clock::alarmOn() 422void Clock::alarmOn()
423{ 423{
424 QDate d = QDate::currentDate(); 424 QDate d = QDate::currentDate();
425 QTime tm( ( int ) hour, ( int ) minute, 0 ); 425 QTime tm( ( int ) hour, ( int ) minute, 0 );
426 qDebug( "Time set " + tm.toString() ); 426 qDebug( "Time set " + tm.toString() );
427 QTime t = QTime::currentTime(); 427 QTime t = QTime::currentTime();
428 if ( t > tm ) 428 if ( t > tm )
429 d = d.addDays( 1 ); 429 d = d.addDays( 1 );
430 int warn = 0; 430 int warn = 0;
431 QDateTime whenl( d, tm ); 431 QDateTime whenl( d, tm );
432 when = whenl; 432 when = whenl;
433 AlarmServer::addAlarm( when, 433 AlarmServer::addAlarm( when,
434 "QPE/Application/clock", 434 "QPE/Application/clock",
435 "alarm(QDateTime,int)", warn ); 435 "alarm(QDateTime,int)", warn );
436 setCaption( "Alarm set: " + whenl.toString() ); 436// setCaption( "Alarm set: " + whenl.toString() );
437 setCaption( tr("Alarm set: %1" ).arg(whenl.toString()) );
437} 438}
438 439
439void Clock::alarmOff() 440void Clock::alarmOff()
440{ 441{
441 int warn = 0; 442 int warn = 0;
442 bSound = FALSE; 443 bSound = FALSE;
443 AlarmServer::deleteAlarm( when, 444 AlarmServer::deleteAlarm( when,
444 "QPE/Application/clock", 445 "QPE/Application/clock",
445 "alarm(QDateTime,int)", warn ); 446 "alarm(QDateTime,int)", warn );
446 qDebug( "Alarm Off " + when.toString() ); 447 qDebug( "Alarm Off " + when.toString() );
447 setCaption( "Clock" ); 448 setCaption( tr("Clock") );
448} 449}
449 450
450void Clock::clearTimer() 451void Clock::clearTimer()
451{ 452{
452 alarmOffBtn->setText( tr( "Alarm Is Off" ) ); 453 alarmOffBtn->setText( tr( "Alarm Is Off" ) );
453 alarmBool = FALSE; 454 alarmBool = FALSE;
454 snoozeBtn->hide(); 455 snoozeBtn->hide();
455 setCaption( "Clock" ); 456 setCaption( tr("Clock") );
456} 457}
457 458
458void Clock::appMessage( const QCString& msg, const QByteArray& /*data*/ ) 459void Clock::appMessage( const QCString& msg, const QByteArray& /*data*/ )
459{ 460{
460 int stopTimer = 0; 461 int stopTimer = 0;
461 int timerStay = 5000; 462 int timerStay = 5000;
462 bSound = TRUE; 463 bSound = TRUE;
463 qDebug( "Message received in clock" ); 464 qDebug( "Message received in clock" );
464 if ( msg == "alarm(QDateTime,int)" ) 465 if ( msg == "alarm(QDateTime,int)" )
465 { 466 {
466 Config config( "qpe" ); 467 Config config( "qpe" );
467 config.setGroup( "Time" ); 468 config.setGroup( "Time" );
468 if ( config.readBoolEntry( "mp3Alarm", 0 ) ) 469 if ( config.readBoolEntry( "mp3Alarm", 0 ) )
469 { 470 {
470 clearTimer(); 471 clearTimer();
471 pthread_t thread; 472 pthread_t thread;
472 pthread_create(&thread, NULL, (void * (*) (void *))startPlayer, NULL/* &*/); 473 pthread_create(&thread, NULL, (void * (*) (void *))startPlayer, NULL/* &*/);
473 474
474 } 475 }
475 else 476 else
476 { 477 {
477 478
478 Sound::soundAlarm(); 479 Sound::soundAlarm();
479 stopTimer = startTimer( timerStay ); 480 stopTimer = startTimer( timerStay );
480 } 481 }
481 } 482 }
482 483
483 if ( msg == "timerStart()" ) 484 if ( msg == "timerStart()" )
484 { 485 {
485 slotStartTimer(); 486 slotStartTimer();
486 } 487 }
487 if ( msg == "timerStop()" ) 488 if ( msg == "timerStop()" )
488 { 489 {
489 slotStopTimer(); 490 slotStopTimer();
490 } 491 }
491 if ( msg == "timerReset()" ) 492 if ( msg == "timerReset()" )
492 { 493 {
493 slotResetTimer(); 494 slotResetTimer();
494 } 495 }
495 496
496 show(); 497 show();
497 raise(); 498 raise();
498 QPEApplication::setKeepRunning(); 499 QPEApplication::setKeepRunning();
499 setActiveWindow(); 500 setActiveWindow();
500} 501}
501 502
502void Clock::timerEvent( QTimerEvent *e ) 503void Clock::timerEvent( QTimerEvent *e )
503{ 504{
diff --git a/noncore/tools/euroconv/main.cpp b/noncore/tools/euroconv/main.cpp
index 2d97f4e..7d69535 100644
--- a/noncore/tools/euroconv/main.cpp
+++ b/noncore/tools/euroconv/main.cpp
@@ -1,39 +1,39 @@
1/**************************************************************************** 1/****************************************************************************
2 * 2 *
3 * File: main.cpp 3 * File: main.cpp
4 * 4 *
5 * Description: main file for OPIE Euroconv aapp 5 * Description: main file for OPIE Euroconv aapp
6 * 6 *
7 * 7 *
8 * Authors: Eric Santonacci <Eric.Santonacci@talc.fr> 8 * Authors: Eric Santonacci <Eric.Santonacci@talc.fr>
9 * 9 *
10 * Requirements: Qt 10 * Requirements: Qt
11 * 11 *
12 * $Id$ 12 * $Id$
13 * 13 *
14 ***************************************************************************/ 14 ***************************************************************************/
15 15
16#include <qpe/qpeapplication.h> 16#include <qpe/qpeapplication.h>
17#include <qvbox.h> 17#include <qvbox.h>
18//#include <qapplication.h> 18//#include <qapplication.h>
19 19
20#include "calcdisplay.h" 20#include "calcdisplay.h"
21#include "calckeypad.h" 21#include "calckeypad.h"
22 22
23 23
24 24
25int main( int argc, char **argv ) { 25int main( int argc, char **argv ) {
26 26
27 QPEApplication app( argc, argv ); 27 QPEApplication app( argc, argv );
28 28
29 QVBox *layout = new QVBox(0, "fond"); 29 QVBox *layout = new QVBox(0, "fond");
30 30
31 LCDDisplay lcd (layout, "lcd"); 31 LCDDisplay lcd (layout, "lcd");
32 KeyPad num(&lcd, layout, "keypad"); 32 KeyPad num(&lcd, layout, "keypad");
33 app.setMainWidget(layout); 33 app.setMainWidget(layout);
34 layout->setCaption("Euroconv"); 34 layout->setCaption( QObject::tr("Euroconv") );
35 layout->showMaximized (); 35 layout->showMaximized ();
36 layout->show(); 36 layout->show();
37 return app.exec(); 37 return app.exec();
38} 38}
39 39
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp
index 21de4d2..49f6355 100644
--- a/noncore/tools/formatter/formatter.cpp
+++ b/noncore/tools/formatter/formatter.cpp
@@ -355,97 +355,98 @@ void FormatterApp::storageComboSelected(int index ) {
355 355
356 TextLabel4->setText( tr( "Storage Type: %1").arg( nameS) ); 356 TextLabel4->setText( tr( "Storage Type: %1").arg( nameS) );
357 currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); 357 currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4);
358 358
359 QString fsType = getFileSystemType((const QString &) currentText); 359 QString fsType = getFileSystemType((const QString &) currentText);
360// qDebug(fsType); 360// qDebug(fsType);
361 for(int i = 0; i < fileSystemsCombo->count(); i++) { 361 for(int i = 0; i < fileSystemsCombo->count(); i++) {
362 if( fsType == fileSystemsCombo->text(i)) 362 if( fsType == fileSystemsCombo->text(i))
363 fileSystemsCombo->setCurrentItem(i); 363 fileSystemsCombo->setCurrentItem(i);
364 } 364 }
365// deviceComboSelected(index); 365// deviceComboSelected(index);
366} 366}
367 367
368void FormatterApp::deviceComboSelected(int index) { 368void FormatterApp::deviceComboSelected(int index) {
369 369
370 StorageInfo storageInfo; 370 StorageInfo storageInfo;
371 QString totalS, usedS, avS, diskS, nameS, fsType, selectedText; 371 QString totalS, usedS, avS, diskS, nameS, fsType, selectedText;
372 372
373 selectedText = deviceComboBox->text(index); 373 selectedText = deviceComboBox->text(index);
374 374
375 const QList<FileSystem> &fs = storageInfo.fileSystems(); 375 const QList<FileSystem> &fs = storageInfo.fileSystems();
376 QListIterator<FileSystem> it ( fs ); 376 QListIterator<FileSystem> it ( fs );
377 QString storage; 377 QString storage;
378 for( ; it.current(); ++it ){ 378 for( ; it.current(); ++it ){
379 const QString name = (*it)->name(); 379 const QString name = (*it)->name();
380 const QString path = (*it)->path(); 380 const QString path = (*it)->path();
381 const QString disk = (*it)->disk(); 381 const QString disk = (*it)->disk();
382// const QString options = (*it)->options(); 382// const QString options = (*it)->options();
383 if( selectedText == disk) { 383 if( selectedText == disk) {
384 diskS = disk; nameS= name; 384 diskS = disk; nameS= name;
385 mountPointLineEdit->setText(path); 385 mountPointLineEdit->setText(path);
386 long mult = (*it)->blockSize() / 1024; 386 long mult = (*it)->blockSize() / 1024;
387 long div = 1024 / (*it)->blockSize(); 387 long div = 1024 / (*it)->blockSize();
388 if ( !mult ) mult = 1; 388 if ( !mult ) mult = 1;
389 if ( !div ) div = 1; 389 if ( !div ) div = 1;
390 long total = (*it)->totalBlocks() * mult / div; 390 long total = (*it)->totalBlocks() * mult / div;
391 long totalMb = total/1024; 391 long totalMb = total/1024;
392 long avail = (*it)->availBlocks() * mult / div; 392 long avail = (*it)->availBlocks() * mult / div;
393 long availMb = avail/1024; 393 long availMb = avail/1024;
394 long used = total - avail; 394 long used = total - avail;
395 long usedMb = used/1024; 395 long usedMb = used/1024;
396 totalS.sprintf(tr("Total: %1 kB ( %d mB)\n").arg( total ), totalMb ); 396 totalS.sprintf(tr("Total: %1 kB ( %d mB)\n").arg( total ), totalMb );
397 usedS.sprintf(tr("Used: %1 kB ( %d mB)\n").arg(used) ,usedMb); 397 usedS.sprintf(tr("Used: %1 kB ( %d mB)\n").arg(used) ,usedMb);
398 avS.sprintf( tr("Available: %1 kB ( %d mB)").arg(avail), availMb ); 398 avS.sprintf( tr("Available: %1 kB ( %d mB)").arg(avail), availMb );
399 } 399 }
400 } 400 }
401 fsType = getFileSystemType((const QString &)selectedText); 401 fsType = getFileSystemType((const QString &)selectedText);
402 402
403 TextLabel5->setText(tr("Type: %1\nFormatted with %1\n%1, %1, %1").arg( nameS).arg( fsType).arg(totalS).arg( usedS).arg( avS )); 403 TextLabel5->setText(tr("Type: %1\nFormatted with %2\n%3, %4, %5").arg( nameS).arg( fsType).arg(totalS).arg( usedS).arg( avS ));
404 TextLabel5->setTextFormat( Qt::RichText );
404// storageComboSelected(0); 405// storageComboSelected(0);
405} 406}
406 407
407void FormatterApp::cleanUp() { 408void FormatterApp::cleanUp() {
408 409
409} 410}
410 411
411 412
412void FormatterApp::editFstab() { 413void FormatterApp::editFstab() {
413 QCopEnvelope e("QPE/Application/textedit","setDocument(QString)"); 414 QCopEnvelope e("QPE/Application/textedit","setDocument(QString)");
414 e << (const QString &)"/etc/fstab"; 415 e << (const QString &)"/etc/fstab";
415} 416}
416 417
417void FormatterApp::parsetab(const QString &fileName) { 418void FormatterApp::parsetab(const QString &fileName) {
418 419
419 fileSystemTypeList.clear(); 420 fileSystemTypeList.clear();
420 fsList.clear(); 421 fsList.clear();
421 struct mntent *me; 422 struct mntent *me;
422// if(fileName == "/etc/mtab") { 423// if(fileName == "/etc/mtab") {
423 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 424 FILE *mntfp = setmntent( fileName.latin1(), "r" );
424 if ( mntfp ) { 425 if ( mntfp ) {
425 while ( (me = getmntent( mntfp )) != 0 ) { 426 while ( (me = getmntent( mntfp )) != 0 ) {
426 QString deviceName = me->mnt_fsname; 427 QString deviceName = me->mnt_fsname;
427 QString filesystemType = me->mnt_type; 428 QString filesystemType = me->mnt_type;
428 if(deviceName != "none") { 429 if(deviceName != "none") {
429 if( fsList.contains(filesystemType) == 0 430 if( fsList.contains(filesystemType) == 0
430 & filesystemType.find("proc",0,TRUE) == -1 431 & filesystemType.find("proc",0,TRUE) == -1
431 & filesystemType.find("cramfs",0,TRUE) == -1 432 & filesystemType.find("cramfs",0,TRUE) == -1
432 & filesystemType.find("auto",0,TRUE) == -1) 433 & filesystemType.find("auto",0,TRUE) == -1)
433 fsList << filesystemType; 434 fsList << filesystemType;
434 deviceList << deviceName; 435 deviceList << deviceName;
435 qDebug(deviceName+"::"+filesystemType); 436 qDebug(deviceName+"::"+filesystemType);
436 fileSystemTypeList << deviceName+"::"+filesystemType; 437 fileSystemTypeList << deviceName+"::"+filesystemType;
437 } 438 }
438 } 439 }
439 } 440 }
440 endmntent( mntfp ); 441 endmntent( mntfp );
441// } else if(fileName == "/etc/fstab") { 442// } else if(fileName == "/etc/fstab") {
442// QFile f("/etc/fstab"); 443// QFile f("/etc/fstab");
443// if ( f.open(IO_ReadOnly) ) { 444// if ( f.open(IO_ReadOnly) ) {
444// QTextStream t (&f); 445// QTextStream t (&f);
445// QString s; 446// QString s;
446// while (! t.eof()) { 447// while (! t.eof()) {
447// s=t.readLine(); 448// s=t.readLine();
448// s=s.simplifyWhiteSpace(); 449// s=s.simplifyWhiteSpace();
449// if ( (!s.isEmpty() ) && (s.find(" ")!=0) ) { 450// if ( (!s.isEmpty() ) && (s.find(" ")!=0) ) {
450// // = me->mnt_fsname; 451// // = me->mnt_fsname;
451// QString filesystemType = me->mnt_type; 452// QString filesystemType = me->mnt_type;