author | mickeyl <mickeyl> | 2004-09-12 15:05:47 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-09-12 15:05:47 (UTC) |
commit | 1ecaa166126baf48c1ed280963b421d70e1afcda (patch) (unidiff) | |
tree | 32cb18504edb47019b11bf1704a165f9171fdaab | |
parent | 146ce9b20f9c225b8bea13beb9338684c20384a2 (diff) | |
download | opie-1ecaa166126baf48c1ed280963b421d70e1afcda.zip opie-1ecaa166126baf48c1ed280963b421d70e1afcda.tar.gz opie-1ecaa166126baf48c1ed280963b421d70e1afcda.tar.bz2 |
show text label and remove bogus sleep
-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 | |||
@@ -1760,402 +1760,393 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) | |||
1760 | QDataStream stream( data, IO_ReadOnly ); | 1760 | QDataStream stream( data, IO_ReadOnly ); |
1761 | QString doc; | 1761 | QString doc; |
1762 | stream >> doc; | 1762 | stream >> doc; |
1763 | QWidget *mw = mainWidget(); | 1763 | QWidget *mw = mainWidget(); |
1764 | if ( !mw ) | 1764 | if ( !mw ) |
1765 | mw = d->qpe_main_widget; | 1765 | mw = d->qpe_main_widget; |
1766 | if ( mw ) | 1766 | if ( mw ) |
1767 | Global::setDocument( mw, doc ); | 1767 | Global::setDocument( mw, doc ); |
1768 | 1768 | ||
1769 | } else if ( msg == "QPEProcessQCop()" ) { | 1769 | } else if ( msg == "QPEProcessQCop()" ) { |
1770 | processQCopFile(); | 1770 | processQCopFile(); |
1771 | d->sendQCopQ(); | 1771 | d->sendQCopQ(); |
1772 | }else | 1772 | }else |
1773 | { | 1773 | { |
1774 | bool p = d->keep_running; | 1774 | bool p = d->keep_running; |
1775 | d->keep_running = FALSE; | 1775 | d->keep_running = FALSE; |
1776 | emit appMessage( msg, data); | 1776 | emit appMessage( msg, data); |
1777 | if ( d->keep_running ) { | 1777 | if ( d->keep_running ) { |
1778 | d->notbusysent = FALSE; | 1778 | d->notbusysent = FALSE; |
1779 | raiseAppropriateWindow(); | 1779 | raiseAppropriateWindow(); |
1780 | if ( !p ) { | 1780 | if ( !p ) { |
1781 | // Tell the system we're still chugging along... | 1781 | // Tell the system we're still chugging along... |
1782 | #ifndef QT_NO_COP | 1782 | #ifndef QT_NO_COP |
1783 | QCopEnvelope e("QPE/System", "appRaised(QString)"); | 1783 | QCopEnvelope e("QPE/System", "appRaised(QString)"); |
1784 | e << d->appName; | 1784 | e << d->appName; |
1785 | #endif | 1785 | #endif |
1786 | } | 1786 | } |
1787 | } | 1787 | } |
1788 | if ( p ) | 1788 | if ( p ) |
1789 | d->keep_running = p; | 1789 | d->keep_running = p; |
1790 | } | 1790 | } |
1791 | #endif | 1791 | #endif |
1792 | } | 1792 | } |
1793 | 1793 | ||
1794 | 1794 | ||
1795 | /*! | 1795 | /*! |
1796 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1796 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1797 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1797 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1798 | 1798 | ||
1799 | \sa showMainDocumentWidget() | 1799 | \sa showMainDocumentWidget() |
1800 | */ | 1800 | */ |
1801 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) | 1801 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) |
1802 | { | 1802 | { |
1803 | // setMainWidget(mw); this breaks FastLoading because lastWindowClose() would quit | 1803 | // setMainWidget(mw); this breaks FastLoading because lastWindowClose() would quit |
1804 | d->show(mw, nomaximize ); | 1804 | d->show(mw, nomaximize ); |
1805 | } | 1805 | } |
1806 | 1806 | ||
1807 | /*! | 1807 | /*! |
1808 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1808 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1809 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1809 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1810 | 1810 | ||
1811 | This calls designates the application as | 1811 | This calls designates the application as |
1812 | a \link docwidget.html document-oriented\endlink application. | 1812 | a \link docwidget.html document-oriented\endlink application. |
1813 | 1813 | ||
1814 | The \a mw widget \e must have this slot: setDocument(const QString&). | 1814 | The \a mw widget \e must have this slot: setDocument(const QString&). |
1815 | 1815 | ||
1816 | \sa showMainWidget() | 1816 | \sa showMainWidget() |
1817 | */ | 1817 | */ |
1818 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) | 1818 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) |
1819 | { | 1819 | { |
1820 | if ( mw && argc() == 2 ) | 1820 | if ( mw && argc() == 2 ) |
1821 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); | 1821 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); |
1822 | 1822 | ||
1823 | 1823 | ||
1824 | // setMainWidget(mw); see above | 1824 | // setMainWidget(mw); see above |
1825 | d->show(mw, nomaximize ); | 1825 | d->show(mw, nomaximize ); |
1826 | } | 1826 | } |
1827 | 1827 | ||
1828 | 1828 | ||
1829 | /*! | 1829 | /*! |
1830 | If an application is started via a \link qcop.html QCop\endlink | 1830 | If an application is started via a \link qcop.html QCop\endlink |
1831 | message, the application will process the \link qcop.html | 1831 | message, the application will process the \link qcop.html |
1832 | QCop\endlink message and then quit. If the application calls this | 1832 | QCop\endlink message and then quit. If the application calls this |
1833 | function while processing a \link qcop.html QCop\endlink message, | 1833 | function while processing a \link qcop.html QCop\endlink message, |
1834 | after processing its outstanding \link qcop.html QCop\endlink | 1834 | after processing its outstanding \link qcop.html QCop\endlink |
1835 | messages the application will start 'properly' and show itself. | 1835 | messages the application will start 'properly' and show itself. |
1836 | 1836 | ||
1837 | \sa keepRunning() | 1837 | \sa keepRunning() |
1838 | */ | 1838 | */ |
1839 | void QPEApplication::setKeepRunning() | 1839 | void QPEApplication::setKeepRunning() |
1840 | { | 1840 | { |
1841 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { | 1841 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { |
1842 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; | 1842 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; |
1843 | qpeApp->d->keep_running = TRUE; | 1843 | qpeApp->d->keep_running = TRUE; |
1844 | } | 1844 | } |
1845 | } | 1845 | } |
1846 | 1846 | ||
1847 | /*! | 1847 | /*! |
1848 | Returns TRUE if the application will quit after processing the | 1848 | Returns TRUE if the application will quit after processing the |
1849 | current list of qcop messages; otherwise returns FALSE. | 1849 | current list of qcop messages; otherwise returns FALSE. |
1850 | 1850 | ||
1851 | \sa setKeepRunning() | 1851 | \sa setKeepRunning() |
1852 | */ | 1852 | */ |
1853 | bool QPEApplication::keepRunning() const | 1853 | bool QPEApplication::keepRunning() const |
1854 | { | 1854 | { |
1855 | return d->keep_running; | 1855 | return d->keep_running; |
1856 | } | 1856 | } |
1857 | 1857 | ||
1858 | /*! | 1858 | /*! |
1859 | \internal | 1859 | \internal |
1860 | */ | 1860 | */ |
1861 | void QPEApplication::internalSetStyle( const QString &style ) | 1861 | void QPEApplication::internalSetStyle( const QString &style ) |
1862 | { | 1862 | { |
1863 | #if QT_VERSION >= 300 | 1863 | #if QT_VERSION >= 300 |
1864 | if ( style == "QPE" ) { | 1864 | if ( style == "QPE" ) { |
1865 | setStyle( new QPEStyle ); | 1865 | setStyle( new QPEStyle ); |
1866 | } | 1866 | } |
1867 | else { | 1867 | else { |
1868 | QStyle *s = QStyleFactory::create( style ); | 1868 | QStyle *s = QStyleFactory::create( style ); |
1869 | if ( s ) | 1869 | if ( s ) |
1870 | setStyle( s ); | 1870 | setStyle( s ); |
1871 | } | 1871 | } |
1872 | #else | 1872 | #else |
1873 | if ( style == "Windows" ) { | 1873 | if ( style == "Windows" ) { |
1874 | setStyle( new QWindowsStyle ); | 1874 | setStyle( new QWindowsStyle ); |
1875 | } | 1875 | } |
1876 | else if ( style == "QPE" ) { | 1876 | else if ( style == "QPE" ) { |
1877 | setStyle( new QPEStyle ); | 1877 | setStyle( new QPEStyle ); |
1878 | } | 1878 | } |
1879 | else if ( style == "Light" ) { | 1879 | else if ( style == "Light" ) { |
1880 | setStyle( new LightStyle ); | 1880 | setStyle( new LightStyle ); |
1881 | } | 1881 | } |
1882 | #ifndef QT_NO_STYLE_PLATINUM | 1882 | #ifndef QT_NO_STYLE_PLATINUM |
1883 | else if ( style == "Platinum" ) { | 1883 | else if ( style == "Platinum" ) { |
1884 | setStyle( new QPlatinumStyle ); | 1884 | setStyle( new QPlatinumStyle ); |
1885 | } | 1885 | } |
1886 | #endif | 1886 | #endif |
1887 | #ifndef QT_NO_STYLE_MOTIF | 1887 | #ifndef QT_NO_STYLE_MOTIF |
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 ); |
2034 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); | 2025 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); |
2035 | w->installEventFilter( qApp ); | 2026 | w->installEventFilter( qApp ); |
2036 | } | 2027 | } |
2037 | } | 2028 | } |
2038 | 2029 | ||
2039 | 2030 | ||
2040 | /*! | 2031 | /*! |
2041 | \reimp | 2032 | \reimp |
2042 | */ | 2033 | */ |
2043 | bool QPEApplication::eventFilter( QObject *o, QEvent *e ) | 2034 | bool QPEApplication::eventFilter( QObject *o, QEvent *e ) |
2044 | { | 2035 | { |
2045 | if ( !o->isWidgetType() ) | 2036 | if ( !o->isWidgetType() ) |
2046 | return FALSE; | 2037 | return FALSE; |
2047 | 2038 | ||
2048 | if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { | 2039 | if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { |
2049 | QMouseEvent * me = ( QMouseEvent* ) e; | 2040 | QMouseEvent * me = ( QMouseEvent* ) e; |
2050 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); | 2041 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); |
2051 | switch (mode) { | 2042 | switch (mode) { |
2052 | case RightOnHold: | 2043 | case RightOnHold: |
2053 | switch ( me->type() ) { | 2044 | switch ( me->type() ) { |
2054 | case QEvent::MouseButtonPress: | 2045 | case QEvent::MouseButtonPress: |
2055 | if ( me->button() == LeftButton ) { | 2046 | if ( me->button() == LeftButton ) { |
2056 | static long Pref = 500; // #### pref. | 2047 | static long Pref = 500; // #### pref. |
2057 | d->presswidget = (QWidget*)o; | 2048 | d->presswidget = (QWidget*)o; |
2058 | d->presspos = me->pos(); | 2049 | d->presspos = me->pos(); |
2059 | d->rightpressed = FALSE; | 2050 | d->rightpressed = FALSE; |
2060 | #ifdef OPIE_WITHROHFEEDBACK | 2051 | #ifdef OPIE_WITHROHFEEDBACK |
2061 | if( ! d->RoH ) | 2052 | if( ! d->RoH ) |
2062 | d->RoH = new Opie::Internal::RoHFeedback; | 2053 | d->RoH = new Opie::Internal::RoHFeedback; |
2063 | 2054 | ||
2064 | d->RoH->init( me->globalPos(), d->presswidget ); | 2055 | d->RoH->init( me->globalPos(), d->presswidget ); |
2065 | Pref = d->RoH->delay(); | 2056 | Pref = d->RoH->delay(); |
2066 | 2057 | ||
2067 | #endif | 2058 | #endif |
2068 | if (!d->presstimer ) | 2059 | if (!d->presstimer ) |
2069 | d->presstimer = startTimer( Pref ); // #### pref. | 2060 | d->presstimer = startTimer( Pref ); // #### pref. |
2070 | 2061 | ||
2071 | } | 2062 | } |
2072 | break; | 2063 | break; |
2073 | case QEvent::MouseMove: | 2064 | case QEvent::MouseMove: |
2074 | if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { | 2065 | if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { |
2075 | killTimer(d->presstimer); | 2066 | killTimer(d->presstimer); |
2076 | #ifdef OPIE_WITHROHFEEDBACK | 2067 | #ifdef OPIE_WITHROHFEEDBACK |
2077 | d->RoH->stop(); | 2068 | d->RoH->stop(); |
2078 | #endif | 2069 | #endif |
2079 | d->presstimer = 0; | 2070 | d->presstimer = 0; |
2080 | } | 2071 | } |
2081 | break; | 2072 | break; |
2082 | case QEvent::MouseButtonRelease: | 2073 | case QEvent::MouseButtonRelease: |
2083 | if ( me->button() == LeftButton ) { | 2074 | if ( me->button() == LeftButton ) { |
2084 | if ( d->presstimer ) { | 2075 | if ( d->presstimer ) { |
2085 | killTimer(d->presstimer); | 2076 | killTimer(d->presstimer); |
2086 | #ifdef OPIE_WITHROHFEEDBACK | 2077 | #ifdef OPIE_WITHROHFEEDBACK |
2087 | d->RoH->stop( ); | 2078 | d->RoH->stop( ); |
2088 | #endif | 2079 | #endif |
2089 | d->presstimer = 0; | 2080 | d->presstimer = 0; |
2090 | } | 2081 | } |
2091 | if ( d->rightpressed && d->presswidget ) { | 2082 | if ( d->rightpressed && d->presswidget ) { |
2092 | printf( "Send ButtonRelease\n" ); | 2083 | printf( "Send ButtonRelease\n" ); |
2093 | // Right released | 2084 | // Right released |
2094 | postEvent( d->presswidget, | 2085 | postEvent( d->presswidget, |
2095 | new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), | 2086 | new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), |
2096 | RightButton, LeftButton + RightButton ) ); | 2087 | RightButton, LeftButton + RightButton ) ); |
2097 | // Left released, off-widget | 2088 | // Left released, off-widget |
2098 | postEvent( d->presswidget, | 2089 | postEvent( d->presswidget, |
2099 | new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), | 2090 | new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), |
2100 | LeftButton, LeftButton ) ); | 2091 | LeftButton, LeftButton ) ); |
2101 | postEvent( d->presswidget, | 2092 | postEvent( d->presswidget, |
2102 | new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), | 2093 | new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), |
2103 | LeftButton, LeftButton ) ); | 2094 | LeftButton, LeftButton ) ); |
2104 | d->rightpressed = FALSE; | 2095 | d->rightpressed = FALSE; |
2105 | return TRUE; // don't send the real Left release | 2096 | return TRUE; // don't send the real Left release |
2106 | } | 2097 | } |
2107 | } | 2098 | } |
2108 | break; | 2099 | break; |
2109 | default: | 2100 | default: |
2110 | break; | 2101 | break; |
2111 | } | 2102 | } |
2112 | break; | 2103 | break; |
2113 | default: | 2104 | default: |
2114 | ; | 2105 | ; |
2115 | } | 2106 | } |
2116 | } | 2107 | } |
2117 | else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 2108 | else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
2118 | QKeyEvent *ke = (QKeyEvent *)e; | 2109 | QKeyEvent *ke = (QKeyEvent *)e; |
2119 | if ( ke->key() == Key_Enter ) { | 2110 | if ( ke->key() == Key_Enter ) { |
2120 | if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { | 2111 | if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { |
2121 | postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', | 2112 | postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', |
2122 | ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); | 2113 | ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); |
2123 | return TRUE; | 2114 | return TRUE; |
2124 | } | 2115 | } |
2125 | } | 2116 | } |
2126 | } | 2117 | } |
2127 | return FALSE; | 2118 | return FALSE; |
2128 | } | 2119 | } |
2129 | 2120 | ||
2130 | /*! | 2121 | /*! |
2131 | \reimp | 2122 | \reimp |
2132 | */ | 2123 | */ |
2133 | void QPEApplication::timerEvent( QTimerEvent *e ) | 2124 | void QPEApplication::timerEvent( QTimerEvent *e ) |
2134 | { | 2125 | { |
2135 | if ( e->timerId() == d->presstimer && d->presswidget ) { | 2126 | if ( e->timerId() == d->presstimer && d->presswidget ) { |
2136 | 2127 | ||
2137 | // Right pressed | 2128 | // Right pressed |
2138 | postEvent( d->presswidget, | 2129 | postEvent( d->presswidget, |
2139 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, | 2130 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, |
2140 | RightButton, LeftButton ) ); | 2131 | RightButton, LeftButton ) ); |
2141 | killTimer( d->presstimer ); | 2132 | killTimer( d->presstimer ); |
2142 | d->presstimer = 0; | 2133 | d->presstimer = 0; |
2143 | d->rightpressed = TRUE; | 2134 | d->rightpressed = TRUE; |
2144 | #ifdef OPIE_WITHROHFEEDBACK | 2135 | #ifdef OPIE_WITHROHFEEDBACK |
2145 | d->RoH->stop(); | 2136 | d->RoH->stop(); |
2146 | #endif | 2137 | #endif |
2147 | } | 2138 | } |
2148 | } | 2139 | } |
2149 | 2140 | ||
2150 | void QPEApplication::removeSenderFromStylusDict() | 2141 | void QPEApplication::removeSenderFromStylusDict() |
2151 | { | 2142 | { |
2152 | stylusDict->remove | 2143 | stylusDict->remove |
2153 | ( ( void* ) sender() ); | 2144 | ( ( void* ) sender() ); |
2154 | if ( d->presswidget == sender() ) | 2145 | if ( d->presswidget == sender() ) |
2155 | d->presswidget = 0; | 2146 | d->presswidget = 0; |
2156 | } | 2147 | } |
2157 | 2148 | ||
2158 | /*! | 2149 | /*! |
2159 | \internal | 2150 | \internal |
2160 | */ | 2151 | */ |
2161 | bool QPEApplication::keyboardGrabbed() const | 2152 | bool QPEApplication::keyboardGrabbed() const |