-rw-r--r-- | core/launcher/desktop.cpp | 36 | ||||
-rw-r--r-- | core/launcher/main.cpp | 11 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 7 | ||||
-rw-r--r-- | core/launcher/taskbar.h | 4 |
4 files changed, 21 insertions, 37 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index ab4f14a..7662e48 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp @@ -22,48 +22,50 @@ #include "info.h" #include "launcher.h" #include "mrulist.h" #include "qcopbridge.h" #include "shutdownimpl.h" #include "startmenu.h" #include "taskbar.h" #include "transferserver.h" #include "irserver.h" #include "packageslave.h" #include <qpe/applnk.h> #include <qpe/mimetype.h> #include <qpe/password.h> #include <qpe/config.h> #include <qpe/power.h> #include <qpe/timeconversion.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/global.h> #if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) #include <qpe/custom.h> #endif +#include <opie/odevice.h> + #include <qgfx_qws.h> #include <qmainwindow.h> #include <qmessagebox.h> #include <qtimer.h> #include <qwindowsystem_qws.h> #include <qvaluelist.h> #include <stdlib.h> #include <unistd.h> class QCopKeyRegister { public: QCopKeyRegister() : keyCode(0) { } QCopKeyRegister(int k, const QString &c, const QString &m) : keyCode(k), channel(c), message(m) { } int getKeyCode() const { return keyCode; } QString getChannel() const { return channel; } QString getMessage() const { return message; } private: int keyCode; @@ -246,49 +248,49 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e ) // See main.cpp for new KeyboardFilter // // if ( ke->simpleData.keycode == Key_SysReq ) { // if ( press ) emit power(); // return TRUE; // } if ( ke->simpleData.keycode == Key_F35 ) { if ( press ) emit backlight(); return TRUE; } if ( ke->simpleData.keycode == Key_F32 ) { if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); return TRUE; } if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { if ( press ) emit symbol(); return TRUE; } if ( ke->simpleData.keycode == Key_NumLock ) { if ( press ) emit numLockStateToggle(); } if ( ke->simpleData.keycode == Key_CapsLock ) { if ( press ) emit capsLockStateToggle(); } - if ( press ) + if (( press && !autoRepeat ) || ( !press && autoRepeat )) qpedesktop->keyClick(); } else { if ( e->type == QWSEvent::Mouse ) { QWSMouseEvent *me = (QWSMouseEvent *)e; static bool up = TRUE; if ( me->simpleData.state&LeftButton ) { if ( up ) { up = FALSE; qpedesktop->screenClick(); } } else { up = TRUE; } } } return QPEApplication::qwsEventFilter( e ); } #endif void DesktopApplication::psTimeout() { qpedesktop->checkMemory(); // in case no events are being generated @@ -306,64 +308,56 @@ void DesktopApplication::psTimeout() if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) { pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 ); } } void DesktopApplication::sendCard() { delete cardSendTimer; cardSendTimer = 0; QString card = getenv("HOME"); card += "/Applications/addressbook/businesscard.vcf"; if ( QFile::exists( card ) ) { QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); QString mimetype = "text/x-vCard"; e << tr("business card") << card << mimetype; } } #if defined(QPE_HAVE_MEMALERTER) QPE_MEMALERTER_IMPL #endif -#if defined(CUSTOM_SOUND_IMPL) -CUSTOM_SOUND_IMPL -#endif - //=========================================================================== Desktop::Desktop() : QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), qcopBridge( 0 ), transferServer( 0 ), packageSlave( 0 ) { -#ifdef CUSTOM_SOUND_INIT - CUSTOM_SOUND_INIT; -#endif - qpedesktop = this; // bg = new Info( this ); tb = new TaskBar; launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); connect(launcher, SIGNAL(busy()), tb, SLOT(startWait())); connect(launcher, SIGNAL(notBusy(const QString&)), tb, SLOT(stopWait(const QString&))); int displayw = qApp->desktop()->width(); int displayh = qApp->desktop()->height(); QSize sz = tb->sizeHint(); setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); tb->show(); launcher->showMaximized(); launcher->show(); launcher->raise(); #if defined(QPE_HAVE_MEMALERTER) @@ -735,62 +729,56 @@ void Desktop::timerEvent( QTimerEvent *e ) void Desktop::terminateServers() { delete transferServer; delete qcopBridge; transferServer = 0; qcopBridge = 0; } void Desktop::rereadVolumes() { Config cfg("qpe"); cfg.setGroup("Volume"); touchclick = cfg.readBoolEntry("TouchSound"); keyclick = cfg.readBoolEntry("KeySound"); alarmsound = cfg.readBoolEntry("AlarmSound"); // Config cfg("Sound"); // cfg.setGroup("System"); // touchclick = cfg.readBoolEntry("Touch"); // keyclick = cfg.readBoolEntry("Key"); } void Desktop::keyClick() { -#ifdef CUSTOM_SOUND_KEYCLICK if ( keyclick ) - CUSTOM_SOUND_KEYCLICK; -#endif + ODevice::inst ( )-> keySound ( ); } void Desktop::screenClick() { -#ifdef CUSTOM_SOUND_TOUCH if ( touchclick ) - CUSTOM_SOUND_TOUCH; -#endif + ODevice::inst ( )-> touchSound ( ); } void Desktop::soundAlarm() { -#ifdef CUSTOM_SOUND_ALARM if (qpedesktop->alarmsound) - CUSTOM_SOUND_ALARM; -#endif + ODevice::inst ( )-> alarmSound ( ); } -bool Desktop::eventFilter( QObject *w, QEvent *ev ) +bool Desktop::eventFilter( QObject *, QEvent *ev ) { if ( ev->type() == QEvent::KeyPress ) { QKeyEvent *ke = (QKeyEvent *)ev; if ( ke->key() == Qt::Key_F11 ) { // menu key QWidget *active = qApp->activeWindow(); - if ( active && active->isPopup() ) { + + if ( active && active-> isPopup ( )) active->close(); - } + raiseMenu(); - return TRUE; + return true; } } - return FALSE; + return false; } - diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 347eee9..b3c331b 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp @@ -8,55 +8,55 @@ ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "desktop.h" #include "taskbar.h" #include "stabmon.h" #include <qpe/qpeapplication.h> #include <qpe/network.h> #include <qpe/config.h> #if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) #include <qpe/custom.h> #endif +#include <opie/odevice.h> + #include <qfile.h> #include <qwindowsystem_qws.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/alarmserver.h> -#include <opie/ohwinfo.h> - #include <stdlib.h> #include <stdio.h> #include <signal.h> #include <unistd.h> #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) #include "../calibrate/calibrate.h" #endif #ifdef QT_QWS_LOGIN #include "../login/qdmdialogimpl.h" #endif #ifdef QT_QWS_CASSIOPEIA static void ignoreMessage( QtMsgType, const char * ) { } #include <sys/mount.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> #include <qdatetime.h> @@ -172,64 +172,64 @@ void initEnvironment() setenv( "TZ", tz, 1 ); config.writeEntry( "Timezone", tz); config.setGroup( "Language" ); QString lang = config.readEntry( "Language", getenv("LANG") ); if ( !lang.isNull() ) setenv( "LANG", lang, 1 ); } static void initBacklight() { QCopEnvelope e("QPE/System", "setBacklight(int)" ); e << -3; // Forced on } class ModelKeyFilter : public QObject, public QWSServer::KeyboardFilter { public: ModelKeyFilter ( ) : QObject ( 0, "MODEL_KEY_FILTER" ) { bool doinst = false; - m_model = OHwInfo::inst ( )-> model ( ); + m_model = ODevice::inst ( )-> model ( ); m_power_timer = 0; switch ( m_model ) { case OMODEL_iPAQ_H31xx: case OMODEL_iPAQ_H36xx: case OMODEL_iPAQ_H37xx: case OMODEL_iPAQ_H38xx: doinst = true; break; default : break; } if ( doinst ) QWSServer::setKeyboardFilter ( this ); } - virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ) + virtual bool filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) { bool kill = false; // Rotate cursor keys 180° switch ( m_model ) { case OMODEL_iPAQ_H31xx: case OMODEL_iPAQ_H38xx: { int newkeycode = keycode; switch ( keycode ) { case Key_Left : newkeycode = Key_Right; break; case Key_Right: newkeycode = Key_Left; break; case Key_Up : newkeycode = Key_Down; break; case Key_Down : newkeycode = Key_Up; break; } if ( newkeycode != keycode ) { QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); kill = true; } break; } default: break; } @@ -246,50 +246,49 @@ public: else if ( m_power_timer ) { killTimer ( m_power_timer ); m_power_timer = 0; QWSServer::sendKeyEvent ( -1, Key_F34, 0, true, false ); QWSServer::sendKeyEvent ( -1, Key_F34, 0, false, false ); } kill = true; } break; } default: break; } return kill; } virtual void timerEvent ( QTimerEvent * ) { killTimer ( m_power_timer ); m_power_timer = 0; QWSServer::sendKeyEvent ( -1, Key_F35, 0, true, false ); QWSServer::sendKeyEvent ( -1, Key_F35, 0, false, false ); } private: - OHwModel m_model; - bool m_power_press; + OModel m_model; int m_power_timer; }; int initApplication( int argc, char ** argv ) { #ifdef QT_QWS_CASSIOPEIA initCassiopeia(); #endif #ifdef QPE_OWNAPM initAPM(); #endif #ifdef QT_DEMO_SINGLE_FLOPPY initFloppy(); #endif initEnvironment(); #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) setenv( "QWS_SIZE", "240x320", 0 ); #endif diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index 5e95c99..e38b9fe 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp @@ -16,48 +16,50 @@ ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** *********************************************************************/ #include "startmenu.h" #include "inputmethods.h" #include "mrulist.h" #include "systray.h" #include "calibrate.h" #include "wait.h" #include "appicons.h" #include "taskbar.h" #include "desktop.h" #include <qpe/qpeapplication.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/global.h> #if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) #include <qpe/custom.h> #endif +#include <opie/odevice.h> + #include <qlabel.h> #include <qlayout.h> #include <qtimer.h> #include <qwindowsystem_qws.h> #include <qwidgetstack.h> #if defined( Q_WS_QWS ) #include <qwsdisplay_qws.h> #include <qgfx_qws.h> #endif #define FACTORY(T) \ static QWidget *new##T( bool maximized ) { \ QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ if ( maximized ) { \ if ( qApp->desktop()->width() <= 350 ) { \ w->showMaximized(); \ } else { \ w->resize( QSize( 300, 300 ) ); \ } \ } \ w->show(); \ return w; \ @@ -248,55 +250,54 @@ void TaskBar::calcMaxWindowRect() #else QWSServer::setMaxWindowRect( wr ); #endif #endif } void TaskBar::receive( const QCString &msg, const QByteArray &data ) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "message(QString)" ) { QString text; stream >> text; setStatusMessage( text ); } else if ( msg == "hideInputMethod()" ) { inputMethods->hideInputMethod(); } else if ( msg == "showInputMethod()" ) { inputMethods->showInputMethod(); } else if ( msg == "reloadInputMethods()" ) { inputMethods->loadInputMethods(); } else if ( msg == "reloadApplets()" ) { sysTray->loadApplets(); } else if ( msg == "soundAlarm()" ) { Desktop::soundAlarm(); } -#ifdef CUSTOM_LEDS else if ( msg == "setLed(int,bool)" ) { int led, status; stream >> led >> status; - CUSTOM_LEDS( led, status ); + + ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off ); } -#endif } QWidget *TaskBar::calibrate(bool) { #ifdef Q_WS_QWS Calibrate *c = new Calibrate; c->show(); return c; #else return 0; #endif } void TaskBar::toggleNumLockState() { if ( lockState ) lockState->toggleNumLockState(); } void TaskBar::toggleCapsLockState() { if ( lockState ) lockState->toggleCapsLockState(); } void TaskBar::toggleSymbolInput() diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h index 78c4722..40983af 100644 --- a/core/launcher/taskbar.h +++ b/core/launcher/taskbar.h @@ -1,51 +1,47 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef __TASKBAR_H__ #define __TASKBAR_H__ -#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) -#include <qpe/custom.h> -#endif - #include <qhbox.h> class QLabel; class QTimer; class InputMethods; class Wait; class SysTray; class MRUList; class QWidgetStack; class QTimer; class QLabel; class StartMenu; class LockKeyState; class TaskBar : public QHBox { Q_OBJECT public: TaskBar(); ~TaskBar(); static QWidget *calibrate( bool ); bool recoverMemory(); |