-rw-r--r-- | library/qpeapplication.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index cf437da..f84bc0e 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -61,24 +61,26 @@ | |||
61 | #include <qmotifstyle.h> | 61 | #include <qmotifstyle.h> |
62 | #include <qmotifplusstyle.h> | 62 | #include <qmotifplusstyle.h> |
63 | #include "lightstyle.h" | 63 | #include "lightstyle.h" |
64 | #endif | 64 | #endif |
65 | #include "global.h" | 65 | #include "global.h" |
66 | #include "resource.h" | 66 | #include "resource.h" |
67 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) | 67 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) |
68 | #include "qutfcodec.h" | 68 | #include "qutfcodec.h" |
69 | #endif | 69 | #endif |
70 | #include "config.h" | 70 | #include "config.h" |
71 | #include "network.h" | 71 | #include "network.h" |
72 | #include "fontmanager.h" | 72 | #include "fontmanager.h" |
73 | #include "fontdatabase.h" | ||
74 | |||
73 | #include "power.h" | 75 | #include "power.h" |
74 | #include "alarmserver.h" | 76 | #include "alarmserver.h" |
75 | #include "applnk.h" | 77 | #include "applnk.h" |
76 | #include "qpemenubar.h" | 78 | #include "qpemenubar.h" |
77 | 79 | ||
78 | #include <unistd.h> | 80 | #include <unistd.h> |
79 | #include <sys/file.h> | 81 | #include <sys/file.h> |
80 | #include <sys/ioctl.h> | 82 | #include <sys/ioctl.h> |
81 | #include <sys/soundcard.h> | 83 | #include <sys/soundcard.h> |
82 | 84 | ||
83 | // for setBacklight() | 85 | // for setBacklight() |
84 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 86 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
@@ -376,25 +378,25 @@ public: | |||
376 | Config config( "qpe" ); | 378 | Config config( "qpe" ); |
377 | config.setGroup( "Screensaver" ); | 379 | config.setGroup( "Screensaver" ); |
378 | if (config.readNumEntry("LcdOffOnly",0) != 0) // We're only turning off the LCD | 380 | if (config.readNumEntry("LcdOffOnly",0) != 0) // We're only turning off the LCD |
379 | { | 381 | { |
380 | fd=open("/dev/fb0",O_RDWR); | 382 | fd=open("/dev/fb0",O_RDWR); |
381 | if (fd != -1) { ioctl(fd,FBIOBLANK,VESA_POWERDOWN); close(fd); } | 383 | if (fd != -1) { ioctl(fd,FBIOBLANK,VESA_POWERDOWN); close(fd); } |
382 | LcdOn = FALSE; | 384 | LcdOn = FALSE; |
383 | } | 385 | } |
384 | else // We're going to suspend the whole machine | 386 | else // We're going to suspend the whole machine |
385 | { | 387 | { |
386 | if ( disable_suspend > 2 && !powerOnline() && !networkOnline() ) { | 388 | if ( disable_suspend > 2 && !powerOnline() && !networkOnline() ) { |
387 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); | 389 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); |
388 | return TRUE; | 390 | return TRUE; |
389 | } | 391 | } |
390 | } | 392 | } |
391 | break; | 393 | break; |
392 | } | 394 | } |
393 | return FALSE; | 395 | return FALSE; |
394 | } | 396 | } |
395 | }; | 397 | }; |
396 | 398 | ||
397 | static int ssi(int interval, Config &config, const QString &enable, const QString& value, int def) | 399 | static int ssi(int interval, Config &config, const QString &enable, const QString& value, int def) |
398 | { | 400 | { |
399 | if ( !enable.isEmpty() && config.readNumEntry(enable,0) == 0 ) | 401 | if ( !enable.isEmpty() && config.readNumEntry(enable,0) == 0 ) |
400 | return 0; | 402 | return 0; |
@@ -495,25 +497,25 @@ static void setScreenSaverInterval(int interval) | |||
495 | \sa qcop.html | 497 | \sa qcop.html |
496 | */ | 498 | */ |
497 | 499 | ||
498 | /*! | 500 | /*! |
499 | Constructs a QPEApplication just as you would construct | 501 | Constructs a QPEApplication just as you would construct |
500 | a QApplication, passing \a argc, \a argv, and \a t. | 502 | a QApplication, passing \a argc, \a argv, and \a t. |
501 | */ | 503 | */ |
502 | QPEApplication::QPEApplication( int& argc, char **argv, Type t ) | 504 | QPEApplication::QPEApplication( int& argc, char **argv, Type t ) |
503 | : QApplication( hack(argc), argv, t ) | 505 | : QApplication( hack(argc), argv, t ) |
504 | { | 506 | { |
505 | int dw = desktop()->width(); | 507 | int dw = desktop()->width(); |
506 | if ( dw < 200 ) { | 508 | if ( dw < 200 ) { |
507 | setFont( QFont( "helvetica", 8 ) ); | 509 | // setFont( QFont( "helvetica", 8 ) ); |
508 | AppLnk::setSmallIconSize(10); | 510 | AppLnk::setSmallIconSize(10); |
509 | AppLnk::setBigIconSize(28); | 511 | AppLnk::setBigIconSize(28); |
510 | } | 512 | } |
511 | 513 | ||
512 | d = new QPEApplicationData; | 514 | d = new QPEApplicationData; |
513 | QMimeSourceFactory::setDefaultFactory(new ResourceMimeFactory); | 515 | QMimeSourceFactory::setDefaultFactory(new ResourceMimeFactory); |
514 | 516 | ||
515 | connect(this, SIGNAL(lastWindowClosed()), this, SLOT(hideOrQuit())); | 517 | connect(this, SIGNAL(lastWindowClosed()), this, SLOT(hideOrQuit())); |
516 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 518 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
517 | 519 | ||
518 | QString qcopfn("/tmp/qcop-msg-"); | 520 | QString qcopfn("/tmp/qcop-msg-"); |
519 | qcopfn += QString(argv[0]); // append command name | 521 | qcopfn += QString(argv[0]); // append command name |
@@ -590,25 +592,39 @@ QPEApplication::QPEApplication( int& argc, char **argv, Type t ) | |||
590 | trans = new QTranslator(this); | 592 | trans = new QTranslator(this); |
591 | tfn = qpeDir()+"/i18n/"+lang+"/"+d->appName+".qm"; | 593 | tfn = qpeDir()+"/i18n/"+lang+"/"+d->appName+".qm"; |
592 | if ( trans->load( tfn )) | 594 | if ( trans->load( tfn )) |
593 | installTranslator( trans ); | 595 | installTranslator( trans ); |
594 | else | 596 | else |
595 | delete trans; | 597 | delete trans; |
596 | 598 | ||
597 | //###language/font hack; should look it up somewhere | 599 | //###language/font hack; should look it up somewhere |
598 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 600 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
599 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 601 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
600 | setFont( fn ); | 602 | setFont( fn ); |
601 | } | 603 | } |
604 | else { | ||
605 | Config config( "qpe" ); | ||
606 | config.setGroup( "Appearance" ); | ||
607 | QString familyStr = config.readEntry( "FontFamily", "fixed" ); | ||
608 | QString styleStr = config.readEntry( "FontStyle", "Regular" ); | ||
609 | QString sizeStr = config.readEntry( "FontSize", "10" ); | ||
610 | QString charSetStr = config.readEntry( "FontCharSet", "iso10646-1" ); | ||
611 | bool ok; | ||
612 | int i_size = sizeStr.toInt( &ok, 10 ); | ||
613 | FontDatabase fdb; | ||
614 | QFont selectedFont = fdb.font( familyStr, styleStr, i_size, charSetStr ); | ||
615 | setFont( selectedFont ); | ||
616 | } | ||
602 | } | 617 | } |
618 | |||
603 | #endif | 619 | #endif |
604 | 620 | ||
605 | applyStyle(); | 621 | applyStyle(); |
606 | 622 | ||
607 | if ( type() == GuiServer ) { | 623 | if ( type() == GuiServer ) { |
608 | setScreenSaverInterval(-1); | 624 | setScreenSaverInterval(-1); |
609 | setVolume(); | 625 | setVolume(); |
610 | QWSServer::setScreenSaver(new QPEScreenSaver); | 626 | QWSServer::setScreenSaver(new QPEScreenSaver); |
611 | } | 627 | } |
612 | 628 | ||
613 | installEventFilter( this ); | 629 | installEventFilter( this ); |
614 | 630 | ||