-rw-r--r-- | library/qpeapplication.cpp | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index ca90427..e1edd4c 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1888,146 +1888,137 @@ void QPEApplication::internalSetStyle( const QString &style ) | |||
1888 | else if ( style == "Motif" ) { | 1888 | else if ( style == "Motif" ) { |
1889 | setStyle( new QMotifStyle ); | 1889 | setStyle( new QMotifStyle ); |
1890 | } | 1890 | } |
1891 | #endif | 1891 | #endif |
1892 | #ifndef QT_NO_STYLE_MOTIFPLUS | 1892 | #ifndef QT_NO_STYLE_MOTIFPLUS |
1893 | else if ( style == "MotifPlus" ) { | 1893 | else if ( style == "MotifPlus" ) { |
1894 | setStyle( new QMotifPlusStyle ); | 1894 | setStyle( new QMotifPlusStyle ); |
1895 | } | 1895 | } |
1896 | #endif | 1896 | #endif |
1897 | 1897 | ||
1898 | else { | 1898 | else { |
1899 | QStyle *sty = 0; | 1899 | QStyle *sty = 0; |
1900 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; | 1900 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; |
1901 | 1901 | ||
1902 | #ifdef Q_OS_MACX | 1902 | #ifdef Q_OS_MACX |
1903 | if ( style. find ( ".dylib" ) > 0 ) | 1903 | if ( style. find ( ".dylib" ) > 0 ) |
1904 | path += style; | 1904 | path += style; |
1905 | else | 1905 | else |
1906 | path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility | 1906 | path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility |
1907 | #else | 1907 | #else |
1908 | if ( style. find ( ".so" ) > 0 ) | 1908 | if ( style. find ( ".so" ) > 0 ) |
1909 | path += style; | 1909 | path += style; |
1910 | else | 1910 | else |
1911 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility | 1911 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility |
1912 | #endif | 1912 | #endif |
1913 | static QLibrary *lastlib = 0; | 1913 | static QLibrary *lastlib = 0; |
1914 | static StyleInterface *lastiface = 0; | 1914 | static StyleInterface *lastiface = 0; |
1915 | 1915 | ||
1916 | QLibrary *lib = new QLibrary ( path ); | 1916 | QLibrary *lib = new QLibrary ( path ); |
1917 | StyleInterface *iface = 0; | 1917 | StyleInterface *iface = 0; |
1918 | 1918 | ||
1919 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) | 1919 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) |
1920 | sty = iface-> style ( ); | 1920 | sty = iface-> style ( ); |
1921 | 1921 | ||
1922 | if ( sty ) { | 1922 | if ( sty ) { |
1923 | setStyle ( sty ); | 1923 | setStyle ( sty ); |
1924 | 1924 | ||
1925 | if ( lastiface ) | 1925 | if ( lastiface ) |
1926 | lastiface-> release ( ); | 1926 | lastiface-> release ( ); |
1927 | lastiface = iface; | 1927 | lastiface = iface; |
1928 | 1928 | ||
1929 | if ( lastlib ) { | 1929 | if ( lastlib ) { |
1930 | lastlib-> unload ( ); | 1930 | lastlib-> unload ( ); |
1931 | delete lastlib; | 1931 | delete lastlib; |
1932 | } | 1932 | } |
1933 | lastlib = lib; | 1933 | lastlib = lib; |
1934 | } | 1934 | } |
1935 | else { | 1935 | else { |
1936 | if ( iface ) | 1936 | if ( iface ) |
1937 | iface-> release ( ); | 1937 | iface-> release ( ); |
1938 | delete lib; | 1938 | delete lib; |
1939 | 1939 | ||
1940 | setStyle ( new LightStyle ( )); | 1940 | setStyle ( new LightStyle ( )); |
1941 | } | 1941 | } |
1942 | } | 1942 | } |
1943 | #endif | 1943 | #endif |
1944 | } | 1944 | } |
1945 | 1945 | ||
1946 | /*! | 1946 | /*! |
1947 | \internal | 1947 | \internal |
1948 | */ | 1948 | */ |
1949 | void QPEApplication::prepareForTermination( bool willrestart ) | 1949 | void QPEApplication::prepareForTermination( bool willrestart ) |
1950 | { | 1950 | { |
1951 | if ( willrestart ) { | 1951 | if ( willrestart ) { |
1952 | // Draw a big wait icon, the image can be altered in later revisions | 1952 | QLabel *lblWait = new QLabel( tr( "Please wait..." ), 0, "wait hack", QWidget::WStyle_Customize | |
1953 | // QWidget *d = QApplication::desktop(); | ||
1954 | QImage img = Resource::loadImage( "launcher/new_wait" ); | ||
1955 | QPixmap pix; | ||
1956 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); | ||
1957 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | | ||
1958 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); | 1953 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); |
1959 | lblWait->setPixmap( pix ); | ||
1960 | lblWait->setAlignment( QWidget::AlignCenter ); | 1954 | lblWait->setAlignment( QWidget::AlignCenter ); |
1961 | lblWait->show(); | 1955 | lblWait->show(); |
1962 | lblWait->showMaximized(); | 1956 | lblWait->showMaximized(); |
1963 | } | 1957 | } |
1964 | #ifndef SINGLE_APP | ||
1965 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); | 1958 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); |
1966 | } | 1959 | } |
1967 | processEvents(); // ensure the message goes out. | 1960 | processEvents(); // ensure the message goes out. |
1968 | sleep( 1 ); // You have 1 second to comply. | ||
1969 | #endif | ||
1970 | } | 1961 | } |
1971 | 1962 | ||
1972 | /*! | 1963 | /*! |
1973 | \internal | 1964 | \internal |
1974 | */ | 1965 | */ |
1975 | void QPEApplication::shutdown() | 1966 | void QPEApplication::shutdown() |
1976 | { | 1967 | { |
1977 | // Implement in server's QPEApplication subclass | 1968 | // Implement in server's QPEApplication subclass |
1978 | } | 1969 | } |
1979 | 1970 | ||
1980 | /*! | 1971 | /*! |
1981 | \internal | 1972 | \internal |
1982 | */ | 1973 | */ |
1983 | void QPEApplication::restart() | 1974 | void QPEApplication::restart() |
1984 | { | 1975 | { |
1985 | // Implement in server's QPEApplication subclass | 1976 | // Implement in server's QPEApplication subclass |
1986 | } | 1977 | } |
1987 | 1978 | ||
1988 | static QPtrDict<void>* stylusDict = 0; | 1979 | static QPtrDict<void>* stylusDict = 0; |
1989 | static void createDict() | 1980 | static void createDict() |
1990 | { | 1981 | { |
1991 | if ( !stylusDict ) | 1982 | if ( !stylusDict ) |
1992 | stylusDict = new QPtrDict<void>; | 1983 | stylusDict = new QPtrDict<void>; |
1993 | } | 1984 | } |
1994 | 1985 | ||
1995 | /*! | 1986 | /*! |
1996 | Returns the current StylusMode for widget \a w. | 1987 | Returns the current StylusMode for widget \a w. |
1997 | 1988 | ||
1998 | \sa setStylusOperation() StylusMode | 1989 | \sa setStylusOperation() StylusMode |
1999 | */ | 1990 | */ |
2000 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) | 1991 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) |
2001 | { | 1992 | { |
2002 | if ( stylusDict ) | 1993 | if ( stylusDict ) |
2003 | return ( StylusMode ) ( int ) stylusDict->find( w ); | 1994 | return ( StylusMode ) ( int ) stylusDict->find( w ); |
2004 | return LeftOnly; | 1995 | return LeftOnly; |
2005 | } | 1996 | } |
2006 | 1997 | ||
2007 | /*! | 1998 | /*! |
2008 | \enum QPEApplication::StylusMode | 1999 | \enum QPEApplication::StylusMode |
2009 | 2000 | ||
2010 | \value LeftOnly the stylus only generates LeftButton | 2001 | \value LeftOnly the stylus only generates LeftButton |
2011 | events (the default). | 2002 | events (the default). |
2012 | \value RightOnHold the stylus generates RightButton events | 2003 | \value RightOnHold the stylus generates RightButton events |
2013 | if the user uses the press-and-hold gesture. | 2004 | if the user uses the press-and-hold gesture. |
2014 | 2005 | ||
2015 | \sa setStylusOperation() stylusOperation() | 2006 | \sa setStylusOperation() stylusOperation() |
2016 | */ | 2007 | */ |
2017 | 2008 | ||
2018 | /*! | 2009 | /*! |
2019 | Causes widget \a w to receive mouse events according to the stylus | 2010 | Causes widget \a w to receive mouse events according to the stylus |
2020 | \a mode. | 2011 | \a mode. |
2021 | 2012 | ||
2022 | \sa stylusOperation() StylusMode | 2013 | \sa stylusOperation() StylusMode |
2023 | */ | 2014 | */ |
2024 | void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) | 2015 | void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) |
2025 | { | 2016 | { |
2026 | createDict(); | 2017 | createDict(); |
2027 | if ( mode == LeftOnly ) { | 2018 | if ( mode == LeftOnly ) { |
2028 | stylusDict->remove | 2019 | stylusDict->remove |
2029 | ( w ); | 2020 | ( w ); |
2030 | w->removeEventFilter( qApp ); | 2021 | w->removeEventFilter( qApp ); |
2031 | } | 2022 | } |
2032 | else { | 2023 | else { |
2033 | stylusDict->insert( w, ( void* ) mode ); | 2024 | stylusDict->insert( w, ( void* ) mode ); |