-rw-r--r-- | configs/linux-sharp-g++-shared | 2 | ||||
-rw-r--r-- | configs/linux-sharp-g++-shared-debug | 2 | ||||
-rw-r--r-- | configs/linux-sharp-g++-static | 2 | ||||
-rw-r--r-- | configs/linux-sharp-g++-static-debug | 2 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 2 | ||||
-rw-r--r-- | core/launcher/desktop.cpp | 2 | ||||
-rw-r--r-- | core/launcher/main.cpp | 2 | ||||
-rw-r--r-- | core/launcher/shutdownimpl.cpp | 2 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 4 | ||||
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol_threaded.cpp | 2 | ||||
-rw-r--r-- | library/alarmserver.cpp | 2 | ||||
-rw-r--r-- | library/power.cpp | 4 | ||||
-rw-r--r-- | library/storage.cpp | 2 | ||||
-rw-r--r-- | qt/qte233-for-opie091-keyboard.patch | 4 |
14 files changed, 17 insertions, 17 deletions
diff --git a/configs/linux-sharp-g++-shared b/configs/linux-sharp-g++-shared index 9c1dd03..862ee34 100644 --- a/configs/linux-sharp-g++-shared +++ b/configs/linux-sharp-g++-shared @@ -1,94 +1,94 @@ # Compiling INTERFACE_DECL_PATH = . SYSCONF_CXX = arm-linux-g++ SYSCONF_CC = arm-linux-gcc DASHCROSS = -arm # Compiling with support libraries SYSCONF_CXXFLAGS_X11 = SYSCONF_CXXFLAGS_QT = -I$(QTDIR)/include SYSCONF_CXXFLAGS_OPENGL = -I/usr/X11R6/include # Compiling YACC output SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses # Linking with support libraries SYSCONF_RPATH_X11 = SYSCONF_RPATH_QT = -Wl,-rpath,$(QTDIR)/lib SYSCONF_RPATH_OPENGL = -Wl,-rpath,/usr/X11R6/lib # Linking with support libraries # X11 SYSCONF_LFLAGS_X11 = SYSCONF_LIBS_X11 = # Qt, Qt+OpenGL SYSCONF_LFLAGS_QT = -L$(QTDIR)/lib SYSCONF_LIBS_QT = -lqte$(QT_THREAD_SUFFIX) SYSCONF_LIBS_QT_OPENGL = # OpenGL SYSCONF_LFLAGS_OPENGL = -L/usr/X11R6/lib SYSCONF_LIBS_OPENGL = # Yacc SYSCONF_LIBS_YACC = # Linking applications SYSCONF_LINK = arm-linux-gcc SYSCONF_LFLAGS = SYSCONF_LIBS = # Link flags for shared objects SYSCONF_LFLAGS_SHOBJ = -shared # Flags for threading SYSCONF_CFLAGS_THREAD = -D_REENTRANT SYSCONF_CXXFLAGS_THREAD = -D_REENTRANT SYSCONF_LFLAGS_THREAD = SYSCONF_LIBS_THREAD = -lpthread # Meta-object compiler SYSCONF_MOC = $(QTDIR)/bin/moc # UI compiler SYSCONF_UIC = $(QTDIR)/bin/uic # Linking shared libraries # - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2 # - Place target in $(DESTDIR) - which has a trailing / # - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH) # SYSCONF_LINK_SHLIB = arm-linux-gcc SYSCONF_LINK_TARGET_SHARED = lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH) SYSCONF_LINK_LIB_SHARED = $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \ $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \ $(OBJECTS) $(OBJMOC) $(LIBS) && \ mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \ cd $(DESTDIR) && \ rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN) # Linking static libraries # - Build the $(TARGET) library, eg. lib$(TARGET).a # - Place target in $(DESTDIR) - which has a trailing / # SYSCONF_AR = arm-linux-ar cqs SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a SYSCONF_LINK_LIB_STATIC = rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \ $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC) # Compiling application source -SYSCONF_CXXFLAGS = -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -O2 -Wall -W +SYSCONF_CXXFLAGS = -pipe -DQT_QWS_EBX -DQT_QWS_SHARP -DQWS -fno-exceptions -fno-rtti -O2 -Wall -W SYSCONF_CFLAGS = -pipe -O2 -Wall -W # Default link type (static linking is still be used where required) SYSCONF_LINK_LIB = $(SYSCONF_LINK_LIB_SHARED) SYSCONF_LINK_TARGET = $(SYSCONF_LINK_TARGET_SHARED) # Compiling library source SYSCONF_CXXFLAGS_LIB = -fPIC SYSCONF_CFLAGS_LIB = -fPIC # Compiling shared-object source SYSCONF_CXXFLAGS_SHOBJ = -fPIC SYSCONF_CFLAGS_SHOBJ = -fPIC # Linking Qt SYSCONF_LIBS_QTLIB = $(SYSCONF_LFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT) # Linking Qt applications SYSCONF_LIBS_QTAPP = diff --git a/configs/linux-sharp-g++-shared-debug b/configs/linux-sharp-g++-shared-debug index 810eef5..5e7819c 100644 --- a/configs/linux-sharp-g++-shared-debug +++ b/configs/linux-sharp-g++-shared-debug @@ -1,94 +1,94 @@ # Compiling INTERFACE_DECL_PATH = . SYSCONF_CXX = arm-linux-g++ SYSCONF_CC = arm-linux-gcc DASHCROSS = -arm # Compiling with support libraries SYSCONF_CXXFLAGS_X11 = SYSCONF_CXXFLAGS_QT = -I$(QTDIR)/include SYSCONF_CXXFLAGS_OPENGL = -I/usr/X11R6/include # Compiling YACC output SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses # Linking with support libraries SYSCONF_RPATH_X11 = SYSCONF_RPATH_QT = -Wl,-rpath,$(QTDIR)/lib SYSCONF_RPATH_OPENGL = -Wl,-rpath,/usr/X11R6/lib # Linking with support libraries # X11 SYSCONF_LFLAGS_X11 = SYSCONF_LIBS_X11 = # Qt, Qt+OpenGL SYSCONF_LFLAGS_QT = -L$(QTDIR)/lib SYSCONF_LIBS_QT = -lqte$(QT_THREAD_SUFFIX) SYSCONF_LIBS_QT_OPENGL = # OpenGL SYSCONF_LFLAGS_OPENGL = -L/usr/X11R6/lib SYSCONF_LIBS_OPENGL = # Yacc SYSCONF_LIBS_YACC = # Linking applications SYSCONF_LINK = arm-linux-gcc SYSCONF_LFLAGS = SYSCONF_LIBS = # Link flags for shared objects SYSCONF_LFLAGS_SHOBJ = -shared # Flags for threading SYSCONF_CFLAGS_THREAD = -D_REENTRANT SYSCONF_CXXFLAGS_THREAD = -D_REENTRANT SYSCONF_LFLAGS_THREAD = SYSCONF_LIBS_THREAD = -lpthread # Meta-object compiler SYSCONF_MOC = $(QTDIR)/bin/moc # UI compiler SYSCONF_UIC = $(QTDIR)/bin/uic # Linking shared libraries # - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2 # - Place target in $(DESTDIR) - which has a trailing / # - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH) # SYSCONF_LINK_SHLIB = arm-linux-gcc SYSCONF_LINK_TARGET_SHARED = lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH) SYSCONF_LINK_LIB_SHARED = $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \ $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \ $(OBJECTS) $(OBJMOC) $(LIBS) && \ mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \ cd $(DESTDIR) && \ rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN) # Linking static libraries # - Build the $(TARGET) library, eg. lib$(TARGET).a # - Place target in $(DESTDIR) - which has a trailing / # SYSCONF_AR = arm-linux-ar cqs SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a SYSCONF_LINK_LIB_STATIC = rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \ $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC) # Compiling application source -SYSCONF_CXXFLAGS = -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -g -Wall -W +SYSCONF_CXXFLAGS = -pipe -DQT_QWS_EBX -DQT_QWS_SHARP -DQWS -fno-exceptions -fno-rtti -g -Wall -W SYSCONF_CFLAGS = -pipe -g -Wall -W # Default link type (static linking is still be used where required) SYSCONF_LINK_LIB = $(SYSCONF_LINK_LIB_SHARED) SYSCONF_LINK_TARGET = $(SYSCONF_LINK_TARGET_SHARED) # Compiling library source SYSCONF_CXXFLAGS_LIB = -fPIC SYSCONF_CFLAGS_LIB = -fPIC # Compiling shared-object source SYSCONF_CXXFLAGS_SHOBJ = -fPIC SYSCONF_CFLAGS_SHOBJ = -fPIC # Linking Qt SYSCONF_LIBS_QTLIB = $(SYSCONF_LFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT) # Linking Qt applications SYSCONF_LIBS_QTAPP = diff --git a/configs/linux-sharp-g++-static b/configs/linux-sharp-g++-static index 15e4c7f..22d3d04 100644 --- a/configs/linux-sharp-g++-static +++ b/configs/linux-sharp-g++-static @@ -1,93 +1,93 @@ # Compiling INTERFACE_DECL_PATH = . SYSCONF_CXX = arm-linux-g++ SYSCONF_CC = arm-linux-gcc DASHCROSS = -arm # Compiling with support libraries SYSCONF_CXXFLAGS_X11 = SYSCONF_CXXFLAGS_QT = -I$(QTDIR)/include SYSCONF_CXXFLAGS_OPENGL = -I/usr/X11R6/include # Compiling YACC output SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses # Linking with support libraries SYSCONF_RPATH_X11 = SYSCONF_RPATH_QT = -Wl,-rpath,$(QTDIR)/lib SYSCONF_RPATH_OPENGL = -Wl,-rpath,/usr/X11R6/lib # Linking with support libraries # X11 SYSCONF_LFLAGS_X11 = SYSCONF_LIBS_X11 = # Qt, Qt+OpenGL SYSCONF_LFLAGS_QT = -L$(QTDIR)/lib SYSCONF_LIBS_QT = -lqte$(QT_THREAD_SUFFIX) SYSCONF_LIBS_QT_OPENGL = # OpenGL SYSCONF_LFLAGS_OPENGL = -L/usr/X11R6/lib SYSCONF_LIBS_OPENGL = # Yacc SYSCONF_LIBS_YACC = # Linking applications SYSCONF_LINK = arm-linux-gcc SYSCONF_LFLAGS = SYSCONF_LIBS = # Link flags for shared objects SYSCONF_LFLAGS_SHOBJ = -shared # Flags for threading SYSCONF_CFLAGS_THREAD = -D_REENTRANT SYSCONF_CXXFLAGS_THREAD = -D_REENTRANT SYSCONF_LFLAGS_THREAD = SYSCONF_LIBS_THREAD = -lpthread # Meta-object compiler SYSCONF_MOC = $(QTDIR)/bin/moc # UI compiler SYSCONF_UIC = $(QTDIR)/bin/uic # Linking shared libraries # - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2 # - Place target in $(DESTDIR) - which has a trailing / # - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH) # SYSCONF_LINK_SHLIB = arm-linux-gcc SYSCONF_LINK_TARGET_SHARED = lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH) SYSCONF_LINK_LIB_SHARED = $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \ $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \ $(OBJECTS) $(OBJMOC) $(LIBS) && \ mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \ cd $(DESTDIR) && \ rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN) # Linking static libraries # - Build the $(TARGET) library, eg. lib$(TARGET).a # - Place target in $(DESTDIR) - which has a trailing / # SYSCONF_AR = arm-linux-ar cqs SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a SYSCONF_LINK_LIB_STATIC = rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \ $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC) # Compiling application source -SYSCONF_CXXFLAGS = -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -O2 -Wall -W +SYSCONF_CXXFLAGS = -pipe -DQT_QWS_EBX -DQT_QWS_SHARP -DQWS -fno-exceptions -fno-rtti -O2 -Wall -W SYSCONF_CFLAGS = -pipe -O2 -Wall -W SYSCONF_LINK_LIB = $(SYSCONF_LINK_LIB_STATIC) SYSCONF_LINK_TARGET = $(SYSCONF_LINK_TARGET_STATIC) # Compiling library source SYSCONF_CXXFLAGS_LIB = SYSCONF_CFLAGS_LIB = # Compiling shared-object source SYSCONF_CXXFLAGS_SHOBJ = -fPIC SYSCONF_CFLAGS_SHOBJ = -fPIC # Linking Qt SYSCONF_LIBS_QTLIB = $(SYSCONF_CXXFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT) # Linking Qt applications SYSCONF_LIBS_QTAPP = $(SYSCONF_LFLAGS_X11) $(SYSCONF_CXXFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT) $(SYSCONF_LIBS_X11) diff --git a/configs/linux-sharp-g++-static-debug b/configs/linux-sharp-g++-static-debug index d7715ed..9c1afd3 100644 --- a/configs/linux-sharp-g++-static-debug +++ b/configs/linux-sharp-g++-static-debug @@ -1,93 +1,93 @@ # Compiling INTERFACE_DECL_PATH = . SYSCONF_CXX = arm-linux-g++ SYSCONF_CC = arm-linux-gcc DASHCROSS = -arm # Compiling with support libraries SYSCONF_CXXFLAGS_X11 = SYSCONF_CXXFLAGS_QT = -I$(QTDIR)/include SYSCONF_CXXFLAGS_OPENGL = -I/usr/X11R6/include # Compiling YACC output SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses # Linking with support libraries SYSCONF_RPATH_X11 = SYSCONF_RPATH_QT = -Wl,-rpath,$(QTDIR)/lib SYSCONF_RPATH_OPENGL = -Wl,-rpath,/usr/X11R6/lib # Linking with support libraries # X11 SYSCONF_LFLAGS_X11 = SYSCONF_LIBS_X11 = # Qt, Qt+OpenGL SYSCONF_LFLAGS_QT = -L$(QTDIR)/lib SYSCONF_LIBS_QT = -lqte$(QT_THREAD_SUFFIX) SYSCONF_LIBS_QT_OPENGL = # OpenGL SYSCONF_LFLAGS_OPENGL = -L/usr/X11R6/lib SYSCONF_LIBS_OPENGL = # Yacc SYSCONF_LIBS_YACC = # Linking applications SYSCONF_LINK = arm-linux-gcc SYSCONF_LFLAGS = SYSCONF_LIBS = # Link flags for shared objects SYSCONF_LFLAGS_SHOBJ = -shared # Flags for threading SYSCONF_CFLAGS_THREAD = -D_REENTRANT SYSCONF_CXXFLAGS_THREAD = -D_REENTRANT SYSCONF_LFLAGS_THREAD = SYSCONF_LIBS_THREAD = -lpthread # Meta-object compiler SYSCONF_MOC = $(QTDIR)/bin/moc # UI compiler SYSCONF_UIC = $(QTDIR)/bin/uic # Linking shared libraries # - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2 # - Place target in $(DESTDIR) - which has a trailing / # - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH) # SYSCONF_LINK_SHLIB = arm-linux-gcc SYSCONF_LINK_TARGET_SHARED = lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH) SYSCONF_LINK_LIB_SHARED = $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \ $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \ $(OBJECTS) $(OBJMOC) $(LIBS) && \ mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \ cd $(DESTDIR) && \ rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \ ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN) # Linking static libraries # - Build the $(TARGET) library, eg. lib$(TARGET).a # - Place target in $(DESTDIR) - which has a trailing / # SYSCONF_AR = arm-linux-ar cqs SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a SYSCONF_LINK_LIB_STATIC = rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \ $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC) # Compiling application source -SYSCONF_CXXFLAGS = -pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -g -Wall -W +SYSCONF_CXXFLAGS = -pipe -DQT_QWS_EBX -DQT_QWS_SHARP -DQWS -fno-exceptions -fno-rtti -g -Wall -W SYSCONF_CFLAGS = -pipe -g -Wall -W SYSCONF_LINK_LIB = $(SYSCONF_LINK_LIB_STATIC) SYSCONF_LINK_TARGET = $(SYSCONF_LINK_TARGET_STATIC) # Compiling library source SYSCONF_CXXFLAGS_LIB = SYSCONF_CFLAGS_LIB = # Compiling shared-object source SYSCONF_CXXFLAGS_SHOBJ = -fPIC SYSCONF_CFLAGS_SHOBJ = -fPIC # Linking Qt SYSCONF_LIBS_QTLIB = $(SYSCONF_CXXFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT) # Linking Qt applications SYSCONF_LIBS_QTAPP = $(SYSCONF_LFLAGS_X11) $(SYSCONF_CXXFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT) $(SYSCONF_LIBS_X11) diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index d6ee6e8..cacc3c4 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp @@ -916,385 +916,385 @@ void TEWidget::setMouseMarks(bool on) mouse_marks = on; setCursor( mouse_marks ? ibeamCursor : arrowCursor ); } /* ------------------------------------------------------------------------- */ /* */ /* Clipboard */ /* */ /* ------------------------------------------------------------------------- */ #undef KeyPress void TEWidget::emitSelection() // Paste Clipboard by simulating keypress events { #ifndef QT_NO_CLIPBOARD QString text = QApplication::clipboard()->text(); if ( ! text.isNull() ) { text.replace(QRegExp("\n"), "\r"); QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text); emit keyPressedSignal(&e); // expose as a big fat keypress event emit clearSelectionSignal(); } #endif } void TEWidget::emitText(QString text) { QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text); emit keyPressedSignal(&e); // expose as a big fat keypress event } void TEWidget::pasteClipboard( ) { emitSelection(); } void TEWidget::setSelection(const QString& t) { #ifndef QT_NO_CLIPBOARD // Disconnect signal while WE set the clipboard QObject *cb = QApplication::clipboard(); QObject::disconnect( cb, SIGNAL(dataChanged()), this, SLOT(onClearSelection()) ); QApplication::clipboard()->setText(t); QObject::connect( cb, SIGNAL(dataChanged()), this, SLOT(onClearSelection()) ); #endif } void TEWidget::onClearSelection() { emit clearSelectionSignal(); } /* ------------------------------------------------------------------------- */ /* */ /* Keyboard */ /* */ /* ------------------------------------------------------------------------- */ //FIXME: an `eventFilter' has been installed instead of a `keyPressEvent' // due to a bug in `QT' or the ignorance of the author to prevent // repaint events being emitted to the screen whenever one leaves // or reenters the screen to/from another application. // // Troll says one needs to change focusInEvent() and focusOutEvent(), // which would also let you have an in-focus cursor and an out-focus // cursor like xterm does. // for the auto-hide cursor feature, I added empty focusInEvent() and // focusOutEvent() so that update() isn't called. // For auto-hide, we need to get keypress-events, but we only get them when // we have focus. void TEWidget::doScroll(int lines) { scrollbar->setValue(scrollbar->value()+lines); } void TEWidget::doHScroll(int lines) { hScrollbar->setValue( hScrollbar->value()+lines); } bool TEWidget::eventFilter( QObject *obj, QEvent *e ) { if ( (e->type() == QEvent::Accel || e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { static_cast<QKeyEvent *>( e )->ignore(); return true; } if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) return FALSE; // not us if ( e->type() == QEvent::Wheel) { QApplication::sendEvent(scrollbar, e); } #ifdef FAKE_CTRL_AND_ALT static bool control = FALSE; static bool alt = FALSE; // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); bool dele=FALSE; if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { QKeyEvent* ke = (QKeyEvent*)e; bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); switch (ke->key()) { case Key_F9: // let this be "Control" control = keydown; e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); dele=TRUE; break; case Key_F13: // let this be "Alt" alt = keydown; e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); dele=TRUE; break; default: if ( control ) { int a = toupper(ke->ascii())-64; if ( a >= 0 && a < ' ' ) { e = new QKeyEvent(e->type(), ke->key(), a, ke->state()|ControlButton, QChar(a,0)); dele=TRUE; } } if ( alt ) { e = new QKeyEvent(e->type(), ke->key(), ke->ascii(), ke->state()|AltButton, ke->text()); dele=TRUE; } } } #endif if ( e->type() == QEvent::KeyPress ) { QKeyEvent* ke = (QKeyEvent*)e; actSel=0; // Key stroke implies a screen update, so TEWidget won't // know where the current selection is. // qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker // qDebug("key pressed 2 is 0x%x", ke->key()); emitText("\\"); // expose } else if( ke->state() == ControlButton && ke->key() == Key_V) { pasteClipboard(); } else emit keyPressedSignal(ke); // expose ke->accept(); #ifdef FAKE_CTRL_AND_ALT if ( dele ) delete e; #endif return true; // stop the event } if ( e->type() == QEvent::Enter ) { QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), this, SLOT(onClearSelection()) ); } if ( e->type() == QEvent::Leave ) { QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), this, SLOT(onClearSelection()) ); } return QFrame::eventFilter( obj, e ); } /* ------------------------------------------------------------------------- */ /* */ /* Frame */ /* */ /* ------------------------------------------------------------------------- */ void TEWidget::frameChanged() { propagateSize(); update(); } /* ------------------------------------------------------------------------- */ /* */ /* Sound */ /* */ /* ------------------------------------------------------------------------- */ void TEWidget::Bell() { -//#ifdef QT_QWS_CUSTOM +//#ifdef QT_QWS_SHARP //# ifndef QT_NO_COP QCopEnvelope( "QPE/TaskBar", "soundAlarm()" ); //# endif //#else //# ifndef QT_NO_SOUND // QSound::play(Resource::findSound("alarm")); //# endif //#endif // QApplication::beep(); } /* ------------------------------------------------------------------------- */ /* */ /* Auxiluary */ /* */ /* ------------------------------------------------------------------------- */ void TEWidget::clearImage() // initialize the image // for internal use only { for (int y = 0; y < lines; y++) for (int x = 0; x < columns; x++) { image[loc(x,y)].c = 0xff; //' '; image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; } } // Create Image /////////////////////////////////////////////////////// void TEWidget::calcGeometry() { int showhscrollbar = 1; int hwidth = 0; int dcolumns; Config cfg("Konsole"); cfg.setGroup("ScrollBar"); useHorzScroll=cfg.readBoolEntry("HorzScroll",0); if(vcolumns == 0) showhscrollbar = 0; if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width(); scrollbar->resize(QApplication::style().scrollBarExtent().width(), contentsRect().height() - hwidth); switch(scrollLoc) { case SCRNONE : columns = ( contentsRect().width() - 2 * rimX ) / font_w; dcolumns = columns; if(vcolumns) columns = vcolumns; blX = (contentsRect().width() - (columns*font_w) ) / 2; if(showhscrollbar) blX = -hposition * font_w; brX = blX; scrollbar->hide(); break; case SCRLEFT : columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; dcolumns = columns; if(vcolumns) columns = vcolumns; brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; if(showhscrollbar) brX = -hposition * font_w; blX = brX + scrollbar->width(); scrollbar->move(contentsRect().topLeft()); scrollbar->show(); break; case SCRRIGHT: columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; dcolumns = columns; if(vcolumns) columns = vcolumns; blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; if(showhscrollbar) blX = -hposition * font_w; brX = blX; scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); scrollbar->show(); break; } //FIXME: support 'rounding' styles lines = ( contentsRect().height() - 2 * rimY ) / font_h; bY = (contentsRect().height() - (lines *font_h)) / 2; if(showhscrollbar == 1) { hScrollbar->resize(contentsRect().width() - hwidth, hwidth); hScrollbar->setRange(0, vcolumns - dcolumns); QPoint p = contentsRect().bottomLeft(); hScrollbar->move(QPoint(p.x(), p.y() - hwidth)); hScrollbar->show(); } else hScrollbar->hide(); if(showhscrollbar == 1) { lines = lines - (hwidth / font_h) - 1; if(lines < 1) lines = 1; } //FIXME: support 'rounding' styles } void TEWidget::makeImage() //FIXME: rename 'calcGeometry? { calcGeometry(); image = (ca*) malloc(lines*columns*sizeof(ca)); clearImage(); } // calculate the needed size QSize TEWidget::calcSize(int cols, int lins) const { int frw = width() - contentsRect().width(); int frh = height() - contentsRect().height(); int scw = (scrollLoc==SCRNONE?0:scrollbar->width()); return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh ); } QSize TEWidget::sizeHint() const { return size(); } void TEWidget::styleChange(QStyle &) { propagateSize(); } #ifndef QT_NO_DRAGANDDROP /* --------------------------------------------------------------------- */ /* */ /* Drag & Drop */ /* */ /* --------------------------------------------------------------------- */ void TEWidget::dragEnterEvent(QDragEnterEvent* e) { e->accept(QTextDrag::canDecode(e) || QUriDrag::canDecode(e)); } void TEWidget::dropEvent(QDropEvent* event) { // The current behaviour when url(s) are dropped is // * if there is only ONE url and if it's a LOCAL one, ask for paste or cd // * in all other cases, just paste // (for non-local ones, or for a list of URLs, 'cd' is nonsense) QStrList strlist; int file_count = 0; dropText = ""; bool bPopup = true; if(QUriDrag::decode(event, strlist)) { if (strlist.count()) { for(const char* p = strlist.first(); p; p = strlist.next()) { if(file_count++ > 0) { dropText += " "; bPopup = false; // more than one file, don't popup } /* KURL url(p); if (url.isLocalFile()) { dropText += url.path(); // local URL : remove protocol } else { dropText += url.prettyURL(); bPopup = false; // a non-local file, don't popup } */ } if (bPopup) // m_drop->popup(pos() + event->pos()); m_drop->popup(mapToGlobal(event->pos())); else { if (currentSession) { currentSession->getEmulation()->sendString(dropText.local8Bit()); } // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; } } } else if(QTextDrag::decode(event, dropText)) { // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index f2e00d8..3e8c731 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp @@ -1,235 +1,235 @@ /********************************************************************** ** 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. ** **********************************************************************/ #include "desktop.h" #include "info.h" #include "launcher.h" #include "qcopbridge.h" #include "shutdownimpl.h" #include "startmenu.h" #include "taskbar.h" #include "transferserver.h" #include "irserver.h" #include "packageslave.h" #include "screensaver.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/network.h> #include <qpe/global.h> -#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) +#if defined( QT_QWS_SHARP ) || 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> #include <fcntl.h> using namespace Opie; 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; QString channel, message; }; typedef QValueList<QCopKeyRegister> KeyRegisterList; KeyRegisterList keyRegisterList; static Desktop* qpedesktop = 0; static int loggedin = 0; static void login( bool at_poweron ) { if ( !loggedin ) { Global::terminateBuiltin( "calibrate" ); Password::authenticate( at_poweron ); loggedin = 1; QCopEnvelope e( "QPE/Desktop", "unlocked()" ); } } bool Desktop::screenLocked() { return loggedin == 0; } /* Priority is number of alerts that are needed to pop up alert. */ class DesktopPowerAlerter : public QMessageBox { public: DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) : QMessageBox( tr( "Battery Status" ), "Low Battery", QMessageBox::Critical, QMessageBox::Ok | QMessageBox::Default, QMessageBox::NoButton, QMessageBox::NoButton, parent, name, FALSE ) { currentPriority = INT_MAX; alertCount = 0; } void alert( const QString &text, int priority ); void hideEvent( QHideEvent * ); private: int currentPriority; int alertCount; }; void DesktopPowerAlerter::alert( const QString &text, int priority ) { alertCount++; if ( alertCount < priority ) return ; if ( priority > currentPriority ) return ; currentPriority = priority; setText( text ); show(); } void DesktopPowerAlerter::hideEvent( QHideEvent *e ) { QMessageBox::hideEvent( e ); alertCount = 0; currentPriority = INT_MAX; } void DesktopApplication::switchLCD ( bool on ) { if ( qApp ) { DesktopApplication *dapp = (DesktopApplication *) qApp; if ( dapp-> m_screensaver ) { if ( on ) { dapp-> m_screensaver-> setDisplayState ( true ); dapp-> m_screensaver-> setBacklight ( -3 ); } else { dapp-> m_screensaver-> setDisplayState ( false ); } } } } DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) : QPEApplication( argc, argv, appType ) { Config cfg( "apm" ); cfg.setGroup( "Warnings" ); //cfg.readNumEntry( "checkinterval", 10000 ) m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 ); m_powerCritical = cfg.readNumEntry( "powercritical", 5 ); m_ps = new PowerStatus; m_ps_last = new PowerStatus; pa = new DesktopPowerAlerter( 0 ); m_timer = new QTimer( this ); connect( m_timer, SIGNAL( timeout() ), this, SLOT( apmTimeout() ) ); m_timer->start( 5000 ); channel = new QCopChannel( "QPE/Desktop", this ); connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), this, SLOT( desktopMessage( const QCString&, const QByteArray& ) ) ); channel = new QCopChannel( "QPE/System", this ); connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); m_screensaver = new OpieScreenSaver ( ); m_screensaver-> setInterval ( -1 ); QWSServer::setScreenSaver( m_screensaver ); apmTimeout ( ); } DesktopApplication::~DesktopApplication() { delete m_ps; delete m_ps_last; delete pa; } void DesktopApplication::apmTimeout() { qpedesktop->checkMemory(); // in case no events are being generated *m_ps_last = *m_ps; *m_ps = PowerStatusManager::readStatus(); if ( m_ps-> acStatus ( ) != m_ps_last-> acStatus ( )) m_screensaver-> powerStatusChanged ( *m_ps ); if ( m_ps-> acStatus ( ) != PowerStatus::Online ) { int bat = m_ps-> batteryPercentRemaining ( ); if ( bat < m_ps_last-> batteryPercentRemaining ( )) { if ( bat <= m_powerCritical ) pa->alert( tr( "Battery level is critical!\nKeep power off until power restored!" ), 1 ); else if ( bat <= m_powerVeryLow ) pa->alert( tr( "Battery is running very low." ), 2 ); } if ( m_ps-> backupBatteryStatus ( ) == PowerStatus::VeryLow ) pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 2 ); diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index b517c7d..8b91f5d 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp @@ -1,182 +1,182 @@ /********************************************************************** ** 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. ** **********************************************************************/ #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 ) +#if defined( QT_QWS_SHARP ) || defined( QT_QWS_IPAQ ) #include <qpe/custom.h> #endif #include <opie/odevice.h> #include <qmessagebox.h> #include <qfile.h> #include <qimage.h> #include <qwindowsystem_qws.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/alarmserver.h> #include <stdlib.h> #include <stdio.h> #include <signal.h> #include <unistd.h> #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) #include "../calibrate/calibrate.h" #endif using namespace Opie; void initEnvironment() { Config config("locale"); config.setGroup( "Location" ); QString tz = config.readEntry( "Timezone", getenv("TZ") ); // if not timezone set, pick New York if (tz.isNull()) tz = "America/New_York"; 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 ); } int initApplication( int argc, char ** argv ) { initEnvironment(); #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) setenv( "QWS_SIZE", "240x320", 0 ); #endif //Don't flicker at startup: QWSServer::setDesktopBackground( QImage() ); DesktopApplication a( argc, argv, QApplication::GuiServer ); ODevice::inst ( )-> setSoftSuspend ( true ); { // init backlight QCopEnvelope e("QPE/System", "setBacklight(int)" ); e << -3; // Forced on } AlarmServer::initialize(); Desktop *d = new Desktop(); QObject::connect( &a, SIGNAL(menu()), d, SLOT(raiseMenu()) ); QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) ); QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) ); QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) ); QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) ); QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); (void)new SysFileMonitor(d); Network::createServer(d); #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) if ( !QFile::exists( "/etc/pointercal" ) ) { // Make sure calibration widget starts on top. Calibrate *cal = new Calibrate; cal->exec(); delete cal; } #endif d->show(); if ( QDate::currentDate ( ). year ( ) < 2000 ) { if ( QMessageBox::information ( 0, DesktopApplication::tr( "Information" ), DesktopApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); e << QString ( ); } } int rv = a.exec(); delete d; ODevice::inst ( )-> setSoftSuspend ( false ); return rv; } static const char *pidfile_path = "/var/run/opie.pid"; void create_pidfile ( ) { FILE *f; if (( f = ::fopen ( pidfile_path, "w" ))) { ::fprintf ( f, "%d", getpid ( )); ::fclose ( f ); } } void remove_pidfile ( ) { ::unlink ( pidfile_path ); } void handle_sigterm ( int /* sig */ ) { if ( qApp ) qApp-> quit ( ); } int main( int argc, char ** argv ) { ::signal ( SIGCHLD, SIG_IGN ); ::signal ( SIGTERM, handle_sigterm ); ::signal ( SIGINT, handle_sigterm ); ::setsid ( ); ::setpgid ( 0, 0 ); ::atexit ( remove_pidfile ); create_pidfile ( ); int retVal = initApplication ( argc, argv ); // Kill them. Kill them all. ::kill ( 0, SIGTERM ); ::sleep ( 1 ); ::kill ( 0, SIGKILL ); return retVal; } diff --git a/core/launcher/shutdownimpl.cpp b/core/launcher/shutdownimpl.cpp index 9292bb8..a202b7b 100644 --- a/core/launcher/shutdownimpl.cpp +++ b/core/launcher/shutdownimpl.cpp @@ -1,179 +1,179 @@ /********************************************************************** ** 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. ** **********************************************************************/ #include "shutdownimpl.h" #include <qpe/global.h> #include <qpe/qcopenvelope_qws.h> #include <qtimer.h> #include <qprogressbar.h> #include <qpushbutton.h> #include <qbuttongroup.h> #include <qlabel.h> #include <qlayout.h> #include <qpalette.h> static void changeButtonColor ( QPushButton *btn, const QColor &col ) { QPalette pal = btn-> palette ( ); pal. setColor ( QPalette::Active, QColorGroup::Button, col ); pal. setColor ( QPalette::Disabled, QColorGroup::Button, col ); pal. setColor ( QPalette::Inactive, QColorGroup::Button, col ); btn-> setPalette ( pal ); } ShutdownImpl::ShutdownImpl( QWidget* parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) { setCaption ( tr( "Shut down..." ) ); QVBoxLayout *vbox = new QVBoxLayout ( this ); vbox-> setSpacing ( 3 ); vbox-> setMargin ( 6 ); QButtonGroup *btngrp = new QButtonGroup ( this ); btngrp-> setTitle ( tr( "Terminate" ) ); btngrp-> setColumnLayout ( 0, Qt::Vertical ); btngrp-> layout ( ) -> setSpacing ( 0 ); btngrp-> layout ( ) -> setMargin ( 0 ); QGridLayout *grid = new QGridLayout ( btngrp-> layout ( ) ); grid-> setAlignment ( Qt::AlignTop ); grid-> setSpacing ( 3 ); grid-> setMargin ( 7 ); QPushButton *quit = new QPushButton ( tr( "Terminate Opie" ), btngrp, "quit" ); changeButtonColor ( quit, QColor ( 236, 236, 179 ) ); btngrp-> insert ( quit, 4 ); grid-> addWidget ( quit, 1, 1 ); QPushButton *reboot = new QPushButton ( tr( "Reboot" ), btngrp, "reboot" ); changeButtonColor ( reboot, QColor( 236, 183, 181 ) ); btngrp-> insert ( reboot, 2 ); grid-> addWidget( reboot, 1, 0 ); QPushButton *restart = new QPushButton ( tr( "Restart Opie" ), btngrp, "restart" ); changeButtonColor ( restart, QColor( 236, 236, 179 ) ); btngrp-> insert ( restart, 3 ); grid-> addWidget ( restart, 0, 1 ); QPushButton *shutdown = new QPushButton( tr( "Shutdown" ), btngrp, "shutdown" ); changeButtonColor ( shutdown, QColor( 236, 183, 181 ) ); btngrp-> insert ( shutdown, 1 ); grid-> addWidget ( shutdown, 0, 0 ); vbox-> addWidget ( btngrp ); m_info = new QLabel ( this, "info" ); m_info-> setText( tr( "<p>\n" "These termination options are provided primarily for use while developing and testing the Opie system. In a normal environment, these concepts are unnecessary." ) ); vbox-> addWidget ( m_info ); m_progress = new QProgressBar ( this, "progressBar" ); m_progress-> setFrameShape ( QProgressBar::Panel ); m_progress-> setFrameShadow ( QProgressBar::Sunken ); m_progress-> setTotalSteps ( 20 ); m_progress-> setIndicatorFollowsStyle ( false ); vbox-> addWidget ( m_progress ); vbox-> addItem ( new QSpacerItem ( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); QPushButton *cancel = new QPushButton ( tr( "Cancel" ), this, "cancel" ); changeButtonColor ( cancel, QColor( 181, 222, 178 ) ); cancel-> setDefault ( true ); cancel-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding, cancel-> sizePolicy ( ). hasHeightForWidth ( ) ) ); vbox-> addWidget ( cancel ); m_timer = new QTimer ( this ); connect ( m_timer, SIGNAL( timeout ( ) ), this, SLOT( timeout ( ) ) ); connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( buttonClicked ( int ) ) ); connect ( cancel, SIGNAL( clicked ( ) ), this, SLOT( cancelClicked ( ) ) ); m_progress-> hide ( ); Global::hideInputMethod ( ); -#ifdef QT_QWS_CUSTOM +#ifdef QT_QWS_SHARP shutdown-> hide ( ); #endif } void ShutdownImpl::buttonClicked ( int b ) { m_counter = 0; switch ( b ) { case 1: m_operation = ShutdownSystem; break; case 2: m_operation = RebootSystem; break; case 3: m_operation = RestartDesktop; break; case 4: m_operation = TerminateDesktop; break; } m_info-> hide ( ); m_progress-> show ( ); m_timer-> start ( 300 ); timeout ( ); } void ShutdownImpl::cancelClicked ( ) { m_progress-> hide ( ); m_info-> show ( ); if ( m_timer-> isActive ( ) ) m_timer-> stop ( ); else close ( ); } void ShutdownImpl::timeout ( ) { if ( ( m_counter += 2 ) > m_progress-> totalSteps ( ) ) { m_progress-> hide ( ); m_timer-> stop ( ); emit shutdown ( m_operation ); } else m_progress-> setProgress ( m_counter ); } void ShutdownImpl::hide ( ) { if ( isVisible ( )) { // hack - shutdown is a launcher dialog, but treated like a standalone app QCopEnvelope e( "QPE/System", "closing(QString)" ); e << QString ( "shutdown" ); } QWidget::hide ( ); } diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index 7d1aaf1..1e6b74e 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp @@ -1,338 +1,338 @@ /********************************************************************** ** 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. ** *********************************************************************/ #include "startmenu.h" #include "inputmethods.h" #include "runningappbar.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 ) +#if defined( QT_QWS_SHARP ) || 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 using namespace Opie; #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; \ } #ifdef SINGLE_APP #define APP(a,b,c,d) FACTORY(b) #include "../launcher/apps.h" #undef APP #endif // SINGLE_APP static Global::Command builtins[] = { #ifdef SINGLE_APP #define APP(a,b,c,d) { a, new##b, c }, #include "../launcher/apps.h" #undef APP #endif #if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX) { "calibrate", TaskBar::calibrate, 1, 0 }, #endif #if !defined(QT_QWS_CASSIOPEIA) { "shutdown", Global::shutdown, 1, 0 }, // { "run", run, 1, 0 }, #endif { 0, TaskBar::calibrate, 0, 0 }, }; static bool initNumLock() { #ifdef QPE_INITIAL_NUMLOCK_STATE QPE_INITIAL_NUMLOCK_STATE #endif return FALSE; } class LockKeyState : public QWidget { public: LockKeyState( QWidget *parent ) : QWidget(parent), nl(initNumLock()), cl(FALSE) { nl_pm = Resource::loadPixmap("numlock"); cl_pm = Resource::loadPixmap("capslock"); } QSize sizeHint() const { return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); } void toggleNumLockState() { nl = !nl; repaint(); } void toggleCapsLockState() { cl = !cl; repaint(); } void paintEvent( QPaintEvent * ) { int y = (height()-sizeHint().height())/2; QPainter p(this); if ( nl ) p.drawPixmap(1,y,nl_pm); if ( cl ) p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); } private: QPixmap nl_pm, cl_pm; bool nl, cl; }; TaskBar::~TaskBar() { } TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) { Global::setBuiltinCommands(builtins); sm = new StartMenu( this ); inputMethods = new InputMethods( this ); connect( inputMethods, SIGNAL(inputToggled(bool)), this, SLOT(calcMaxWindowRect()) ); //new QuickLauncher( this ); stack = new QWidgetStack( this ); stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); label = new QLabel(stack); //mru = new MRUList( stack ); //stack->raiseWidget( mru ); runningAppBar = new RunningAppBar(stack); stack->raiseWidget(runningAppBar); waitIcon = new Wait( this ); (void) new AppIcons( this ); sysTray = new SysTray( this ); // ## make customizable in some way? -#ifdef QT_QWS_CUSTOM +#ifdef QT_QWS_SHARP lockState = new LockKeyState( this ); #else lockState = 0; #endif #if defined(Q_WS_QWS) #if !defined(QT_NO_COP) QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); #endif #endif waitTimer = new QTimer( this ); connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); clearer = new QTimer( this ); QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); } void TaskBar::setStatusMessage( const QString &text ) { if ( !text.isEmpty() ) { label->setText( text ); stack->raiseWidget( label ); if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) sysTray->hide(); clearer->start( 3000, TRUE ); } else { clearStatusBar(); } } void TaskBar::clearStatusBar() { label->clear(); stack->raiseWidget(runningAppBar); // stack->raiseWidget( mru ); } void TaskBar::startWait() { waitIcon->setWaiting( true ); // a catchall stop after 10 seconds... waitTimer->start( 10 * 1000, true ); } void TaskBar::stopWait(const QString& /*app*/) { waitTimer->stop(); //mru->addTask(sm->execToLink(app)); waitIcon->setWaiting( false ); } void TaskBar::stopWait() { waitTimer->stop(); waitIcon->setWaiting( false ); } void TaskBar::resizeEvent( QResizeEvent *e ) { QHBox::resizeEvent( e ); calcMaxWindowRect(); } void TaskBar::styleChange( QStyle &s ) { QHBox::styleChange( s ); calcMaxWindowRect(); } void TaskBar::calcMaxWindowRect() { #ifdef Q_WS_QWS QRect wr; int displayWidth = qApp->desktop()->width(); QRect ir = inputMethods->inputRect(); if ( ir.isValid() ) { wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); } else { wr.setCoords( 0, 0, displayWidth-1, y()-1 ); } #if QT_VERSION < 300 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, QSize(qt_screen->width(),qt_screen->height())) ); #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 == "reloadApps()" ) { sm->reloadApps(); } else if ( msg == "reloadApplets()" ) { sysTray->clearApplets(); sysTray->addApplets(); sm->reloadApplets(); } else if ( msg == "soundAlarm()" ) { Desktop::soundAlarm(); } else if ( msg == "setLed(int,bool)" ) { int led, status; stream >> led >> status; QValueList <OLed> ll = ODevice::inst ( )-> ledList ( ); if ( ll. count ( )) { OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0]; bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow ); ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off ); } } } 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() { if ( inputMethods->currentShown() == "Unicode" ) { inputMethods->hideInputMethod(); } else { inputMethods->showInputMethod("Unicode"); } } bool TaskBar::recoverMemory() { //eturn mru->quitOldApps(); return true; } diff --git a/core/multimedia/opieplayer/loopcontrol_threaded.cpp b/core/multimedia/opieplayer/loopcontrol_threaded.cpp index c7dc7a8..1b89bc8 100644 --- a/core/multimedia/opieplayer/loopcontrol_threaded.cpp +++ b/core/multimedia/opieplayer/loopcontrol_threaded.cpp @@ -1,234 +1,234 @@ /********************************************************************** ** 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. ** **********************************************************************/ #define _REENTRANT #include <qpe/qpeapplication.h> #include <qimage.h> #include <qpainter.h> #ifdef Q_WS_QWS #include <qpe/qcopenvelope_qws.h> #endif #include "mediaplayerplugininterface.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <unistd.h> #include <pthread.h> #include "loopcontrol.h" #include "audiodevice.h" #include "videowidget.h" #include "audiowidget.h" #include "mediaplayerstate.h" -#if defined(QT_QWS_CUSTOM) || defined(QT_QWS_IPAQ) +#if defined(QT_QWS_SHARP) || defined(QT_QWS_IPAQ) #define USE_REALTIME_AUDIO_THREAD #endif extern VideoWidget *videoUI; // now only needed to tell it to play a frame extern MediaPlayerState *mediaPlayerState; #define DecodeLoopDebug(x) qDebug x //#define DecodeLoopDebug(x) static char *audioBuffer = NULL; static AudioDevice *audioDevice = NULL; static bool disabledSuspendScreenSaver = FALSE; pthread_t video_tid; pthread_attr_t video_attr; pthread_t audio_tid; pthread_attr_t audio_attr; bool emitPlayFinished = FALSE; bool emitChangePos = FALSE; class Mutex { public: Mutex() { pthread_mutexattr_t attr; pthread_mutexattr_init( &attr ); pthread_mutex_init( &mutex, &attr ); pthread_mutexattr_destroy( &attr ); } ~Mutex() { pthread_mutex_destroy( &mutex ); } void lock() { pthread_mutex_lock( &mutex ); } void unlock() { pthread_mutex_unlock( &mutex ); } /* bool locked() { switch ( pthread_mutex_trylock( &mutex ) ) { case EBUSY: return TRUE; case 0: pthread_mutex_unlock( &mutex ); default: return FALSE; } } */ private: pthread_mutex_t mutex; }; class currentFrameObj { public: currentFrameObj() : value( 0 ) { } void set( long f ) { mutex.lock(); value = f; mediaPlayerState->curDecoder()->videoSetFrame( f, 0 ); mutex.unlock(); } long get() { return value; } private: long value; Mutex mutex; }; Mutex *videoMutex; Mutex *audioMutex; Mutex *globalMutex; clock_t begin; LoopControl::LoopControl( QObject *parent, const char *name ) : QObject( parent, name ) { isMuted = FALSE; connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) ); timerid = startTimer( 200 ); videoMutex = new Mutex; audioMutex = new Mutex; globalMutex = new Mutex; //begin = clock(); } LoopControl::~LoopControl() { stop(); killTimer( timerid ); } static bool sendingNewPos = FALSE; static long prev_frame = 0; static int currentSample = 0; void LoopControl::timerEvent( QTimerEvent* ) { // We need to emit playFinished from the main thread, not one of the // decoding threads else we'll have all kinds of yucky things happen (reentrance). // playFinished will eventually call stop() which stops these threads. if ( emitPlayFinished ) { emitPlayFinished = FALSE; mediaPlayerState->setPlaying( FALSE ); } if ( emitChangePos ) { emitChangePos = FALSE; if ( hasVideoChannel && hasAudioChannel ) { sendingNewPos = TRUE; mediaPlayerState->setPosition( current_frame ); } else if ( hasVideoChannel ) { sendingNewPos = TRUE; mediaPlayerState->setPosition( current_frame ); } else if ( hasAudioChannel ) { sendingNewPos = TRUE; mediaPlayerState->setPosition( audioSampleCounter ); } } } void LoopControl::setPosition( long pos ) { if ( sendingNewPos ) { sendingNewPos = FALSE; return; } if ( hasVideoChannel && hasAudioChannel ) { videoMutex->lock(); audioMutex->lock(); qDebug("setting position"); playtime.restart(); playtime = playtime.addMSecs( -pos * 1000 / framerate ); //begin = clock() - (double)pos * CLOCKS_PER_SEC / framerate; current_frame = pos + 1; mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream ); prev_frame = current_frame - 1; currentSample = (int)( current_frame * freq / framerate ); mediaPlayerState->curDecoder()->audioSetSample( currentSample, stream ); audioSampleCounter = currentSample - 1; audioMutex->unlock(); videoMutex->unlock(); } else if ( hasVideoChannel ) { videoMutex->lock(); playtime.restart(); playtime = playtime.addMSecs( -pos * 1000 / framerate ); //begin = clock() - (double)pos * CLOCKS_PER_SEC / framerate; current_frame = pos + 1; mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream ); videoMutex->unlock(); prev_frame = current_frame - 1; } else if ( hasAudioChannel ) { audioMutex->lock(); playtime.restart(); playtime = playtime.addMSecs( -pos * 1000 / freq ); //begin = clock() - (double)pos * CLOCKS_PER_SEC / freq; currentSample = pos + 1; // (int)( current_frame * freq / framerate ); mediaPlayerState->curDecoder()->audioSetSample( currentSample, stream ); audioSampleCounter = currentSample - 1; audioMutex->unlock(); } } void *startVideoThread( void *ptr ) { LoopControl *mpegView = (LoopControl *)ptr; mpegView->startVideo(); return 0; } diff --git a/library/alarmserver.cpp b/library/alarmserver.cpp index 02bca3d..7e6e515 100644 --- a/library/alarmserver.cpp +++ b/library/alarmserver.cpp @@ -1,353 +1,353 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** This file is part of the 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. ** **********************************************************************/ #include <qdir.h> #include <qfile.h> #include <qmessagebox.h> #include <qtextstream.h> #include <qpe/qpeapplication.h> #include "global.h" #include "resource.h" #include <qpe/qcopenvelope_qws.h> #include "alarmserver.h" #include <qpe/timeconversion.h> #include <sys/types.h> #include <sys/stat.h> #include <stdlib.h> #include <unistd.h> struct timerEventItem { time_t UTCtime; QCString channel, message; int data; bool operator==( const timerEventItem &right ) const { return ( UTCtime == right.UTCtime && channel == right.channel && message == right.message && data == right.data ); } }; class TimerReceiverObject : public QObject { public: TimerReceiverObject() { } ~TimerReceiverObject() { } void resetTimer(); void setTimerEventItem(); void deleteTimer(); protected: void timerEvent( QTimerEvent *te ); private: QString atfilename; }; TimerReceiverObject *timerEventReceiver = NULL; QList<timerEventItem> timerEventList; timerEventItem *nearestTimerEvent = NULL; // set the timer to go off on the next event in the list void setNearestTimerEvent() { nearestTimerEvent = NULL; QListIterator<timerEventItem> it( timerEventList ); if ( *it ) nearestTimerEvent = *it; for ( ; *it; ++it ) if ( (*it)->UTCtime < nearestTimerEvent->UTCtime ) nearestTimerEvent = *it; if (nearestTimerEvent) timerEventReceiver->resetTimer(); else timerEventReceiver->deleteTimer(); } //store current state to file //Simple implementation. Should run on a timer. static void saveState() { QString savefilename = Global::applicationFileName( "AlarmServer", "saveFile" ); if ( timerEventList.isEmpty() ) { unlink( savefilename ); return; } QFile savefile(savefilename+".new"); if ( savefile.open(IO_WriteOnly) ) { QDataStream ds( &savefile ); //save QListIterator<timerEventItem> it( timerEventList ); for ( ; *it; ++it ) { ds << it.current()->UTCtime; ds << it.current()->channel; ds << it.current()->message; ds << it.current()->data; } savefile.close(); unlink( savefilename ); QDir d; d.rename(savefilename+".new",savefilename); } } /*! Sets up the alarm server. Restoring to previous state (session management). */ void AlarmServer::initialize() { //read autosave file and put events in timerEventList QString savefilename = Global::applicationFileName( "AlarmServer", "saveFile" ); QFile savefile(savefilename); if ( savefile.open(IO_ReadOnly) ) { QDataStream ds( &savefile ); while ( !ds.atEnd() ) { timerEventItem *newTimerEventItem = new timerEventItem; ds >> newTimerEventItem->UTCtime; ds >> newTimerEventItem->channel; ds >> newTimerEventItem->message; ds >> newTimerEventItem->data; timerEventList.append( newTimerEventItem ); } savefile.close(); if (!timerEventReceiver) timerEventReceiver = new TimerReceiverObject; setNearestTimerEvent(); } } static const char* atdir = "/var/spool/at/"; static bool triggerAtd( bool writeHWClock = FALSE ) { QFile trigger(QString(atdir) + "trigger"); if ( trigger.open(IO_WriteOnly|IO_Raw) ) { const char* data = -#ifdef QT_QWS_CUSTOM +#ifdef QT_QWS_SHARP //custom atd only writes HW Clock if we write a 'W' ( writeHWClock ) ? "W\n" : #endif data = "\n"; int len = strlen(data); int total_written = trigger.writeBlock(data,len); if ( total_written != len ) { QMessageBox::critical( 0, QObject::tr( "Out of Space" ), QObject::tr( "Unable to schedule alarm.\nFree some memory and try again." ) ); trigger.close(); QFile::remove( trigger.name() ); return FALSE; } return TRUE; } return FALSE; } void TimerReceiverObject::deleteTimer() { if ( !atfilename.isEmpty() ) { unlink( atfilename ); atfilename = QString::null; triggerAtd( FALSE ); } } void TimerReceiverObject::resetTimer() { const int maxsecs = 2147000; int total_written; QDateTime nearest = TimeConversion::fromUTC(nearestTimerEvent->UTCtime); QDateTime now = QDateTime::currentDateTime(); if ( nearest < now ) nearest = now; int secs = TimeConversion::secsTo( now, nearest ); if ( secs > maxsecs ) { // too far for millisecond timing secs = maxsecs; } // System timer (needed so that we wake from deep sleep), // from the Epoch in seconds. // int at_secs = TimeConversion::toUTC(nearest); // qDebug("reset timer to %d seconds from Epoch",at_secs); QString fn = atdir + QString::number(at_secs) + "." + QString::number(getpid()); if ( fn != atfilename ) { QFile atfile(fn+".new"); if ( atfile.open(IO_WriteOnly|IO_Raw) ) { // just wake up and delete the at file QString cmd = "#!/bin/sh\nrm " + fn; total_written = atfile.writeBlock(cmd.latin1(),cmd.length()); if ( total_written != int(cmd.length()) ) { QMessageBox::critical( 0, tr("Out of Space"), tr("Unable to schedule alarm.\n" "Please free up space and try again") ); atfile.close(); QFile::remove( atfile.name() ); return; } atfile.close(); unlink( atfilename ); QDir d; d.rename(fn+".new",fn); chmod(fn.latin1(),0755); atfilename = fn; triggerAtd( FALSE ); } else { qWarning("Cannot open atd file %s",fn.latin1()); } } // Qt timers (does the actual alarm) // from now in milliseconds // qDebug("AlarmServer waiting %d seconds",secs); startTimer( 1000 * secs + 500 ); } void TimerReceiverObject::timerEvent( QTimerEvent * ) { bool needSave = FALSE; killTimers(); if (nearestTimerEvent) { if ( nearestTimerEvent->UTCtime <= TimeConversion::toUTC(QDateTime::currentDateTime()) ) { #ifndef QT_NO_COP QCopEnvelope e( nearestTimerEvent->channel, nearestTimerEvent->message ); e << TimeConversion::fromUTC( nearestTimerEvent->UTCtime ) << nearestTimerEvent->data; #endif timerEventList.remove( nearestTimerEvent ); needSave = TRUE; } setNearestTimerEvent(); } else { resetTimer(); } if ( needSave ) saveState(); } /*! \class AlarmServer alarmserver.h \brief The AlarmServer class allows alarms to be scheduled and unscheduled. Applications can schedule alarms with addAlarm() and can unschedule alarms with deleteAlarm(). When the time for an alarm to go off is reached the specified \link qcop.html QCop\endlink message is sent on the specified channel (optionally with additional data). Scheduling an alarm using this class is important (rather just using a QTimer) since the machine may be asleep and needs to get woken up using the Linux kernel which implements this at the kernel level to minimize battery usage while asleep. \ingroup qtopiaemb \sa QCopEnvelope */ /*! Schedules an alarm to go off at (or soon after) time \a when. When the alarm goes off, the \link qcop.html QCop\endlink \a message will be sent to \a channel, with \a data as a parameter. If this function is called with exactly the same data as a previous call the subsequent call is ignored, so there is only ever one alarm with a given set of parameters. \sa deleteAlarm() */ void AlarmServer::addAlarm ( QDateTime when, const QCString& channel, const QCString& message, int data) { if ( qApp->type() == QApplication::GuiServer ) { bool needSave = FALSE; // Here we are the server so either it has been directly called from // within the server or it has been sent to us from a client via QCop if (!timerEventReceiver) timerEventReceiver = new TimerReceiverObject; timerEventItem *newTimerEventItem = new timerEventItem; newTimerEventItem->UTCtime = TimeConversion::toUTC( when ); newTimerEventItem->channel = channel; newTimerEventItem->message = message; newTimerEventItem->data = data; // explore the case of already having the event in here... QListIterator<timerEventItem> it( timerEventList ); for ( ; *it; ++it ) if ( *(*it) == *newTimerEventItem ) return; // if we made it here, it is okay to add the item... timerEventList.append( newTimerEventItem ); needSave = TRUE; // quicker than using setNearestTimerEvent() if ( nearestTimerEvent ) { if (newTimerEventItem->UTCtime < nearestTimerEvent->UTCtime) { nearestTimerEvent = newTimerEventItem; timerEventReceiver->killTimers(); timerEventReceiver->resetTimer(); } } else { nearestTimerEvent = newTimerEventItem; timerEventReceiver->resetTimer(); } if ( needSave ) saveState(); } else { #ifndef QT_NO_COP QCopEnvelope e( "QPE/System", "addAlarm(QDateTime,QCString,QCString,int)" ); e << when << channel << message << data; #endif } } /*! Deletes previously scheduled alarms which match \a when, \a channel, \a message, and \a data. Passing null values for \a when, \a channel, or for the \link qcop.html QCop\endlink \a message, acts as a wildcard meaning "any". Similarly, passing -1 for \a data indicates "any". If there is no matching alarm, nothing happens. \sa addAlarm() */ void AlarmServer::deleteAlarm (QDateTime when, const QCString& channel, const QCString& message, int data) { diff --git a/library/power.cpp b/library/power.cpp index d53ecfe..ec5b309 100644 --- a/library/power.cpp +++ b/library/power.cpp @@ -1,228 +1,228 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** This file is part of the 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. ** **********************************************************************/ #include "power.h" -#ifdef QT_QWS_CUSTOM +#ifdef QT_QWS_SHARP #include "custom.h" #endif #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <fcntl.h> #include <sys/ioctl.h> #ifdef QT_QWS_IPAQ_NO_APM #include <linux/h3600_ts.h> #endif PowerStatusManager *PowerStatusManager::powerManager = 0; PowerStatus *PowerStatusManager::ps = 0; static bool haveProcApm = false; PowerStatusManager::PowerStatusManager() { powerManager = this; ps = new PowerStatus; FILE *f = fopen("/proc/apm", "r"); if ( f ) { fclose(f); haveProcApm = TRUE; } } const PowerStatus &PowerStatusManager::readStatus() { if ( !powerManager ) (void)new PowerStatusManager; powerManager->getStatus(); return *ps; } // Standard /proc/apm reader bool PowerStatusManager::getProcApmStatus( int &ac, int &bs, int &bf, int &pc, int &sec ) { bool ok = false; ac = 0xff; bs = 0xff; bf = 0xff; pc = -1; sec = -1; FILE *f = fopen("/proc/apm", "r"); if ( f ) { //I 1.13 1.2 0x02 0x00 0xff 0xff 49% 147 sec char u; fscanf(f, "%*[^ ] %*d.%*d 0x%*x 0x%x 0x%x 0x%x %d%% %i %c", &ac, &bs, &bf, &pc, &sec, &u); fclose(f); switch ( u ) { case 'm': sec *= 60; case 's': break; // ok default: sec = -1; // unknown } // extract data switch ( bs ) { case 0x00: ps->bs = PowerStatus::High; break; case 0x01: ps->bs = PowerStatus::Low; break; case 0x7f: ps->bs = PowerStatus::VeryLow; break; case 0x02: ps->bs = PowerStatus::Critical; break; case 0x03: ps->bs = PowerStatus::Charging; break; case 0x04: case 0xff: // 0xff is Unknown but we map to NotPresent default: ps->bs = PowerStatus::NotPresent; break; } switch ( ac ) { case 0x00: ps->ac = PowerStatus::Offline; break; case 0x01: ps->ac = PowerStatus::Online; break; case 0x02: ps->ac = PowerStatus::Backup; break; } if ( pc > 100 ) pc = -1; ps->percentRemain = pc; ps->secsRemain = sec; ok = true; } return ok; } -#ifdef QT_QWS_CUSTOM +#ifdef QT_QWS_SHARP void PowerStatusManager::getStatus() { int ac, bs, bf, pc, sec; ps->percentAccurate = TRUE; // not for long... if ( haveProcApm && getProcApmStatus( ac, bs, bf, pc, sec ) ) { // special case if ( bs == 0x7f ) ps->bs = PowerStatus::VeryLow; pc = -1; // fake percentage if ( pc < 0 ) { switch ( bs ) { case 0x00: ps->percentRemain = 100; break; // High case 0x01: ps->percentRemain = 30; break; // Low case 0x7f: ps->percentRemain = 10; break; // Very Low case 0x02: ps->percentRemain = 5; break; // Critical case 0x03: ps->percentRemain = -1; break; // Charging } ps->percentAccurate = FALSE; } } char *device = "/dev/apm_bios"; int fd = ::open (device, O_WRONLY); if ( fd >= 0 ) { int bbat_status = ioctl( fd, APM_IOC_BATTERY_BACK_CHK, 0 ); switch ( bbat_status ) { case 0x00: ps->bbs = PowerStatus::High; break; case 0x01: ps->bbs = PowerStatus::Low; break; case 0x7f: ps->bbs = PowerStatus::VeryLow; break; case 0x02: ps->bbs = PowerStatus::Critical; break; case 0x03: ps->bbs = PowerStatus::Charging; break; case 0x04: ps->bbs = PowerStatus::NotPresent; break; } ::close(fd); } } #else void PowerStatusManager::getStatus() { bool usedApm = FALSE; ps->percentAccurate = TRUE; // Some iPAQ kernel builds don't have APM. If this is not the case we // save ourselves an ioctl by testing if /proc/apm exists in the // constructor and we use /proc/apm instead int ac, bs, bf, pc, sec; if ( haveProcApm ) usedApm = getProcApmStatus( ac, bs, bf, pc, sec ); if ( !usedApm ) { #ifdef QT_QWS_IPAQ_NO_APM int fd; int err; struct bat_dev batt_info; memset(&batt_info, 0, sizeof(batt_info)); fd = ::open("/dev/ts",O_RDONLY); if( fd < 0 ) return; ioctl(fd, GET_BATTERY_STATUS, &batt_info); ac_status = batt_info.ac_status; ps->percentRemain = ( 425 * batt_info.batt1_voltage ) / 1000 - 298; // from h3600_ts.c ps->secsRemain = -1; // seconds is bogus on iPAQ ::close (fd); #else ps->percentRemain = 100; ps->secsRemain = -1; ps->percentAccurate = FALSE; #endif } } #endif diff --git a/library/storage.cpp b/library/storage.cpp index 937908d..3668d29 100644 --- a/library/storage.cpp +++ b/library/storage.cpp @@ -1,200 +1,200 @@ /********************************************************************** ** Copyright (C) Holger 'zecke' Freyther <freyther@kde.org> ** 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. ** **********************************************************************/ #include <qpe/storage.h> -#ifdef QT_QWS_CUSTOM +#ifdef QT_QWS_SHARP #include <qpe/custom.h> #endif #include <qfile.h> #include <qtimer.h> #include <qcopchannel_qws.h> #include <stdio.h> #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) #include <sys/vfs.h> #include <mntent.h> #endif #include <qstringlist.h> static bool isCF(const QString& m) { FILE* f = fopen("/var/run/stab", "r"); if (!f) f = fopen("/var/state/pcmcia/stab", "r"); if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); if ( f ) { char line[1024]; char devtype[80]; char devname[80]; while ( fgets( line, 1024, f ) ) { // 0 ide ide-cs 0 hda 3 0 if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) { if ( QString(devtype) == "ide" && m.find(devname)>0 ) { fclose(f); return TRUE; } } } fclose(f); } return FALSE; } StorageInfo::StorageInfo( QObject *parent ) : QObject( parent ) { mFileSystems.setAutoDelete( TRUE ); channel = new QCopChannel( "QPE/Card", this ); connect( channel, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); update(); } const FileSystem *StorageInfo::fileSystemOf( const QString &filename ) { for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) { if ( filename.startsWith( (*i)->path() ) ) return (*i); } return 0; } void StorageInfo::cardMessage( const QCString& msg, const QByteArray& ) { if ( msg == "mtabChanged()" ) update(); } // cause of the lack of a d pointer we need // to store informations in a config file :( void StorageInfo::update() { //qDebug("StorageInfo::updating"); #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) struct mntent *me; FILE *mntfp = setmntent( "/etc/mtab", "r" ); QStringList curdisks; QStringList curopts; QStringList curfs; bool rebuild = FALSE; int n=0; if ( mntfp ) { while ( (me = getmntent( mntfp )) != 0 ) { QString fs = me->mnt_fsname; if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" || fs.left( 14 ) == "/dev/mmc/part1" || fs.left(5)=="tmpfs" ) { n++; curdisks.append(fs); curopts.append( me->mnt_opts ); //qDebug("-->fs %s opts %s", fs.latin1(), me->mnt_opts ); curfs.append( me->mnt_dir ); bool found = FALSE; for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) { if ( (*i)->disk() == fs ) { found = TRUE; break; } } if ( !found ) rebuild = TRUE; } } endmntent( mntfp ); } if ( rebuild || n != (int)mFileSystems.count() ) { mFileSystems.clear(); QStringList::ConstIterator it=curdisks.begin(); QStringList::ConstIterator fsit=curfs.begin(); QStringList::ConstIterator optsIt=curopts.begin(); for (; it!=curdisks.end(); ++it, ++fsit, ++optsIt) { QString opts = *optsIt; QString disk = *it; QString humanname; bool removable = FALSE; if ( isCF(disk) ) { humanname = tr("CF Card"); removable = TRUE; } else if ( disk == "/dev/hda1" ) { humanname = tr("Hard Disk"); } else if ( disk.left(9) == "/dev/mmcd" ) { humanname = tr("SD Card"); removable = TRUE; } else if ( disk.left( 14 ) == "/dev/mmc/part1" ) { humanname = tr("MMC Card"); removable = TRUE; } else if ( disk.left(7) == "/dev/hd" ) humanname = tr("Hard Disk") + " " + disk; else if ( disk.left(7) == "/dev/sd" ) humanname = tr("SCSI Hard Disk") + " " + disk; else if ( disk.left(14) == "/dev/mtdblock6" ) //openzaurus ramfs humanname = tr("Internal Memory"); else if ( disk == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" ) humanname = tr("Internal Storage"); else if ( disk.left(14) == "/dev/mtdblock/" ) humanname = tr("Internal Storage") + " " + disk; else if ( disk.left(13) == "/dev/mtdblock" ) humanname = tr("Internal Storage") + " " + disk; else if ( disk.left(5) == "tmpfs" ) //ipaqs /mnt/ramfs humanname = tr("Internal Memory"); FileSystem *fs = new FileSystem( disk, *fsit, humanname, removable, opts ); mFileSystems.append( fs ); } emit disksChanged(); } else { // just update them for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) i.current()->update(); } #endif } //--------------------------------------------------------------------------- FileSystem::FileSystem( const QString &disk, const QString &path, const QString &name, bool rem, const QString &o ) : fsdisk( disk ), fspath( path ), humanname( name ), blkSize(512), totalBlks(0), availBlks(0), removable( rem ), opts( o ) { update(); } void FileSystem::update() { #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) struct statfs fs; if ( !statfs( fspath.latin1(), &fs ) ) { blkSize = fs.f_bsize; totalBlks = fs.f_blocks; availBlks = fs.f_bavail; } else { blkSize = 0; totalBlks = 0; availBlks = 0; } #endif } diff --git a/qt/qte233-for-opie091-keyboard.patch b/qt/qte233-for-opie091-keyboard.patch index 9d76a64..c1b85b6 100644 --- a/qt/qte233-for-opie091-keyboard.patch +++ b/qt/qte233-for-opie091-keyboard.patch @@ -1,145 +1,145 @@ --- src.orig/kernel/qkeyboard_qws.cpp Mon Mar 18 02:11:25 2002 +++ src/kernel/qkeyboard_qws.cpp Fri Aug 30 04:28:39 2002 @@ -269,7 +269,7 @@ { Qt::Key_O, 'o' , 'O' , 'O'-64 }, { Qt::Key_P, 'p' , 'P' , 'P'-64 }, { Qt::Key_BraceLeft, '[' , '{' , 0xffff }, - { Qt::Key_Escape, ']' , '}' , 0xffff }, + { Qt::Key_BraceRight, ']' , '}' , 0xffff }, { Qt::Key_Return, 13 , 13 , 0xffff }, { Qt::Key_Control, 0xffff , 0xffff , 0xffff }, { Qt::Key_A, 'a' , 'A' , 'A'-64 }, // 30 @@ -394,7 +394,7 @@ bool numLock; #endif bool caps; - bool extended; + int extended; int modifiers; int prevuni; int prevkey; @@ -524,7 +524,7 @@ shift = false; alt = false; ctrl = false; - extended = false; + extended = 0; prevuni = 0; prevkey = 0; caps = FALSE; @@ -561,10 +561,24 @@ int keyCode = Qt::Key_unknown; bool release = false; int keypad = 0; +#if defined(QT_QWS_IPAQ) + static int ipaq_return_pressed = false; // iPAQ Action Key has ScanCode 0x60: 0x60|0x80 = 0xe0 == extended mode 1 ! +#endif + - #if !defined(QT_QWS_CUSTOM) + #if !defined(QT_QWS_SHARP) - if (code == 224) { + if ((code == 224) +#if defined(QT_QWS_IPAQ) + && !ipaq_return_pressed +#endif + ) + { // extended - extended = true; + extended = 1; + return; + } + else if (code == 225) { + // extended 2 + extended = 2; return; } #endif @@ -574,7 +588,7 @@ code &= 0x7f; } - if (extended) { + if (extended == 1) { switch (code) { case 72: keyCode = Qt::Key_Up; @@ -612,6 +626,32 @@ case 53: keyCode = Qt::Key_Slash; break; + case 0x1d: + keyCode = Qt::Key_Control; + break; + case 0x2a: + keyCode = Qt::Key_SysReq; + break; + case 0x38: + keyCode = Qt::Key_Alt; + break; + case 0x5b: + keyCode = Qt::Key_Super_L; + break; + case 0x5c: + keyCode = Qt::Key_Super_R; + break; + case 0x5d: + keyCode = Qt::Key_Menu; + break; + } + } else if (extended == 2) { + switch (code) { + case 0x1d: + return; + case 0x45: + keyCode = Qt::Key_Pause; + break; } } else { - #if defined(QT_QWS_CUSTOM) + #if defined(QT_QWS_SHARP) @@ -650,6 +690,7 @@ repeatable = FALSE; break; case 0x60: + ipaq_return_pressed = !release; keyCode = Key_Return; break; case 0x67: @@ -687,13 +728,19 @@ else repeater->stop(); #endif + + /* + Translate shift+Key_Tab to Key_Backtab + */ + if (( keyCode == Key_Tab ) && shift ) + keyCode = Key_Backtab; } /* Keypad consists of extended keys 53 and 28, and non-extended keys 55 and 71 through 83. */ - if ( extended ? (code == 53 || code == 28) : + if ((extended == 1) ? (code == 53 || code == 28) : (code == 55 || ( code >= 71 && code <= 83 )) ) keypad = Qt::Keypad; @@ -803,7 +850,7 @@ unicode = QWSServer::keyMap()[code].shift_unicode ? QWSServer::keyMap()[code].shift_unicode : 0xffff; else unicode = QWSServer::keyMap()[code].unicode ? QWSServer::keyMap()[code].unicode : 0xffff; - } else { + } else if (extended == 1) { if ( code == 53 ) unicode = '/'; } @@ -829,7 +876,7 @@ prevkey = prevuni = 0; } } - extended = false; + extended = 0; } |