85 files changed, 2262 insertions, 144 deletions
@@ -1,118 +1,121 @@ ifndef QTDIR $(error QTDIR not set) endif prefix=/opt/QtPalmtop ifeq ($(OPIEDIR),) export OPIEDIR:=$(TOPDIR) endif ifeq ($(IPK_DIR),) export IPK_DIR:=$(OPIEDIR) endif ifneq ($(wildcard $(TOPDIR)/.config),) include $(TOPDIR)/.config endif ifdef CONFIG_TARGET_X86 PLATFORM=x86-linux endif ifdef CONFIG_TARGET_SHARP PLATFORM=sharp-linux endif ifdef CONFIG_TARGET_IPAQ PLATFORM=ipaq-linux endif ifdef CONFIG_TARGET_RAMSES PLATFORM=ramses-linux endif ifdef CONFIG_TARGET_SIMPAD PLATFORM=simpad-linux endif ifdef CONFIG_TARGET_YOPY PLATFORM=yopy-linux endif +ifdef CONFIG_TARGET_MACOSX + PLATFORM=macx-darwin +endif export QMAKE:=$(OPIEDIR)/qmake/qmake export QMAKESPECSDIR=$(OPIEDIR)/mkspecs ifeq ($(QPE_VERSION),) VERSION_MAJ:=$(shell echo $$(sed -n -e 's/.*QPE_VERSION "\([0-9]*\)\..*\..*".*/\1/p' <$(OPIEDIR)/library/version.h)) VERSION_MIN:=$(shell echo $$(sed -n -e 's/.*QPE_VERSION ".*\.\([0-9]*\)\..*".*/\1/p' <$(OPIEDIR)/library/version.h)) VERSION_PAT:=$(shell echo $$(sed -n -e 's/.*QPE_VERSION ".*\..*\.\([0-9]*\).*/\1/p' <$(OPIEDIR)/library/version.h)) QPE_VERSION:=$(VERSION_MAJ).$(VERSION_MIN).$(VERSION_PAT) ifeq ($(QPE_VERSION),..) QPE_VERSION=0.9.3 endif endif export QPE_VERSION SUB_VERSION=$(shell echo $$(sed -n -e 's,.*SUB_VERSION \"\(.*\)\".*,\1,p' <$(OPIEDIR)/library/version.h)) ifeq ($(VERSION_CVS),) VERSION_CVS:=$(shell date +%Y%m%d) endif ifneq ($(filter %snapshot",$(shell cat $(OPIEDIR)/library/version.h|grep QPE_VERSION)),) SUB_VERSION:=$(VERSION_CVS) endif export SUB_VERSION ifneq ($(strip $(SUB_VERSION)),) EXTRAVERSION=-$(SUB_VERSION) endif ifeq ($(QTE_REVISION),) QTE_REVISION=5 endif export QTE_REVISION export DEB_VERSION=2.0 ifeq ($(QTE_BASEVERSION),) ifneq ($(shell ls $(QTDIR)/include/qglobal.h 2>/dev/null),) QTE_BASEVERSION:=$(shell cat $(QTDIR)/include/qglobal.h|grep '^\#define QT_VERSION'|grep -v STR|sed -e 's/\#define QT_VERSION\t*//; s/.*\([0-9]\)\([0-9]\)\([0-9]\).*/\1.\2.\3/;') else QTE_BASEVERSION=2.3.5 endif endif export QTE_BASEVERSION ifeq ($(QTE_VERSION),) ifneq ($(shell ls $(QTDIR)/include/qglobal.h 2>/dev/null),) QTE_VERSION:=$(shell cat $(QTDIR)/include/qglobal.h|grep '^\#define QT_VERSION_STR'|sed -e 's/\#define QT_VERSION_STR\t*//;' -e 's/.*"\([^"]*\)".*/\1/;') else QTE_VERSION=2.3.5 endif endif export QTE_VERSION export PATH:=$(OPIEDIR)/scripts:$(PATH) export QMAKESPEC=$(QMAKESPECSDIR)/$(patsubst "%",%,$(CONFIG_SPECFILE)) ifdef CONFIG_OPTIMIZATIONS export CFLAGS_RELEASE=$(patsubst "%,%,$(CONFIG_OPTIMIZATIONS)) export CFLAGS_RELEASE:=$(patsubst %",%,$(CFLAGS_RELEASE)) endif ifeq ($(STRIP),) ifneq ($(CONFIG_TARGET_X86),) STRIP=strip endif ifneq ($(CONFIG_TARGET_IPAQ),) STRIP=arm-linux-strip endif ifneq ($(CONFIG_TARGET_SHARP),) STRIP=arm-linux-strip endif ifneq ($(CONFIG_TARGET_RAMSES),) STRIP=arm-linux-strip endif ifneq ($(CONFIG_TARGET_SIMPAD),) STRIP=arm-linux-strip endif ifneq ($(CONFIG_TARGET_YOPY),) STRIP=arm-linux-strip endif endif @@ -1,190 +1,194 @@ 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" 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 DEBUG boolean "Enable debug builds" default n config RELEASE bool default y depends !DEBUG config QUICK_LAUNCH boolean "Enable Quick Launch" default n config OPIE_NO_OVERRIDE_QT boolean "Build Opie against an unpatched version of Qt" default n 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 config EXPERIMENTAL bool "Prompt for development and/or incomplete items" default y endmenu menu "Base" choice prompt "Qpe Library Selection" default LIBQPE source library/config.in source x11/config.in endchoice source libopie/config.in source core/opie-login/config.in source core/opiealarm/config.in source core/launcher/config.in source core/qws/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/mail/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/pim/config.in menu "Today Plugins" source noncore/todayplugins/config.in source core/pim/today/plugins/config.in endmenu endmenu menu "Settings" source core/settings/config.in source noncore/settings/config.in endmenu menu "Theming" source noncore/decorations/config.in 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 "" depends on EXPERIMENTAL menu "Experimental" depends on EXPERIMENTAL source libopie2/config.in config SQL_PIM_BACKEND bool "Add SQL-Backend support (experimental)" default n help This adds the SQL-Support, using SQLite. Which database is used by the backends is defined by the file "pimaccess.conf" in the directory "Settings". There currently do exist to groups "[contact]" and "[todo]". You can select the used backend by the variable "usebackend=<type>", where <type> is "sql" or "xml". "xml" is the default ! Important: The SQLite-library "libsqlite.so" must be installed ! depends ( LIBOPIE2DB ) comment "SQL-Support needs libopie2db!" depends !( LIBOPIE2DB ) endmenu diff --git a/core/applets/batteryapplet/batteryapplet.pro b/core/applets/batteryapplet/batteryapplet.pro index c68ceb7..1bc208b 100644 --- a/core/applets/batteryapplet/batteryapplet.pro +++ b/core/applets/batteryapplet/batteryapplet.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = battery.h batterystatus.h batteryappletimpl.h SOURCES = battery.cpp batterystatus.cpp batteryappletimpl.cpp TARGET = batteryapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include .. LIBS += -lqpe -lopie VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libbatteryapplet.ts \ ../../../i18n/nl/libbatteryapplet.ts \ ../../../i18n/da/libbatteryapplet.ts \ ../../../i18n/xx/libbatteryapplet.ts \ ../../../i18n/en/libbatteryapplet.ts \ ../../../i18n/es/libbatteryapplet.ts \ ../../../i18n/fr/libbatteryapplet.ts \ ../../../i18n/hu/libbatteryapplet.ts \ ../../../i18n/ja/libbatteryapplet.ts \ ../../../i18n/ko/libbatteryapplet.ts \ ../../../i18n/no/libbatteryapplet.ts \ ../../../i18n/pl/libbatteryapplet.ts \ ../../../i18n/pt/libbatteryapplet.ts \ ../../../i18n/pt_BR/libbatteryapplet.ts \ ../../../i18n/sl/libbatteryapplet.ts \ ../../../i18n/zh_CN/libbatteryapplet.ts \ ../../../i18n/zh_TW/libbatteryapplet.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/applets diff --git a/core/applets/cardmon/cardmon.pro b/core/applets/cardmon/cardmon.pro index 3907aa4..75facde 100644 --- a/core/applets/cardmon/cardmon.pro +++ b/core/applets/cardmon/cardmon.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = cardmon.h cardmonimpl.h SOURCES = cardmon.cpp cardmonimpl.cpp TARGET = cardmonapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include ../launcher LIBS += -lqpe -lopie VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libcardmonapplet.ts \ ../../../i18n/nl/libcardmonapplet.ts \ ../../../i18n/da/libcardmonapplet.ts \ ../../../i18n/xx/libcardmonapplet.ts \ ../../../i18n/en/libcardmonapplet.ts \ ../../../i18n/es/libcardmonapplet.ts \ ../../../i18n/fr/libcardmonapplet.ts \ ../../../i18n/hu/libcardmonapplet.ts \ ../../../i18n/ja/libcardmonapplet.ts \ ../../../i18n/ko/libcardmonapplet.ts \ ../../../i18n/no/libcardmonapplet.ts \ ../../../i18n/pl/libcardmonapplet.ts \ ../../../i18n/pt/libcardmonapplet.ts \ ../../../i18n/pt_BR/libcardmonapplet.ts \ ../../../i18n/sl/libcardmonapplet.ts \ ../../../i18n/zh_CN/libcardmonapplet.ts \ ../../../i18n/zh_TW/libcardmonapplet.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/applets diff --git a/core/applets/clipboardapplet/clipboardapplet.pro b/core/applets/clipboardapplet/clipboardapplet.pro index 1e9cc4f..358d658 100644 --- a/core/applets/clipboardapplet/clipboardapplet.pro +++ b/core/applets/clipboardapplet/clipboardapplet.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = clipboard.h clipboardappletimpl.h SOURCES = clipboard.cpp clipboardappletimpl.cpp TARGET = clipboardapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libclipboardapplet.ts \ ../../../i18n/nl/libclipboardapplet.ts \ ../../../i18n/da/libclipboardapplet.ts \ ../../../i18n/xx/libclipboardapplet.ts \ ../../../i18n/en/libclipboardapplet.ts \ ../../../i18n/es/libclipboardapplet.ts \ ../../../i18n/fr/libclipboardapplet.ts \ ../../../i18n/hu/libclipboardapplet.ts \ ../../../i18n/ja/libclipboardapplet.ts \ ../../../i18n/ko/libclipboardapplet.ts \ ../../../i18n/no/libclipboardapplet.ts \ ../../../i18n/pl/libclipboardapplet.ts \ ../../../i18n/pt/libclipboardapplet.ts \ ../../../i18n/pt_BR/libclipboardapplet.ts \ ../../../i18n/sl/libclipboardapplet.ts \ ../../../i18n/zh_CN/libclipboardapplet.ts \ ../../../i18n/zh_TW/libclipboardapplet.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/applets diff --git a/core/applets/clockapplet/clockapplet.pro b/core/applets/clockapplet/clockapplet.pro index 22c7b55..88092f5 100644 --- a/core/applets/clockapplet/clockapplet.pro +++ b/core/applets/clockapplet/clockapplet.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = clock.h clockappletimpl.h SOURCES = clock.cpp clockappletimpl.cpp TARGET = clockapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include .. LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libclockapplet.ts \ ../../../i18n/nl/libclockapplet.ts \ ../../../i18n/da/libclockapplet.ts \ ../../../i18n/xx/libclockapplet.ts \ ../../../i18n/en/libclockapplet.ts \ ../../../i18n/es/libclockapplet.ts \ ../../../i18n/fr/libclockapplet.ts \ ../../../i18n/hu/libclockapplet.ts \ ../../../i18n/ja/libclockapplet.ts \ ../../../i18n/ko/libclockapplet.ts \ ../../../i18n/no/libclockapplet.ts \ ../../../i18n/pl/libclockapplet.ts \ ../../../i18n/pt/libclockapplet.ts \ ../../../i18n/pt_BR/libclockapplet.ts \ ../../../i18n/sl/libclockapplet.ts \ ../../../i18n/zh_CN/libclockapplet.ts \ ../../../i18n/zh_TW/libclockapplet.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/applets diff --git a/core/applets/homeapplet/homeapplet.pro b/core/applets/homeapplet/homeapplet.pro index ac7956b..854050f 100644 --- a/core/applets/homeapplet/homeapplet.pro +++ b/core/applets/homeapplet/homeapplet.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = home.h SOURCES = home.cpp TARGET = homeapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libhomeapplet.ts \ ../../../i18n/nl/libhomeapplet.ts \ ../../../i18n/da/libhomeapplet.ts \ ../../../i18n/xx/libhomeapplet.ts \ ../../../i18n/en/libhomeapplet.ts \ ../../../i18n/es/libhomeapplet.ts \ ../../../i18n/fr/libhomeapplet.ts \ ../../../i18n/hu/libhomeapplet.ts \ ../../../i18n/ja/libhomeapplet.ts \ ../../../i18n/ko/libhomeapplet.ts \ ../../../i18n/no/libhomeapplet.ts \ ../../../i18n/pl/libhomeapplet.ts \ ../../../i18n/pt/libhomeapplet.ts \ ../../../i18n/pt_BR/libhomeapplet.ts \ ../../../i18n/sl/libhomeapplet.ts \ ../../../i18n/zh_CN/libhomeapplet.ts \ ../../../i18n/zh_TW/libhomeapplet.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/applets diff --git a/core/applets/irdaapplet/irdaapplet.pro b/core/applets/irdaapplet/irdaapplet.pro index 56632ed..be16bad 100644 --- a/core/applets/irdaapplet/irdaapplet.pro +++ b/core/applets/irdaapplet/irdaapplet.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = irda.h irdaappletimpl.h SOURCES = irda.cpp irdaappletimpl.cpp TARGET = irdaapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libirdaapplet.ts \ ../../../i18n/nl/libirdaapplet.ts \ ../../../i18n/da/libirdaapplet.ts \ ../../../i18n/xx/libirdaapplet.ts \ ../../../i18n/en/libirdaapplet.ts \ ../../../i18n/es/libirdaapplet.ts \ ../../../i18n/fr/libirdaapplet.ts \ ../../../i18n/hu/libirdaapplet.ts \ ../../../i18n/ja/libirdaapplet.ts \ ../../../i18n/ko/libirdaapplet.ts \ ../../../i18n/no/libirdaapplet.ts \ ../../../i18n/pl/libirdaapplet.ts \ ../../../i18n/pt/libirdaapplet.ts \ ../../../i18n/pt_BR/libirdaapplet.ts \ ../../../i18n/sl/libirdaapplet.ts \ ../../../i18n/zh_CN/libirdaapplet.ts \ ../../../i18n/zh_TW/libirdaapplet.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/applets diff --git a/core/applets/logoutapplet/logoutapplet.pro b/core/applets/logoutapplet/logoutapplet.pro index a019303..7826bb3 100644 --- a/core/applets/logoutapplet/logoutapplet.pro +++ b/core/applets/logoutapplet/logoutapplet.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = logout.h SOURCES = logout.cpp TARGET = logoutapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/liblogoutapplet.ts \ ../../../i18n/nl/liblogoutapplet.ts \ ../../../i18n/da/liblogoutapplet.ts \ ../../../i18n/xx/liblogoutapplet.ts \ ../../../i18n/en/liblogoutapplet.ts \ ../../../i18n/es/liblogoutapplet.ts \ ../../../i18n/fr/liblogoutapplet.ts \ ../../../i18n/hu/liblogoutapplet.ts \ ../../../i18n/ja/liblogoutapplet.ts \ ../../../i18n/ko/liblogoutapplet.ts \ ../../../i18n/no/liblogoutapplet.ts \ ../../../i18n/pl/liblogoutapplet.ts \ ../../../i18n/pt/liblogoutapplet.ts \ ../../../i18n/pt_BR/liblogoutapplet.ts \ ../../../i18n/sl/liblogoutapplet.ts \ ../../../i18n/zh_CN/liblogoutapplet.ts \ ../../../i18n/zh_TW/liblogoutapplet.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/applets diff --git a/core/applets/restartapplet/restartapplet.pro b/core/applets/restartapplet/restartapplet.pro index bd27b0a..368a0ea 100644 --- a/core/applets/restartapplet/restartapplet.pro +++ b/core/applets/restartapplet/restartapplet.pro @@ -1,17 +1,17 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = restart.h restartappletimpl.h SOURCES = restart.cpp restartappletimpl.cpp TARGET = restartapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 MOC_DIR=opieobj OBJECTS_DIR=opieobj include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/applets diff --git a/core/applets/restartapplet2/restartapplet.pro b/core/applets/restartapplet2/restartapplet.pro index 85a3b66..12a7922 100644 --- a/core/applets/restartapplet2/restartapplet.pro +++ b/core/applets/restartapplet2/restartapplet.pro @@ -1,17 +1,17 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = restart.h SOURCES = restart.cpp TARGET = restartapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 MOC_DIR=opieobj OBJECTS_DIR=opieobj include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/applets diff --git a/core/applets/rotateapplet/rotateapplet.pro b/core/applets/rotateapplet/rotateapplet.pro index 9b39dba..2c8de8d 100644 --- a/core/applets/rotateapplet/rotateapplet.pro +++ b/core/applets/rotateapplet/rotateapplet.pro @@ -1,31 +1,31 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugn warn_on release HEADERS = rotate.h SOURCES = rotate.cpp TARGET = rotateapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/librotateapplet.ts \ ../../../i18n/nl/librotateapplet.ts \ ../../../i18n/da/librotateapplet.ts \ ../../../i18n/xx/librotateapplet.ts \ ../../../i18n/en/librotateapplet.ts \ ../../../i18n/es/librotateapplet.ts \ ../../../i18n/fr/librotateapplet.ts \ ../../../i18n/hu/librotateapplet.ts \ ../../../i18n/ja/librotateapplet.ts \ ../../../i18n/ko/librotateapplet.ts \ ../../../i18n/no/librotateapplet.ts \ ../../../i18n/pl/librotateapplet.ts \ ../../../i18n/pt/librotateapplet.ts \ ../../../i18n/pt_BR/librotateapplet.ts \ ../../../i18n/sl/librotateapplet.ts \ ../../../i18n/zh_CN/librotateapplet.ts \ ../../../i18n/zh_TW/librotateapplet.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/applets diff --git a/core/applets/screenshotapplet/screenshotapplet.pro b/core/applets/screenshotapplet/screenshotapplet.pro index fe7b299..a86eff2 100644 --- a/core/applets/screenshotapplet/screenshotapplet.pro +++ b/core/applets/screenshotapplet/screenshotapplet.pro @@ -1,35 +1,35 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = screenshot.h inputDialog.h screenshotappletimpl.h SOURCES = screenshot.cpp inputDialog.cpp screenshotappletimpl.cpp TARGET = screenshotapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 MOC_DIR=opieobj OBJECTS_DIR=opieobj TRANSLATIONS = ../../../i18n/de/libscreenshotapplet.ts \ ../../../i18n/nl/libscreenshotapplet.ts \ ../../../i18n/da/libscreenshotapplet.ts \ ../../../i18n/xx/libscreenshotapplet.ts \ ../../../i18n/en/libscreenshotapplet.ts \ ../../../i18n/es/libscreenshotapplet.ts \ ../../../i18n/fr/libscreenshotapplet.ts \ ../../../i18n/hu/libscreenshotapplet.ts \ ../../../i18n/ja/libscreenshotapplet.ts \ ../../../i18n/ko/libscreenshotapplet.ts \ ../../../i18n/no/libscreenshotapplet.ts \ ../../../i18n/pl/libscreenshotapplet.ts \ ../../../i18n/pt/libscreenshotapplet.ts \ ../../../i18n/pt_BR/libscreenshotapplet.ts \ ../../../i18n/sl/libscreenshotapplet.ts \ ../../../i18n/zh_CN/libscreenshotapplet.ts \ ../../../i18n/zh_TW/libscreenshotapplet.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/applets diff --git a/core/applets/suspendapplet/suspendapplet.pro b/core/applets/suspendapplet/suspendapplet.pro index 7635d32..f58de63 100644 --- a/core/applets/suspendapplet/suspendapplet.pro +++ b/core/applets/suspendapplet/suspendapplet.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = suspend.h SOURCES = suspend.cpp TARGET = suspendapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libsuspendapplet.ts \ ../../../i18n/nl/libsuspendapplet.ts \ ../../../i18n/da/libsuspendapplet.ts \ ../../../i18n/xx/libsuspendapplet.ts \ ../../../i18n/en/libsuspendapplet.ts \ ../../../i18n/es/libsuspendapplet.ts \ ../../../i18n/fr/libsuspendapplet.ts \ ../../../i18n/hu/libsuspendapplet.ts \ ../../../i18n/ja/libsuspendapplet.ts \ ../../../i18n/ko/libsuspendapplet.ts \ ../../../i18n/no/libsuspendapplet.ts \ ../../../i18n/pl/libsuspendapplet.ts \ ../../../i18n/pt/libsuspendapplet.ts \ ../../../i18n/pt_BR/libsuspendapplet.ts \ ../../../i18n/sl/libsuspendapplet.ts \ ../../../i18n/zh_CN/libsuspendapplet.ts \ ../../../i18n/zh_TW/libsuspendapplet.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/applets diff --git a/core/applets/vmemo/vmemo.pro b/core/applets/vmemo/vmemo.pro index 8cf1f07..43cb767 100644 --- a/core/applets/vmemo/vmemo.pro +++ b/core/applets/vmemo/vmemo.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = vmemo.h vmemoimpl.h adpcm.h SOURCES = vmemo.cpp vmemoimpl.cpp adpcm.c TARGET = vmemoapplet DESTDIR =$(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libvmemoapplet.ts \ ../../../i18n/nl/libvmemoapplet.ts \ ../../../i18n/da/libvmemoapplet.ts \ ../../../i18n/xx/libvmemoapplet.ts \ ../../../i18n/en/libvmemoapplet.ts \ ../../../i18n/es/libvmemoapplet.ts \ ../../../i18n/fr/libvmemoapplet.ts \ ../../../i18n/hu/libvmemoapplet.ts \ ../../../i18n/ja/libvmemoapplet.ts \ ../../../i18n/ko/libvmemoapplet.ts \ ../../../i18n/no/libvmemoapplet.ts \ ../../../i18n/pl/libvmemoapplet.ts \ ../../../i18n/pt/libvmemoapplet.ts \ ../../../i18n/pt_BR/libvmemoapplet.ts \ ../../../i18n/sl/libvmemoapplet.ts \ ../../../i18n/zh_CN/libvmemoapplet.ts \ ../../../i18n/zh_TW/libvmemoapplet.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/applets diff --git a/core/applets/volumeapplet/volumeapplet.pro b/core/applets/volumeapplet/volumeapplet.pro index d30567c..68d9eff 100644 --- a/core/applets/volumeapplet/volumeapplet.pro +++ b/core/applets/volumeapplet/volumeapplet.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = volume.h volumeappletimpl.h oledbox.h SOURCES = volume.cpp volumeappletimpl.cpp oledbox.cpp TARGET = volumeapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libvolumeapplet.ts \ ../../../i18n/nl/libvolumeapplet.ts \ ../../../i18n/da/libvolumeapplet.ts \ ../../../i18n/xx/libvolumeapplet.ts \ ../../../i18n/en/libvolumeapplet.ts \ ../../../i18n/es/libvolumeapplet.ts \ ../../../i18n/fr/libvolumeapplet.ts \ ../../../i18n/hu/libvolumeapplet.ts \ ../../../i18n/ja/libvolumeapplet.ts \ ../../../i18n/ko/libvolumeapplet.ts \ ../../../i18n/no/libvolumeapplet.ts \ ../../../i18n/pl/libvolumeapplet.ts \ ../../../i18n/pt/libvolumeapplet.ts \ ../../../i18n/pt_BR/libvolumeapplet.ts \ ../../../i18n/sl/libvolumeapplet.ts \ ../../../i18n/zh_CN/libvolumeapplet.ts \ ../../../i18n/zh_TW/libvolumeapplet.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/applets diff --git a/core/launcher/applauncher.cpp b/core/launcher/applauncher.cpp index d6f93da..0ac043b 100644 --- a/core/launcher/applauncher.cpp +++ b/core/launcher/applauncher.cpp @@ -165,550 +165,554 @@ void AppLauncher::received(const QCString& msg, const QByteArray& data) QDataStream stream( data, IO_ReadOnly ); if ( msg == "execute(QString)" ) { QString t; stream >> t; if ( !executeBuiltin( t, QString::null ) ) execute(t, QString::null); } else if ( msg == "execute(QString,QString)" ) { QString t,d; stream >> t >> d; if ( !executeBuiltin( t, d ) ) execute( t, d ); } else if ( msg == "processQCop(QString)" ) { // from QPE/Server QString t; stream >> t; if ( !executeBuiltin( t, QString::null ) ) execute( t, QString::null, TRUE); } else if ( msg == "raise(QString)" ) { QString appName; stream >> appName; if ( !executeBuiltin( appName, QString::null ) ) { if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) { //qDebug( "Raising: %s", appName.latin1() ); QCString channel = "QPE/Application/"; channel += appName.latin1(); // Need to lock it to avoid race conditions with QPEApplication::processQCopFile QFile f("/tmp/qcop-msg-" + appName); if ( f.open(IO_WriteOnly | IO_Append) ) { #ifndef Q_OS_WIN32 flock(f.handle(), LOCK_EX); #endif QDataStream ds(&f); QByteArray b; QDataStream bstream(b, IO_WriteOnly); ds << channel << QCString("raise()") << b; f.flush(); #ifndef Q_OS_WIN32 flock(f.handle(), LOCK_UN); #endif f.close(); } bool alreadyRunning = isRunning( appName ); if ( execute(appName, QString::null) ) { int id = startTimer(RAISE_TIMEOUT_MS + alreadyRunning?2000:0); waitingHeartbeat.insert( appName, id ); } } } } else if ( msg == "sendRunningApps()" ) { QStringList apps; QMap<int,QString>::Iterator it; for( it = runningApps.begin(); it != runningApps.end(); ++it ) apps.append( *it ); QCopEnvelope e( "QPE/Desktop", "runningApps(QStringList)" ); e << apps; } else if ( msg == "appRaised(QString)" ) { QString appName; stream >> appName; qDebug("Got a heartbeat from %s", appName.latin1()); QMap<QString,int>::Iterator it = waitingHeartbeat.find(appName); if ( it != waitingHeartbeat.end() ) { killTimer( *it ); waitingHeartbeat.remove(it); } // Check to make sure we're not waiting on user input... if ( appKillerBox && appName == appKillerName ) { // If we are, we kill the dialog box, and the code waiting on the result // will clean us up (basically the user said "no"). delete appKillerBox; appKillerBox = 0; appKillerName = QString::null; } } } void AppLauncher::signalHandler(int) { #ifndef Q_OS_WIN32 int status; pid_t pid = waitpid(-1, &status, WNOHANG); /* if (pid == 0 || &status == 0 ) { qDebug("hmm, could not get return value from signal"); } */ QApplication::postEvent(appLauncherPtr, new AppStoppedEvent(pid, status) ); #else qDebug("Unhandled signal see by AppLauncher::signalHandler(int)"); #endif } bool AppLauncher::event(QEvent *e) { if ( e->type() == appStopEventID ) { AppStoppedEvent *ae = (AppStoppedEvent *) e; sigStopped(ae->pid(), ae->status() ); return TRUE; } return QObject::event(e); } void AppLauncher::timerEvent( QTimerEvent *e ) { int id = e->timerId(); QMap<QString,int>::Iterator it; for ( it = waitingHeartbeat.begin(); it != waitingHeartbeat.end(); ++it ) { if ( *it == id ) { if ( appKillerBox ) // we're already dealing with one return; appKillerName = it.key(); killTimer( id ); waitingHeartbeat.remove( it ); // qDebug("Checking in on %s", appKillerName.latin1()); // We store this incase the application responds while we're // waiting for user input so we know not to delete ourselves. appKillerBox = new QMessageBox(tr("Application Problem"), tr("<p>%1 is not responding.</p>").arg(appKillerName) + tr("<p>Would you like to force the application to exit?</p>"), QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No | QMessageBox::Default, QMessageBox::NoButton); if (appKillerBox->exec() == QMessageBox::Yes) { // qDebug("Killing the app!!! Bwuhahahaha!"); int pid = pidForName(appKillerName); if ( pid > 0 ) kill( pid ); } appKillerName = QString::null; delete appKillerBox; appKillerBox = 0; return; } } QObject::timerEvent( e ); } #ifndef Q_OS_WIN32 void AppLauncher::sigStopped(int sigPid, int sigStatus) { int exitStatus = 0; bool crashed = WIFSIGNALED(sigStatus); if ( !crashed ) { if ( WIFEXITED(sigStatus) ) exitStatus = WEXITSTATUS(sigStatus); } else { exitStatus = WTERMSIG(sigStatus); } QMap<int,QString>::Iterator it = runningApps.find( sigPid ); if ( it == runningApps.end() ) { if ( sigPid == qlPid ) { qDebug( "quicklauncher stopped" ); qlPid = 0; qlReady = FALSE; QFile::remove("/tmp/qcop-msg-quicklauncher" ); QTimer::singleShot( 2000, this, SLOT(createQuickLauncher()) ); } /* if ( sigPid == -1 ) qDebug("non-qtopia application exited (disregarded)"); else qDebug("==== no pid matching %d in list, definite bug", sigPid); */ return; } QString appName = *it; runningApps.remove(it); QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName); if ( hbit != waitingHeartbeat.end() ) { killTimer( *hbit ); waitingHeartbeat.remove( hbit ); } if ( appName == appKillerName ) { appKillerName = QString::null; delete appKillerBox; appKillerBox = 0; } /* we must disable preload for an app that crashes as the system logic relies on preloaded apps actually being loaded. If eg. the crash happened in the constructor, we can't automatically reload the app (withouth some timeout value for eg. 3 tries (which I think is a bad solution) */ bool preloadDisabled = FALSE; if ( !DocumentList::appLnkSet ) return; const AppLnk* app = DocumentList::appLnkSet->findExec( appName ); if ( !app ) return; // QCop messages processed to slow? if ( crashed && app->isPreloaded() ) { Config cfg("Launcher"); cfg.setGroup("Preload"); QStringList apps = cfg.readListEntry("Apps",','); QString exe = app->exec(); apps.remove(exe); cfg.writeEntry("Apps",apps,','); preloadDisabled = TRUE; } // clean up if ( exitStatus ) { QCopEnvelope e("QPE/System", "notBusy(QString)"); e << app->exec(); } /* // debug info for (it = runningApps.begin(); it != runningApps.end(); ++it) { qDebug("running according to internal list: %s, with pid %d", (*it).data(), it.key() ); } */ #ifdef QTOPIA_PROGRAM_MONITOR if ( crashed ) { QString sig; switch( exitStatus ) { case SIGABRT: sig = "SIGABRT"; break; case SIGALRM: sig = "SIGALRM"; break; case SIGBUS: sig = "SIGBUS"; break; case SIGFPE: sig = "SIGFPE"; break; case SIGHUP: sig = "SIGHUP"; break; case SIGILL: sig = "SIGILL"; break; case SIGKILL: sig = "SIGKILL"; break; case SIGPIPE: sig = "SIGPIPE"; break; case SIGQUIT: sig = "SIGQUIT"; break; case SIGSEGV: sig = "SIGSEGV"; break; case SIGTERM: sig = "SIGTERM"; break; case SIGTRAP: sig = "SIGTRAP"; break; default: sig = QString("Unkown %1").arg(exitStatus); } if ( preloadDisabled ) sig += tr("<qt><p>Fast loading has been disabled for this application. Tap and hold the application icon to reenable it.</qt>"); QString str = tr("<qt><b>%1</b> was terminated due to signal code %2</qt>").arg( app->name() ).arg( sig ); QMessageBox::information(0, tr("Application terminated"), str ); } else { if ( exitStatus == 255 ) { //could not find app (because global returns -1) QMessageBox::information(0, tr("Application not found"), tr("<qt>Could not locate application <b>%1</b></qt>").arg( app->exec() ) ); } else { QFileInfo fi(Opie::Global::tempDir() + "qcop-msg-" + appName); if ( fi.exists() && fi.size() ) { emit terminated(sigPid, appName); qWarning("Re executing obmitted for %s", appName.latin1() ); // execute( appName, QString::null ); return; } } } #endif emit terminated(sigPid, appName); } #else void AppLauncher::sigStopped(int sigPid, int sigStatus) { qDebug("Unhandled signal : AppLauncher::sigStopped(int sigPid, int sigStatus)"); } #endif // Q_OS_WIN32 bool AppLauncher::isRunning(const QString &app) { for (QMap<int,QString>::ConstIterator it = runningApps.begin(); it != runningApps.end(); ++it) { if ( *it == app ) { #ifdef Q_OS_UNIX pid_t t = ::__getpgid( it.key() ); if ( t == -1 ) { qDebug("appLauncher bug, %s believed running, but pid %d is not existing", app.data(), it.key() ); runningApps.remove( it.key() ); return FALSE; } #endif return TRUE; } } return FALSE; } bool AppLauncher::executeBuiltin(const QString &c, const QString &document) { Global::Command* builtin = Opie::Global::builtinCommands(); QGuardedPtr<QWidget> *running = Opie::Global::builtinRunning(); // Attempt to execute the app using a builtin class for the app if (builtin) { for (int i = 0; builtin[i].file; i++) { if ( builtin[i].file == c ) { if ( running[i] ) { if ( !document.isNull() && builtin[i].documentary ) Global::setDocument(running[i], document); running[i]->raise(); running[i]->show(); running[i]->setActiveWindow(); } else { running[i] = builtin[i].func( builtin[i].maximized ); } #ifndef QT_NO_COP QCopEnvelope e("QPE/System", "notBusy(QString)" ); e << c; // that was quick ;-) #endif return TRUE; } } } // Convert the command line in to a list of arguments QStringList list = QStringList::split(QRegExp(" *"),c); QString ap=list[0]; if ( ap == "suspend" ) { // No tr QWSServer::processKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); return TRUE; } return FALSE; } bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise) { qWarning("AppLauncher::execute"); // Convert the command line in to a list of arguments QStringList list = QStringList::split(QRegExp(" *"),c); if ( !docParam.isEmpty() ) list.append( docParam ); QString appName = list[0]; if ( isRunning(appName) ) { QCString channel = "QPE/Application/"; channel += appName.latin1(); // Need to lock it to avoid race conditions with QPEApplication::processQCopFile QFile f(Opie::Global::tempDir() + "qcop-msg-" + appName); if ( !noRaise && f.open(IO_WriteOnly | IO_Append) ) { #ifndef Q_OS_WIN32 flock(f.handle(), LOCK_EX); #endif QDataStream ds(&f); QByteArray b; QDataStream bstream(b, IO_WriteOnly); if ( !f.size() ) { ds << channel << QCString("raise()") << b; if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) { int id = startTimer(RAISE_TIMEOUT_MS); waitingHeartbeat.insert( appName, id ); } } if ( !docParam.isEmpty() ) { bstream << docParam; ds << channel << QCString("setDocument(QString)") << b; } f.flush(); #ifndef Q_OS_WIN32 flock(f.handle(), LOCK_UN); #endif f.close(); } if ( QCopChannel::isRegistered(channel) ) // avoid unnecessary warnings QCopChannel::send(channel,"QPEProcessQCop()"); return TRUE; } #ifdef QT_NO_QWS_MULTIPROCESS QMessageBox::warning( 0, tr("Error"), tr("<qt>Could not find the application %1</qt>").arg(c), tr("OK"), 0, 0, 0, 1 ); #else QStrList slist; unsigned j; for ( j = 0; j < list.count(); j++ ) slist.append( list[j].utf8() ); const char **args = new const char *[slist.count() + 1]; for ( j = 0; j < slist.count(); j++ ) args[j] = slist.at(j); args[j] = NULL; #ifndef Q_OS_WIN32 +#ifdef Q_OS_MACX + if ( qlPid && qlReady && QFile::exists( QPEApplication::qpeDir()+"plugins/application/lib"+args[0] + ".dylib" ) ) { +#else if ( qlPid && qlReady && QFile::exists( QPEApplication::qpeDir()+"plugins/application/lib"+args[0] + ".so" ) ) { +#endif /* Q_OS_MACX */ qDebug( "Quick launching: %s", args[0] ); if ( getuid() == 0 ) setpriority( PRIO_PROCESS, qlPid, 0 ); QCString qlch("QPE/QuickLauncher-"); qlch += QString::number(qlPid); QCopEnvelope env( qlch, "execute(QStrList)" ); env << slist; runningApps[qlPid] = QString(args[0]); emit launched(qlPid, QString(args[0])); QCopEnvelope e("QPE/System", "busy()"); qlPid = 0; qlReady = FALSE; QTimer::singleShot( getuid() == 0 ? 800 : 1500, this, SLOT(createQuickLauncher()) ); } else { int pid = ::vfork(); if ( !pid ) { for ( int fd = 3; fd < 100; fd++ ) ::close( fd ); ::setpgid( ::getpid(), ::getppid() ); // Try bindir first, so that foo/bar works too ::execv( QPEApplication::qpeDir()+"bin/"+args[0], (char * const *)args ); ::execvp( args[0], (char * const *)args ); _exit( -1 ); } runningApps[pid] = QString(args[0]); emit launched(pid, QString(args[0])); QCopEnvelope e("QPE/System", "busy()"); } #else QProcess *proc = new QProcess(this); if (proc){ for (int i=0; i < slist.count(); i++) proc->addArgument(args[i]); connect(proc, SIGNAL(processExited()), this, SLOT(processExited())); if (!proc->start()){ qDebug("Unable to start application %s", args[0]); }else{ PROCESS_INFORMATION *procInfo = (PROCESS_INFORMATION *)proc->processIdentifier(); if (procInfo){ DWORD pid = procInfo->dwProcessId; runningApps[pid] = QString(args[0]); runningAppsProc.append(proc); emit launched(pid, QString(args[0])); QCopEnvelope e("QPE/System", "busy()"); }else{ qDebug("Unable to read process inforation #1 for %s", args[0]); } } }else{ qDebug("Unable to create process for application %s", args[0]); return FALSE; } #endif #endif //QT_NO_QWS_MULTIPROCESS delete [] args; return TRUE; } void AppLauncher::kill( int pid ) { #ifndef Q_OS_WIN32 ::kill( pid, SIGTERM ); #else for ( QProcess *proc = runningAppsProc.first(); proc; proc = runningAppsProc.next() ) { if ( proc->processIdentifier() == pid ) { proc->kill(); break; } } #endif } int AppLauncher::pidForName( const QString &appName ) { int pid = -1; QMap<int, QString>::Iterator it; for (it = runningApps.begin(); it!= runningApps.end(); ++it) { if (*it == appName) { pid = it.key(); break; } } return pid; } void AppLauncher::createQuickLauncher() { static bool disabled = FALSE; if (disabled) return; qlReady = FALSE; qlPid = ::vfork(); if ( !qlPid ) { char **args = new char *[2]; args[0] = "quicklauncher"; args[1] = 0; for ( int fd = 3; fd < 100; fd++ ) ::close( fd ); ::setpgid( ::getpid(), ::getppid() ); // Try bindir first, so that foo/bar works too setenv( "LD_BIND_NOW", "1", 1 ); ::execv( QPEApplication::qpeDir()+"bin/quicklauncher", args ); ::execvp( "quicklauncher", args ); delete []args; disabled = TRUE; _exit( -1 ); } else if ( qlPid == -1 ) { qlPid = 0; } else { if ( getuid() == 0 ) setpriority( PRIO_PROCESS, qlPid, 19 ); } } // Used only by Win32 void AppLauncher::processExited() { #ifdef Q_OS_WIN32 qDebug("AppLauncher::processExited()"); bool found = FALSE; QProcess *proc = (QProcess *) sender(); if (!proc){ qDebug("Interanl error NULL proc"); return; } QString appName = proc->arguments()[0]; qDebug("Removing application %s", appName.latin1()); runningAppsProc.remove(proc); QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName); if ( hbit != waitingHeartbeat.end() ) { killTimer( *hbit ); waitingHeartbeat.remove( hbit ); } if ( appName == appKillerName ) { appKillerName = QString::null; delete appKillerBox; appKillerBox = 0; } // Search for the app to find its PID QMap<int, QString>::Iterator it; for (it = runningApps.begin(); it!= runningApps.end(); ++it){ if (it.data() == appName){ found = TRUE; break; } } if (found){ emit terminated(it.key(), it.data()); runningApps.remove(it.key()); }else{ qDebug("Internal error application %s not listed as running", appName.latin1()); } #endif } diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp index 8f3e812..62e316c 100644 --- a/core/launcher/inputmethods.cpp +++ b/core/launcher/inputmethods.cpp @@ -1,614 +1,618 @@ /********************************************************************** ** 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. ** **********************************************************************/ #define QTOPIA_INTERNAL_LANGLIST #include "inputmethods.h" #include <qtopia/config.h> #include <qtopia/qpeapplication.h> #include <qtopia/inputmethodinterface.h> #include <qtopia/global.h> #include <qpopupmenu.h> #include <qpushbutton.h> #include <qtoolbutton.h> #include <qwidgetstack.h> #include <qwidget.h> #include <qlayout.h> #include <qtimer.h> #include <qdir.h> #include <stdlib.h> #include <qtranslator.h> #include <qtl.h> #ifdef Q_WS_QWS #include <qwindowsystem_qws.h> #include <qwsevent_qws.h> #include <qcopchannel_qws.h> #endif /* ### SingleFloppy if someone is interested? */ #if 0 #ifdef QT_NO_COMPONENT #include "../plugins/inputmethods/handwriting/handwritingimpl.h" #include "../plugins/inputmethods/keyboard/keyboardimpl.h" #include "../3rdparty/plugins/inputmethods/pickboard/pickboardimpl.h" #endif #endif /* XPM */ static const char * tri_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", ".........", ".........", "....a....", "...aaa...", "..aaaaa..", ".aaaaaaa.", ".........", "........."}; int InputMethod::operator <(const InputMethod& o) const { return name() < o.name(); } int InputMethod::operator >(const InputMethod& o) const { return name() > o.name(); } int InputMethod::operator <=(const InputMethod& o) const { return name() <= o.name(); } /* Slightly hacky: We use WStyle_Tool as a flag to say "this widget belongs to the IM system, so clicking it should not cause a reset". */ class IMToolButton : public QToolButton { public: IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent ) { setWFlags( WStyle_Tool ); } }; InputMethods::InputMethods( QWidget *parent ) : QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ), mkeyboard(0), imethod(0) { Config cfg( "Launcher" ); cfg.setGroup( "InputMethods" ); inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader | QWidget::WStyle_Tool; inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? QWidget::WStyle_DialogBorder : 0; inputWidgetWidth = cfg.readNumEntry( "Width", 100 ); setBackgroundMode( PaletteBackground ); QHBoxLayout *hbox = new QHBoxLayout( this ); kbdButton = new IMToolButton( this); kbdButton->setFocusPolicy(NoFocus); kbdButton->setToggleButton( TRUE ); if (parent->sizeHint().height() > 0) kbdButton->setFixedHeight( parent->sizeHint().height() ); kbdButton->setFixedWidth( 32 ); kbdButton->setAutoRaise( TRUE ); kbdButton->setUsesBigPixmap( TRUE ); hbox->addWidget( kbdButton ); connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) ); kbdChoice = new IMToolButton( this ); kbdChoice->setFocusPolicy(NoFocus); kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); if (parent->sizeHint().height() > 0) kbdChoice->setFixedHeight( parent->sizeHint().height() ); kbdChoice->setFixedWidth( 13 ); kbdChoice->setAutoRaise( TRUE ); hbox->addWidget( kbdChoice ); connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) ); connect( (QPEApplication*)qApp, SIGNAL(clientMoused()), this, SLOT(resetStates()) ); imButton = new QWidgetStack( this ); // later a widget stack imButton->setFocusPolicy(NoFocus); if (parent->sizeHint().height() > 0) imButton->setFixedHeight( parent->sizeHint().height() ); hbox->addWidget(imButton); imChoice = new QToolButton( this ); imChoice->setFocusPolicy(NoFocus); imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); if (parent->sizeHint().height() > 0) imChoice->setFixedHeight( parent->sizeHint().height() ); imChoice->setFixedWidth( 13 ); imChoice->setAutoRaise( TRUE ); hbox->addWidget( imChoice ); connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) ); loadInputMethods(); QCopChannel *channel = new QCopChannel( "QPE/IME", this ); connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(qcopReceive(const QCString&, const QByteArray&)) ); } InputMethods::~InputMethods() { Config cfg("qpe"); cfg.setGroup("InputMethod"); if (imethod) cfg.writeEntry("im", imethod->name() ); if (mkeyboard) cfg.writeEntry("current", mkeyboard->name() ); unloadInputMethods(); } void InputMethods::hideInputMethod() { kbdButton->setOn( FALSE ); } void InputMethods::showInputMethod() { kbdButton->setOn( TRUE ); } void InputMethods::showInputMethod(const QString& name) { int i = 0; QValueList<InputMethod>::Iterator it; InputMethod *im = 0; for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { QString lname = (*it).libName.mid((*it).libName.findRev('/') + 1); if ( (*it).name() == name || lname == name ) { im = &(*it); break; } } if ( im ) chooseKeyboard(im); } void InputMethods::resetStates() { if ( mkeyboard && !mkeyboard->newIM ) mkeyboard->interface->resetState(); } QRect InputMethods::inputRect() const { if ( !mkeyboard || !mkeyboard->widget || !mkeyboard->widget->isVisible() ) return QRect(); else return mkeyboard->widget->geometry(); } void InputMethods::unloadInputMethods() { unloadMethod( inputMethodList ); unloadMethod( inputModifierList ); inputMethodList.clear(); inputModifierList.clear(); } void InputMethods::unloadMethod( QValueList<InputMethod>& list ) { QValueList<InputMethod>::Iterator it; for (it = list.begin(); it != list.end(); ++it ) (*it).releaseInterface(); } QStringList InputMethods::plugins()const { QString path = QPEApplication::qpeDir() + "/plugins/inputmethods"; +#ifdef Q_OS_MACX + QDir dir( path, "lib*.dylib" ); +#else QDir dir( path, "lib*.so" ); +#endif /* Q_OS_MACX */ return dir.entryList(); } void InputMethods::installTranslator( const QString& type ) { QStringList langs = Global::languageList(); QStringList::ConstIterator lit; for ( lit= langs.begin(); lit!=langs.end(); ++lit) { QString lang = *lit; QTranslator * trans = new QTranslator(qApp); QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; if ( trans->load( tfn )) qApp->installTranslator( trans ); else delete trans; } } void InputMethods::setPreferedHandlers() { Config cfg("qpe"); cfg.setGroup("InputMethod"); QString current = cfg.readEntry("current"); QString im = cfg.readEntry("im"); QValueList<InputMethod>::Iterator it; if (!inputModifierList.isEmpty() && !im.isEmpty() ) { for (it = inputModifierList.begin(); it != inputModifierList.end(); ++it ) if ( (*it).name() == im ) { imethod = &(*it); break; } } if (!inputMethodList.isEmpty() && !current.isEmpty() ) { for (it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) if ( (*it).name() == current ) { qWarning("preferred keyboard is %s", current.latin1() ); mkeyboard = &(*it); kbdButton->setPixmap( *mkeyboard->icon() ); break; } } } void InputMethods::loadInputMethods() { #ifndef QT_NO_COMPONENT hideInputMethod(); mkeyboard = 0; unloadInputMethods(); QString path = QPEApplication::qpeDir() + "/plugins/inputmethods"; QStringList list = plugins(); QStringList::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { InputMethodInterface *iface = 0; ExtInputMethodInterface *eface = 0; QLibrary *lib = new QLibrary( path + "/" + *it ); if ( lib->queryInterface( IID_InputMethod, (QUnknownInterface**)&iface ) == QS_OK ) { InputMethod input; input.newIM = FALSE; input.library = lib; input.libName = *it; input.interface = iface; input.widget = input.interface->inputMethod( 0, inputWidgetStyle ); input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) ); inputMethodList.append( input ); } else if ( lib->queryInterface( IID_ExtInputMethod, (QUnknownInterface**)&eface ) == QS_OK ) { InputMethod input; input.newIM = TRUE; input.library = lib; input.libName = *it; input.extInterface = eface; input.widget = input.extInterface->keyboardWidget( 0, inputWidgetStyle ); // may be either a simple, or advanced. if (input.widget) { //qDebug("its a keyboard"); inputMethodList.append( input ); } else { //qDebug("its a real im"); input.widget = input.extInterface->statusWidget( 0, 0 ); if (input.widget) { //qDebug("blah"); inputModifierList.append( input ); imButton->addWidget(input.widget, inputModifierList.count()); } } }else{ delete lib; lib = 0l; } installTranslator( (*it).left( (*it).find(".") ) ); } qHeapSort( inputMethodList ); #endif /* killed BUILT in cause they would not compile */ QWSServer::setCurrentInputMethod( 0 ); /* set the prefered IM + handler */ setPreferedHandlers(); if ( !inputModifierList.isEmpty() ) { if (!imethod) imethod = &inputModifierList[0]; imButton->raiseWidget(imethod->widget); QWSServer::setCurrentInputMethod( imethod->extInterface->inputMethod() ); } else { imethod = 0; } // we need to update keyboards afterwards, as some of them may not be compatible with // the current input method updateKeyboards(imethod); if ( !inputModifierList.isEmpty() ) imButton->show(); else imButton->hide(); if ( inputModifierList.count() > 1 ) imChoice->show(); else imChoice->hide(); } void InputMethods::chooseKbd() { QPopupMenu pop( this ); pop.setFocusPolicy( NoFocus ); //don't reset IM QString imname; if (imethod) imname = imethod->libName.mid(imethod->libName.findRev('/') + 1); int i = 0; int firstDepKbd = 0; QValueList<InputMethod>::Iterator it; for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { // add empty new items, all old items. if (!(*it).newIM || (*it).extInterface->compatible().count() == 0 ) { pop.insertItem( (*it).name(), i, firstDepKbd); if ( mkeyboard == &(*it) ) pop.setItemChecked( i, TRUE ); firstDepKbd++; } else if ( (*it).extInterface->compatible().contains(imname)) { // check if we need to insert a sep. if (firstDepKbd == i) pop.insertSeparator(); pop.insertItem( (*it).name(), i, -1); if ( mkeyboard == &(*it) ) pop.setItemChecked( i, TRUE ); } } QPoint pt = mapToGlobal(kbdChoice->geometry().topRight()); QSize s = pop.sizeHint(); pt.ry() -= s.height(); pt.rx() -= s.width(); i = pop.exec( pt ); if ( i == -1 ) return; InputMethod *im = &inputMethodList[i]; chooseKeyboard(im); } void InputMethods::chooseIm() { QPopupMenu pop( this ); int i = 0; QValueList<InputMethod>::Iterator it; for ( it = inputModifierList.begin(); it != inputModifierList.end(); ++it, i++ ) { pop.insertItem( (*it).name(), i ); if ( imethod == &(*it) ) pop.setItemChecked( i, TRUE ); } QPoint pt = mapToGlobal(imChoice->geometry().topRight()); QSize s = pop.sizeHint(); pt.ry() -= s.height(); pt.rx() -= s.width(); i = pop.exec( pt ); if ( i == -1 ) return; InputMethod *im = &inputModifierList[i]; chooseMethod(im); } void InputMethods::chooseKeyboard(InputMethod* im) { if ( im != mkeyboard ) { if ( mkeyboard && mkeyboard->widget->isVisible() ) mkeyboard->widget->hide(); mkeyboard = im; kbdButton->setPixmap( *mkeyboard->icon() ); } if ( !kbdButton->isOn() ) kbdButton->setOn( TRUE ); else showKbd( TRUE ); } static bool keyboardCompatible(InputMethod *keyb, const QString &imname ) { if ( !keyb || !keyb->newIM || !keyb->extInterface->compatible().count() ) return TRUE; if ( keyb->extInterface->compatible().contains(imname) ) return TRUE; return FALSE; } // Updates the display of the soft keyboards available to the current input method void InputMethods::updateKeyboards(InputMethod *im ) { uint count; if ( im ) { QString imname = im->libName.mid(im->libName.findRev('/') + 1); if ( mkeyboard && !keyboardCompatible(mkeyboard, imname) ) { kbdButton->setOn( FALSE ); showKbd( FALSE ); mkeyboard = 0; } count = 0; QValueList<InputMethod>::Iterator it; for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) { if ( keyboardCompatible( &(*it), imname ) ) { if ( !mkeyboard ) { mkeyboard = &(*it); kbdButton->setPixmap( *mkeyboard->icon() ); } count++; } } } else { count = inputMethodList.count(); if ( count && !mkeyboard ) { mkeyboard = &inputMethodList[0]; kbdButton->setPixmap( *mkeyboard->icon() ); } else if (!count){ mkeyboard = 0; //might be redundant } } if ( count > 1 ) kbdChoice->show(); else kbdChoice->hide(); if ( count ) kbdButton->show(); else kbdButton->hide(); } void InputMethods::chooseMethod(InputMethod* im) { if ( im != imethod ) { updateKeyboards( im ); Config cfg("qpe"); cfg.setGroup("InputMethod"); if (im ) cfg.writeEntry("im", im->name() ); if (mkeyboard) cfg.writeEntry("current", mkeyboard->name() ); QWSServer::setCurrentInputMethod( 0 ); imethod = im; if ( imethod && imethod->newIM ) QWSServer::setCurrentInputMethod( imethod->extInterface->inputMethod() ); else QWSServer::setCurrentInputMethod( 0 ); if ( im ) imButton->raiseWidget(im->widget); else imButton->hide(); //### good UI? make sure it is shown again! } } void InputMethods::qcopReceive( const QCString &msg, const QByteArray &data ) { if ( imethod && imethod->newIM ) imethod->extInterface->qcopReceive( msg, data ); } void InputMethods::showKbd( bool on ) { if ( !mkeyboard ) return; if ( on ) { mkeyboard->resetState(); int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); int width = qApp->desktop()->width() * (inputWidgetWidth*0.01); int left = 0; int top = mapToGlobal( QPoint() ).y() - height; if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) { qDebug( "InputMethods: reading geometry." ); Config cfg( "Launcher" ); cfg.setGroup( "InputMethods" ); int l = cfg.readNumEntry( "absX", -1 ); int t = cfg.readNumEntry( "absY", -1 ); int w = cfg.readNumEntry( "absWidth", -1 ); int h = cfg.readNumEntry( "absHeight", -1 ); if ( l > -1 && t > -1 && w > -1 && h > -1 ) { qDebug( "InputMethods: config values ( %d, %d, %d, %d ) are ok.", l, t, w, h ); left = l; top = t; width = w; height = h; } else { qDebug( "InputMethods: config values are new or not ok." ); } } else { qDebug( "InputMethods: no floating selected." ); } mkeyboard->widget->resize( width, height ); mkeyboard->widget->move( left, top ); mkeyboard->widget->show(); mkeyboard->widget->installEventFilter( this ); } else { if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) { QPoint pos = mkeyboard->widget->pos(); QSize siz = mkeyboard->widget->size(); qDebug( "InputMethods: saving geometry." ); Config cfg( "Launcher" ); cfg.setGroup( "InputMethods" ); cfg.writeEntry( "absX", pos.x() ); cfg.writeEntry( "absY", pos.y() ); cfg.writeEntry( "absWidth", siz.width() ); cfg.writeEntry( "absHeight", siz.height() ); cfg.write(); mkeyboard->widget->hide(); mkeyboard->widget->removeEventFilter( this ); } } emit inputToggled( on ); } bool InputMethods::shown() const { return mkeyboard && mkeyboard->widget->isVisible(); } QString InputMethods::currentShown() const { return mkeyboard && mkeyboard->widget->isVisible() ? mkeyboard->name() : QString::null; } void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool press, bool repeat ) { #if defined(Q_WS_QWS) QWSServer::sendKeyEvent( unicode, scancode, mod, press, repeat ); #endif } diff --git a/core/launcher/irserver.cpp b/core/launcher/irserver.cpp index 579c78c..63f8d05 100644 --- a/core/launcher/irserver.cpp +++ b/core/launcher/irserver.cpp @@ -1,73 +1,77 @@ /********************************************************************** ** 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 "irserver.h" #include <qtopia/qlibrary.h> #include <qtopia/qpeapplication.h> #include <qtranslator.h> #include "obexinterface.h" #include <qdir.h> IrServer::IrServer( QObject *parent, const char *name ) : QObject( parent, name ), obexIface(0) { lib = 0; obexIface = 0; QString path = QPEApplication::qpeDir() + "/plugins/obex/"; +#ifdef Q_OS_MACX + QDir dir( path, "lib*.dylib" ); +#else QDir dir( path, "lib*.so" ); +#endif /* Q_OS_MACX */ QStringList list = dir.entryList(); QStringList::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { QLibrary *trylib = new QLibrary( path + *it ); //qDebug("trying lib %s", (path + (*it)).latin1() ); if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&obexIface ) == QS_OK ) { lib = trylib; //qDebug("found obex lib" ); QString lang = getenv( "LANG" ); QTranslator * trans = new QTranslator(qApp); QString type = (*it).left( (*it).find(".") ); QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; //qDebug("tr fpr obex: %s", tfn.latin1() ); if ( trans->load( tfn )) qApp->installTranslator( trans ); else delete trans; break; } else { delete lib; } } if ( !lib ) qDebug("could not load IR plugin" ); } IrServer::~IrServer() { if ( obexIface ) obexIface->release(); delete lib; } diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 74965df..5416d33 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp @@ -1,354 +1,356 @@ /********************************************************************** ** 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 QTOPIA_INTERNAL_FILEOPERATIONS #define QTOPIA_INTERNAL_FILEOPERATIONS #endif #include "server.h" #include "serverapp.h" #include "taskbar.h" #include "stabmon.h" #include "launcher.h" #include "firstuse.h" #include "launcherglobal.h" #include <qtopia/qpeapplication.h> #include <qtopia/network.h> #include <qtopia/config.h> #include <qtopia/custom.h> #include <qtopia/global.h> #include <qfile.h> #include <qdir.h> #ifdef QWS #include <qwindowsystem_qws.h> #include <qtopia/qcopenvelope_qws.h> #endif #include <qtopia/alarmserver.h> #include <stdlib.h> #include <stdio.h> #include <signal.h> #ifndef Q_OS_WIN32 #include <unistd.h> #else #include <process.h> #endif #include "calibrate.h" #ifdef QT_QWS_LOGIN #include "../login/qdmdialogimpl.h" #endif #ifdef Q_WS_QWS #include <qkeyboard_qws.h> #endif #include <qmessagebox.h> #include <opie/odevice.h> using namespace Opie; static void cleanup() { QDir dir( Opie::Global::tempDir(), "qcop-msg-*" ); QStringList stale = dir.entryList(); QStringList::Iterator it; for ( it = stale.begin(); it != stale.end(); ++it ) { dir.remove( *it ); } } static void refreshTimeZoneConfig() { /* ### FIXME timezone handling */ #if 0 // We need to help WorldTime in setting up its configuration for // the current translation // BEGIN no tr const char *defaultTz[] = { "America/New_York", "America/Los_Angeles", "Europe/Oslo", "Asia/Tokyo", "Asia/Hong_Kong", "Australia/Brisbane", 0 }; // END no tr TimeZone curZone; QString zoneID; int zoneIndex; Config cfg = Config( "WorldTime" ); cfg.setGroup( "TimeZones" ); if (!cfg.hasKey( "Zone0" )){ // We have no existing timezones use the defaults which are untranslated strings QString currTz = TimeZone::current().id(); QStringList zoneDefaults; zoneDefaults.append( currTz ); for ( int i = 0; defaultTz[i] && zoneDefaults.count() < 6; i++ ) { if ( defaultTz[i] != currTz ) zoneDefaults.append( defaultTz[i] ); } zoneIndex = 0; for (QStringList::Iterator it = zoneDefaults.begin(); it != zoneDefaults.end() ; ++it){ cfg.writeEntry( "Zone" + QString::number( zoneIndex ) , *it); zoneIndex++; } } // We have an existing list of timezones refresh the // translations of TimeZone name zoneIndex = 0; while (cfg.hasKey( "Zone"+ QString::number( zoneIndex ))){ zoneID = cfg.readEntry( "Zone" + QString::number( zoneIndex )); curZone = TimeZone( zoneID ); if ( !curZone.isValid() ){ qDebug( "initEnvironment() Invalid TimeZone %s", zoneID.latin1() ); break; } cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() ); zoneIndex++; } #endif } void initEnvironment() { #ifdef Q_OS_WIN32 // Config file requires HOME dir which uses QDir which needs the winver qt_init_winver(); #endif Config config("locale"); config.setGroup( "Location" ); QString tz = config.readEntry( "Timezone", getenv("TZ") ).stripWhiteSpace(); // if not timezone set, pick New York if (tz.isNull() || tz.isEmpty()) tz = "America/New_York"; setenv( "TZ", tz, 1 ); config.writeEntry( "Timezone", tz); config.setGroup( "Language" ); QString lang = config.readEntry( "Language", getenv("LANG") ).stripWhiteSpace(); if( lang.isNull() || lang.isEmpty()) lang = "en_US"; setenv( "LANG", lang, 1 ); config.writeEntry("Language", lang); config.write(); #if 0 setenv( "QWS_SIZE", "240x320", 0 ); #endif QString env(getenv("QWS_DISPLAY")); if (env.contains("Transformed")) { int rot; // transformed driver default rotation is controlled by the hardware. Config config("qpe"); config.setGroup( "Rotation" ); if ( ( rot = config.readNumEntry( "Rot", -1 ) ) == -1 ) rot = ODevice::inst ( )-> rotation ( ) * 90; setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); QPEApplication::defaultRotation ( ); /* to ensure deforient matches reality */ } } static void initKeyboard() { Config config("qpe"); config.setGroup( "Keyboard" ); int ard = config.readNumEntry( "RepeatDelay" ); int arp = config.readNumEntry( "RepeatPeriod" ); if ( ard > 0 && arp > 0 ) qwsSetKeyboardAutoRepeat( ard, arp ); QString layout = config.readEntry( "Layout", "us101" ); Server::setKeyboardLayout( layout ); } static bool firstUse() { bool needFirstUse = FALSE; if ( QWSServer::mouseHandler() && QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { if ( !QFile::exists( "/etc/pointercal" ) ) needFirstUse = TRUE; } { Config config( "qpe" ); config.setGroup( "Startup" ); needFirstUse |= config.readBoolEntry( "FirstUse", TRUE ); } if ( !needFirstUse ) return FALSE; FirstUse *fu = new FirstUse(); fu->exec(); bool rs = fu->restartNeeded(); delete fu; return rs; } int initApplication( int argc, char ** argv ) { cleanup(); initEnvironment(); //Don't flicker at startup: #ifdef QWS QWSServer::setDesktopBackground( QImage() ); #endif ServerApplication a( argc, argv, QApplication::GuiServer ); refreshTimeZoneConfig(); initKeyboard(); // Don't use first use under Windows if ( firstUse() ) { a.restart(); return 0; } ODevice::inst ( )-> setSoftSuspend ( true ); { QCopEnvelope e("QPE/System", "setBacklight(int)" ); e << -3; // Forced on } AlarmServer::initialize(); Server *s = new Server(); (void)new SysFileMonitor(s); #ifdef QWS Network::createServer(s); #endif s->show(); /* THE ARM rtc has problem holdings the time on reset */ if ( QDate::currentDate ( ). year ( ) < 2000 ) { if ( QMessageBox::information ( 0, ServerApplication::tr( "Information" ), ServerApplication::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(); qDebug("exiting..."); delete s; +#ifndef Q_OS_MACX ODevice::inst()->setSoftSuspend( false ); +#endif 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 ( ); } #ifndef Q_OS_WIN32 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 ); // Have we been asked to restart? if ( ServerApplication::doRestart ) { for ( int fd = 3; fd < 100; fd++ ) close( fd ); execl( (QPEApplication::qpeDir()+"bin/qpe").latin1(), "qpe", 0 ); } // Kill them. Kill them all. ::kill ( 0, SIGTERM ); ::sleep ( 1 ); ::kill ( 0, SIGKILL ); return retVal; } #else int main( int argc, char ** argv ) { int retVal = initApplication( argc, argv ); if ( DesktopApplication::doRestart ) { qDebug("Trying to restart"); execl( (QPEApplication::qpeDir()+"bin\\qpe").latin1(), "qpe", 0 ); } return retVal; } #endif diff --git a/core/launcher/packageslave.cpp b/core/launcher/packageslave.cpp index 4f149a5..bf34368 100644 --- a/core/launcher/packageslave.cpp +++ b/core/launcher/packageslave.cpp @@ -1,97 +1,341 @@ /********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** -** This file is part of Qtopia Environment. +** 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 "packageslave.h" +#include <qtopia/qprocess.h> -#include <qpe/process.h> -#include <qpe/qcopenvelope_qws.h> +#ifdef Q_WS_QWS +#include <qtopia/qcopenvelope_qws.h> +#endif #include <qdatastream.h> +#ifdef Q_WS_QWS #include <qcopchannel_qws.h> +#endif +#include <qtextstream.h> +#include <qdir.h> + +#include <stdlib.h> +#include <sys/stat.h> // mkdir() + +#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) #include <unistd.h> +#include <sys/vfs.h> +#include <mntent.h> +#elif defined(Q_OS_WIN32) +#include <windows.h> +#include <winbase.h> +#elif defined(Q_OS_MACX) +#include <unistd.h> +#endif + -PackageSlave::PackageSlave( QObject *parent, char* name ) - : QObject( parent, name ), packageChannel( 0 ) +PackageHandler::PackageHandler( QObject *parent, char* name ) + : QObject( parent, name ), packageChannel( 0 ), currentProcess( 0 ), mNoSpaceLeft( FALSE ) { // setup qcop channel +#ifndef QT_NO_COP packageChannel = new QCopChannel( "QPE/Package", this ); connect( packageChannel, SIGNAL( received(const QCString &, const QByteArray &) ), this, SLOT( qcopMessage( const QCString &, const QByteArray &) ) ); +#endif } -void PackageSlave::qcopMessage( const QCString &msg, const QByteArray &data ) +void PackageHandler::qcopMessage( const QCString &msg, const QByteArray &data ) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "installPackage(QString)" ) { QString file; stream >> file; installPackage( file ); - } - else if ( msg == "removePackage(QString)" ) { + } else if ( msg == "removePackage(QString)" ) { QString file; stream >> file; removePackage( file ); + } else if ( msg == "addPackageFiles(QString,QString)" ) { + QString location, listfile; + stream >> location >> listfile; + addPackageFiles( location, listfile); + } else if ( msg == "addPackages(QString)" ) { + QString location; + stream >> location; + addPackages( location ); + } else if ( msg == "cleanupPackageFiles(QString)" ) { + QString listfile; + stream >> listfile; + cleanupPackageFiles( listfile ); + } else if ( msg == "cleanupPackages(QString)" ) { + QString location; + stream >> location; + cleanupPackages( location ); + } else if ( msg == "prepareInstall(QString,QString)" ) { + QString size, path; + stream >> size; + stream >> path; + prepareInstall( size, path ); } } -void PackageSlave::installPackage( const QString &package ) +void PackageHandler::installPackage( const QString &package ) { - Process proc( QStringList() << "ipkg" << "install" << package ); + if ( mNoSpaceLeft ) { + mNoSpaceLeft = FALSE; + // Don't emit that for now, I still couldn't test it (Wener) + //sendReply( "installFailed(QString)", package ); + //return; + } + + currentProcess = new QProcess( QStringList() << "ipkg" << "install" << package ); // No tr + connect( currentProcess, SIGNAL( processExited() ), SLOT( iProcessExited() ) ); + connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) ); + connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) ); + currentPackage = package; + currentProcessError=""; sendReply( "installStarted(QString)", package ); + currentProcess->start(); +} + +void PackageHandler::removePackage( const QString &package ) +{ + currentProcess = new QProcess( QStringList() << "ipkg" << "remove" << package ); // No tr + connect( currentProcess, SIGNAL( processExited() ), SLOT( rmProcessExited() ) ); + connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) ); + connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) ); + currentPackage = package; + + currentProcessError=""; + sendReply( "removeStarted(QString)", package ); + currentProcess->start(); +} + +void PackageHandler::sendReply( const QCString& msg, const QString& arg ) +{ +#ifndef QT_NO_COP + QCopEnvelope e( "QPE/Desktop", msg ); + e << arg; +#endif +} + +void PackageHandler::addPackageFiles( const QString &location, + const QString &listfile ) +{ + QFile f(listfile); +#ifndef Q_OS_WIN32 + //make a copy so we can remove the symlinks later + mkdir( ("/usr/lib/ipkg/info/"+location).ascii(), 0777 ); + system(("cp " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); +#else + QDir d; + //#### revise + qDebug("Copy file at %s: %s", __FILE__, __LINE__ ); + d.mkdir(("/usr/lib/ipkg/info/" + location).ascii()); + system(("copy " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); +#endif + + + if ( f.open(IO_ReadOnly) ) { + QTextStream ts(&f); + + QString s; + while ( !ts.eof() ) { // until end of file... + s = ts.readLine(); // line of text excluding '\n' + // for s, do link/mkdir. + if ( s.right(1) == "/" ) { + qDebug("do mkdir for %s", s.ascii()); +#ifndef Q_OS_WIN32 + mkdir( s.ascii(), 0777 ); + //possible optimization: symlink directories + //that don't exist already. -- Risky. +#else + d.mkdir( s.ascii()); +#endif + + } else { +#ifndef Q_OS_WIN32 + qDebug("do symlink for %s", s.ascii()); + symlink( (location + s).ascii(), s.ascii() ); +#else + qDebug("Copy file instead of a symlink for WIN32"); + if (!CopyFile((TCHAR*)qt_winTchar((location + s), TRUE), (TCHAR*)qt_winTchar(s, TRUE), FALSE)) + qWarning("Unable to create symlinkfor %s", + (location + s).ascii()); +#endif + } + } + f.close(); + } +} - QString output; - if ( proc.exec( "", output ) ) { - sendReply( "installDone(QString)", package ); +void PackageHandler::addPackages( const QString &location ) +{ + // get list of *.list in location/usr/lib/ipkg/info/*.list + QDir dir(location + "/usr/lib/ipkg/info", "*.list", // No tr + QDir::Name, QDir::Files); + if ( !dir.exists() ) + return; + + QStringList packages = dir.entryList(); + for ( QStringList::Iterator it = packages.begin(); + it != packages.end(); ++it ) { + addPackageFiles( location, *it ); } +} + + +void PackageHandler::cleanupPackageFiles( const QString &listfile ) +{ + QFile f(listfile); + + if ( f.open(IO_ReadOnly) ) { + QTextStream ts(&f); + + QString s; + while ( !ts.eof() ) { // until end of file... + s = ts.readLine(); // line of text excluding '\n' + // for s, do link/mkdir. + if ( s.right(1) == "/" ) { + //should rmdir if empty, after all files have been removed + } else { +#ifndef Q_OS_WIN32 + qDebug("remove symlink for %s", s.ascii()); + //check if it is a symlink first (don't remove /etc/passwd...) + char buf[10]; //we don't care about the contents + if ( ::readlink( s.ascii(),buf, 10 >= 0 ) ) + ::unlink( s.ascii() ); +#else + // ### revise + qWarning("Unable to remove symlink %s:%s", __FILE__, __LINE__); +#endif + } + } + f.close(); + + //remove the list file + ::unlink( listfile.ascii() ); + + } +} + +void PackageHandler::cleanupPackages( const QString &location ) +{ + // get list of *.list in location/usr/lib/ipkg/info/*.list + QDir dir( "/usr/lib/ipkg/info/"+location, "*.list", // No tr + QDir::Name, QDir::Files); + if ( !dir.exists() ) + return; + + QStringList packages = dir.entryList(); + for ( QStringList::Iterator it = packages.begin(); + it != packages.end(); ++it ) { + cleanupPackageFiles( *it ); + } + + //remove the backup directory + //### +} + +void PackageHandler::prepareInstall( const QString& size, const QString& path ) +{ + // Check whether there will be enough space to install the next package. + bool ok; + unsigned int s = size.toUInt( &ok ); + + if ( !ok ) + return; + + // Shamelessly stolen from the sysinfo application (Werner) +#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) + struct statfs fs; + if ( statfs( path.latin1(), &fs ) == 0 ) + if ( s > fs.f_bsize * fs.f_bavail ) { + //qDebug("############### Not enough space left ###############"); + mNoSpaceLeft = TRUE; + } +#endif +} + +void PackageHandler::iProcessExited() +{ + if ( currentProcess->normalExit() && currentProcess->exitStatus() == 0 ) + sendReply( "installDone(QString)", currentPackage ); else { - sendReply( "installFailed(QString)", package ); +#ifndef QT_NO_COP + QCopEnvelope e( "QPE/Desktop", "installFailed(QString,int,QString)" ); + e << currentPackage << currentProcess->exitStatus() + << currentProcessError; +#endif } + + delete currentProcess; + currentProcess = 0; + +#ifndef QT_NO_COP QCopEnvelope e("QPE/System", "linkChanged(QString)"); QString lf = QString::null; e << lf; - unlink( package ); +#endif + unlink( currentPackage ); } -void PackageSlave::removePackage( const QString &package ) +void PackageHandler::rmProcessExited() { - Process proc( QStringList() << "ipkg" << "remove" << package ); + if ( currentProcess->normalExit() && currentProcess->exitStatus() == 0 ) + sendReply( "removeDone(QString)", currentPackage ); + else + sendReply( "removeFailed(QString)", currentPackage ); - sendReply( "removeStarted(QString)", package ); - - QString output; - if ( proc.exec( "", output ) ) { - sendReply( "removeDone(QString)", package ); - } - else { - sendReply( "removeFailed(QString)", package ); - } +#ifndef QT_NO_COP QCopEnvelope e("QPE/System", "linkChanged(QString)"); QString lf = QString::null; e << lf; +#endif } -void PackageSlave::sendReply( const QCString& msg, const QString& arg ) +void PackageHandler::readyReadStdout() { - QCopEnvelope e( "QPE/Desktop", msg ); - e << arg; + while ( currentProcess->canReadLineStdout() ) { + QString line = currentProcess->readLineStdout(); + currentProcessError.append("OUT:"+line); + if ( line.contains( "Unpacking" ) ) // No tr + sendReply( "installStep(QString)", "one" ); // No tr + else if ( line.contains( "Configuring" ) ) // No tr + sendReply( "installStep(QString)", "two" ); // No tr + } +} + +void PackageHandler::readyReadStderr() +{ + while ( currentProcess->canReadLineStderr() ) { + QString line = currentProcess->readLineStderr(); + currentProcessError.append("ERR:"+line); + } +} + +void PackageHandler::redoPackages() +{ + //get list of filesystems + + //call cleanupPackages for the ones that have disappeared + + //call addPackageFiles for the new ones } diff --git a/core/launcher/qprocess_unix.cpp b/core/launcher/qprocess_unix.cpp index a07bf64..19a8c93 100644 --- a/core/launcher/qprocess_unix.cpp +++ b/core/launcher/qprocess_unix.cpp @@ -1,436 +1,439 @@ /********************************************************************** ** 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 "qplatformdefs.h" // Solaris redefines connect -> __xnet_connect with _XOPEN_SOURCE_EXTENDED. #if defined(connect) #undef connect #endif #include "qprocess.h" #ifndef QT_NO_PROCESS #include "qapplication.h" #include "qqueue.h" #include "qlist.h" #include "qsocketnotifier.h" #include "qtimer.h" #include "qregexp.h" #include "qcleanuphandler_p.h" #include <stdlib.h> // ### FOR Qt 2.3 compat #include <unistd.h> #include <signal.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <sys/wait.h> #include <sys/fcntl.h> #include <errno.h> +#ifdef Q_OS_MACX +#include <sys/time.h> +#endif #include <sys/resource.h> #ifdef __MIPSEL__ # ifndef SOCK_DGRAM # define SOCK_DGRAM 1 # endif # ifndef SOCK_STREAM # define SOCK_STREAM 2 # endif #endif //#define QT_QPROCESS_DEBUG #ifdef Q_C_CALLBACKS extern "C" { #endif // Q_C_CALLBACKS #define QT_SIGNAL_RETTYPE void #define QT_SIGNAL_ARGS int #define QT_SIGNAL_IGNORE SIG_IGN QT_SIGNAL_RETTYPE qt_C_sigchldHnd(QT_SIGNAL_ARGS); QT_SIGNAL_RETTYPE qt_C_sigpipeHnd(QT_SIGNAL_ARGS); #ifdef Q_C_CALLBACKS } #endif // Q_C_CALLBACKS class QProc; class QProcessManager; class QProcessPrivate { public: QProcessPrivate(); ~QProcessPrivate(); void closeOpenSocketsForChild(); void newProc( pid_t pid, QProcess *process ); QByteArray bufStdout; QByteArray bufStderr; QQueue<QByteArray> stdinBuf; QSocketNotifier *notifierStdin; QSocketNotifier *notifierStdout; QSocketNotifier *notifierStderr; ssize_t stdinBufRead; QProc *proc; bool exitValuesCalculated; bool socketReadCalled; static QProcessManager *procManager; }; /*********************************************************************** * * QProc * **********************************************************************/ /* The class QProcess does not necessarily map exactly to the running child processes: if the process is finished, the QProcess class may still be there; furthermore a user can use QProcess to start more than one process. The helper-class QProc has the semantics that one instance of this class maps directly to a running child process. */ class QProc { public: QProc( pid_t p, QProcess *proc=0 ) : pid(p), process(proc) { #if defined(QT_QPROCESS_DEBUG) qDebug( "QProc: Constructor for pid %d and QProcess %p", pid, process ); #endif socketStdin = 0; socketStdout = 0; socketStderr = 0; } ~QProc() { #if defined(QT_QPROCESS_DEBUG) qDebug( "QProc: Destructor for pid %d and QProcess %p", pid, process ); #endif if ( process != 0 ) { if ( process->d->notifierStdin ) process->d->notifierStdin->setEnabled( FALSE ); if ( process->d->notifierStdout ) process->d->notifierStdout->setEnabled( FALSE ); if ( process->d->notifierStderr ) process->d->notifierStderr->setEnabled( FALSE ); process->d->proc = 0; } if( socketStdin != 0 ) ::close( socketStdin ); // ### close these sockets even on parent exit or is it better only on // sigchld (but what do I have to do with them on exit then)? if( socketStdout != 0 ) ::close( socketStdout ); if( socketStderr != 0 ) ::close( socketStderr ); } pid_t pid; int socketStdin; int socketStdout; int socketStderr; QProcess *process; }; /*********************************************************************** * * QProcessManager * **********************************************************************/ class QProcessManager : public QObject { Q_OBJECT public: QProcessManager(); ~QProcessManager(); void append( QProc *p ); void remove( QProc *p ); void cleanup(); public slots: void removeMe(); void sigchldHnd( int ); public: struct sigaction oldactChld; struct sigaction oldactPipe; QList<QProc> *procList; int sigchldFd[2]; }; QCleanupHandler<QProcessManager> qprocess_cleanup_procmanager; QProcessManager::QProcessManager() { procList = new QList<QProc>; procList->setAutoDelete( TRUE ); // The SIGCHLD handler writes to a socket to tell the manager that // something happened. This is done to get the processing in sync with the // event reporting. if ( ::socketpair( AF_UNIX, SOCK_STREAM, 0, sigchldFd ) ) { sigchldFd[0] = 0; sigchldFd[1] = 0; } else { #if defined(QT_QPROCESS_DEBUG) qDebug( "QProcessManager: install socket notifier (%d)", sigchldFd[1] ); #endif QSocketNotifier *sn = new QSocketNotifier( sigchldFd[1], QSocketNotifier::Read, this ); connect( sn, SIGNAL(activated(int)), this, SLOT(sigchldHnd(int)) ); sn->setEnabled( TRUE ); } // install a SIGCHLD handler and ignore SIGPIPE struct sigaction act; #if defined(QT_QPROCESS_DEBUG) qDebug( "QProcessManager: install a SIGCHLD handler" ); #endif act.sa_handler = qt_C_sigchldHnd; sigemptyset( &(act.sa_mask) ); sigaddset( &(act.sa_mask), SIGCHLD ); act.sa_flags = SA_NOCLDSTOP; #if defined(SA_RESTART) act.sa_flags |= SA_RESTART; #endif if ( sigaction( SIGCHLD, &act, &oldactChld ) != 0 ) qWarning( "Error installing SIGCHLD handler" ); #if defined(QT_QPROCESS_DEBUG) qDebug( "QProcessManager: install a SIGPIPE handler (SIG_IGN)" ); #endif /* Using qt_C_sigpipeHnd rather than SIG_IGN is a workaround for a strange problem where GNU tar (called by backuprestore) would hang on filesystem-full. Strangely, the qt_C_sigpipeHnd is never even called, yet this avoids the hang. */ act.sa_handler = qt_C_sigpipeHnd; sigemptyset( &(act.sa_mask) ); sigaddset( &(act.sa_mask), SIGPIPE ); act.sa_flags = 0; if ( sigaction( SIGPIPE, &act, &oldactPipe ) != 0 ) qWarning( "Error installing SIGPIPE handler" ); } QProcessManager::~QProcessManager() { delete procList; if ( sigchldFd[0] != 0 ) ::close( sigchldFd[0] ); if ( sigchldFd[1] != 0 ) ::close( sigchldFd[1] ); // restore SIGCHLD handler #if defined(QT_QPROCESS_DEBUG) qDebug( "QProcessManager: restore old sigchild handler" ); #endif if ( sigaction( SIGCHLD, &oldactChld, 0 ) != 0 ) qWarning( "Error restoring SIGCHLD handler" ); #if defined(QT_QPROCESS_DEBUG) qDebug( "QProcessManager: restore old sigpipe handler" ); #endif if ( sigaction( SIGPIPE, &oldactPipe, 0 ) != 0 ) qWarning( "Error restoring SIGPIPE handler" ); } void QProcessManager::append( QProc *p ) { procList->append( p ); #if defined(QT_QPROCESS_DEBUG) qDebug( "QProcessManager: append process (procList.count(): %d)", procList->count() ); #endif } void QProcessManager::remove( QProc *p ) { procList->remove( p ); #if defined(QT_QPROCESS_DEBUG) qDebug( "QProcessManager: remove process (procList.count(): %d)", procList->count() ); #endif cleanup(); } void QProcessManager::cleanup() { if ( procList->count() == 0 ) { QTimer::singleShot( 0, this, SLOT(removeMe()) ); } } void QProcessManager::removeMe() { if ( procList->count() == 0 ) { qprocess_cleanup_procmanager.remove( &QProcessPrivate::procManager ); QProcessPrivate::procManager = 0; delete this; } } void QProcessManager::sigchldHnd( int fd ) { char tmp; ::read( fd, &tmp, sizeof(tmp) ); #if defined(QT_QPROCESS_DEBUG) qDebug( "QProcessManager::sigchldHnd()" ); #endif QProc *proc; QProcess *process; bool removeProc; proc = procList->first(); while ( proc != 0 ) { removeProc = FALSE; process = proc->process; QProcess *process_exit_notify=0; if ( process != 0 ) { if ( !process->isRunning() ) { #if defined(QT_QPROCESS_DEBUG) qDebug( "QProcessManager::sigchldHnd() (PID: %d): process exited (QProcess available)", proc->pid ); #endif // read pending data int nbytes = 0; if ( ::ioctl(proc->socketStdout, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) { #if defined(QT_QPROCESS_DEBUG) qDebug( "QProcessManager::sigchldHnd() (PID: %d): reading %d bytes of pending data on stdout", proc->pid, nbytes ); #endif process->socketRead( proc->socketStdout ); } nbytes = 0; if ( ::ioctl(proc->socketStderr, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) { #if defined(QT_QPROCESS_DEBUG) qDebug( "QProcessManager::sigchldHnd() (PID: %d): reading %d bytes of pending data on stderr", proc->pid, nbytes ); #endif process->socketRead( proc->socketStderr ); } if ( process->notifyOnExit ) process_exit_notify = process; removeProc = TRUE; } } else { int status; if ( ::waitpid( proc->pid, &status, WNOHANG ) == proc->pid ) { #if defined(QT_QPROCESS_DEBUG) qDebug( "QProcessManager::sigchldHnd() (PID: %d): process exited (QProcess not available)", proc->pid ); #endif removeProc = TRUE; } } if ( removeProc ) { QProc *oldproc = proc; proc = procList->next(); remove( oldproc ); } else { proc = procList->next(); } if ( process_exit_notify ) emit process_exit_notify->processExited(); } } #include "qprocess_unix.moc" /*********************************************************************** * * QProcessPrivate * **********************************************************************/ QProcessManager *QProcessPrivate::procManager = 0; QProcessPrivate::QProcessPrivate() { #if defined(QT_QPROCESS_DEBUG) qDebug( "QProcessPrivate: Constructor" ); #endif stdinBufRead = 0; notifierStdin = 0; notifierStdout = 0; notifierStderr = 0; exitValuesCalculated = FALSE; socketReadCalled = FALSE; proc = 0; } QProcessPrivate::~QProcessPrivate() { #if defined(QT_QPROCESS_DEBUG) qDebug( "QProcessPrivate: Destructor" ); #endif if ( proc != 0 ) { if ( proc->socketStdin != 0 ) { ::close( proc->socketStdin ); proc->socketStdin = 0; } proc->process = 0; } while ( !stdinBuf.isEmpty() ) { delete stdinBuf.dequeue(); } delete notifierStdin; delete notifierStdout; delete notifierStderr; } /* Closes all open sockets in the child process that are not needed by the child process. Otherwise one child may have an open socket on standard input, etc. of another child. */ void QProcessPrivate::closeOpenSocketsForChild() { if ( procManager != 0 ) { if ( procManager->sigchldFd[0] != 0 ) ::close( procManager->sigchldFd[0] ); if ( procManager->sigchldFd[1] != 0 ) ::close( procManager->sigchldFd[1] ); // close also the sockets from other QProcess instances QProc *proc; diff --git a/core/launcher/server.pro b/core/launcher/server.pro index 93baeb4..0513536 100644 --- a/core/launcher/server.pro +++ b/core/launcher/server.pro @@ -1,120 +1,125 @@ TEMPLATE = app CONFIG += qtopia warn_on release DESTDIR = $$(OPIEDIR)/bin HEADERS += server.h \ serverinterface.h \ launchertab.h \ documentlist.h \ appicons.h \ taskbar.h \ runningappbar.h \ applauncher.h \ stabmon.h \ inputmethods.h \ systray.h \ wait.h \ shutdownimpl.h \ launcher.h \ launcherview.h \ $$(OPIEDIR)/core/apps/calibrate/calibrate.h \ startmenu.h \ transferserver.h \ qcopbridge.h \ packageslave.h \ irserver.h \ firstuse.h \ $$(OPIEDIR)/rsync/buf.h \ $$(OPIEDIR)/rsync/checksum.h \ $$(OPIEDIR)/rsync/command.h \ $$(OPIEDIR)/rsync/emit.h \ $$(OPIEDIR)/rsync/job.h \ $$(OPIEDIR)/rsync/netint.h \ $$(OPIEDIR)/rsync/protocol.h \ $$(OPIEDIR)/rsync/prototab.h \ $$(OPIEDIR)/rsync/rsync.h \ $$(OPIEDIR)/rsync/search.h \ $$(OPIEDIR)/rsync/stream.h \ $$(OPIEDIR)/rsync/sumset.h \ $$(OPIEDIR)/rsync/trace.h \ $$(OPIEDIR)/rsync/types.h \ $$(OPIEDIR)/rsync/util.h \ $$(OPIEDIR)/rsync/whole.h \ $$(OPIEDIR)/rsync/config_rsync.h \ $$(OPIEDIR)/rsync/qrsync.h \ syncdialog.h \ serverapp.h \ launcherglobal.h \ qprocess.h \ screensaver.h SOURCES += server.cpp \ serverinterface.cpp \ launchertab.cpp \ documentlist.cpp \ appicons.cpp \ taskbar.cpp \ runningappbar.cpp \ applauncher.cpp \ stabmon.cpp \ inputmethods.cpp \ systray.cpp \ wait.cpp \ shutdownimpl.cpp \ launcher.cpp \ launcherview.cpp \ $$(OPIEDIR)/core/apps/calibrate/calibrate.cpp \ transferserver.cpp \ packageslave.cpp \ irserver.cpp \ qcopbridge.cpp \ startmenu.cpp \ main.cpp \ firstuse.cpp \ $$(OPIEDIR)/rsync/base64.c \ $$(OPIEDIR)/rsync/buf.c \ $$(OPIEDIR)/rsync/checksum.c \ $$(OPIEDIR)/rsync/command.c \ $$(OPIEDIR)/rsync/delta.c \ $$(OPIEDIR)/rsync/emit.c \ $$(OPIEDIR)/rsync/hex.c \ $$(OPIEDIR)/rsync/job.c \ $$(OPIEDIR)/rsync/mdfour.c \ $$(OPIEDIR)/rsync/mksum.c \ $$(OPIEDIR)/rsync/msg.c \ $$(OPIEDIR)/rsync/netint.c \ $$(OPIEDIR)/rsync/patch.c \ $$(OPIEDIR)/rsync/prototab.c \ $$(OPIEDIR)/rsync/readsums.c \ $$(OPIEDIR)/rsync/scoop.c \ $$(OPIEDIR)/rsync/search.c \ $$(OPIEDIR)/rsync/stats.c \ $$(OPIEDIR)/rsync/stream.c \ $$(OPIEDIR)/rsync/sumset.c \ $$(OPIEDIR)/rsync/trace.c \ $$(OPIEDIR)/rsync/tube.c \ $$(OPIEDIR)/rsync/util.c \ $$(OPIEDIR)/rsync/version.c \ $$(OPIEDIR)/rsync/whole.c \ $$(OPIEDIR)/rsync/qrsync.cpp \ syncdialog.cpp \ serverapp.cpp \ launcherglobal.cpp \ qprocess.cpp \ qprocess_unix.cpp \ screensaver.cpp INCLUDEPATH += $(OPIEDIR)/core/apps/calibrate DEPENDPATH += $(OPIEDIR)/core/apps/calibrate INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/rsync DEPENDPATH += $(OPIEDIR)/rsync TARGET = qpe -LIBS += -lcrypt -lqpe -lopie +CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) +contains( CONFTEST, y ){ + LIBS += -lqpe -lopie +}else{ + LIBS += -lcrypt -lqpe -lopie +} include ( $(OPIEDIR)/include.pro ) diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp index 014418d..08ae885 100644 --- a/core/launcher/startmenu.cpp +++ b/core/launcher/startmenu.cpp @@ -1,333 +1,337 @@ /********************************************************************** ** 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. ** **********************************************************************/ #define INCLUDE_MENUITEM_DEF #include "startmenu.h" #include <qtopia/qpeapplication.h> #include <qtopia/config.h> #include <qtopia/applnk.h> #include <qtopia/global.h> #include <qtopia/resource.h> #include <qtopia/mimetype.h> #include <qtopia/qlibrary.h> #include <qdict.h> #include <qdir.h> #include <qpainter.h> #include <stdlib.h> void StartPopupMenu::keyPressEvent( QKeyEvent *e ) { if ( e->key() == Key_F33 || e->key() == Key_Space ) { // "OK" button, little hacky QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); QPopupMenu::keyPressEvent( &ke ); } else { QPopupMenu::keyPressEvent( e ); } } //--------------------------------------------------------------------------- StartMenu::StartMenu(QWidget *parent) : QLabel( parent ) { startButtonPixmap = "go"; // No tr int sz = AppLnk::smallIconSize()+3; QPixmap pm; pm.convertFromImage(Resource::loadImage(startButtonPixmap).smoothScale(sz,sz)); setPixmap(pm); setFocusPolicy( NoFocus ); launchMenu = 0; refreshMenu(); } void StartMenu::mousePressEvent( QMouseEvent * ) { launch(); } StartMenu::~StartMenu() { clearApplets(); } void StartMenu::createMenu() { clearApplets(); delete launchMenu; launchMenu = new StartPopupMenu( this ); loadMenu( launchMenu ); loadApplets(); bool result = nother || ntabs || m_applets.count(); if ( result ) connect( launchMenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); } void StartMenu::refreshMenu() { Config cfg("Taskbar"); cfg.setGroup("Menu"); bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE); bool lot = cfg.readBoolEntry("LauncherOther",TRUE); bool lt = ltabs || lot; if ( launchMenu && !lt ) return; // nothing to do if ( launchMenu ) { int i; /* find the first entry we want to remove */ for (i=0; i<(int)launchMenu->count(); i++) { QMenuItem* item = launchMenu->findItem(launchMenu->idAt(i)); if ( item && item->id() >= 0 && item->id() < ntabs ) { break; } if ( item && item->isSeparator() ) { i++; break; } } /* remove them */ while (i<(int)launchMenu->count()) launchMenu->removeItemAt(i); loadMenu(launchMenu); addApplets(launchMenu); } else { createMenu(); } } void StartMenu::itemSelected( int id ) { if ( id >= 0 && id < ntabs ) { emit tabSelected(tabs[id]); } else if ( id >= 20 && id < 20+nother ) { other.at(id-20)->execute(); }else { MenuApplet *applet = m_applets.find ( id ); if ( applet ) { qWarning("activated"); applet-> iface-> activated(); } } } bool StartMenu::loadMenu( QPopupMenu *menu ) { Config cfg("Taskbar"); cfg.setGroup("Menu"); bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE); bool lot = cfg.readBoolEntry("LauncherOther",TRUE); bool sepfirst = !ltabs && !lot; tabs.clear(); other.setAutoDelete(TRUE); other.clear(); ntabs = 0; nother = 0; bool f=TRUE; if ( ltabs || lot ) { QDir dir( MimeType::appsFolderName(), QString::null, QDir::Name ); for (int i=0; i<(int)dir.count(); i++) { QString d = dir[i]; Config cfg(dir.path()+"/"+d+"/.directory",Config::File); if ( cfg.isValid() ) { QString nm = cfg.readEntry("Name"); QString ic = cfg.readEntry("Icon"); if ( !!nm && !!ic ) { tabs.append(d); menu->insertItem( Resource::loadIconSet(ic), nm, ntabs++ ); } } else if ( lot && d.right(8)==".desktop") { AppLnk* applnk = new AppLnk(dir.path()+"/"+d); if ( applnk->isValid() ) { if ( applnk->type() == "Separator" ) { // No tr if ( lot ) { menu->insertSeparator(); sepfirst = f && !ltabs; } delete applnk; } else { f = FALSE; other.append(applnk); menu->insertItem( Resource::loadIconSet(applnk->icon()), applnk->name(), 20+nother++ ); } } else { delete applnk; } } } if ( !menu->count() ) sepfirst = TRUE; } launchMenu->setName(sepfirst ? "accessories" : "accessories_need_sep"); // No tr return (nother || ntabs ); } void StartMenu::launch() { int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height(); if ( launchMenu->isVisible() ) launchMenu->hide(); else launchMenu->popup( QPoint( 1, y ) ); } static int compareAppletPositions(const void *a, const void *b) { const MenuApplet* aa = *(const MenuApplet**)a; const MenuApplet* ab = *(const MenuApplet**)b; int d = aa->iface->position() - ab->iface->position(); if ( d ) return d; return QString::compare(aa->library->library(),ab->library->library()); } void StartMenu::clearApplets() { if (launchMenu ) launchMenu-> hide(); for ( QIntDictIterator<MenuApplet> it ( m_applets ); it. current ( ); ++it ) { MenuApplet *applet = it. current ( ); if ( launchMenu ) { launchMenu-> removeItem ( applet-> id ); delete applet-> popup; } applet-> iface-> release(); applet-> library-> unload(); delete applet-> library; } m_applets.clear(); } void StartMenu::loadApplets() { Config cfg( "StartMenu" ); cfg.setGroup( "Applets" ); // SafeMode causes too much problems, so we disable it for now -- // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 // removed in the remerge PluginManager could handle it // we don't currently use it -zecke QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); QString lang = getenv( "LANG" ); QString path = QPEApplication::qpeDir() + "/plugins/applets"; +#ifdef Q_OS_MACX + QDir dir( path, "lib*.dylib" ); +#else QDir dir( path, "lib*.so" ); +#endif /* Q_OS_MACX */ QStringList list = dir.entryList(); QStringList::Iterator it; int napplets=0; MenuApplet* *xapplets = new MenuApplet*[list.count()]; for ( it = list.begin(); it != list.end(); ++it ) { if ( exclude.find( *it ) != exclude.end() ) continue; MenuAppletInterface *iface = 0; QLibrary *lib = new QLibrary( path + "/" + *it ); if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { MenuApplet *applet = new MenuApplet; xapplets[napplets++] = applet; applet->library = lib; applet->iface = iface; QTranslator *trans = new QTranslator(qApp); QString type = (*it).left( (*it).find(".") ); QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; if ( trans->load( tfn )) qApp->installTranslator( trans ); else delete trans; } else { exclude += *it; delete lib; } } cfg.writeEntry( "ExcludeApplets", exclude, ',' ); qsort(xapplets,napplets,sizeof(m_applets[0]),compareAppletPositions); int foo = ( launchMenu-> count ( )) ? launchMenu-> insertSeparator ( ) : 0; while (napplets--) { MenuApplet *applet = xapplets[napplets]; applet-> popup = applet-> iface-> popup ( this ); if ( applet-> popup ) applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup ); else applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) ); m_applets.insert ( applet-> id, new MenuApplet(*applet)); } delete [] xapplets; } /* * Launcher calls loadMenu too often fix that */ void StartMenu::addApplets(QPopupMenu* pop) { QIntDict<MenuApplet> dict; if( pop-> count ( )) pop-> insertSeparator ( ); for ( QIntDictIterator<MenuApplet> it ( m_applets ); it. current ( ); ++it ) { MenuApplet *applet = it. current ( ); if ( applet-> popup ) applet-> id = pop-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup ); else applet-> id = pop-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) ); dict.insert( applet->id, new MenuApplet(*applet) ); } /* need to update the key */ m_applets.setAutoDelete( true ); m_applets.clear(); m_applets.setAutoDelete( false ); m_applets = dict; } diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp index 6122770..691f6b8 100644 --- a/core/launcher/systray.cpp +++ b/core/launcher/systray.cpp @@ -1,149 +1,154 @@ /********************************************************************** ** 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 <qtopia/qpeapplication.h> #include <qtopia/qlibrary.h> #include <qtopia/config.h> #include <qlayout.h> #include <qdir.h> #include <qmessagebox.h> #include <qtranslator.h> #include "systray.h" #include <stdlib.h> /* ### Single build floppies ### */ #if 0 #ifdef QT_NO_COMPONENTS #include "../plugins/applets/clockapplet/clockappletimpl.h" #endif #endif SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) { //setFrameStyle( QFrame::Panel | QFrame::Sunken ); loadApplets(); } SysTray::~SysTray() { clearApplets(); } static int compareAppletPositions(const void *a, const void *b) { const TaskbarApplet* aa = *(const TaskbarApplet**)a; const TaskbarApplet* ab = *(const TaskbarApplet**)b; int d = ab->iface->position() - aa->iface->position(); if ( d ) return d; return QString::compare(ab->name,aa->name); } void SysTray::loadApplets() { hide(); clearApplets(); addApplets(); } void SysTray::clearApplets() { #ifndef QT_NO_COMPONENTS /* * Note on clearing. SOme applets delete their * applets themselves some don't do it * and on restart this can crash. If we delete it * here we might end up in a double deletion. We could * use QGuardedPtr but that would be one QOBject * for every applet more but only useful for restart */ QValueList<TaskbarApplet>::Iterator mit; for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { (*mit).iface->release(); (*mit).library->unload(); delete (*mit).library; } #endif appletList.clear(); if ( layout ) delete layout; layout = new QHBoxLayout( this, 0, 1 ); layout->setAutoAdd(TRUE); } void SysTray::addApplets() { hide(); #ifndef QT_NO_COMPONENTS Config cfg( "Taskbar" ); cfg.setGroup( "Applets" ); QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); QString lang = getenv( "LANG" ); QString path = QPEApplication::qpeDir() + "/plugins/applets"; +#ifdef Q_OS_MACX + QDir dir( path, "lib*.dylib" ); +#else QDir dir( path, "lib*.so" ); +#endif /* Q_OS_MACX */ QStringList list = dir.entryList(); QStringList::Iterator it; int napplets=0; TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; for ( it = list.begin(); it != list.end(); ++it ) { if ( exclude.find( *it ) != exclude.end() ) continue; + qWarning( "Found Applet: %s", (*it).latin1() ); TaskbarAppletInterface *iface = 0; QLibrary *lib = new QLibrary( path + "/" + *it ); if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { TaskbarApplet *applet = new TaskbarApplet; applets[napplets++] = applet; applet->library = lib; applet->iface = iface; QTranslator *trans = new QTranslator(qApp); QString type = (*it).left( (*it).find(".") ); QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; if ( trans->load( tfn )) qApp->installTranslator( trans ); else delete trans; } else { exclude += *it; delete lib; } } cfg.writeEntry( "ExcludeApplets", exclude, ',' ); qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions); while (napplets--) { TaskbarApplet *applet = applets[napplets]; applet->applet = applet->iface->applet( this ); appletList.append(*applet); } delete [] applets; #else /* ## FIXME single app */ TaskbarApplet * const applet = new TaskbarApplet(); applet->iface = new ClockAppletImpl(); applet->applet = applet->iface->applet( this ); appletList.append( applet ); #endif show(); } diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp index c69df2d..439e110 100644 --- a/core/launcher/transferserver.cpp +++ b/core/launcher/transferserver.cpp @@ -1,416 +1,419 @@ /********************************************************************** ** 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. ** **********************************************************************/ //#define _XOPEN_SOURCE #include <qtopia/global.h> #include <qtopia/qpeapplication.h> #ifndef Q_OS_WIN32 #include <pwd.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> #include <time.h> + +#ifndef Q_OS_MACX #include <shadow.h> #include <crypt.h> +#endif /* Q_OS_MACX */ #else #include <stdlib.h> #include <time.h> #endif #if defined(_OS_LINUX_) #include <shadow.h> #endif #include <qdir.h> #include <qfile.h> #include <qtextstream.h> #include <qdatastream.h> #include <qmessagebox.h> #include <qstringlist.h> #include <qfileinfo.h> #include <qregexp.h> //#include <qtopia/qcopchannel_qws.h> #include <qtopia/process.h> #include <qtopia/global.h> #include <qtopia/config.h> #include <qtopia/private/contact.h> #include <qtopia/quuid.h> #include <qtopia/version.h> #ifdef Q_WS_QWS #include <qtopia/qcopenvelope_qws.h> #endif #include "launcherglobal.h" #include "transferserver.h" #include <qtopia/qprocess.h> const int block_size = 51200; TransferServer::TransferServer( Q_UINT16 port, QObject *parent, const char* name) : QServerSocket( port, 1, parent, name ) { connections.setAutoDelete( TRUE ); if ( !ok() ) qWarning( "Failed to bind to port %d", port ); } void TransferServer::authorizeConnections() { QListIterator<ServerPI> it(connections); while ( it.current() ) { if ( !it.current()->verifyAuthorised() ) { disconnect( it.current(), SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) ); connections.removeRef( it.current() ); } else ++it; } } void TransferServer::closed(ServerPI *item) { connections.removeRef(item); } TransferServer::~TransferServer() { } void TransferServer::newConnection( int socket ) { ServerPI *ptr = new ServerPI( socket, this ); connect( ptr, SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) ); connections.append( ptr ); } QString SyncAuthentication::serverId() { Config cfg("Security"); cfg.setGroup("Sync"); QString r = cfg.readEntry("serverid"); if ( r.isEmpty() ) { r = Opie::Global::uuid(); cfg.writeEntry("serverid", r ); } return r; } QString SyncAuthentication::ownerName() { QString vfilename = Global::applicationFileName("addressbook", "businesscard.vcf"); if (QFile::exists(vfilename)) { Contact c; c = Contact::readVCard( vfilename )[0]; return c.fullName(); } return QString::null; } QString SyncAuthentication::loginName() { struct passwd *pw = 0L; #ifndef Q_OS_WIN32 pw = getpwuid( geteuid() ); return QString::fromLocal8Bit( pw->pw_name ); #else //### revise return QString(); #endif } int SyncAuthentication::isAuthorized(QHostAddress peeraddress) { Config cfg("Security"); cfg.setGroup("Sync"); // QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0"); uint auth_peer = cfg.readNumEntry("auth_peer", 0xc0a80100); // QHostAddress allowed; // allowed.setAddress(allowedstr); // uint auth_peer = allowed.ip4Addr(); uint auth_peer_bits = cfg.readNumEntry("auth_peer_bits", 24); uint mask = auth_peer_bits >= 32 // shifting by 32 is not defined ? 0xffffffff : (((1 << auth_peer_bits) - 1) << (32 - auth_peer_bits)); return (peeraddress.ip4Addr() & mask) == auth_peer; } bool SyncAuthentication::checkUser( const QString& user ) { if ( user.isEmpty() ) return FALSE; QString euser = loginName(); return user == euser; } bool SyncAuthentication::checkPassword( const QString& password ) { #ifdef ALLOW_UNIX_USER_FTP // First, check system password... struct passwd *pw = 0; struct spwd *spw = 0; pw = getpwuid( geteuid() ); spw = getspnam( pw->pw_name ); QString cpwd = QString::fromLocal8Bit( pw->pw_passwd ); if ( cpwd == "x" && spw ) cpwd = QString::fromLocal8Bit( spw->sp_pwdp ); // Note: some systems use more than crypt for passwords. QString cpassword = QString::fromLocal8Bit( crypt( password.local8Bit(), cpwd.local8Bit() ) ); if ( cpwd == cpassword ) return TRUE; #endif static int lastdenial=0; static int denials=0; int now = time(0); // Detect old Qtopia Desktop (no password) if ( password.isEmpty() ) { if ( denials < 1 || now > lastdenial+600 ) { QMessageBox unauth( tr("Sync Connection"), tr("<p>An unauthorized system is requesting access to this device." "<p>If you are using a version of Qtopia Desktop older than 1.5.1, " "please upgrade."), QMessageBox::Warning, QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, 0, QString::null, TRUE, WStyle_StaysOnTop); unauth.setButtonText(QMessageBox::Cancel, tr("Deny")); unauth.exec(); denials++; lastdenial=now; } return FALSE; } // Second, check sync password... static int lock=0; if ( lock ) return FALSE; ++lock; /* * we need to support old Sync software and QtopiaDesktop */ if ( password.left(6) == "Qtopia" || password.left(6) == "rootme" ) { Config cfg( "Security" ); cfg.setGroup("Sync"); QStringList pwds = cfg.readListEntry("Passwords",' '); for (QStringList::ConstIterator it=pwds.begin(); it!=pwds.end(); ++it) { #ifndef Q_OS_WIN32 QString cpassword = QString::fromLocal8Bit( crypt( password.mid(8).local8Bit(), (*it).left(2).latin1() ) ); #else // ### revise QString cpassword(""); #endif if ( *it == cpassword ) { lock--; return TRUE; } } // Unrecognized system. Be careful... QMessageBox unrecbox( tr("Sync Connection"), tr( "<p>An unrecognized system is requesting access to this device." "<p>If you have just initiated a Sync for the first time, this is normal."), QMessageBox::Warning, QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, 0, QString::null, TRUE, WStyle_StaysOnTop); unrecbox.setButtonText(QMessageBox::Cancel, tr("Deny")); unrecbox.setButtonText(QMessageBox::Yes, tr("Allow")); if ( (denials > 2 && now < lastdenial+600) || unrecbox.exec() != QMessageBox::Yes) { denials++; lastdenial=now; lock--; return FALSE; } else { const char salty[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/."; char salt[2]; salt[0]= salty[rand() % (sizeof(salty)-1)]; salt[1]= salty[rand() % (sizeof(salty)-1)]; #ifndef Q_OS_WIN32 QString cpassword = QString::fromLocal8Bit( crypt( password.mid(8).local8Bit(), salt ) ); #else //### revise QString cpassword(""); #endif denials=0; pwds.prepend(cpassword); cfg.writeEntry("Passwords",pwds,' '); lock--; return TRUE; } } lock--; return FALSE; } ServerPI::ServerPI( int socket, QObject *parent, const char* name ) : QSocket( parent, name ) , dtp( 0 ), serversocket( 0 ), waitsocket( 0 ), storFileSize(-1) { state = Connected; setSocket( socket ); peerport = peerPort(); peeraddress = peerAddress(); #ifndef INSECURE if ( !SyncAuthentication::isAuthorized(peeraddress) ) { state = Forbidden; startTimer( 0 ); } else #endif { connect( this, SIGNAL( readyRead() ), SLOT( read() ) ); connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); passiv = FALSE; for( int i = 0; i < 4; i++ ) wait[i] = FALSE; send( "220 Qtopia " QPE_VERSION " FTP Server" ); // No tr state = Wait_USER; dtp = new ServerDTP( this ); connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) ); connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) ); connect( dtp, SIGNAL( error( int ) ), SLOT( dtpError( int ) ) ); directory = QDir::currentDirPath(); static int p = 1024; while ( !serversocket || !serversocket->ok() ) { delete serversocket; serversocket = new ServerSocket( ++p, this ); } connect( serversocket, SIGNAL( newIncomming( int ) ), SLOT( newConnection( int ) ) ); } } ServerPI::~ServerPI() { close(); dtp->close(); delete dtp; delete serversocket; } bool ServerPI::verifyAuthorised() { if ( !SyncAuthentication::isAuthorized(peerAddress()) ) { state = Forbidden; return FALSE; } return TRUE; } void ServerPI::connectionClosed() { // qDebug( "Debug: Connection closed" ); emit connectionClosed(this); } void ServerPI::send( const QString& msg ) { QTextStream os( this ); os << msg << endl; //qDebug( "Reply: %s", msg.latin1() ); } void ServerPI::read() { while ( canReadLine() ) process( readLine().stripWhiteSpace() ); } bool ServerPI::checkReadFile( const QString& file ) { QString filename; if ( file[0] != "/" ) filename = directory.path() + "/" + file; else filename = file; QFileInfo fi( filename ); return ( fi.exists() && fi.isReadable() ); } bool ServerPI::checkWriteFile( const QString& file ) { QString filename; if ( file[0] != "/" ) filename = directory.path() + "/" + file; else filename = file; QFileInfo fi( filename ); if ( fi.exists() ) if ( !QFile( filename ).remove() ) return FALSE; return TRUE; } void ServerPI::process( const QString& message ) { //qDebug( "Command: %s", message.latin1() ); // split message using "," as separator QStringList msg = QStringList::split( " ", message ); if ( msg.isEmpty() ) return; // command token QString cmd = msg[0].upper(); // argument token QString arg; if ( msg.count() >= 2 ) arg = msg[1]; // full argument string QString args; if ( msg.count() >= 2 ) { diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.pro b/core/multimedia/opieplayer/wavplugin/wavplugin.pro index 0366542..db41ad4 100644 --- a/core/multimedia/opieplayer/wavplugin/wavplugin.pro +++ b/core/multimedia/opieplayer/wavplugin/wavplugin.pro @@ -1,32 +1,32 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = wavplugin.h wavpluginimpl.h SOURCES = wavplugin.cpp wavpluginimpl.cpp TARGET = wavplugin DESTDIR = $(OPIEDIR)/plugins/codecs INCLUDEPATH += $(OPIEDIR)/include .. DEPENDPATH += ../$(OPIEDIR)/include .. LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../../../i18n/de/libwavplugin.ts \ ../../../../i18n/nl/libwavplugin.ts \ ../../../../i18n/da/libwavplugin.ts \ ../../../../i18n/xx/libwavplugin.ts \ ../../../../i18n/en/libwavplugin.ts \ ../../../../i18n/es/libwavplugin.ts \ ../../../../i18n/fr/libwavplugin.ts \ ../../../../i18n/hu/libwavplugin.ts \ ../../../../i18n/ja/libwavplugin.ts \ ../../../../i18n/ko/libwavplugin.ts \ ../../../../i18n/no/libwavplugin.ts \ ../../../../i18n/pl/libwavplugin.ts \ ../../../../i18n/pt/libwavplugin.ts \ ../../../../i18n/pt_BR/libwavplugin.ts \ ../../../../i18n/sl/libwavplugin.ts \ ../../../../i18n/zh_CN/libwavplugin.ts \ ../../../../i18n/zh_TW/libwavplugin.ts include ( $(OPIEDIR)/include.pro ) diff --git a/core/pim/today/plugins/addressbook/addressbook.pro b/core/pim/today/plugins/addressbook/addressbook.pro index 4ebbc9e..54aaff2 100644 --- a/core/pim/today/plugins/addressbook/addressbook.pro +++ b/core/pim/today/plugins/addressbook/addressbook.pro @@ -1,43 +1,43 @@ TEMPLATE = lib CONFIG -= moc -CONFIG += qt release +CONFIG += qt plugin release # Input HEADERS = addressplugin.h addresspluginimpl.h addresspluginconfig.h \ addresspluginwidget.h SOURCES = addressplugin.cpp addresspluginimpl.cpp addresspluginconfig.cpp \ addresspluginwidget.cpp INCLUDEPATH += $(OPIEDIR)/include \ ../ ../library DEPENDPATH += $(OPIEDIR)/include \ ../ ../library LIBS+= -lqpe -lopie DESTDIR = $(OPIEDIR)/plugins/today TARGET = todayaddressbookplugin TRANSLATIONS = ../../../../../i18n/de/libtodayaddressbookplugin.ts \ ../../../../../i18n/nl/libtodayaddressbookplugin.ts \ ../../../../../i18n/xx/libtodayaddressbookplugin.ts \ ../../../../../i18n/en/libtodayaddressbookplugin.ts \ ../../../../../i18n/es/libtodayaddressbookplugin.ts \ ../../../../../i18n/fr/libtodayaddressbookplugin.ts \ ../../../../../i18n/hu/libtodayaddressbookplugin.ts \ ../../../../../i18n/ja/libtodayaddressbookplugin.ts \ ../../../../../i18n/ko/libtodayaddressbookplugin.ts \ ../../../../../i18n/no/libtodayaddressbookplugin.ts \ ../../../../../i18n/pl/libtodayaddressbookplugin.ts \ ../../../../../i18n/pt/libtodayaddressbookplugin.ts \ ../../../../../i18n/pt_BR/libtodayaddressbookplugin.ts \ ../../../../../i18n/sl/libtodayaddressbookplugin.ts \ ../../../../../i18n/zh_CN/libtodayaddressbookplugin.ts \ ../../../../../i18n/zh_TW/libtodayaddressbookplugin.ts \ ../../../../../i18n/it/libtodayaddressbookplugin.ts \ ../../../../../i18n/da/libtodayaddressbookplugin.ts include ( $(OPIEDIR)/include.pro ) diff --git a/core/pim/today/plugins/datebook/datebook.pro b/core/pim/today/plugins/datebook/datebook.pro index e0a1dcb..2139f63 100644 --- a/core/pim/today/plugins/datebook/datebook.pro +++ b/core/pim/today/plugins/datebook/datebook.pro @@ -1,39 +1,39 @@ TEMPLATE = lib CONFIG -= moc -CONFIG += qt release +CONFIG += qt plugin release # Input HEADERS = datebookplugin.h datebookpluginimpl.h datebookpluginconfig.h \ datebookevent.h datebookpluginwidget.h SOURCES = datebookplugin.cpp datebookpluginimpl.cpp datebookpluginconfig.cpp \ datebookevent.cpp datebookpluginwidget.cpp INCLUDEPATH += $(OPIEDIR)/include \ ../ ../library DEPENDPATH += $(OPIEDIR)/include \ ../ ../library LIBS+= -lqpe -lopie DESTDIR = $(OPIEDIR)/plugins/today TARGET = todaydatebookplugin TRANSLATIONS = ../../../../../i18n/de/libtodaydatebookplugin.ts \ ../../../../../i18n/nl/libtodaydatebookplugin.ts \ ../../../../../i18n/xx/libtodaydatebookplugin.ts \ ../../../../../i18n/en/libtodaydatebookplugin.ts \ ../../../../../i18n/es/libtodaydatebookplugin.ts \ ../../../../../i18n/fr/libtodaydatebookplugin.ts \ ../../../../../i18n/hu/libtodaydatebookplugin.ts \ ../../../../../i18n/ja/libtodaydatebookplugin.ts \ ../../../../../i18n/ko/libtodaydatebookplugin.ts \ ../../../../../i18n/no/libtodaydatebookplugin.ts \ ../../../../../i18n/pl/libtodaydatebookplugin.ts \ ../../../../../i18n/pt/libtodaydatebookplugin.ts \ ../../../../../i18n/pt_BR/libtodaydatebookplugin.ts \ ../../../../../i18n/sl/libtodaydatebookplugin.ts \ ../../../../../i18n/zh_CN/libtodaydatebookplugin.ts \ ../../../../../i18n/zh_TW/libtodaydatebookplugin.ts \ ../../../../../i18n/it/libtodaydatebookplugin.ts \ ../../../../../i18n/da/libtodaydatebookplugin.ts include ( $(OPIEDIR)/include.pro ) diff --git a/core/pim/today/plugins/mail/mail.pro b/core/pim/today/plugins/mail/mail.pro index 70c484d..421b3a5 100644 --- a/core/pim/today/plugins/mail/mail.pro +++ b/core/pim/today/plugins/mail/mail.pro @@ -1,37 +1,37 @@ TEMPLATE = lib CONFIG -= moc -CONFIG += qt release +CONFIG += qt plugin release # Input HEADERS = mailplugin.h mailpluginimpl.h mailpluginwidget.h SOURCES = mailplugin.cpp mailpluginimpl.cpp mailpluginwidget.cpp INCLUDEPATH += $(OPIEDIR)/include \ ../ ../library DEPENDPATH += $(OPIEDIR)/include \ ../ ../library LIBS+= -lqpe -lopie DESTDIR = $(OPIEDIR)/plugins/today TARGET = todaymailplugin TRANSLATIONS = ../../../../../i18n/de/libtodaymailplugin.ts \ ../../../../../i18n/nl/libtodaymailplugin.ts \ ../../../../../i18n/xx/libtodaymailplugin.ts \ ../../../../../i18n/en/libtodaymailplugin.ts \ ../../../../../i18n/es/libtodaymailplugin.ts \ ../../../../../i18n/fr/libtodaymailplugin.ts \ ../../../../../i18n/hu/libtodaymailplugin.ts \ ../../../../../i18n/ja/libtodaymailplugin.ts \ ../../../../../i18n/ko/libtodaymailplugin.ts \ ../../../../../i18n/no/libtodaymailplugin.ts \ ../../../../../i18n/pl/libtodaymailplugin.ts \ ../../../../../i18n/pt/libtodaymailplugin.ts \ ../../../../../i18n/pt_BR/libtodaymailplugin.ts \ ../../../../../i18n/sl/libtodaymailplugin.ts \ ../../../../../i18n/zh_CN/libtodaymailplugin.ts \ ../../../../../i18n/zh_TW/libtodaymailplugin.ts \ ../../../../../i18n/it/libtodaymailplugin.ts \ ../../../../../i18n/da/libtodaymailplugin.ts include ( $(OPIEDIR)/include.pro ) diff --git a/core/pim/today/plugins/todolist/todolist.pro b/core/pim/today/plugins/todolist/todolist.pro index 31a6a27..c8730bb 100644 --- a/core/pim/today/plugins/todolist/todolist.pro +++ b/core/pim/today/plugins/todolist/todolist.pro @@ -1,40 +1,40 @@ TEMPLATE = lib CONFIG -= moc -CONFIG += qt release +CONFIG += qt plugin release # Input HEADERS = todoplugin.h todopluginimpl.h todopluginconfig.h \ todopluginwidget.h SOURCES = todoplugin.cpp todopluginimpl.cpp todopluginconfig.cpp \ todopluginwidget.cpp INCLUDEPATH += $(OPIEDIR)/include \ ../ ../library DEPENDPATH += $(OPIEDIR)/include \ ../ ../library LIBS+= -lqpe -lopie DESTDIR = $(OPIEDIR)/plugins/today TARGET = todaytodolistplugin TRANSLATIONS = ../../../../../i18n/de/libtodaytodolistplugin.ts \ ../../../../../i18n/nl/libtodaytodolistplugin.ts \ ../../../../../i18n/xx/libtodaytodolistplugin.ts \ ../../../../../i18n/en/libtodaytodolistplugin.ts \ ../../../../../i18n/es/libtodaytodolistplugin.ts \ ../../../../../i18n/fr/libtodaytodolistplugin.ts \ ../../../../../i18n/hu/libtodaytodolistplugin.ts \ ../../../../../i18n/ja/libtodaytodolistplugin.ts \ ../../../../../i18n/ko/libtodaytodolistplugin.ts \ ../../../../../i18n/no/libtodaytodolistplugin.ts \ ../../../../../i18n/pl/libtodaytodolistplugin.ts \ ../../../../../i18n/pt/libtodaytodolistplugin.ts \ ../../../../../i18n/pt_BR/libtodaytodolistplugin.ts \ ../../../../../i18n/sl/libtodaytodolistplugin.ts \ ../../../../../i18n/zh_CN/libtodaytodolistplugin.ts \ ../../../../../i18n/zh_TW/libtodaytodolistplugin.ts \ ../../../../../i18n/it/libtodaytodolistplugin.ts \ ../../../../../i18n/da/libtodaytodolistplugin.ts include ( $(OPIEDIR)/include.pro ) diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index f213943..cb18c1c 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -1,402 +1,409 @@ /* * today.cpp * * copyright : (c) 2002,2003 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #define QTOPIA_INTERNAL_LANGLIST #include "today.h" #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/resource.h> #include <qpe/global.h> #include <qpe/qpeapplication.h> #include <qpe/contact.h> #include <qpe/timestring.h> #include <qdir.h> #include <qfile.h> #include <qtimer.h> #include <qwhatsthis.h> #include <qtranslator.h> struct TodayPlugin { TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} QLibrary *library; QInterfacePtr<TodayPluginInterface> iface; TodayPluginObject *guiPart; QWidget *guiBox; QString name; bool active; bool excludeRefresh; int pos; }; static QValueList<TodayPlugin> pluginList; Today::Today( QWidget* parent, const char* name, WFlags fl ) : TodayBase( parent, name, fl ) { QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); #if defined(Q_WS_QWS) #if !defined(QT_NO_COP) QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); #endif #endif setOwnerField(); m_refreshTimer = new QTimer( this ); connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); m_refreshTimer->start( 15000 ); //init(); loadPlugins(); showMaximized(); } /** * Qcop receive method. */ void Today::channelReceived( const QCString &msg, const QByteArray & data ) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "message(QString)" ) { QString message; stream >> message; setOwnerField( message ); } } void Today::setRefreshTimer( int interval ) { disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); // 0 is "never" case if ( !interval == 0 ) { connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); m_refreshTimer->changeInterval( interval ); } } /** * Initialises the owner field with the default value, the username */ void Today::setOwnerField() { QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); if ( QFile::exists( file ) ) { Contact cont = Contact::readVCard( file )[0]; QString returnString = cont.fullName(); OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); } else { OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); } } /** * Set the owner field with a given QString, for example per qcop. */ void Today::setOwnerField( QString &message ) { if ( !message.isEmpty() ) { OwnerField->setText( "<b>" + message + "</b>" ); } } /** * Init stuff needed for today. Reads the config file. */ void Today::init() { // read config Config cfg( "today" ); cfg.setGroup( "Plugins" ); m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); m_allApplets = cfg.readListEntry( "AllApplets", ',' ); cfg.setGroup( "General" ); m_iconSize = cfg.readNumEntry( "IconSize", 18 ); m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); // set the date in top label QDate date = QDate::currentDate(); DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); if ( layout ) { delete layout; } if ( m_hideBanner ) { Opiezilla->hide(); TodayLabel->hide(); } else { Opiezilla->show(); TodayLabel->show(); } layout = new QVBoxLayout( this ); layout->addWidget( Frame ); layout->addWidget( OwnerField ); } /** * Load the plugins */ void Today::loadPlugins() { init(); QValueList<TodayPlugin>::Iterator tit; if ( !pluginList.isEmpty() ) { for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { (*tit).guiBox->hide(); (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); delete (*tit).guiBox; (*tit).library->unload(); delete (*tit).library; } pluginList.clear(); } QString path = QPEApplication::qpeDir() + "/plugins/today"; + qWarning("Searching for Plugins in: %s", path.latin1()); +#ifdef Q_OS_MACX + QDir dir( path, "lib*.dylib" ); +#else QDir dir( path, "lib*.so" ); +#endif QStringList list = dir.entryList(); QStringList::Iterator it; + qWarning("Found: %d entries !", list.count() ); + QMap<QString, TodayPlugin> tempList; for ( it = list.begin(); it != list.end(); ++it ) { QInterfacePtr<TodayPluginInterface> iface; QLibrary *lib = new QLibrary( path + "/" + *it ); qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() ); qDebug( QString(*it) ); TodayPlugin plugin; plugin.library = lib; plugin.iface = iface; plugin.name = QString(*it); QString type = (*it).left( (*it).find(".") ); // grr, sharp rom does not know Global::languageList(); // QStringList langs = Global::languageList(); QString tfn = QPEApplication::qpeDir() + "/i18n/"; QDir langDir = tfn; QStringList langs = langDir.entryList("*", QDir::Dirs ); for (QStringList::ConstIterator lit = langs.begin(); lit!=langs.end(); ++lit) { QString lang = *lit; qDebug( "Languages: " + lang ); QTranslator * trans = new QTranslator( qApp ); QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm"; if ( trans->load( tfn ) ) { qApp->installTranslator( trans ); } else { delete trans; } } // find out if plugins should be shown if ( m_excludeApplets.grep( *it ).isEmpty() ) { plugin.active = true; } else { plugin.active = false; } plugin.guiPart = plugin.iface->guiPart(); plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); // package the whole thing into a qwidget so it can be shown and hidden plugin.guiBox = new QWidget( this ); QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); QPixmap plugPix; plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); plugIcon->setPixmap( plugPix ); QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); plugIcon->setName( plugin.guiPart->appName() ); connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); // a scrollview for each plugin QScrollView* sv = new QScrollView( plugin.guiBox ); QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); // not sure if that is good .-) sv->setMinimumHeight( 12 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setHScrollBarMode( QScrollView::AlwaysOff ); sv->setFrameShape( QFrame::NoFrame ); sv->addChild( plugWidget ); // make sure the icon is on the top alligned boxLayout->addWidget( plugIcon, 0, AlignTop ); boxLayout->addWidget( sv, 0, AlignTop ); boxLayout->setStretchFactor( plugIcon, 1 ); boxLayout->setStretchFactor( sv, 9 ); // "prebuffer" it in one more list, to get the sorting done tempList.insert( plugin.name, plugin ); // on first start the list is off course empty if ( m_allApplets.isEmpty() ) { layout->addWidget( plugin.guiBox ); pluginList.append( plugin ); } // if plugin is not yet in the list, add it to the layout too else if ( !m_allApplets.contains( plugin.name ) ) { layout->addWidget( plugin.guiBox ); pluginList.append( plugin ); } } else { qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); delete lib; } } if ( !m_allApplets.isEmpty() ) { TodayPlugin tempPlugin; QStringList::Iterator stringit; for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { tempPlugin = ( tempList.find( *stringit ) ).data(); if ( !( (tempPlugin.name).isEmpty() ) ) { layout->addWidget( tempPlugin.guiBox ); pluginList.append( tempPlugin ); } } } draw(); } /** * Repaint method. Reread all fields. */ void Today::draw() { if ( pluginList.count() == 0 ) { QLabel *noPlugins = new QLabel( this ); noPlugins->setText( tr( "No plugins found" ) ); layout->addWidget( noPlugins ); return; } uint count = 0; TodayPlugin plugin; for ( uint i = 0; i < pluginList.count(); i++ ) { plugin = pluginList[i]; if ( plugin.active ) { // qDebug( plugin.name + " is ACTIVE " ); plugin.guiBox->show(); } else { // qDebug( plugin.name + " is INACTIVE" ); plugin.guiBox->hide(); } count++; } if ( count == 0 ) { QLabel *noPluginsActive = new QLabel( this ); noPluginsActive->setText( tr( "No plugins activated" ) ); layout->addWidget( noPluginsActive ); } layout->addStretch(0); } /** * The method for the configuration dialog. */ void Today::startConfig() { // disconnect timer to prevent problems while being on config dialog disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); m_refreshTimer->stop( ); TodayConfig conf( this, "dialog", true ); TodayPlugin plugin; QList<TodayConfigWidget> configWidgetList; for ( int i = pluginList.count() - 1; i >= 0; i-- ) { plugin = pluginList[i]; // load the config widgets in the tabs if ( plugin.guiPart->configWidget( this ) != 0l ) { TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); configWidgetList.append( widget ); conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() , plugin.guiPart->appName() ); } // set the order/activate tab conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); } if ( conf.exec() == QDialog::Accepted ) { conf.writeConfig(); TodayConfigWidget *confWidget; for ( confWidget = configWidgetList.first(); confWidget != 0; confWidget = configWidgetList.next() ) { confWidget->writeConfig(); } loadPlugins(); } else { // since refresh is not called in that case , reconnect the signal m_refreshTimer->start( 15000 ); // get the config value in here later connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); } } /** * Refresh for the view. Reload all applets * */ void Today::refresh() { init(); QValueList<TodayPlugin>::Iterator it; for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { if ( !(*it).excludeRefresh ) { (*it).guiPart->refresh(); layout->addWidget( (*it).guiBox ); qDebug( "refresh" ); } } layout->addStretch(0); } void Today::startApplication() { QCopEnvelope e( "QPE/System", "execute(QString)" ); e << QString( sender()->name() ); } /** * launch addressbook (personal card) */ void Today::editCard() { QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); } Today::~Today() { } diff --git a/core/qws/transferserver.cpp b/core/qws/transferserver.cpp index 0337a94..239c824 100644 --- a/core/qws/transferserver.cpp +++ b/core/qws/transferserver.cpp @@ -1,500 +1,519 @@ /********************************************************************** ** 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. ** **********************************************************************/ #define _XOPEN_SOURCE #include <pwd.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> #include <time.h> + +#ifndef Q_OS_MACX #include <shadow.h> +#endif /* Q_OS_MACX */ /* we need the _OS_LINUX stuff first ! */ #include <qglobal.h> #ifndef _OS_LINUX_ +// Is anybody able to review this ? The include "uuid/uuid.h" couldn't be found +// anywhere ? Therfore I removed it completely.. +// I think it should be made permanentyl !? (eilers) +#warning "Where should uuid/uuid.h be found ? Removed this part .. (eilers)" +#if 0 extern "C" { #include <uuid/uuid.h> #define UUID_H_INCLUDED } +#endif + #endif // not defined linux #if defined(_OS_LINUX_) #include <shadow.h> +#elif defined(Q_OS_MACX) +#include <stdlib.h> #endif #include <qdir.h> #include <qfile.h> #include <qtextstream.h> #include <qdatastream.h> #include <qmessagebox.h> #include <qstringlist.h> #include <qfileinfo.h> #include <qregexp.h> //#include <qpe/qcopchannel_qws.h> #include <qpe/process.h> #include <qpe/global.h> #include <qpe/config.h> #include <qpe/contact.h> #include <qpe/quuid.h> #include <qpe/version.h> #include <qpe/qcopenvelope_qws.h> #include "transferserver.h" #include <opie/oprocess.h> const int block_size = 51200; TransferServer::TransferServer( Q_UINT16 port, QObject *parent , const char* name ) : QServerSocket( port, 1, parent, name ) { if ( !ok() ) qWarning( "Failed to bind to port %d", port ); } TransferServer::~TransferServer() { } void TransferServer::newConnection( int socket ) { (void) new ServerPI( socket, this ); } /* * small class in anonymous namespace * to generate a QUUid for us */ namespace { struct UidGen { QString uuid(); }; -#if !defined(_OS_LINUX_) - +#if defined(Q_OS_MACX) QString UidGen::uuid() { - uuid_t uuid; - uuid_generate( uuid ); - return QUUid( uuid ).toString(); + srandom( random() ); + QString numStr = QString::number( random() ); + + return "{" + numStr + "}"; } -#else +#elif defined(_OS_LINUX_) /* * linux got a /proc/sys/kernel/random/uuid file * it'll generate the uuids for us */ QString UidGen::uuid() { QFile file( "/proc/sys/kernel/random/uuid" ); if (!file.open(IO_ReadOnly ) ) return QString::null; QTextStream stream(&file); return "{" + stream.read().stripWhiteSpace() + "}"; } +#else +QString UidGen::uuid() +{ + uuid_t uuid; + ::uuid_generate( uuid ); + return QUUid( uuid ).toString(); +} #endif } QString SyncAuthentication::serverId() { Config cfg("Security"); cfg.setGroup("Sync"); QString r = cfg.readEntry("serverid"); if ( r.isEmpty() ) { UidGen gen; r = gen.uuid(); cfg.writeEntry("serverid", r ); } return r; } QString SyncAuthentication::ownerName() { QString vfilename = Global::applicationFileName("addressbook", "businesscard.vcf"); if (QFile::exists(vfilename)) { Contact c; c = Contact::readVCard( vfilename )[0]; return c.fullName(); } return ""; } QString SyncAuthentication::loginName() { struct passwd *pw; pw = getpwuid( geteuid() ); return QString::fromLocal8Bit( pw->pw_name ); } int SyncAuthentication::isAuthorized(QHostAddress peeraddress) { Config cfg("Security"); cfg.setGroup("Sync"); // QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0"); uint auth_peer = cfg.readNumEntry("auth_peer", 0xc0a80100); // QHostAddress allowed; // allowed.setAddress(allowedstr); // uint auth_peer = allowed.ip4Addr(); uint auth_peer_bits = cfg.readNumEntry("auth_peer_bits", 24); uint mask = auth_peer_bits >= 32 // shifting by 32 is not defined ? 0xffffffff : (((1 << auth_peer_bits) - 1) << (32 - auth_peer_bits)); return (peeraddress.ip4Addr() & mask) == auth_peer; } bool SyncAuthentication::checkUser( const QString& user ) { if ( user.isEmpty() ) return FALSE; QString euser = loginName(); return user == euser; } bool SyncAuthentication::checkPassword( const QString& password ) { #ifdef ALLOW_UNIX_USER_FTP // First, check system password... struct passwd *pw = 0; struct spwd *spw = 0; pw = getpwuid( geteuid() ); spw = getspnam( pw->pw_name ); QString cpwd = QString::fromLocal8Bit( pw->pw_passwd ); if ( cpwd == "x" && spw ) cpwd = QString::fromLocal8Bit( spw->sp_pwdp ); // Note: some systems use more than crypt for passwords. QString cpassword = QString::fromLocal8Bit( crypt( password.local8Bit(), cpwd.local8Bit() ) ); if ( cpwd == cpassword ) return TRUE; #endif static int lastdenial = 0; static int denials = 0; int now = time(0); // Detect old Qtopia Desktop (no password) if ( password.isEmpty() ) { if ( denials < 1 || now > lastdenial + 600 ) { QMessageBox::warning( 0, tr("Sync Connection"), tr("<p>An unauthorized system is requesting access to this device." "<p>If you are using a version of Qtopia Desktop older than 1.5.1, " "please upgrade."), tr("Deny") ); denials++; lastdenial = now; } return FALSE; } // Second, check sync password... QString pass = password.left(6); /* old QtopiaDesktops are sending * rootme newer versions got a Qtopia * prefixed. Qtopia prefix will suceed * until the sync software syncs up * FIXME */ if ( pass == "rootme" || pass == "Qtopia") { QString cpassword = QString::fromLocal8Bit( crypt( password.mid(8).local8Bit(), "qp" ) ); Config cfg("Security"); cfg.setGroup("Sync"); QString pwds = cfg.readEntry("Passwords"); if ( QStringList::split(QChar(' '), pwds).contains(cpassword) ) return TRUE; // Unrecognized system. Be careful... if ( (denials > 2 && now < lastdenial + 600) || QMessageBox::warning(0, tr("Sync Connection"), tr("<p>An unrecognized system is requesting access to this device." "<p>If you have just initiated a Sync for the first time, this is normal."), tr("Allow"), tr("Deny"), 0, 1, 1 ) == 1 ) { denials++; lastdenial = now; return FALSE; } else { denials = 0; cfg.writeEntry("Passwords", pwds + " " + cpassword); return TRUE; } } return FALSE; } ServerPI::ServerPI( int socket, QObject *parent , const char* name ) : QSocket( parent, name ) , dtp( 0 ), serversocket( 0 ), waitsocket( 0 ) { state = Connected; setSocket( socket ); peerport = peerPort(); peeraddress = peerAddress(); #ifndef INSECURE if ( !SyncAuthentication::isAuthorized(peeraddress) ) { state = Forbidden; startTimer( 0 ); } else #endif { connect( this, SIGNAL( readyRead() ), SLOT( read() ) ); connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); passiv = FALSE; for ( int i = 0; i < 4; i++ ) wait[i] = FALSE; send( "220 Qtopia " QPE_VERSION " FTP Server" ); state = Wait_USER; dtp = new ServerDTP( this ); connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) ); connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) ); connect( dtp, SIGNAL( error( int ) ), SLOT( dtpError( int ) ) ); directory = QDir::currentDirPath(); static int p = 1024; while ( !serversocket || !serversocket->ok() ) { delete serversocket; serversocket = new ServerSocket( ++p, this ); } connect( serversocket, SIGNAL( newIncomming( int ) ), SLOT( newConnection( int ) ) ); } } ServerPI::~ServerPI() { } void ServerPI::connectionClosed() { // qDebug( "Debug: Connection closed" ); delete this; } void ServerPI::send( const QString& msg ) { QTextStream os( this ); os << msg << endl; //qDebug( "Reply: %s", msg.latin1() ); } void ServerPI::read() { while ( canReadLine() ) process( readLine().stripWhiteSpace() ); } bool ServerPI::checkReadFile( const QString& file ) { QString filename; if ( file[0] != "/" ) filename = directory.path() + "/" + file; else filename = file; QFileInfo fi( filename ); return ( fi.exists() && fi.isReadable() ); } bool ServerPI::checkWriteFile( const QString& file ) { QString filename; if ( file[0] != "/" ) filename = directory.path() + "/" + file; else filename = file; QFileInfo fi( filename ); if ( fi.exists() ) if ( !QFile( filename ).remove() ) return FALSE; return TRUE; } void ServerPI::process( const QString& message ) { //qDebug( "Command: %s", message.latin1() ); // split message using "," as separator QStringList msg = QStringList::split( " ", message ); if ( msg.isEmpty() ) return ; // command token QString cmd = msg[0].upper(); // argument token QString arg; if ( msg.count() >= 2 ) arg = msg[1]; // full argument string QString args; if ( msg.count() >= 2 ) { QStringList copy( msg ); // FIXME: for Qt3 // copy.pop_front() copy.remove( copy.begin() ); args = copy.join( " " ); } //qDebug( "args: %s", args.latin1() ); // we always respond to QUIT, regardless of state if ( cmd == "QUIT" ) { send( "211 Good bye!" ); delete this; return ; } // connected to client if ( Connected == state ) return ; // waiting for user name if ( Wait_USER == state ) { if ( cmd != "USER" || msg.count() < 2 || !SyncAuthentication::checkUser( arg ) ) { send( "530 Please login with USER and PASS" ); return ; } send( "331 User name ok, need password" ); state = Wait_PASS; return ; } // waiting for password if ( Wait_PASS == state ) { if ( cmd != "PASS" || !SyncAuthentication::checkPassword( arg ) ) { send( "530 Please login with USER and PASS" ); return ; } send( "230 User logged in, proceed" ); state = Ready; return ; } // ACCESS CONTROL COMMANDS // account (ACCT) if ( cmd == "ACCT" ) { // even wu-ftp does not support it send( "502 Command not implemented" ); } // change working directory (CWD) else if ( cmd == "CWD" ) { if ( !args.isEmpty() ) { if ( directory.cd( args, TRUE ) ) send( "250 Requested file action okay, completed" ); else send( "550 Requested action not taken" ); } else send( "500 Syntax error, command unrecognized" ); } // change to parent directory (CDUP) else if ( cmd == "CDUP" ) { if ( directory.cdUp() ) send( "250 Requested file action okay, completed" ); else send( "550 Requested action not taken" ); } // structure mount (SMNT) else if ( cmd == "SMNT" ) { // even wu-ftp does not support it send( "502 Command not implemented" ); } // reinitialize (REIN) else if ( cmd == "REIN" ) { // even wu-ftp does not support it send( "502 Command not implemented" ); } // TRANSFER PARAMETER COMMANDS // data port (PORT) else if ( cmd == "PORT" ) { if ( parsePort( arg ) ) send( "200 Command okay" ); else send( "500 Syntax error, command unrecognized" ); } // passive (PASV) else if ( cmd == "PASV" ) { passiv = TRUE; send( "227 Entering Passive Mode (" + address().toString().replace( QRegExp( "\\." ), "," ) + "," + QString::number( ( serversocket->port() ) >> 8 ) + "," + QString::number( ( serversocket->port() ) & 0xFF ) + ")" ); } // representation type (TYPE) else if ( cmd == "TYPE" ) { if ( arg.upper() == "A" || arg.upper() == "I" ) send( "200 Command okay" ); else send( "504 Command not implemented for that parameter" ); } // file structure (STRU) else if ( cmd == "STRU" ) { if ( arg.upper() == "F" ) send( "200 Command okay" ); else send( "504 Command not implemented for that parameter" ); } // transfer mode (MODE) else if ( cmd == "MODE" ) { if ( arg.upper() == "S" ) diff --git a/core/settings/launcher/menusettings.cpp b/core/settings/launcher/menusettings.cpp index 5a9fada..6fca621 100644 --- a/core/settings/launcher/menusettings.cpp +++ b/core/settings/launcher/menusettings.cpp @@ -1,159 +1,163 @@ /* This file is part of the OPIE Project =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "menusettings.h" #include <qpe/config.h> #include <qpe/qlibrary.h> #include <qpe/qpeapplication.h> #include <qpe/menuappletinterface.h> #include <qpe/qcopenvelope_qws.h> #include <qdir.h> #include <qlistview.h> #include <qcheckbox.h> #include <qheader.h> #include <qlayout.h> #include <qlabel.h> #include <qwhatsthis.h> #include <stdlib.h> MenuSettings::MenuSettings ( QWidget *parent, const char *name ) : QWidget ( parent, name ) { m_applets_changed = false; QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this ); lay-> addWidget ( l ); m_list = new QListView ( this ); m_list-> addColumn ( "foobar" ); m_list-> header ( )-> hide ( ); lay-> addWidget ( m_list ); m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this ); lay-> addWidget ( m_menutabs ); QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." )); QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." )); connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); init ( ); } void MenuSettings::init ( ) { Config cfg ( "StartMenu" ); cfg. setGroup ( "Applets" ); QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; +#ifdef Q_OS_MACX + QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); +#else QStringList list = QDir ( path, "lib*.so" ). entryList ( ); +#endif /* Q_OS_MACX */ for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { QString name; QPixmap icon; MenuAppletInterface *iface = 0; QLibrary *lib = new QLibrary ( path + "/" + *it ); lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); if ( iface ) { QString lang = getenv( "LANG" ); QTranslator *trans = new QTranslator ( qApp ); QString type = (*it). left ((*it). find (".")); QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; if ( trans-> load ( tfn )) qApp-> installTranslator ( trans ); else delete trans; name = iface-> name ( ); icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal ); iface-> release ( ); lib-> unload ( ); QCheckListItem *item; item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); if ( !icon. isNull ( )) item-> setPixmap ( 0, icon ); item-> setOn ( exclude. find ( *it ) == exclude. end ( )); m_applets [*it] = item; } else { delete lib; } } cfg. setGroup ( "Menu" ); m_menutabs-> setChecked ( cfg. readBoolEntry ( "LauncherTabs", true )); } void MenuSettings::appletChanged() { m_applets_changed = true; } void MenuSettings::accept ( ) { bool apps_changed = false; Config cfg ( "StartMenu" ); cfg. setGroup ( "Applets" ); if ( m_applets_changed ) { QStringList exclude; QMap <QString, QCheckListItem *>::Iterator it; for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { if ( !(*it)-> isOn ( )) exclude << it. key ( ); } cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); } cfg. writeEntry ( "SafeMode", false ); cfg. setGroup ( "Menu" ); if ( m_menutabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) { apps_changed = true; cfg. writeEntry ( "LauncherTabs", m_menutabs-> isChecked ( )); } cfg. write ( ); if ( m_applets_changed ) { QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" ); m_applets_changed = false; } if ( apps_changed ) { QCopEnvelope ( "QPE/TaskBar", "reloadApps()" ); } } diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp index b3e302a..d03ea49 100644 --- a/core/settings/launcher/taskbarsettings.cpp +++ b/core/settings/launcher/taskbarsettings.cpp @@ -1,156 +1,173 @@ /* This file is part of the OPIE Project =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "taskbarsettings.h" #include <qpe/config.h> #include <qpe/qlibrary.h> #include <qpe/qpeapplication.h> #include <qpe/taskbarappletinterface.h> #include <qpe/qcopenvelope_qws.h> #include <qdir.h> #include <qlistview.h> #include <qcheckbox.h> #include <qheader.h> #include <qlayout.h> #include <qlabel.h> #include <qwhatsthis.h> #include <stdlib.h> TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) : QWidget ( parent, name ) { m_applets_changed = false; QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this ); lay-> addWidget ( l ); m_list = new QListView ( this ); m_list-> addColumn ( "foobar" ); m_list-> header ( )-> hide ( ); lay-> addWidget ( m_list ); QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); init ( ); } void TaskbarSettings::init ( ) { Config cfg ( "Taskbar" ); cfg. setGroup ( "Applets" ); QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; +#ifdef Q_OS_MACX + QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); +#else QStringList list = QDir ( path, "lib*.so" ). entryList ( ); +#endif /* Q_OS_MACX */ for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { QString name; QPixmap icon; TaskbarNamedAppletInterface *iface = 0; + qWarning("Load applet: %s", (*it).latin1() ); QLibrary *lib = new QLibrary ( path + "/" + *it ); lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); + qWarning("<1>"); if ( iface ) { + qWarning("<2>"); QString lang = getenv( "LANG" ); QTranslator *trans = new QTranslator ( qApp ); QString type = (*it). left ((*it). find (".")); QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; if ( trans-> load ( tfn )) qApp-> installTranslator ( trans ); else delete trans; name = iface-> name ( ); icon = iface-> icon ( ); iface-> release ( ); } + qWarning("<3>"); if ( !iface ) { + qWarning("<4>"); lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); if ( iface ) { + qWarning("<5>"); name = (*it). mid ( 3 ); + qWarning("Found applet: %s", name.latin1() ); +#ifdef Q_OS_MACX + int sep = name. find( ".dylib" ); +#else int sep = name. find( ".so" ); +#endif /* Q_OS_MACX */ if ( sep > 0 ) name. truncate ( sep ); sep = name. find ( "applet" ); if ( sep == (int) name.length ( ) - 6 ) name. truncate ( sep ); name[0] = name[0]. upper ( ); iface-> release ( ); } } + qWarning("<6>"); if ( iface ) { + qWarning("<7>"); QCheckListItem *item; item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); if ( !icon. isNull ( )) item-> setPixmap ( 0, icon ); item-> setOn ( exclude. find ( *it ) == exclude. end ( )); m_applets [*it] = item; } lib-> unload ( ); delete lib; } } void TaskbarSettings::appletChanged() { m_applets_changed = true; } void TaskbarSettings::accept ( ) { Config cfg ( "Taskbar" ); cfg. setGroup ( "Applets" ); if ( m_applets_changed ) { QStringList exclude; QMap <QString, QCheckListItem *>::Iterator it; for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { if ( !(*it)-> isOn ( )) exclude << it. key ( ); } cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); } cfg. writeEntry ( "SafeMode", false ); cfg. write ( ); if ( m_applets_changed ) { QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" ); m_applets_changed = false; } } diff --git a/development/keyview/keyview.pro b/development/keyview/keyview.pro index 70cc171..ca657bd 100644 --- a/development/keyview/keyview.pro +++ b/development/keyview/keyview.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -#CONFIG = qt warn_on debug -CONFIG = qt warn_on release +#CONFIG = qt plugin warn_on debug +CONFIG = qt plugin warn_on release HEADERS = keyview.h keyboardimpl.h SOURCES = keyview.cpp keyboardimpl.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include ../../launcher LIBS += -lqpe INTERFACES = TARGET = keyview DESTDIR = $(OPIEDIR)/plugins/inputmethods TRANSLATIONS = ../i18n/de/keyview.ts \ ../i18n/nl/keyview.ts \ ../i18n/da/keyview.ts \ ../i18n/xx/keyview.ts \ ../i18n/en/keyview.ts \ ../i18n/es/keyview.ts \ ../i18n/fr/keyview.ts \ ../i18n/hu/keyview.ts \ ../i18n/ja/keyview.ts \ ../i18n/ko/keyview.ts \ ../i18n/no/keyview.ts \ ../i18n/pl/keyview.ts \ ../i18n/pt/keyview.ts \ ../i18n/pt_BR/keyview.ts \ ../i18n/sl/keyview.ts \ ../i18n/zh_CN/keyview.ts \ ../i18n/zh_TW/keyview.ts include ( $(OPIEDIR)/include.pro ) diff --git a/development/macosx/README_MACOSX b/development/macosx/README_MACOSX new file mode 100644 index 0000000..e2ed15f --- a/dev/null +++ b/development/macosx/README_MACOSX @@ -0,0 +1,91 @@ +Information about porting Opie to MacOS-X (eilers) +================================================== + +Credits: +-------- + +Special thanks to xxxx for its patches for qt-X11 (2.3.2), QT/E (2.3.5) and qtopia (1.6.1). +Without them, I wouldn't be able to provide the port for OPIE to MacOS-X that fast.. + +Status: +------- +The basic system works quite well. But a lot of applications and plugins, +which are platform specific, need some work to be compileable. + +What is ready: + +libqpe +libopie1 +pim-applications (addressbook, todolist, datebook, today) +A lot of applications and plugins which are not platform specific. + +What will follow soon: + +libopie2 + +Remember: A lot of configuration-settings are not tested (as for instance +the quicklauncher) and might fail to compile. +If you want to avoid misconfigurations, you may want to start with +the config-file in this directory. Just copy "config_macosx" to $OPIEDIR/.config +to get a working configuration to start with. + +(The missing apps/plugins will be ported on demand.) + +How to compile Opie for MacOS-X: +------------------------------- + +Before compiling for MacOS-X, you need the following: + +1. X11-Server (Provided by Apple) +2. QT-2.3.2 for X11 +3. QT/E-2.3.7 +4. Patches for QT-2.3.2 for MacOSX +5. Patches for QT/E-2.3.7 for MacOSX + +Please follow the instructions by xxxx how to create a buildsystem +for your Mac. +What is different to the previous desciption: +You don't need Qtopia ! +It is recommended to use QT/E in version 2.3.7 instead of 2.3.5 as described. +The Patch for QT/E for Opie, including all other opie-patches is available in the +qt-directory ($OPIEDIR/qt) and is called "qte237-all-macosx.patch" + +If your buildsystem is working correctly, you should be able to build +opie. You have to enter "make menuconfig" and set +"Build Parameters"->"Target Machine"->"Mac OS X (DARWIN)" +activate the platform specific changes. + +You will see that a lot of applications and plugins/applets will not compile +successfully, due to the fact that they are not ported to this platform. +You may disable them to be able to compile the rest. + + +Information for Developers: +--------------------------- + +1. Platform specific code should be surrounded by +#ifdef Q_OS_MACX +MACOS-X CODE +#else +OTHER-CODE +#endif + +2. The Plugin-Handling by MacOS-X is different than it is by Linux. +On linux-systems, shared libraries are not different to dynamic loaded libraries +(aka plugins). They just are different whether they are loaded automatically +at startup or manually by any application. +On MacOS-X, the plugins are loaded by a special mechanism and must be in a special +binary format. Therefore you have to add the term "plugin" to the CONFIG-clause, as +for instance: + +TEMPLATE=lib +CONFIG += qt plugin release + +If you don't add "plugin" you will get a shared library which is not loadable +(Error-Code: NSObjectFileImageInappropriateFile (2))! + + + +For problems, help and flames, feel free to contact me at + +eilers.stefan@epost.de
\ No newline at end of file diff --git a/development/macosx/config_macosx b/development/macosx/config_macosx new file mode 100644 index 0000000..eb0792f --- a/dev/null +++ b/development/macosx/config_macosx @@ -0,0 +1,290 @@ +# +# Automatically generated make config: don't edit +# + +# +# Build Parameters +# +# CONFIG_TARGET_X86 is not set +CONFIG_TARGET_MACOSX=y +# CONFIG_TARGET_SHARP is not set +# CONFIG_TARGET_IPAQ is not set +# CONFIG_TARGET_RAMSES is not set +# CONFIG_TARGET_SIMPAD is not set +# CONFIG_TARGET_YOPY is not set +# CONFIG_OPTIMIZE is not set +CONFIG_DEBUG=y +CONFIG_QUICK_LAUNCH=y +# CONFIG_OPIE_NO_OVERRIDE_QT is not set +CONFIG_SPECFILE="qws/macx-generic-g++" +CONFIG_EXPERIMENTAL=y + +# +# Base +# +CONFIG_LIBQPE=y +# CONFIG_X11 is not set +CONFIG_LIBOPIE=y +# CONFIG_OPIE-LOGIN is not set +# CONFIG_OPIEALARM is not set +CONFIG_LAUNCHER=y +CONFIG_PRELOAD=y +CONFIG_LAUNCHER_CORE=y +CONFIG_QWS=y + +# +# +# + +# +# Applets +# +CONFIG_BATTERYAPPLET=y +# CONFIG_CARDMON is not set +CONFIG_CLIPBOARDAPPLET=y +CONFIG_CLOCKAPPLET=y +CONFIG_HOMEAPPLET=y +# CONFIG_IRDAAPPLET is not set +# CONFIG_LOGOUTAPPLET is not set +# CONFIG_OBEXAPPLET is not set +# CONFIG_OBEX is not set +# CONFIG_RESTARTAPPLET is not set +# CONFIG_ROTATEAPPLET is not set +# CONFIG_SCREENSHOTAPPLET is not set +# CONFIG_SUSPENDAPPLET is not set +# CONFIG_VMEMO is not set +# CONFIG_VOLUMEAPPLET is not set +# CONFIG_VTAPPLET is not set + +# +# Network applet needs a libqpe and libopie2 (core, ui, net) +# +CONFIG_NOTESAPPLET=y +# CONFIG_WIRELESSAPPLET is not set + +# +# Apps +# +# CONFIG_CALIBRATE is not set +# CONFIG_EMBEDDEDKONSOLE is not set +CONFIG_FILEBROWSER=y +CONFIG_HELPBROWSER=y +# CONFIG_OAPP is not set +CONFIG_OIPKG=y +CONFIG_QCOP=y +CONFIG_TEXTEDIT=y +# CONFIG_ADVANCEDFM is not set +# CONFIG_AQPKG is not set +CONFIG_CHECKBOOK=y +# CONFIG_ODICT is not set +# CONFIG_BARTENDER is not set +# CONFIG_OPIE-CONSOLE is not set +# CONFIG_OPIE-READER is not set +CONFIG_OPIE-SHEET=y +CONFIG_OPIE-WRITE=y +CONFIG_OXYGEN=y +CONFIG_SYSINFO=y +CONFIG_TABLEVIEWER=y +CONFIG_TINYKATE=y +CONFIG_LIBKATE=y +# CONFIG_ZSAFE is not set + +# +# Communications and Networking +# +# CONFIG_GSMTOOL is not set +# CONFIG_KEYPEBBLE is not set +# CONFIG_MOBILEMSG is not set +# CONFIG_MAIL is not set +# CONFIG_FTPLIB is not set +# CONFIG_MAILIT is not set +# CONFIG_OPIEIRC is not set +# CONFIG_OPIE-RDESKTOP is not set +# CONFIG_UBROWSER is not set + +# +# wellenreiter needs libqpe, libopie1 and libopie2 (core+net+ui) +# + +# +# Games +# +CONFIG_BACKGAMMON=y +CONFIG_BOUNCE=y +CONFIG_BUZZWORD=y +CONFIG_FIFTEEN=y +CONFIG_GO=y +CONFIG_KBILL=y +CONFIG_KCHECKERS=y +CONFIG_KPACMAN=y +CONFIG_MINDBREAKER=y +CONFIG_MINESWEEP=y +# CONFIG_WORDGAME is not set +CONFIG_PARASHOOT=y +CONFIG_QASTEROIDS=y +# CONFIG_SFCAVE is not set +# CONFIG_SFCAVE-SDL is not set +# CONFIG_SNAKE is not set +CONFIG_SOLITAIRE=y +# CONFIG_TETRIX is not set +# CONFIG_TICTAC is not set + +# +# Graphics and Multimedia +# +# CONFIG_FREETYPE is not set +CONFIG_DRAWPAD=y +# CONFIG_QPDF is not set +# CONFIG_OPIEPLAYER is not set + +# +# opie-camera needs a libqpe, libopie and libopie2core +# +# CONFIG_OPIEPLAYER2 is not set +# CONFIG_OPIEREC is not set +CONFIG_SHOWIMG=y + +# +# Input methods +# +# CONFIG_DASHER is not set +# CONFIG_DVORAK is not set +CONFIG_HANDWRITING=y + +# +# opie-handwriting-classicset automatically selected +# + +# +# opie-handwriting-graffitiset automatically selected +# +CONFIG_JUMPX=y +# CONFIG_KEYBOARD is not set +CONFIG_KJUMPX=y +# CONFIG_MULTIKEY is not set +CONFIG_PICKBOARD=y +CONFIG_UNIKEYBOARD=y + +# +# Pim +# +CONFIG_ADDRESSBOOK=y +CONFIG_DATEBOOK=y +CONFIG_OSEARCH=y +CONFIG_TODAY=y +CONFIG_TODO=y + +# +# Today Plugins +# +# CONFIG_TODAY_FORTUNE is not set +# CONFIG_TODAY_STOCKTICKER is not set +# CONFIG_TODAY_WEATHER is not set +CONFIG_TODAY_ADDRESSBOOK=y +CONFIG_TODAY_DATEBOOK=y +CONFIG_TODAY_MAIL=y +CONFIG_TODAY_TODOLIST=y + +# +# Settings +# +CONFIG_BUTTON-SETTINGS=y +CONFIG_CITYTIME=y +CONFIG_LAUNCHER-SETTINGS=y +CONFIG_LIGHT-AND-POWER=y +CONFIG_SECURITY=y +CONFIG_APPEARANCE2=y +CONFIG_BACKUP=y +CONFIG_LANGUAGE=y +CONFIG_MEDIUMMOUNT=y +CONFIG_NETSYSTEMTIME=y +# CONFIG_NETWORKSETUP is not set +# CONFIG_SOUND is not set +# CONFIG_SSHKEYS is not set +CONFIG_TABMANAGER=y +# CONFIG_USERMANAGER is not set + +# +# Theming +# + +# +# Decorations +# +CONFIG_DECO_FLAT=y +CONFIG_DECO_LIQUID=y +CONFIG_DECO_POLISHED=y + +# +# Styles +# +CONFIG_FLAT=y +CONFIG_FRESH=y +CONFIG_LIQUID=y +CONFIG_METAL=y +CONFIG_THEME=y + +# +# Tools +# +CONFIG_CALCULATOR=y +CONFIG_CLOCK=y +CONFIG_EUROCONV=y +# CONFIG_FORMATTER is not set +CONFIG_OPIE-SH=y +# CONFIG_REMOTE is not set + +# +# Development +# +# CONFIG_KEYVIEW is not set + +# +# Examples +# +# CONFIG_EXAMPLES is not set + +# +# +# + +# +# Experimental +# + +# +# libopie2 +# +# CONFIG_LIBOPIE2CORE is not set + +# +# libopie2db needs a libqpe and libopie2core +# + +# +# libopie2net needs a libqpe and libopie2core +# + +# +# libopie2pim needs a libqpe and libopie2core +# + +# +# libopie2ui needs a libqpe and libopie2core +# + +# +# libopie2mm needs a libqpe and libopie2core +# + +# +# +# + +# +# the examples need a libqpe, libopie2core, libopie2db, libopie2net, libopie2pim, libopie2ui and libopie2mm +# + +# +# SQL-Support needs libopie2db! +# diff --git a/include.pro b/include.pro index 70ed731..4bdcaa7 100644 --- a/include.pro +++ b/include.pro @@ -1,105 +1,115 @@ include ( $(OPIEDIR)/gen.pro ) # base opie install path -prefix = /opt/QtPalmtop +# prefix = /opt/QtPalmtop ??? Why here (eilers) ??? +prefix = $(OPIEDIR) contains( CONFIG, quick-app-lib ) { TEMPLATE = lib DESTDIR = $(OPIEDIR)/plugins/application DEFINES += OPIE_APP_INTERFACE !contains( TARGET, launcher ) { message( Linking $$TARGET to quicklauncher ) system( rm -f $$(OPIEDIR)/bin/$$TARGET ) system( ln -s quicklauncher $$(OPIEDIR)/bin/$$TARGET ) } } contains ( CONFIG, quick-app-bin ) { TEMPLATE = app DESTDIR = $(OPIEDIR)/bin DEFINES -= OPIE_APP_INTERFACE message( Touching plugins/application/lib$${TARGET}.so ) system( touch $$(OPIEDIR)/plugins/application/lib$${TARGET}.so ) } contains( TEMPLATE, lib ) { target.path = $$prefix/lib } !contains( TEMPLATE, lib ) { target.path = $$prefix/bin } INSTALLS += target # ipkg control files control.path = /CONTROL control.files = control postinst prerm postrm preinst conffiles INSTALLS += control # images, default is $$prefix/pics/$$TARGET pics.path = $$prefix/pics/$$TARGET pics.files = pics/* INSTALLS += pics # sounds, default path is $$prefix/sounds/$$TARGET sounds.path = $$prefix/sounds/$$TARGET sounds.files = sounds/* INSTALLS += sounds # init scripts, default path is /etc/init.d init.path = /etc/init.d init.files = init.d/* INSTALLS += init # data, default path is /usr/share/$$TARGET data.path = /usr/share/$$TARGET data.files = share/* INSTALLS += data etc.path = $$prefix/etc/ etc.files = etc/* INSTALLS += etc apps.path = $$prefix/apps/ apps.files = apps/* INSTALLS += apps # sounds, default path is $$prefix/sounds/$$TARGET sounds.path = $$prefix/sounds/$$TARGET sounds.files = sounds/* INSTALLS += sounds # anything in nonstandard paths root.path = / root.files = root/* INSTALLS += root # new targets opie-lupdate.target = opie-lupdate opie-lupdate.commands = opie-lupdate $(PRO) opie-lrelease.target = opie-lrelease opie-lrelease.commands = opie-lrelease $(PRO) lupdate.target = lupdate lupdate.commands = lupdate -noobsolete $(PRO) lrelease.target = lrelease lrelease.commands = lrelease $(PRO) # new message target to get all strings from the apps with and without tr messages.target = messages messages.commands = xgettext -C -n -ktr -kQT_TRANSLATE_NOOP $$HEADERS $$SOURCES -o '$(OPIEDIR)/messages-$(QMAKE_TARGET)-tr.po' && xgettext -C -n -a $$HEADERS $$SOURCES -o '$(OPIEDIR)/messages-$(QMAKE_TARGET)-allstrings.po' ipk.target = ipk ipk.commands = tmp=`mktemp -d /tmp/ipkg-opie.XXXXXXXXXX` && ( $(MAKE) INSTALL_ROOT="$$$$tmp" install && ipkg-build $$$$tmp; rm -rf $$$$tmp; ) QMAKE_EXTRA_UNIX_TARGETS += lupdate lrelease ipk opie-lupdate opie-lrelease messages +CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) +contains( CONFTEST, y ){ +QMAKE_LFLAGS += -Wl +} +else { QMAKE_LFLAGS += -Wl,-rpath=$$prefix/lib +# I am not sure whether it is a good idea to change the way plugins is build +# on linux. Therefore I remove the "plugin" term, which is needed by MacOS-X +CONFIG -= plugin +} QMAKE_LIBDIR += $(OPIEDIR)/lib MOC_DIR=.moc/$(PLATFORM) OBJECTS_DIR=.obj/$(PLATFORM) #was here now at thetop #include ( $(OPIEDIR)/gen.pro ) diff --git a/inputmethods/dasher/dasher.pro b/inputmethods/dasher/dasher.pro index 7b6def9..b7669a4 100644 --- a/inputmethods/dasher/dasher.pro +++ b/inputmethods/dasher/dasher.pro @@ -1,57 +1,57 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = Alphabet.h \ DasherModel.h \ FrameRate.h \ AlphabetMap.h \ DasherNode.h \ LanguageModel.h \ AlphIO.h \ DasherScreen.h \ PPMLanguageModel.h \ Context.h \ DasherSettingsInterface.h \ QtDasherImpl.h \ CustomAlphabet.h \ DasherTypes.h \ QtDasherPlugin.h \ DashEdit.h \ DasherView.h \ QtDasherScreen.h \ DasherAppInterface.h \ DasherViewSquare.h \ SettingsStore.h \ DasherInterface.h \ DasherWidgetInterface.h SOURCES = Alphabet.cpp \ DasherModel.cpp \ LanguageModel.cpp \ AlphabetMap.cpp \ DasherNode.cpp \ PPMLanguageModel.cpp \ AlphIO.cpp \ DasherSettingsInterface.cpp \ SettingsStore.cpp \ CustomAlphabet.cpp \ DasherView.cpp \ DasherInterface.cpp \ DasherViewSquare.cpp \ QtDasherImpl.cc \ QtDasherPlugin.cc \ QtDasherScreen.cc TARGET = qdasher DESTDIR = ../../plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include ../../launcher LIBS += -lqpe QMAKE_LFLAGS += -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods VERSION = 1.0.0 SUBDIRS = DasherCore include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/inputmethods diff --git a/inputmethods/dvorak/dvorak.pro b/inputmethods/dvorak/dvorak.pro index cd30aa2..67fe4e6 100644 --- a/inputmethods/dvorak/dvorak.pro +++ b/inputmethods/dvorak/dvorak.pro @@ -1,36 +1,36 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = dvorak.h \ dvorakimpl.h SOURCES = dvorak.cpp \ dvorakimpl.cpp TARGET = qdvorak DESTDIR = ../../plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include ../../launcher LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard QMAKE_LFLAGS += -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods VERSION = 1.0.0 TRANSLATIONS = ../../i18n/de/libqdvorak.ts \ ../../i18n/nl/libqdvorak.ts \ ../../i18n/da/libqdvorak.ts \ ../../i18n/xx/libqdvorak.ts \ ../../i18n/en/libqdvorak.ts \ ../../i18n/es/libqdvorak.ts \ ../../i18n/fr/libqdvorak.ts \ ../../i18n/hu/libqdvorak.ts \ ../../i18n/ja/libqdvorak.ts \ ../../i18n/ko/libqdvorak.ts \ ../../i18n/no/libqdvorak.ts \ ../../i18n/pl/libqdvorak.ts \ ../../i18n/pt/libqdvorak.ts \ ../../i18n/pt_BR/libqdvorak.ts \ ../../i18n/sl/libqdvorak.ts \ ../../i18n/zh_CN/libqdvorak.ts \ ../../i18n/zh_TW/libqdvorak.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/inputmethods diff --git a/inputmethods/handwriting/handwriting.pro b/inputmethods/handwriting/handwriting.pro index 4ec5932..7a22208 100644 --- a/inputmethods/handwriting/handwriting.pro +++ b/inputmethods/handwriting/handwriting.pro @@ -1,54 +1,54 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = qimpenchar.h \ qimpenprofile.h \ qimpencombining.h \ qimpenhelp.h \ qimpeninput.h \ qimpenmatch.h \ qimpensetup.h \ qimpenstroke.h \ qimpenwidget.h \ qimpenwordpick.h \ handwritingimpl.h SOURCES = qimpenchar.cpp \ qimpenprofile.cpp \ qimpencombining.cpp \ qimpenhelp.cpp \ qimpeninput.cpp \ qimpenmatch.cpp \ qimpensetup.cpp \ qimpenstroke.cpp \ qimpenwidget.cpp \ qimpenwordpick.cpp \ handwritingimpl.cpp INTERFACES = qimpenprefbase.ui TARGET = qhandwriting DESTDIR = ../../plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include ../../launcher LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../i18n/de/libqhandwriting.ts \ ../../i18n/nl/libqhandwriting.ts \ ../../i18n/da/libqhandwriting.ts \ ../../i18n/xx/libqhandwriting.ts \ ../../i18n/en/libqhandwriting.ts \ ../../i18n/es/libqhandwriting.ts \ ../../i18n/fr/libqhandwriting.ts \ ../../i18n/hu/libqhandwriting.ts \ ../../i18n/ja/libqhandwriting.ts \ ../../i18n/ko/libqhandwriting.ts \ ../../i18n/no/libqhandwriting.ts \ ../../i18n/pl/libqhandwriting.ts \ ../../i18n/pt/libqhandwriting.ts \ ../../i18n/pt_BR/libqhandwriting.ts \ ../../i18n/sl/libqhandwriting.ts \ ../../i18n/zh_CN/libqhandwriting.ts \ ../../i18n/zh_TW/libqhandwriting.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/inputmethods diff --git a/inputmethods/jumpx/jumpx.pro b/inputmethods/jumpx/jumpx.pro index eff4563..a75ffd5 100644 --- a/inputmethods/jumpx/jumpx.pro +++ b/inputmethods/jumpx/jumpx.pro @@ -1,35 +1,35 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = keyboard.h \ keyboardimpl.h SOURCES = keyboard.cpp \ keyboardimpl.cpp TARGET = qjumpx DESTDIR = ../../plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../i18n/de/libqjumpx.ts \ ../../i18n/nl/libqjumpx.ts \ ../../i18n/da/libqjumpx.ts \ ../../i18n/xx/libqjumpx.ts \ ../../i18n/en/libqjumpx.ts \ ../../i18n/es/libqjumpx.ts \ ../../i18n/fr/libqjumpx.ts \ ../../i18n/hu/libqjumpx.ts \ ../../i18n/ja/libqjumpx.ts \ ../../i18n/ko/libqjumpx.ts \ ../../i18n/no/libqjumpx.ts \ ../../i18n/pl/libqjumpx.ts \ ../../i18n/pt/libqjumpx.ts \ ../../i18n/pt_BR/libqjumpx.ts \ ../../i18n/sl/libqjumpx.ts \ ../../i18n/zh_CN/libqjumpx.ts \ ../../i18n/zh_TW/libqjumpx.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/inputmethods diff --git a/inputmethods/keyboard/keyboard.pro b/inputmethods/keyboard/keyboard.pro index 5ca97f1..56e35b9 100644 --- a/inputmethods/keyboard/keyboard.pro +++ b/inputmethods/keyboard/keyboard.pro @@ -1,36 +1,36 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = keyboard.h \ keyboardimpl.h SOURCES = keyboard.cpp \ keyboardimpl.cpp TARGET = qkeyboard DESTDIR = ../../plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include ../../launcher LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard QMAKE_LFLAGS += -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods VERSION = 1.0.0 TRANSLATIONS = ../../i18n/de/libqkeyboard.ts \ ../../i18n/nl/libqkeyboard.ts \ ../../i18n/da/libqkeyboard.ts \ ../../i18n/xx/libqkeyboard.ts \ ../../i18n/en/libqkeyboard.ts \ ../../i18n/es/libqkeyboard.ts \ ../../i18n/fr/libqkeyboard.ts \ ../../i18n/hu/libqkeyboard.ts \ ../../i18n/ja/libqkeyboard.ts \ ../../i18n/ko/libqkeyboard.ts \ ../../i18n/no/libqkeyboard.ts \ ../../i18n/pl/libqkeyboard.ts \ ../../i18n/pt/libqkeyboard.ts \ ../../i18n/pt_BR/libqkeyboard.ts \ ../../i18n/sl/libqkeyboard.ts \ ../../i18n/zh_CN/libqkeyboard.ts \ ../../i18n/zh_TW/libqkeyboard.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/inputmethods diff --git a/inputmethods/kjumpx/kjumpx.pro b/inputmethods/kjumpx/kjumpx.pro index 0624583..2dd6ddf 100644 --- a/inputmethods/kjumpx/kjumpx.pro +++ b/inputmethods/kjumpx/kjumpx.pro @@ -1,35 +1,35 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = keyboard.h \ keyboardimpl.h SOURCES = keyboard.cpp \ keyboardimpl.cpp TARGET = qkjumpx DESTDIR = ../../plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../i18n/de/libqkjumpx.ts \ ../../i18n/nl/libqkjumpx.ts \ ../../i18n/da/libqkjumpx.ts \ ../../i18n/xx/libqkjumpx.ts \ ../../i18n/en/libqkjumpx.ts \ ../../i18n/es/libqkjumpx.ts \ ../../i18n/fr/libqkjumpx.ts \ ../../i18n/hu/libqkjumpx.ts \ ../../i18n/ja/libqkjumpx.ts \ ../../i18n/ko/libqkjumpx.ts \ ../../i18n/no/libqkjumpx.ts \ ../../i18n/pl/libqkjumpx.ts \ ../../i18n/pt/libqkjumpx.ts \ ../../i18n/pt_BR/libqkjumpx.ts \ ../../i18n/sl/libqkjumpx.ts \ ../../i18n/zh_CN/libqkjumpx.ts \ ../../i18n/zh_TW/libqkjumpx.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/inputmethods diff --git a/inputmethods/multikey/multikey.pro b/inputmethods/multikey/multikey.pro index 424c000..82dcb94 100644 --- a/inputmethods/multikey/multikey.pro +++ b/inputmethods/multikey/multikey.pro @@ -1,36 +1,36 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = keyboard.h \ configdlg.h \ keyboardimpl.h SOURCES = keyboard.cpp \ configdlg.cpp \ keyboardimpl.cpp TARGET = qmultikey DESTDIR = $(OPIEDIR)/plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include ../../launcher LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard QMAKE_LFLAGS += -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods VERSION = 1.0.0 TRANSLATIONS = ../../i18n/pt_BR/libqmultikey.ts \ ../../i18n/nl/libqmultikey.ts \ ../../i18n/de/libqmultikey.ts \ ../../i18n/xx/libqmultikey.ts \ ../../i18n/en/libqmultikey.ts \ ../../i18n/hu/libqmultikey.ts \ ../../i18n/sl/libqmultikey.ts \ ../../i18n/ja/libqmultikey.ts \ ../../i18n/ko/libqmultikey.ts \ ../../i18n/pl/libqmultikey.ts \ ../../i18n/no/libqmultikey.ts \ ../../i18n/zh_CN/libqmultikey.ts \ ../../i18n/zh_TW/libqmultikey.ts \ ../../i18n/fr/libqmultikey.ts \ ../../i18n/da/libqmultikey.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/inputmethods diff --git a/inputmethods/pickboard/pickboard.pro b/inputmethods/pickboard/pickboard.pro index 53ff8f0..b86c069 100644 --- a/inputmethods/pickboard/pickboard.pro +++ b/inputmethods/pickboard/pickboard.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = pickboard.h pickboardcfg.h pickboardimpl.h pickboardpicks.h SOURCES = pickboard.cpp pickboardcfg.cpp pickboardimpl.cpp pickboardpicks.cpp TARGET = qpickboard DESTDIR = ../../plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include ../../launcher LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../i18n/de/libqpickboard.ts \ ../../i18n/nl/libqpickboard.ts \ ../../i18n/da/libqpickboard.ts \ ../../i18n/xx/libqpickboard.ts \ ../../i18n/en/libqpickboard.ts \ ../../i18n/es/libqpickboard.ts \ ../../i18n/fr/libqpickboard.ts \ ../../i18n/hu/libqpickboard.ts \ ../../i18n/ja/libqpickboard.ts \ ../../i18n/ko/libqpickboard.ts \ ../../i18n/no/libqpickboard.ts \ ../../i18n/pl/libqpickboard.ts \ ../../i18n/pt/libqpickboard.ts \ ../../i18n/pt_BR/libqpickboard.ts \ ../../i18n/sl/libqpickboard.ts \ ../../i18n/zh_CN/libqpickboard.ts \ ../../i18n/zh_TW/libqpickboard.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/inputmethods diff --git a/inputmethods/unikeyboard/unikeyboard.pro b/inputmethods/unikeyboard/unikeyboard.pro index 0732dc8..678f575 100644 --- a/inputmethods/unikeyboard/unikeyboard.pro +++ b/inputmethods/unikeyboard/unikeyboard.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = unikeyboard.h unikeyboardimpl.h SOURCES = unikeyboard.cpp unikeyboardimpl.cpp TARGET = qunikeyboard DESTDIR = ../../plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include ../../launcher LIBS += -lqpe VERSION = 1.0.0 TRANSLATIONS = ../../i18n/de/libqunikeyboard.ts \ ../../i18n/nl/libqunikeyboard.ts \ ../../i18n/da/libqunikeyboard.ts \ ../../i18n/xx/libqunikeyboard.ts \ ../../i18n/en/libqunikeyboard.ts \ ../../i18n/es/libqunikeyboard.ts \ ../../i18n/fr/libqunikeyboard.ts \ ../../i18n/hu/libqunikeyboard.ts \ ../../i18n/ja/libqunikeyboard.ts \ ../../i18n/ko/libqunikeyboard.ts \ ../../i18n/no/libqunikeyboard.ts \ ../../i18n/pl/libqunikeyboard.ts \ ../../i18n/pt/libqunikeyboard.ts \ ../../i18n/pt_BR/libqunikeyboard.ts \ ../../i18n/sl/libqunikeyboard.ts \ ../../i18n/zh_CN/libqunikeyboard.ts \ ../../i18n/zh_TW/libqunikeyboard.ts include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/inputmethods diff --git a/libopie/libopie.pro b/libopie/libopie.pro index 0398775..bf6b78f 100644 --- a/libopie/libopie.pro +++ b/libopie/libopie.pro @@ -1,136 +1,132 @@ TEMPLATE = lib CONFIG += qte warn_on release HEADERS = ofontmenu.h \ ocolorbutton.h \ ofiledialog.h ofileselector.h \ ofileselector_p.h \ ocheckitem.h \ xmltree.h \ colordialog.h colorpopupmenu.h \ oclickablelabel.h oprocctrl.h \ oprocess.h odevice.h odevicebutton.h \ otimepicker.h otabwidget.h \ otabbar.h otabinfo.h \ ofontselector.h \ pim/opimrecord.h \ pim/otodo.h \ pim/orecordlist.h \ pim/opimaccesstemplate.h \ pim/opimaccessbackend.h \ pim/otodoaccess.h \ pim/otodoaccessbackend.h \ pim/oconversion.h \ pim/ocontact.h \ pim/ocontactfields.h \ pim/ocontactaccess.h \ pim/ocontactaccessbackend.h \ pim/ocontactaccessbackend_xml.h \ pim/ocontactaccessbackend_vcard.h \ pim/obackendfactory.h \ pim/opimcache.h \ pim/otodoaccessvcal.h \ pim/orecur.h \ pim/opimstate.h \ pim/opimxrefpartner.h \ pim/opimxref.h \ pim/opimxrefmanager.h \ pim/opimmaintainer.h \ pim/opimnotify.h \ pim/opimnotifymanager.h \ pim/opimmainwindow.h \ pim/opimresolver.h \ pim/oevent.h \ pim/otimezone.h \ pim/odatebookaccess.h \ pim/odatebookaccessbackend.h \ pim/odatebookaccessbackend_xml.h \ orecurrancewidget.h \ oticker.h owait.h SOURCES = ofontmenu.cc \ ocolorbutton.cpp \ sharp_compat.cpp \ xmltree.cc \ ofiledialog.cc ofileselector.cpp \ ocheckitem.cpp \ colordialog.cpp \ colorpopupmenu.cpp oclickablelabel.cpp \ oprocctrl.cpp oprocess.cpp \ odevice.cpp odevicebutton.cpp otimepicker.cpp \ otabwidget.cpp otabbar.cpp \ ofontselector.cpp \ pim/otodo.cpp \ pim/opimrecord.cpp \ pim/otodoaccess.cpp \ pim/otodoaccessbackend.cpp \ pim/otodoaccessxml.cpp \ pim/oconversion.cpp \ pim/ocontact.cpp \ pim/ocontactfields.cpp \ pim/ocontactaccess.cpp \ pim/ocontactaccessbackend_vcard.cpp \ pim/ocontactaccessbackend_xml.cpp \ pim/otodoaccessvcal.cpp \ pim/orecur.cpp \ pim/opimstate.cpp \ pim/opimxrefpartner.cpp \ pim/opimxref.cpp \ pim/opimxrefmanager.cpp \ pim/opimmaintainer.cpp \ pim/opimnotify.cpp \ pim/opimnotifymanager.cpp \ pim/opimmainwindow.cpp \ pim/opimresolver.cpp \ pim/oevent.cpp \ pim/otimezone.cpp \ pim/odatebookaccess.cpp \ pim/odatebookaccessbackend.cpp \ pim/odatebookaccessbackend_xml.cpp \ orecurrancewidget.cpp \ oticker.cpp owait.cpp TARGET = opie INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/lib$(PROJMAK) -# The following is just for my Notebook ! -# It should never be committed !! (eilers) -# QMAKE_CXXFLAGS += -DQT_NO_SOUND - LIBS += -lqpe # Add SQL-Support if selected by config (eilers) CONFTEST = $$system( echo $CONFIG_SQL_PIM_BACKEND ) contains( CONFTEST, y ){ DEFINES += __USE_SQL LIBS += -lopiedb2 -lsqlite HEADERS += pim/otodoaccesssql.h pim/ocontactaccessbackend_sql.h SOURCES += pim/otodoaccesssql.cpp pim/ocontactaccessbackend_sql.cpp } INTERFACES = otimepickerbase.ui orecurrancebase.ui TARGET = opie TRANSLATIONS = ../i18n/de/libopie.ts \ ../i18n/nl/libopie.ts \ ../i18n/xx/libopie.ts \ ../i18n/en/libopie.ts \ ../i18n/es/libopie.ts \ ../i18n/fr/libopie.ts \ ../i18n/hu/libopie.ts \ ../i18n/ja/libopie.ts \ ../i18n/ko/libopie.ts \ ../i18n/no/libopie.ts \ ../i18n/pl/libopie.ts \ ../i18n/pt/libopie.ts \ ../i18n/pt_BR/libopie.ts \ ../i18n/sl/libopie.ts \ ../i18n/zh_CN/libopie.ts \ ../i18n/zh_TW/libopie.ts \ ../i18n/da/libopie.ts include ( big-screen/big-screen.pro ) include ( $(OPIEDIR)/include.pro ) diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 3edf8e7..fef623a 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp @@ -1,410 +1,412 @@ /* This file is part of the OPIE libraries Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> #include <signal.h> #include <sys/time.h> +#ifndef QT_NO_SOUND #include <linux/soundcard.h> +#endif #include <math.h> #include <qapplication.h> #include <qfile.h> #include <qtextstream.h> #include <qpe/sound.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include "odevice.h" #include <qwindowsystem_qws.h> #ifndef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #endif // _IO and friends are only defined in kernel headers ... #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) #define OD_IO(type,number) OD_IOC(0,type,number,0) #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) using namespace Opie; class ODeviceData { public: QString m_vendorstr; OVendor m_vendor; QString m_modelstr; OModel m_model; QString m_systemstr; OSystem m_system; QString m_sysverstr; Transformation m_rotation; ODirection m_direction; QValueList <ODeviceButton> *m_buttons; uint m_holdtime; QStrList *m_cpu_frequencies; }; class iPAQ : public ODevice, public QWSServer::KeyboardFilter { protected: virtual void init ( ); virtual void initButtons ( ); public: virtual bool setSoftSuspend ( bool soft ); virtual bool setDisplayBrightness ( int b ); virtual int displayBrightnessResolution ( ) const; virtual void alarmSound ( ); virtual QValueList <OLed> ledList ( ) const; virtual QValueList <OLedState> ledStateList ( OLed led ) const; virtual OLedState ledState ( OLed led ) const; virtual bool setLedState ( OLed led, OLedState st ); virtual bool hasLightSensor ( ) const; virtual int readLightSensor ( ); virtual int lightSensorResolution ( ) const; protected: virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); virtual void timerEvent ( QTimerEvent *te ); int m_power_timer; OLedState m_leds [2]; }; class Jornada : public ODevice { protected: virtual void init ( ); //virtual void initButtons ( ); public: virtual bool setSoftSuspend ( bool soft ); virtual bool setDisplayBrightness ( int b ); virtual int displayBrightnessResolution ( ) const; static bool isJornada(); }; class Zaurus : public ODevice { protected: virtual void init ( ); virtual void initButtons ( ); public: virtual bool setSoftSuspend ( bool soft ); virtual bool setDisplayBrightness ( int b ); virtual int displayBrightnessResolution ( ) const; virtual void alarmSound ( ); virtual void keySound ( ); virtual void touchSound ( ); virtual QValueList <OLed> ledList ( ) const; virtual QValueList <OLedState> ledStateList ( OLed led ) const; virtual OLedState ledState ( OLed led ) const; virtual bool setLedState ( OLed led, OLedState st ); static bool isZaurus(); protected: virtual void buzzer ( int snd ); OLedState m_leds [1]; bool m_embedix; }; class SIMpad : public ODevice, public QWSServer::KeyboardFilter { protected: virtual void init ( ); virtual void initButtons ( ); public: virtual bool setSoftSuspend ( bool soft ); virtual bool suspend(); virtual bool setDisplayStatus( bool on ); virtual bool setDisplayBrightness ( int b ); virtual int displayBrightnessResolution ( ) const; virtual void alarmSound ( ); virtual QValueList <OLed> ledList ( ) const; virtual QValueList <OLedState> ledStateList ( OLed led ) const; virtual OLedState ledState ( OLed led ) const; virtual bool setLedState ( OLed led, OLedState st ); protected: virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); virtual void timerEvent ( QTimerEvent *te ); int m_power_timer; OLedState m_leds [1]; //FIXME check if really only one }; class Ramses : public ODevice, public QWSServer::KeyboardFilter { protected: virtual void init ( ); public: virtual bool setSoftSuspend ( bool soft ); virtual bool suspend ( ); virtual bool setDisplayStatus( bool on ); virtual bool setDisplayBrightness ( int b ); virtual int displayBrightnessResolution ( ) const; virtual bool setDisplayContrast ( int b ); virtual int displayContrastResolution ( ) const; protected: virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); virtual void timerEvent ( QTimerEvent *te ); int m_power_timer; }; struct i_button { uint model; Qt::Key code; char *utext; char *pix; char *fpressedservice; char *fpressedaction; char *fheldservice; char *fheldaction; } ipaq_buttons [] = { { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), "devicebuttons/ipaq_calendar", "datebook", "nextView()", "today", "raise()" }, { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), "devicebuttons/ipaq_contact", "addressbook", "raise()", "addressbook", "beamBusinessCard()" }, { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), "devicebuttons/ipaq_menu", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), "devicebuttons/ipaq_mail", "mail", "raise()", "mail", "newMail()" }, { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), "devicebuttons/ipaq_home", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), "devicebuttons/ipaq_record", "QPE/VMemo", "toggleRecord()", "sound", "raise()" }, }; struct z_button { Qt::Key code; char *utext; char *pix; char *fpressedservice; char *fpressedaction; char *fheldservice; char *fheldaction; } z_buttons [] = { { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), "devicebuttons/z_calendar", "datebook", "nextView()", "today", "raise()" }, { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), "devicebuttons/z_contact", "addressbook", "raise()", "addressbook", "beamBusinessCard()" }, { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), "devicebuttons/z_home", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), "devicebuttons/z_menu", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), "devicebuttons/z_mail", "mail", "raise()", "mail", "newMail()" }, }; struct z_button z_buttons_c700 [] = { { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), "devicebuttons/z_calendar", "datebook", "nextView()", "today", "raise()" }, { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), "devicebuttons/z_contact", "addressbook", "raise()", "addressbook", "beamBusinessCard()" }, { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), "devicebuttons/z_home", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), "devicebuttons/z_menu", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"), "", "QPE/Rotation", "flip()", "QPE/Rotation", "flip()" }, }; struct s_button { uint model; Qt::Key code; char *utext; char *pix; char *fpressedservice; char *fpressedaction; char *fheldservice; char *fheldaction; } simpad_buttons [] = { { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), "devicebuttons/simpad_lower_up", "datebook", "nextView()", "today", "raise()" }, { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), "devicebuttons/simpad_lower_down", "addressbook", "raise()", "addressbook", "beamBusinessCard()" }, { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), "devicebuttons/simpad_lower_right", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), "devicebuttons/simpad_lower_left", "mail", "raise()", "mail", "newMail()" }, { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), "devicebuttons/simpad_upper_up", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), "devicebuttons/simpad_upper_down", "addressbook", "raise()", "addressbook", "beamBusinessCard()" }, { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), "devicebuttons/simpad_upper_right", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), "devicebuttons/simpad_upper_left", "QPE/Rotation", "flip()", "QPE/Rotation", "flip()" }, /* { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), "devicebuttons/simpad_lower_upper", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), "devicebuttons/simpad_upper_lower", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, */ }; struct r_button { uint model; Qt::Key code; char *utext; char *pix; char *fpressedservice; char *fpressedaction; char *fheldservice; char *fheldaction; } ramses_buttons [] = { { Model_Ramses_MNCI, Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), "devicebuttons/z_menu", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Model_Ramses_MNCI, Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), "devicebuttons/ipaq_home", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, }; class Yopy : public ODevice { protected: virtual void init ( ); virtual void initButtons ( ); public: virtual bool suspend ( ); virtual bool setDisplayBrightness ( int b ); virtual int displayBrightnessResolution ( ) const; static bool isYopy ( ); }; struct yopy_button { Qt::Key code; char *utext; char *pix; char *fpressedservice; char *fpressedaction; char *fheldservice; char *fheldaction; } yopy_buttons [] = { { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Action Button"), "devicebuttons/yopy_action", "datebook", "nextView()", "today", "raise()" }, { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "OK Button"), diff --git a/library/filemanager.cpp b/library/filemanager.cpp index cc657fa..91986a0 100644 --- a/library/filemanager.cpp +++ b/library/filemanager.cpp @@ -1,341 +1,384 @@ /********************************************************************** ** 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 "filemanager.h" #include "applnk.h" #include <qdir.h> #include <qfile.h> #include <qfileinfo.h> #include <qtextstream.h> #include <qtextcodec.h> #include <errno.h> #include <stdlib.h> #include <unistd.h> #include <sys/stat.h> #include <dirent.h> -#include <sys/sendfile.h> +#ifdef Q_OS_MACX +// MacOS X does not have sendfile.. :( +// But maybe in the future.. !? +# ifdef SENDFILE +# include <sys/types.h> +# include <sys/socket.h> +# endif +#else +# include <sys/sendfile.h> +#endif /* Q_OS_MACX */ #include <fcntl.h> /*! \class FileManager \brief The FileManager class assists with AppLnk input/output. */ /*! Constructs a FileManager. */ FileManager::FileManager() { } /*! Destroys a FileManager. */ FileManager::~FileManager() { } /*! Saves \a data as the document specified by \a f. Returns whether the operation succeeded. */ bool FileManager::saveFile( const DocLnk &f, const QByteArray &data ) { QString fn = f.file() + ".new"; ensurePathExists( fn ); QFile fl( fn ); if ( !fl.open( IO_WriteOnly|IO_Raw ) ) { qWarning("open failed"); return FALSE; } int total_written = fl.writeBlock( data ); fl.close(); if ( total_written != int(data.size()) || !f.writeLink() ) { QFile::remove( fn ); return FALSE; } qDebug("total written %d out of %d", total_written, data.size()); // else rename the file... if ( !renameFile( fn.latin1(), f.file().latin1() ) ) { qWarning( "problem renaming file %s to %s, errno: %d", fn.latin1(), f.file().latin1(), errno ); // remove the file... } return TRUE; } /*! Saves \a text as the document specified by \a f. The text is saved in UTF8 format. Returns whether the operation succeeded. */ bool FileManager::saveFile( const DocLnk &f, const QString &text ) { QString fn = f.file() + ".new"; ensurePathExists( fn ); QFile fl( fn ); if ( !fl.open( IO_WriteOnly|IO_Raw ) ) { qWarning("open failed"); return FALSE; } QCString cstr = text.utf8(); int total_written; total_written = fl.writeBlock( cstr.data(), cstr.length() ); fl.close(); if ( total_written != int(cstr.length()) || !f.writeLink() ) { QFile::remove( fn ); return FALSE; } // okay now rename the file.. if ( !renameFile( fn.latin1(), f.file().latin1() ) ) { qWarning( "problem renaming file %s to %s, errno: %d", fn.latin1(), f.file().latin1(), errno ); } return TRUE; } /*! Loads \a text from the document specified by \a f. The text is required to be in UTF8 format. Returns whether the operation succeeded. */ bool FileManager::loadFile( const DocLnk &f, QString &text ) { QString fn = f.file(); QFile fl( fn ); if ( !fl.open( IO_ReadOnly ) ) return FALSE; QTextStream ts( &fl ); #if QT_VERSION <= 230 && defined(QT_NO_CODECS) // The below should work, but doesn't in Qt 2.3.0 ts.setCodec( QTextCodec::codecForMib( 106 ) ); #else ts.setEncoding( QTextStream::UnicodeUTF8 ); #endif text = ts.read(); fl.close(); return TRUE; } /*! Loads \a ba from the document specified by \a f. Returns whether the operation succeeded. */ bool FileManager::loadFile( const DocLnk &f, QByteArray &ba ) { QString fn = f.file(); QFile fl( fn ); if ( !fl.open( IO_ReadOnly ) ) return FALSE; ba.resize( fl.size() ); if ( fl.size() > 0 ) fl.readBlock( ba.data(), fl.size() ); fl.close(); return TRUE; } /*! Copies the document specified by \a src to the document specified by \a dest. Returns whether the operation succeeded. */ bool FileManager::copyFile( const AppLnk &src, const AppLnk &dest ) { QFile sf( src.file() ); if ( !sf.open( IO_ReadOnly ) ) return FALSE; QString fn = dest.file() + ".new"; ensurePathExists( fn ); QFile df( fn ); if ( !df.open( IO_WriteOnly|IO_Raw ) ) return FALSE; const int bufsize = 16384; char buffer[bufsize]; bool ok = TRUE; int bytesRead = 0; while ( ok && !sf.atEnd() ) { bytesRead = sf.readBlock( buffer, bufsize ); if ( bytesRead < 0 ) ok = FALSE; while ( ok && bytesRead > 0 ) { int bytesWritten = df.writeBlock( buffer, bytesRead ); if ( bytesWritten < 0 ) ok = FALSE; else bytesRead -= bytesWritten; } } if ( ok ) ok = dest.writeLink(); if ( ok ) { // okay now rename the file... if ( !renameFile( fn.latin1(), dest.file().latin1() ) ) { qWarning( "problem renaming file %s to %s, errno: %d", fn.latin1(), dest.file().latin1(), errno ); // remove the tmp file, otherwise, it will just lay around... QFile::remove( fn.latin1() ); } } else { QFile::remove( fn.latin1() ); } return ok; } + + bool FileManager::copyFile( const QString & src, const QString & dest ) { bool success = true; struct stat status; int read_fd=0; int write_fd=0; struct stat stat_buf; off_t offset = 0; QFile srcFile(src); QFile destFile(dest); if(!srcFile.open( IO_ReadOnly|IO_Raw)) { return success = false; } read_fd = srcFile.handle(); if(read_fd != -1) { fstat (read_fd, &stat_buf); if( !destFile.open( IO_WriteOnly|IO_Raw ) ) return success = false; write_fd = destFile.handle(); if(write_fd != -1) { int err=0; QString msg; - err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); - if( err == -1) { - switch(err) { - case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; - case EINVAL: msg = "Descriptor is not valid or locked. "; - case ENOMEM: msg = "Insufficient memory to read from in_fd."; - case EIO: msg = "Unspecified error while reading from in_fd."; - }; - success = false; - } - } else { +#ifdef Q_OS_MACX +#ifdef SENDMAIL + /* FreeBSD does support a different kind of + * sendfile. (eilers) + * I took this from Very Secure FTPd + * Licence: GPL + * Author: Chris Evans + * sysdeputil.c + */ + /* XXX - start_pos will truncate on 32-bit machines - can we + * say "start from current pos"? + */ + off_t written = 0; + int retval = 0; + retval = sendfile(read_fd, write_fd, offset, stat_buf.st_size, NULL, + &written, 0); + /* Translate to Linux-like retval */ + if (written > 0) + { + err = (int) written; + } +#else /* SENDMAIL */ + err == -1; + msg = "FAILURE: Using unsupported function \"sendfile()\" Need Workaround !!"; + success = false; +# warning "Need workaround for sendfile!!(eilers)" +#endif /* SENDMAIL */ + +#else + err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); + if( err == -1) { + switch(err) { + case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; + case EINVAL: msg = "Descriptor is not valid or locked. "; + case ENOMEM: msg = "Insufficient memory to read from in_fd."; + case EIO: msg = "Unspecified error while reading from in_fd."; + }; + success = false; + } +#endif /* Q_OS_MACX */ + if( !success ) + qWarning( msg ); + } else { qWarning("open write failed %s, %s",src.latin1(), dest.latin1()); success = false; } } else { qWarning("open read failed %s, %s",src.latin1(), dest.latin1()); success = false; } srcFile.close(); destFile.close(); // Set file permissions if( stat( (const char *) src, &status ) == 0 ) { chmod( (const char *) dest, status.st_mode ); } return success; } bool FileManager::renameFile( const QString & src, const QString & dest ) { if(copyFile( src, dest )) { if(QFile::remove(src) ) { return true; } } return false; } /*! Opens the document specified by \a f as a readable QIODevice. The caller must delete the return value. Returns 0 if the operation fails. */ QIODevice* FileManager::openFile( const DocLnk& f ) { QString fn = f.file(); QFile* fl = new QFile( fn ); if ( !fl->open( IO_ReadOnly ) ) { delete fl; fl = 0; } return fl; } /*! Opens the document specified by \a f as a writable QIODevice. The caller must delete the return value. Returns 0 if the operation fails. */ QIODevice* FileManager::saveFile( const DocLnk& f ) { QString fn = f.file(); ensurePathExists( fn ); QFile* fl = new QFile( fn ); if ( fl->open( IO_WriteOnly ) ) { f.writeLink(); } else { delete fl; fl = 0; } return fl; } /*! Returns whether the document specified by \a f current exists as a file on disk. */ bool FileManager::exists( const DocLnk &f ) { return QFile::exists(f.file()); } /*! Ensures that the path \a fn exists, by creating required directories. Returns TRUE if successful. */ bool FileManager::ensurePathExists( const QString &fn ) { QFileInfo fi(fn); fi.setFile( fi.dirPath(TRUE) ); if ( !fi.exists() ) { if ( system(("mkdir -p "+fi.filePath())) ) return FALSE; } return TRUE; } diff --git a/library/fontdatabase.cpp b/library/fontdatabase.cpp index c7a5211..2ad8e95 100644 --- a/library/fontdatabase.cpp +++ b/library/fontdatabase.cpp @@ -1,249 +1,253 @@ /********************************************************************** ** 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 <qpe/qpeapplication.h> #include "fontfactoryinterface.h" #include "fontdatabase.h" #include <qpe/qlibrary.h> #include <qfontmanager_qws.h> #include <qdir.h> #include <qdict.h> #include <stdio.h> #include <stdlib.h> static QString fontDir() { QString qtdir = getenv("QTDIR"); if ( qtdir.isEmpty() ) qtdir = "/usr/local/qt-embedded"; return qtdir+"/lib/fonts/"; } #ifdef QT_NO_FONTDATABASE static QString fontFamily( const QString& key ) { int u0 = key.find('_'); int u1 = key.find('_',u0+1); int u2 = key.find('_',u1+1); QString family = key.left(u0); //int pointSize = key.mid(u0+1,u1-u0-1).toInt(); //int weight = key.mid(u1+1,u2-u1-1).toInt(); //bool italic = key.mid(u2-1,1) == "i"; // #### ignores _t and _I fields return family; } #endif QValueList<FontFactory> *FontDatabase::factoryList = 0; /*! \class FontDatabase fontdatabase.h \brief The FontDatabase class provides information about available fonts. Most often you will simply want to query the database for the available font families(). Use FontDatabase rather than QFontDatabase when you may need access to fonts that are not normally available. For example, if the freetype library and the Qtopia freetype plugin are installed, TrueType fonts will be available to your application. Font renderer plugins have greater resource requirements than system fonts so they should be used only when necessary. You can force the loading of font renderer plugins with loadRenderers(). \ingroup qtopiaemb */ /*! Constructs a FontDatabase object. */ FontDatabase::FontDatabase() #ifndef QT_NO_FONTDATABASE : QFontDatabase() #endif { if ( !factoryList ) loadRenderers(); } /*! Returns a list of names of all the available font families. */ QStringList FontDatabase::families() const { #ifndef QT_NO_FONTDATABASE return QFontDatabase::families(); #else #ifndef QWS QStringList list; return list; #else QStringList list; QDict<void> familyDict; QDiskFont *qdf; for ( qdf=qt_fontmanager->diskfonts.first(); qdf!=0; qdf=qt_fontmanager->diskfonts.next()) { QString familyname = qdf->name; if ( !familyDict.find( familyname ) ) { familyDict.insert( familyname, (void *)1 ); list.append( familyname ); } } QDir dir(fontDir(),"*.qpf"); for (int i=0; i<(int)dir.count(); i++) { QString familyname = fontFamily(dir[i]); if ( !familyDict.find( familyname ) ) { familyDict.insert( familyname, (void *)1 ); list.append( familyname ); } } return list; #endif #endif } #ifdef QT_NO_FONTDATABASE /*! Returns a list of standard fontsizes. */ QValueList<int> FontDatabase::standardSizes() { static int s[]={ 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72, 0 }; static bool first = TRUE; static QValueList<int> sList; if ( first ) { first = FALSE; int i = 0; while( s[i] ) sList.append( s[i++] ); } return sList; } #endif /*! Load any font renderer plugins that are available and make the fonts that the plugins can read available. */ void FontDatabase::loadRenderers() { #ifndef QWS return; #else #ifndef QT_NO_COMPONENT if ( !factoryList ) factoryList = new QValueList<FontFactory>; QValueList<FontFactory>::Iterator mit; for ( mit = factoryList->begin(); mit != factoryList->end(); ++mit ) { qt_fontmanager->factories.setAutoDelete( false ); qt_fontmanager->factories.removeRef( (*mit).factory ); qt_fontmanager->factories.setAutoDelete( true ); (*mit).interface->release(); (*mit).library->unload(); delete (*mit).library; } factoryList->clear(); QString path = QPEApplication::qpeDir() + "/plugins/fontfactories"; +#ifdef Q_OS_MACX + QDir dir( path, "lib*.dylib" ); +#else QDir dir( path, "lib*.so" ); +#endif if ( !dir.exists()) return; QStringList list = dir.entryList(); QStringList::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { FontFactoryInterface *iface = 0; QLibrary *lib = new QLibrary( path + "/" + *it ); if ( lib->queryInterface( IID_FontFactory, (QUnknownInterface**)&iface ) == QS_OK ) { FontFactory factory; factory.library = lib; factory.interface = iface; factory.factory = factory.interface->fontFactory(); factoryList->append( factory ); qt_fontmanager->factories.append( factory.factory ); readFonts( factory.factory ); } else { delete lib; } } #endif #endif } /*! \internal */ void FontDatabase::readFonts( QFontFactory *factory ) { #ifndef QWS return; #else // Load in font definition file QString fn = fontDir() + "fontdir"; FILE* fontdef=fopen(fn.local8Bit(),"r"); if(!fontdef) { QCString temp=fn.local8Bit(); qWarning("Cannot find font definition file %s - is $QTDIR set correctly?", temp.data()); return; } char buf[200]=""; char name[200]=""; char render[200]=""; char file[200]=""; char flags[200]=""; char isitalic[10]=""; fgets(buf,200,fontdef); while(!feof(fontdef)) { if ( buf[0] != '#' ) { int weight=50; int size=0; flags[0]=0; sscanf(buf,"%s %s %s %s %d %d %s",name,file,render,isitalic,&weight,&size,flags); QString filename; if ( file[0] != '/' ) filename = fontDir(); filename += file; if ( QFile::exists(filename) ) { if( factory->name() == render ) { QDiskFont * qdf=new QDiskFont(factory,name,isitalic[0]=='y', weight,size,flags,filename); qt_fontmanager->diskfonts.append(qdf); #if QT_VERSION >= 232 QFontDatabase::qwsAddDiskFont( qdf ); #endif } } } fgets(buf,200,fontdef); } fclose(fontdef); #endif } diff --git a/library/global.cpp b/library/global.cpp index 90954fe..05d23ac 100644 --- a/library/global.cpp +++ b/library/global.cpp @@ -223,592 +223,596 @@ static QString dictDir() /*! \internal */ Global::Global() { } /*! Returns the unchangeable QDawg that contains general words for the current locale. \sa addedDawg() */ const QDawg& Global::fixedDawg() { if ( !fixed_dawg ) { if ( !docDirCreated ) createDocDir(); fixed_dawg = new QDawg; QString dawgfilename = dictDir() + "/dawg"; QString words_lang; QStringList langs = Global::languageList(); for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { QString lang = *it; words_lang = dictDir() + "/words." + lang; QString dawgfilename_lang = dawgfilename + "." + lang; if ( QFile::exists(dawgfilename_lang) || QFile::exists(words_lang) ) { dawgfilename = dawgfilename_lang; break; } } QFile dawgfile(dawgfilename); if ( !dawgfile.exists() ) { QString fn = dictDir() + "/words"; if ( QFile::exists(words_lang) ) fn = words_lang; QFile in(fn); if ( in.open(IO_ReadOnly) ) { fixed_dawg->createFromWords(&in); dawgfile.open(IO_WriteOnly); fixed_dawg->write(&dawgfile); dawgfile.close(); } } else { fixed_dawg->readFile(dawgfilename); } } return *fixed_dawg; } /*! Returns the changeable QDawg that contains general words for the current locale. \sa fixedDawg() */ const QDawg& Global::addedDawg() { return dawg("local"); } /*! Returns the QDawg with the given \a name. This is an application-specific word list. \a name should not contain "/". */ const QDawg& Global::dawg(const QString& name) { createDocDir(); if ( !named_dawg ) named_dawg = new QDict<QDawg>; QDawg* r = named_dawg->find(name); if ( !r ) { r = new QDawg; named_dawg->insert(name,r); QString dawgfilename = applicationFileName("Dictionary", name ) + ".dawg"; QFile dawgfile(dawgfilename); if ( dawgfile.open(IO_ReadOnly) ) r->readFile(dawgfilename); } return *r; } /*! \overload Adds \a wordlist to the addedDawg(). Note that the addition of words persists between program executions (they are saved in the dictionary files), so you should confirm the words with the user before adding them. */ void Global::addWords(const QStringList& wordlist) { addWords("local",wordlist); } /*! \overload Adds \a wordlist to the addedDawg(). Note that the addition of words persists between program executions (they are saved in the dictionary files), so you should confirm the words with the user before adding them. */ void Global::addWords(const QString& dictname, const QStringList& wordlist) { QDawg& d = (QDawg&)dawg(dictname); QStringList all = d.allWords() + wordlist; d.createFromWords(all); QString dawgfilename = applicationFileName("Dictionary", dictname) + ".dawg"; QFile dawgfile(dawgfilename); if ( dawgfile.open(IO_WriteOnly) ) { d.write(&dawgfile); dawgfile.close(); } // #### Re-read the dawg here if we use mmap(). // #### Signal other processes to re-read. } /*! Returns the full path for the application called \a appname, with the given \a filename. Returns QString::null if there was a problem creating the directory tree for \a appname. If \a filename contains "/", it is the caller's responsibility to ensure that those directories exist. */ QString Global::applicationFileName(const QString& appname, const QString& filename) { QDir d; QString r = getenv("HOME"); r += "/Applications/"; if ( !QFile::exists( r ) ) if ( d.mkdir(r) == false ) return QString::null; r += appname; if ( !QFile::exists( r ) ) if ( d.mkdir(r) == false ) return QString::null; r += "/"; r += filename; return r; } /*! \internal */ void Global::createDocDir() { if ( !docDirCreated ) { docDirCreated = TRUE; mkdir( QPEApplication::documentDir().latin1(), 0755 ); } } /*! Displays a status \a message to the user. This usually appears in the taskbar for a short amount of time, then disappears. */ void Global::statusMessage(const QString& message) { #if !defined(QT_NO_COP) QCopEnvelope e( "QPE/TaskBar", "message(QString)" ); e << message; #endif } /*! \internal */ void Global::applyStyle() { #if !defined(QT_NO_COP) QCopChannel::send( "QPE/System", "applyStyle()" ); #else ((QPEApplication *)qApp)->applyStyle(); // apply without needing QCop for floppy version #endif } /*! \internal */ QWidget *Global::shutdown( bool ) { #if !defined(QT_NO_COP) QCopChannel::send( "QPE/System", "shutdown()" ); #endif return 0; } /*! \internal */ QWidget *Global::restart( bool ) { #if !defined(QT_NO_COP) QCopChannel::send( "QPE/System", "restart()" ); #endif return 0; } /*! Explicitly show the current input method. Input methods are indicated in the taskbar by a small icon. If the input method is activated (shown) then it takes up some proportion of the bottom of the screen, to allow the user to interact (input characters) with it. \sa hideInputMethod() */ void Global::showInputMethod() { #if !defined(QT_NO_COP) QCopChannel::send( "QPE/TaskBar", "showInputMethod()" ); #endif } /*! Explicitly hide the current input method. The current input method is still indicated in the taskbar, but no longer takes up screen space, and can no longer be interacted with. \sa showInputMethod() */ void Global::hideInputMethod() { #if !defined(QT_NO_COP) QCopChannel::send( "QPE/TaskBar", "hideInputMethod()" ); #endif } /*! \internal */ bool Global::isBuiltinCommand( const QString &name ) { if(!builtin) return FALSE; // yes, it can happen for (int i = 0; builtin[i].file; i++) { if ( builtin[i].file == name ) { return TRUE; } } return FALSE; } Global::Command* Global::builtin=0; QGuardedPtr<QWidget> *Global::running=0; /*! \class Global::Command \brief The Global::Command class is internal. \internal */ /*! \internal */ void Global::setBuiltinCommands( Command* list ) { if ( running ) delete [] running; builtin = list; int count = 0; if (!builtin) return; while ( builtin[count].file ) count++; running = new QGuardedPtr<QWidget> [ count ]; } /*! \internal */ void Global::setDocument( QWidget* receiver, const QString& document ) { Emitter emitter(receiver,document); } /*! \internal */ bool Global::terminateBuiltin( const QString& n ) { if (!builtin) return FALSE; for (int i = 0; builtin[i].file; i++) { if ( builtin[i].file == n ) { delete running[i]; return TRUE; } } return FALSE; } /*! \internal */ void Global::terminate( const AppLnk* app ) { //if ( terminateBuiltin(app->exec()) ) return; // maybe? haven't tried this #ifndef QT_NO_COP QCString channel = "QPE/Application/" + app->exec().utf8(); if ( QCopChannel::isRegistered(channel) ) { QCopEnvelope e(channel, "quit()"); } #endif } /*! Low-level function to run command \a c. \warning Do not use this function. Use execute instead. \sa execute() */ void Global::invoke(const QString &c) { // Convert the command line in to a list of arguments QStringList list = QStringList::split(QRegExp(" *"),c); #if !defined(QT_NO_COP) QString ap=list[0]; // see if the application is already running // XXX should lock file /tmp/qcop-msg-ap if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) { // If the channel is already register, the app is already running, so show it. { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); } //QCopEnvelope e("QPE/System", "notBusy(QString)" ); //e << ap; return; } // XXX should unlock file /tmp/qcop-msg-ap //see if it is being started if ( StartingAppList::isStarting( ap ) ) { // FIXME take it out for now, since it leads to a much to short showing of wait if // some entry is clicked. // Real cause is that ::execute is called twice for document tab. But it would need some larger changes // to fix that, and with future syncs with qtopia 1.6 it will change anyway big time since somebody there // had the idea that an apploader belongs to the launcher ... //QCopEnvelope e("QPE/System", "notBusy(QString)" ); //e << ap; return; } #endif #ifdef QT_NO_QWS_MULTIPROCESS QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 ); #else QStrList slist; unsigned int j; for ( j = 0; j < list.count(); j++ ) slist.append( list[j].utf8() ); const char **args = new (const char *)[slist.count() + 1]; for ( j = 0; j < slist.count(); j++ ) args[j] = slist.at(j); args[j] = NULL; #if !defined(QT_NO_COP) // an attempt to show a wait... // more logic should be used, but this will be fine for the moment... QCopEnvelope ( "QPE/System", "busy()" ); #endif #ifdef HAVE_QUICKEXEC +#ifdef Q_OS_MACX + QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".dylib"; +#else QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; +#endif qDebug("libfile = %s", libexe.latin1() ); if ( QFile::exists( libexe ) ) { qDebug("calling quickexec %s", libexe.latin1() ); quickexecv( libexe.utf8().data(), (const char **)args ); } else #endif { bool success = false; int pfd [2]; if ( ::pipe ( pfd ) < 0 ) pfd [0] = pfd [1] = -1; pid_t pid = ::fork ( ); if ( pid == 0 ) { // child for ( int fd = 3; fd < 100; fd++ ) { if ( fd != pfd [1] ) ::close ( fd ); } ::setpgid ( ::getpid ( ), ::getppid ( )); // Closing of fd[1] indicates that the execvp succeeded! if ( pfd [1] >= 0 ) ::fcntl ( pfd [1], F_SETFD, FD_CLOEXEC ); // Try bindir first, so that foo/bar works too ::execv ( qpeDir ( ) + "/bin/" + args [0], (char * const *) args ); ::execvp ( args [0], (char * const *) args ); char resultByte = 1; if ( pfd [1] >= 0 ) ::write ( pfd [1], &resultByte, 1 ); ::_exit ( -1 ); } else if ( pid > 0 ) { success = true; if ( pfd [1] >= 0 ) ::close ( pfd [1] ); if ( pfd [0] >= 0 ) { while ( true ) { char resultByte; int n = ::read ( pfd [0], &resultByte, 1 ); if ( n == 1 ) { success = false; break; } if (( n == -1 ) && (( errno == ECHILD ) || ( errno == EINTR ))) continue; break; // success } ::close ( pfd [0] ); } } if ( success ) StartingAppList::add( list[0] ); else QMessageBox::warning( 0, "Error", "Could not start the application " + c, "Ok", 0, 0, 0, 1 ); } #endif //QT_NO_QWS_MULTIPROCESS } /*! Executes the application identfied by \a c, passing \a document if it isn't null. Note that a better approach might be to send a QCop message to the application's QPE/Application/\e{appname} channel. */ void Global::execute( const QString &c, const QString& document ) { // ask the server to do the work #if !defined(QT_NO_COP) if ( document.isNull() ) { QCopEnvelope e( "QPE/System", "execute(QString)" ); e << c; } else { QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); e << c << document; } #endif return; } /*! Returns the string \a s with the characters '\', '"', and '$' quoted by a preceeding '\'. \sa stringQuote() */ QString Global::shellQuote(const QString& s) { QString r="\""; for (int i=0; i<(int)s.length(); i++) { char c = s[i].latin1(); switch (c) { case '\\': case '"': case '$': r+="\\"; } r += s[i]; } r += "\""; return r; } /*! Returns the string \a s with the characters '\' and '"' quoted by a preceeding '\'. \sa shellQuote() */ QString Global::stringQuote(const QString& s) { QString r="\""; for (int i=0; i<(int)s.length(); i++) { char c = s[i].latin1(); switch (c) { case '\\': case '"': r+="\\"; } r += s[i]; } r += "\""; return r; } /*! Finds all documents on the system's document directories which match the filter \a mimefilter, and appends the resulting DocLnk objects to \a folder. */ void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) { QString homedocs = QString(getenv("HOME")) + "/Documents"; DocLnkSet d(homedocs,mimefilter); folder->appendFrom(d); /** let's do intellegint way of searching these files * a) the user don't want to check mediums global * b) the user wants to check but use the global options for it * c) the user wants to check it but not this medium * d) the user wants to check and this medium as well * * In all cases we need to apply a different mimefilter to * the medium. * a) mimefilter.isEmpty() we need to apply the responding filter * either the global or the one on the medium * * b) mimefilter is set to an application we need to find out if the * mimetypes are included in the mime mask of the medium */ StorageInfo storage; const QList<FileSystem> &fs = storage.fileSystems(); QListIterator<FileSystem> it ( fs ); for ( ; it.current(); ++it ) { if ( (*it)->isRemovable() ) { // let's find out if we should search on it // this is a candidate look at the cf and see if we should search on it QString path = (*it)->path(); if( !checkStorage((*it)->path() + "/.opiestorage.cf" ) ) continue; DocLnkSet ide( path, mimefilter ); folder->appendFrom(ide); } else if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { QString path = (*it)->path() + "/Documents"; DocLnkSet ide( path, mimefilter ); folder->appendFrom(ide); } } } QStringList Global::languageList() { QString lang = getenv("LANG"); QStringList langs; langs.append(lang); int i = lang.find("."); if ( i > 0 ) lang = lang.left( i ); i = lang.find( "_" ); if ( i > 0 ) langs.append(lang.left(i)); return langs; } QStringList Global::helpPath() { QString qpeDir = QPEApplication::qpeDir(); QStringList path; QStringList langs = Global::languageList(); for (QStringList::ConstIterator it = langs.fromLast(); it!=langs.end(); --it) { QString lang = *it; if ( !lang.isEmpty() ) path += qpeDir + "/help/" + lang + "/html"; } path += qpeDir + "/pics"; path += qpeDir + "/help/html"; /* we even put english into the en dir so try it as fallback as well for opie */ path += qpeDir + "/help/en/html"; path += qpeDir + "/docs"; return path; } #include "global.moc" diff --git a/library/library.pro b/library/library.pro index ab1f451..5acfc0c 100644 --- a/library/library.pro +++ b/library/library.pro @@ -1,157 +1,157 @@ TEMPLATE = lib #CONFIG += qt warn_on release CONFIG += qt warn_on debug HEADERS = calendar.h \ global.h \ resource.h \ xmlreader.h \ mimetype.h \ menubutton.h \ network.h \ networkinterface.h \ filemanager.h \ fontmanager.h \ qdawg.h \ datebookmonth.h \ fileselector.h \ fileselector_p.h \ imageedit.h \ qcopenvelope_qws.h \ qpedecoration_qws.h \ qpeapplication.h \ qpestyle.h \ qpedialog.h \ lightstyle.h \ config.h \ applnk.h \ sound.h \ tzselect.h \ qmath.h \ datebookdb.h \ alarmserver.h \ process.h \ password.h \ timestring.h \ fontfactoryinterface.h \ fontdatabase.h \ power.h \ storage.h \ qpemessagebox.h \ timeconversion.h \ qpedebug.h \ qpemenubar.h \ qpetoolbar.h \ backend/categories.h \ stringutil.h \ backend/palmtoprecord.h \ backend/task.h \ backend/event.h \ backend/contact.h\ categorymenu.h \ categoryedit_p.h \ categoryselect.h \ categorywidget.h \ ir.h \ backend/vobject_p.h \ findwidget_p.h \ finddialog.h \ lnkproperties.h \ windowdecorationinterface.h \ textcodecinterface.h \ imagecodecinterface.h \ qt_override_p.h SOURCES = calendar.cpp \ global.cpp \ xmlreader.cpp \ mimetype.cpp \ menubutton.cpp \ network.cpp \ networkinterface.cpp \ filemanager.cpp \ fontmanager.cpp \ qdawg.cpp \ datebookmonth.cpp \ fileselector.cpp \ imageedit.cpp \ resource.cpp \ qpedecoration_qws.cpp \ qcopenvelope_qws.cpp \ qpeapplication.cpp \ qpestyle.cpp \ qpedialog.cpp \ lightstyle.cpp \ config.cpp \ applnk.cpp \ sound.cpp \ tzselect.cpp \ qmath.c \ datebookdb.cpp \ alarmserver.cpp \ password.cpp \ process.cpp \ process_unix.cpp \ timestring.cpp \ fontdatabase.cpp \ power.cpp \ storage.cpp \ qpemessagebox.cpp \ backend/timeconversion.cpp \ qpedebug.cpp \ qpemenubar.cpp \ qpetoolbar.cpp \ backend/categories.cpp \ backend/stringutil.cpp \ backend/palmtoprecord.cpp \ backend/task.cpp \ backend/event.cpp \ backend/contact.cpp \ categorymenu.cpp \ categoryedit_p.cpp \ categoryselect.cpp \ categorywidget.cpp \ ir.cpp \ backend/vcc_yacc.cpp \ backend/vobject.cpp \ findwidget_p.cpp \ finddialog.cpp \ lnkproperties.cpp \ qt_override.cpp # Qt 3 compatibility HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp INCLUDEPATH += $(OPIEDIR)/include backend -LIBS += -ldl -lcrypt -lm +# LIBS += -ldl -lcrypt -lm INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui TARGET = qpe DESTDIR = $(OPIEDIR)/lib$(PROJMAK) VERSION = 1.5.0.1 TRANSLATIONS = ../i18n/de/libqpe.ts \ ../i18n/nl/libqpe.ts \ ../i18n/xx/libqpe.ts \ ../i18n/en/libqpe.ts \ ../i18n/es/libqpe.ts \ ../i18n/fr/libqpe.ts \ ../i18n/hu/libqpe.ts \ ../i18n/ja/libqpe.ts \ ../i18n/ko/libqpe.ts \ ../i18n/no/libqpe.ts \ ../i18n/pl/libqpe.ts \ ../i18n/pt/libqpe.ts \ ../i18n/pt_BR/libqpe.ts \ ../i18n/sl/libqpe.ts \ ../i18n/zh_CN/libqpe.ts \ ../i18n/it/libqpe.ts \ ../i18n/zh_TW/libqpe.ts \ ../i18n/da/libqpe.ts include ( $(OPIEDIR)/include.pro ) contains( CONFIG, no-override ){ DEFINES += OPIE_NO_OVERRIDE_QT } diff --git a/library/network.cpp b/library/network.cpp index 3568809..991e11a 100644 --- a/library/network.cpp +++ b/library/network.cpp @@ -37,408 +37,412 @@ #include <stdlib.h> #ifndef QT_NO_COP class NetworkEmitter : public QCopChannel { Q_OBJECT public: NetworkEmitter() : QCopChannel("QPE/Network",qApp) { } void receive(const QCString &msg, const QByteArray&) { if ( msg == "choicesChanged()" ) emit changed(); } signals: void changed(); }; /*! \internal Requests that the service \a choice be started. The \a password is the password to use if required. */ void Network::start(const QString& choice, const QString& password) { QCopEnvelope e("QPE/Network", "start(QString,QString)"); e << choice << password; } /*! \class Network network.h \brief The Network class provides network access functionality. \internal */ // copy the proxy settings of the active config over to the Proxies.conf file /*! \internal */ void Network::writeProxySettings( Config &cfg ) { Config proxy( Network::settingsDir() + "/Proxies.conf", Config::File ); proxy.setGroup("Properties"); cfg.setGroup("Proxy"); proxy.writeEntry("type", cfg.readEntry("type") ); proxy.writeEntry("autoconfig", cfg.readEntry("autoconfig") ); proxy.writeEntry("httphost", cfg.readEntry("httphost") ); proxy.writeEntry("httpport", cfg.readEntry("httpport") ); proxy.writeEntry("ftphost", cfg.readEntry("ftphost") ); proxy.writeEntry("ftpport", cfg.readEntry("ftpport") ); proxy.writeEntry("noproxies", cfg.readEntry("noproxies") ); cfg.setGroup("Properties"); } /*! \internal Stops the current network service. */ void Network::stop() { QCopEnvelope e("QPE/Network", "stop()"); } static NetworkEmitter *emitter = 0; /*! \internal */ void Network::connectChoiceChange(QObject* receiver, const char* slot) { if ( !emitter ) emitter = new NetworkEmitter; QObject::connect(emitter,SIGNAL(changed()),receiver,slot); } #endif // QT_NO_COP /*! \internal */ QString Network::settingsDir() { return Global::applicationFileName("Network", "modules"); } #ifndef QT_NO_COP /*! \internal */ QStringList Network::choices(QListBox* lb, const QString& dir) { QStringList list; if ( lb ) lb->clear(); QString adir = dir.isEmpty() ? settingsDir() : dir; QDir settingsdir(adir); settingsdir.mkdir(adir); QStringList files = settingsdir.entryList("*.conf"); for (QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it ) { QString filename = settingsdir.filePath(*it); Config cfg(filename, Config::File); cfg.setGroup("Info"); if ( lb ) lb->insertItem(Resource::loadPixmap("Network/" + cfg.readEntry("Type")), cfg.readEntry("Name")); list.append(filename); } return list; } class NetworkServer : public QCopChannel { Q_OBJECT public: NetworkServer(QObject* parent) : QCopChannel("QPE/Network",parent), wait(0) { up = FALSE; examineNetworks( TRUE ); QCopChannel* card = new QCopChannel("QPE/Card",parent); connect(card,SIGNAL(received(const QCString &, const QByteArray&)), this,SLOT(cardMessage(const QCString &, const QByteArray&))); } ~NetworkServer() { stop(); } bool networkOnline() const { return up; } private: void receive(const QCString &msg, const QByteArray& data) { if ( msg == "start(QString,QString)" ) { QDataStream stream(data,IO_ReadOnly); QString file,password; stream >> file >> password; if ( file.isEmpty() ) { QStringList l = Network::choices(); for (QStringList::ConstIterator i=l.begin(); i!=l.end(); ++i) { Config cfg(*i,Config::File); cfg.setGroup("Info"); QString type = cfg.readEntry("Type"); NetworkInterface* plugin = Network::loadPlugin(type); cfg.setGroup("Properties"); if ( plugin && plugin->isAvailable(cfg) ) { file = *i; break; } } if ( file.isEmpty() ) { QCopEnvelope("QPE/Network", "failed()"); return; } } start(file,password); } else if ( msg == "stop()" ) { stop(); } else if ( msg == "choicesChanged()" ) { examineNetworks(); } } private slots: void cardMessage(const QCString &msg, const QByteArray&) { if ( msg == "stabChanged()" ) examineNetworks(); } private: void examineNetworks( bool firstStart = FALSE ) { QStringList l = Network::choices(); bool wasup = up; up=FALSE; QStringList pavailable = available; available.clear(); for (QStringList::ConstIterator it=l.begin(); it!=l.end(); ++it) { Config cfg(*it,Config::File); cfg.setGroup("Info"); QString type = cfg.readEntry("Type"); NetworkInterface* plugin = Network::loadPlugin(type); cfg.setGroup("Properties"); if ( plugin ) { if ( plugin->isActive(cfg) ) { up = TRUE; if ( firstStart ) plugin->start( cfg ); } if ( plugin->isAvailable(cfg) ) available.append(*it); } } // Try to work around unreproducible bug whereby // the netmon applet shows wrong state. bool reannounce = wait<0; if ( available != pavailable || reannounce ) { QCopEnvelope e("QPE/Network", "available(QStringList)"); e << available; } if ( up != wasup || reannounce ) { QCopEnvelope("QPE/Network", up ? "up()" : "down()"); } } void start( const QString& file, const QString& password ) { if ( !current.isEmpty() ) stop(); current = QString::null; Config cfg(file, Config::File); cfg.setGroup("Info"); QString type = cfg.readEntry("Type"); NetworkInterface* plugin = Network::loadPlugin(type); bool started = FALSE; if ( plugin ) { cfg.setGroup("Properties"); if ( plugin->start(cfg,password) ) { Network::writeProxySettings( cfg ); current = file; wait=0; startTimer(400); started = TRUE; } } if ( !started ) { QCopEnvelope("QPE/Network", "failed()"); } } void stop() { bool stopped = FALSE; if ( !current.isEmpty() ) { Config cfg(current, Config::File); cfg.setGroup("Info"); QString type = cfg.readEntry("Type"); NetworkInterface* plugin = Network::loadPlugin(type); if ( plugin ) { cfg.setGroup("Properties"); if ( plugin->stop(cfg) ) { current = QString::null; wait=0; startTimer(400); stopped = TRUE; } } } if ( !stopped ) { QCopEnvelope("QPE/Network", "failed()"); } } void timerEvent(QTimerEvent*) { examineNetworks(); if ( wait >= 0 ) { if ( up == !current.isNull() ) { // done killTimers(); if ( up ) { startTimer(3000); // monitor link wait = -1; } } else { wait++; if ( wait == 600 ) { killTimers(); // forget about it after 240 s QCopEnvelope("QPE/Network", "failed()"); up = !current.isNull(); } } } else if ( !up ) { killTimers(); } } private: QStringList available; QString current; bool up; int wait; }; static NetworkServer* ns=0; /*! \internal */ QString Network::serviceName(const QString& service) { Config cfg(service, Config::File); cfg.setGroup("Info"); return cfg.readEntry("Name"); } /*! \internal */ QString Network::serviceType(const QString& service) { Config cfg(service, Config::File); cfg.setGroup("Info"); return cfg.readEntry("Type"); } /*! \internal */ bool Network::serviceNeedsPassword(const QString& service) { Config cfg(service,Config::File); cfg.setGroup("Info"); QString type = cfg.readEntry("Type"); NetworkInterface* plugin = Network::loadPlugin(type); cfg.setGroup("Properties"); return plugin ? plugin->needPassword(cfg) : FALSE; } /*! \internal */ bool Network::networkOnline() { return ns && ns->networkOnline(); } /*! \internal */ void Network::createServer(QObject* parent) { ns = new NetworkServer(parent); } /*! \internal */ int Network::addStateWidgets(QWidget* parent) { int n=0; QStringList l = Network::choices(); QVBoxLayout* vb = new QVBoxLayout(parent); for (QStringList::ConstIterator it=l.begin(); it!=l.end(); ++it) { Config cfg(*it,Config::File); cfg.setGroup("Info"); QString type = cfg.readEntry("Type"); NetworkInterface* plugin = Network::loadPlugin(type); cfg.setGroup("Properties"); if ( plugin ) { QWidget* w; if ( (w=plugin->addStateWidget(parent,cfg)) ) { n++; vb->addWidget(w); } } } return n; } static QDict<NetworkInterface> *ifaces; /*! \internal */ NetworkInterface* Network::loadPlugin(const QString& type) { #ifndef QT_NO_COMPONENT if ( !ifaces ) ifaces = new QDict<NetworkInterface>; NetworkInterface *iface = ifaces->find(type); if ( !iface ) { +#ifdef Q_OS_MACX + QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".dylib"; +#else QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".so"; +#endif QLibrary lib(libfile); if ( !lib.queryInterface( IID_Network, (QUnknownInterface**)&iface ) == QS_OK ) return 0; ifaces->insert(type,iface); QStringList langs = Global::languageList(); for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { QString lang = *it; QTranslator * trans = new QTranslator(qApp); QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/lib"+type+".qm"; if ( trans->load( tfn )) qApp->installTranslator( trans ); else delete trans; } } return iface; #else return 0; #endif } #include "network.moc" #endif // QT_NO_COP diff --git a/library/qlibrary_unix.cpp b/library/qlibrary_unix.cpp index 7740321..0229b7b 100644 --- a/library/qlibrary_unix.cpp +++ b/library/qlibrary_unix.cpp @@ -1,132 +1,243 @@ /********************************************************************** ** 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 "qlibrary_p.h" #ifndef QT_NO_COMPONENT /* The platform dependent implementations of - loadLibrary - freeLibrary - resolveSymbol It's not too hard to guess what the functions do. */ #if defined(Q_OS_HPUX) // for HP-UX < 11.x and 32 bit #include <dl.h> bool QLibraryPrivate::loadLibrary() { if ( pHnd ) return TRUE; QString filename = library->library(); pHnd = (void*)shl_load( filename.latin1(), BIND_DEFERRED | BIND_NONFATAL | DYNAMIC_PATH, 0 ); #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) if ( !pHnd ) qDebug( "Failed to load library %s!", filename.latin1() ); #endif return pHnd != 0; } bool QLibraryPrivate::freeLibrary() { if ( !pHnd ) return TRUE; if ( !shl_unload( (shl_t)pHnd ) ) { pHnd = 0; return TRUE; } return FALSE; } void* QLibraryPrivate::resolveSymbol( const char* symbol ) { if ( !pHnd ) return 0; void* address = 0; if ( shl_findsym( (shl_t*)&pHnd, symbol, TYPE_UNDEFINED, address ) < 0 ) { #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) qDebug( "Couldn't resolve symbol \"%s\"", symbol ); #endif return 0; } return address; } -#else // Q_OS_HPUX +#elif defined(_NULL_LIB_) + +bool QLibraryPrivate::loadLibrary() +{ + //qDebug("QLibraryPrivate::loadLibrary\n"); + return FALSE; +} +bool QLibraryPrivate::freeLibrary() +{ + //qDebug("QLibraryPrivate::freeLibrary\n"); + return FALSE; +} +void* QLibraryPrivate::resolveSymbol( const char* symbol ) +{ + //qDebug("QLibraryPrivate::resolveSymbol\n"); + return FALSE; +} + +#elif defined(Q_OS_MACX) + +#define ENUM_DYLD_BOOL +enum DYLD_BOOL { + DYLD_FALSE, + DYLD_TRUE +}; +#include <mach-o/dyld.h> +typedef struct { + NSObjectFileImage img; + NSModule mod; +} DyldLibDesc; + +bool QLibraryPrivate::loadLibrary() +{ + // qDebug("QLibraryPrivate::loadLibrary\n"); + // return FALSE; + if ( pHnd ) + return TRUE; + + QString filename = library->library(); + + NSObjectFileImage img = 0; + NSModule mod = 0; + NSObjectFileImageReturnCode ret = NSCreateObjectFileImageFromFile( filename.latin1() , &img ); + if ( ret != NSObjectFileImageSuccess ) { + qWarning( "Error in NSCreateObjectFileImageFromFile(): %d; Filename: %s", ret, filename.latin1() ); + if (ret == NSObjectFileImageAccess) { + qWarning ("(NSObjectFileImageAccess)" ); + } + } else { + mod = NSLinkModule(img, filename.latin1(), NSLINKMODULE_OPTION_BINDNOW | + NSLINKMODULE_OPTION_PRIVATE | + NSLINKMODULE_OPTION_RETURN_ON_ERROR); + if (mod == 0) { + qWarning( "Error in NSLinkModule()" ); + NSDestroyObjectFileImage(img); + } + } + DyldLibDesc* desc = 0; + if (img != 0 && mod != 0) { + desc = new DyldLibDesc; + desc->img = img; + desc->mod = mod; + } + pHnd = desc; + return pHnd != 0; +} + +bool QLibraryPrivate::freeLibrary() +{ + //qDebug("QLibraryPrivate::freeLibrary\n"); + //return FALSE; + if ( !pHnd ) + return TRUE; + + DyldLibDesc* desc = (DyldLibDesc*) pHnd; + NSModule mod = desc->mod; + NSObjectFileImage img = desc->img; + DYLD_BOOL success = NSUnLinkModule(mod, NSUNLINKMODULE_OPTION_NONE); + if ( success ) { + NSDestroyObjectFileImage(img); + delete desc; + pHnd = 0; + } +#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) + else { + qWarning( "Error in NSUnLinkModule(): %d", ret ); + } +#endif + return pHnd == 0; +} + +void* QLibraryPrivate::resolveSymbol( const char* symbol ) +{ + //qDebug("QLibraryPrivate::resolveSymbol\n"); + //return FALSE; + if ( !pHnd ) + return 0; + + DyldLibDesc* desc = (DyldLibDesc*) pHnd; + NSSymbol sym = NSLookupSymbolInModule(desc->mod, symbol); + void* address = 0; + if (sym != 0) { + address = NSAddressOfSymbol(sym); + } +#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) + if ( address == 0 ) + qWarning( "Cannot find symbol: %s", symbol ); +#endif + return address; +} + +#else // Something else, assuming POSIX #include <dlfcn.h> bool QLibraryPrivate::loadLibrary() { if ( pHnd ) return TRUE; QString filename = library->library(); pHnd = dlopen( filename.latin1() , RTLD_LAZY ); #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) if ( !pHnd ) qWarning( "%s", dlerror() ); #endif return pHnd != 0; } bool QLibraryPrivate::freeLibrary() { if ( !pHnd ) return TRUE; int ec = dlclose( pHnd ); if ( !ec ) pHnd = 0; #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) else { const char* error = dlerror(); if ( error ) qWarning( "%s", error ); } #endif return pHnd == 0; } void* QLibraryPrivate::resolveSymbol( const char* f ) { if ( !pHnd ) return 0; void* address = dlsym( pHnd, f ); #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) const char* error = dlerror(); if ( error ) qWarning( "%s", error ); #endif return address; } #endif // POSIX #endif // QT_NO_COMPONENT diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index d4734ae..a97efc0 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -1,796 +1,815 @@ /********************************************************************** ** 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. ** */ #define QTOPIA_INTERNAL_LANGLIST #include <stdlib.h> #include <unistd.h> +#ifndef Q_OS_MACX #include <linux/limits.h> // needed for some toolchains (PATH_MAX) +#endif #include <qfile.h> #include <qqueue.h> #ifdef Q_WS_QWS #ifndef QT_NO_COP #if QT_VERSION <= 231 #define private public #define sendLocally processEvent #include "qcopenvelope_qws.h" #undef private #else #include "qcopenvelope_qws.h" #endif #endif #include <qwindowsystem_qws.h> #endif #include <qtextstream.h> #include <qpalette.h> #include <qbuffer.h> #include <qptrdict.h> #include <qregexp.h> #include <qdir.h> #include <qlabel.h> #include <qdialog.h> #include <qdragobject.h> #include <qtextcodec.h> #include <qevent.h> #include <qtooltip.h> #include <qsignal.h> #include <qmainwindow.h> #include <qwidgetlist.h> #include <qpixmapcache.h> #if defined(Q_WS_QWS) && !defined(QT_NO_COP) #define QTOPIA_INTERNAL_INITAPP #include "qpeapplication.h" #include "qpestyle.h" #include "styleinterface.h" #if QT_VERSION >= 300 #include <qstylefactory.h> #else #include <qplatinumstyle.h> #include <qwindowsstyle.h> #include <qmotifstyle.h> #include <qmotifplusstyle.h> #include "lightstyle.h" #include <qpe/qlibrary.h> #endif #include "global.h" #include "resource.h" #if QT_VERSION <= 230 && defined(QT_NO_CODECS) #include "qutfcodec.h" #endif #include "config.h" #include "network.h" #ifdef QWS #include "fontmanager.h" #endif #include "alarmserver.h" #include "applnk.h" #include "qpemenubar.h" #include "textcodecinterface.h" #include "imagecodecinterface.h" #include <unistd.h> #include <sys/file.h> #include <sys/ioctl.h> +#ifndef QT_NO_SOUND #include <sys/soundcard.h> - +#endif #include "qt_override_p.h" class QPEApplicationData { public: QPEApplicationData ( ) : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), keep_running( true ), qcopQok( false ), qpe_main_widget( 0 ) {} int presstimer; QWidget* presswidget; QPoint presspos; bool rightpressed : 1; bool kbgrabbed : 1; bool notbusysent : 1; bool preloaded : 1; bool forceshow : 1; bool nomaximize : 1; bool keep_running : 1; bool qcopQok : 1; QStringList langs; QString appName; struct QCopRec { QCopRec( const QCString &ch, const QCString &msg, const QByteArray &d ) : channel( ch ), message( msg ), data( d ) { } QCString channel; QCString message; QByteArray data; }; QWidget* qpe_main_widget; QGuardedPtr<QWidget> lastraised; QQueue<QCopRec> qcopq; QString styleName; QString decorationName; void enqueueQCop( const QCString &ch, const QCString &msg, const QByteArray &data ) { qcopq.enqueue( new QCopRec( ch, msg, data ) ); } void sendQCopQ() { if (!qcopQok ) return; QCopRec * r; while((r=qcopq.dequeue())) { // remove from queue before sending... // event loop can come around again before getting // back from sendLocally #ifndef QT_NO_COP QCopChannel::sendLocally( r->channel, r->message, r->data ); #endif delete r; } } static void show_mx(QWidget* mw, bool nomaximize, const QString & = QString::null ) { // ugly hack, remove that later after finding a sane solution // Addendum: Only Sharp currently has models with high resolution but (physically) small displays, // so this is only useful if QT_QWS_SIMPAD is NOT defined. E.g. SIMpad has 800x600 but has // a (physically) large enough display to use the small icons #if defined(OPIE_HIGH_RES_SMALL_PHY) if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) { ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true ); } #endif if ( mw->layout() && mw->inherits("QDialog") ) { QPEApplication::showDialog((QDialog*)mw, nomaximize); } else { #ifdef Q_WS_QWS if ( !nomaximize ) mw->showMaximized(); else #endif mw->show(); } } static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) { /* // This works but disable it for now until it is safe to apply // What is does is scan the .desktop files of all the apps for // the applnk that has the corresponding argv[0] as this program // then it uses the name stored in the .desktop file as the caption // for the main widget. This saves duplicating translations for // the app name in the program and in the .desktop files. AppLnkSet apps( appsPath ); QList<AppLnk> appsList = apps.children(); for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { if ( (*it)->exec() == appName ) { mw->setCaption( (*it)->name() ); return TRUE; } } */ return FALSE; } void show(QWidget* mw, bool nomax) { setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); nomaximize = nomax; qpe_main_widget = mw; qcopQok = TRUE; #ifndef QT_NO_COP sendQCopQ(); #endif if ( preloaded ) { if (forceshow) show_mx(mw, nomax); } else if ( keep_running ) { show_mx(mw, nomax); } } void loadTextCodecs() { QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; +#ifdef Q_OS_MACX + QDir dir( path, "lib*.dylib" ); +#else QDir dir( path, "lib*.so" ); +#endif QStringList list; if ( dir. exists ( )) list = dir.entryList(); QStringList::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { TextCodecInterface *iface = 0; QLibrary *lib = new QLibrary( path + "/" + *it ); if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { QValueList<int> mibs = iface->mibEnums(); for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { (void)iface->createForMib(*i); // ### it exists now; need to remember if we can delete it } } else { lib->unload(); delete lib; } } } void loadImageCodecs() { QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; +#ifdef Q_OS_MACX + QDir dir( path, "lib*.dylib" ); +#else QDir dir( path, "lib*.so" ); +#endif QStringList list; if ( dir. exists ( )) list = dir.entryList(); QStringList::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { ImageCodecInterface *iface = 0; QLibrary *lib = new QLibrary( path + "/" + *it ); if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { QStringList formats = iface->keys(); for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { (void)iface->installIOHandler(*i); // ### it exists now; need to remember if we can delete it } } else { lib->unload(); delete lib; } } } }; class ResourceMimeFactory : public QMimeSourceFactory { public: ResourceMimeFactory() : resImage( 0 ) { setFilePath( Global::helpPath() ); setExtensionType( "html", "text/html;charset=UTF-8" ); } ~ResourceMimeFactory() { delete resImage; } const QMimeSource* data( const QString& abs_name ) const { const QMimeSource * r = QMimeSourceFactory::data( abs_name ); if ( !r ) { int sl = abs_name.length(); do { sl = abs_name.findRev( '/', sl - 1 ); QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; int dot = name.findRev( '.' ); if ( dot >= 0 ) name = name.left( dot ); QImage img = Resource::loadImage( name ); if ( !img.isNull() ) { delete resImage; resImage = new QImageDrag( img ); r = resImage; } } while ( !r && sl > 0 ); } return r; } private: mutable QImageDrag *resImage; }; static int& hack(int& i) { #if QT_VERSION <= 230 && defined(QT_NO_CODECS) // These should be created, but aren't in Qt 2.3.0 (void)new QUtf8Codec; (void)new QUtf16Codec; #endif return i; } static int muted = 0; static int micMuted = 0; static void setVolume( int t = 0, int percent = -1 ) { switch ( t ) { case 0: { Config cfg( "qpe" ); cfg.setGroup( "Volume" ); if ( percent < 0 ) percent = cfg.readNumEntry( "VolumePercent", 50 ); +#ifndef QT_NO_SOUND int fd = 0; if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { int vol = muted ? 0 : percent; // set both channels to same volume vol |= vol << 8; ioctl( fd, MIXER_WRITE( 0 ), &vol ); ::close( fd ); } +#endif } break; } } static void setMic( int t = 0, int percent = -1 ) { switch ( t ) { case 0: { Config cfg( "qpe" ); cfg.setGroup( "Volume" ); if ( percent < 0 ) percent = cfg.readNumEntry( "Mic", 50 ); +#ifndef QT_NO_SOUND int fd = 0; int mic = micMuted ? 0 : percent; if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); ::close( fd ); } +#endif } break; } } static void setBass( int t = 0, int percent = -1 ) { switch ( t ) { case 0: { Config cfg( "qpe" ); cfg.setGroup( "Volume" ); if ( percent < 0 ) percent = cfg.readNumEntry( "BassPercent", 50 ); +#ifndef QT_NO_SOUND int fd = 0; int bass = percent; if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); ::close( fd ); } +#endif } break; } } static void setTreble( int t = 0, int percent = -1 ) { switch ( t ) { case 0: { Config cfg( "qpe" ); cfg.setGroup( "Volume" ); if ( percent < 0 ) percent = cfg.readNumEntry( "TreblePercent", 50 ); +#ifndef QT_NO_SOUND int fd = 0; int treble = percent; if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); ::close( fd ); } +#endif } break; } } /*! \class QPEApplication qpeapplication.h \brief The QPEApplication class implements various system services that are available to all Qtopia applications. Simply by using QPEApplication instead of QApplication, a standard Qt application becomes a Qtopia application. It automatically follows style changes, quits and raises, and in the case of \link docwidget.html document-oriented\endlink applications, changes the currently displayed document in response to the environment. To create a \link docwidget.html document-oriented\endlink application use showMainDocumentWidget(); to create a non-document-oriented application use showMainWidget(). The keepRunning() function indicates whether the application will continue running after it's processed the last \link qcop.html QCop\endlink message. This can be changed using setKeepRunning(). A variety of signals are emitted when certain events occur, for example, timeChanged(), clockChanged(), weekChanged(), dateFormatChanged() and volumeChanged(). If the application receives a \link qcop.html QCop\endlink message on the application's QPE/Application/\e{appname} channel, the appMessage() signal is emitted. There are also flush() and reload() signals, which are emitted when synching begins and ends respectively - upon these signals, the application should save and reload any data files that are involved in synching. Most of these signals will initially be received and unfiltered through the appMessage() signal. This class also provides a set of useful static functions. The qpeDir() and documentDir() functions return the respective paths. The grabKeyboard() and ungrabKeyboard() functions are used to control whether the application takes control of the device's physical buttons (e.g. application launch keys). The stylus' mode of operation is set with setStylusOperation() and retrieved with stylusOperation(). There are also setInputMethodHint() and inputMethodHint() functions. \ingroup qtopiaemb */ /*! \fn void QPEApplication::clientMoused() \internal */ /*! \fn void QPEApplication::timeChanged(); This signal is emitted when the time changes outside the normal passage of time, i.e. if the time is set backwards or forwards. */ /*! \fn void QPEApplication::clockChanged( bool ampm ); This signal is emitted when the user changes the clock's style. If \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, they want a 24-hour clock. */ /*! \fn void QPEApplication::volumeChanged( bool muted ) This signal is emitted whenever the mute state is changed. If \a muted is TRUE, then sound output has been muted. */ /*! \fn void QPEApplication::weekChanged( bool startOnMonday ) This signal is emitted if the week start day is changed. If \a startOnMonday is TRUE then the first day of the week is Monday; if \a startOnMonday is FALSE then the first day of the week is Sunday. */ /*! \fn void QPEApplication::dateFormatChanged(DateFormat) This signal is emitted whenever the date format is changed. */ /*! \fn void QPEApplication::flush() ### */ /*! \fn void QPEApplication::reload() */ void QPEApplication::processQCopFile() { QString qcopfn("/tmp/qcop-msg-"); qcopfn += d->appName; // append command name QFile f(qcopfn); if ( f.open(IO_ReadWrite) ) { #ifndef Q_OS_WIN32 flock(f.handle(), LOCK_EX); #endif QDataStream ds(&f); QCString channel, message; QByteArray data; while(!ds.atEnd()) { ds >> channel >> message >> data; d->enqueueQCop(channel,message,data); } ::ftruncate(f.handle(), 0); #ifndef Q_OS_WIN32 f.flush(); flock(f.handle(), LOCK_UN); #endif } #endif } /*! \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) This signal is emitted when a message is received on this application's QPE/Application/<i>appname</i> \link qcop.html QCop\endlink channel. The slot to which you connect this signal uses \a msg and \a data in the following way: \code void MyWidget::receive( const QCString& msg, const QByteArray& data ) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "someMessage(int,int,int)" ) { int a,b,c; stream >> a >> b >> c; ... } else if ( msg == "otherMessage(QString)" ) { ... } } \endcode \sa qcop.html Note that messages received here may be processed by qpe application and emitted as signals, such as flush() and reload(). */ /*! Constructs a QPEApplication just as you would construct a QApplication, passing \a argc, \a argv, and \a t. For applications, \a t should be the default, GuiClient. Only the Qtopia server passes GuiServer. */ QPEApplication::QPEApplication( int & argc, char **argv, Type t ) : QApplication( hack(argc), argv, t ), pidChannel( 0 ) { QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. d = new QPEApplicationData; d->loadTextCodecs(); d->loadImageCodecs(); int dw = desktop() ->width(); if ( dw < 200 ) { setFont( QFont( "vera", 8 ) ); AppLnk::setSmallIconSize( 10 ); AppLnk::setBigIconSize( 28 ); } #if defined(OPIE_HIGH_RES_SMALL_PHY) else if ( dw > 600 ) { setFont( QFont( "vera", 16 ) ); AppLnk::setSmallIconSize( 24 ); AppLnk::setBigIconSize( 48 ); } #endif else if ( dw > 200 ) { setFont( QFont( "vera", 10 ) ); AppLnk::setSmallIconSize( 14 ); AppLnk::setBigIconSize( 32 ); } QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); sysChannel = new QCopChannel( "QPE/System", this ); connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); /* COde now in initapp */ #if 0 #if defined(Q_WS_QWS) && !defined(QT_NO_COP) QString qcopfn( "/tmp/qcop-msg-" ); qcopfn += QString( argv[ 0 ] ); // append command name QFile f( qcopfn ); if ( f.open( IO_ReadOnly ) ) { flock( f.handle(), LOCK_EX ); } QCString channel = QCString( argv[ 0 ] ); channel.replace( QRegExp( ".*/" ), "" ); d->appName = channel; channel = "QPE/Application/" + channel; pidChannel = new QCopChannel( channel, this ); connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); if ( f.isOpen() ) { d->keep_running = FALSE; QDataStream ds( &f ); QCString channel, message; QByteArray data; while ( !ds.atEnd() ) { ds >> channel >> message >> data; d->enqueueQCop( channel, message, data ); } flock( f.handle(), LOCK_UN ); f.close(); f.remove(); } for ( int a = 0; a < argc; a++ ) { if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { argv[ a ] = argv[ a + 1 ]; a++; d->preloaded = TRUE; argc -= 1; } else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { argv[ a ] = argv[ a + 1 ]; a++; d->preloaded = TRUE; d->forceshow = TRUE; argc -= 1; } } /* overide stored arguments */ setArgs( argc, argv ); #endif #else initApp( argc, argv ); #endif // qwsSetDecoration( new QPEDecoration() ); #ifndef QT_NO_TRANSLATION d->langs = Global::languageList(); for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { QString lang = *it; installTranslation( lang + "/libopie.qm"); installTranslation( lang + "/libqpe.qm" ); installTranslation( lang + "/" + d->appName + ".qm" ); //###language/font hack; should look it up somewhere #ifdef QWS if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { QFont fn = FontManager::unicodeFont( FontManager::Proportional ); setFont( fn ); } #endif } #endif applyStyle(); if ( type() == GuiServer ) { setVolume(); } installEventFilter( this ); QPEMenuToolFocusManager::initialize(); #ifdef QT_NO_QWS_CURSOR // if we have no cursor, probably don't want tooltips QToolTip::setEnabled( FALSE ); #endif } #ifdef QTOPIA_INTERNAL_INITAPP void QPEApplication::initApp( int argc, char **argv ) { bool initial = pidChannel; // was set to 0 in the initializer delete pidChannel; d->keep_running = TRUE; d->preloaded = FALSE; d->forceshow = FALSE; QCString channel = QCString(argv[0]); channel.replace(QRegExp(".*/"),""); d->appName = channel; #if QT_VERSION > 235 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 #endif channel = "QPE/Application/" + channel; pidChannel = new QCopChannel( channel, this); connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(pidMessage(const QCString &, const QByteArray &))); if (!initial) { processQCopFile(); d->keep_running = d->qcopq.isEmpty(); } for (int a=0; a<argc; a++) { if ( qstrcmp(argv[a],"-preload")==0 ) { argv[a] = argv[a+1]; a++; d->preloaded = TRUE; argc-=1; } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { argv[a] = argv[a+1]; a++; d->preloaded = TRUE; d->forceshow = TRUE; argc-=1; } } /* overide stored arguments */ setArgs(argc, argv); /* install translation here */ for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) installTranslation( (*it) + "/" + d->appName + ".qm" ); } #endif static QPtrDict<void>* inputMethodDict = 0; static void createInputMethodDict() { if ( !inputMethodDict ) inputMethodDict = new QPtrDict<void>; } /*! Returns the currently set hint to the system as to whether widget \a w has any use for text input methods. \sa setInputMethodHint() InputMethodHint */ QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) { if ( inputMethodDict && w ) return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); return Normal; } /*! \enum QPEApplication::InputMethodHint \value Normal the application sometimes needs text input (the default). \value AlwaysOff the application never needs text input. \value AlwaysOn the application always needs text input. */ @@ -1268,773 +1287,779 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data if ( type() == GuiServer ) restart(); } else if ( msg == "language(QString)" ) { if ( type() == GuiServer ) { QString l; stream >> l; QString cl = getenv( "LANG" ); if ( cl != l ) { if ( l.isNull() ) unsetenv( "LANG" ); else setenv( "LANG", l.latin1(), 1 ); restart(); } } } else if ( msg == "timeChange(QString)" ) { QString t; stream >> t; if ( t.isNull() ) unsetenv( "TZ" ); else setenv( "TZ", t.latin1(), 1 ); // emit the signal so everyone else knows... emit timeChanged(); } else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { if ( type() == GuiServer ) { QDateTime when; QCString channel, message; int data; stream >> when >> channel >> message >> data; AlarmServer::addAlarm( when, channel, message, data ); } } else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { if ( type() == GuiServer ) { QDateTime when; QCString channel, message; int data; stream >> when >> channel >> message >> data; AlarmServer::deleteAlarm( when, channel, message, data ); } } else if ( msg == "clockChange(bool)" ) { int tmp; stream >> tmp; emit clockChanged( tmp ); } else if ( msg == "weekChange(bool)" ) { int tmp; stream >> tmp; emit weekChanged( tmp ); } else if ( msg == "setDateFormat(DateFormat)" ) { DateFormat tmp; stream >> tmp; emit dateFormatChanged( tmp ); } else if ( msg == "setVolume(int,int)" ) { int t, v; stream >> t >> v; setVolume( t, v ); emit volumeChanged( muted ); } else if ( msg == "volumeChange(bool)" ) { stream >> muted; setVolume(); emit volumeChanged( muted ); } else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> int t, v; stream >> t >> v; setMic( t, v ); emit micChanged( micMuted ); } else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> stream >> micMuted; setMic(); emit micChanged( micMuted ); } else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> int t, v; stream >> t >> v; setBass( t, v ); } else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> setBass(); } else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> int t, v; stream >> t >> v; setTreble( t, v ); } else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> setTreble(); } else if ( msg == "getMarkedText()" ) { if ( type() == GuiServer ) { const ushort unicode = 'C'-'@'; const int scan = Key_C; qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); } } else if ( msg == "newChannel(QString)") { QString myChannel = "QPE/Application/" + d->appName; QString channel; stream >> channel; if (channel == myChannel) { processQCopFile(); d->sendQCopQ(); } } #endif } /*! \internal */ bool QPEApplication::raiseAppropriateWindow() { bool r=FALSE; // 1. Raise the main widget QWidget *top = d->qpe_main_widget; if ( !top ) top = mainWidget(); if ( top && d->keep_running ) { if ( top->isVisible() ) r = TRUE; else if (d->preloaded) { // We are preloaded and not visible.. pretend we just started.. #ifndef QT_NO_COP QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); e << d->appName; #endif } d->show_mx(top,d->nomaximize, d->appName); top->raise(); } QWidget *topm = activeModalWidget(); // 2. Raise any parentless widgets (except top and topm, as they // are raised before and after this loop). Order from most // recently raised as deepest to least recently as top, so // that repeated calls cycle through widgets. QWidgetList *list = topLevelWidgets(); if ( list ) { bool foundlast = FALSE; QWidget* topsub = 0; if ( d->lastraised ) { for (QWidget* w = list->first(); w; w = list->next()) { if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { if ( w == d->lastraised ) foundlast = TRUE; if ( foundlast ) { w->raise(); topsub = w; } } } } for (QWidget* w = list->first(); w; w = list->next()) { if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { if ( w == d->lastraised ) break; w->raise(); topsub = w; } } d->lastraised = topsub; delete list; } // 3. Raise the active modal widget. if ( topm && topm != top ) { topm->show(); topm->raise(); // If we haven't already handled the fastAppShowing message if (!top && d->preloaded) { #ifndef QT_NO_COP QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); e << d->appName; #endif } r = FALSE; } return r; } void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) { #ifdef Q_WS_QWS if ( msg == "quit()" ) { tryQuit(); } else if ( msg == "quitIfInvisible()" ) { if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) quit(); } else if ( msg == "close()" ) { hideOrQuit(); } else if ( msg == "disablePreload()" ) { d->preloaded = FALSE; d->keep_running = TRUE; /* so that quit will quit */ } else if ( msg == "enablePreload()" ) { if (d->qpe_main_widget) d->preloaded = TRUE; d->keep_running = TRUE; /* so next quit won't quit */ } else if ( msg == "raise()" ) { d->keep_running = TRUE; d->notbusysent = FALSE; raiseAppropriateWindow(); // Tell the system we're still chugging along... QCopEnvelope e("QPE/System", "appRaised(QString)"); e << d->appName; } else if ( msg == "flush()" ) { emit flush(); // we need to tell the desktop QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); e << d->appName; } else if ( msg == "reload()" ) { emit reload(); } else if ( msg == "setDocument(QString)" ) { d->keep_running = TRUE; QDataStream stream( data, IO_ReadOnly ); QString doc; stream >> doc; QWidget *mw = mainWidget(); if ( !mw ) mw = d->qpe_main_widget; if ( mw ) Global::setDocument( mw, doc ); } else if ( msg == "QPEProcessQCop()" ) { processQCopFile(); d->sendQCopQ(); }else { bool p = d->keep_running; d->keep_running = FALSE; emit appMessage( msg, data); if ( d->keep_running ) { d->notbusysent = FALSE; raiseAppropriateWindow(); if ( !p ) { // Tell the system we're still chugging along... #ifndef QT_NO_COP QCopEnvelope e("QPE/System", "appRaised(QString)"); e << d->appName; #endif } } if ( p ) d->keep_running = p; } #endif } /*! Sets widget \a mw as the mainWidget() and shows it. For small windows, consider passing TRUE for \a nomaximize rather than the default FALSE. \sa showMainDocumentWidget() */ void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) { d->show(mw, nomaximize ); } /*! Sets widget \a mw as the mainWidget() and shows it. For small windows, consider passing TRUE for \a nomaximize rather than the default FALSE. This calls designates the application as a \link docwidget.html document-oriented\endlink application. The \a mw widget \e must have this slot: setDocument(const QString&). \sa showMainWidget() */ void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) { if ( mw && argc() == 2 ) Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); d->show(mw, nomaximize ); } /*! If an application is started via a \link qcop.html QCop\endlink message, the application will process the \link qcop.html QCop\endlink message and then quit. If the application calls this function while processing a \link qcop.html QCop\endlink message, after processing its outstanding \link qcop.html QCop\endlink messages the application will start 'properly' and show itself. \sa keepRunning() */ void QPEApplication::setKeepRunning() { if ( qApp && qApp->inherits( "QPEApplication" ) ) { QPEApplication * qpeApp = ( QPEApplication* ) qApp; qpeApp->d->keep_running = TRUE; } } /*! Returns TRUE if the application will quit after processing the current list of qcop messages; otherwise returns FALSE. \sa setKeepRunning() */ bool QPEApplication::keepRunning() const { return d->keep_running; } /*! \internal */ void QPEApplication::internalSetStyle( const QString &style ) { #if QT_VERSION >= 300 if ( style == "QPE" ) { setStyle( new QPEStyle ); } else { QStyle *s = QStyleFactory::create( style ); if ( s ) setStyle( s ); } #else if ( style == "Windows" ) { setStyle( new QWindowsStyle ); } else if ( style == "QPE" ) { setStyle( new QPEStyle ); } else if ( style == "Light" ) { setStyle( new LightStyle ); } #ifndef QT_NO_STYLE_PLATINUM else if ( style == "Platinum" ) { setStyle( new QPlatinumStyle ); } #endif #ifndef QT_NO_STYLE_MOTIF else if ( style == "Motif" ) { setStyle( new QMotifStyle ); } #endif #ifndef QT_NO_STYLE_MOTIFPLUS else if ( style == "MotifPlus" ) { setStyle( new QMotifPlusStyle ); } #endif else { QStyle *sty = 0; QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; +#ifdef Q_OS_MACX + if ( style. find ( ".dylib" ) > 0 ) + path += style; + else + path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility +#else if ( style. find ( ".so" ) > 0 ) path += style; else path = path + "lib" + style. lower ( ) + ".so"; // compatibility - +#endif static QLibrary *lastlib = 0; static StyleInterface *lastiface = 0; QLibrary *lib = new QLibrary ( path ); StyleInterface *iface = 0; if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) sty = iface-> style ( ); if ( sty ) { setStyle ( sty ); if ( lastiface ) lastiface-> release ( ); lastiface = iface; if ( lastlib ) { lastlib-> unload ( ); delete lastlib; } lastlib = lib; } else { if ( iface ) iface-> release ( ); delete lib; setStyle ( new LightStyle ( )); } } #endif } /*! \internal */ void QPEApplication::prepareForTermination( bool willrestart ) { if ( willrestart ) { // Draw a big wait icon, the image can be altered in later revisions // QWidget *d = QApplication::desktop(); QImage img = Resource::loadImage( "launcher/new_wait" ); QPixmap pix; pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); lblWait->setPixmap( pix ); lblWait->setAlignment( QWidget::AlignCenter ); lblWait->show(); lblWait->showMaximized(); } #ifndef SINGLE_APP { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); } processEvents(); // ensure the message goes out. sleep( 1 ); // You have 1 second to comply. #endif } /*! \internal */ void QPEApplication::shutdown() { // Implement in server's QPEApplication subclass } /*! \internal */ void QPEApplication::restart() { // Implement in server's QPEApplication subclass } static QPtrDict<void>* stylusDict = 0; static void createDict() { if ( !stylusDict ) stylusDict = new QPtrDict<void>; } /*! Returns the current StylusMode for widget \a w. \sa setStylusOperation() StylusMode */ QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) { if ( stylusDict ) return ( StylusMode ) ( int ) stylusDict->find( w ); return LeftOnly; } /*! \enum QPEApplication::StylusMode \value LeftOnly the stylus only generates LeftButton events (the default). \value RightOnHold the stylus generates RightButton events if the user uses the press-and-hold gesture. \sa setStylusOperation() stylusOperation() */ /*! Causes widget \a w to receive mouse events according to the stylus \a mode. \sa stylusOperation() StylusMode */ void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) { createDict(); if ( mode == LeftOnly ) { stylusDict->remove ( w ); w->removeEventFilter( qApp ); } else { stylusDict->insert( w, ( void* ) mode ); connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); w->installEventFilter( qApp ); } } /*! \reimp */ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) { if ( !o->isWidgetType() ) return FALSE; if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { QMouseEvent * me = ( QMouseEvent* ) e; StylusMode mode = (StylusMode)(int)stylusDict->find(o); switch (mode) { case RightOnHold: switch ( me->type() ) { case QEvent::MouseButtonPress: if ( me->button() == LeftButton ) { if (!d->presstimer ) d->presstimer = startTimer(500); // #### pref. d->presswidget = (QWidget*)o; d->presspos = me->pos(); d->rightpressed = FALSE; } break; case QEvent::MouseMove: if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { killTimer(d->presstimer); d->presstimer = 0; } break; case QEvent::MouseButtonRelease: if ( me->button() == LeftButton ) { if ( d->presstimer ) { killTimer(d->presstimer); d->presstimer = 0; } if ( d->rightpressed && d->presswidget ) { // Right released postEvent( d->presswidget, new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), RightButton, LeftButton + RightButton ) ); // Left released, off-widget postEvent( d->presswidget, new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), LeftButton, LeftButton ) ); postEvent( d->presswidget, new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), LeftButton, LeftButton ) ); d->rightpressed = FALSE; return TRUE; // don't send the real Left release } } break; default: break; } break; default: ; } } else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { QKeyEvent *ke = (QKeyEvent *)e; if ( ke->key() == Key_Enter ) { if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); return TRUE; } } } return FALSE; } /*! \reimp */ void QPEApplication::timerEvent( QTimerEvent *e ) { if ( e->timerId() == d->presstimer && d->presswidget ) { // Right pressed postEvent( d->presswidget, new QMouseEvent( QEvent::MouseButtonPress, d->presspos, RightButton, LeftButton ) ); killTimer( d->presstimer ); d->presstimer = 0; d->rightpressed = TRUE; } } void QPEApplication::removeSenderFromStylusDict() { stylusDict->remove ( ( void* ) sender() ); if ( d->presswidget == sender() ) d->presswidget = 0; } /*! \internal */ bool QPEApplication::keyboardGrabbed() const { return d->kbgrabbed; } /*! Reverses the effect of grabKeyboard(). This is called automatically on program exit. */ void QPEApplication::ungrabKeyboard() { ((QPEApplication *) qApp )-> d-> kbgrabbed = false; } /*! Grabs the physical keyboard keys, e.g. the application's launching keys. Instead of launching applications when these keys are pressed the signals emitted are sent to this application instead. Some games programs take over the launch keys in this way to make interaction easier. \sa ungrabKeyboard() */ void QPEApplication::grabKeyboard() { ((QPEApplication *) qApp )-> d-> kbgrabbed = true; } /*! \reimp */ int QPEApplication::exec() { d->qcopQok = true; #ifndef QT_NO_COP d->sendQCopQ(); if ( !d->keep_running ) processEvents(); // we may have received QCop messages in the meantime. #endif if ( d->keep_running ) //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) return QApplication::exec(); #ifndef QT_NO_COP { QCopEnvelope e( "QPE/System", "closing(QString)" ); e << d->appName; } #endif processEvents(); return 0; } /*! \internal External request for application to quit. Quits if possible without loosing state. */ void QPEApplication::tryQuit() { if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) return ; // Inside modal loop or konsole. Too hard to save state. #ifndef QT_NO_COP { QCopEnvelope e( "QPE/System", "closing(QString)" ); e << d->appName; } #endif processEvents(); quit(); } /*! \internal */ void QPEApplication::installTranslation( const QString& baseName ) { QTranslator* trans = new QTranslator(this); QString tfn = qpeDir() + "/i18n/"+baseName; if ( trans->load( tfn ) ) installTranslator( trans ); else delete trans; } /*! \internal User initiated quit. Makes the window 'Go Away'. If preloaded this means hiding the window. If not it means quitting the application. As this is user initiated we don't need to check state. */ void QPEApplication::hideOrQuit() { processEvents(); // If we are a preloaded application we don't actually quit, so emit // a System message indicating we're quasi-closing. if ( d->preloaded && d->qpe_main_widget ) #ifndef QT_NO_COP { QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); e << d->appName; d->qpe_main_widget->hide(); } #endif else quit(); } #if (__GNUC__ > 2 ) extern "C" void __cxa_pure_virtual(); void __cxa_pure_virtual() { fprintf( stderr, "Pure virtual called\n"); abort(); } #endif #if defined(OPIE_NEW_MALLOC) // The libraries with the skiff package (and possibly others) have // completely useless implementations of builtin new and delete that // use about 50% of your CPU. Here we revert to the simple libc // functions. void* operator new[]( size_t size ) { return malloc( size ); } void* operator new( size_t size ) { return malloc( size ); } void operator delete[]( void* p ) { free( p ); } void operator delete[]( void* p, size_t /*size*/ ) { free( p ); } void operator delete( void* p ) { diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp index 933542d..bac1a75 100644 --- a/library/qpedecoration_qws.cpp +++ b/library/qpedecoration_qws.cpp @@ -131,773 +131,781 @@ public: }; QPEManager::QPEManager( QPEDecoration *d, QObject *parent ) : QObject( parent ), decoration( d ), helpState(0), inWhatsThis(FALSE) { wtTimer = new QTimer( this ); connect( wtTimer, SIGNAL(timeout()), this, SLOT(whatsThisTimeout()) ); } void QPEManager::updateActive() { QWidget *newActive = qApp->activeWindow(); if ( newActive && (QWidget*)active == newActive ) return; if ( active && (!newActive || ((TLWidget *)newActive)->manager()) ) { ((TLWidget *)(QWidget*)active)->manager()->removeEventFilter( this ); } if ( newActive && ((TLWidget *)newActive)->manager() ) { active = newActive; ((TLWidget *)(QWidget*)active)->manager()->installEventFilter( this ); } else if ( !newActive ) { active = 0; } } int QPEManager::pointInQpeRegion( QWidget *w, const QPoint &p ) { QRect rect(w->geometry()); if ( decoration->region( w, rect, (QWSDecoration::Region)QPEDecoration::Help ).contains(p) ) return QPEDecoration::Help; for (int i = QWSDecoration::LastRegion; i >= QWSDecoration::Title; i--) { if (decoration->region(w, rect, (QWSDecoration::Region)i).contains(p)) return (QWSDecoration::Region)i; } return QWSDecoration::None; } bool QPEManager::eventFilter( QObject *o, QEvent *e ) { QWSManager *mgr = (QWSManager *)o; QWidget *w = mgr->widget(); switch ( e->type() ) { case QEvent::MouseButtonPress: { pressTime = QTime::currentTime(); QPoint p = ((QMouseEvent*)e)->globalPos(); int inRegion = pointInQpeRegion( w, p ); #ifdef WHATSTHIS_MODE if ( !w->geometry().contains(p) && QWhatsThis::inWhatsThisMode() ) { QString text; switch ( inRegion ) { case QWSDecoration::Close: if ( ((HackWidget*)w)->needsOk() ) text = QObject::tr("Click to close this window, discarding changes."); else text = QObject::tr("Click to close this window."); break; case QWSDecoration::Minimize: text = QObject::tr("Click to close this window and apply changes."); break; case QWSDecoration::Maximize: if ( w->isMaximized() ) text = QObject::tr("Click to make this window moveable."); else text = QObject::tr("Click to make this window use all available screen area."); break; default: break; } QWhatsThis::leaveWhatsThisMode( text ); whatsThisTimeout(); helpState = 0; return true; } #endif if ( inRegion == QPEDecoration::Help ) { #ifdef WHATSTHIS_MODE wtTimer->start( 400, TRUE ); #endif helpState = QWSButton::Clicked|QWSButton::MouseOver; drawButton( w, QPEDecoration::Help, helpState ); return true; } } break; case QEvent::MouseButtonRelease: if ( helpState & QWSButton::Clicked ) { wtTimer->stop(); helpState = 0; drawButton( w, QPEDecoration::Help, helpState ); QPoint p = ((QMouseEvent*)e)->globalPos(); if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) { decoration->help( w ); } return true; } break; case QEvent::MouseMove: if ( helpState & QWSButton::Clicked ) { int oldState = helpState; QPoint p = ((QMouseEvent*)e)->globalPos(); if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) { helpState = QWSButton::Clicked|QWSButton::MouseOver; } else { helpState = 0; } if ( helpState != oldState ) drawButton( w, QPEDecoration::Help, helpState ); } break; default: break; } return QObject::eventFilter( o, e ); } void QPEManager::drawButton( QWidget *w, QPEDecoration::QPERegion r, int state ) { QPainter painter(w); QRegion rgn = ((TLWidget *)w)->topExtra()->decor_allocated_region; painter.internalGfx()->setWidgetDeviceRegion( rgn ); painter.setClipRegion(decoration->region(w, w->rect(),QWSDecoration::All)); decoration->paintButton( &painter, w, (QWSDecoration::Region)r, state ); } void QPEManager::drawTitle( QWidget *w ) { QPainter painter(w); QRegion rgn = ((TLWidget *)w)->topExtra()->decor_allocated_region; painter.internalGfx()->setWidgetDeviceRegion( rgn ); painter.setClipRegion(decoration->region(w, w->rect(),QWSDecoration::All)); decoration->paint( &painter, w ); decoration->paintButton(&painter, w, QWSDecoration::Menu, 0); decoration->paintButton(&painter, w, QWSDecoration::Close, 0); decoration->paintButton(&painter, w, QWSDecoration::Minimize, 0); decoration->paintButton(&painter, w, QWSDecoration::Maximize, 0); } void QPEManager::whatsThisTimeout() { if ( !QWhatsThis::inWhatsThisMode() ) { if ( inWhatsThis ) { if ( whatsThis ) { QWidget *w = whatsThis; whatsThis = 0; drawTitle( w ); } wtTimer->stop(); } else { QWhatsThis::enterWhatsThisMode(); helpState = 0; updateActive(); if ( active ) { whatsThis = active; drawTitle( active ); // check periodically to see if we've left whats this mode wtTimer->start( 250 ); } } inWhatsThis = !inWhatsThis; } } //=========================================================================== static QImage *okImage( int th ) { static QImage *i = 0; if ( !i || i->height() != th ) { delete i; i = new QImage(scaleButton(Resource::loadImage("OKButton"),th)); } return i; } static QImage *closeImage( int th ) { static QImage *i = 0; if ( !i || i->height() != th ) { delete i; i = new QImage(scaleButton(Resource::loadImage("CloseButton"),th)); } return i; } static QImage *helpImage( int th ) { static QImage *i = 0; if ( !i || i->height() != th ) { delete i; i = new QImage(scaleButton(Resource::loadImage("HelpButton"),th)); } return i; } static QImage *maximizeImage( int th ) { static QImage *i = 0; if ( !i || i->height() != th ) { delete i; i = new QImage(scaleButton(Resource::loadImage("MaximizeButton"),th)); } return i; } int WindowDecorationInterface::metric( Metric m, const WindowData *wd ) const { switch ( m ) { case TitleHeight: if ( QApplication::desktop()->height() > 320 ) return 19; else return 15; case LeftBorder: case RightBorder: case TopBorder: case BottomBorder: return 4; case OKWidth: return okImage(metric(TitleHeight,wd))->width(); case CloseWidth: return closeImage(metric(TitleHeight,wd))->width(); case HelpWidth: return helpImage(metric(TitleHeight,wd))->width(); case MaximizeWidth: return maximizeImage(metric(TitleHeight,wd))->width(); case CornerGrabSize: return 16; } return 0; } void WindowDecorationInterface::drawArea( Area a, QPainter *p, const WindowData *wd ) const { int th = metric( TitleHeight, wd ); QRect r = wd->rect; switch ( a ) { case Border: { const QColorGroup &cg = wd->palette.active(); qDrawWinPanel(p, r.x()-metric(LeftBorder,wd), r.y()-th-metric(TopBorder,wd), r.width()+metric(LeftBorder,wd)+metric(RightBorder,wd), r.height()+th+metric(TopBorder,wd)+metric(BottomBorder,wd), cg, FALSE, &cg.brush(QColorGroup::Background)); } break; case Title: { const QColorGroup &cg = wd->palette.active(); QBrush titleBrush; QPen titleLines; if ( wd->flags & WindowData::Active ) { titleBrush = cg.brush(QColorGroup::Highlight); titleLines = titleBrush.color().dark(); } else { titleBrush = cg.brush(QColorGroup::Background); titleLines = titleBrush.color(); } p->fillRect( r.x(), r.y()-th, r.width(), th, titleBrush); p->setPen( titleLines ); for ( int i = r.y()-th; i < r.y(); i += 2 ) p->drawLine( r.left(), i, r.right(), i ); } break; case TitleText: p->drawText( r.x()+3+metric(HelpWidth,wd), r.top()-th, r.width()-metric(OKWidth,wd)-metric(CloseWidth,wd), th, QPainter::AlignVCenter, wd->caption); break; } } void WindowDecorationInterface::drawButton( Button b, QPainter *p, const WindowData *wd, int x, int y, int, int, QWSButton::State state ) const { QImage *img = 0; switch ( b ) { case OK: img = okImage(metric(TitleHeight,wd)); break; case Close: img = closeImage(metric(TitleHeight,wd)); break; case Help: img = helpImage(metric(TitleHeight,wd)); break; case Maximize: img = maximizeImage(metric(TitleHeight,wd)); break; } if ( img ) { if ((state & QWSButton::MouseOver) && (state & QWSButton::Clicked)) p->drawImage(x+2, y+2, *img); else p->drawImage(x+1, y+1, *img); } } QRegion WindowDecorationInterface::mask( const WindowData *wd ) const { int th = metric(TitleHeight,wd); QRect rect( wd->rect ); QRect r(rect.left() - metric(LeftBorder,wd), rect.top() - th - metric(TopBorder,wd), rect.width() + metric(LeftBorder,wd) + metric(RightBorder,wd), rect.height() + th + metric(TopBorder,wd) + metric(BottomBorder,wd)); return QRegion(r) - rect; } class DefaultWindowDecoration : public WindowDecorationInterface { public: DefaultWindowDecoration() : ref(0) {} QString name() const { return "Default"; } QPixmap icon() const { return QPixmap(); } QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_WindowDecoration ) *iface = this; if ( *iface ) (*iface)->addRef(); return QS_OK; } Q_REFCOUNT private: ulong ref; }; static WindowDecorationInterface *wdiface = 0; static QLibrary *wdlib = 0; static QString libname; //=========================================================================== QPEDecoration::QPEDecoration() : QWSDefaultDecoration() { init ( libname ); } QPEDecoration::QPEDecoration( const QString &plugin ) : QWSDefaultDecoration() { init ( plugin ); } void QPEDecoration::init ( const QString &plugin ) { libname = plugin; if ( wdlib ) { wdiface->release(); wdlib->unload(); delete wdlib; wdlib = 0; } else { delete wdiface; } WindowDecorationInterface *iface = 0; QString path = QPEApplication::qpeDir() + "/plugins/decorations/"; +#ifdef Q_OS_MACX + if ( plugin.find( ".dylib" ) > 0 ) { +#else if ( plugin.find( ".so" ) > 0 ) { +#endif // full library name supplied path += plugin; } else { +#ifdef Q_OS_MACX + path += "lib" + plugin.lower() + ".dylib"; // compatibility +#else path += "lib" + plugin.lower() + ".so"; // compatibility +#endif } QLibrary *lib = new QLibrary( path ); if ( lib->queryInterface( IID_WindowDecoration, (QUnknownInterface**)&iface ) == QS_OK && iface ) { wdiface = iface; wdlib = lib; } else { delete lib; wdiface = new DefaultWindowDecoration; } helpFile = QString(qApp->argv()[0]) + ".html"; QStringList helpPath = Global::helpPath(); helpExists = FALSE; for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !helpExists; ++it) { helpExists = QFile::exists( *it + "/" + helpFile ); //qDebug ( "Checking %s/%s for help: %d", (*it).latin1(), helpFile.latin1(),helpExists); } qpeManager = new QPEManager( this ); // Qtopia 1.5 compatibility imageOk = *okImage ( 15 ); imageClose = *closeImage ( 15 ); imageHelp = *helpImage ( 15 ); } QPEDecoration::~QPEDecoration() { delete qpeManager; } const char **QPEDecoration::menuPixmap() { return (const char **)0; } const char **QPEDecoration::closePixmap() { return (const char **)qpe_close_xpm; } const char **QPEDecoration::minimizePixmap() { return (const char **)qpe_accept_xpm; } const char **QPEDecoration::maximizePixmap() { return (const char **)0; } const char **QPEDecoration::normalizePixmap() { return (const char **)0; } int QPEDecoration::getTitleHeight( const QWidget *w ) { WindowDecorationInterface::WindowData wd; windowData( w, wd ); return wdiface->metric(WindowDecorationInterface::TitleHeight,&wd); } /* If rect is empty, no frame is added. (a hack, really) */ QRegion QPEDecoration::region(const QWidget *widget, const QRect &rect, QWSDecoration::Region type) { qpeManager->updateActive(); WindowDecorationInterface::WindowData wd; windowData( widget, wd ); wd.rect = rect; int titleHeight = wdiface->metric(WindowDecorationInterface::TitleHeight,&wd); int okWidth = wdiface->metric(WindowDecorationInterface::OKWidth,&wd); int closeWidth = wdiface->metric(WindowDecorationInterface::CloseWidth,&wd); int helpWidth = wdiface->metric(WindowDecorationInterface::HelpWidth,&wd); int grab = wdiface->metric(WindowDecorationInterface::CornerGrabSize,&wd); QRegion region; switch ((int)type) { case Menu: break; case Maximize: if ( !widget->inherits( "QDialog" ) && qApp->desktop()->width() > 350 ) { int maximizeWidth = wdiface->metric(WindowDecorationInterface::MaximizeWidth,&wd); int left = rect.right() - maximizeWidth - closeWidth; if ( ((HackWidget *)widget)->needsOk() ) left -= okWidth; QRect r(left, rect.top() - titleHeight, closeWidth, titleHeight); region = r; } break; case Minimize: if ( ((HackWidget *)widget)->needsOk() ) { QRect r(rect.right() - okWidth, rect.top() - titleHeight, okWidth, titleHeight); if (r.left() > rect.left() + titleHeight) region = r; } break; case Close: { int left = rect.right() - closeWidth; if ( ((HackWidget *)widget)->needsOk() ) left -= okWidth; QRect r(left, rect.top() - titleHeight, closeWidth, titleHeight); region = r; } break; case Title: if ( !widget->isMaximized() ) { int width = rect.width() - helpWidth - closeWidth; if ( ((HackWidget *)widget)->needsOk() ) width -= okWidth; QRect r(rect.left()+helpWidth, rect.top() - titleHeight, width, titleHeight); if (r.width() > 0) region = r; } break; case Help: if ( helpExists || widget->testWFlags(Qt::WStyle_ContextHelp) ) { QRect r(rect.left(), rect.top() - titleHeight, helpWidth, titleHeight); region = r; } break; case Top: if ( !widget->isMaximized() ) { QRegion m = wdiface->mask(&wd); QRect br = m.boundingRect(); int b = wdiface->metric(WindowDecorationInterface::TopBorder,&wd); region = m & QRect( br.left()+grab, br.top(), br.width()-2*grab, b ); } break; case Left: if ( !widget->isMaximized() ) { QRegion m = wdiface->mask(&wd); QRect br = m.boundingRect(); int b = wdiface->metric(WindowDecorationInterface::LeftBorder,&wd); region = m & QRect( br.left(), br.top()+grab, b, br.height()-2*grab ); } break; case Right: if ( !widget->isMaximized() ) { QRegion m = wdiface->mask(&wd); QRect br = m.boundingRect(); int b = wdiface->metric(WindowDecorationInterface::RightBorder,&wd); region = m & QRect( rect.right(), br.top()+grab, b, br.height()-2*grab ); } break; case Bottom: if ( !widget->isMaximized() ) { QRegion m = wdiface->mask(&wd); QRect br = m.boundingRect(); int b = wdiface->metric(WindowDecorationInterface::BottomBorder,&wd); region = m & QRect( br.left()+grab, rect.bottom(), br.width()-2*grab, b ); } break; case TopLeft: if ( !widget->isMaximized() ) { QRegion m = wdiface->mask(&wd); QRect br = m.boundingRect(); int tb = wdiface->metric(WindowDecorationInterface::TopBorder,&wd); int lb = wdiface->metric(WindowDecorationInterface::LeftBorder,&wd); QRegion crgn( br.left(), br.top(), grab, tb ); crgn |= QRect( br.left(), br.top(), lb, grab ); region = m & crgn; } break; case TopRight: if ( !widget->isMaximized() ) { QRegion m = wdiface->mask(&wd); QRect br = m.boundingRect(); int tb = wdiface->metric(WindowDecorationInterface::TopBorder,&wd); int rb = wdiface->metric(WindowDecorationInterface::RightBorder,&wd); QRegion crgn( br.right()-grab, br.top(), grab, tb ); crgn |= QRect( br.right()-rb, br.top(), rb, grab ); region = m & crgn; } break; case BottomLeft: if ( !widget->isMaximized() ) { QRegion m = wdiface->mask(&wd); QRect br = m.boundingRect(); region = m & QRect( br.left(), br.bottom()-grab, grab, grab ); } break; case BottomRight: if ( !widget->isMaximized() ) { QRegion m = wdiface->mask(&wd); QRect br = m.boundingRect(); region = m & QRect( br.right()-grab, br.bottom()-grab, grab, grab ); } break; case All: if ( widget->isMaximized() ) region = QWSDefaultDecoration::region(widget, rect, type); else region = wdiface->mask(&wd) - rect; break; default: region = QWSDefaultDecoration::region(widget, rect, type); break; } return region; } void QPEDecoration::paint(QPainter *painter, const QWidget *widget) { WindowDecorationInterface::WindowData wd; windowData( widget, wd ); int titleWidth = getTitleWidth(widget); int titleHeight = wdiface->metric(WindowDecorationInterface::TitleHeight,&wd); QRect rect(widget->rect()); // title bar rect QRect tr( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight ); #ifndef QT_NO_PALETTE QRegion oldClip = painter->clipRegion(); painter->setClipRegion( oldClip - QRegion( tr ) ); // reduce flicker wdiface->drawArea( WindowDecorationInterface::Border, painter, &wd ); painter->setClipRegion( oldClip ); if (titleWidth > 0) { const QColorGroup &cg = widget->palette().active(); QBrush titleBrush; QPen titlePen; if ( wd.flags & WindowDecorationInterface::WindowData::Active ) { titleBrush = cg.brush(QColorGroup::Highlight); titlePen = cg.color(QColorGroup::HighlightedText); } else { titleBrush = cg.brush(QColorGroup::Background); titlePen = cg.color(QColorGroup::Text); } wdiface->drawArea( WindowDecorationInterface::Title, painter, &wd ); // Draw caption painter->setPen(titlePen); QFont f( QApplication::font() ); f.setWeight( QFont::Bold ); painter->setFont(f); wdiface->drawArea( WindowDecorationInterface::TitleText, painter, &wd ); } #endif //QT_NO_PALETTE paintButton( painter, widget, (QWSDecoration::Region)Help, 0 ); } void QPEDecoration::paintButton(QPainter *painter, const QWidget *w, QWSDecoration::Region type, int state) { WindowDecorationInterface::Button b; switch ((int)type) { case Close: b = WindowDecorationInterface::Close; break; case Minimize: if ( ((HackWidget *)w)->needsOk() ) b = WindowDecorationInterface::OK; else if ( helpExists ) b = WindowDecorationInterface::Help; else return; break; case Help: b = WindowDecorationInterface::Help; break; case Maximize: b = WindowDecorationInterface::Maximize; break; default: return; } WindowDecorationInterface::WindowData wd; windowData( w, wd ); int titleHeight = wdiface->metric(WindowDecorationInterface::TitleHeight,&wd); QRect rect(w->rect()); QRect tr( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight ); QRect brect(region(w, w->rect(), type).boundingRect()); const QColorGroup &cg = w->palette().active(); if ( wd.flags & WindowDecorationInterface::WindowData::Active ) painter->setPen( cg.color(QColorGroup::HighlightedText) ); else painter->setPen( cg.color(QColorGroup::Text) ); QRegion oldClip = painter->clipRegion(); painter->setClipRegion( QRect(brect.x(), tr.y(), brect.width(), tr.height()) ); // reduce flicker wdiface->drawArea( WindowDecorationInterface::Title, painter, &wd ); wdiface->drawButton( b, painter, &wd, brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)state ); painter->setClipRegion( oldClip ); } //#define QPE_DONT_SHOW_TITLEBAR void QPEDecoration::maximize( QWidget *widget ) { #ifdef QPE_DONT_SHOW_TITLEBAR if ( !widget->inherits( "QDialog" ) ) { widget->setGeometry( qt_maxWindowRect ); } else #endif { QWSDecoration::maximize( widget ); } } #ifndef QT_NO_DIALOG class HackDialog : public QDialog { public: void acceptIt() { if ( isA( "QMessageBox" ) ) qApp->postEvent( this, new QKeyEvent( QEvent::KeyPress, Key_Enter, '\n', 0, "\n" ) ); else accept(); } }; #endif void QPEDecoration::minimize( QWidget *widget ) { #ifndef QT_NO_DIALOG // We use the minimize button as an "accept" button. if ( widget->inherits( "QDialog" ) ) { HackDialog *d = (HackDialog *)widget; d->acceptIt(); } #endif else if ( ((HackWidget *)widget)->needsOk() ) { QSignal s; s.connect( widget, SLOT( accept() ) ); s.activate(); } else { help( widget ); } } void QPEDecoration::help( QWidget *w ) { if ( helpExists ) { Global::execute( "helpbrowser", helpFile ); } else if ( w && w->testWFlags(Qt::WStyle_ContextHelp) ) { QWhatsThis::enterWhatsThisMode(); QWhatsThis::leaveWhatsThisMode( QObject::tr( "<Qt>Comprehensive help is not available for this application, " "however there is context-sensitive help.<p>To use context-sensitive help:<p>" "<ol><li>click and hold the help button." "<li>when the title bar shows <b>What's this...</b>, " "click on any control.</ol></Qt>" ) ); } } void QPEDecoration::windowData( const QWidget *w, WindowDecorationInterface::WindowData &wd ) const { wd.rect = w->rect(); if ( qpeManager->whatsThisWidget() == w ) wd.caption = QObject::tr("What's this..." ); else wd.caption = w->caption(); wd.palette = qApp->palette(); wd.flags = 0; wd.flags |= w->isMaximized() ? WindowDecorationInterface::WindowData::Maximized : 0; wd.flags |= w->testWFlags(Qt::WStyle_Dialog) ? WindowDecorationInterface::WindowData::Dialog : 0; const QWidget *active = qpeManager->activeWidget(); wd.flags |= w == active ? WindowDecorationInterface::WindowData::Active : 0; wd.reserved = 1; diff --git a/library/sound.cpp b/library/sound.cpp index c8704f9..5b67995 100644 --- a/library/sound.cpp +++ b/library/sound.cpp @@ -1,221 +1,224 @@ /********************************************************************** ** 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/resource.h> #include <qpe/sound.h> #include <qpe/qcopenvelope_qws.h> #include <qsound.h> #include <qfile.h> #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> + +#ifndef QT_NO_SOUND #include <sys/soundcard.h> +#endif #include "config.h" #include <qmessagebox.h> #ifndef QT_NO_SOUND static int WAVsoundDuration(const QString& filename) { // bad solution // most of this is copied from qsoundqss.cpp QFile input(filename); if ( !input.open(IO_ReadOnly) ) return 0; struct QRiffChunk { char id[4]; Q_UINT32 size; char data[4/*size*/]; } chunk; struct { Q_INT16 formatTag; Q_INT16 channels; Q_INT32 samplesPerSec; Q_INT32 avgBytesPerSec; Q_INT16 blockAlign; Q_INT16 wBitsPerSample; } chunkdata; int total = 0; while(1) { // Keep reading chunks... const int n = sizeof(chunk)-sizeof(chunk.data); if ( input.readBlock((char*)&chunk,n) != n ) break; if ( qstrncmp(chunk.id,"data",4) == 0 ) { total += chunkdata.avgBytesPerSec ? chunk.size * 1000 / chunkdata.avgBytesPerSec : 0; //qDebug("%d bytes of PCM (%dms)", chunk.size,chunkdata.avgBytesPerSec ? chunk.size * 1000 / chunkdata.avgBytesPerSec : 0); input.at(input.at()+chunk.size-4); } else if ( qstrncmp(chunk.id,"RIFF",4) == 0 ) { char d[4]; if ( input.readBlock(d,4) != 4 ) return 0; if ( qstrncmp(d,"WAVE",4) != 0 ) { // skip //qDebug("skip %.4s RIFF chunk",d); if ( chunk.size < 10000000 ) (void)input.at(input.at()+chunk.size-4); } } else if ( qstrncmp(chunk.id,"fmt ",4) == 0 ) { if ( input.readBlock((char*)&chunkdata,sizeof(chunkdata)) != sizeof(chunkdata) ) return 0; #define WAVE_FORMAT_PCM 1 if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) { //qDebug("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag); return 0; } } else { //qDebug("skip %.4s chunk",chunk.id); // ignored chunk if ( chunk.size < 10000000 ) (void)input.at(input.at()+chunk.size); } } //qDebug("%dms",total); return total; } class SoundData : public QSound { public: SoundData ( const QString& name ) : QSound ( Resource::findSound ( name )), filename ( Resource::findSound ( name )) { loopsleft=0; ms = WAVsoundDuration(filename); } void playLoop ( int loopcnt = -1 ) { // needs server support loopsleft = loopcnt; if ( ms ) startTimer ( ms > 50 ? ms-50 : 0 ); // 50 for latency play ( ); } void timerEvent ( QTimerEvent *e ) { if ( loopsleft >= 0 ) { if ( --loopsleft <= 0 ) { killTimer ( e-> timerId ( )); loopsleft = 0; return; } } play(); } bool isFinished ( ) const { return ( loopsleft == 0 ); } private: QString filename; int loopsleft; int ms; }; #endif /*! Opens a wave sound file \a name for playing * Resource is used for finding the file **/ Sound::Sound(const QString& name) { #ifndef QT_NO_SOUND d = new SoundData(name); #endif } /*! Destroys the sound */ Sound::~Sound() { #ifndef QT_NO_SOUND delete d; #endif } /*! Play the sound once */ void Sound::play() { #ifndef QT_NO_SOUND d->playLoop(1); #endif } /*! Play the sound, repeatedly until stop() is called */ void Sound::playLoop() { #ifndef QT_NO_SOUND d->killTimers(); d->playLoop(); #endif } /*! Do not repeat the sound after it finishes. This will end a playLoop() */ void Sound::stop() { #ifndef QT_NO_SOUND d->killTimers(); #endif } bool Sound::isFinished() const { #ifndef QT_NO_SOUND return d->isFinished(); #else return true; #endif } /*! Sounds the audible system alarm. This is used for applications such as Calendar when it needs to alarm the user of an event. */ void Sound::soundAlarm() { #ifndef QT_NO_COP QCopEnvelope( "QPE/TaskBar", "soundAlarm()" ); #endif } /*! \class Sound \brief The Sound class plays WAVE sound files and can invoke the audible alarm. The Sound class is constructed with the .wav music file name. The Sound class retrieves the sound file from the shared Resource class. This class ties together QSound and the available sound resources. To sound an audible system alarm, call the static method soundAlarm() \ingroup qtopiaemb */ diff --git a/library/storage.cpp b/library/storage.cpp index dc5cc22..f8b75d0 100644 --- a/library/storage.cpp +++ b/library/storage.cpp @@ -1,344 +1,376 @@ /********************************************************************** ** Copyright (C) Holger 'zecke' Freyther <freyther@kde.org> ** Copyright (C) Lorn Potter <llornkcor@handhelds.org> ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Opie 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> #include <qpe/custom.h> #include <qfile.h> #include <qtimer.h> #include <qcopchannel_qws.h> #include <stdio.h> -#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) +#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) #include <sys/vfs.h> #include <mntent.h> #endif +#ifdef Q_OS_MACX +# include <sys/param.h> +# include <sys/ucred.h> +# include <sys/mount.h> +# include <stdio.h> // For strerror() +# include <errno.h> +#endif /* Q_OS_MACX */ + #include <qstringlist.h> -#include <sys/vfs.h> -#include <mntent.h> +// Shouldn't be here ! (eilers) +// #include <sys/vfs.h> +// #include <mntent.h> static bool isCF(const QString& m) { + +#ifndef Q_OS_MACX 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); } +#endif /* Q_OS_MACX */ return FALSE; } /*! \class StorageInfo storage.h \brief The StorageInfo class describes the disks mounted on the file system. This class provides access to the mount information for the Linux filesystem. Each mount point is represented by the FileSystem class. To ensure this class has the most up to date size information, call the update() method. Note that this will automatically be signaled by the operating system when a disk has been mounted or unmounted. \ingroup qtopiaemb */ /*! Constructor that determines the current mount points of the filesystem. The standard \a parent parameters is passed on to QObject. */ 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(); } /*! Returns the longest matching FileSystem that starts with the same prefix as \a filename as its mount point. */ 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(); } /*! Updates the mount and free space available information for each mount point. This method is automatically called when a disk is mounted or unmounted. */ // 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" || fs.left(9)=="/dev/root" ) { 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(9) == "/dev/root" ) 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 } bool deviceTab( const char *device) { - QString name = device; - bool hasDevice=false; + QString name = device; + bool hasDevice=false; + +#ifdef Q_OS_MACX + // Darwin (MacOS X) + struct statfs** mntbufp; + int count = 0; + if ( ( count = getmntinfo( mntbufp, MNT_WAIT ) ) == 0 ){ + qWarning("deviceTab: Error in getmntinfo(): %s",strerror( errno ) ); + hasDevice = false; + } + for( int i = 0; i < count; i++ ){ + QString deviceName = mntbufp[i]->f_mntfromname; + qDebug(deviceName); + if( deviceName.left( name.length() ) == name ) + hasDevice = true; + } +#else + // Linux struct mntent *me; FILE *mntfp = setmntent( "/etc/mtab", "r" ); if ( mntfp ) { while ( (me = getmntent( mntfp )) != 0 ) { QString deviceName = me->mnt_fsname; // qDebug(deviceName); if( deviceName.left(name.length()) == name) { hasDevice = true; } } } endmntent( mntfp ); +#endif /* Q_OS_MACX */ + + return hasDevice; } /*! * @fn static bool StorageInfo::hasCf() * @brief returns whether device has Cf mounted * */ bool StorageInfo::hasCf() { return deviceTab("/dev/hd"); } /*! * @fn static bool StorageInfo::hasSd() * @brief returns whether device has SD mounted * */ bool StorageInfo::hasSd() { return deviceTab("/dev/mmcd"); } /*! * @fn static bool StorageInfo::hasMmc() * @brief reutrns whether device has mmc mounted * */ bool StorageInfo::hasMmc() { bool hasMmc=false; if( deviceTab("/dev/mmc/part")) hasMmc=true; if( deviceTab("/dev/mmcd")) hasMmc=true; return hasMmc; } /*! \fn const QList<FileSystem> &StorageInfo::fileSystems() const Returns a list of all available mounted file systems. \warning This may change in Qtopia 3.x to return only relevant Qtopia file systems (and ignore mount points such as /tmp) */ /*! \fn void StorageInfo::disksChanged() Gets emitted when a disk has been mounted or unmounted, such as when a CF c */ //--------------------------------------------------------------------------- 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 } /*! \class FileSystem storage.h \brief The FileSystem class describes a single mount point. This class simply returns information about a mount point, including file system name, mount point, human readable name, size information and mount options information. \ingroup qtopiaemb \sa StorageInfo */ /*! \fn const QString &FileSystem::disk() const Returns the file system name, such as /dev/hda3 */ /*! \fn const QString &FileSystem::path() const Returns the mount path, such as /home */ /*! \fn const QString &FileSystem::name() const Returns the translated, human readable name for the mount directory. */ /*! \fn const QString &FileSystem::options() const Returns the mount options */ /*! \fn long FileSystem::blockSize() const Returns the size of each block on the file system. */ /*! \fn long FileSystem::totalBlocks() const Returns the total number of blocks on the file system */ /*! \fn long FileSystem::availBlocks() const Returns the number of available blocks on the file system */ /*! \fn bool FileSystem::isRemovable() const Returns flag whether the file system can be removed, such as a CF card would be removable, but the internal memory wouldn't */ /*! \fn bool FileSystem::isWritable() const Returns flag whether the file system is mounted as writable or read-only. Returns FALSE if read-only, TRUE if read and write. */ /*! \fn QStringList StorageInfo::fileSystemNames() const Returns a list of filesystem names. */ diff --git a/mkspecs/qws/macx-generic-g++/qmake.conf b/mkspecs/qws/macx-generic-g++/qmake.conf index 3460a40..04f1c8b 100644 --- a/mkspecs/qws/macx-generic-g++/qmake.conf +++ b/mkspecs/qws/macx-generic-g++/qmake.conf @@ -1,80 +1,81 @@ # # $Id$ # # qmake configuration for macx-g++ with Qt/Embedded # MAKEFILE_GENERATOR = UNIX TEMPLATE = app CONFIG += qt warn_on release QMAKE_EXTENSION_SHLIB = dylib QMAKE_CC = $(TB)cc QMAKE_LEX = flex QMAKE_LEXFLAGS = QMAKE_YACC = yacc QMAKE_YACCFLAGS = -d QMAKE_CFLAGS = -pipe $(CFLAGS_EXTRA) QMAKE_CFLAGS_WARN_ON = -Wall -W QMAKE_CFLAGS_WARN_OFF = QMAKE_CFLAGS_RELEASE = $(if $(CFLAGS_RELEASE),$(CFLAGS_RELEASE), -O2 -fno-default-inline) QMAKE_CFLAGS_DEBUG = -g QMAKE_CFLAGS_SHLIB = -fPIC QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses QMAKE_CFLAGS_THREAD = -D_REENTRANT QMAKE_CXX = $(TB)c++ -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_QWS_TRANSFORMED -DQWS -fno-exceptions -fno-rtti $(CXXFLAGS_EXTRA) +QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_QWS_TRANSFORMED -DQWS -fno-exceptions -fno-rtti $(CXXFLAGS_EXTRA) -DQ_OS_MACX -DQT_NO_SOUND -DOPIE_NO_OVERRIDE_QT QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD QMAKE_INCDIR = QMAKE_LIBDIR = QMAKE_INCDIR_X11 = QMAKE_LIBDIR_X11 = QMAKE_INCDIR_QT = $(QTDIR)/include QMAKE_LIBDIR_QT = $(QTDIR)/lib QMAKE_INCDIR_OPENGL = /usr/X11R6/include QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib QMAKE_LINK = $$QMAKE_CXX QMAKE_LINK_SHLIB = $$QMAKE_CXX QMAKE_LFLAGS = $(LFLAGS_EXTRA) QMAKE_LFLAGS_RELEASE = QMAKE_LFLAGS_DEBUG = QMAKE_LFLAGS_SHLIB = -dynamiclib QMAKE_LFLAGS_INCREMENTAL = -undefined suppress -flat_namespace QMAKE_LFLAGS_PLUGIN = -bundle QMAKE_LFLAGS_SONAME = QMAKE_LFLAGS_THREAD = QMAKE_RPATH = QMAKE_LIBS = $(LIBS_EXTRA) QMAKE_LIBS_X11 = QMAKE_LIBS_X11SM = QMAKE_LIBS_QT = -lqte +#QMAKE_LIBS_QT = libqte.dylib QMAKE_LIBS_QT_THREAD = -lqte-mt QMAKE_LIBS_QT_OPENGL = -lqgl QMAKE_LIBS_THREAD = QMAKE_MOC = $(QTDIR)/bin/moc QMAKE_UIC = $(QTDIR)/bin/uic QMAKE_AR = ar cqs QMAKE_RANLIB = QMAKE_TAR = tar -cf QMAKE_GZIP = gzip -9f QMAKE_COPY = cp -f QMAKE_MOVE = mv -f QMAKE_DEL_FILE = rm -f QMAKE_DEL_DIR = rmdir diff --git a/noncore/applets/networkapplet/networkapplet.pro b/noncore/applets/networkapplet/networkapplet.pro index ec58455..368f80e 100644 --- a/noncore/applets/networkapplet/networkapplet.pro +++ b/noncore/applets/networkapplet/networkapplet.pro @@ -1,15 +1,15 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = networkapplet.h SOURCES = networkapplet.cpp TARGET = networkapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopiecore2 -lopieui2 -lopienet2 VERSION = 0.1.0 MOC_DIR = moc OBJECTS_DIR = obj include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/applets/notesapplet/notesapplet.pro b/noncore/applets/notesapplet/notesapplet.pro index e4558f7..3075948 100644 --- a/noncore/applets/notesapplet/notesapplet.pro +++ b/noncore/applets/notesapplet/notesapplet.pro @@ -1,16 +1,16 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = notes.h notesappletimpl.h SOURCES = notes.cpp notesappletimpl.cpp TARGET = notesapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 MOC_DIR=opieobj OBJECTS_DIR=opieobj include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/applets/wirelessapplet/wirelessapplet.pro b/noncore/applets/wirelessapplet/wirelessapplet.pro index 501327d..aee89d7 100644 --- a/noncore/applets/wirelessapplet/wirelessapplet.pro +++ b/noncore/applets/wirelessapplet/wirelessapplet.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = wireless.h wirelessappletimpl.h networkinfo.h mgraph.h advancedconfig.h SOURCES = wireless.cpp wirelessappletimpl.cpp networkinfo.cpp mgraph.cpp advancedconfig.cpp INTERFACES = advancedconfigbase.ui TARGET = wirelessapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include LIBS += -lqpe VERSION = 0.1.0 TRANSLATIONS = ../../../i18n/de/libwirelessapplet.ts \ ../../../i18n/nl/libwirelessapplet.ts \ ../../../i18n/da/libwirelessapplet.ts \ ../../../i18n/xx/libwirelessapplet.ts \ ../../../i18n/en/libwirelessapplet.ts \ ../../../i18n/es/libwirelessapplet.ts \ ../../../i18n/fr/libwirelessapplet.ts \ ../../../i18n/hu/libwirelessapplet.ts \ ../../../i18n/ja/libwirelessapplet.ts \ ../../../i18n/ko/libwirelessapplet.ts \ ../../../i18n/no/libwirelessapplet.ts \ ../../../i18n/pl/libwirelessapplet.ts \ ../../../i18n/pt/libwirelessapplet.ts \ ../../../i18n/pt_BR/libwirelessapplet.ts \ ../../../i18n/sl/libwirelessapplet.ts \ ../../../i18n/zh_CN/libwirelessapplet.ts \ ../../../i18n/zh_TW/libwirelessapplet.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/decorations/flat/flat.pro b/noncore/decorations/flat/flat.pro index e691339..f3d63ea 100644 --- a/noncore/decorations/flat/flat.pro +++ b/noncore/decorations/flat/flat.pro @@ -1,15 +1,15 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = flat.h SOURCES = flat.cpp TARGET = flat DESTDIR = $(OPIEDIR)/plugins/decorations INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/decorations/liquid/liquid.pro b/noncore/decorations/liquid/liquid.pro index 7c310a6..2afed26 100644 --- a/noncore/decorations/liquid/liquid.pro +++ b/noncore/decorations/liquid/liquid.pro @@ -1,14 +1,14 @@ TEMPLATE = lib -CONFIG = qt embedded release warn_on +CONFIG = qt plugin embedded release warn_on SOURCES = liquid.cpp HEADERS = liquid.h LIBS += -lqpe INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/plugins/decorations TARGET = liquid VERSION = 1.0.0 include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/decorations/polished/polished.pro b/noncore/decorations/polished/polished.pro index 1ee940e..d3f3dcc 100644 --- a/noncore/decorations/polished/polished.pro +++ b/noncore/decorations/polished/polished.pro @@ -1,15 +1,15 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = polished.h SOURCES = polished.cpp TARGET = polished DESTDIR = $(OPIEDIR)/plugins/decorations INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/net/opietooth/applet/applet.pro b/noncore/net/opietooth/applet/applet.pro index 23c1d0a..4efcb42 100644 --- a/noncore/net/opietooth/applet/applet.pro +++ b/noncore/net/opietooth/applet/applet.pro @@ -1,33 +1,33 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = bluezapplet.h bluezappletimpl.h SOURCES = bluezapplet.cpp bluezappletimpl.cpp TARGET = bluetoothapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopietooth VERSION = 0.0.3 TRANSLATIONS = ../../../../i18n/de/libbluetoothapplet.ts \ ../../../../i18n/nl/libbluetoothapplet.ts \ ../../../../i18n/da/libbluetoothapplet.ts \ ../../../../i18n/xx/libbluetoothapplet.ts \ ../../../../i18n/en/libbluetoothapplet.ts \ ../../../../i18n/es/libbluetoothapplet.ts \ ../../../../i18n/fr/libbluetoothapplet.ts \ ../../../../i18n/hu/libbluetoothapplet.ts \ ../../../../i18n/ja/libbluetoothapplet.ts \ ../../../../i18n/ko/libbluetoothapplet.ts \ ../../../../i18n/no/libbluetoothapplet.ts \ ../../../../i18n/pl/libbluetoothapplet.ts \ ../../../../i18n/pt/libbluetoothapplet.ts \ ../../../../i18n/pt_BR/libbluetoothapplet.ts \ ../../../../i18n/sl/libbluetoothapplet.ts \ ../../../../i18n/zh_CN/libbluetoothapplet.ts \ ../../../../i18n/zh_TW/libbluetoothapplet.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/settings/networksettings/ppp/ppp.pro b/noncore/settings/networksettings/ppp/ppp.pro index 84acd0e..dc78eb1 100644 --- a/noncore/settings/networksettings/ppp/ppp.pro +++ b/noncore/settings/networksettings/ppp/ppp.pro @@ -1,17 +1,17 @@ #TEMPLATE = app # TEMPLATE = lib -#CONFIG += qt warn_on release -CONFIG += qt warn_on debug +#CONFIG += qt plugin warn_on release +CONFIG += qt plugin warn_on debug DESTDIR = $(OPIEDIR)/plugins/networksettings HEADERS = pppmodule.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h interfaceinformationppp.h interfaceppp.h authwidget.h chooserwidget.h devices.h SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp interfaceinformationppp.cpp interfaceppp.cpp authwidget.cpp chooserwidget.cpp devices.cpp INCLUDEPATH += $(OPIEDIR)/include ../ ../interfaces/ DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -L../interfaces/ -linterfaces TARGET = kppp VERSION = 1.0.0 include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/settings/networksettings/wlan/wlan.pro b/noncore/settings/networksettings/wlan/wlan.pro index 82a5b2f..098ad1d 100644 --- a/noncore/settings/networksettings/wlan/wlan.pro +++ b/noncore/settings/networksettings/wlan/wlan.pro @@ -1,28 +1,28 @@ # TEMPLATE = lib #TEMPLATE = app -CONFIG += qt warn_on release -#CONFIG += qt warn_on debug +CONFIG += qt plugin warn_on release +#CONFIG += qt plugin warn_on debug DESTDIR = $(OPIEDIR)/plugins/networksettings HEADERS = infoimp.h wlanmodule.h wextensions.h keyedit.h SOURCES = infoimp.cpp wlanmodule.cpp wextensions.cpp keyedit.cpp INCLUDEPATH += $(OPIEDIR)/include ../ ../interfaces/ DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -L../interfaces/ -linterfaces -lopienet2 INTERFACES = wlan.ui info.ui TARGET = wlan VERSION = 1.0.0 #CONFIG += wirelessopts wirelessopts { HEADERS += wlanimp.h SOURCES += wlanimp.cpp } ! wirelessopts { HEADERS += wlanimp2.h SOURCES += wlanimp2.cpp } include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/styles/flat/flat.pro b/noncore/styles/flat/flat.pro index ed25d5c..2721e14 100644 --- a/noncore/styles/flat/flat.pro +++ b/noncore/styles/flat/flat.pro @@ -1,15 +1,15 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = flat.h SOURCES = flat.cpp TARGET = flatstyle DESTDIR = $(OPIEDIR)/plugins/styles INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/styles/fresh/fresh.pro b/noncore/styles/fresh/fresh.pro index 88a8de3..564c5cd 100644 --- a/noncore/styles/fresh/fresh.pro +++ b/noncore/styles/fresh/fresh.pro @@ -1,15 +1,15 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS = fresh.h SOURCES = fresh.cpp TARGET = freshstyle DESTDIR = $(OPIEDIR)/plugins/styles INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/styles/liquid/liquid.pro b/noncore/styles/liquid/liquid.pro index 9241eba..4e1c575 100644 --- a/noncore/styles/liquid/liquid.pro +++ b/noncore/styles/liquid/liquid.pro @@ -1,39 +1,39 @@ TEMPLATE = lib -CONFIG = qt embedded release warn_on +CONFIG = qt plugin embedded release warn_on SOURCES = liquid.cpp \ effects.cpp \ liquidset.cpp \ plugin.cpp HEADERS = liquid.h \ effects.h \ liquidset.h \ plugin.h LIBS += -lqpe -lopie INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/plugins/styles TARGET = liquid VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libliquid.ts \ ../../../i18n/nl/libliquid.ts \ ../../../i18n/da/libliquid.ts \ ../../../i18n/xx/libliquid.ts \ ../../../i18n/en/libliquid.ts \ ../../../i18n/es/libliquid.ts \ ../../../i18n/fr/libliquid.ts \ ../../../i18n/hu/libliquid.ts \ ../../../i18n/ja/libliquid.ts \ ../../../i18n/ko/libliquid.ts \ ../../../i18n/no/libliquid.ts \ ../../../i18n/pl/libliquid.ts \ ../../../i18n/pt/libliquid.ts \ ../../../i18n/pt_BR/libliquid.ts \ ../../../i18n/sl/libliquid.ts \ ../../../i18n/zh_CN/libliquid.ts \ ../../../i18n/zh_TW/libliquid.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/styles/metal/metal.pro b/noncore/styles/metal/metal.pro index 3bb376d..8633284 100644 --- a/noncore/styles/metal/metal.pro +++ b/noncore/styles/metal/metal.pro @@ -1,32 +1,32 @@ TEMPLATE = lib -CONFIG = qt embedded release warn_on +CONFIG = qt plugin embedded release warn_on SOURCES = metal.cpp plugin.cpp HEADERS = metal.h plugin.h LIBS += -lqpe INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/plugins/styles TARGET = metal VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libmetal.ts \ ../../../i18n/nl/libmetal.ts \ ../../../i18n/da/libmetal.ts \ ../../../i18n/xx/libmetal.ts \ ../../../i18n/en/libmetal.ts \ ../../../i18n/es/libmetal.ts \ ../../../i18n/fr/libmetal.ts \ ../../../i18n/hu/libmetal.ts \ ../../../i18n/ja/libmetal.ts \ ../../../i18n/ko/libmetal.ts \ ../../../i18n/no/libmetal.ts \ ../../../i18n/pl/libmetal.ts \ ../../../i18n/pt/libmetal.ts \ ../../../i18n/pt_BR/libmetal.ts \ ../../../i18n/sl/libmetal.ts \ ../../../i18n/zh_CN/libmetal.ts \ ../../../i18n/zh_TW/libmetal.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/styles/theme/theme.pro b/noncore/styles/theme/theme.pro index f7ed324..4f84f3f 100644 --- a/noncore/styles/theme/theme.pro +++ b/noncore/styles/theme/theme.pro @@ -1,42 +1,42 @@ TEMPLATE = lib -CONFIG = qt embedded debug warn_on +CONFIG = qt plugin embedded debug warn_on SOURCES = ogfxeffect.cpp \ othemestyle.cpp \ othemebase.cpp \ themeset.cpp \ plugin.cpp HEADERS = ogfxeffect.h \ othemebase.h \ othemestyle.h \ themeset.h \ plugin.h LIBS += -lqpe INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/plugins/styles TARGET = theme VERSION = 1.0.0 TRANSLATIONS = ../../../i18n/de/libtheme.ts \ ../../../i18n/nl/libtheme.ts \ ../../../i18n/da/libtheme.ts \ ../../../i18n/xx/libtheme.ts \ ../../../i18n/en/libtheme.ts \ ../../../i18n/es/libtheme.ts \ ../../../i18n/fr/libtheme.ts \ ../../../i18n/hu/libtheme.ts \ ../../../i18n/ja/libtheme.ts \ ../../../i18n/ko/libtheme.ts \ ../../../i18n/no/libtheme.ts \ ../../../i18n/pl/libtheme.ts \ ../../../i18n/pt/libtheme.ts \ ../../../i18n/pt_BR/libtheme.ts \ ../../../i18n/sl/libtheme.ts \ ../../../i18n/zh_CN/libtheme.ts \ ../../../i18n/zh_TW/libtheme.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/todayplugins/fortune/fortune.pro b/noncore/todayplugins/fortune/fortune.pro index 0a0d5b9..ac503c3 100644 --- a/noncore/todayplugins/fortune/fortune.pro +++ b/noncore/todayplugins/fortune/fortune.pro @@ -1,41 +1,41 @@ TEMPLATE = lib #CONFIG -= moc -CONFIG += qt release +CONFIG += qt plugin release # Input HEADERS = fortuneplugin.h fortunepluginimpl.h \ fortunepluginwidget.h SOURCES = fortuneplugin.cpp fortunepluginimpl.cpp \ fortunepluginwidget.cpp INCLUDEPATH += $(OPIEDIR)/include \ ../ ../library DEPENDPATH += $(OPIEDIR)/include \ ../ ../library LIBS+= -lqpe -lopie DESTDIR = $(OPIEDIR)/plugins/today TARGET = todayfortuneplugin TRANSLATIONS = ../../../i18n/de/libtodayfortuneplugin.ts \ ../../../i18n/nl/libtodayfortuneplugin.ts \ ../../../i18n/xx/libtodayfortuneplugin.ts \ ../../../i18n/en/libtodayfortuneplugin.ts \ ../../../i18n/es/libtodayfortuneplugin.ts \ ../../../i18n/fr/libtodayfortuneplugin.ts \ ../../../i18n/hu/libtodayfortuneplugin.ts \ ../../../i18n/ja/libtodayfortuneplugin.ts \ ../../../i18n/ko/libtodayfortuneplugin.ts \ ../../../i18n/no/libtodayfortuneplugin.ts \ ../../../i18n/pl/libtodayfortuneplugin.ts \ ../../../i18n/pt/libtodayfortuneplugin.ts \ ../../../i18n/pt_BR/libtodayfortuneplugin.ts \ ../../../i18n/sl/libtodayfortuneplugin.ts \ ../../../i18n/zh_CN/libtodayfortuneplugin.ts \ ../../../i18n/zh_TW/libtodayfortuneplugin.ts \ ../../../i18n/it/libtodayfortuneplugin.ts \ ../../../i18n/da/libtodayfortuneplugin.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro index c34be33..490a8f9 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro @@ -1,48 +1,48 @@ TEMPLATE = lib CONFIG -= moc -CONFIG += qt release +CONFIG += qt plugin release HEADERS = stocktickerplugin.h stocktickerpluginimpl.h stocktickerpluginwidget.h stocktickerconfig.h \ ../libstocks/csv.h \ ../libstocks/http.h \ ../libstocks/lists.h \ ../libstocks/stocks.h SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp stocktickerconfig.cpp \ ../libstocks/csv.c \ ../libstocks/currency.c \ ../libstocks/history.c \ ../libstocks/http.c \ ../libstocks/lists.c \ ../libstocks/stocks.c INCLUDEPATH += $(OPIEDIR)/include \ ../ ../library DEPENDPATH += $(OPIEDIR)/include \ ../ ../library LIBS+= -lqpe -lopie -lpthread TMAKE_CFLAGS += -D__UNIX__ DESTDIR = $(OPIEDIR)/plugins/today TARGET = todaystocktickerplugin TRANSLATIONS = ../../../../i18n/de/libtodaystocktickerplugin.ts \ ../../../../i18n/nl/libtodaystocktickerplugin.ts \ ../../../../i18n/xx/libtodaystocktickerplugin.ts \ ../../../../i18n/en/libtodaystocktickerplugin.ts \ ../../../../i18n/es/libtodaystocktickerplugin.ts \ ../../../../i18n/fr/libtodaystocktickerplugin.ts \ ../../../../i18n/hu/libtodaystocktickerplugin.ts \ ../../../../i18n/ja/libtodaystocktickerplugin.ts \ ../../../../i18n/ko/libtodaystocktickerplugin.ts \ ../../../../i18n/no/libtodaystocktickerplugin.ts \ ../../../../i18n/pl/libtodaystocktickerplugin.ts \ ../../../../i18n/pt/libtodaystocktickerplugin.ts \ ../../../../i18n/pt_BR/libtodaystocktickerplugin.ts \ ../../../../i18n/sl/libtodaystocktickerplugin.ts \ ../../../../i18n/zh_CN/libtodaystocktickerplugin.ts \ ../../../../i18n/zh_TW/libtodaystocktickerplugin.ts \ ../../../../i18n/it/libtodaystocktickerplugin.ts \ ../../../../i18n/da/libtodaystocktickerplugin.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/todayplugins/weather/weather.pro b/noncore/todayplugins/weather/weather.pro index 2833e88..bd4b565 100644 --- a/noncore/todayplugins/weather/weather.pro +++ b/noncore/todayplugins/weather/weather.pro @@ -1,43 +1,43 @@ TEMPLATE = lib #CONFIG -= moc -CONFIG += qt release +CONFIG += qt plugin release HEADERS = weatherplugin.h \ weatherpluginimpl.h \ weatherpluginwidget.h \ weatherconfig.h SOURCES = weatherplugin.cpp \ weatherpluginimpl.cpp \ weatherpluginwidget.cpp \ weatherconfig.cpp INCLUDEPATH += $(OPIEDIR)/include \ ../ ../library DEPENDPATH += $(OPIEDIR)/include \ ../ ../library LIBS+= -lqpe -lopie DESTDIR = $(OPIEDIR)/plugins/today TARGET = todayweatherplugin TRANSLATIONS = ../../../i18n/de/libtodayweatherplugin.ts \ ../../../i18n/nl/libtodayweatherplugin.ts \ ../../../i18n/xx/libtodayweatherplugin.ts \ ../../../i18n/en/libtodayweatherplugin.ts \ ../../../i18n/es/libtodayweatherplugin.ts \ ../../../i18n/fr/libtodayweatherplugin.ts \ ../../../i18n/hu/libtodayweatherplugin.ts \ ../../../i18n/ja/libtodayweatherplugin.ts \ ../../../i18n/ko/libtodayweatherplugin.ts \ ../../../i18n/no/libtodayweatherplugin.ts \ ../../../i18n/pl/libtodayweatherplugin.ts \ ../../../i18n/pt/libtodayweatherplugin.ts \ ../../../i18n/pt_BR/libtodayweatherplugin.ts \ ../../../i18n/sl/libtodayweatherplugin.ts \ ../../../i18n/zh_CN/libtodayweatherplugin.ts \ ../../../i18n/zh_TW/libtodayweatherplugin.ts \ ../../../i18n/it/libtodayweatherplugin.ts \ ../../../i18n/da/libtodayweatherplugin.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/unsupported/mail2/bend/bend.pro b/noncore/unsupported/mail2/bend/bend.pro index b03f652..61eea5f 100644 --- a/noncore/unsupported/mail2/bend/bend.pro +++ b/noncore/unsupported/mail2/bend/bend.pro @@ -1,32 +1,32 @@ TEMPLATE = lib -CONFIG += qt warn_on release +CONFIG += qt plugin warn_on release HEADERS += bend.h \ bendimpl.h SOURCES += bend.cpp \ bendimpl.cpp INCLUDEPATH += $(OPIEDIR)/include ../libmail LIBS += -lmail -lqpe TARGET = bend DESTDIR += $(OPIEDIR)/plugins/applets/ TRANSLATIONS = ../../../i18n/de/libbend.ts \ ../../../i18n/nl/libbend.ts \ ../../../i18n/da/libbend.ts \ ../../../i18n/xx/libbend.ts \ ../../../i18n/en/libbend.ts \ ../../../i18n/es/libbend.ts \ ../../../i18n/fr/libbend.ts \ ../../../i18n/hu/libbend.ts \ ../../../i18n/ja/libbend.ts \ ../../../i18n/ko/libbend.ts \ ../../../i18n/no/libbend.ts \ ../../../i18n/pl/libbend.ts \ ../../../i18n/pt/libbend.ts \ ../../../i18n/pt_BR/libbend.ts \ ../../../i18n/sl/libbend.ts \ ../../../i18n/zh_CN/libbend.ts \ ../../../i18n/zh_TW/libbend.ts include ( $(OPIEDIR)/include.pro ) diff --git a/plugins/Makefile b/plugins/Makefile index 4863bd0..2515903 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -1,4 +1,8 @@ clean: - find -name "*.so*" -print0 | xargs -0 rm -f +ifeq ( CONFIG_TARGET_MACOSX, y ) + find ./ -name "*.dylib*" -print0 | xargs -0 rm -f +else + find ./ -name "*.so*" -print0 | xargs -0 rm -f +endif all install ipk lupdate lrelease opie-lupdate opie-lrelease: diff --git a/qmake/include/qglobal.h b/qmake/include/qglobal.h index d212bff..94e5607 100644 --- a/qmake/include/qglobal.h +++ b/qmake/include/qglobal.h @@ -1,541 +1,548 @@ /**************************************************************************** ** $Id$ ** ** Global type declarations and definitions ** ** Created : 920529 ** ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. ** ** This file is part of the tools module of the Qt GUI Toolkit. ** ** This file may be distributed under the terms of the Q Public License ** as defined by Trolltech AS of Norway and appearing in the file ** LICENSE.QPL included in the packaging of this file. ** ** 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. ** ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition ** licenses may use this file in accordance with the Qt Commercial License ** Agreement provided with the Software. ** ** 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/pricing.html or email sales@trolltech.com for ** information about Qt Commercial License Agreements. ** See http://www.trolltech.com/qpl/ for QPL licensing information. ** 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 QGLOBAL_H #define QGLOBAL_H #define QT_VERSION_STR "3.1.2" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ #define QT_VERSION 0x030102 /* The operating system, must be one of: (Q_OS_x) MACX - Mac OS X MAC9 - Mac OS 9 MSDOS - MS-DOS and Windows OS2 - OS/2 OS2EMX - XFree86 on OS/2 (not PM) WIN32 - Win32 (Windows 95/98/ME and Windows NT/2000/XP) CYGWIN - Cygwin SOLARIS - Sun Solaris HPUX - HP-UX ULTRIX - DEC Ultrix LINUX - Linux FREEBSD - FreeBSD NETBSD - NetBSD OPENBSD - OpenBSD BSDI - BSD/OS IRIX - SGI Irix OSF - HP Tru64 UNIX SCO - SCO OpenServer 5 UNIXWARE - UnixWare 7, Open UNIX 8 AIX - AIX HURD - GNU Hurd DGUX - DG/UX RELIANT - Reliant UNIX DYNIX - DYNIX/ptx QNX - QNX QNX6 - QNX RTP 6.1 LYNX - LynxOS BSD4 - Any BSD 4.4 system UNIX - Any UNIX BSD/SYSV system */ #if defined(__APPLE__) && defined(__GNUC__) # define Q_OS_MACX #elif defined(__MACOSX__) # define Q_OS_MACX #elif defined(macintosh) # define Q_OS_MAC9 #elif defined(__CYGWIN__) # define Q_OS_CYGWIN #elif defined(MSDOS) || defined(_MSDOS) # define Q_OS_MSDOS #elif defined(__OS2__) # if defined(__EMX__) # define Q_OS_OS2EMX # else # define Q_OS_OS2 # endif #elif !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__)) # define Q_OS_WIN32 # define Q_OS_WIN64 #elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) # define Q_OS_WIN32 #elif defined(__MWERKS__) && defined(__INTEL__) # define Q_OS_WIN32 #elif defined(__sun) || defined(sun) # define Q_OS_SOLARIS #elif defined(hpux) || defined(__hpux) # define Q_OS_HPUX #elif defined(__ultrix) || defined(ultrix) # define Q_OS_ULTRIX #elif defined(sinix) # define Q_OS_RELIANT #elif defined(__linux__) || defined(__linux) # define Q_OS_LINUX #elif defined(__FreeBSD__) # define Q_OS_FREEBSD # define Q_OS_BSD4 #elif defined(__NetBSD__) # define Q_OS_NETBSD # define Q_OS_BSD4 #elif defined(__OpenBSD__) # define Q_OS_OPENBSD # define Q_OS_BSD4 #elif defined(__bsdi__) # define Q_OS_BSDI # define Q_OS_BSD4 #elif defined(__sgi) # define Q_OS_IRIX #elif defined(__osf__) # define Q_OS_OSF #elif defined(_AIX) # define Q_OS_AIX #elif defined(__Lynx__) # define Q_OS_LYNX #elif defined(__GNU_HURD__) # define Q_OS_HURD #elif defined(__DGUX__) # define Q_OS_DGUX #elif defined(__QNXNTO__) # define Q_OS_QNX6 #elif defined(__QNX__) # define Q_OS_QNX #elif defined(_SEQUENT_) # define Q_OS_DYNIX #elif defined(_SCO_DS) /* SCO OpenServer 5 + GCC */ # define Q_OS_SCO #elif defined(__USLC__) /* all SCO platforms + UDK or OUDK */ # define Q_OS_UNIXWARE # define Q_OS_UNIXWARE7 #elif defined(__svr4__) && defined(i386) /* Open UNIX 8 + GCC */ # define Q_OS_UNIXWARE # define Q_OS_UNIXWARE7 #else # error "Qt has not been ported to this OS - talk to qt-bugs@trolltech.com" #endif #if defined(Q_OS_MAC9) || defined(Q_OS_MACX) -# define Q_OS_MAC +/* This hack forces the generater to compile qmake not for maxosx native. It is + * compiled for Linux and generates usual makefiles.. + * Does anyone has a better solution for this ? (eilers) + */ +// # define Q_OS_MAC +#define Q_OS_LINUX +#warning "boeser Hack !! (se)" +#undef Q_OS_MACX #endif #if defined(Q_OS_MAC9) || defined(Q_OS_MSDOS) || defined(Q_OS_OS2) || defined(Q_OS_WIN32) || defined(Q_OS_WIN64) # undef Q_OS_UNIX #elif !defined(Q_OS_UNIX) # define Q_OS_UNIX #endif /* The compiler, must be one of: (Q_CC_x) SYM - Symantec C++ for both PC and Macintosh MPW - MPW C++ MWERKS - Metrowerks CodeWarrior MSVC - Microsoft Visual C/C++ BOR - Borland/Turbo C++ WAT - Watcom C++ GNU - GNU C++ COMEAU - Comeau C++ EDG - Edison Design Group C++ OC - CenterLine C++ SUN - Sun WorkShop, Forte Developer, or Sun ONE Studio C++ MIPS - MIPSpro C++ DEC - DEC C++ HP - HPUX C++ HPACC - HPUX ANSI C++ USLC - SCO OUDK, UDK, and UnixWare 2.X C++ CDS - Reliant C++ KAI - KAI C++ INTEL - Intel C++ HIGHC - MetaWare High C/C++ PGI - Portland Group C++ GHS - Green Hills Optimizing C++ Compilers Should be sorted most to least authoritative. */ /* Symantec C++ is now Digital Mars */ #if defined(__DMC__) || defined(__SC__) # define Q_CC_SYM /* "explicit" semantics implemented in 8.1e but keyword recognized since 7.5 */ # if defined(__SC__) && __SC__ < 0x750 # define Q_NO_EXPLICIT_KEYWORD # endif # define Q_NO_USING_KEYWORD # if !defined(_CPPUNWIND) # define Q_NO_EXCEPTIONS # endif #elif defined(applec) # define Q_CC_MPW # define Q_NO_BOOL_TYPE # define Q_NO_EXPLICIT_KEYWORD # define Q_NO_USING_KEYWORD #elif defined(__MWERKS__) # define Q_CC_MWERKS /* "explicit" recognized since 4.0d1 */ # define QMAC_PASCAL pascal # define Q_NO_USING_KEYWORD /* ### check "using" status */ #elif defined(_MSC_VER) # define Q_CC_MSVC /* proper support of bool for _MSC_VER >= 1100 */ # define Q_CANNOT_DELETE_CONSTANT # define Q_INLINE_TEMPLATES inline /* Visual C++.Net issues for _MSC_VER >= 1300 */ # if _MSC_VER >= 1300 # define Q_CC_MSVC_NET # if _MSC_VER < 1310 # define Q_TYPENAME # endif # endif # define Q_NO_USING_KEYWORD /* ### check "using" status */ #elif defined(__BORLANDC__) || defined(__TURBOC__) # define Q_CC_BOR # if __BORLANDC__ < 0x502 # define Q_NO_BOOL_TYPE # define Q_NO_EXPLICIT_KEYWORD # endif # define Q_NO_USING_KEYWORD /* ### check "using" status */ #elif defined(__WATCOMC__) # define Q_CC_WAT # if defined(Q_OS_QNX4) /* compiler flags */ # define Q_TYPENAME # define Q_NO_BOOL_TYPE # define Q_CANNOT_DELETE_CONSTANT # define mutable /* ??? */ # define Q_BROKEN_TEMPLATE_SPECIALIZATION /* no template classes in QVariant */ # define QT_NO_TEMPLATE_VARIANT /* Wcc does not fill in functions needed by valuelists, maps, and valuestacks implicitly */ # define Q_FULL_TEMPLATE_INSTANTIATION /* can we just compare the structures? */ # define Q_FULL_TEMPLATE_INSTANTIATION_MEMCMP /* these are not useful to our customers */ # define QT_QWS_NO_SHM # define QT_NO_QWS_MULTIPROCESS # define QT_NO_SQL # define QT_NO_QWS_CURSOR # endif #elif defined(__GNUC__) # define Q_CC_GNU # define Q_C_CALLBACKS # if __GNUC__ == 2 && __GNUC_MINOR__ <= 7 # define Q_FULL_TEMPLATE_INSTANTIATION # endif /* GCC 2.95 knows "using" but does not support it correctly */ # if __GNUC__ == 2 && __GNUC_MINOR__ <= 95 # define Q_NO_USING_KEYWORD # endif /* GCC 3.1 and GCC 3.2 wrongly define _SB_CTYPE_MACROS on HP-UX */ # if defined(Q_OS_HPUX) && __GNUC__ == 3 && __GNUC_MINOR__ >= 1 # define Q_WRONG_SB_CTYPE_MACROS # endif # if (defined(__arm__) || defined(__ARMEL__)) && !defined(QT_MOC_CPP) # define Q_PACKED __attribute__ ((packed)) # endif # if !defined(__EXCEPTIONS) # define Q_NO_EXCEPTIONS # endif /* IBM compiler versions are a bit messy. There are actually two products: the C product, and the C++ product. The C++ compiler is always packaged with the latest version of the C compiler. Version numbers do not always match. This little table (I'm not sure it's accurate) should be helpful: C++ product C product C Set 3.1 C Compiler 3.0 ... ... C++ Compiler 3.6.6 C Compiler 4.3 ... ... Visual Age C++ 4.0 ... ... ... Visual Age C++ 5.0 C Compiler 5.0 Now: __xlC__ is the version of the C compiler in hexadecimal notation is only an approximation of the C++ compiler version __IBMCPP__ is the version of the C++ compiler in decimal notation but it is not defined on older compilers like C Set 3.1 */ #elif defined(__xlC__) # define Q_CC_XLC # define Q_FULL_TEMPLATE_INSTANTIATION # if __xlC__ < 0x400 # define Q_NO_BOOL_TYPE # define Q_NO_EXPLICIT_KEYWORD # define Q_NO_USING_KEYWORD # define Q_TYPENAME # define Q_INLINE_TEMPLATES inline # define Q_BROKEN_TEMPLATE_SPECIALIZATION # define Q_CANNOT_DELETE_CONSTANT # endif /* Older versions of DEC C++ do not define __EDG__ or __EDG - observed on DEC C++ V5.5-004. New versions do define __EDG__ - observed on Compaq C++ V6.3-002. This compiler is different enough from other EDG compilers to handle it separately anyway. */ #elif defined(__DECCXX) # define Q_CC_DEC /* Compaq C++ V6 compilers are EDG-based but I'm not sure about older DEC C++ V5 compilers. */ # if defined(__EDG__) # define Q_CC_EDG # endif /* Compaq have disabled EDG's _BOOL macro and use _BOOL_EXISTS instead - observed on Compaq C++ V6.3-002. In any case versions prior to Compaq C++ V6.0-005 do not have bool. */ # if !defined(_BOOL_EXISTS) # define Q_NO_BOOL_TYPE # endif /* Spurious (?) error messages observed on Compaq C++ V6.5-014. */ # define Q_NO_USING_KEYWORD /* Apply to all versions prior to Compaq C++ V6.0-000 - observed on DEC C++ V5.5-004. */ # if __DECCXX_VER < 60060000 # define Q_TYPENAME # define Q_BROKEN_TEMPLATE_SPECIALIZATION # define Q_CANNOT_DELETE_CONSTANT # endif /* avoid undefined symbol problems with out-of-line template members */ # define Q_INLINE_TEMPLATES inline /* Compilers with EDG front end are similar. To detect them we test: __EDG documented by SGI, observed on MIPSpro 7.3.1.1 and KAI C++ 4.0b __EDG__ documented in EDG online docs, observed on Compaq C++ V6.3-002 */ #elif defined(__EDG) || defined(__EDG__) # define Q_CC_EDG /* From the EDG documentation (does not seem to apply to Compaq C++): _BOOL Defined in C++ mode when bool is a keyword. The name of this predefined macro is specified by a configuration flag. _BOOL is the default. __BOOL_DEFINED Defined in Microsoft C++ mode when bool is a keyword. */ # if !defined(_BOOL) && !defined(__BOOL_DEFINED) # define Q_NO_BOOL_TYPE # endif /* The Portland Group compiler is based on EDG and does define __EDG__ */ # if defined(__COMO__) # define Q_CC_COMEAU # define Q_C_CALLBACKS /* Using the `using' keyword avoids KAI C++ warnings */ # elif defined(__KCC) # define Q_CC_KAI # if !defined(_EXCEPTIONS) # define Q_NO_EXCEPTIONS # endif /* Using the `using' keyword avoids Intel C++ warnings */ # elif defined(__INTEL_COMPILER) # define Q_CC_INTEL # if !defined(__EXCEPTIONS) # define Q_NO_EXCEPTIONS # endif /* The Portland Group compiler is based on EDG and does define __EDG__ */ # elif defined(__PGI) # define Q_CC_PGI # if !defined(__EXCEPTIONS) # define Q_NO_EXCEPTIONS # endif /* Never tested! */ # elif defined(__ghs) # define Q_CC_GHS /* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */ # elif defined(__USLC__) && defined(__SCO_VERSION__) # define Q_CC_USLC /* The latest UDK 7.1.1b does not need this, but previous versions do */ # if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010) # define Q_INLINE_TEMPLATES inline # endif # define Q_NO_USING_KEYWORD /* ### check "using" status */ /* Never tested! */ # elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER) # define Q_CC_OC # define Q_NO_USING_KEYWORD /* CDS++ defines __EDG__ although this is not documented in the Reliant documentation. It also follows conventions like _BOOL and this documented */ # elif defined(sinix) # define Q_CC_CDS # define Q_NO_USING_KEYWORD # if defined(__cplusplus) && (__cplusplus < 2) /* Cfront C++ mode */ # define Q_NO_EXCEPTIONS # endif /* The MIPSpro compiler in o32 mode is based on EDG but disables features such as template specialization nevertheless */ # elif defined(__sgi) # define Q_CC_MIPS # if defined(_MIPS_SIM) && (_MIPS_SIM == _ABIO32) /* o32 ABI */ # define Q_TYPENAME # define Q_BROKEN_TEMPLATE_SPECIALIZATION # define Q_STRICT_INLINING_RULES # define Q_NO_EXPLICIT_KEYWORD # define Q_INLINE_TEMPLATES inline # elif defined(_COMPILER_VERSION) && (_COMPILER_VERSION < 730) /* 7.2 */ # define Q_TYPENAME # define Q_BROKEN_TEMPLATE_SPECIALIZATION # endif # define Q_NO_USING_KEYWORD /* ### check "using" status */ # endif /* The older UnixWare 2.X compiler? */ #elif defined(__USLC__) # define Q_CC_USLC # define Q_TYPENAME # define Q_NO_BOOL_TYPE # define Q_NO_EXPLICIT_KEYWORD # define Q_NO_USING_KEYWORD # define Q_INLINE_TEMPLATES inline /* Never tested! */ #elif defined(__HIGHC__) # define Q_CC_HIGHC #elif defined(__SUNPRO_CC) # define Q_CC_SUN /* 5.0 compiler or better 'bool' is enabled by default but can be disabled using -features=nobool in which case _BOOL is not defined this is the default in 4.2 compatibility mode triggered by -compat=4 */ # if __SUNPRO_CC >= 0x500 # if !defined(_BOOL) # define Q_NO_BOOL_TYPE # endif # if defined(__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT <= 4) # define Q_NO_USING_KEYWORD # endif # define Q_C_CALLBACKS /* 4.2 compiler or older */ # else # define Q_NO_BOOL_TYPE # define Q_NO_EXPLICIT_KEYWORD # define Q_NO_USING_KEYWORD # endif /* CDS++ does not seem to define __EDG__ or __EDG according to Reliant documentation but nevertheless uses EDG conventions like _BOOL */ #elif defined(sinix) # define Q_CC_EDG # define Q_CC_CDS # if !defined(_BOOL) # define Q_NO_BOOL_TYPE # endif # define Q_BROKEN_TEMPLATE_SPECIALIZATION #elif defined(Q_OS_HPUX) /* __HP_aCC was not defined in first aCC releases */ # if defined(__HP_aCC) || __cplusplus >= 199707L # define Q_CC_HPACC # else # define Q_CC_HP # define Q_NO_BOOL_TYPE # define Q_FULL_TEMPLATE_INSTANTIATION # define Q_BROKEN_TEMPLATE_SPECIALIZATION # define Q_NO_EXPLICIT_KEYWORD # endif # define Q_NO_USING_KEYWORD /* ### check "using" status */ #else # error "Qt has not been tested with this compiler - talk to qt-bugs@trolltech.com" #endif #ifndef Q_PACKED # define Q_PACKED #endif /* The window system, must be one of: (Q_WS_x) MACX - Mac OS X MAC9 - Mac OS 9 QWS - Qt/Embedded WIN32 - Windows X11 - X Window System PM - unsupported WIN16 - unsupported */ #if defined(Q_OS_MAC9) # define Q_WS_MAC9 #elif defined(Q_OS_MSDOS) # define Q_WS_WIN16 # error "Qt requires Win32 and does not work with Windows 3.x" #elif defined(_WIN32_X11_) # define Q_WS_X11 #elif defined(Q_OS_WIN32) # define Q_WS_WIN32 # if defined(Q_OS_WIN64) # define Q_WS_WIN64 # endif #elif defined(Q_OS_OS2) # define Q_WS_PM # error "Qt does not work with OS/2 Presentation Manager or Workplace Shell" #elif defined(Q_OS_UNIX) # if defined(QWS) # define Q_WS_QWS # define QT_NO_QWS_IM # elif defined(Q_OS_MACX) # define Q_WS_MACX # else # define Q_WS_X11 # endif #endif #if defined(Q_OS_MAC) && !defined(QMAC_PASCAL) # define QMAC_PASCAL #endif diff --git a/qt/qt-2.3.7.patch/qte237-all-macosx.patch b/qt/qt-2.3.7.patch/qte237-all-macosx.patch new file mode 100644 index 0000000..82ed530 --- a/dev/null +++ b/qt/qt-2.3.7.patch/qte237-all-macosx.patch @@ -0,0 +1,1161 @@ +diff -ru qte-2.3.7_orig/include/qapplication.h qte-2.3.7/include/qapplication.h +--- qte-2.3.7_orig/include/qapplication.h Thu Jul 17 03:20:25 2003 ++++ qte-2.3.7/include/qapplication.h Mon Oct 27 14:21:28 2003 +@@ -61,6 +61,10 @@ + class QSemaphore; + #endif + ++#if !defined( QT_WEAK_SYMBOL ) ++#define QT_WEAK_SYMBOL ++#endif ++ + // REMOVE IN 3.0 (just here for moc source compatibility) + #define QNonBaseApplication QApplication + +@@ -85,7 +89,10 @@ + + #ifndef QT_NO_STYLE + static QStyle &style(); +- static void setStyle( QStyle* ); ++ static void setStyle( QStyle* ) QT_WEAK_SYMBOL; ++private: ++ static void setStyle_NonWeak( QStyle* ); ++public: + #endif + #if 1 /* OBSOLETE */ + enum ColorMode { NormalColors, CustomColors }; +@@ -106,11 +113,19 @@ + #ifndef QT_NO_PALETTE + static QPalette palette( const QWidget* = 0 ); + static void setPalette( const QPalette &, bool informWidgets=FALSE, ++ const char* className = 0 ) QT_WEAK_SYMBOL; ++private: ++ static void setPalette_NonWeak( const QPalette &, bool informWidgets=FALSE, + const char* className = 0 ); ++public: + #endif + static QFont font( const QWidget* = 0 ); + static void setFont( const QFont &, bool informWidgets=FALSE, ++ const char* className = 0 ) QT_WEAK_SYMBOL; ++private: ++ static void setFont_NonWeak( const QFont &, bool informWidgets=FALSE, + const char* className = 0 ); ++public: + static QFontMetrics fontMetrics(); + + QWidget *mainWidget() const; +@@ -207,7 +222,10 @@ + void qwsSetCustomColors( QRgb *colortable, int start, int numColors ); + #ifndef QT_NO_QWS_MANAGER + static QWSDecoration &qwsDecoration(); +- static void qwsSetDecoration( QWSDecoration *); ++ static void qwsSetDecoration( QWSDecoration *) QT_WEAK_SYMBOL; ++private: ++ static void qwsSetDecoration_NonWeak( QWSDecoration *); ++public: + #endif + #endif + +Only in qte-2.3.7/include: qconfig-qpe.h +diff -ru qte-2.3.7_orig/include/qconfig.h qte-2.3.7/include/qconfig.h +--- qte-2.3.7_orig/include/qconfig.h Fri Jan 26 14:43:06 2001 ++++ qte-2.3.7/include/qconfig.h Wed Oct 29 22:13:16 2003 +@@ -1,3 +1,26 @@ ++// Copied from qconfig-qpe.h ++/********************************************************************** ++** Copyright (C) 2000 Trolltech AS. All rights reserved. ++** ++** This file is part of Qtopia Environment. ++** ++** This file may be distributed and/or modified under the terms of the ++** GNU General Public License version 2 as published by the Free Software ++** Foundation and appearing in the file LICENSE.GPL included in the ++** packaging of this file. ++** ++** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ++** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ++** ++** See http://www.trolltech.com/gpl/ for GPL licensing information. ++** ++** Contact info@trolltech.com if any conditions of this licensing are ++** not clear to you. ++** ++**********************************************************************/ ++#ifndef QT_H ++#endif // QT_H ++ + // Empty leaves all features enabled. See doc/html/features.html for choices. + + // Note that disabling some features will produce a libqt that is not +@@ -8,3 +31,69 @@ + #ifndef QT_DLL + #define QT_DLL // Internal + #endif ++ ++#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_SL5XXX) ++# define QT_NO_QWS_CURSOR ++# define QT_NO_QWS_MOUSE_AUTO ++#endif ++#ifndef QT_NO_CODECS ++#define QT_NO_CODECS ++#endif ++#define QT_NO_UNICODETABLES ++//#define QT_NO_IMAGEIO_BMP ++#define QT_NO_IMAGEIO_PPM ++//#define QT_NO_ASYNC_IO ++//#define QT_NO_ASYNC_IMAGE_IO ++#define QT_NO_FREETYPE ++#define QT_NO_BDF ++//#define QT_NO_FONTDATABASE ++#define QT_NO_DRAGANDDROP ++//#define QT_NO_CLIPBOARD ++#define QT_NO_PROPERTIES ++#define QT_NO_NETWORKPROTOCOL ++ ++#define QT_NO_IMAGE_TEXT ++ ++//#define QT_NO_TOOLTIP ++#define QT_NO_COLORNAMES ++#define QT_NO_TRANSFORMATIONS ++#define QT_NO_TRANSLATION_BUILDER ++#define QT_NO_COMPLEXTEXT ++#define QT_NO_PRINTER ++#define QT_NO_PICTURE ++//#define QT_NO_ICONVIEW ++#define QT_NO_DIAL ++#define QT_NO_SIZEGRIP ++#define QT_NO_WORKSPACE ++//#define QT_NO_TABLE ++//#define QT_NO_ACTION ++//#define QT_NO_SETTINGS ++#define QT_NO_STYLE_POCKETPC ++#ifndef QT_NO_STYLE_AQUA ++# define QT_NO_STYLE_AQUA ++#endif ++#define QT_NO_STYLE_MOTIF ++#define QT_NO_STYLE_PLATINUM ++#define QT_NO_FILEDIALOG ++#define QT_NO_FONTDIALOG ++#define QT_NO_PRINTDIALOG ++#define QT_NO_COLORDIALOG ++#define QT_NO_INPUTDIALOG ++//#define QT_NO_MESSAGEBOX ++#define QT_NO_PROGRESSDIALOG ++//#define QT_NO_TABDIALOG ++#define QT_NO_WIZARD ++#define QT_NO_EFFECTS ++//#define QT_NO_COMPONENT ++#define QT_NO_DOM ++#define QT_NO_SEMIMODAL ++//#define QT_NO_PROGRESSBAR ++#define QT_NO_SPLITTER ++ ++//#define QT_NO_QWS_SAVEFONTS ++//#define QT_NO_QWS_PROPERTIES ++ ++#define QT_NO_QWS_BEOS_WM_STYLE ++#define QT_NO_QWS_KDE2_WM_STYLE ++#define QT_NO_QWS_KDE_WM_STYLE ++#define QT_NO_QWS_WINDOWS_WM_STYLE +diff -ru qte-2.3.7_orig/include/qfontdatabase.h qte-2.3.7/include/qfontdatabase.h +--- qte-2.3.7_orig/include/qfontdatabase.h Thu Jul 17 03:20:25 2003 ++++ qte-2.3.7/include/qfontdatabase.h Mon Oct 27 14:21:28 2003 +@@ -59,6 +59,10 @@ + class QDiskFont; + #endif + ++#if !defined( QT_WEAK_SYMBOL ) ++#define QT_WEAK_SYMBOL ++#endif ++ + class QFontDatabasePrivate; + + class Q_EXPORT QFontDatabase +@@ -67,9 +71,16 @@ + QFontDatabase(); + + QStringList families( bool onlyForLocale = TRUE ) const; ++ ++ + QValueList<int> pointSizes( const QString &family, + const QString &style = QString::null, +- const QString &charSet = QString::null ); ++ const QString &charSet = QString::null ) QT_WEAK_SYMBOL; ++private: ++ QValueList<int> pointSizes_NonWeak( const QString &family, ++ const QString &style, ++ const QString &charSet ); ++public: + QStringList styles( const QString &family, + const QString &charSet = QString::null ) const; + QStringList charSets( const QString &familyName, +Only in qte-2.3.7_orig/include: qgifimageformat_p.h +diff -ru qte-2.3.7_orig/include/qmodules.h qte-2.3.7/include/qmodules.h +--- qte-2.3.7_orig/include/qmodules.h Fri Aug 31 17:00:56 2001 ++++ qte-2.3.7/include/qmodules.h Wed Oct 29 21:57:53 2003 +@@ -1,14 +1,12 @@ +-#ifndef QT_H +-#endif // QT_H +- ++// These modules are licensed to you + #define QT_MODULE_TOOLS + #define QT_MODULE_KERNEL + #define QT_MODULE_WIDGETS + #define QT_MODULE_DIALOGS +- + #define QT_MODULE_ICONVIEW + #define QT_MODULE_WORKSPACE +-#define QT_MODULE_TABLE ++#define QT_MODULE_NETWORK + #define QT_MODULE_CANVAS ++#define QT_MODULE_TABLE + #define QT_MODULE_XML +-#define QT_MODULE_NETWORK ++#define QT_MODULE_OPENGL +Only in qte-2.3.7_orig/include: qxt.h +Only in qte-2.3.7/lib: libqte.dylib +Only in qte-2.3.7/lib: libqte.dylib.2 +Only in qte-2.3.7/lib: libqte.dylib.2.3 +Only in qte-2.3.7/lib: libqte.dylib.2.3.7 +Only in qte-2.3.7/src/3rdparty/kernel: qgifimageformat.o +Only in qte-2.3.7/src/3rdparty/kernel: qpointarray.o +Only in qte-2.3.7/src/3rdparty/kernel: qpolygonscanner.o +Only in qte-2.3.7/src/3rdparty/kernel: qregion_qws.o +Only in qte-2.3.7/src/3rdparty/libpng: png.o +Only in qte-2.3.7/src/3rdparty/libpng: pngerror.o +Only in qte-2.3.7/src/3rdparty/libpng: pngget.o +Only in qte-2.3.7/src/3rdparty/libpng: pngmem.o +Only in qte-2.3.7/src/3rdparty/libpng: pngpread.o +Only in qte-2.3.7/src/3rdparty/libpng: pngread.o +Only in qte-2.3.7/src/3rdparty/libpng: pngrio.o +Only in qte-2.3.7/src/3rdparty/libpng: pngrtran.o +Only in qte-2.3.7/src/3rdparty/libpng: pngrutil.o +Only in qte-2.3.7/src/3rdparty/libpng: pngset.o +Only in qte-2.3.7/src/3rdparty/libpng: pngtrans.o +Only in qte-2.3.7/src/3rdparty/libpng: pngwio.o +Only in qte-2.3.7/src/3rdparty/libpng: pngwrite.o +Only in qte-2.3.7/src/3rdparty/libpng: pngwtran.o +Only in qte-2.3.7/src/3rdparty/libpng: pngwutil.o +Only in qte-2.3.7/src/3rdparty/tools: qbig5codec.o +Only in qte-2.3.7/src/3rdparty/tools: qeucjpcodec.o +Only in qte-2.3.7/src/3rdparty/tools: qeuckrcodec.o +Only in qte-2.3.7/src/3rdparty/tools: qgbkcodec.o +Only in qte-2.3.7/src/3rdparty/tools: qjiscodec.o +Only in qte-2.3.7/src/3rdparty/tools: qjpunicode.o +Only in qte-2.3.7/src/3rdparty/tools: qrtlcodec.o +Only in qte-2.3.7/src/3rdparty/tools: qsjiscodec.o +Only in qte-2.3.7/src/3rdparty/tools: qtsciicodec.o +Only in qte-2.3.7/src/3rdparty/zlib: Makefile +Only in qte-2.3.7/src/3rdparty/zlib: adler32.o +Only in qte-2.3.7/src/3rdparty/zlib: compress.o +Only in qte-2.3.7/src/3rdparty/zlib: crc32.o +Only in qte-2.3.7/src/3rdparty/zlib: deflate.o +Only in qte-2.3.7/src/3rdparty/zlib: gzio.o +Only in qte-2.3.7/src/3rdparty/zlib: infblock.o +Only in qte-2.3.7/src/3rdparty/zlib: infcodes.o +Only in qte-2.3.7/src/3rdparty/zlib: inffast.o +Only in qte-2.3.7/src/3rdparty/zlib: inflate.o +Only in qte-2.3.7/src/3rdparty/zlib: inftrees.o +Only in qte-2.3.7/src/3rdparty/zlib: infutil.o +Only in qte-2.3.7/src/3rdparty/zlib: trees.o +Only in qte-2.3.7/src/3rdparty/zlib: uncompr.o +Only in qte-2.3.7/src/3rdparty/zlib: zutil.o +Only in qte-2.3.7/src: Makefile +Only in qte-2.3.7/src: allmoc.cpp +Only in qte-2.3.7/src: allmoc.o +Only in qte-2.3.7/src/canvas: qcanvas.o +Only in qte-2.3.7/src/dialogs: qcolordialog.moc +Only in qte-2.3.7/src/dialogs: qcolordialog.o +Only in qte-2.3.7/src/dialogs: qfiledialog.moc +Only in qte-2.3.7/src/dialogs: qfiledialog.o +Only in qte-2.3.7/src/dialogs: qfontdialog.o +Only in qte-2.3.7/src/dialogs: qinputdialog.o +Only in qte-2.3.7/src/dialogs: qmessagebox.o +Only in qte-2.3.7/src/dialogs: qprintdialog.o +Only in qte-2.3.7/src/dialogs: qprogressdialog.o +Only in qte-2.3.7/src/dialogs: qtabdialog.o +Only in qte-2.3.7/src/dialogs: qwizard.o +Only in qte-2.3.7/src/iconview: qiconview.o +Only in qte-2.3.7/src/kernel: qabstractlayout.o +Only in qte-2.3.7/src/kernel: qaccel.o +diff -ru qte-2.3.7_orig/src/kernel/qapplication.cpp qte-2.3.7/src/kernel/qapplication.cpp +--- qte-2.3.7_orig/src/kernel/qapplication.cpp Thu Jul 17 03:20:25 2003 ++++ qte-2.3.7/src/kernel/qapplication.cpp Mon Oct 27 14:21:28 2003 +@@ -35,6 +35,8 @@ + ** + **********************************************************************/ + ++#define QT_WEAK_SYMBOL __attribute__(( weak )) ++ + #include "qobjectlist.h" + #include "qobjectdict.h" + #include "qapplication.h" +@@ -933,11 +935,16 @@ + #ifndef QT_NO_STYLE + void QApplication::setStyle( QStyle *style ) + { ++ setStyle_NonWeak ( style ); ++} ++ ++void QApplication::setStyle_NonWeak( QStyle *style ) ++{ + QStyle* old = app_style; +- app_style = style; + + if ( startingUp() ) { + delete old; ++ app_style = style; + return; + } + +@@ -958,6 +965,8 @@ + old->unPolish( qApp ); + } + ++ app_style = style; ++ + // take care of possible palette requirements of certain gui + // styles. Do it before polishing the application since the style + // might call QApplication::setStyle() itself +@@ -1184,13 +1193,30 @@ + \sa QWidget::setPalette(), palette(), QStyle::polish() + */ + +-void QApplication::setPalette( const QPalette &palette, bool informWidgets, ++void QApplication::setPalette ( const QPalette &palette, bool informWidgets, ++ const char* className ) ++{ ++ setPalette_NonWeak ( palette, informWidgets, className ); ++} ++ ++void QApplication::setPalette_NonWeak ( const QPalette &palette, bool informWidgets, + const char* className ) + { + QPalette pal = palette; + #ifndef QT_NO_STYLE +- if ( !startingUp() ) ++ if ( !startingUp() ) { + qApp->style().polish( pal ); // NB: non-const reference ++ if ( className ) { ++ // if we just polished a class specific palette (this normally ++ // only called by qt_fix_tooltips - see below), we better re- ++ // polish the global palette. Some styles like liquid can get ++ // confused, because they can not detect if the polished palette ++ // is the global one or only a class specific one. ++ // (liquid uses this palette to calculate blending pixmaps) ++ QPalette p = qApp-> palette ( ); ++ qApp->style().polish ( p ); ++ } ++ } + #endif + bool all = FALSE; + if ( !className ) { +@@ -1273,6 +1299,12 @@ + */ + + void QApplication::setFont( const QFont &font, bool informWidgets, ++ const char* className ) ++{ ++ setFont_NonWeak ( font, informWidgets, className ); ++} ++ ++void QApplication::setFont_NonWeak( const QFont &font, bool informWidgets, + const char* className ) + { + bool all = FALSE; +diff -ru qte-2.3.7_orig/src/kernel/qapplication.h qte-2.3.7/src/kernel/qapplication.h +--- qte-2.3.7_orig/src/kernel/qapplication.h Thu Jul 17 03:20:25 2003 ++++ qte-2.3.7/src/kernel/qapplication.h Mon Oct 27 14:21:28 2003 +@@ -61,6 +61,10 @@ + class QSemaphore; + #endif + ++#if !defined( QT_WEAK_SYMBOL ) ++#define QT_WEAK_SYMBOL ++#endif ++ + // REMOVE IN 3.0 (just here for moc source compatibility) + #define QNonBaseApplication QApplication + +@@ -85,7 +89,10 @@ + + #ifndef QT_NO_STYLE + static QStyle &style(); +- static void setStyle( QStyle* ); ++ static void setStyle( QStyle* ) QT_WEAK_SYMBOL; ++private: ++ static void setStyle_NonWeak( QStyle* ); ++public: + #endif + #if 1 /* OBSOLETE */ + enum ColorMode { NormalColors, CustomColors }; +@@ -106,11 +113,19 @@ + #ifndef QT_NO_PALETTE + static QPalette palette( const QWidget* = 0 ); + static void setPalette( const QPalette &, bool informWidgets=FALSE, ++ const char* className = 0 ) QT_WEAK_SYMBOL; ++private: ++ static void setPalette_NonWeak( const QPalette &, bool informWidgets=FALSE, + const char* className = 0 ); ++public: + #endif + static QFont font( const QWidget* = 0 ); + static void setFont( const QFont &, bool informWidgets=FALSE, ++ const char* className = 0 ) QT_WEAK_SYMBOL; ++private: ++ static void setFont_NonWeak( const QFont &, bool informWidgets=FALSE, + const char* className = 0 ); ++public: + static QFontMetrics fontMetrics(); + + QWidget *mainWidget() const; +@@ -207,7 +222,10 @@ + void qwsSetCustomColors( QRgb *colortable, int start, int numColors ); + #ifndef QT_NO_QWS_MANAGER + static QWSDecoration &qwsDecoration(); +- static void qwsSetDecoration( QWSDecoration *); ++ static void qwsSetDecoration( QWSDecoration *) QT_WEAK_SYMBOL; ++private: ++ static void qwsSetDecoration_NonWeak( QWSDecoration *); ++public: + #endif + #endif + +Only in qte-2.3.7/src/kernel: qapplication.o +diff -ru qte-2.3.7_orig/src/kernel/qapplication_qws.cpp qte-2.3.7/src/kernel/qapplication_qws.cpp +--- qte-2.3.7_orig/src/kernel/qapplication_qws.cpp Thu Jul 17 03:20:25 2003 ++++ qte-2.3.7/src/kernel/qapplication_qws.cpp Mon Oct 27 14:21:28 2003 +@@ -2804,6 +2804,11 @@ + */ + void QApplication::qwsSetDecoration( QWSDecoration *d ) + { ++ qwsSetDecoration_NonWeak ( d ); ++} ++ ++void QApplication::qwsSetDecoration_NonWeak( QWSDecoration *d ) ++{ + if ( d ) { + delete qws_decoration; + qws_decoration = d; +Only in qte-2.3.7/src/kernel: qapplication_qws.cpp~ +Only in qte-2.3.7/src/kernel: qapplication_qws.o +Only in qte-2.3.7/src/kernel: qasyncimageio.o +Only in qte-2.3.7/src/kernel: qasyncio.o +Only in qte-2.3.7/src/kernel: qbitmap.o +Only in qte-2.3.7/src/kernel: qclipboard.o +Only in qte-2.3.7/src/kernel: qclipboard_qws.o +Only in qte-2.3.7/src/kernel: qcolor.o +Only in qte-2.3.7/src/kernel: qcolor_p.o +Only in qte-2.3.7/src/kernel: qcolor_qws.o +Only in qte-2.3.7/src/kernel: qconnection.o +Only in qte-2.3.7/src/kernel: qcopchannel_qws.moc +Only in qte-2.3.7/src/kernel: qcopchannel_qws.o +Only in qte-2.3.7/src/kernel: qcursor.o +Only in qte-2.3.7/src/kernel: qcursor_qws.o +Only in qte-2.3.7/src/kernel: qdialog.o +Only in qte-2.3.7/src/kernel: qdirectpainter_qws.o +Only in qte-2.3.7/src/kernel: qdnd_qws.o +Only in qte-2.3.7/src/kernel: qdragobject.o +Only in qte-2.3.7/src/kernel: qdrawutil.o +Only in qte-2.3.7/src/kernel: qdropsite.o +Only in qte-2.3.7/src/kernel: qevent.o +Only in qte-2.3.7/src/kernel: qfocusdata.o +Only in qte-2.3.7/src/kernel: qfont.o +Only in qte-2.3.7/src/kernel: qfont_qws.o +diff -ru qte-2.3.7_orig/src/kernel/qfontdatabase.cpp qte-2.3.7/src/kernel/qfontdatabase.cpp +--- qte-2.3.7_orig/src/kernel/qfontdatabase.cpp Thu Jul 17 03:20:25 2003 ++++ qte-2.3.7/src/kernel/qfontdatabase.cpp Mon Oct 27 14:21:28 2003 +@@ -35,6 +35,8 @@ + ** + **********************************************************************/ + ++#define QT_WEAK_SYMBOL __attribute__(( weak )) ++ + #include "qfontdatabase.h" + + #ifndef QT_NO_FONTDATABASE +@@ -2421,6 +2423,13 @@ + */ + + QValueList<int> QFontDatabase::pointSizes( const QString &family, ++ const QString &style, ++ const QString &charSet ) ++{ ++ return pointSizes_NonWeak ( family, style, charSet ); ++} ++ ++QValueList<int> QFontDatabase::pointSizes_NonWeak ( const QString &family, + const QString &style, + const QString &charSet ) + { +diff -ru qte-2.3.7_orig/src/kernel/qfontdatabase.h qte-2.3.7/src/kernel/qfontdatabase.h +--- qte-2.3.7_orig/src/kernel/qfontdatabase.h Thu Jul 17 03:20:25 2003 ++++ qte-2.3.7/src/kernel/qfontdatabase.h Mon Oct 27 14:21:28 2003 +@@ -59,6 +59,10 @@ + class QDiskFont; + #endif + ++#if !defined( QT_WEAK_SYMBOL ) ++#define QT_WEAK_SYMBOL ++#endif ++ + class QFontDatabasePrivate; + + class Q_EXPORT QFontDatabase +@@ -67,9 +71,16 @@ + QFontDatabase(); + + QStringList families( bool onlyForLocale = TRUE ) const; ++ ++ + QValueList<int> pointSizes( const QString &family, + const QString &style = QString::null, +- const QString &charSet = QString::null ); ++ const QString &charSet = QString::null ) QT_WEAK_SYMBOL; ++private: ++ QValueList<int> pointSizes_NonWeak( const QString &family, ++ const QString &style, ++ const QString &charSet ); ++public: + QStringList styles( const QString &family, + const QString &charSet = QString::null ) const; + QStringList charSets( const QString &familyName, +Only in qte-2.3.7/src/kernel: qfontdatabase.o +Only in qte-2.3.7/src/kernel: qfontfactorybdf_qws.o +Only in qte-2.3.7/src/kernel: qfontfactoryttf_qws.o +Only in qte-2.3.7/src/kernel: qfontmanager_qws.o +diff -ru qte-2.3.7_orig/src/kernel/qgfx_qws.cpp qte-2.3.7/src/kernel/qgfx_qws.cpp +--- qte-2.3.7_orig/src/kernel/qgfx_qws.cpp Thu Jul 17 03:20:25 2003 ++++ qte-2.3.7/src/kernel/qgfx_qws.cpp Mon Oct 27 14:27:25 2003 +@@ -32,7 +32,7 @@ + #include "qgfx_qws.h" + + #include <stdio.h> +-#include <dlfcn.h> ++//#include <dlfcn.h> + #include <sys/types.h> + #include <dirent.h> + #include <stdlib.h> +Only in qte-2.3.7/src/kernel: qgfx_qws.o +diff -ru qte-2.3.7_orig/src/kernel/qgfxraster_qws.cpp qte-2.3.7/src/kernel/qgfxraster_qws.cpp +--- qte-2.3.7_orig/src/kernel/qgfxraster_qws.cpp Thu Jul 17 03:20:25 2003 ++++ qte-2.3.7/src/kernel/qgfxraster_qws.cpp Mon Oct 27 14:27:25 2003 +@@ -75,7 +75,11 @@ + # if __BYTE_ORDER == __BIG_ENDIAN + # define QWS_BIG_ENDIAN + # endif ++#elif defined(__APPLE__) ++# define QWS_BIG_ENDIAN + #endif ++// AJ: the above (test for __APPLE__) is very hacky, but I can't ++// think of something better at the moment. + + // Pull this private function in from qglobal.cpp + extern unsigned int qt_int_sqrt( unsigned int n ); +@@ -3770,6 +3774,19 @@ + b = srcval & 0xff; + + unsigned char * tmp=(unsigned char *)&alphabuf[loopc]; ++# ifdef QWS_BIG_ENDIAN ++ if(av==255) { ++ // Do nothing - we already have source values in r,g,b ++ } else if(av==0) { ++ r = *(tmp+1); ++ g = *(tmp+2); ++ b = *(tmp+3); ++ } else { ++ r = ((r-*(tmp+1)) * av) / 256 + *(tmp+1); ++ g = ((g-*(tmp+2)) * av) / 256 + *(tmp+2); ++ b = ((b-*(tmp+3)) * av) / 256 + *(tmp+3); ++ } ++# else + if(av==255) { + // Do nothing - we already have source values in r,g,b + } else if(av==0) { +@@ -3781,6 +3798,7 @@ + g = ((g-*(tmp+1)) * av) / 256 + *(tmp+1); + b = ((b-*(tmp+0)) * av) / 256 + *(tmp+0); + } ++# endif + *(alphaptr++) = (r << 16) | (g << 8) | b; + } + +@@ -4204,7 +4222,7 @@ + + } else if ( depth == 1 ) { + if (srctype==SourceImage) { +- static int warn; ++ static int warn = 0; + if ( warn++ < 5 ) + qDebug( "bitmap alpha-image not implemented" ); + hImageLineUnclipped( x1, x2, l, srcdata, FALSE ); +@@ -4237,7 +4255,7 @@ + setAlphaType(IgnoreAlpha); + if ( w <= 0 || h <= 0 || !ncliprect ) return; + GFX_START(QRect(rx+xoffs, ry+yoffs, w+1, h+1)) +-#ifdef QWS_EXPERIMENTAL_FASTPATH ++#if 0 // def QWS_EXPERIMENTAL_FASTPATH !! this is crashing HancomWord on OZ !! + // ### fix for 8bpp + // This seems to be reliable now, at least for 16bpp + +Only in qte-2.3.7/src/kernel: qgfxraster_qws.cpp~ +Only in qte-2.3.7/src/kernel: qgfxraster_qws.o +Only in qte-2.3.7/src/kernel: qguardedptr.o +Only in qte-2.3.7/src/kernel: qiconset.o +Only in qte-2.3.7/src/kernel: qimage.o +Only in qte-2.3.7/src/kernel: qinputcontext_qws.o +Only in qte-2.3.7/src/kernel: qjpegio.o +diff -ru qte-2.3.7_orig/src/kernel/qkeyboard_qws.cpp qte-2.3.7/src/kernel/qkeyboard_qws.cpp +--- qte-2.3.7_orig/src/kernel/qkeyboard_qws.cpp Thu Jul 17 03:20:25 2003 ++++ qte-2.3.7/src/kernel/qkeyboard_qws.cpp Mon Oct 27 14:42:11 2003 +@@ -69,7 +69,7 @@ + #if !defined(_OS_QNX6_) + + #include <termios.h> +-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) ++#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) + #include <sys/kd.h> + #include <sys/vt.h> + #endif +@@ -468,10 +468,12 @@ + void QWSPC101KeyboardHandler::restoreLeds() + { + char leds; ++#if !defined(_OS_MACX_) + ioctl(0, KDGETLED, &leds); + leds = leds & ~LED_CAP; + if ( caps ) leds |= LED_CAP; + ioctl(0, KDSETLED, leds); ++#endif + } + + class QWSTtyKeyboardHandler : public QWSPC101KeyboardHandler +@@ -547,7 +549,7 @@ + + static void vtSwitchHandler(int /*sig*/) + { +-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) ++#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) + if (vtActive) { + qwsServer->enablePainting(false); + qt_screen->save(); +@@ -880,7 +882,7 @@ + if (term && !release) { + ctrl = false; + alt = false; +-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) ++#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) + ioctl(kbdFD, VT_ACTIVATE, term); + #endif + return; +@@ -1031,7 +1033,7 @@ + struct termios termdata; + tcgetattr( kbdFD, &termdata ); + +-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) ++#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) + ioctl(kbdFD, KDSKBMODE, K_RAW); + #endif + +@@ -1047,7 +1049,7 @@ + + signal(VTSWITCHSIG, vtSwitchHandler); + +-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) ++#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) + struct vt_mode vtMode; + ioctl(kbdFD, VT_GETMODE, &vtMode); + +@@ -1068,7 +1070,7 @@ + { + if (kbdFD >= 0) + { +-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) ++#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) + ioctl(kbdFD, KDSKBMODE, K_XLATE); + #endif + tcsetattr(kbdFD, TCSANOW, &origTermData); +Only in qte-2.3.7/src/kernel: qkeyboard_qws.cpp.rej +Only in qte-2.3.7/src/kernel: qkeyboard_qws.cpp~ +Only in qte-2.3.7/src/kernel: qkeyboard_qws.moc +Only in qte-2.3.7/src/kernel: qkeyboard_qws.o +Only in qte-2.3.7/src/kernel: qlayout.o +Only in qte-2.3.7/src/kernel: qlayoutengine.o +Only in qte-2.3.7/src/kernel: qlocalfs.o +diff -ru qte-2.3.7_orig/src/kernel/qlock_qws.cpp qte-2.3.7/src/kernel/qlock_qws.cpp +--- qte-2.3.7_orig/src/kernel/qlock_qws.cpp Thu Jul 17 03:20:25 2003 ++++ qte-2.3.7/src/kernel/qlock_qws.cpp Mon Oct 27 14:27:25 2003 +@@ -38,7 +38,7 @@ + #include <errno.h> + + #if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) \ +- || defined _OS_FREEBSD_ ++ || defined(_OS_FREEBSD_) || defined(_OS_MACX_) + /* union semun is defined by including <sys/sem.h> */ + #else + /* according to X/OPEN we have to define it ourselves */ +Only in qte-2.3.7/src/kernel: qlock_qws.o +Only in qte-2.3.7/src/kernel: qmemorymanager_qws.o +Only in qte-2.3.7/src/kernel: qmetaobject.o +Only in qte-2.3.7/src/kernel: qmime.o +Only in qte-2.3.7/src/kernel: qmngio.o +Only in qte-2.3.7/src/kernel: qmovie.moc +Only in qte-2.3.7/src/kernel: qmovie.o +Only in qte-2.3.7/src/kernel: qnetworkprotocol.o +Only in qte-2.3.7/src/kernel: qobject.o +Only in qte-2.3.7/src/kernel: qpaintdevice_qws.o +Only in qte-2.3.7/src/kernel: qpaintdevicemetrics.o +Only in qte-2.3.7/src/kernel: qpainter.o +Only in qte-2.3.7/src/kernel: qpainter_qws.o +Only in qte-2.3.7/src/kernel: qpalette.o +Only in qte-2.3.7/src/kernel: qpicture.o +Only in qte-2.3.7/src/kernel: qpixmap.o +Only in qte-2.3.7/src/kernel: qpixmap_qws.o +Only in qte-2.3.7/src/kernel: qpixmapcache.o +Only in qte-2.3.7/src/kernel: qpngio.o +Only in qte-2.3.7/src/kernel: qpoint.o +Only in qte-2.3.7/src/kernel: qprinter.o +Only in qte-2.3.7/src/kernel: qprinter_qws.o +Only in qte-2.3.7/src/kernel: qpsprinter.o +Only in qte-2.3.7/src/kernel: qrect.o +Only in qte-2.3.7/src/kernel: qregion.o +Only in qte-2.3.7/src/kernel: qrichtext.o +Only in qte-2.3.7/src/kernel: qsemimodal.o +Only in qte-2.3.7/src/kernel: qsharedmemory.o +Only in qte-2.3.7/src/kernel: qsignal.o +Only in qte-2.3.7/src/kernel: qsignalmapper.o +Only in qte-2.3.7/src/kernel: qsimplerichtext.o +Only in qte-2.3.7/src/kernel: qsize.o +Only in qte-2.3.7/src/kernel: qsizegrip.o +Only in qte-2.3.7/src/kernel: qsocketnotifier.o +Only in qte-2.3.7/src/kernel: qsound.o +Only in qte-2.3.7/src/kernel: qsound_qws.o +Only in qte-2.3.7/src/kernel: qsoundqss_qws.moc +Only in qte-2.3.7/src/kernel: qsoundqss_qws.o +Only in qte-2.3.7/src/kernel: qstyle.o +Only in qte-2.3.7/src/kernel: qstylesheet.o +Only in qte-2.3.7/src/kernel: qthread_unix.moc +Only in qte-2.3.7/src/kernel: qthread_unix.o +Only in qte-2.3.7/src/kernel: qtimer.o +Only in qte-2.3.7/src/kernel: qtranslator.o +Only in qte-2.3.7/src/kernel: qurl.o +Only in qte-2.3.7/src/kernel: qurlinfo.o +Only in qte-2.3.7/src/kernel: qurloperator.o +Only in qte-2.3.7/src/kernel: qvariant.o +Only in qte-2.3.7/src/kernel: qwidget.o +Only in qte-2.3.7/src/kernel: qwidget_qws.o +diff -ru qte-2.3.7_orig/src/kernel/qwindowsystem_qws.cpp qte-2.3.7/src/kernel/qwindowsystem_qws.cpp +--- qte-2.3.7_orig/src/kernel/qwindowsystem_qws.cpp Thu Jul 17 03:20:26 2003 ++++ qte-2.3.7/src/kernel/qwindowsystem_qws.cpp Mon Oct 27 14:27:25 2003 +@@ -844,6 +844,18 @@ + { + } + ++static void catchSegvSignal( int ) ++{ ++#ifndef QT_NO_QWS_KEYBOARD ++ if ( qwsServer ) ++ qwsServer->closeKeyboard(); ++#endif ++ QWSServer::closedown(); ++ fprintf(stderr, "Segmentation fault.\n"); ++ exit(1); ++} ++ ++ + /*! + \class QWSServer qwindowsystem_qws.h + \brief Server-specific functionality in Qt/Embedded +@@ -936,6 +948,7 @@ + } + + signal(SIGPIPE, ignoreSignal); //we get it when we read ++ signal(SIGSEGV, catchSegvSignal); //recover the keyboard on crash + #endif + focusw = 0; + mouseGrabber = 0; +@@ -950,7 +963,7 @@ + + #ifndef QT_NO_QWS_MULTIPROCESS + if ( !geteuid() ) { +-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) ++#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) + if( mount(0, "/var/shm", "shm", 0, 0) ) { + /* This just confuses people with 2.2 kernels + if ( errno != EBUSY ) +Only in qte-2.3.7/src/kernel: qwindowsystem_qws.cpp~ +Only in qte-2.3.7/src/kernel: qwindowsystem_qws.o +Only in qte-2.3.7/src/kernel: qwmatrix.o +Only in qte-2.3.7/src/kernel: qwsbeosdecoration_qws.o +Only in qte-2.3.7/src/kernel: qwscommand_qws.o +Only in qte-2.3.7/src/kernel: qwscursor_qws.o +Only in qte-2.3.7/src/kernel: qwsdecoration_qws.o +Only in qte-2.3.7/src/kernel: qwsdefaultdecoration_qws.o +Only in qte-2.3.7/src/kernel: qwsevent_qws.o +Only in qte-2.3.7/src/kernel: qwshydrodecoration_qws.o +Only in qte-2.3.7/src/kernel: qwskde2decoration_qws.o +Only in qte-2.3.7/src/kernel: qwskdedecoration_qws.o +Only in qte-2.3.7/src/kernel: qwsmanager_qws.o +diff -ru qte-2.3.7_orig/src/kernel/qwsmouse_qws.cpp qte-2.3.7/src/kernel/qwsmouse_qws.cpp +--- qte-2.3.7_orig/src/kernel/qwsmouse_qws.cpp Thu Jul 17 03:20:26 2003 ++++ qte-2.3.7/src/kernel/qwsmouse_qws.cpp Mon Oct 27 14:27:25 2003 +@@ -336,7 +336,7 @@ + tty.c_oflag = 0; + tty.c_lflag = 0; + tty.c_cflag = f | CREAD | CLOCAL | HUPCL; +-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) ++#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) + tty.c_line = 0; + #endif + tty.c_cc[VTIME] = 0; +@@ -889,7 +889,7 @@ + tty.c_iflag = IGNBRK | IGNPAR; + tty.c_oflag = 0; + tty.c_lflag = 0; +-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) ++#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_) + tty.c_line = 0; + #endif // _OS_FREEBSD_ + tty.c_cc[VTIME] = 0; +Only in qte-2.3.7/src/kernel: qwsmouse_qws.moc +Only in qte-2.3.7/src/kernel: qwsmouse_qws.o +Only in qte-2.3.7/src/kernel: qwsproperty_qws.o +Only in qte-2.3.7/src/kernel: qwsregionmanager_qws.o +Only in qte-2.3.7/src/kernel: qwssocket_qws.o +Only in qte-2.3.7/src/kernel: qwswindowsdecoration_qws.o +Only in qte-2.3.7/src/moc: Makefile +Only in qte-2.3.7/src/moc: moc +Only in qte-2.3.7/src/moc: mocgen.o +Only in qte-2.3.7/src/moc: qbuffer.o +Only in qte-2.3.7/src/moc: qcollection.o +Only in qte-2.3.7/src/moc: qcstring.o +Only in qte-2.3.7/src/moc: qdatastream.o +Only in qte-2.3.7/src/moc: qdatetime.o +Only in qte-2.3.7/src/moc: qfile.o +Only in qte-2.3.7/src/moc: qfile_unix.o +Only in qte-2.3.7/src/moc: qgarray.o +Only in qte-2.3.7/src/moc: qgdict.o +Only in qte-2.3.7/src/moc: qglist.o +Only in qte-2.3.7/src/moc: qglobal.o +Only in qte-2.3.7/src/moc: qgvector.o +Only in qte-2.3.7/src/moc: qiodevice.o +Only in qte-2.3.7/src/moc: qregexp.o +Only in qte-2.3.7/src/moc: qstring.o +Only in qte-2.3.7/src/moc: qtextcodec.o +Only in qte-2.3.7/src/moc: qtextstream.o +Only in qte-2.3.7/src/moc: qutfcodec.o +Only in qte-2.3.7/src/network: qdns.o +Only in qte-2.3.7/src/network: qftp.o +Only in qte-2.3.7/src/network: qhostaddress.o +Only in qte-2.3.7/src/network: qnetwork.o +Only in qte-2.3.7/src/network: qserversocket.o +Only in qte-2.3.7/src/network: qsocket.o +Only in qte-2.3.7/src/network: qsocketdevice.o +Only in qte-2.3.7/src/network: qsocketdevice_unix.o +Only in qte-2.3.7/src/table: qtable.o +Only in qte-2.3.7/src/tools: qbitarray.o +Only in qte-2.3.7/src/tools: qbuffer.o +Only in qte-2.3.7/src/tools: qcollection.o +Only in qte-2.3.7/src/tools: qconfig-qpe.h +Only in qte-2.3.7/src/tools: qconfig-qpe.h~ +diff -ru qte-2.3.7_orig/src/tools/qconfig.h qte-2.3.7/src/tools/qconfig.h +--- qte-2.3.7_orig/src/tools/qconfig.h Fri Jan 26 14:43:06 2001 ++++ qte-2.3.7/src/tools/qconfig.h Wed Oct 29 22:13:16 2003 +@@ -1,3 +1,26 @@ ++// Copied from qconfig-qpe.h ++/********************************************************************** ++** Copyright (C) 2000 Trolltech AS. All rights reserved. ++** ++** This file is part of Qtopia Environment. ++** ++** This file may be distributed and/or modified under the terms of the ++** GNU General Public License version 2 as published by the Free Software ++** Foundation and appearing in the file LICENSE.GPL included in the ++** packaging of this file. ++** ++** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ++** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ++** ++** See http://www.trolltech.com/gpl/ for GPL licensing information. ++** ++** Contact info@trolltech.com if any conditions of this licensing are ++** not clear to you. ++** ++**********************************************************************/ ++#ifndef QT_H ++#endif // QT_H ++ + // Empty leaves all features enabled. See doc/html/features.html for choices. + + // Note that disabling some features will produce a libqt that is not +@@ -8,3 +31,69 @@ + #ifndef QT_DLL + #define QT_DLL // Internal + #endif ++ ++#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_SL5XXX) ++# define QT_NO_QWS_CURSOR ++# define QT_NO_QWS_MOUSE_AUTO ++#endif ++#ifndef QT_NO_CODECS ++#define QT_NO_CODECS ++#endif ++#define QT_NO_UNICODETABLES ++//#define QT_NO_IMAGEIO_BMP ++#define QT_NO_IMAGEIO_PPM ++//#define QT_NO_ASYNC_IO ++//#define QT_NO_ASYNC_IMAGE_IO ++#define QT_NO_FREETYPE ++#define QT_NO_BDF ++//#define QT_NO_FONTDATABASE ++#define QT_NO_DRAGANDDROP ++//#define QT_NO_CLIPBOARD ++#define QT_NO_PROPERTIES ++#define QT_NO_NETWORKPROTOCOL ++ ++#define QT_NO_IMAGE_TEXT ++ ++//#define QT_NO_TOOLTIP ++#define QT_NO_COLORNAMES ++#define QT_NO_TRANSFORMATIONS ++#define QT_NO_TRANSLATION_BUILDER ++#define QT_NO_COMPLEXTEXT ++#define QT_NO_PRINTER ++#define QT_NO_PICTURE ++//#define QT_NO_ICONVIEW ++#define QT_NO_DIAL ++#define QT_NO_SIZEGRIP ++#define QT_NO_WORKSPACE ++//#define QT_NO_TABLE ++//#define QT_NO_ACTION ++//#define QT_NO_SETTINGS ++#define QT_NO_STYLE_POCKETPC ++#ifndef QT_NO_STYLE_AQUA ++# define QT_NO_STYLE_AQUA ++#endif ++#define QT_NO_STYLE_MOTIF ++#define QT_NO_STYLE_PLATINUM ++#define QT_NO_FILEDIALOG ++#define QT_NO_FONTDIALOG ++#define QT_NO_PRINTDIALOG ++#define QT_NO_COLORDIALOG ++#define QT_NO_INPUTDIALOG ++//#define QT_NO_MESSAGEBOX ++#define QT_NO_PROGRESSDIALOG ++//#define QT_NO_TABDIALOG ++#define QT_NO_WIZARD ++#define QT_NO_EFFECTS ++//#define QT_NO_COMPONENT ++#define QT_NO_DOM ++#define QT_NO_SEMIMODAL ++//#define QT_NO_PROGRESSBAR ++#define QT_NO_SPLITTER ++ ++//#define QT_NO_QWS_SAVEFONTS ++//#define QT_NO_QWS_PROPERTIES ++ ++#define QT_NO_QWS_BEOS_WM_STYLE ++#define QT_NO_QWS_KDE2_WM_STYLE ++#define QT_NO_QWS_KDE_WM_STYLE ++#define QT_NO_QWS_WINDOWS_WM_STYLE +Only in qte-2.3.7/src/tools: qconfig.h~ +Only in qte-2.3.7/src/tools: qcstring.o +Only in qte-2.3.7/src/tools: qdatastream.o +Only in qte-2.3.7/src/tools: qdatetime.o +Only in qte-2.3.7/src/tools: qdir.o +Only in qte-2.3.7/src/tools: qdir_unix.o +Only in qte-2.3.7/src/tools: qfile.o +Only in qte-2.3.7/src/tools: qfile_unix.o +Only in qte-2.3.7/src/tools: qfileinfo.o +Only in qte-2.3.7/src/tools: qfileinfo_unix.o +Only in qte-2.3.7/src/tools: qgarray.o +Only in qte-2.3.7/src/tools: qgcache.o +Only in qte-2.3.7/src/tools: qgdict.o +Only in qte-2.3.7/src/tools: qglist.o +Only in qte-2.3.7/src/tools: qglobal.o +Only in qte-2.3.7/src/tools: qgvector.o +Only in qte-2.3.7/src/tools: qiodevice.o +Only in qte-2.3.7/src/tools: qmap.o +diff -ru qte-2.3.7_orig/src/tools/qmodules.h qte-2.3.7/src/tools/qmodules.h +--- qte-2.3.7_orig/src/tools/qmodules.h Fri Aug 31 17:00:56 2001 ++++ qte-2.3.7/src/tools/qmodules.h Wed Oct 29 21:57:53 2003 +@@ -1,14 +1,12 @@ +-#ifndef QT_H +-#endif // QT_H +- ++// These modules are licensed to you + #define QT_MODULE_TOOLS + #define QT_MODULE_KERNEL + #define QT_MODULE_WIDGETS + #define QT_MODULE_DIALOGS +- + #define QT_MODULE_ICONVIEW + #define QT_MODULE_WORKSPACE +-#define QT_MODULE_TABLE ++#define QT_MODULE_NETWORK + #define QT_MODULE_CANVAS ++#define QT_MODULE_TABLE + #define QT_MODULE_XML +-#define QT_MODULE_NETWORK ++#define QT_MODULE_OPENGL +Only in qte-2.3.7/src/tools: qregexp.o +Only in qte-2.3.7/src/tools: qstring.o +Only in qte-2.3.7/src/tools: qstringlist.o +Only in qte-2.3.7/src/tools: qtextcodec.o +Only in qte-2.3.7/src/tools: qtextstream.o +Only in qte-2.3.7/src/tools: qutfcodec.o +Only in qte-2.3.7/src/widgets: qaction.o +Only in qte-2.3.7/src/widgets: qbutton.o +Only in qte-2.3.7/src/widgets: qbuttongroup.o +Only in qte-2.3.7/src/widgets: qcdestyle.o +Only in qte-2.3.7/src/widgets: qcheckbox.o +Only in qte-2.3.7/src/widgets: qcombobox.o +diff -ru qte-2.3.7_orig/src/widgets/qcommonstyle.cpp qte-2.3.7/src/widgets/qcommonstyle.cpp +--- qte-2.3.7_orig/src/widgets/qcommonstyle.cpp Thu Jul 17 03:20:26 2003 ++++ qte-2.3.7/src/widgets/qcommonstyle.cpp Mon Oct 27 14:21:28 2003 +@@ -566,7 +566,7 @@ + bool enabled, bool active ) + { + #ifndef QT_NO_MENUBAR +-#ifndef QT_NO_STYLE_SGI ++#if 1 // #ifndef QT_NO_STYLE_SGI + if (draw_menu_bar_impl != 0) { + QDrawMenuBarItemImpl impl = draw_menu_bar_impl; + (this->*impl)(p, x, y, w, h, mi, g, enabled, active); +Only in qte-2.3.7/src/widgets: qcommonstyle.o +Only in qte-2.3.7/src/widgets: qcompactstyle.o +Only in qte-2.3.7/src/widgets: qdial.o +Only in qte-2.3.7/src/widgets: qeffects.moc +Only in qte-2.3.7/src/widgets: qeffects.o +Only in qte-2.3.7/src/widgets: qframe.o +Only in qte-2.3.7/src/widgets: qgrid.o +Only in qte-2.3.7/src/widgets: qgroupbox.o +Only in qte-2.3.7/src/widgets: qhbox.o +Only in qte-2.3.7/src/widgets: qhbuttongroup.o +Only in qte-2.3.7/src/widgets: qheader.o +Only in qte-2.3.7/src/widgets: qhgroupbox.o +Only in qte-2.3.7/src/widgets: qinterlacestyle.o +Only in qte-2.3.7/src/widgets: qlabel.o +Only in qte-2.3.7/src/widgets: qlcdnumber.o +Only in qte-2.3.7/src/widgets: qlineedit.o +Only in qte-2.3.7/src/widgets: qlistbox.o +diff -ru qte-2.3.7_orig/src/widgets/qlistview.cpp qte-2.3.7/src/widgets/qlistview.cpp +--- qte-2.3.7_orig/src/widgets/qlistview.cpp Thu Jul 17 03:20:26 2003 ++++ qte-2.3.7/src/widgets/qlistview.cpp Mon Oct 27 14:21:28 2003 +@@ -4968,9 +4968,9 @@ + l = l->childItem ? l->childItem : l->siblingItem; + + if ( l && l->height() ) +- s.setHeight( s.height() + 10 * l->height() ); +- else +- s.setHeight( s.height() + 140 ); ++ s.setHeight( s.height() + 4 /*10*/ * l->height() ); ++ else // ^v much too big for handhelds ++ s.setHeight( s.height() + 30 /*140*/ ); + + if ( s.width() > s.height() * 3 ) + s.setHeight( s.width() / 3 ); +Only in qte-2.3.7/src/widgets: qlistview.o +Only in qte-2.3.7/src/widgets: qmainwindow.moc +Only in qte-2.3.7/src/widgets: qmainwindow.o +Only in qte-2.3.7/src/widgets: qmenubar.o +Only in qte-2.3.7/src/widgets: qmenudata.o +Only in qte-2.3.7/src/widgets: qmotifplusstyle.o +Only in qte-2.3.7/src/widgets: qmotifstyle.o +Only in qte-2.3.7/src/widgets: qmultilineedit.o +Only in qte-2.3.7/src/widgets: qplatinumstyle.o +Only in qte-2.3.7/src/widgets: qpopupmenu.o +Only in qte-2.3.7/src/widgets: qprogressbar.o +Only in qte-2.3.7/src/widgets: qpushbutton.o +Only in qte-2.3.7/src/widgets: qradiobutton.o +Only in qte-2.3.7/src/widgets: qrangecontrol.o +Only in qte-2.3.7/src/widgets: qscrollbar.o +Only in qte-2.3.7/src/widgets: qscrollview.o +Only in qte-2.3.7/src/widgets: qsgistyle.o +Only in qte-2.3.7/src/widgets: qslider.o +Only in qte-2.3.7/src/widgets: qspinbox.o +Only in qte-2.3.7/src/widgets: qsplitter.o +Only in qte-2.3.7/src/widgets: qstatusbar.o +Only in qte-2.3.7/src/widgets: qtabbar.o +Only in qte-2.3.7/src/widgets: qtableview.o +Only in qte-2.3.7/src/widgets: qtabwidget.o +Only in qte-2.3.7/src/widgets: qtextbrowser.o +Only in qte-2.3.7/src/widgets: qtextview.o +Only in qte-2.3.7/src/widgets: qtoolbar.moc +Only in qte-2.3.7/src/widgets: qtoolbar.o +diff -ru qte-2.3.7_orig/src/widgets/qtoolbutton.cpp qte-2.3.7/src/widgets/qtoolbutton.cpp +--- qte-2.3.7_orig/src/widgets/qtoolbutton.cpp Thu Jul 17 03:20:27 2003 ++++ qte-2.3.7/src/widgets/qtoolbutton.cpp Mon Oct 27 14:21:28 2003 +@@ -230,7 +230,7 @@ + else + QToolTip::add( this, textLabel ); + } +-#endif ++#endif + } + + +@@ -324,12 +324,12 @@ + QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Large, QIconSet::Normal); + w = pm.width(); + h = pm.height(); +- if ( w < 32 ) +- w = 32; +- if ( h < 32 ) +- h = 32; ++ if ( w < 24 ) ++ w = 24; ++ if ( h < 24 ) ++ h = 24; + } else { +- w = h = 16; ++ w = h = 14; + QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Small, QIconSet::Normal); + w = pm.width(); + h = pm.height(); +Only in qte-2.3.7/src/widgets: qtoolbutton.o +Only in qte-2.3.7/src/widgets: qtooltip.moc +Only in qte-2.3.7/src/widgets: qtooltip.o +Only in qte-2.3.7/src/widgets: qvalidator.o +Only in qte-2.3.7/src/widgets: qvbox.o +Only in qte-2.3.7/src/widgets: qvbuttongroup.o +Only in qte-2.3.7/src/widgets: qvgroupbox.o +Only in qte-2.3.7/src/widgets: qwhatsthis.moc +Only in qte-2.3.7/src/widgets: qwhatsthis.o +Only in qte-2.3.7/src/widgets: qwidgetstack.o +Only in qte-2.3.7/src/widgets: qwindowsstyle.o +Only in qte-2.3.7/src/workspace: qworkspace.moc +Only in qte-2.3.7/src/workspace: qworkspace.o +Only in qte-2.3.7/src/xml: qdom.o +Only in qte-2.3.7/src/xml: qxml.o +Only in qte-2.3.7: src-mt.mk +Only in qte-2.3.7: stamp-headers +Only in qte-2.3.7/tools: Makefile +Only in qte-2.3.7/tools/designer: Makefile +Only in qte-2.3.7/tools/designer/designer: Makefile +Only in qte-2.3.7/tools/designer/examples/walkthrough: Makefile +Only in qte-2.3.7/tools/designer/integration/rc2ui: Makefile +Only in qte-2.3.7/tools/designer/tools/createcw: Makefile +Only in qte-2.3.7/tools/designer/uic: Makefile +Only in qte-2.3.7/tools/designer/util: Makefile +Only in qte-2.3.7/tools/makeqpf: Makefile +Only in qte-2.3.7/tools/mergetr: Makefile +Only in qte-2.3.7/tools/msg2qm: Makefile +Only in qte-2.3.7/tools/qconfig: Makefile +Only in qte-2.3.7/tools/qembed: Makefile +Only in qte-2.3.7/tools/qvfb: Makefile +Only in qte-2.3.7/tutorial: Makefile +Only in qte-2.3.7/tutorial/t1: Makefile +Only in qte-2.3.7/tutorial/t10: Makefile +Only in qte-2.3.7/tutorial/t11: Makefile +Only in qte-2.3.7/tutorial/t12: Makefile +Only in qte-2.3.7/tutorial/t13: Makefile +Only in qte-2.3.7/tutorial/t14: Makefile +Only in qte-2.3.7/tutorial/t2: Makefile +Only in qte-2.3.7/tutorial/t3: Makefile +Only in qte-2.3.7/tutorial/t4: Makefile +Only in qte-2.3.7/tutorial/t5: Makefile +Only in qte-2.3.7/tutorial/t6: Makefile +Only in qte-2.3.7/tutorial/t7: Makefile +Only in qte-2.3.7/tutorial/t8: Makefile +Only in qte-2.3.7/tutorial/t9: Makefile diff --git a/rsync/config_linux.h b/rsync/config_linux.h index e5ff3e4..f488b78 100644 --- a/rsync/config_linux.h +++ b/rsync/config_linux.h @@ -1,115 +1,115 @@ /* config.h. Generated automatically by configure. */ /* config.h.in. Generated automatically from configure.in by autoheader 2.13. */ /* Define to empty if the keyword does not work. */ /* #undef const */ /* Define to `long' if <sys/types.h> doesn't define. */ /* #undef off_t */ /* Define to `unsigned' if <sys/types.h> doesn't define. */ /* #undef size_t */ /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define this if your sockaddr structure contains sin_len */ /* #undef HAVE_SOCK_SIN_LEN */ /* How many bits would you like to have in an off_t? */ #define _FILE_OFFSET_BITS 64 /* Define to include GNU C library extensions. */ #define _GNU_SOURCE 1 /* GNU extension of saving argv[0] to program_invocation_short_name */ -#define HAVE_PROGRAM_INVOCATION_NAME 1 +/* #define HAVE_PROGRAM_INVOCATION_NAME 1 */ /* Define to a replacement type if intmax_t is not a builtin, or in sys/types.h or stdlib.h or stddef.h */ /* #undef intmax_t */ /* The number of bytes in a int. */ #define SIZEOF_INT 4 /* The number of bytes in a long. */ #define SIZEOF_LONG 4 /* The number of bytes in a off_t. */ #define SIZEOF_OFF_T 8 /* The number of bytes in a short. */ #define SIZEOF_SHORT 2 /* The number of bytes in a size_t. */ #define SIZEOF_SIZE_T 4 /* The number of bytes in a unsigned char. */ #define SIZEOF_UNSIGNED_CHAR 1 /* The number of bytes in a unsigned int. */ #define SIZEOF_UNSIGNED_INT 4 /* The number of bytes in a unsigned long. */ #define SIZEOF_UNSIGNED_LONG 4 /* The number of bytes in a unsigned short. */ #define SIZEOF_UNSIGNED_SHORT 2 /* Define if you have the mtrace function. */ #define HAVE_MTRACE 1 /* Define if you have the snprintf function. */ #define HAVE_SNPRINTF 1 /* Define if you have the strerror function. */ #define HAVE_STRERROR 1 /* Define if you have the vsnprintf function. */ #define HAVE_VSNPRINTF 1 /* Define if you have the <alloca.h> header file. */ #define HAVE_ALLOCA_H 1 /* Define if you have the <bzlib.h> header file. */ #define HAVE_BZLIB_H 1 /* Define if you have the <config.h> header file. */ /* #undef HAVE_CONFIG_H */ /* Define if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 /* Define if you have the <libintl.h> header file. */ #define HAVE_LIBINTL_H 1 /* Define if you have the <mcheck.h> header file. */ #define HAVE_MCHECK_H 1 /* Define if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Define if you have the popt library (-lpopt). */ #define HAVE_LIBPOPT 1 /* Name of package */ #define PACKAGE "librsync" /* Version number of package */ #define VERSION "0.9.5" /* Number of bits in a file offset, on hosts where this is settable. */ #define _FILE_OFFSET_BITS 64 /* Define to make ftello visible on some hosts (e.g. HP-UX 10.20). */ /* #undef _LARGEFILE_SOURCE */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ /* Define to make ftello visible on some hosts (e.g. glibc 2.1.3). */ /* #undef _XOPEN_SOURCE */ diff --git a/rsync/trace.h b/rsync/trace.h index 60a6477..2bb8552 100644 --- a/rsync/trace.h +++ b/rsync/trace.h @@ -1,122 +1,112 @@ /*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- * * librsync -- generate and apply network deltas * $Id$ * * Copyright (C) 2000, 2001 by Martin Pool <mbp@samba.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * TODO: A function like perror that includes strerror output. Apache * does this by adding flags as well as the severity level which say * whether such information should be included. */ /* * trace may be turned off. * * error is always on, but you can return and continue in some way * * fatal terminates the whole process */ -void rs_fatal0(char const *s, ...); -void rs_error0(char const *s, ...); -void rs_trace0(char const *s, ...); - -void rs_log0_nofn(int level, char const *fmt, ...); - -#ifdef __GNUC__ +#if defined(HAVE_VARARG_MACROS) && defined(__GNUC__) +/* + * TODO: Don't assume this is a gcc thing; rather test in autoconf for + * support for __FUNCTION__. One simple way might just be to try compiling + * the definition of one of these functions! + * + * TODO: Also look for the C9X predefined identifier `_function', or + * whatever it's called. + */ void rs_log0(int level, char const *fn, char const *fmt, ...) __attribute__ ((format(printf, 3, 4))); #ifdef DO_RS_TRACE # define rs_trace(fmt, arg...) \ do { rs_log0(RS_LOG_DEBUG, __FUNCTION__, fmt , ##arg); \ } while (0) #else -# define rs_trace(s, str...) +# define rs_trace(fmt, arg...) #endif /* !DO_RS_TRACE */ -/* - * TODO: Don't assume this is a gcc thing; rather test in autoconf for - * support for __FUNCTION__ and varargs macros. One simple way might - * just be to try compiling the definition of one of these functions! - * - * TODO: Also look for the C9X predefined identifier `_function', or - * whatever it's called. - */ - #define rs_log(l, s, str...) do { \ rs_log0((l), __FUNCTION__, (s) , ##str); \ } while (0) #define rs_error(s, str...) do { \ rs_log0(RS_LOG_ERR, __FUNCTION__, (s) , ##str); \ } while (0) #define rs_fatal(s, str...) do { \ rs_log0(RS_LOG_CRIT, __FUNCTION__, \ (s) , ##str); \ abort(); \ } while (0) #else /************************* ! __GNUC__ */ - +# define rs_trace rs_trace0 # define rs_fatal rs_fatal0 # define rs_error rs_error0 # define rs_log rs_log0_nofn - -# ifdef DO_RS_TRACE -# define rs_trace rs_trace0 -# endif /* DO_RS_TRACE */ #endif /* ! __GNUC__ */ - +void rs_trace0(char const *s, ...); +void rs_fatal0(char const *s, ...); +void rs_error0(char const *s, ...); void rs_log0(int level, char const *fn, char const *fmt, ...); - +void rs_log0_nofn(int level, char const *fmt, ...); enum { RS_LOG_PRIMASK = 7, /**< Mask to extract priority part. \internal */ RS_LOG_NONAME = 8 /**< \b Don't show function name in message. */ }; - /** * \macro rs_trace_enabled() * * Call this before putting too much effort into generating trace * messages. */ extern int rs_trace_level; #ifdef DO_RS_TRACE # define rs_trace_enabled() ((rs_trace_level & RS_LOG_PRIMASK) >= RS_LOG_DEBUG) #else # define rs_trace_enabled() 0 #endif diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 97c7917..e438bd8 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h @@ -1,39 +1,39 @@ /* confdata.c */ P(conf_parse,void,(const char *name)); P(conf_read,int,(const char *name)); P(conf_write,int,(const char *name)); /* menu.c */ -P(rootmenu,struct menu,); +extern struct menu rootmenu; P(menu_is_visible,bool,(struct menu *menu)); P(menu_get_prompt,const char *,(struct menu *menu)); P(menu_get_root_menu,struct menu *,(struct menu *menu)); P(menu_get_parent_menu,struct menu *,(struct menu *menu)); /* symbol.c */ P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); -P(sym_change_count,int,); +extern int sym_change_count; P(sym_lookup,struct symbol *,(const char *name, int isconst)); P(sym_find,struct symbol *,(const char *name)); P(sym_type_name,const char *,(enum symbol_type type)); P(sym_calc_value,void,(struct symbol *sym)); P(sym_get_type,enum symbol_type,(struct symbol *sym)); P(sym_tristate_within_range,bool,(struct symbol *sym,tristate tri)); P(sym_set_tristate_value,bool,(struct symbol *sym,tristate tri)); P(sym_toggle_tristate_value,tristate,(struct symbol *sym)); P(sym_string_valid,bool,(struct symbol *sym, const char *newval)); P(sym_string_within_range,bool,(struct symbol *sym, const char *str)); P(sym_set_string_value,bool,(struct symbol *sym, const char *newval)); P(sym_is_changable,bool,(struct symbol *sym)); P(sym_get_choice_prop,struct property *,(struct symbol *sym)); P(sym_get_default_prop,struct property *,(struct symbol *sym)); P(sym_get_string_value,const char *,(struct symbol *sym)); P(prop_get_type_name,const char *,(enum prop_type type)); /* expr.c */ P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2)); P(expr_print,void,(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken)); |