author | mickeyl <mickeyl> | 2005-06-26 12:18:37 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-06-26 12:18:37 (UTC) |
commit | 53f924947144ddbb3e15d3bd1ddc877073c7ec7f (patch) (unidiff) | |
tree | 501e5658099d63309fbf56fc7bd046c0a174a024 /library | |
parent | d5a2b0d5ca4daa11894c52f3599dab56205bef4c (diff) | |
download | opie-53f924947144ddbb3e15d3bd1ddc877073c7ec7f.zip opie-53f924947144ddbb3e15d3bd1ddc877073c7ec7f.tar.gz opie-53f924947144ddbb3e15d3bd1ddc877073c7ec7f.tar.bz2 |
get the default gfx driver from QWS_DISPLAY instead of hardcoding
it to 'Transformed' when launching rotated apps.
Patch courtesy Manuel Teira
-rw-r--r-- | library/applnk.cpp | 6 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 5 | ||||
-rw-r--r-- | library/qpeapplication.h | 5 |
3 files changed, 12 insertions, 4 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp index c82d3b9..874a1b6 100644 --- a/library/applnk.cpp +++ b/library/applnk.cpp | |||
@@ -592,195 +592,197 @@ QString AppLnk::linkFile() const | |||
592 | /* tmpfs + and ramfs are available too but not removable | 592 | /* tmpfs + and ramfs are available too but not removable |
593 | * either we fix storage or add this | 593 | * either we fix storage or add this |
594 | */ | 594 | */ |
595 | if ( fs && ( fs->isRemovable() || fs->disk() == "/dev/mtdblock6" || fs->disk() == "tmpfs") ) { | 595 | if ( fs && ( fs->isRemovable() || fs->disk() == "/dev/mtdblock6" || fs->disk() == "tmpfs") ) { |
596 | that->mLinkFile = fs->path(); | 596 | that->mLinkFile = fs->path(); |
597 | } else | 597 | } else |
598 | that->mLinkFile = getenv( "HOME" ); | 598 | that->mLinkFile = getenv( "HOME" ); |
599 | that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName); | 599 | that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName); |
600 | 600 | ||
601 | /* the desktop file exists make sure we don't point to the same file */ | 601 | /* the desktop file exists make sure we don't point to the same file */ |
602 | if ( QFile::exists(that->mLinkFile+".desktop") ) { | 602 | if ( QFile::exists(that->mLinkFile+".desktop") ) { |
603 | AppLnk lnk( that->mLinkFile + ".desktop" ); | 603 | AppLnk lnk( that->mLinkFile + ".desktop" ); |
604 | 604 | ||
605 | /* the linked is different */ | 605 | /* the linked is different */ |
606 | if(that->file() != lnk.file() ) { | 606 | if(that->file() != lnk.file() ) { |
607 | int n = 1; | 607 | int n = 1; |
608 | QString nn; | 608 | QString nn; |
609 | while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")) { | 609 | while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")) { |
610 | n++; | 610 | n++; |
611 | /* just to be sure */ | 611 | /* just to be sure */ |
612 | AppLnk lnk(nn ); | 612 | AppLnk lnk(nn ); |
613 | if (lnk.file() == that->file() ) | 613 | if (lnk.file() == that->file() ) |
614 | break; | 614 | break; |
615 | } | 615 | } |
616 | that->mLinkFile = nn; | 616 | that->mLinkFile = nn; |
617 | } | 617 | } |
618 | } | 618 | } |
619 | that->mLinkFile += ".desktop"; | 619 | that->mLinkFile += ".desktop"; |
620 | storeLink(); | 620 | storeLink(); |
621 | } | 621 | } |
622 | return that->mLinkFile; | 622 | return that->mLinkFile; |
623 | } | 623 | } |
624 | return mLinkFile; | 624 | return mLinkFile; |
625 | } | 625 | } |
626 | 626 | ||
627 | /*! | 627 | /*! |
628 | Copies \a copy. | 628 | Copies \a copy. |
629 | */ | 629 | */ |
630 | AppLnk::AppLnk( const AppLnk © ) | 630 | AppLnk::AppLnk( const AppLnk © ) |
631 | { | 631 | { |
632 | mName = copy.mName; | 632 | mName = copy.mName; |
633 | mPixmap = copy.mPixmap; | 633 | mPixmap = copy.mPixmap; |
634 | mBigPixmap = copy.mBigPixmap; | 634 | mBigPixmap = copy.mBigPixmap; |
635 | mExec = copy.mExec; | 635 | mExec = copy.mExec; |
636 | mType = copy.mType; | 636 | mType = copy.mType; |
637 | mRotation = copy.mRotation; | 637 | mRotation = copy.mRotation; |
638 | mComment = copy.mComment; | 638 | mComment = copy.mComment; |
639 | mFile = copy.mFile; | 639 | mFile = copy.mFile; |
640 | mLinkFile = copy.mLinkFile; | 640 | mLinkFile = copy.mLinkFile; |
641 | mIconFile = copy.mIconFile; | 641 | mIconFile = copy.mIconFile; |
642 | mMimeTypes = copy.mMimeTypes; | 642 | mMimeTypes = copy.mMimeTypes; |
643 | mMimeTypeIcons = copy.mMimeTypeIcons; | 643 | mMimeTypeIcons = copy.mMimeTypeIcons; |
644 | mId = 0; | 644 | mId = 0; |
645 | d = new AppLnkPrivate(); | 645 | d = new AppLnkPrivate(); |
646 | d->mCat = copy.d->mCat; | 646 | d->mCat = copy.d->mCat; |
647 | d->mCatList = copy.d->mCatList; | 647 | d->mCatList = copy.d->mCatList; |
648 | d->mPixmaps = copy.d->mPixmaps; | 648 | d->mPixmaps = copy.d->mPixmaps; |
649 | } | 649 | } |
650 | 650 | ||
651 | /*! | 651 | /*! |
652 | Destroys the AppLnk. Note that if the AppLnk is currently a member | 652 | Destroys the AppLnk. Note that if the AppLnk is currently a member |
653 | of an AppLnkSet, this will produce a run-time warning. | 653 | of an AppLnkSet, this will produce a run-time warning. |
654 | 654 | ||
655 | \sa AppLnkSet::add() AppLnkSet::remove() | 655 | \sa AppLnkSet::add() AppLnkSet::remove() |
656 | */ | 656 | */ |
657 | AppLnk::~AppLnk() | 657 | AppLnk::~AppLnk() |
658 | { | 658 | { |
659 | if ( mId ) | 659 | if ( mId ) |
660 | qWarning("Deleting AppLnk that is in an AppLnkSet"); | 660 | qWarning("Deleting AppLnk that is in an AppLnkSet"); |
661 | if ( d ) | 661 | if ( d ) |
662 | delete d; | 662 | delete d; |
663 | } | 663 | } |
664 | 664 | ||
665 | /*! | 665 | /*! |
666 | \overload | 666 | \overload |
667 | Executes the application associated with this AppLnk. | 667 | Executes the application associated with this AppLnk. |
668 | 668 | ||
669 | \sa exec() | 669 | \sa exec() |
670 | */ | 670 | */ |
671 | void AppLnk::execute() const | 671 | void AppLnk::execute() const |
672 | { | 672 | { |
673 | execute( QStringList::split( ' ', property( "Arguments" ) ) ); | 673 | execute( QStringList::split( ' ', property( "Arguments" ) ) ); |
674 | } | 674 | } |
675 | 675 | ||
676 | /*! | 676 | /*! |
677 | Executes the application associated with this AppLnk, with | 677 | Executes the application associated with this AppLnk, with |
678 | \a args as arguments. | 678 | \a args as arguments. |
679 | 679 | ||
680 | \sa exec() | 680 | \sa exec() |
681 | */ | 681 | */ |
682 | void AppLnk::execute(const QStringList& args) const | 682 | void AppLnk::execute(const QStringList& args) const |
683 | { | 683 | { |
684 | #ifdef Q_WS_QWS | 684 | #ifdef Q_WS_QWS |
685 | if ( !mRotation.isEmpty() ) { | 685 | if ( !mRotation.isEmpty() ) { |
686 | // ######## this will only work in the server | 686 | // ######## this will only work in the server |
687 | int rot = QPEApplication::defaultRotation(); | 687 | int rot = QPEApplication::defaultRotation(); |
688 | int j = 0; | ||
688 | rot = (rot+mRotation.toInt())%360; | 689 | rot = (rot+mRotation.toInt())%360; |
689 | QCString old = getenv("QWS_DISPLAY"); | 690 | QCString old = getenv( "QWS_DISPLAY" ) ? getenv( "QWS_DISPLAY" ) : "Transformed"; |
690 | setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); | 691 | QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() ); |
692 | setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg( driver ).arg( rot ), 1 ); | ||
691 | invoke(args); | 693 | invoke(args); |
692 | setenv("QWS_DISPLAY", old.data(), 1); | 694 | setenv("QWS_DISPLAY", old.data(), 1); |
693 | } else | 695 | } else |
694 | #endif | 696 | #endif |
695 | invoke(args); | 697 | invoke(args); |
696 | } | 698 | } |
697 | 699 | ||
698 | /*! | 700 | /*! |
699 | Invokes the application associated with this AppLnk, with | 701 | Invokes the application associated with this AppLnk, with |
700 | \a args as arguments. Rotation is not taken into account by | 702 | \a args as arguments. Rotation is not taken into account by |
701 | this function, so you should not call it directly. | 703 | this function, so you should not call it directly. |
702 | 704 | ||
703 | \sa execute() | 705 | \sa execute() |
704 | */ | 706 | */ |
705 | void AppLnk::invoke(const QStringList& args) const | 707 | void AppLnk::invoke(const QStringList& args) const |
706 | { | 708 | { |
707 | if ( property( "Arguments" ).isEmpty() ) | 709 | if ( property( "Arguments" ).isEmpty() ) |
708 | Global::execute( exec(), args[0] ); | 710 | Global::execute( exec(), args[0] ); |
709 | else | 711 | else |
710 | Global::execute( exec(), args.join( " " ) ); | 712 | Global::execute( exec(), args.join( " " ) ); |
711 | } | 713 | } |
712 | 714 | ||
713 | /*! | 715 | /*! |
714 | Sets the Exec property to \a exec. | 716 | Sets the Exec property to \a exec. |
715 | 717 | ||
716 | \sa exec() name() | 718 | \sa exec() name() |
717 | */ | 719 | */ |
718 | void AppLnk::setExec( const QString& exec ) | 720 | void AppLnk::setExec( const QString& exec ) |
719 | { | 721 | { |
720 | mExec = exec; | 722 | mExec = exec; |
721 | } | 723 | } |
722 | 724 | ||
723 | #if 0 // this was inlined for better BC | 725 | #if 0 // this was inlined for better BC |
724 | /*! | 726 | /*! |
725 | Sets the Rotation property to \a rot. | 727 | Sets the Rotation property to \a rot. |
726 | 728 | ||
727 | \sa rotation() | 729 | \sa rotation() |
728 | */ | 730 | */ |
729 | void AppLnk::setRotation ( const QString &rot ) | 731 | void AppLnk::setRotation ( const QString &rot ) |
730 | { | 732 | { |
731 | mRotation = rot; | 733 | mRotation = rot; |
732 | } | 734 | } |
733 | #endif | 735 | #endif |
734 | 736 | ||
735 | /*! | 737 | /*! |
736 | Sets the Name property to \a docname. | 738 | Sets the Name property to \a docname. |
737 | 739 | ||
738 | \sa name() | 740 | \sa name() |
739 | */ | 741 | */ |
740 | void AppLnk::setName( const QString& docname ) | 742 | void AppLnk::setName( const QString& docname ) |
741 | { | 743 | { |
742 | mName = docname; | 744 | mName = docname; |
743 | } | 745 | } |
744 | 746 | ||
745 | /*! | 747 | /*! |
746 | Sets the File property to \a filename. | 748 | Sets the File property to \a filename. |
747 | 749 | ||
748 | \sa file() name() | 750 | \sa file() name() |
749 | */ | 751 | */ |
750 | void AppLnk::setFile( const QString& filename ) | 752 | void AppLnk::setFile( const QString& filename ) |
751 | { | 753 | { |
752 | mFile = filename; | 754 | mFile = filename; |
753 | } | 755 | } |
754 | 756 | ||
755 | /*! | 757 | /*! |
756 | Sets the LinkFile property to \a filename. | 758 | Sets the LinkFile property to \a filename. |
757 | 759 | ||
758 | \sa linkFile() | 760 | \sa linkFile() |
759 | */ | 761 | */ |
760 | void AppLnk::setLinkFile( const QString& filename ) | 762 | void AppLnk::setLinkFile( const QString& filename ) |
761 | { | 763 | { |
762 | mLinkFile = filename; | 764 | mLinkFile = filename; |
763 | } | 765 | } |
764 | 766 | ||
765 | /*! | 767 | /*! |
766 | Sets the Comment property to \a comment. | 768 | Sets the Comment property to \a comment. |
767 | 769 | ||
768 | This text is displayed in the 'Details Dialog', for example if the | 770 | This text is displayed in the 'Details Dialog', for example if the |
769 | user uses the 'press-and-hold' gesture. | 771 | user uses the 'press-and-hold' gesture. |
770 | 772 | ||
771 | \sa comment() | 773 | \sa comment() |
772 | */ | 774 | */ |
773 | void AppLnk::setComment( const QString& comment ) | 775 | void AppLnk::setComment( const QString& comment ) |
774 | { | 776 | { |
775 | mComment = comment; | 777 | mComment = comment; |
776 | } | 778 | } |
777 | 779 | ||
778 | /*! | 780 | /*! |
779 | Sets the Type property to \a type. | 781 | Sets the Type property to \a type. |
780 | 782 | ||
781 | For applications, games and settings the type should be \c | 783 | For applications, games and settings the type should be \c |
782 | Application; for documents the type should be the document's MIME | 784 | Application; for documents the type should be the document's MIME |
783 | type. | 785 | type. |
784 | 786 | ||
785 | \sa type() | 787 | \sa type() |
786 | */ | 788 | */ |
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 0f3e4a4..19e99f2 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1195,193 +1195,196 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e ) | |||
1195 | 1195 | ||
1196 | 1196 | ||
1197 | return QApplication::qwsEventFilter( e ); | 1197 | return QApplication::qwsEventFilter( e ); |
1198 | } | 1198 | } |
1199 | #endif | 1199 | #endif |
1200 | 1200 | ||
1201 | /*! | 1201 | /*! |
1202 | Destroys the QPEApplication. | 1202 | Destroys the QPEApplication. |
1203 | */ | 1203 | */ |
1204 | QPEApplication::~QPEApplication() | 1204 | QPEApplication::~QPEApplication() |
1205 | { | 1205 | { |
1206 | ungrabKeyboard(); | 1206 | ungrabKeyboard(); |
1207 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 1207 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
1208 | // Need to delete QCopChannels early, since the display will | 1208 | // Need to delete QCopChannels early, since the display will |
1209 | // be gone by the time we get to ~QObject(). | 1209 | // be gone by the time we get to ~QObject(). |
1210 | delete sysChannel; | 1210 | delete sysChannel; |
1211 | delete pidChannel; | 1211 | delete pidChannel; |
1212 | #endif | 1212 | #endif |
1213 | 1213 | ||
1214 | #ifdef OPIE_WITHROHFEEDBACK | 1214 | #ifdef OPIE_WITHROHFEEDBACK |
1215 | if( d->RoH ) | 1215 | if( d->RoH ) |
1216 | delete d->RoH; | 1216 | delete d->RoH; |
1217 | #endif | 1217 | #endif |
1218 | delete d; | 1218 | delete d; |
1219 | } | 1219 | } |
1220 | 1220 | ||
1221 | /*! | 1221 | /*! |
1222 | Returns <tt>$OPIEDIR/</tt>. | 1222 | Returns <tt>$OPIEDIR/</tt>. |
1223 | */ | 1223 | */ |
1224 | QString QPEApplication::qpeDir() | 1224 | QString QPEApplication::qpeDir() |
1225 | { | 1225 | { |
1226 | QString base, dir; | 1226 | QString base, dir; |
1227 | 1227 | ||
1228 | if (getenv( "OPIEDIR" )) | 1228 | if (getenv( "OPIEDIR" )) |
1229 | base = QString(getenv("OPIEDIR")).stripWhiteSpace(); | 1229 | base = QString(getenv("OPIEDIR")).stripWhiteSpace(); |
1230 | if ( !base.isNull() && (base.length() > 0 )){ | 1230 | if ( !base.isNull() && (base.length() > 0 )){ |
1231 | #ifdef Q_OS_WIN32 | 1231 | #ifdef Q_OS_WIN32 |
1232 | QString temp(base); | 1232 | QString temp(base); |
1233 | if (temp[(int)temp.length()-1] != QDir::separator()) | 1233 | if (temp[(int)temp.length()-1] != QDir::separator()) |
1234 | temp.append(QDir::separator()); | 1234 | temp.append(QDir::separator()); |
1235 | dir = temp; | 1235 | dir = temp; |
1236 | #else | 1236 | #else |
1237 | dir = QString( base ) + "/"; | 1237 | dir = QString( base ) + "/"; |
1238 | #endif | 1238 | #endif |
1239 | }else{ | 1239 | }else{ |
1240 | dir = QString( ".." ) + QDir::separator(); | 1240 | dir = QString( ".." ) + QDir::separator(); |
1241 | } | 1241 | } |
1242 | 1242 | ||
1243 | return dir; | 1243 | return dir; |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | /*! | 1246 | /*! |
1247 | Returns the user's current Document directory. There is a trailing "/". | 1247 | Returns the user's current Document directory. There is a trailing "/". |
1248 | .. well, it does now,, and there's no trailing '/' | 1248 | .. well, it does now,, and there's no trailing '/' |
1249 | */ | 1249 | */ |
1250 | QString QPEApplication::documentDir() | 1250 | QString QPEApplication::documentDir() |
1251 | { | 1251 | { |
1252 | const char* base = getenv( "HOME"); | 1252 | const char* base = getenv( "HOME"); |
1253 | if ( base ) | 1253 | if ( base ) |
1254 | return QString( base ) + "/Documents"; | 1254 | return QString( base ) + "/Documents"; |
1255 | 1255 | ||
1256 | return QString( "../Documents" ); | 1256 | return QString( "../Documents" ); |
1257 | } | 1257 | } |
1258 | 1258 | ||
1259 | static int deforient = -1; | 1259 | static int deforient = -1; |
1260 | 1260 | ||
1261 | /*! | 1261 | /*! |
1262 | \internal | 1262 | \internal |
1263 | */ | 1263 | */ |
1264 | int QPEApplication::defaultRotation() | 1264 | int QPEApplication::defaultRotation() |
1265 | { | 1265 | { |
1266 | if ( deforient < 0 ) { | 1266 | if ( deforient < 0 ) { |
1267 | QString d = getenv( "QWS_DISPLAY" ); | 1267 | QString d = getenv( "QWS_DISPLAY" ); |
1268 | if ( d.contains( "Rot90" ) ) { | 1268 | if ( d.contains( "Rot90" ) ) { |
1269 | deforient = 90; | 1269 | deforient = 90; |
1270 | } | 1270 | } |
1271 | else if ( d.contains( "Rot180" ) ) { | 1271 | else if ( d.contains( "Rot180" ) ) { |
1272 | deforient = 180; | 1272 | deforient = 180; |
1273 | } | 1273 | } |
1274 | else if ( d.contains( "Rot270" ) ) { | 1274 | else if ( d.contains( "Rot270" ) ) { |
1275 | deforient = 270; | 1275 | deforient = 270; |
1276 | } | 1276 | } |
1277 | else { | 1277 | else { |
1278 | deforient = 0; | 1278 | deforient = 0; |
1279 | } | 1279 | } |
1280 | } | 1280 | } |
1281 | return deforient; | 1281 | return deforient; |
1282 | } | 1282 | } |
1283 | 1283 | ||
1284 | /*! | 1284 | /*! |
1285 | \internal | 1285 | \internal |
1286 | */ | 1286 | */ |
1287 | void QPEApplication::setDefaultRotation( int r ) | 1287 | void QPEApplication::setDefaultRotation( int r ) |
1288 | { | 1288 | { |
1289 | if ( qApp->type() == GuiServer ) { | 1289 | if ( qApp->type() == GuiServer ) { |
1290 | deforient = r; | 1290 | deforient = r; |
1291 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 1291 | int j = 0; |
1292 | QCString old = getenv( "QWS_DISPLAY" ) ? getenv( "QWS_DISPLAY" ) : "Transformed"; | ||
1293 | QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() ); | ||
1294 | setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg(driver).arg( r ).latin1(), 1 ); | ||
1292 | Config config("qpe"); | 1295 | Config config("qpe"); |
1293 | config.setGroup( "Rotation" ); | 1296 | config.setGroup( "Rotation" ); |
1294 | config.writeEntry( "Rot", r ); | 1297 | config.writeEntry( "Rot", r ); |
1295 | } | 1298 | } |
1296 | else { | 1299 | else { |
1297 | #ifndef QT_NO_COP | 1300 | #ifndef QT_NO_COP |
1298 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 1301 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
1299 | e << r; | 1302 | e << r; |
1300 | } | 1303 | } |
1301 | #endif | 1304 | #endif |
1302 | 1305 | ||
1303 | } | 1306 | } |
1304 | } | 1307 | } |
1305 | 1308 | ||
1306 | #include <qgfx_qws.h> | 1309 | #include <qgfx_qws.h> |
1307 | #include <qwindowsystem_qws.h> | 1310 | #include <qwindowsystem_qws.h> |
1308 | 1311 | ||
1309 | #if QT_VERSION > 236 | 1312 | #if QT_VERSION > 236 |
1310 | extern void qws_clearLoadedFonts(); | 1313 | extern void qws_clearLoadedFonts(); |
1311 | #endif | 1314 | #endif |
1312 | 1315 | ||
1313 | void QPEApplication::setCurrentMode( int x, int y, int depth ) | 1316 | void QPEApplication::setCurrentMode( int x, int y, int depth ) |
1314 | { | 1317 | { |
1315 | // Reset the caches | 1318 | // Reset the caches |
1316 | #if QT_VERSION > 236 | 1319 | #if QT_VERSION > 236 |
1317 | qws_clearLoadedFonts(); | 1320 | qws_clearLoadedFonts(); |
1318 | #endif | 1321 | #endif |
1319 | QPixmapCache::clear(); | 1322 | QPixmapCache::clear(); |
1320 | 1323 | ||
1321 | // Change the screen mode | 1324 | // Change the screen mode |
1322 | qt_screen->setMode(x, y, depth); | 1325 | qt_screen->setMode(x, y, depth); |
1323 | 1326 | ||
1324 | if ( qApp->type() == GuiServer ) { | 1327 | if ( qApp->type() == GuiServer ) { |
1325 | #if QT_VERSION > 236 | 1328 | #if QT_VERSION > 236 |
1326 | // Reconfigure the GuiServer | 1329 | // Reconfigure the GuiServer |
1327 | qwsServer->beginDisplayReconfigure(); | 1330 | qwsServer->beginDisplayReconfigure(); |
1328 | qwsServer->endDisplayReconfigure(); | 1331 | qwsServer->endDisplayReconfigure(); |
1329 | #endif | 1332 | #endif |
1330 | // Get all the running apps to reset | 1333 | // Get all the running apps to reset |
1331 | QCopEnvelope env( "QPE/System", "reset()" ); | 1334 | QCopEnvelope env( "QPE/System", "reset()" ); |
1332 | } | 1335 | } |
1333 | } | 1336 | } |
1334 | 1337 | ||
1335 | void QPEApplication::reset() { | 1338 | void QPEApplication::reset() { |
1336 | // Reconnect to the screen | 1339 | // Reconnect to the screen |
1337 | qt_screen->disconnect(); | 1340 | qt_screen->disconnect(); |
1338 | qt_screen->connect( QString::null ); | 1341 | qt_screen->connect( QString::null ); |
1339 | 1342 | ||
1340 | // Redraw everything | 1343 | // Redraw everything |
1341 | applyStyle(); | 1344 | applyStyle(); |
1342 | } | 1345 | } |
1343 | 1346 | ||
1344 | #if (QT_VERSION < 238) && defined Q_OS_MACX | 1347 | #if (QT_VERSION < 238) && defined Q_OS_MACX |
1345 | bool qt_left_hand_scrollbars = false; | 1348 | bool qt_left_hand_scrollbars = false; |
1346 | #else | 1349 | #else |
1347 | extern bool qt_left_hand_scrollbars QPE_WEAK_SYMBOL; | 1350 | extern bool qt_left_hand_scrollbars QPE_WEAK_SYMBOL; |
1348 | #endif | 1351 | #endif |
1349 | 1352 | ||
1350 | /*! | 1353 | /*! |
1351 | \internal | 1354 | \internal |
1352 | */ | 1355 | */ |
1353 | void QPEApplication::applyStyle() | 1356 | void QPEApplication::applyStyle() |
1354 | { | 1357 | { |
1355 | Config config( "qpe" ); | 1358 | Config config( "qpe" ); |
1356 | config.setGroup( "Appearance" ); | 1359 | config.setGroup( "Appearance" ); |
1357 | 1360 | ||
1358 | #if QT_VERSION > 233 | 1361 | #if QT_VERSION > 233 |
1359 | // Widget style | 1362 | // Widget style |
1360 | QString style = config.readEntry( "Style", "FlatStyle" ); | 1363 | QString style = config.readEntry( "Style", "FlatStyle" ); |
1361 | 1364 | ||
1362 | internalSetStyle ( style ); | 1365 | internalSetStyle ( style ); |
1363 | 1366 | ||
1364 | // Colors - from /etc/colors/Liquid.scheme | 1367 | // Colors - from /etc/colors/Liquid.scheme |
1365 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); | 1368 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); |
1366 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); | 1369 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); |
1367 | QPalette pal( btncolor, bgcolor ); | 1370 | QPalette pal( btncolor, bgcolor ); |
1368 | QString color = config.readEntry( "Highlight", "#73adef" ); | 1371 | QString color = config.readEntry( "Highlight", "#73adef" ); |
1369 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); | 1372 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); |
1370 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 1373 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
1371 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 1374 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
1372 | color = config.readEntry( "Text", "#000000" ); | 1375 | color = config.readEntry( "Text", "#000000" ); |
1373 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 1376 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
1374 | color = config.readEntry( "ButtonText", "#000000" ); | 1377 | color = config.readEntry( "ButtonText", "#000000" ); |
1375 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 1378 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
1376 | color = config.readEntry( "Base", "#FFFFFF" ); | 1379 | color = config.readEntry( "Base", "#FFFFFF" ); |
1377 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 1380 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
1378 | 1381 | ||
1379 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 1382 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
1380 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 1383 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
1381 | 1384 | ||
1382 | setPalette( pal, TRUE ); | 1385 | setPalette( pal, TRUE ); |
1383 | 1386 | ||
1384 | 1387 | ||
1385 | // Set the ScrollBar on the 'right' side but only if the weak symbol is present | 1388 | // Set the ScrollBar on the 'right' side but only if the weak symbol is present |
1386 | if (&qt_left_hand_scrollbars ) | 1389 | if (&qt_left_hand_scrollbars ) |
1387 | qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false ); | 1390 | qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false ); |
diff --git a/library/qpeapplication.h b/library/qpeapplication.h index 167fe69..cff3e43 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h | |||
@@ -115,125 +115,128 @@ public: | |||
115 | DisableSuspend = 2, | 115 | DisableSuspend = 2, |
116 | Enable = 100 | 116 | Enable = 100 |
117 | }; | 117 | }; |
118 | 118 | ||
119 | static void setInputMethodHint( QWidget *, InputMethodHint ); | 119 | static void setInputMethodHint( QWidget *, InputMethodHint ); |
120 | static InputMethodHint inputMethodHint( QWidget * ); | 120 | static InputMethodHint inputMethodHint( QWidget * ); |
121 | 121 | ||
122 | void showMainWidget( QWidget*, bool nomax=FALSE ); | 122 | void showMainWidget( QWidget*, bool nomax=FALSE ); |
123 | void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); | 123 | void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); |
124 | 124 | ||
125 | static void showDialog( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; | 125 | static void showDialog( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; |
126 | static int execDialog ( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; | 126 | static int execDialog ( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; |
127 | static void showWidget( QWidget*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; | 127 | static void showWidget( QWidget*, bool nomax=FALSE ) QPE_WEAK_SYMBOL; |
128 | /* Merge setTempScreenSaverMode */ | 128 | /* Merge setTempScreenSaverMode */ |
129 | #ifdef QTOPIA_INTERNAL_INITAPP | 129 | #ifdef QTOPIA_INTERNAL_INITAPP |
130 | void initApp( int argv, char **argv ); | 130 | void initApp( int argv, char **argv ); |
131 | #endif | 131 | #endif |
132 | 132 | ||
133 | static void setKeepRunning(); | 133 | static void setKeepRunning(); |
134 | bool keepRunning() const; | 134 | bool keepRunning() const; |
135 | 135 | ||
136 | bool keyboardGrabbed() const; | 136 | bool keyboardGrabbed() const; |
137 | 137 | ||
138 | int exec(); | 138 | int exec(); |
139 | 139 | ||
140 | signals: | 140 | signals: |
141 | void clientMoused(); | 141 | void clientMoused(); |
142 | void timeChanged(); | 142 | void timeChanged(); |
143 | void clockChanged( bool pm ); | 143 | void clockChanged( bool pm ); |
144 | void micChanged( bool muted ); | 144 | void micChanged( bool muted ); |
145 | void volumeChanged( bool muted ); | 145 | void volumeChanged( bool muted ); |
146 | void appMessage( const QCString& msg, const QByteArray& data); | 146 | void appMessage( const QCString& msg, const QByteArray& data); |
147 | void weekChanged( bool startOnMonday ); | 147 | void weekChanged( bool startOnMonday ); |
148 | void dateFormatChanged( DateFormat ); | 148 | void dateFormatChanged( DateFormat ); |
149 | void flush(); | 149 | void flush(); |
150 | void reload(); | 150 | void reload(); |
151 | /* linkChanged signal */ | 151 | /* linkChanged signal */ |
152 | 152 | ||
153 | private slots: | 153 | private slots: |
154 | void systemMessage( const QCString &msg, const QByteArray &data ); | 154 | void systemMessage( const QCString &msg, const QByteArray &data ); |
155 | void pidMessage( const QCString &msg, const QByteArray &data ); | 155 | void pidMessage( const QCString &msg, const QByteArray &data ); |
156 | void removeSenderFromStylusDict(); | 156 | void removeSenderFromStylusDict(); |
157 | void hideOrQuit(); | 157 | void hideOrQuit(); |
158 | 158 | ||
159 | protected: | 159 | protected: |
160 | bool qwsEventFilter( QWSEvent * ); | 160 | bool qwsEventFilter( QWSEvent * ); |
161 | void internalSetStyle( const QString &style ); | 161 | void internalSetStyle( const QString &style ); |
162 | void prepareForTermination(bool willrestart); | 162 | void prepareForTermination(bool willrestart); |
163 | virtual void restart(); | 163 | virtual void restart(); |
164 | virtual void shutdown(); | 164 | virtual void shutdown(); |
165 | bool eventFilter( QObject *, QEvent * ); | 165 | bool eventFilter( QObject *, QEvent * ); |
166 | void timerEvent( QTimerEvent * ); | 166 | void timerEvent( QTimerEvent * ); |
167 | bool raiseAppropriateWindow(); | 167 | bool raiseAppropriateWindow(); |
168 | virtual void tryQuit(); | 168 | virtual void tryQuit(); |
169 | private: | 169 | private: |
170 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); | 170 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); |
171 | void processQCopFile(); | 171 | void processQCopFile(); |
172 | 172 | ||
173 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 173 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
174 | QCopChannel *sysChannel; | 174 | QCopChannel *sysChannel; |
175 | QCopChannel *pidChannel; | 175 | QCopChannel *pidChannel; |
176 | #endif | 176 | #endif |
177 | QPEApplicationData *d; | 177 | QPEApplicationData *d; |
178 | 178 | ||
179 | bool reserved_sh; | 179 | bool reserved_sh; |
180 | 180 | ||
181 | }; | 181 | }; |
182 | 182 | ||
183 | 183 | ||
184 | 184 | ||
185 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ | 185 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ |
186 | 186 | ||
187 | inline int TransToDeg ( Transformation t ) | 187 | inline int TransToDeg ( Transformation t ) |
188 | { | 188 | { |
189 | int d = static_cast<int>( t ); | 189 | int d = static_cast<int>( t ); |
190 | return d * 90; | 190 | return d * 90; |
191 | } | 191 | } |
192 | 192 | ||
193 | inline Transformation DegToTrans ( int d ) | 193 | inline Transformation DegToTrans ( int d ) |
194 | { | 194 | { |
195 | Transformation t = static_cast<Transformation>( d / 90 ); | 195 | Transformation t = static_cast<Transformation>( d / 90 ); |
196 | return t; | 196 | return t; |
197 | } | 197 | } |
198 | 198 | ||
199 | /* | 199 | /* |
200 | * Set current rotation of Opie, and rotation for newly started apps. | 200 | * Set current rotation of Opie, and rotation for newly started apps. |
201 | * Differs from setDefaultRotation in that 1) it rotates currently running apps, | 201 | * Differs from setDefaultRotation in that 1) it rotates currently running apps, |
202 | * and 2) does not set deforient or save orientation to qpe.conf. | 202 | * and 2) does not set deforient or save orientation to qpe.conf. |
203 | */ | 203 | */ |
204 | 204 | ||
205 | inline void QPEApplication::setCurrentRotation( int r ) | 205 | inline void QPEApplication::setCurrentRotation( int r ) |
206 | { | 206 | { |
207 | // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots | 207 | // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots |
208 | // for compatibility with the SharpROM use fallback to setDefaultTransformation() | 208 | // for compatibility with the SharpROM use fallback to setDefaultTransformation() |
209 | #if QT_VERSION > 233 | 209 | #if QT_VERSION > 233 |
210 | Transformation e = DegToTrans( r ); | 210 | Transformation e = DegToTrans( r ); |
211 | ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 211 | QCString old = getenv("QWS_DISPLAY") ? getenv( "QWS_DISPLAY" ) : "Transformed"; |
212 | int j = 0; | ||
213 | QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() ); | ||
214 | ::setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg( driver ).arg( r ).latin1(), 1 ); | ||
212 | qApp->desktop()->qwsDisplay()->setTransformation( e ); | 215 | qApp->desktop()->qwsDisplay()->setTransformation( e ); |
213 | #else | 216 | #else |
214 | setDefaultRotation( r ); | 217 | setDefaultRotation( r ); |
215 | #endif | 218 | #endif |
216 | } | 219 | } |
217 | 220 | ||
218 | /* | 221 | /* |
219 | * Qtopia 1.7 SDK compatibility macros | 222 | * Qtopia 1.7 SDK compatibility macros |
220 | * FIXME: Support Opie Quicklaunch Interface | 223 | * FIXME: Support Opie Quicklaunch Interface |
221 | */ | 224 | */ |
222 | #define QTOPIA_ADD_APPLICATION(NAME,IMPLEMENTATION) \ | 225 | #define QTOPIA_ADD_APPLICATION(NAME,IMPLEMENTATION) \ |
223 | int main( int argc, char** argv ) \ | 226 | int main( int argc, char** argv ) \ |
224 | { \ | 227 | { \ |
225 | QPEApplication app = QPEApplication( argc, argv );\ | 228 | QPEApplication app = QPEApplication( argc, argv );\ |
226 | IMPLEMENTATION* mw = new IMPLEMENTATION(); \ | 229 | IMPLEMENTATION* mw = new IMPLEMENTATION(); \ |
227 | app.showMainWidget( mw ); \ | 230 | app.showMainWidget( mw ); \ |
228 | app.exec(); \ | 231 | app.exec(); \ |
229 | } | 232 | } |
230 | #define QTOPIA_MAIN // Bee-Bop-Alula | 233 | #define QTOPIA_MAIN // Bee-Bop-Alula |
231 | 234 | ||
232 | /* | 235 | /* |
233 | * -remove me | 236 | * -remove me |
234 | */ | 237 | */ |
235 | #ifdef Q_WS_QWS | 238 | #ifdef Q_WS_QWS |
236 | extern Q_EXPORT QRect qt_maxWindowRect; | 239 | extern Q_EXPORT QRect qt_maxWindowRect; |
237 | #endif | 240 | #endif |
238 | 241 | ||
239 | #endif | 242 | #endif |