-rw-r--r-- | Rules.make | 3 | ||||
-rw-r--r-- | config.in | 5 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 20 | ||||
-rw-r--r-- | core/launcher/launcher.h | 3 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 2 |
5 files changed, 9 insertions, 24 deletions
@@ -1,306 +1,309 @@ .phony: force force: $(configs) : $(call makecfg,$@) $(TOPDIR)/gen.pro : $(TOPDIR)/.config echo > $@ # added for threaded version ifneq ($(CONFIG_THREADED),) echo CONFIG += thread >> $@ else echo CONFIG -= thread >> $@ endif ifneq ($(CONFIG_DEBUG),) echo CONFIG += debug >> $@ echo CONFIG -= release >> $@ echo DEFINES += "QT_COMPONENT_DEBUG=2" >> $@ echo DEFINES += QT_DEBUG >> $@ else echo CONFIG -= debug >> $@ echo CONFIG += release >> $@ echo DEFINES += "OPIE_NO_DEBUG" >> $@ endif ifeq ($(CONFIG_STATIC),y) echo CONFIG += staticlib >> $@ endif ifeq ($(filter 3.%,$(QTE_VERSION)),) # not qt3 echo CONFIG -= qt3 >> $@ else echo CONFIG += qt3 >> $@ endif ifneq ($(CONFIG_QUICK_LAUNCH),) echo contains\( CONFIG, quick-app \) \{ >> $@ echo CONFIG -= staticlib >> $@ echo CONFIG -= quick-app >> $@ echo CONFIG += quick-app-lib >> $@ echo QUICKLAUNCH_PATH = $(CONFIG_QUICKLAUNCH_PATH) >> $@ echo \} >> $@ else echo contains\( CONFIG, quick-app \) \{ >> $@ echo CONFIG -= quick-app >> $@ echo CONFIG += quick-app-bin >> $@ echo \} >> $@ endif ifeq ($(CONFIG_SQL_PIM_BACKEND),y) echo ENABLE_SQL_PIM_BACKEND=$(CONFIG_SQL_PIM_BACKEND) >> $@ else echo ENABLE_SQL_PIM_BACKEND=n >> $@ endif ifeq ($(CONFIG_OPIE_NO_OVERRIDE_QT),y) echo CONFIG += no-override >> $@ endif ifeq ($(CONFIG_OPIE_NO_ERASERECT_FIX),y) echo DEFINES += OPIE_NO_ERASE_RECT_HACKFIX >> $@ endif ifeq ($(CONFIG_OPIE_NO_BUILTIN_SHUTDOWN),y) echo DEFINES += OPIE_NO_BUILTIN_SHUTDOWN >> $@ endif ifeq ($(CONFIG_OPIE_NO_BUILTIN_CALIBRATE),y) echo DEFINES += OPIE_NO_BUILTIN_CALIBRATE >> $@ endif ifeq ($(CONFIG_USE_REALTIME_AUDIO_THREAD),y) echo DEFINES += USE_REALTIME_AUDIO_THREAD >> $@ endif ifeq ($(CONFIG_USE_FILE_NOTIFICATION),y) echo DEFINES += USE_FILE_NOTIFICATION >> $@ endif ifeq ($(CONFIG_QT_QWS_ALLOW_CLOCK),y) echo DEFINES += QT_QWS_ALLOW_OVERCLOCK >> $@ endif ifeq ($(CONFIG_OPIE_NEW_ALLOC),y) echo DEFINES += OPIE_NEW_MALLOC >> $@ endif ifeq ($(CONFIG_OPIE_NO_SOUND_PCM_READ_BITS),y) echo DEFINES += OPIE_NO_SOUND_PCM_READ_BITS >> $@ endif echo DEFINES += OPIE_SOUND_FRAGMENT_SHIFT=$(CONFIG_OPIE_SOUND_FRAGMENT_SHIFT) >> $@ ifeq ($(CONFIG_OPIE_WE_VERSION_OVERRIDE),y) echo DEFINES += OPIE_WE_VERSION=$(CONFIG_OPIE_WE_VERSION) >> $@ endif +ifeq ($(CONFIG_OPIE_TASKBAR_LOCK_KEY_STATE),y) + echo DEFINES += OPIE_TASKBAR_LOCK_KEY_STATE >> $@ +endif # Write LIB dirs and INC dirs... ifeq ($(CONFIG_LIBETPAN_DEP),y) echo LIBETPAN_LIB_DIR = $(CONFIG_LIBETPAN_LIB_DIR) >> $@ echo LIBETPAN_INC_DIR = $(CONFIG_LIBETPAN_INC_DIR) >> $@ endif ifeq ($(CONFIG_LIBPCAP_DEP),y) echo LIBPCAP_LIB_DIR = $(CONFIG_LIBPCAP_LIB_DIR) >> $@ echo LIBPCAP_INC_DIR = $(CONFIG_LIBPCAP_INC_DIR) >> $@ endif ifeq ($(CONFIG_LIBSQLITE_DEP),y) echo LIBSQLITE_LIB_DIR = $(CONFIG_LIBSQLITE_LIB_DIR) >> $@ echo LIBSQLITE_INC_DIR = $(CONFIG_LIBSQLITE_INC_DIR) >> $@ endif ifeq ($(CONFIG_LIBXINE_DEP),y) echo LIBXINE_LIB_DIR = $(CONFIG_LIBXINE_LIB_DIR) >> $@ echo LIBXINE_INC_DIR = $(CONFIG_LIBXINE_INC_DIR) >> $@ endif ifeq ($(CONFIG_LIBIPK_DEP),y) echo LIBIPK_LIB_DIR = $(CONFIG_LIBIPK_LIB_DIR) >> $@ echo LIBIPK_INC_DIR = $(CONFIG_LIBIPK_INC_DIR) >> $@ endif ifeq ($(CONFIG_LIBSDK_DEP),y) echo LIBSDL_LIB_DIR = $(CONFIG_LIBSDL_LIB_DIR) >> $@ echo LIBSDL_INC_DIR = $(CONFIG_LIBSDL_INC_DIR) >> $@ endif ifeq ($(CONFIG_LIBSWORD_DEP),y) echo LIBSWORD_LIB_DIR = $(CONFIG_LIBSWORD_LIB_DIR) >> $@ echo LIBSWORD_INC_DIR = $(CONFIG_LIBSWORD_INC_DIR) >> $@ endif $(TOPDIR)/.depends : $(shell if [ -e $(TOPDIR)/config.in ]\; then echo $(TOPDIR)/config.in\; fi\;) $(TOPDIR)/.config $(TOPDIR)/packages @echo Generating dependency information... # add to subdir-y, and add descend rules @cat $(TOPDIR)/packages | grep -v '^#' | \ awk '{print \ ".PHONY : " $$2 "\n" \ "subdir-$$(" $$1 ") += " $$2 "\n\n"; \ print $$2 " : " $$2 "/Makefile\n\t$$(call descend,$$@,$(filter-out $$@,$$(filter-out $$@,$$(MAKECMDGOALS))))\n"; }' > $(TOPDIR)/.depends cat $(TOPDIR)/packages | grep -v '^#' | \ perl -ne '($$cfg, $$dir, $$pro) = $$_ =~ /^(\S+)\s+(\S+)\s+(\S+)/; if ( -e "$$dir/$$pro" ) { print "$$dir/Makefile : $$dir/$$pro \$$(QMAKE) \$$(OPIEDIR)/gen.pro \$$(OPIEDIR)/.config\n\t\$$(call makefilegen,\$$@)\n\n"; }' \ >> $(TOPDIR)/.depends # interpackage dependency generation @cat $(TOPDIR)/packages | \ $(TOPDIR)/scripts/deps.pl >> $(TOPDIR)/.depends $(TOPDIR)/.depends.cfgs: # config.in interdependencies @echo $(configs) | sed -e 's,/config.in,,g' | ( for i in `cat`; do echo $$i; done ) > dirs @cat dirs | ( for i in `cat`; do if [ "`cat dirs|grep $$i 2>/dev/null|wc -l`" -ne "1" ]; then deps=`cat dirs|grep $$i| grep -v "^$$i$$"|for i in \`cat|sed -e's,^$(TOPDIR)/,$$(TOPDIR)/,g'\`; do echo $$i/config.in; done`; echo `echo $$i/config.in|sed -e 's,^$(TOPDIR)/,$$(TOPDIR)/,'` : $$deps; fi; done ) >> $@ @-rm -f dirs $(QTDIR)/stamp-headers : @-rm -f $(QTDIR)/stamp-headers* ( cd $(QTDIR)/include; \ $(patsubst %,ln -sf ../src/kernel/%;,qgfx_qws.h qwsmouse_qws.h \ qcopchannel_qws.h qwindowsystem_qws.h \ qfontmanager_qws.h qwsdefaultdecoration_qws.h)) touch $@ $(QTDIR)/stamp-headers-x11 : @-rm -f $(QTDIR)/stamp-headers* cd $(QTDIR)/include; $(patsubst %,ln -sf $(OPIEDIR)/x11/libqpe-x11/qt/%;,qgfx_qws.h qwsmouse_qws.h qcopchannel_qws.h qwindowsystem_qws.h qfontmanager_qws.h qwsdefaultdecoration_qws.h) touch $@ $(OPIEDIR)/stamp-headers : @-rm -f $(OPIEDIR)/stamp-headers* mkdir -p $(TOPDIR)/include/qpe \ $(TOPDIR)/include/qtopia \ $(TOPDIR)/include/opie \ $(TOPDIR)/include/opie2 \ $(TOPDIR)/include/qtopia/private \ $(TOPDIR)/include/sl ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; ) ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; ) ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; ) ifeq ($(CONFIG_LIBOPIE),y) # libopie1 ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; ) ( cd include/opie && ln -sf ../../libopie/pim/*.h .; ) ( cd include/opie && ln -sf ../../libopie/big-screen/*.h .; ) endif # libopie2 ( cd include/opie2 && ln -sf ../../libopie2/opiecore/*.h .; ) ( cd include/opie2 && ln -sf ../../libopie2/opiecore/device/*.h .; ) ( cd include/opie2 && ln -sf ../../libopie2/opiemm/*.h .; ) ( cd include/opie2 && ln -sf ../../libopie2/opiedb/*.h .; ) ( cd include/opie2 && ln -sf ../../libopie2/opienet/*.h .; ) ( cd include/opie2 && ln -sf ../../libopie2/opiepim/*.h .; ) ( cd include/opie2 && ln -sf ../../libopie2/opiepim/core/*.h .; ) ( cd include/opie2 && ln -sf ../../libopie2/opiepim/core/backends/*.h .; ) ( cd include/opie2 && ln -sf ../../libopie2/opiepim/ui/*.h .; ) ( cd include/opie2 && ln -sf ../../libopie2/opieui/*.h .; ) ( cd include/opie2 && ln -sf ../../libopie2/opieui/fileselector/*.h .; ) ( cd include/opie2 && ln -sf ../../libopie2/opieui/big-screen/*.h .; ) ( cd include/opie2 && ln -sf ../../libopie2/opiesecurity/*.h .; ) # auxilliary libraries ( cd include/opie2 && ln -sf ../../libqtaux/*.h .; ) ( cd include/sl && ln -sf ../../libslcompat/*.h .; ) ( cd include/ && ln -sf ../noncore/net/ftplib/*.h .; ) ( cd include/ && ln -sf ../inputmethods/pickboard/pickboardcfg.h .; ) ( cd include/ && ln -sf ../inputmethods/pickboard/pickboardpicks.h .; ) # all ifeq ($(CONFIG_LIBOPIE),y) ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) endif ( cd include/opie2; for generatedHeader in `cd ../../libopie2/opieui; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ ln -sf ../../libopie2/opieui/$$generatedHeader $$generatedHeader; done ) ( cd include/opie2; for generatedHeader in `cd ../../libopie2/opiepim/ui; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ ln -sf ../../libopie2/opiepim/ui/$$generatedHeader $$generatedHeader; done ) ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h touch $@ $(OPIEDIR)/stamp-headers-x11 : @-rm -f $(OPIEDIR)/stamp-headers* mkdir -p $(TOPDIR)/include/qpe $(TOPDIR)/include/qtopia \ $(TOPDIR)/include/opie $(TOPDIR)/include/qtopia/private ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; ) ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; ) ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; ) ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; ) ( cd include/opie && ln -sf ../../libsql/*.h .; ) ( cd include/opie && ln -sf ../../libopie/pim/*.h .; ) ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h ( cd include/qpe; ln -sf ../../x11/libqpe-x11/qpe/*.h .; ) touch $@ $(TOPDIR)/library/custom.h : $(TOPDIR)/.config @-rm -f $@ @$(if $(patsubst "%",%,$(CONFIG_CUSTOMFILE)),\ ln -sf $(patsubst "%",%,$(CONFIG_CUSTOMFILE)) $@) @touch $@ $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf $(TOPDIR)/scripts/kconfig/conf $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/qmake/qmake: @$(call descend,$(shell dirname $@),$(shell basename $@)) menuconfig: $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf ./config.in $(TOPDIR)/scripts/kconfig/mconf ./config.in @touch ./.config.stamp xconfig: $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in $(TOPDIR)/scripts/kconfig/qconf ./config.in @touch .config.stamp gconfig: $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in $(TOPDIR)/scripts/kconfig/gconf ./config.in @touch .config.stamp config: $(TOPDIR)/scripts/kconfig/conf ./config.in $(TOPDIR)/scripts/kconfig/conf ./config.in @touch .config.stamp oldconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in $(TOPDIR)/scripts/kconfig/conf -o ./config.in @touch .config.stamp randconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in $(TOPDIR)/scripts/kconfig/conf -r ./config.in @touch .config.stamp allyesconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in $(TOPDIR)/scripts/kconfig/conf -y ./config.in @touch .config.stamp allnoconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in $(TOPDIR)/scripts/kconfig/conf -n ./config.in @touch .config.stamp defconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in $(TOPDIR)/scripts/kconfig/conf -d ./config.in @touch .config.stamp $(TOPDIR)/qmake/qmake : $(TOPDIR)/mkspecs/default $(TOPDIR)/mkspecs/default : ln -sf linux-g++ $@ $(TOPDIR)/scripts/subst : force @( \ echo 's,\$$QPE_VERSION,$(QPE_VERSION),g'; \ echo 's,\$$OPIE_VERSION,$(OPIE_VERSION),g'; \ echo 's,\$$QTE_VERSION,$(QTE_VERSION),g'; \ echo 's,\$$QTE_REVISION,$(QTE_REVISION),g'; \ echo 's,\$$SUB_VERSION,$(SUB_VERSION),g'; \ echo 's,\$$EXTRAVERSION,$(EXTRAVERSION),g'; \ echo 's,\$$QTE_BASEVERSION,$(QTE_BASEVERSION),g'; \ ) > $@ || ( rm -f $@; exit 1 ) $(TOPDIR)/scripts/filesubst : force @( \ echo 's,\$$OPIEDIR/root/,/,g'; \ echo 's,$(OPIEDIR)/root/,/,g'; \ echo 's,\$$OPIEDIR,$(prefix),g'; \ echo 's,$(OPIEDIR),$(prefix),g'; \ echo 's,\$$QTDIR,$(prefix),g'; \ echo 's,$(QTDIR),$(prefix),g'; \ echo 's,^\(\./\)*root/,/,g'; \ echo 's,^\(\./\)*etc/,$(prefix)/etc/,g'; \ echo 's,^\(\./\)*lib/,$(prefix)/lib/,g'; \ echo 's,^\(\./\)*bin/,$(prefix)/bin/,g'; \ echo 's,^\(\./\)*pics/,$(prefix)/pics/,g'; \ echo 's,^\(\./\)*sounds/,$(prefix)/sounds/,g'; \ echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ echo 's,^\(\./\)*plugins/,$(prefix)/plugins/,g'; \ echo 's,^\(\./\)*apps/,$(prefix)/apps/,g'; \ echo 's,^\(\./\)*share/,$(prefix)/share/,g'; \ echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ echo 's,^\(\./\)*help/,$(prefix)/help/,g'; \ ) > $@ || ( rm -f $@; exit 1 ) ## general rules ## define descend $(MAKE) $(if $(QMAKE),QMAKE=$(QMAKE)) -C $(1) $(2) endef define makefilegen cd $(if $(1),$(shell dirname $(1))); $(TOPDIR)/qmake/qmake $(3) -o $(if $(1),$(shell basename $(1))) `cat $(OPIEDIR)/packages | grep " \`echo $(1)|sed -e 's,/Makefile$$,,'\` " | \ head -1 | awk '{print $$3}'` endef define makecfg $(TOPDIR)/scripts/makecfg.pl $1 $(OPIEDIR) endef @@ -1,259 +1,264 @@ mainmenu "Opie Configuration" menu "Build Parameters" choice prompt "Target Machine" default TARGET_X86 help Please select the architecture of the machine you will be building the OpenZaurus buildroot for. config TARGET_X86 boolean "Intel X86" config TARGET_MACOSX boolean "Mac OS X (DARWIN)" config TARGET_SHARP boolean "Sharp Zaurus w/ SA1100 (5000 and 5500)" config TARGET_C700 boolean "Sharp Zaurus w/ PXA25x (5600, C7x0, C8x0)" config TARGET_IPAQ boolean "iPAQ" config TARGET_RAMSES boolean "Ramses" config TARGET_SIMPAD boolean "SIMpad" config TARGET_YOPY boolean "Yopy 3500/3700" endchoice config OPTIMIZE boolean "Use optimizations" default "y" if ! TARGET_X86 config THREADED boolean "Enable threaded build" default "n" config STATIC boolean "Build static libraries" default "n" config DEBUG boolean "Enable debug builds" default n config RELEASE bool default y depends !DEBUG config QUICK_LAUNCH boolean "Enable Quick Launch" default n if TARGET_X86 default y if ! TARGET_X86 config QUICKLAUNCH_PATH string "Path to quicklauncher" default "./quicklauncher" if TARGET_X86 default "/opt/QtPalmtop/bin/quicklauncher" if ! TARGET_X86 config SPECFILE string default "qws/linux-generic-g++" if TARGET_X86 && (! X11) default "linux-g++" if TARGET_X86 && X11 default "qws/linux-sharp-g++" if TARGET_SHARP && (! X11) default "linux-g++" if TARGET_SHARP && X11 default "qws/linux-ipaq-g++" if TARGET_IPAQ && (! X11) default "linux-g++" if TARGET_IPAQ && X11 default "qws/linux-ramses-g++" if TARGET_RAMSES && (! X11) default "linux-g++" if TARGET_RAMSES && X11 default "qws/linux-simpad-g++" if TARGET_SIMPAD && (! X11) default "linux-g++" if TARGET_SIMPAD && X11 default "qws/linux-yopy-g++" if TARGET_YOPY && (! X11) default "qws/macx-generic-g++" if TARGET_MACOSX && (! X11) config CUSTOMFILE string default "custom-ipaq.h" if TARGET_IPAQ default "custom-sharp.h" if TARGET_SHARP default "custom-ramses.h" if TARGET_RAMSES default "custom-ipaq.h" if TARGET_SIMPAD default "custom-yopy.h" if TARGET_YOPY config OPTIMIZATIONS string "Optimization flags" depends OPTIMIZE default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_IPAQ default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_YOPY default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SHARP default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_RAMSES default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SIMPAD default "-march=armv5te -mtune=xscale -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_C700 config EXPERIMENTAL bool "Prompt for development and/or incomplete items" default y endmenu menu "Configuration" config OPIE_NO_OVERRIDE_QT boolean "Build Opie against an unpatched version of Qt" default n config OPIE_NO_ERASERECT_FIX boolean "Disable Fixup eraseRect for HancomMobileWord,neocal.. to make libopiecore work on Sharps libqpe" default n config OPIE_NO_BUILTIN_SHUTDOWN boolean "Disable the built in shutdown application" default y config OPIE_NO_BUILTIN_CALIBRATE boolean "Disable the built in calibrate application" default y if TARGET_YOPY default n if ! TARGET_YOPY config OPIE_SOUND_FRAGMENT_SHIFT string "The sound fragment used in Opie Player I" default "14" if TARGET_IPAQ default "16" if ! TARGET_IPAQ config USE_REALTIME_AUDIO_THREAD boolean "Use a realtime thread in Opie Player I" default y if TARGET_IPAQ || TARGET_SIMPAD || TARGET_RAMSES || TARGET_SHARP default n if ! (TARGET_IPAQ || TARGET_SIMPAD || TARGET_RAMSES || TARGET_SHARP) config QT_QWS_ALLOW_OVERCLOCK boolean "Allow the user to overclock the device" depends TARGET_RAMSES default n config USE_FILE_NOTIFICATION boolean "Substitute (some) polling interfaces with OFileNotifier" default y config OPIE_NEW_ALLOC boolean "Use malloc and free for the implementation" default y if TARGET_RAMSES || TARGET_IPAQ || TARGET_SIMPAD || TARGET_SHARP default n if ! (TARGET_IPAQ || TARGET_SIMPAD || TARGET_RAMSES || TARGET_SHARP) +config OPIE_TASKBAR_LOCK_KEY_STATE + boolean "Have a KeyLock state indicator on the taskbar" + default y if TARGET_SHARP + default n if !TARGET_SHARP + config OPIE_NO_SOUND_PCM_READ_BITS boolean "There is not a pcm_read_bits io control" default y if TARGET_SHARP default n if ! TARGET_SHARP endmenu menu "Dependencies" source dependencies.in endmenu menu "Base" choice prompt "Qpe Library Selection" default LIBQPE source library/config.in source x11/config.in endchoice source libopie/config.in source libopie2/config.in source libqtaux/config.in source rsync/config.in source core/opie-login/config.in source core/opiealarm/config.in source core/tools/quicklauncher/config.in source core/launcher/config.in source core/symlinker/config.in endmenu comment "" menu "Applets" source core/applets/config.in source noncore/applets/config.in endmenu menu "Apps" source core/apps/config.in source noncore/apps/config.in endmenu menu "Communications and Networking" source noncore/comm/config.in source noncore/net/config.in endmenu menu "Games" source noncore/games/config.in endmenu menu "Graphics and Multimedia" source freetype/config.in source noncore/graphics/config.in source core/multimedia/config.in source noncore/multimedia/config.in endmenu menu "Input methods" source inputmethods/config.in endmenu menu "Pim" source core/obex/config.in source core/pim/config.in comment "Today Plugins ---" source noncore/todayplugins/config.in source core/pim/today/plugins/config.in endmenu menu "Settings" source core/settings/config.in source noncore/settings/config.in source noncore/securityplugins/config.in endmenu menu "Theming" comment "Decorations ---" source noncore/decorations/config.in comment "Styles ---" source noncore/styles/config.in endmenu menu "Tools" source noncore/tools/config.in endmenu menu "Development" source development/keyview/config.in #source development/debugviewer/config.in endmenu menu "Examples" config EXAMPLES boolean "Compile Example Application" source examples/config.in endmenu comment "" menu "Unsupported / Unmaintained" source noncore/unsupported/config.in endmenu comment "" depends on EXPERIMENTAL menu "Experimental" depends on EXPERIMENTAL source libslcompat/config.in source core/qws/config.in endmenu diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 87a54bf..aa357ca 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp @@ -1,801 +1,781 @@ /********************************************************************** ** 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 "startmenu.h" #include "taskbar.h" #include "serverinterface.h" #include "launcherview.h" #include "launcher.h" #include "server.h" /* OPIE */ #include <opie2/odebug.h> #include <qtopia/global.h> #ifdef Q_WS_QWS #include <qtopia/qcopenvelope_qws.h> #endif #include <qtopia/resource.h> #include <qtopia/applnk.h> #include <qtopia/config.h> #include <qtopia/qpeapplication.h> #include <qtopia/mimetype.h> #include <qtopia/private/categories.h> #define QTOPIA_INTERNAL_FSLP #include <qtopia/lnkproperties.h> /* QT */ #include <qdir.h> #ifdef Q_WS_QWS #include <qkeyboard_qws.h> #include <qwindowsystem_qws.h> #endif #include <qtimer.h> #include <qcombobox.h> #include <qvbox.h> #include <qlayout.h> #include <qstyle.h> #include <qpushbutton.h> #include <qtabbar.h> #include <qwidgetstack.h> #include <qregexp.h> #include <qmessagebox.h> #include <qframe.h> #include <qpainter.h> #include <qlabel.h> #include <qtextstream.h> #include <qpopupmenu.h> /* STD */ #include <stdlib.h> #include <assert.h> #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) #include <unistd.h> #include <stdio.h> #include <sys/vfs.h> #include <mntent.h> #endif static bool isVisibleWindow( int ); //=========================================================================== LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : QVBox( parent ), docview( 0 ) { docLoadingWidgetEnabled = false; docLoadingWidget = 0; docLoadingWidgetProgress = 0; launcher = parent; categoryBar = new LauncherTabBar( this ); QPalette pal = categoryBar->palette(); pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); categoryBar->setPalette( pal ); stack = new QWidgetStack(this); connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); categoryBar->show(); stack->show(); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(launcherMessage(const QCString&,const QByteArray&)) ); connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), this, SLOT(appMessage(const QCString&,const QByteArray&))); #endif createDocLoadingWidget(); } void LauncherTabWidget::createDocLoadingWidget() { // Construct the 'doc loading widget' shown when finding documents // ### LauncherView class needs changing to be more generic so // this widget can change its background similar to the iconviews // so the background for this matches docLoadingWidget = new LauncherView( stack ); docLoadingWidget->hideIcons(); QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); docLoadingVBox->setSpacing( 20 ); docLoadingVBox->setMargin( 10 ); QWidget *space1 = new QWidget( docLoadingVBox ); docLoadingVBox->setStretchFactor( space1, 1 ); QLabel *waitPixmap = new QLabel( docLoadingVBox ); waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); Config cfg( "Launcher" ); cfg.setGroup( "DocTab" ); bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); QLabel *textLabel = new QLabel( docLoadingVBox ); textLabel->setAlignment( int( QLabel::AlignCenter ) ); docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); docLoadingWidgetProgress->setProgress( 0 ); docLoadingWidgetProgress->setCenterIndicator( TRUE ); docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker setProgressStyle(); if ( docTabEnabled ) { textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); } else { textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); docLoadingWidgetProgress->hide(); docLoadingWidgetEnabled = true; } QWidget *space2 = new QWidget( docLoadingVBox ); docLoadingVBox->setStretchFactor( space2, 1 ); cfg.setGroup( "Tab Documents" ); // No tr setTabViewAppearance( docLoadingWidget, cfg ); stack->addWidget( docLoadingWidget, 0 ); } void LauncherTabWidget::initLayout() { layout()->activate(); docView()->setFocus(); categoryBar->showTab("Documents"); } void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) { if ( message == "nextView()" ) categoryBar->nextTab(); } void LauncherTabWidget::raiseTabWidget() { if ( categoryBar->currentView() == docView() && docLoadingWidgetEnabled ) { stack->raiseWidget( docLoadingWidget ); docLoadingWidget->updateGeometry(); } else { stack->raiseWidget( categoryBar->currentView() ); } } void LauncherTabWidget::tabProperties() { LauncherView *view = categoryBar->currentView(); QPopupMenu *m = new QPopupMenu( this ); m->insertItem( tr("Icon View"), LauncherView::Icon ); m->insertItem( tr("List View"), LauncherView::List ); m->setItemChecked( (int)view->viewMode(), TRUE ); int rv = m->exec( QCursor::pos() ); if ( rv >= 0 && rv != view->viewMode() ) { view->setViewMode( (LauncherView::ViewMode)rv ); } delete m; } void LauncherTabWidget::deleteView( const QString& id ) { LauncherTab *t = categoryBar->launcherTab(id); if ( t ) { stack->removeWidget( t->view ); delete t->view; categoryBar->removeTab( t ); } } LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) { LauncherView* view = new LauncherView( stack ); connect( view, SIGNAL(clicked(const AppLnk*)), this, SIGNAL(clicked(const AppLnk*))); connect( view, SIGNAL(rightPressed(AppLnk*)), this, SIGNAL(rightPressed(AppLnk*))); int n = categoryBar->count(); stack->addWidget( view, n ); LauncherTab *tab = new LauncherTab( id, view, pm, label ); categoryBar->insertTab( tab, n-1 ); if ( id == "Documents" ) docview = view; odebug << "inserting " << id << " at " << n-1 << "" << oendl; Config cfg("Launcher"); setTabAppearance( tab, cfg ); cfg.setGroup( "GUI" ); view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) ); return view; } LauncherView *LauncherTabWidget::view( const QString &id ) { LauncherTab *t = categoryBar->launcherTab(id); if ( !t ) return 0; return t->view; } LauncherView *LauncherTabWidget::docView() { return docview; } void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) { if ( v != docLoadingWidgetEnabled && docLoadingWidget ) { docLoadingWidgetEnabled = v; raiseTabWidget(); } } void LauncherTabWidget::setLoadingProgress( int percent ) { docLoadingWidgetProgress->setProgress( (percent / 4) * 4 ); } // ### this function could more to LauncherView void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) { // View QString view = cfg.readEntry( "View", "Icon" ); if ( view == "List" ) // No tr v->setViewMode( LauncherView::List ); QString bgType = cfg.readEntry( "BackgroundType", "Image" ); if ( bgType == "Image" ) { // No tr QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); v->setBackgroundType( LauncherView::Image, pm ); } else if ( bgType == "SolidColor" ) { QString c = cfg.readEntry( "BackgroundColor" ); v->setBackgroundType( LauncherView::SolidColor, c ); } else { v->setBackgroundType( LauncherView::Ruled, QString::null ); } QString textCol = cfg.readEntry( "TextColor" ); if ( textCol.isEmpty() ) v->setTextColor( QColor() ); else v->setTextColor( QColor(textCol) ); // bool customFont = cfg.readBoolEntry( "CustomFont", FALSE ); QStringList font = cfg.readListEntry( "Font", ',' ); if ( font.count() == 4 ) v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); // ### FIXME TabColor TabTextColor } // ### Could move to LauncherTab void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg ) { cfg.setGroup( QString( "Tab %1" ).arg(tab->type) ); // No tr setTabViewAppearance( tab->view, cfg ); // Tabs QString tabCol = cfg.readEntry( "TabColor" ); if ( tabCol.isEmpty() ) tab->bgColor = QColor(); else tab->bgColor = QColor(tabCol); QString tabTextCol = cfg.readEntry( "TabTextColor" ); if ( tabTextCol.isEmpty() ) tab->fgColor = QColor(); else tab->fgColor = QColor(tabTextCol); } void LauncherTabWidget::paletteChange( const QPalette &p ) { QVBox::paletteChange( p ); QPalette pal = palette(); pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); categoryBar->setPalette( pal ); categoryBar->update(); } void LauncherTabWidget::styleChange( QStyle & ) { QTimer::singleShot( 0, this, SLOT(setProgressStyle()) ); } void LauncherTabWidget::setProgressStyle() { if (docLoadingWidgetProgress) { docLoadingWidgetProgress->setFrameShape( QProgressBar::Box ); docLoadingWidgetProgress->setFrameShadow( QProgressBar::Plain ); docLoadingWidgetProgress->setMargin( 1 ); docLoadingWidgetProgress->setLineWidth( 1 ); } } /* * FIXME * The following NULL check is triggered by inserting, then removing a tab on the fly * as you would if you had removable media (which I do). Without this check * the first app launched after a tab removal causes qpe to Segfault. * This obviously has a more sinister cause, but this works around it with no * obvious adverse effects. Please FIXME * bkc - 17/6/2004 * */ void LauncherTabWidget::setBusy(bool on) { if ( on ) currentView()->setBusy(TRUE); else { for ( int i = 0; i < categoryBar->count(); i++ ) { if (categoryBar->tab(i)) { LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view; view->setBusy( FALSE ); } else { odebug << "Averting Disaster with tab " << i << " == NULL! " << oendl; } } } } void LauncherTabWidget::setBusyIndicatorType( const QString& str ) { for (int i = 0; i < categoryBar->count(); i++ ) { LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view; view->setBusyIndicatorType( str ); } } LauncherView *LauncherTabWidget::currentView(void) { return (LauncherView*)stack->visibleWidget(); } void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "setTabView(QString,int)" ) { QString id; stream >> id; int mode; stream >> mode; if ( view(id) ) view(id)->setViewMode( (LauncherView::ViewMode)mode ); } else if ( msg == "setTabBackground(QString,int,QString)" ) { QString id; stream >> id; int mode; stream >> mode; QString pixmapOrColor; stream >> pixmapOrColor; if ( view(id) ) view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); if ( id == "Documents" ) docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); } else if ( msg == "setTextColor(QString,QString)" ) { QString id; stream >> id; QString color; stream >> color; if ( view(id) ) view(id)->setTextColor( QColor(color) ); if ( id == "Documents" ) docLoadingWidget->setTextColor( QColor(color) ); } else if ( msg == "setFont(QString,QString,int,int,int)" ) { QString id; stream >> id; QString fam; stream >> fam; int size; stream >> size; int weight; stream >> weight; int italic; stream >> italic; if ( view(id) ) { if ( !fam.isEmpty() ) { view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl; } else { view(id)->clearViewFont(); } } }else if ( msg == "setBusyIndicatorType(QString)" ) { QString type; stream >> type; setBusyIndicatorType( type ); }else if ( msg == "home()" ) { if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { if (categoryBar) categoryBar->nextTab(); }else static_cast<QWidget*>(parent())->raise(); } } //--------------------------------------------------------------------------- Launcher::Launcher() : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) { tabs = 0; tb = 0; Config cfg( "Launcher" ); cfg.setGroup( "DocTab" ); docTabEnabled = cfg.readBoolEntry( "Enable", true ); } void Launcher::createGUI() { setCaption( tr("Launcher") ); // we have a pretty good idea how big we'll be setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); tb = new TaskBar; tabs = new LauncherTabWidget( this ); setCentralWidget( tabs ); ServerInterface::dockWidget( tb, ServerInterface::Bottom ); tb->show(); qApp->installEventFilter( this ); - - connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); - connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); - connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); - connect( tb, SIGNAL(tabSelected(const QString&)), this, SLOT(showTab(const QString&)) ); connect( tabs, SIGNAL(selected(const QString&)), this, SLOT(viewSelected(const QString&)) ); connect( tabs, SIGNAL(clicked(const AppLnk*)), this, SLOT(select(const AppLnk*))); connect( tabs, SIGNAL(rightPressed(AppLnk*)), this, SLOT(properties(AppLnk*))); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); connect( sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(systemMessage(const QCString&,const QByteArray&)) ); #endif // all documents QImage img( Resource::loadImage( "DocsIcon" ) ); QPixmap pm; pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); // It could add this itself if it handles docs tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); qApp->setMainWidget( this ); QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); } Launcher::~Launcher() { if ( tb ) destroyGUI(); } bool Launcher::requiresDocuments() const { Config cfg( "Launcher" ); cfg.setGroup( "DocTab" ); return cfg.readBoolEntry( "Enable", true ); } void Launcher::makeVisible() { showMaximized(); } void Launcher::destroyGUI() { delete tb; tb = 0; delete tabs; tabs =0; } bool Launcher::eventFilter( QObject*, QEvent *ev ) { #ifdef QT_QWS_CUSTOM 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() ) active->close(); else { Global::terminateBuiltin("calibrate"); // No tr tb->launchStartMenu(); } return TRUE; } } #else Q_UNUSED(ev); #endif return FALSE; } -void Launcher::toggleSymbolInput() -{ - tb->toggleSymbolInput(); -} - -void Launcher::toggleNumLockState() -{ - tb->toggleNumLockState(); -} - -void Launcher::toggleCapsLockState() -{ - tb->toggleCapsLockState(); -} - static bool isVisibleWindow(int wid) { #ifdef Q_WS_QWS const QList<QWSWindow> &list = qwsServer->clientWindows(); QWSWindow* w; for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { if ( w->winId() == wid ) return !w->isFullyObscured(); } #endif return FALSE; } void Launcher::viewSelected(const QString& s) { setCaption( s + tr(" - Launcher") ); } void Launcher::showTab(const QString& id) { tabs->categoryBar->showTab(id); raise(); } void Launcher::select( const AppLnk *appLnk ) { if ( appLnk->type() == "Folder" ) { // No tr // Not supported: flat is simpler for the user } else { if ( appLnk->exec().isNull() ) { int i = QMessageBox::information(this,tr("No application"), tr("<p>No application is defined for this document." "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); /* ### Fixme */ if ( i == 1 ) Global::execute("textedit",appLnk->file()); return; } tabs->setBusy(TRUE); emit executing( appLnk ); appLnk->execute(); } } void Launcher::properties( AppLnk *appLnk ) { if ( appLnk->type() == "Folder" ) { // No tr // Not supported: flat is simpler for the user } else { /* ### libqtopia FIXME also moving docLnks... */ LnkProperties prop(appLnk,0 ); QPEApplication::execDialog( &prop ); } } void Launcher::storageChanged( const QList<FileSystem> &fs ) { // ### update combo boxes if we had a combo box for the storage type } void Launcher::systemMessage( const QCString &msg, const QByteArray &data) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "busy()" ) { tb->startWait(); } else if ( msg == "notBusy(QString)" ) { QString app; stream >> app; tabs->setBusy(FALSE); tb->stopWait(app); } else if (msg == "applyStyle()") { tabs->currentView()->relayout(); } } // These are the update functions from the server void Launcher::typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& ) { tabs->newView( type, pixmap, name ); ids.append( type ); /* this will be called in applicationScanningProgress with value 100! */ // tb->refreshStartMenu(); static bool first = TRUE; if ( first ) { first = FALSE; tabs->categoryBar->showTab(type); } tabs->view( type )->setUpdatesEnabled( FALSE ); tabs->view( type )->setSortEnabled( FALSE ); } void Launcher::typeRemoved( const QString& type ) { tabs->view( type )->removeAllItems(); tabs->deleteView( type ); ids.remove( type ); /* this will be called in applicationScanningProgress with value 100! */ // tb->refreshStartMenu(); } void Launcher::applicationAdded( const QString& type, const AppLnk& app ) { if ( app.type() == "Separator" ) // No tr return; LauncherView *view = tabs->view( type ); if ( view ) view->addItem( new AppLnk( app ), FALSE ); else owarn << "addAppLnk: No view for type " << type.latin1() << ". Can't add app " << app.name().latin1() << "!", MimeType::registerApp( app ); } void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) { LauncherView *view = tabs->view( type ); if ( view ) view->removeLink( app.linkFile() ); else owarn << "removeAppLnk: No view for " << type << "!" << oendl; } void Launcher::allApplicationsRemoved() { MimeType::clear(); for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) tabs->view( (*it) )->removeAllItems(); } void Launcher::documentAdded( const DocLnk& doc ) { tabs->docView()->addItem( new DocLnk( doc ), FALSE ); } void Launcher::aboutToAddBegin() { tabs->docView()->setUpdatesEnabled( false ); } void Launcher::aboutToAddEnd() { tabs->docView()->setUpdatesEnabled( true ); } void Launcher::showLoadingDocs() { tabs->docView()->hide(); } void Launcher::showDocTab() { if ( tabs->categoryBar->currentView() == tabs->docView() ) tabs->docView()->show(); } void Launcher::documentRemoved( const DocLnk& doc ) { tabs->docView()->removeLink( doc.linkFile() ); } void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) { documentRemoved( oldDoc ); documentAdded( newDoc ); } void Launcher::allDocumentsRemoved() { tabs->docView()->removeAllItems(); } void Launcher::applicationStateChanged( const QString& name, ApplicationState state ) { tb->setApplicationState( name, state ); } void Launcher::applicationScanningProgress( int percent ) { switch ( percent ) { case 0: { for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { tabs->view( (*it) )->setUpdatesEnabled( FALSE ); tabs->view( (*it) )->setSortEnabled( FALSE ); } break; } case 100: { for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { tabs->view( (*it) )->setUpdatesEnabled( TRUE ); tabs->view( (*it) )->setSortEnabled( TRUE ); } tb->refreshStartMenu(); break; } default: break; } } void Launcher::documentScanningProgress( int percent ) { switch ( percent ) { case 0: { tabs->setLoadingProgress( 0 ); tabs->setLoadingWidgetEnabled( TRUE ); tabs->docView()->setUpdatesEnabled( FALSE ); tabs->docView()->setSortEnabled( FALSE ); break; } case 100: { tabs->docView()->updateTools(); tabs->docView()->setSortEnabled( TRUE ); tabs->docView()->setUpdatesEnabled( TRUE ); tabs->setLoadingWidgetEnabled( FALSE ); break; } default: tabs->setLoadingProgress( percent ); break; } } diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h index 29bd7db..2eaf77c 100644 --- a/core/launcher/launcher.h +++ b/core/launcher/launcher.h @@ -1,159 +1,156 @@ /********************************************************************** ** 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. ** **********************************************************************/ #ifndef LAUNCHER_H #define LAUNCHER_H #include <qtopia/config.h> #include <qtopia/storage.h> #include <qtopia/applnk.h> #include <qmainwindow.h> #include <qstringlist.h> #include <qprogressbar.h> #include <qvbox.h> #include <qlist.h> #include <qdict.h> #include "launcherview.h" #include "launchertab.h" #include "serverinterface.h" class QWidgetStack; class TaskBar; class Launcher; class LauncherTabWidget : public QVBox { // can't use a QTabWidget, since it won't let us set the frame style. Q_OBJECT public: LauncherTabWidget( Launcher* parent ); void updateDocs(AppLnkSet* docFolder); void setBusy(bool on); LauncherView *currentView(void); LauncherView* newView( const QString&, const QPixmap& pm, const QString& label ); void deleteView( const QString& ); void setTabViewAppearance( LauncherView *v, Config &cfg ); void setTabAppearance( LauncherTab *, Config &cfg ); LauncherView *view( const QString & ); LauncherView *docView(); void createDocLoadingWidget(); void setLoadingWidgetEnabled( bool v ); void setLoadingProgress( int percent ); LauncherTabBar* categoryBar; void setBusyIndicatorType( const QString& type ); signals: void selected(const QString&); void clicked(const AppLnk*); void rightPressed(AppLnk*); protected slots: void raiseTabWidget(); void tabProperties(); void initLayout(); private slots: void launcherMessage( const QCString &, const QByteArray &); void appMessage( const QCString &, const QByteArray &); void setProgressStyle(); protected: void paletteChange( const QPalette &p ); void styleChange( QStyle & ); private: Launcher *launcher; LauncherView *docview; QWidgetStack *stack; LauncherView *docLoadingWidget; QProgressBar *docLoadingWidgetProgress; bool docLoadingWidgetEnabled; }; class Launcher : public QMainWindow, public ServerInterface { Q_OBJECT public: Launcher(); ~Launcher(); // implementing ServerInterface void createGUI(); void destroyGUI(); void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ); void typeRemoved( const QString& type ); void applicationAdded( const QString& type, const AppLnk& doc ); void applicationRemoved( const QString& type, const AppLnk& doc ); void allApplicationsRemoved(); void applicationStateChanged( const QString& name, ApplicationState state ); void documentAdded( const DocLnk& doc ); void documentRemoved( const DocLnk& doc ); void aboutToAddBegin(); void aboutToAddEnd(); void allDocumentsRemoved(); void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ); void storageChanged( const QList<FileSystem> & ); void applicationScanningProgress( int percent ); void documentScanningProgress( int percent ); bool requiresApplications() const { return TRUE; } bool requiresDocuments() const; void showLoadingDocs(); void showDocTab(); QStringList idList() const { return ids; } public slots: void viewSelected(const QString&); void showTab(const QString&); void select( const AppLnk * ); void properties( AppLnk * ); void makeVisible(); signals: void executing( const AppLnk * ); private slots: void systemMessage( const QCString &, const QByteArray &); - void toggleSymbolInput(); - void toggleNumLockState(); - void toggleCapsLockState(); protected: bool eventFilter( QObject *o, QEvent *ev ); private: void updateApps(); void loadDocs(); void updateDocs(); void updateTabs(); LauncherTabWidget *tabs; QStringList ids; TaskBar *tb; bool docTabEnabled; }; #endif // LAUNCHERVIEW_H diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index 86e0d0d..abe238f 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp @@ -1,380 +1,380 @@ /********************************************************************** ** 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 "startmenu.h" #include "inputmethods.h" #include "runningappbar.h" #include "systray.h" #include "wait.h" #include "appicons.h" #include "taskbar.h" #include "server.h" /* OPIE */ #include <opie2/odebug.h> #include <qtopia/config.h> #include <qtopia/qpeapplication.h> #ifdef QWS #include <qtopia/qcopenvelope_qws.h> #endif #include <qtopia/global.h> using namespace Opie::Core; /* QT */ #include <qlabel.h> #include <qlayout.h> #include <qtimer.h> #ifdef QWS #include <qwindowsystem_qws.h> #endif #include <qwidgetstack.h> #if defined( Q_WS_QWS ) #include <qwsdisplay_qws.h> #include <qgfx_qws.h> #endif static bool initNumLock() { #ifdef QPE_INITIAL_NUMLOCK_STATE QPE_INITIAL_NUMLOCK_STATE #endif return FALSE; } //--------------------------------------------------------------------------- class SafeMode : public QWidget { Q_OBJECT public: SafeMode( QWidget *parent ) : QWidget( parent ), menu(0) { message = tr("Safe Mode"); QFont f( font() ); f.setWeight( QFont::Bold ); setFont( f ); } void mousePressEvent( QMouseEvent *); QSize sizeHint() const; void paintEvent( QPaintEvent* ); private slots: void action(int i); private: QString message; QPopupMenu *menu; }; void SafeMode::mousePressEvent( QMouseEvent *) { if ( !menu ) { menu = new QPopupMenu(this); menu->insertItem( tr("Plugin Manager..."), 0 ); menu->insertItem( tr("Restart Qtopia"), 1 ); menu->insertItem( tr("Help..."), 2 ); connect(menu, SIGNAL(activated(int)), this, SLOT(action(int))); } QPoint curPos = mapToGlobal( QPoint(0,0) ); QSize sh = menu->sizeHint(); menu->popup( curPos-QPoint((sh.width()-width())/2,sh.height()) ); } void SafeMode::action(int i) { switch (i) { case 0: Global::execute( "pluginmanager" ); break; case 1: Global::restart(); break; case 2: Global::execute( "helpbrowser", "safemode.html" ); break; } } QSize SafeMode::sizeHint() const { QFontMetrics fm = fontMetrics(); return QSize( fm.width(message), fm.height() ); } void SafeMode::paintEvent( QPaintEvent* ) { QPainter p(this); p.drawText( rect(), AlignCenter, message ); } //--------------------------------------------------------------------------- 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) { Config cfg( "Launcher" ); cfg.setGroup( "InputMethods" ); resizeRunningApp = cfg.readBoolEntry( "Resize", true ); sm = new StartMenu( this ); connect( sm, SIGNAL(tabSelected(const QString&)), this, SIGNAL(tabSelected(const QString&)) ); inputMethods = new InputMethods( this ); connect( inputMethods, SIGNAL(inputToggled(bool)), this, SLOT(calcMaxWindowRect()) ); stack = new QWidgetStack( this ); stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); label = new QLabel(stack); runningAppBar = new RunningAppBar(stack); stack->raiseWidget(runningAppBar); waitIcon = new Wait( this ); (void) new AppIcons( this ); sysTray = new SysTray( this ); /* ### FIXME plugin loader and safe mode */ #if 0 if (PluginLoader::inSafeMode()) (void)new SafeMode( this ); #endif // ## make customizable in some way? -#ifdef QT_QWS_CUSTOM +#ifdef OPIE_TASKBAR_LOCK_KEY_STATE 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())); connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); } 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); if ( sysTray ) sysTray->show(); // 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&) { waitTimer->stop(); waitIcon->setWaiting( false ); } void TaskBar::stopWait() { waitTimer->stop(); waitIcon->setWaiting( false ); } /* * This resizeEvent will be captured by * the ServerInterface and it'll layout * and calc rect. Now if we go from bigger * to smaller screen the SysTray is out of * bounds and repaint() won't trigger an Event */ void TaskBar::resizeEvent( QResizeEvent *e ) { if ( sysTray ) sysTray->hide(); QHBox::resizeEvent( e ); if ( sysTray ) sysTray->show(); owarn << "TaskBar::resize event" << oendl; } void TaskBar::styleChange( QStyle &s ) { QHBox::styleChange( s ); calcMaxWindowRect(); } void TaskBar::calcMaxWindowRect() { if ( resizeRunningApp ) { #if defined(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 < 0x030000 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 == "showInputMethod(QString)" ) { QString name; stream >> name; inputMethods->showInputMethod(name); } else if ( msg == "reloadInputMethods()" ) { inputMethods->loadInputMethods(); } else if ( msg == "reloadApplets()" ) { sysTray->clearApplets(); sm->createMenu(); sysTray->addApplets(); }else if ( msg == "toggleMenu()" ) { if ( sm-> launchMenu-> isVisible() ) sm-> launch(); else QCopEnvelope e( "QPE/System", "toggleApplicationMenu()" ); }else if ( msg == "toggleStartMenu()" ) sm->launch(); } void TaskBar::setApplicationState( const QString &name, ServerInterface::ApplicationState state ) { if ( state == ServerInterface::Launching ) runningAppBar->applicationLaunched( name ); else if ( state == ServerInterface::Terminated ) runningAppBar->applicationTerminated( name ); } void TaskBar::toggleNumLockState() { if ( lockState ) lockState->toggleNumLockState(); } void TaskBar::toggleCapsLockState() { if ( lockState ) lockState->toggleCapsLockState(); } void TaskBar::toggleSymbolInput() { QString unicodeInput = qApp->translate( "InputMethods", "Unicode" ); if ( inputMethods->currentShown() == unicodeInput ) { inputMethods->hideInputMethod(); } else { inputMethods->showInputMethod( unicodeInput ); } } #include "taskbar.moc" |