summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-07-07 11:56:39 (UTC)
committer zautrix <zautrix>2004-07-07 11:56:39 (UTC)
commit56721aac86c9ae5253abac8962474c8d1a7e648a (patch) (side-by-side diff)
treec12f41eba0d5724ee800cdb92727ffd6d3c1cf6c
parent13d88c91f2916090bd45e23b504d0b665c68126f (diff)
downloadkdepimpi-56721aac86c9ae5253abac8962474c8d1a7e648a.zip
kdepimpi-56721aac86c9ae5253abac8962474c8d1a7e648a.tar.gz
kdepimpi-56721aac86c9ae5253abac8962474c8d1a7e648a.tar.bz2
Changes for compiling on desktop
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile263
-rw-r--r--kabc/kabc.pro4
-rw-r--r--kabc/plugins/dir/dir.pro29
-rw-r--r--kabc/plugins/dir/resourcedir.cpp6
-rw-r--r--kabc/plugins/file/file.pro30
-rw-r--r--kabc/plugins/file/resourcefile.cpp6
-rw-r--r--kaddressbook/kcmconfigs/addresseewidget.cpp1
-rw-r--r--kaddressbook/mainembedded.cpp7
-rw-r--r--kopi-desktop.pro2
-rw-r--r--kopiemail.control2
-rw-r--r--microkde/kdecore/klibloader.cpp17
-rw-r--r--microkde/kdecore/kstandarddirs.cpp3
-rw-r--r--microkde/kdeui/ktoolbar.cpp2
-rw-r--r--microkde/kresources/factory.cpp3
-rw-r--r--microkde/microkde.pro10
15 files changed, 239 insertions, 146 deletions
diff --git a/Makefile b/Makefile
index d770a05..620581b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,118 +1,147 @@
-DISTPATH = $(shell pwd)
-DISTDIR = $(shell basename $(DISTPATH))
-
-SUBDIRS = libical/src/libical libical/src/libicalss qtcompat microkde \
- libkcal libkdepim kabc kabc/converter/opie kabc/formats/binary kabc/plugins/file kabc/plugins/dir \
- kabc/plugins/opie \
- korganizer kalarmd kaddressbook kmicromail/libetpan kmicromail/libmailwrapper kmicromail
-all: tmake
- for i in $(SUBDIRS); do pushd $$i; \
- make -f Makefile$(PLATFORM) || exit 1; popd; \
- done
-
-objects:
- for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done
- for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done
- mkdir -p libical/lib/$(PLATFORM)
-
-clean:
- rm -f libical/lib/$(PLATFORM)/*;
- for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\
- rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \
- done
-install:
- cd bin/kdepim; make install
- cp db2file/db2file $(QPEDIR)/bin/db2file
- cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop
- cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kmicromail.desktop
- cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop
-
-dist:
- @echo Dont forget to do "make install" before "make dist"
- rm -f *arm.ipk
- rm -f *~
- cd ..; tar czf kdepim.src.tar.gz --exclude=obj --exclude=moc kdepim
- mkipks kmicrokdelibs.control
- mkipks korganizer.control
- mkipks kaddressbook.control
- mkipks kopiemail.control
- mkipks korganizer-alarm.control
-
-tmake: objects qtcompat/Makefile$(PLATFORM) microkde/Makefile$(PLATFORM) \
- libkcal/Makefile$(PLATFORM) \
- libkdepim/Makefile$(PLATFORM) korganizer/Makefile$(PLATFORM) \
- kalarmd/Makefile$(PLATFORM) \
- libical/src/libical/Makefile$(PLATFORM) \
- libical/src/libicalss/Makefile$(PLATFORM) \
- kabc/Makefile$(PLATFORM) \
- kabc/converter/opie/Makefile$(PLATFORM) \
- kabc/formats/binary/Makefile$(PLATFORM) \
- kabc/plugins/file/Makefile$(PLATFORM) \
- kabc/plugins/dir/Makefile$(PLATFORM) \
- kabc/plugins/ldap/Makefile$(PLATFORM) \
- kabc/plugins/opie/Makefile$(PLATFORM) \
- kaddressbook/Makefile$(PLATFORM) \
- kmicromail/Makefile$(PLATFORM) \
- kmicromail/libetpan/Makefile$(PLATFORM) \
- kmicromail/libmailwrapper/Makefile$(PLATFORM)
-
-
-
-qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro
- cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM)
-
-microkde/Makefile$(PLATFORM): microkde/microkdeE.pro
- cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM)
-
-libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro
- cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM)
-
-
-libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro
- cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" libkdepimE.pro -o Makefile$(PLATFORM)
-
-kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro
- cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" kalarmdE.pro -o Makefile$(PLATFORM)
-
-korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro
- cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" korganizerE.pro -o Makefile$(PLATFORM)
-
-libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro
- cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalE.pro -o Makefile$(PLATFORM)
-
-libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro
- cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM)
-
-kabc/Makefile$(PLATFORM): kabc/kabcE.pro
- cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM)
-
-kabc/converter/opie/Makefile$(PLATFORM): kabc/converter/opie/opieconverterE.pro
- cd kabc/converter/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieconverterE.pro -o Makefile$(PLATFORM)
-
-kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro
- cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcformat_binaryE.pro -o Makefile$(PLATFORM)
-
-kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/kabc_fileE.pro
- cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" kabc_fileE.pro -o Makefile$(PLATFORM)
-
-kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/kabc_dirE.pro
- cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" kabc_dirE.pro -o Makefile$(PLATFORM)
-
-kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/kabc_ldapE.pro
- cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" kabc_ldapE.pro -o Makefile$(PLATFORM)
-
-kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/kabc_opieE.pro
- cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" kabc_opieE.pro -o Makefile$(PLATFORM)
-
-
-kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro
- cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM)
-
-
-kmicromail/Makefile$(PLATFORM): kmicromail/kmicromailE.pro
- cd kmicromail; tmake "CONFIG+=$(RELEASE_DEBUG)" kmicromailE.pro -o Makefile$(PLATFORM)
-kmicromail/libetpan/Makefile$(PLATFORM): kmicromail/libetpan/libetpanE.pro
- cd kmicromail/libetpan; tmake "CONFIG+=$(RELEASE_DEBUG)" libetpanE.pro -o Makefile$(PLATFORM)
-kmicromail/libmailwrapper/Makefile$(PLATFORM): kmicromail/libmailwrapper/libmailwrapperE.pro
- cd kmicromail/libmailwrapper; tmake "CONFIG+=$(RELEASE_DEBUG)" libmailwrapperE.pro -o Makefile$(PLATFORM)
+#############################################################################
+# Makefile for building: kopi-desktop
+# Generated by qmake (1.07a) (Qt 3.3.2) on: Wed Jul 7 13:43:59 2004
+# Project: kopi-desktop.pro
+# Template: subdirs
+# Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro
+#############################################################################
+
+MAKEFILE = Makefile
+QMAKE = qmake
+DEL_FILE = rm -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+INSTALL_FILE=
+INSTALL_DIR =
+SUBTARGETS = \
+ sub-libical \
+ sub-libkcal \
+ sub-microkde \
+ sub-libkdepim \
+ sub-kabc \
+ sub-korganizer \
+ sub-kaddressbook \
+ sub-kabc-plugins-file \
+ sub-kabc-plugins-dir
+
+first: all
+
+all: Makefile $(SUBTARGETS)
+
+libical/$(MAKEFILE):
+ @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical"
+ cd libical && $(QMAKE) libical.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
+sub-libical: libical/$(MAKEFILE) FORCE
+ cd libical && $(MAKE) -f $(MAKEFILE)
+
+libkcal/$(MAKEFILE):
+ @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal"
+ cd libkcal && $(QMAKE) libkcal.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
+sub-libkcal: libkcal/$(MAKEFILE) FORCE
+ cd libkcal && $(MAKE) -f $(MAKEFILE)
+
+microkde/$(MAKEFILE):
+ @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde"
+ cd microkde && $(QMAKE) microkde.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
+sub-microkde: microkde/$(MAKEFILE) FORCE
+ cd microkde && $(MAKE) -f $(MAKEFILE)
+
+libkdepim/$(MAKEFILE):
+ @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim"
+ cd libkdepim && $(QMAKE) libkdepim.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
+sub-libkdepim: libkdepim/$(MAKEFILE) FORCE
+ cd libkdepim && $(MAKE) -f $(MAKEFILE)
+
+kabc/$(MAKEFILE):
+ @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc"
+ cd kabc && $(QMAKE) kabc.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
+sub-kabc: kabc/$(MAKEFILE) FORCE
+ cd kabc && $(MAKE) -f $(MAKEFILE)
+
+korganizer/$(MAKEFILE):
+ @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer"
+ cd korganizer && $(QMAKE) korganizer.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
+sub-korganizer: korganizer/$(MAKEFILE) FORCE
+ cd korganizer && $(MAKE) -f $(MAKEFILE)
+
+kaddressbook/$(MAKEFILE):
+ @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook"
+ cd kaddressbook && $(QMAKE) kaddressbook.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
+sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE
+ cd kaddressbook && $(MAKE) -f $(MAKEFILE)
+
+kabc/plugins/file/$(MAKEFILE):
+ @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file"
+ cd kabc/plugins/file && $(QMAKE) file.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
+sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE
+ cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE)
+
+kabc/plugins/dir/$(MAKEFILE):
+ @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir"
+ cd kabc/plugins/dir && $(QMAKE) dir.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
+sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE
+ cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE)
+
+Makefile: kopi-desktop.pro /usr/local/qtgcc/mkspecs/default/qmake.conf
+ $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro
+qmake: qmake_all
+ @$(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro
+
+all: $(SUBTARGETS)
+qmake_all: libical/$(MAKEFILE) libkcal/$(MAKEFILE) microkde/$(MAKEFILE) libkdepim/$(MAKEFILE) kabc/$(MAKEFILE) korganizer/$(MAKEFILE) kaddressbook/$(MAKEFILE) kabc/plugins/file/$(MAKEFILE) kabc/plugins/dir/$(MAKEFILE)
+ ( [ -d libical ] && cd libical ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
+ ( [ -d libkcal ] && cd libkcal ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
+ ( [ -d microkde ] && cd microkde ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
+ ( [ -d libkdepim ] && cd libkdepim ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
+ ( [ -d kabc ] && cd kabc ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
+ ( [ -d korganizer ] && cd korganizer ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
+ ( [ -d kaddressbook ] && cd kaddressbook ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
+ ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
+ ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
+clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE
+ ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true
+ ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true
+ ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true
+ ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true
+ ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true
+ ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true
+ ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true
+ ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true
+ ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; ) || true
+uninstall_subdirs: qmake_all FORCE
+ ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
+ ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
+ ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
+ ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
+ ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
+ ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
+ ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
+ ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
+ ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
+install_subdirs: qmake_all FORCE
+ ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true
+ ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true
+ ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true
+ ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true
+ ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true
+ ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true
+ ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true
+ ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true
+ ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) install; ) || true
+distclean: qmake_all FORCE
+ ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
+ ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
+ ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
+ ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
+ ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
+ ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
+ ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
+ ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
+ ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
+
+install: install_subdirs
+
+uninstall: uninstall_subdirs
+
+FORCE:
diff --git a/kabc/kabc.pro b/kabc/kabc.pro
index ea4bbb7..4a8d73a 100644
--- a/kabc/kabc.pro
+++ b/kabc/kabc.pro
@@ -1,214 +1,214 @@
TEMPLATE = lib
CONFIG += qt warn_on
#release debug
DESTDIR=../bin
TARGET = microkabc
include( ../variables.pri )
INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kio/kfile ../qtcompat ../microkde/kdeui
#LIBS += -lmicrokde -lldap
LIBS += -L$(QPEDIR)/lib
DEFINES += KAB_EMBEDDED DESKTOP_VERSION
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
INTERFACES = \
HEADERS = \
resource.h \
stdaddressbook.h \
agent.h \
geo.h \
key.h \
field.h \
plugin.h \
address.h \
addresseelist.h \
formatfactory.h \
formatplugin.h \
phonenumber.h \
distributionlist.h \
distributionlistdialog.h \
distributionlisteditor.h \
vcardformatplugin.h \
-formats/binaryformat.h \
formats/vcardformatplugin2.h \
picture.h \
secrecy.h \
sound.h \
addressbook.h \
timezone.h \
addressee.h \
addresseedialog.h \
vcardconverter.h \
vcard21parser.h \
vcardformatimpl.h \
plugins/file/resourcefile.h \
plugins/file/resourcefileconfig.h \
plugins/dir/resourcedir.h \
plugins/dir/resourcedirconfig.h \
vcardparser/vcardline.h \
vcardparser/vcard.h \
vcardparser/vcardtool.h \
vcardparser/vcardparser.h \
vcard/include/VCardAdrParam.h \
vcard/include/VCardAdrValue.h \
vcard/include/VCardAgentParam.h \
vcard/include/VCardContentLine.h \
vcard/include/VCardDateParam.h \
vcard/include/VCardDateValue.h \
vcard/include/VCardEmailParam.h \
vcard/include/VCardGeoValue.h \
vcard/include/VCardGroup.h \
vcard/include/VCardImageParam.h \
vcard/include/VCardImageValue.h \
vcard/include/VCardLangValue.h \
vcard/include/VCardNValue.h \
vcard/include/VCardParam.h \
vcard/include/VCardPhoneNumberValue.h \
vcard/include/VCardSourceParam.h \
vcard/include/VCardTelParam.h \
vcard/include/VCardTextParam.h \
vcard/include/VCardTextNSParam.h \
vcard/include/VCardTextValue.h \
vcard/include/VCardTextBinParam.h \
vcard/include/VCardURIValue.h \
vcard/include/VCardVCard.h \
vcard/include/VCardEntity.h \
vcard/include/VCardValue.h \
vcard/include/VCardSoundValue.h \
vcard/include/VCardAgentValue.h \
vcard/include/VCardTelValue.h \
vcard/include/VCardTextBinValue.h \
vcard/include/VCardOrgValue.h \
vcard/include/VCardUTCValue.h \
vcard/include/VCardClassValue.h \
vcard/include/VCardFloatValue.h \
vcard/include/VCardTextListValue.h \
vcard/include/generated/AdrParam-generated.h \
vcard/include/generated/AdrValue-generated.h \
vcard/include/generated/AgentParam-generated.h \
vcard/include/generated/ContentLine-generated.h \
vcard/include/generated/DateParam-generated.h \
vcard/include/generated/DateValue-generated.h \
vcard/include/generated/EmailParam-generated.h \
vcard/include/generated/GeoValue-generated.h \
vcard/include/generated/Group-generated.h \
vcard/include/generated/ImageParam-generated.h \
vcard/include/generated/ImageValue-generated.h \
vcard/include/generated/LangValue-generated.h \
vcard/include/generated/NValue-generated.h \
vcard/include/generated/Param-generated.h \
vcard/include/generated/PhoneNumberValue-generated.h \
vcard/include/generated/SourceParam-generated.h \
vcard/include/generated/TelParam-generated.h \
vcard/include/generated/TextParam-generated.h \
vcard/include/generated/TextNSParam-generated.h \
vcard/include/generated/TextValue-generated.h \
vcard/include/generated/TextBinParam-generated.h \
vcard/include/generated/URIValue-generated.h \
vcard/include/generated/VCard-generated.h \
vcard/include/generated/VCardEntity-generated.h \
vcard/include/generated/Value-generated.h \
vcard/include/generated/SoundValue-generated.h \
vcard/include/generated/AgentValue-generated.h \
vcard/include/generated/TelValue-generated.h \
vcard/include/generated/TextBinValue-generated.h \
vcard/include/generated/OrgValue-generated.h \
vcard/include/generated/UTCValue-generated.h \
vcard/include/generated/ClassValue-generated.h \
vcard/include/generated/FloatValue-generated.h \
vcard/include/generated/TextListValue-generated.h
# plugins/ldap/resourceldap.h \
# plugins/ldap/resourceldapconfig.h \
+#formats/binary/binaryformat.h \
SOURCES = \
distributionlist.cpp \
distributionlistdialog.cpp \
distributionlisteditor.cpp \
vcardformatplugin.cpp \
-formats/binaryformat.cpp \
formats/vcardformatplugin2.cpp \
formatfactory.cpp \
resource.cpp \
stdaddressbook.cpp \
plugin.cpp \
agent.cpp \
geo.cpp \
key.cpp \
field.cpp \
address.cpp \
phonenumber.cpp \
picture.cpp \
secrecy.cpp \
sound.cpp \
addressbook.cpp \
timezone.cpp \
addressee.cpp \
addresseelist.cpp \
addresseedialog.cpp \
vcardconverter.cpp \
vcard21parser.cpp \
vcardformatimpl.cpp \
plugins/file/resourcefile.cpp \
plugins/file/resourcefileconfig.cpp \
plugins/dir/resourcedir.cpp \
plugins/dir/resourcedirconfig.cpp \
vcardparser/vcardline.cpp \
vcardparser/vcard.cpp \
vcardparser/vcardtool.cpp \
vcardparser/vcardparser.cpp \
vcard/AdrParam.cpp \
vcard/AdrValue.cpp \
vcard/AgentParam.cpp \
vcard/ContentLine.cpp \
vcard/DateParam.cpp \
vcard/DateValue.cpp \
vcard/EmailParam.cpp \
vcard/Entity.cpp \
vcard/Enum.cpp \
vcard/GeoValue.cpp \
vcard/ImageParam.cpp \
vcard/ImageValue.cpp \
vcard/LangValue.cpp \
vcard/NValue.cpp \
vcard/Param.cpp \
vcard/PhoneNumberValue.cpp \
vcard/RToken.cpp \
vcard/SourceParam.cpp \
vcard/TelParam.cpp \
vcard/TextParam.cpp \
vcard/TextValue.cpp \
vcard/TextBinParam.cpp \
vcard/URIValue.cpp \
vcard/VCardv.cpp \
vcard/VCardEntity.cpp \
vcard/Value.cpp \
vcard/SoundValue.cpp \
vcard/AgentValue.cpp \
vcard/TelValue.cpp \
vcard/TextBinValue.cpp \
vcard/OrgValue.cpp \
vcard/UTCValue.cpp \
vcard/ClassValue.cpp \
vcard/FloatValue.cpp \
vcard/TextListValue.cpp
# plugins/ldap/resourceldap.cpp \
# plugins/ldap/resourceldapconfig.cpp \
+#formats/binary/binaryformat.cpp \
diff --git a/kabc/plugins/dir/dir.pro b/kabc/plugins/dir/dir.pro
new file mode 100644
index 0000000..3db201f
--- a/dev/null
+++ b/kabc/plugins/dir/dir.pro
@@ -0,0 +1,29 @@
+TEMPLATE = lib
+CONFIG += qt warn_on release
+#release debug
+
+TARGET = microkabc_dir
+INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat
+DESTDIR = ../../../bin
+#LIBS += -lmicrokde -lmicrokabc
+#LIBS += -L$(QPEDIR)/lib
+
+INTERFACES = \
+
+HEADERS = \
+ resourcedir.h \
+ resourcedirconfig.h
+
+SOURCES = \
+ resourcedir.cpp \
+ resourcedirconfig.cpp
+
+unix : {
+OBJECTS_DIR = obj/unix
+MOC_DIR = moc/unix
+}
+win32: {
+DEFINES += _WIN32_
+OBJECTS_DIR = obj/win
+MOC_DIR = moc/win
+} \ No newline at end of file
diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp
index be19821..6ea2f4b 100644
--- a/kabc/plugins/dir/resourcedir.cpp
+++ b/kabc/plugins/dir/resourcedir.cpp
@@ -71,288 +71,290 @@ extern "C"
}
ResourceDir::ResourceDir( const KConfig *config )
: Resource( config )
{
QString path;
KConfig *cfg = (KConfig *)config;
if ( cfg ) {
//US path = config->readEntry( "FilePath" );
path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() );
//US mFormatName = config->readEntry( "FileFormat" );
mFormatName = cfg->readEntry( "FileFormat", "vcard" );
} else {
path = StdAddressBook::directoryName();
mFormatName = "vcard";
}
FormatFactory *factory = FormatFactory::self();
mFormat = factory->format( mFormatName );
if ( !mFormat ) {
mFormatName = "vcard";
mFormat = factory->format( mFormatName );
}
/*US
//US qDebug("ResourceDir::ResourceDir initialized with format %s ", mFormatName.latin1());
if (mFormatName == "vcard")
mFormat = new VCardFormatPlugin2();
else if (mFormatName == "binary")
mFormat = new BinaryFormat();
else
qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1());
*/
/*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods
connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) );
connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) );
connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) );
*/
setPath( path );
}
ResourceDir::~ResourceDir()
{
delete mFormat;
mFormat = 0;
}
void ResourceDir::writeConfig( KConfig *config )
{
Resource::writeConfig( config );
config->writeEntry( "FilePath", mPath );
config->writeEntry( "FileFormat", mFormatName );
}
Ticket *ResourceDir::requestSaveTicket()
{
kdDebug(5700) << "ResourceDir::requestSaveTicket()" << endl;
if ( !addressBook() ) return 0;
if ( !lock( mPath ) ) {
kdDebug(5700) << "ResourceDir::requestSaveTicket(): Unable to lock path '"
<< mPath << "'" << endl;
return 0;
}
return createTicket( this );
}
bool ResourceDir::doOpen()
{
QDir dir( mPath );
if ( !dir.exists() ) { // no directory available
return dir.mkdir( dir.path() );
} else {
QString testName = dir.entryList( QDir::Files )[0];
if ( testName.isNull() || testName.isEmpty() ) // no file in directory
return true;
QFile file( mPath + "/" + testName );
if ( file.open( IO_ReadOnly ) )
return true;
if ( file.size() == 0 )
return true;
bool ok = mFormat->checkFormat( &file );
file.close();
return ok;
}
}
void ResourceDir::doClose()
{
}
bool ResourceDir::load()
{
kdDebug(5700) << "ResourceDir::load(): '" << mPath << "'" << endl;
QDir dir( mPath );
QStringList files = dir.entryList( QDir::Files );
QStringList::Iterator it;
bool ok = true;
for ( it = files.begin(); it != files.end(); ++it ) {
QFile file( mPath + "/" + (*it) );
if ( !file.open( IO_ReadOnly ) ) {
addressBook()->error( i18n( "Unable to open file '%1' for reading" ).arg( file.name() ) );
ok = false;
continue;
}
if ( !mFormat->loadAll( addressBook(), this, &file ) )
ok = false;
file.close();
}
return ok;
}
bool ResourceDir::save( Ticket *ticket )
{
kdDebug(5700) << "ResourceDir::save(): '" << mPath << "'" << endl;
AddressBook::Iterator it;
bool ok = true;
for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) {
if ( (*it).resource() != this || !(*it).changed() )
continue;
QFile file( mPath + "/" + (*it).uid() );
if ( !file.open( IO_WriteOnly ) ) {
addressBook()->error( i18n( "Unable to open file '%1' for writing" ).arg( file.name() ) );
continue;
}
mFormat->save( *it, &file );
// mark as unchanged
(*it).setChanged( false );
file.close();
}
delete ticket;
unlock( mPath );
return ok;
}
bool ResourceDir::lock( const QString &path )
{
kdDebug(5700) << "ResourceDir::lock()" << endl;
QString p = path;
//US change the implementation how the lockfilename is getting created
//US p.replace( QRegExp("/"), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + p + ".lock" );
KURL url(p);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
kdDebug(5700) << "-- lock name: " << lockName << endl;
if ( QFile::exists( lockName ) ) return false;
QString lockUniqueName;
lockUniqueName = p + KApplication::randomString( 8 );
url = lockUniqueName;
//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl;
// Create unique file
QFile file( mLockUniqueName );
file.open( IO_WriteOnly );
file.close();
// Create lock file
- int result = ::link( QFile::encodeName( mLockUniqueName ),
+ int result = 0;
+#ifndef _WIN32_
+ result = ::link( QFile::encodeName( mLockUniqueName ),
QFile::encodeName( lockName ) );
-
+#endif
if ( result == 0 ) {
addressBook()->emitAddressBookLocked();
return true;
}
// TODO: check stat
return false;
}
void ResourceDir::unlock( const QString &path )
{
QString p = path;
//US change the implementation how the lockfilename is getting created
//US p.replace( QRegExp( "/" ), "_" );
//US QString lockName = locate( "data", "kabc/lock/" + p + ".lock" );
KURL url(p);
QString lockName = locate( "data", "kabc/lock/" + url.fileName() + ".lock" );
::unlink( QFile::encodeName( lockName ) );
QFile::remove( mLockUniqueName );
addressBook()->emitAddressBookUnlocked();
}
void ResourceDir::setPath( const QString &path )
{
/*US ToDo: no synchronization so far. Has to be changed in the future
mDirWatch.stopScan();
mDirWatch.removeDir( mPath );
*/
mPath = path;
/*US ToDo: no synchronization so far. Has to be changed in the future
mDirWatch.addDir( mPath, true );
mDirWatch.startScan();
*/
//US simulate KDirWatch event
pathChanged();
}
QString ResourceDir::path() const
{
return mPath;
}
void ResourceDir::setFormat( const QString &format )
{
mFormatName = format;
if ( mFormat )
delete mFormat;
FormatFactory *factory = FormatFactory::self();
mFormat = factory->format( mFormatName );
/*US
qDebug("ResourceDir::setFormat initialized with format %s ", format.latin1());
if (mFormatName == "vcard")
mFormat = new VCardFormatPlugin2();
else if (mFormatName == "binary")
mFormat = new BinaryFormat();
else
qDebug("ResourceDir::setFormat format unknown !!! %s ", format.latin1());
*/
}
QString ResourceDir::format() const
{
return mFormatName;
}
void ResourceDir::pathChanged()
{
if ( !addressBook() )
return;
load();
addressBook()->emitAddressBookChanged();
}
void ResourceDir::removeAddressee( const Addressee& addr )
{
QFile::remove( mPath + "/" + addr.uid() );
}
void ResourceDir::cleanUp()
{
unlock( mPath );
}
//US #include "resourcedir.moc"
diff --git a/kabc/plugins/file/file.pro b/kabc/plugins/file/file.pro
new file mode 100644
index 0000000..a5ade93
--- a/dev/null
+++ b/kabc/plugins/file/file.pro
@@ -0,0 +1,30 @@
+TEMPLATE = lib
+CONFIG += qt warn_on release
+#release debug
+
+TARGET = microkabc_file
+INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat
+
+DESTDIR = ../../../bin
+#LIBS += -lmicrokde -lmicrokabc
+#LIBS += -L$(QPEDIR)/lib
+
+INTERFACES = \
+
+HEADERS = \
+ resourcefile.h \
+ resourcefileconfig.h
+
+SOURCES = \
+ resourcefile.cpp \
+ resourcefileconfig.cpp
+
+unix : {
+OBJECTS_DIR = obj/unix
+MOC_DIR = moc/unix
+}
+win32: {
+DEFINES += _WIN32_
+OBJECTS_DIR = obj/win
+MOC_DIR = moc/win
+} \ No newline at end of file
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index 3920f69..4b4c935 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -97,293 +97,295 @@ ResourceFile::ResourceFile( const QString &fileName,
void ResourceFile::init( const QString &fileName, const QString &formatName )
{
mFormatName = formatName;
FormatFactory *factory = FormatFactory::self();
mFormat = factory->format( mFormatName );
if ( !mFormat ) {
mFormatName = "vcard";
mFormat = factory->format( mFormatName );
}
/*US
//US qDebug("ResourceFile::init initialized with format %s ", formatName.latin1());
if (mFormatName == "vcard") {
mFormat = new VCardFormatPlugin2();
// qDebug("ResourceFile::init format VCardFormatPlugin2");
}
else if (mFormatName == "binary") {
mFormat = new BinaryFormat();
// qDebug("ResourceFile::init format BinaryFormat");
}
else
qDebug("ResourceFile::init format unknown !!! %s ", formatName.latin1());
*/
/*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods
connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
*/
setFileName( fileName );
}
ResourceFile::~ResourceFile()
{
delete mFormat;
mFormat = 0;
}
void ResourceFile::writeConfig( KConfig *config )
{
Resource::writeConfig( config );
config->writeEntry( "FileName", mFileName );
config->writeEntry( "FileFormat", mFormatName );
// qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1());
}
Ticket *ResourceFile::requestSaveTicket()
{
kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl;
if ( !addressBook() ) return 0;
if ( !lock( mFileName ) ) {
kdDebug(5700) << "ResourceFile::requestSaveTicket(): Unable to lock file '"
<< mFileName << "'" << endl;
return 0;
}
return createTicket( this );
}
bool ResourceFile::doOpen()
{
QFile file( mFileName );
if ( !file.exists() ) {
// try to create the file
bool ok = file.open( IO_WriteOnly );
if ( ok )
file.close();
return ok;
} else {
if ( !file.open( IO_ReadWrite ) )
return false;
if ( file.size() == 0 ) {
file.close();
return true;
}
bool ok = mFormat->checkFormat( &file );
file.close();
return ok;
}
}
void ResourceFile::doClose()
{
}
bool ResourceFile::load()
{
QFile file( mFileName );
if ( !file.open( IO_ReadOnly ) ) {
addressBook()->error( i18n( "Unable to open file '%1'." ).arg( mFileName ) );
return false;
}
// qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1());
return mFormat->loadAll( addressBook(), this, &file );
}
bool ResourceFile::save( Ticket *ticket )
{
// qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1());
// create backup file
QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() );
/*US we use a simpler method to create a backupfile
(void) KSaveFile::backupFile( mFileName, QString::null
,extension );
KSaveFile saveFile( mFileName );
bool ok = false;
if ( saveFile.status() == 0 && saveFile.file() )
{
mFormat->saveAll( addressBook(), this, saveFile.file() );
ok = saveFile.close();
}
*/
//US ToDo: write backupfile
QFile info;
info.setName( mFileName );
bool ok = info.open( IO_WriteOnly );
if ( ok ) {
mFormat->saveAll( addressBook(), this, &info );
info.close();
ok = true;
}
else {
}
if ( !ok )
addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) );
delete ticket;
unlock( mFileName );
return ok;
qDebug("ResourceFile::save has to be changed");
return true;
}
bool ResourceFile::lock( const QString &fileName )
{
QString fn = fileName;
//US change the implementation how the lockfilename is getting created
//US fn.replace( QRegExp("/"), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
if (QFile::exists( lockName )) return false;
QString lockUniqueName;
lockUniqueName = fn + KApplication::randomString( 8 );
url = lockUniqueName;
//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl;
// Create unique file
QFile file( mLockUniqueName );
file.open( IO_WriteOnly );
file.close();
// Create lock file
- int result = ::link( QFile::encodeName( mLockUniqueName ),
+ int result = 0;
+#ifndef _WIN32_
+ result = ::link( QFile::encodeName( mLockUniqueName ),
QFile::encodeName( lockName ) );
-
+#endif
if ( result == 0 ) {
addressBook()->emitAddressBookLocked();
return true;
}
// TODO: check stat
return false;
}
void ResourceFile::unlock( const QString &fileName )
{
QString fn = fileName;
//US change the implementation how the lockfilename is getting created
//US fn.replace( QRegExp( "/" ), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
//US QString lockName = fn + ".lock";
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
QFile::remove( lockName );
QFile::remove( mLockUniqueName );
addressBook()->emitAddressBookUnlocked();
}
void ResourceFile::setFileName( const QString &fileName )
{
/*US ToDo: no synchronization so far. Has to be changed in the future
mDirWatch.stopScan();
mDirWatch.removeFile( mFileName );
*/
mFileName = fileName;
/*US ToDo: no synchronization so far. Has to be changed in the future
mDirWatch.addFile( mFileName );
mDirWatch.startScan();
*/
//US simulate KDirWatch event
fileChanged();
}
QString ResourceFile::fileName() const
{
return mFileName;
}
void ResourceFile::setFormat( const QString &format )
{
mFormatName = format;
delete mFormat;
FormatFactory *factory = FormatFactory::self();
mFormat = factory->format( mFormatName );
/*US
//qDebug("ResourceFile::setFormat initialized with format %s ", format.latin1());
if (mFormatName == "vcard") {
mFormat = new VCardFormatPlugin2();
// qDebug("ResourceFile::setFormat format %s", mFormatName.latin1());
}
else if (mFormatName == "binary") {
mFormat = new BinaryFormat();
// qDebug("ResourceFile::setFormat format %s", mFormatName.latin1());
}
else
qDebug("ResourceFile::setFormat format unknown !!! %s ", format.latin1());
*/
}
QString ResourceFile::format() const
{
return mFormatName;
}
void ResourceFile::fileChanged()
{
// There is a small theoretical chance that KDirWatch calls us before
// we are fully constructed
if (!addressBook())
return;
load();
addressBook()->emitAddressBookChanged();
}
void ResourceFile::removeAddressee( const Addressee &addr )
{
QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) );
QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/logos/" ) + addr.uid() ) );
QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/sounds/" ) + addr.uid() ) );
}
void ResourceFile::cleanUp()
{
unlock( mFileName );
}
//US #include "resourcefile.moc"
diff --git a/kaddressbook/kcmconfigs/addresseewidget.cpp b/kaddressbook/kcmconfigs/addresseewidget.cpp
index f84b2ba..eb5bdd9 100644
--- a/kaddressbook/kcmconfigs/addresseewidget.cpp
+++ b/kaddressbook/kcmconfigs/addresseewidget.cpp
@@ -1,220 +1,221 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.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.
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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlistbox.h>
#include <qpushbutton.h>
+#include <qapplication.h>
#include <kbuttonbox.h>
#include <kcombobox.h>
#include <kconfig.h>
#include <kdialog.h>
#include <klocale.h>
#include <kglobal.h>
#include <klineedit.h>
#include <kstandarddirs.h>
#include "addresseewidget.h"
NamePartWidget::NamePartWidget( const QString &title, QWidget *parent,
const char *name )
: QWidget( parent, name )
{
if (KGlobal::getOrientation() == KGlobal::Portrait)
{
QGridLayout* layout = new QGridLayout( this, 1, 1, KDialog::marginHintSmall(),
KDialog::spacingHintSmall() );
QLabel *label = new QLabel( i18n( title ), this );
layout->addWidget( label, 0, 1 );
mBox = new QListBox( this );
mBox->setMaximumSize(70, 70);
layout->addMultiCellWidget( mBox, 0, 1, 0, 0 );
KButtonBox *bbox = new KButtonBox( this, Qt::Vertical );
mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) );
mRemoveButton = bbox->addButton( i18n( "Rem" ), this, SLOT( remove() ) );
bbox->layout();
layout->addMultiCellWidget( bbox, 0, 1, 2,2);
mEdit = new KLineEdit( this );
layout->addWidget( mEdit, 1, 1 );
//mEdit->setMinimumWidth(50);
// layout->addWidget( group );
}
else
{
QHBoxLayout *layout = new QHBoxLayout( this );
QGroupBox *group = new QGroupBox( 0, Qt::Vertical, title, this );
QGridLayout *groupLayout = new QGridLayout( group->layout(), 2, 2,
KDialog::spacingHint() );
mBox = new QListBox( group );
groupLayout->addWidget( mBox, 0, 0 );
KButtonBox *bbox = new KButtonBox( group, Qt::Vertical );
mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) );
mRemoveButton = bbox->addButton( i18n( "Remove" ), this, SLOT( remove() ) );
bbox->layout();
groupLayout->addWidget( bbox, 0, 1 );
mEdit = new KLineEdit( group );
groupLayout->addMultiCellWidget( mEdit, 1, 1, 0, 1 );
layout->addWidget( group );
}
mAddButton->setEnabled( false );
mRemoveButton->setEnabled( false );
connect( mBox, SIGNAL( selectionChanged( QListBoxItem* ) ),
SLOT( selectionChanged( QListBoxItem* ) ) );
connect( mEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
connect( mEdit, SIGNAL( returnPressed() ), SLOT( add() ) );
}
NamePartWidget::~NamePartWidget()
{
}
void NamePartWidget::setNameParts( const QStringList &list )
{
mBox->clear();
mBox->insertStringList( list );
}
QStringList NamePartWidget::nameParts() const
{
QStringList parts;
for ( uint i = 0; i < mBox->count(); ++i )
parts.append( mBox->text( i ) );
return parts;
}
void NamePartWidget::add()
{
if ( !mEdit->text().isEmpty() ) {
mBox->insertItem( mEdit->text() );
emit modified();
}
mEdit->setText( "" );
}
void NamePartWidget::remove()
{
mBox->removeItem( mBox->currentItem() );
if ( mBox->count() == 0 )
selectionChanged( 0 );
emit modified();
}
void NamePartWidget::selectionChanged( QListBoxItem *item )
{
mRemoveButton->setEnabled( item != 0 );
}
void NamePartWidget::textChanged( const QString& text )
{
mAddButton->setEnabled( !text.isEmpty() );
}
AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
QGridLayout *layout;
mPrefix = new NamePartWidget( i18n( "Prefixes" ), this );
mInclusion = new NamePartWidget( i18n( "Inclusions" ), this );
mSuffix = new NamePartWidget( i18n( "Suffixes" ), this );
QString dfn;
if (QApplication::desktop()->width() > 320 )
dfn = i18n( "Default formatted name:" );
else
dfn = i18n( "Def. formatted name:" );
QLabel *label = new QLabel( dfn, this );
mFormattedNameCombo = new KComboBox( this );
mFormattedNameCombo->insertItem( i18n( "Empty" ) );
mFormattedNameCombo->insertItem( i18n( "Simple Name" ) );
mFormattedNameCombo->insertItem( i18n( "Full Name" ) );
mFormattedNameCombo->insertItem( i18n( "Reverse Name" ) );
if (KGlobal::getOrientation() == KGlobal::Portrait)
{
layout = new QGridLayout( this, 4, 2, KDialog::marginHintSmall(),
KDialog::spacingHintSmall() );
layout->addMultiCellWidget( mPrefix, 0, 0, 0, 1 );
layout->addMultiCellWidget( mInclusion, 1, 1, 0, 1 );
layout->addMultiCellWidget( mSuffix, 2, 2, 0, 1 );
layout->addWidget( label, 3, 0 );
layout->addWidget( mFormattedNameCombo, 3, 1 );
}
else
{
layout = new QGridLayout( this, 2, 3, KDialog::marginHint(),
KDialog::spacingHint() );
layout->addWidget( mPrefix, 0, 0 );
layout->addWidget( mInclusion, 0, 1 );
layout->addWidget( mSuffix, 0, 2 );
layout->addWidget( label, 1, 0 );
layout->addMultiCellWidget( mFormattedNameCombo, 1, 1, 1, 2 );
}
connect( mPrefix, SIGNAL( modified() ), SIGNAL( modified() ) );
connect( mInclusion, SIGNAL( modified() ), SIGNAL( modified() ) );
connect( mSuffix, SIGNAL( modified() ), SIGNAL( modified() ) );
connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SIGNAL( modified() ) );
}
AddresseeWidget::~AddresseeWidget()
{
}
void AddresseeWidget::restoreSettings()
{
KConfig config( locateLocal("config", "kabcrc") );
config.setGroup( "General" );
mPrefix->setNameParts( config.readListEntry( "Prefixes" ) );
mInclusion->setNameParts( config.readListEntry( "Inclusions" ) );
mSuffix->setNameParts( config.readListEntry( "Suffixes" ) );
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index dce6a88..cf1fd3e 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,189 +1,190 @@
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#include <stdlib.h>
#else
#include <qapplication.h>
#include <qwindowsstyle.h>
#include <qplatinumstyle.h>
#include <qmainwindow.h>
#endif
#include <kstandarddirs.h>
#include <kglobal.h>
#include <stdio.h>
#include <qdir.h>
#include "kaddressbookmain.h"
int main( int argc, char **argv )
{
#ifndef DESKTOP_VERSION
QPEApplication a( argc, argv );
a.setKeepRunning ();
#else
QApplication a( argc, argv );
QApplication::setStyle( new QPlatinumStyle ());
#endif
bool exitHelp = false;
if ( argc > 1 ) {
QString command = argv[1];
if ( command == "-help" ){
printf("KA/E command line commands:\n");
printf(" no command: Start KA/E in usual way\n");
printf(" -help: This output\n");
printf(" KA/E is exiting now. Bye!\n");
exitHelp = true;
}
}
if ( ! exitHelp ) {
KGlobal::setAppName( "kaddressbook" );
#ifndef DESKTOP_VERSION
if ( QApplication::desktop()->width() > 320 )
KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
else
KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
#else
QString fileName ;
- fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/";
+ fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
+ QApplication::addLibraryPath ( qApp->applicationDirPath () );
#endif
KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
KAddressBookMain m ;
//US MainWindow m;
//US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
#ifndef DESKTOP_VERSION
a.showMainWidget( &m );
#else
- a.setMainWidget(m );
- m->show();
+ a.setMainWidget( &m );
+ m.show();
#endif
a.exec();
}
qDebug("KA: Bye! ");
}
/*
#include <stdlib.h>
#include <qstring.h>
#include <kabc/stdaddressbook.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <kcrash.h>
#include <kdebug.h>
#include <klocale.h>
#include <kstartupinfo.h>
#include <kuniqueapplication.h>
#include <kwin.h>
#include "kaddressbookmain.h"
#include "kabcore.h"
extern "C" {
void crashHandler( int )
{
KABC::StdAddressBook::handleCrash();
::exit( 0 );
}
}
class KAddressBookApp : public KUniqueApplication {
public:
KAddressBookApp() : mMainWin( 0 ) {}
~KAddressBookApp() {}
int newInstance();
private:
KAddressBookMain *mMainWin;
};
int KAddressBookApp::newInstance()
{
if ( isRestored() ) {
// There can only be one main window
if ( KMainWindow::canBeRestored( 1 ) ) {
mMainWin = new KAddressBookMain;
mMainWin->show();
mMainWin->restore( 1 );
}
} else {
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
QCString addrStr = args->getOption( "addr" );
QCString uidStr = args->getOption( "uid" );
QString addr;
QString uid;
if ( !addrStr.isEmpty() )
addr = QString::fromLocal8Bit( addrStr );
if ( !uidStr.isEmpty() )
uid = QString::fromLocal8Bit( uidStr );
if ( args->isSet( "editor-only" ) ) {
if ( !mMainWin )
mMainWin = new KAddressBookMain;
KStartupInfo::appStarted();
mMainWin->hide();
} else {
if ( mMainWin ) {
mMainWin->show();
KWin::setActiveWindow( mMainWin->winId() );
} else {
mMainWin = new KAddressBookMain;
mMainWin->show();
}
}
// Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do
if ( !addr.isEmpty() )
mMainWin->addEmail( addr );
if ( !uid.isEmpty() )
mMainWin->showContactEditor( uid );
if ( args->isSet( "new-contact" ) ) {
mMainWin->newContact();
}
}
KCrash::setEmergencySaveFunction( crashHandler );
return 0;
}
// the dummy argument is required, because KMail apparently sends an empty
// argument.
static KCmdLineOptions kmoptions[] =
{
{ "a", 0 , 0 },
{ "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 },
{ "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 },
{ "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 },
{ "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 },
{ "+[argument]", I18N_NOOP( "dummy argument" ), 0},
{ 0, 0, 0}
};
int main( int argc, char *argv[] )
{
KLocale::setMainCatalogue( "kaddressbook" );
KCmdLineArgs::init( argc, argv, KABCore::createAboutData() );
KCmdLineArgs::addCmdLineOptions( kmoptions );
KUniqueApplication::addCmdLineOptions();
if ( !KAddressBookApp::start() )
exit( 0 );
KAddressBookApp app;
KGlobal::locale()->insertCatalogue( "libkdepim" );
return app.exec();
}
*/
diff --git a/kopi-desktop.pro b/kopi-desktop.pro
index 1a5fabd..b255756 100644
--- a/kopi-desktop.pro
+++ b/kopi-desktop.pro
@@ -1,6 +1,6 @@
TEMPLATE = subdirs
-SUBDIRS = libical libkcal microkde libkdepim kabc korganizer kaddressbook
+SUBDIRS = libical libkcal microkde libkdepim kabc korganizer kaddressbook kabc/plugins/file kabc/plugins/dir
#kalarmd
diff --git a/kopiemail.control b/kopiemail.control
index 3d563f0..7a93a1b 100644
--- a/kopiemail.control
+++ b/kopiemail.control
@@ -1,14 +1,14 @@
Files: bin/ompi apps/Pim/kmicromail.desktop pics/kdepim/kmicromail/* lib/libssl* lib/libcrypto.* lib/libkmicro*
Priority: optional
Section: qpe/pim
Maintainer: Lutz Rogowski <lutz@pi-sync.net>
Architecture: arm
-Version: 1.9.2a
+Version: 1.9.2b
License: GPL
Depends: lib/libmicrokde.so
Description: KOrganizer/Pi and Kaddressbook/Pi
The embedded version of KOrganizer/Platform-independend,
the KDE calendar and scheduling program
optimized for 640x480 and 320x240 resolution
on Zaurus PDA
diff --git a/microkde/kdecore/klibloader.cpp b/microkde/kdecore/klibloader.cpp
index c07d50f..c091e05 100644
--- a/microkde/kdecore/klibloader.cpp
+++ b/microkde/kdecore/klibloader.cpp
@@ -1,647 +1,648 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Torben Weis <weis@kde.org>
Copyright (C) 2000 Michael Matz <matz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
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.
*/
//US #include <config.h>
#include <qclipboard.h>
#include <qfile.h>
#include <qtimer.h>
#include <qobjectdict.h>
#include <qwidgetlist.h>
#include <qwidget.h>
#include "kapplication.h"
#include "klibloader.h"
#include "kstandarddirs.h"
#include "kdebug.h"
#include "klocale.h"
/*US
#ifndef NDEBUG
#include "ltdl.h"
#endif
*/
//US do everything through qlibrary
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#include <qtopia/qlibrary.h>
+#else
+#include <qlibrary.h>
#endif
-/*US
-#ifdef Q_WS_X11
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#endif
-*/
+
template class QAsciiDict<KLibrary>;
#include <stdlib.h> //getenv
/*US
#if HAVE_DLFCN_H
# include <dlfcn.h>
#endif
#ifdef RTLD_GLOBAL
# define LT_GLOBAL RTLD_GLOBAL
#else
# ifdef DL_GLOBAL
# define LT_GLOBAL DL_GLOBAL
# endif
#endif
#ifndef LT_GLOBAL
# define LT_GLOBAL 0
#endif
*/
/*US
extern "C" {
extern int lt_dlopen_flag;
}
*/
KLibFactory::KLibFactory( QObject* parent, const char* name )
: QObject( parent, name )
{
}
KLibFactory::~KLibFactory()
{
// kdDebug(150) << "Deleting KLibFactory " << this << endl;
}
QObject* KLibFactory::create( QObject* parent, const char* name, const char* classname, const QStringList &args )
{
QObject* obj = createObject( parent, name, classname, args );
if ( obj )
emit objectCreated( obj );
return obj;
}
QObject* KLibFactory::createObject( QObject*, const char*, const char*, const QStringList &)
{
return 0;
}
// -----------------------------------------------
//US KLibrary::KLibrary( const QString& libname, const QString& filename, void * handle )
KLibrary::KLibrary( const QString& libname, const QString& filename, QLibrary* handle )
{
/* Make sure, we have a KLibLoader */
(void) KLibLoader::self();
m_libname = libname;
m_filename = filename;
m_handle = handle;
m_factory = 0;
m_timer = 0;
}
KLibrary::~KLibrary()
{
// kdDebug(150) << "Deleting KLibrary " << this << " " << m_libname << endl;
if ( m_timer && m_timer->isActive() )
m_timer->stop();
// If any object is remaining, delete
if ( m_objs.count() > 0 )
{
QPtrListIterator<QObject> it( m_objs );
for ( ; it.current() ; ++it )
{
kdDebug(150) << "Factory still has object " << it.current() << " " << it.current()->name () << " Library = " << m_libname << endl;
disconnect( it.current(), SIGNAL( destroyed() ),
this, SLOT( slotObjectDestroyed() ) );
}
m_objs.setAutoDelete(true);
m_objs.clear();
}
if ( m_factory ) {
// kdDebug(150) << " ... deleting the factory " << m_factory << endl;
delete m_factory;
}
}
QString KLibrary::name() const
{
return m_libname;
}
QString KLibrary::fileName() const
{
return m_filename;
}
KLibFactory* KLibrary::factory()
{
if ( m_factory )
return m_factory;
QCString symname;
symname.sprintf("init_%s", name().latin1() );
void* sym = symbol( symname );
if ( !sym )
{
qDebug("KLibrary: The library %s does not offer an %s function", name().latin1(), symname.data());
#ifndef NDEBUG
//US qDebug("KLibrary: errorcode: %s", lt_dlerror());
#endif
kdWarning(150) << "KLibrary: The library " << name().latin1() << " does not offer an init_" << name().latin1() << " function" << endl;
return 0;
}
typedef KLibFactory* (*t_func)();
t_func func = (t_func)sym;
m_factory = func();
if( !m_factory )
{
kdWarning(150) << "KLibrary: The library " << name() << " does not offer a KDE compatible factory" << endl;
return 0;
}
connect( m_factory, SIGNAL( objectCreated( QObject * ) ),
this, SLOT( slotObjectCreated( QObject * ) ) );
return m_factory;
}
void* KLibrary::symbol( const char* symname ) const
{
//US void* sym = lt_dlsym( (lt_dlhandle) m_handle, symname );
void* sym = m_handle->resolve( symname );
if ( !sym )
{
//US kdWarning(150) << "KLibrary: " << lt_dlerror() << endl;
- kdWarning(150) << "KLibrary: " << m_libname << ", symbol:" << symname << " not found " << endl;
return 0;
}
return sym;
}
bool KLibrary::hasSymbol( const char* symname ) const
{
//US void* sym = lt_dlsym( (lt_dlhandle) m_handle, symname );
void* sym = m_handle->resolve( symname );
return (sym != 0L );
}
void KLibrary::unload() const
{
if (KLibLoader::s_self)
KLibLoader::s_self->unloadLibrary(QFile::encodeName(name()));
}
void KLibrary::slotObjectCreated( QObject *obj )
{
if ( !obj )
return;
if ( m_timer && m_timer->isActive() )
m_timer->stop();
if ( m_objs.containsRef( obj ) )
return; // we know this object already
connect( obj, SIGNAL( destroyed() ),
this, SLOT( slotObjectDestroyed() ) );
m_objs.append( obj );
}
void KLibrary::slotObjectDestroyed()
{
m_objs.removeRef( sender() );
if ( m_objs.count() == 0 )
{
// kdDebug(150) << "KLibrary: shutdown timer for " << name() << " started!"
// << endl;
if ( !m_timer )
{
m_timer = new QTimer( this, "klibrary_shutdown_timer" );
connect( m_timer, SIGNAL( timeout() ),
this, SLOT( slotTimeout() ) );
}
// as long as it's not stable make the timeout short, for debugging
// pleasure (matz)
//m_timer->start( 1000*60, true );
m_timer->start( 1000*10, true );
}
}
void KLibrary::slotTimeout()
{
if ( m_objs.count() != 0 )
return;
/* Don't go through KLibLoader::unloadLibrary(), because that uses the
ref counter, but this timeout means to unconditionally close this library
The destroyed() signal will take care to remove us from all lists.
*/
delete this;
}
// -------------------------------------------------
/* This helper class is needed, because KLibraries can go away without
being unloaded. So we need some info about KLibraries even after its
death. */
class KLibWrapPrivate
{
public:
//US KLibWrapPrivate(KLibrary *l, lt_dlhandle h);
KLibWrapPrivate(KLibrary *l, QLibrary* h);
KLibrary *lib;
enum {UNKNOWN, UNLOAD, DONT_UNLOAD} unload_mode;
int ref_count;
//US lt_dlhandle handle;
QLibrary *handle;
QString name;
QString filename;
};
//US KLibWrapPrivate::KLibWrapPrivate(KLibrary *l, lt_dlhandle h)
KLibWrapPrivate::KLibWrapPrivate(KLibrary *l, QLibrary* h)
: lib(l), ref_count(1), handle(h), name(l->name()), filename(l->fileName())
{
unload_mode = UNKNOWN;
/*US
if (lt_dlsym(handle, "__kde_do_not_unload") != 0) {
// kdDebug(150) << "Will not unload " << name << endl;
unload_mode = DONT_UNLOAD;
} else if (lt_dlsym(handle, "__kde_do_unload") != 0) {
unload_mode = UNLOAD;
}
*/
//US use instead:
if (h->resolve("__kde_do_not_unload") != 0) {
// kdDebug(150) << "Will not unload " << name << endl;
unload_mode = DONT_UNLOAD;
} else if (h->resolve("__kde_do_unload") != 0) {
unload_mode = UNLOAD;
}
}
class KLibLoaderPrivate
{
public:
QPtrList<KLibWrapPrivate> loaded_stack;
QPtrList<KLibWrapPrivate> pending_close;
enum {UNKNOWN, UNLOAD, DONT_UNLOAD} unload_mode;
QString errorMessage;
};
KLibLoader* KLibLoader::s_self = 0;
KLibLoader* KLibLoader::self()
{
if ( !s_self )
s_self = new KLibLoader;
return s_self;
}
void KLibLoader::cleanUp()
{
if ( !s_self )
return;
delete s_self;
s_self = 0;
}
KLibLoader::KLibLoader( QObject* parent, const char* name )
: QObject( parent, name )
{
s_self = this;
d = new KLibLoaderPrivate;
//US lt_dlinit();
d->unload_mode = KLibLoaderPrivate::UNKNOWN;
if (getenv("KDE_NOUNLOAD") != 0)
d->unload_mode = KLibLoaderPrivate::DONT_UNLOAD;
else if (getenv("KDE_DOUNLOAD") != 0)
d->unload_mode = KLibLoaderPrivate::UNLOAD;
d->loaded_stack.setAutoDelete( true );
}
KLibLoader::~KLibLoader()
{
// kdDebug(150) << "Deleting KLibLoader " << this << " " << name() << endl;
QAsciiDictIterator<KLibWrapPrivate> it( m_libs );
for (; it.current(); ++it )
{
kdDebug(150) << "The KLibLoader contains the library " << it.current()->name
<< " (" << it.current()->lib << ")" << endl;
d->pending_close.append(it.current());
}
close_pending(0);
delete d;
}
//static
QString KLibLoader::findLibrary( const char * name/*US , const KInstance * instance*/ )
{
QCString libname( name );
// only append ".la" if there is no extension
// this allows to load non-libtool libraries as well
// (mhk, 20000228)
int pos = libname.findRev('/');
if (pos < 0)
pos = 0;
/*US
if (libname.find('.', pos) < 0) {
libname += ".la";
}
*/
//US in the microedition we work only with shared libraries.
if (libname.find('.', pos) < 0) {
libname += ".so";
}
// only look up the file if it is not an absolute filename
// (mhk, 20000228)
QString libfile;
if (libname[0] == '/')
libfile = libname;
else
{
//US at this point the libname must exist as real filesname. No expansions will be made later
// in findResources. Because of that we prepend the lib prefix here to the name
//US I add also the "lib" prefix. I do not how could this could have worked before without it?
libname.insert(pos, "lib");
//US libfile = instance->dirs()->findResource( "module", libname );
libfile = KGlobal::dirs()->findResource( "module", libname );
if ( libfile.isEmpty() )
{
//US libfile = instance->dirs()->findResource( "lib", libname );
libfile = KGlobal::dirs()->findResource( "lib", libname );
#ifndef NDEBUG
if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules
kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl;
#endif
}
if ( libfile.isEmpty() )
{
#ifndef NDEBUG
kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl;
self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(libname);
qDebug("KLibLoader::library could not find library: %s", libname.data());
#endif
}
else
self()->d->errorMessage = QString::null;
}
return libfile;
}
KLibrary* KLibLoader::globalLibrary( const char *name )
{
KLibrary *tmp;
/*US
int olt_dlopen_flag = lt_dlopen_flag;
lt_dlopen_flag |= LT_GLOBAL;
kdDebug(150) << "Loading the next library global with flag "
<< lt_dlopen_flag
<< "." << endl;
*/
tmp = library(name);
/*US
lt_dlopen_flag = olt_dlopen_flag;
*/
return tmp;
}
KLibrary* KLibLoader::library( const char *name )
{
if (!name)
return 0;
KLibWrapPrivate* wrap = m_libs[name];
if (wrap) {
/* Nothing to do to load the library. */
wrap->ref_count++;
return wrap->lib;
}
/* Test if this library was loaded at some time, but got
unloaded meanwhile, whithout being dlclose()'ed. */
QPtrListIterator<KLibWrapPrivate> it(d->loaded_stack);
for (; it.current(); ++it) {
if (it.current()->name == name)
wrap = it.current();
}
if (wrap) {
d->pending_close.removeRef(wrap);
if (!wrap->lib) {
/* This lib only was in loaded_stack, but not in m_libs. */
wrap->lib = new KLibrary( name, wrap->filename, wrap->handle );
}
wrap->ref_count++;
} else {
QString libfile = findLibrary( name );
if ( libfile.isEmpty() )
return 0;
-
+#ifdef DESKTOP_VERSION
+ QLibrary *qlib = new QLibrary( libfile.latin1() );
+#else
QLibrary *qlib = new QLibrary( libfile.latin1(), QLibrary::Immediately );
+#endif
//US lt_dlhandle handle = lt_dlopen( libfile.latin1() );
//US if ( !handle )
if ( !qlib )
{
//US const char* errmsg = lt_dlerror();
char* errmsg;
sprintf(errmsg, "KLibLoader::library could not load library: %s", libfile.latin1());
qDebug(errmsg);
if(errmsg)
d->errorMessage = QString::fromLatin1(errmsg);
else
d->errorMessage = QString::null;
kdWarning(150) << "library=" << name << ": file=" << libfile << ": " << d->errorMessage << endl;
return 0;
}
else
d->errorMessage = QString::null;
KLibrary *lib = new KLibrary( name, libfile, qlib );
wrap = new KLibWrapPrivate(lib, qlib);
d->loaded_stack.prepend(wrap);
}
m_libs.insert( name, wrap );
connect( wrap->lib, SIGNAL( destroyed() ),
this, SLOT( slotLibraryDestroyed() ) );
return wrap->lib;
}
QString KLibLoader::lastErrorMessage() const
{
return d->errorMessage;
}
void KLibLoader::unloadLibrary( const char *libname )
{
KLibWrapPrivate *wrap = m_libs[ libname ];
if (!wrap)
return;
if (--wrap->ref_count)
return;
// kdDebug(150) << "closing library " << libname << endl;
m_libs.remove( libname );
disconnect( wrap->lib, SIGNAL( destroyed() ),
this, SLOT( slotLibraryDestroyed() ) );
close_pending( wrap );
}
KLibFactory* KLibLoader::factory( const char* name )
{
KLibrary* lib = library( name );
if ( !lib )
return 0;
return lib->factory();
}
void KLibLoader::slotLibraryDestroyed()
{
const KLibrary *lib = static_cast<const KLibrary *>( sender() );
QAsciiDictIterator<KLibWrapPrivate> it( m_libs );
for (; it.current(); ++it )
if ( it.current()->lib == lib )
{
KLibWrapPrivate *wrap = it.current();
wrap->lib = 0; /* the KLibrary object is already away */
m_libs.remove( it.currentKey() );
close_pending( wrap );
return;
}
}
void KLibLoader::close_pending(KLibWrapPrivate *wrap)
{
if (wrap && !d->pending_close.containsRef( wrap ))
d->pending_close.append( wrap );
/* First delete all KLibrary objects in pending_close, but _don't_ unload
the DSO behind it. */
QPtrListIterator<KLibWrapPrivate> it(d->pending_close);
for (; it.current(); ++it) {
wrap = it.current();
if (wrap->lib) {
disconnect( wrap->lib, SIGNAL( destroyed() ),
this, SLOT( slotLibraryDestroyed() ) );
delete wrap->lib;
wrap->lib = 0;
}
}
if (d->unload_mode == KLibLoaderPrivate::DONT_UNLOAD) return;
bool deleted_one = false;
while ((wrap = d->loaded_stack.first())) {
/* Let's first see, if we want to try to unload this lib.
If the env. var KDE_DOUNLOAD is set, we try to unload every lib.
If not, we look at the lib itself, and unload it only, if it exports
the symbol __kde_do_unload. */
if (d->unload_mode != KLibLoaderPrivate::UNLOAD
&& wrap->unload_mode != KLibWrapPrivate::UNLOAD)
break;
/* Now ensure, that the libs are only unloaded in the reverse direction
they were loaded. */
if (!d->pending_close.containsRef( wrap )) {
if (!deleted_one)
/* Only diagnose, if we really haven't deleted anything. */
// kdDebug(150) << "try to dlclose " << wrap->name << ": not yet" << endl;
break;
}
// kdDebug(150) << "try to dlclose " << wrap->name << ": yes, done." << endl;
+#if 0
#ifndef Q_WS_QWS
if ( !deleted_one ) {
/* Only do the hack once in this loop.
WABA: *HACK*
We need to make sure to clear the clipboard before unloading a DSO
because the DSO could have defined an object derived from QMimeSource
and placed that on the clipboard. */
/*kapp->clipboard()->clear();*/
/* Well.. let's do something more subtle... convert the clipboard context
to text. That should be safe as it only uses objects defined by Qt. */
QWidgetList *widgetlist = QApplication::topLevelWidgets();
QWidget *co = widgetlist->first();
while (co) {
if (qstrcmp(co->name(), "internal clipboard owner") == 0) {
if (XGetSelectionOwner(co->x11Display(), XA_PRIMARY) == co->winId())
kapp->clipboard()->setText(kapp->clipboard()->text());
break;
}
co = widgetlist->next();
}
delete widgetlist;
}
#else
// FIXME(E): Implement in Qt Embedded
#endif
+#endif // 0
deleted_one = true;
//US lt_dlclose(wrap->handle);
wrap->handle->unload();
d->pending_close.removeRef(wrap);
/* loaded_stack is AutoDelete, so wrap is freed */
d->loaded_stack.remove();
}
}
void KLibLoader::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
void KLibFactory::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
//US #include "klibloader.moc"
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp
index 1a1e027..7f51d78 100644
--- a/microkde/kdecore/kstandarddirs.cpp
+++ b/microkde/kdecore/kstandarddirs.cpp
@@ -1,238 +1,237 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Sirtaj Singh Kang <taj@kde.org>
Copyright (C) 1999 Stephan Kulow <coolo@kde.org>
Copyright (C) 1999 Waldo Bastian <bastian@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
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.
*/
/*
* Author: Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org>
* Version: $Id$
* Generated: Thu Mar 5 16:05:28 EST 1998
*/
//US #include "config.h"
#include <stdlib.h>
#include <assert.h>
//US#include <errno.h>
//US #ifdef HAVE_SYS_STAT_H
//US #include <sys/stat.h>
//US #endif
//US#include <sys/types.h>
//US#include <dirent.h>
//US#include <pwd.h>
#include <qregexp.h>
#include <qasciidict.h>
#include <qdict.h>
#include <qdir.h>
#include <qfileinfo.h>
#include <qstring.h>
#include <qstringlist.h>
-#include <qpe/qpeapplication.h>
#include "kstandarddirs.h"
#include "kconfig.h"
#include "kdebug.h"
//US #include "kinstance.h"
#include "kshell.h"
//US#include <sys/param.h>
//US#include <unistd.h>
//US
QString KStandardDirs::mAppDir = QString::null;
template class QDict<QStringList>;
#if 0
#include <qtextedit.h>
void ddd( QString op )
{
static QTextEdit * dot = 0;
if ( ! dot )
dot = new QTextEdit();
dot->show();
dot->append( op );
}
#endif
class KStandardDirs::KStandardDirsPrivate
{
public:
KStandardDirsPrivate()
: restrictionsActive(false),
dataRestrictionActive(false)
{ }
bool restrictionsActive;
bool dataRestrictionActive;
QAsciiDict<bool> restrictions;
QStringList xdgdata_prefixes;
QStringList xdgconf_prefixes;
};
static const char* const types[] = {"html", "icon", "apps", "sound",
"data", "locale", "services", "mime",
"servicetypes", "config", "exe",
"wallpaper", "lib", "pixmap", "templates",
"module", "qtplugins",
"xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", 0 };
static int tokenize( QStringList& token, const QString& str,
const QString& delim );
KStandardDirs::KStandardDirs( ) : addedCustoms(false)
{
d = new KStandardDirsPrivate;
dircache.setAutoDelete(true);
relatives.setAutoDelete(true);
absolutes.setAutoDelete(true);
savelocations.setAutoDelete(true);
addKDEDefaults();
}
KStandardDirs::~KStandardDirs()
{
delete d;
}
bool KStandardDirs::isRestrictedResource(const char *type, const QString& relPath) const
{
if (!d || !d->restrictionsActive)
return false;
if (d->restrictions[type])
return true;
if (strcmp(type, "data")==0)
{
applyDataRestrictions(relPath);
if (d->dataRestrictionActive)
{
d->dataRestrictionActive = false;
return true;
}
}
return false;
}
void KStandardDirs::applyDataRestrictions(const QString &relPath) const
{
QString key;
int i = relPath.find('/');
if (i != -1)
key = "data_"+relPath.left(i);
else
key = "data_"+relPath;
if (d && d->restrictions[key.latin1()])
d->dataRestrictionActive = true;
}
QStringList KStandardDirs::allTypes() const
{
QStringList list;
for (int i = 0; types[i] != 0; ++i)
list.append(QString::fromLatin1(types[i]));
return list;
}
void KStandardDirs::addPrefix( const QString& _dir )
{
if (_dir.isNull())
return;
QString dir = _dir;
if (dir.at(dir.length() - 1) != '/')
dir += '/';
if (!prefixes.contains(dir)) {
prefixes.append(dir);
dircache.clear();
}
}
void KStandardDirs::addXdgConfigPrefix( const QString& _dir )
{
if (_dir.isNull())
return;
QString dir = _dir;
if (dir.at(dir.length() - 1) != '/')
dir += '/';
if (!d->xdgconf_prefixes.contains(dir)) {
d->xdgconf_prefixes.append(dir);
dircache.clear();
}
}
void KStandardDirs::addXdgDataPrefix( const QString& _dir )
{
if (_dir.isNull())
return;
QString dir = _dir;
if (dir.at(dir.length() - 1) != '/')
dir += '/';
if (!d->xdgdata_prefixes.contains(dir)) {
d->xdgdata_prefixes.append(dir);
dircache.clear();
}
}
QString KStandardDirs::kfsstnd_prefixes()
{
return prefixes.join(":");
}
bool KStandardDirs::addResourceType( const char *type,
const QString& relativename )
{
if (relativename.isNull())
return false;
QStringList *rels = relatives.find(type);
if (!rels) {
rels = new QStringList();
relatives.insert(type, rels);
}
QString copy = relativename;
if (copy.at(copy.length() - 1) != '/')
copy += '/';
if (!rels->contains(copy)) {
rels->prepend(copy);
dircache.remove(type); // clean the cache
return true;
}
return false;
}
bool KStandardDirs::addResourceDir( const char *type,
const QString& absdir)
{
QStringList *paths = absolutes.find(type);
if (!paths) {
paths = new QStringList();
absolutes.insert(type, paths);
}
@@ -1036,385 +1035,385 @@ QString KStandardDirs::saveLocation(const char *type,
if(!create) {
#ifndef NDEBUG
qDebug("save location %s doesn't exist", fullPath.latin1());
#endif
return fullPath;
}
if(!makeDir(fullPath, 0700)) {
qWarning("failed to create %s", fullPath.latin1());
return fullPath;
}
dircache.remove(type);
}
return fullPath;
}
QString KStandardDirs::relativeLocation(const char *type, const QString &absPath)
{
QString fullPath = absPath;
int i = absPath.findRev('/');
if (i != -1)
{
fullPath = realPath(absPath.left(i+1))+absPath.mid(i+1); // Normalize
}
QStringList candidates = resourceDirs(type);
for (QStringList::ConstIterator it = candidates.begin();
it != candidates.end(); it++)
if (fullPath.startsWith(*it))
{
return fullPath.mid((*it).length());
}
return absPath;
}
bool KStandardDirs::makeDir(const QString& dir2, int mode)
{
QString dir = QDir::convertSeparators( dir2 );
#if 0
//LR
// we want an absolute path
if (dir.at(0) != '/')
return false;
QString target = dir;
uint len = target.length();
// append trailing slash if missing
if (dir.at(len - 1) != '/')
target += '/';
QString base("");
uint i = 1;
while( i < len )
{
//US struct stat st;
int pos = target.find('/', i);
base += target.mid(i - 1, pos - i + 1);
QCString baseEncoded = QFile::encodeName(base);
// bail out if we encountered a problem
//US if (stat(baseEncoded, &st) != 0)
QFileInfo baseEncodedInfo(baseEncoded);
if (!baseEncodedInfo.exists())
{
// Directory does not exist....
// Or maybe a dangling symlink ?
//US if (lstat(baseEncoded, &st) == 0)
if (baseEncodedInfo.isSymLink()) {
//US (void)unlink(baseEncoded); // try removing
QFile(baseEncoded).remove();
}
//US if ( mkdir(baseEncoded, (mode_t) mode) != 0)
QDir dirObj;
if ( dirObj.mkdir(baseEncoded) != true )
{
//US perror("trying to create local folder");
return false; // Couldn't create it :-(
}
}
i = pos + 1;
}
return true;
#endif
// ********************************************
// new code for WIN32
QDir dirObj;
// we want an absolute path
#ifndef _WIN32_
if (dir.at(0) != '/')
return false;
#endif
QString target = dir;
uint len = target.length();
#ifndef _WIN32_
// append trailing slash if missing
if (dir.at(len - 1) != '/')
target += '/';
#endif
QString base("");
uint i = 1;
while( i < len )
{
//US struct stat st;
#ifndef _WIN32_
int pos = target.find('/', i);
#else
int pos = target.find('\\', i);
#endif
if ( pos < 0 )
return true;
base += target.mid(i - 1, pos - i + 1);
//QMessageBox::information( 0,"cap111", base, 1 );
/*US
QCString baseEncoded = QFile::encodeName(base);
// bail out if we encountered a problem
if (stat(baseEncoded, &st) != 0)
{
// Directory does not exist....
// Or maybe a dangling symlink ?
if (lstat(baseEncoded, &st) == 0)
(void)unlink(baseEncoded); // try removing
if ( mkdir(baseEncoded, (mode_t) mode) != 0) {
perror("trying to create local folder");
return false; // Couldn't create it :-(
}
}
*/
if (dirObj.exists(base) == false)
{
//qDebug("KStandardDirs::makeDir try to create : %s" , base.latin1());
if (dirObj.mkdir(base) != true)
{
qDebug("KStandardDirs::makeDir could not create: %s" , base.latin1());
return false;
}
}
i = pos + 1;
}
return true;
}
static QString readEnvPath(const char *env)
{
#ifdef _WIN32_
return "";
#else
QCString c_path = getenv(env);
if (c_path.isEmpty())
return QString::null;
return QFile::decodeName(c_path);
#endif
}
void KStandardDirs::addKDEDefaults()
{
//qDebug("ERROR: KStandardDirs::addKDEDefaults() called ");
//return;
QStringList kdedirList;
// begin KDEDIRS
QString kdedirs = readEnvPath("MICROKDEDIRS");
if (!kdedirs.isEmpty())
{
tokenize(kdedirList, kdedirs, ":");
}
else
{
QString kdedir = readEnvPath("MICROKDEDIR");
if (!kdedir.isEmpty())
{
kdedir = KShell::tildeExpand(kdedir);
kdedirList.append(kdedir);
}
}
//US kdedirList.append(KDEDIR);
//US for embedded, add qtopia dir as kdedir
- kdedirList.append(QPEApplication::qpeDir());
+ kdedirList.append(readEnvPath("QPEDIR" ));
#ifdef __KDE_EXECPREFIX
QString execPrefix(__KDE_EXECPREFIX);
if (execPrefix!="NONE")
kdedirList.append(execPrefix);
#endif
QString localKdeDir;
//US if (getuid())
if (true)
{
localKdeDir = readEnvPath("MICROKDEHOME");
if (!localKdeDir.isEmpty())
{
if (localKdeDir.at(localKdeDir.length()-1) != '/')
localKdeDir += '/';
}
else
{
localKdeDir = QDir::homeDirPath() + "/kdepim/";
}
}
else
{
// We treat root different to prevent root messing up the
// file permissions in the users home directory.
localKdeDir = readEnvPath("MICROKDEROOTHOME");
if (!localKdeDir.isEmpty())
{
if (localKdeDir.at(localKdeDir.length()-1) != '/')
localKdeDir += '/';
}
else
{
//US struct passwd *pw = getpwuid(0);
//US localKdeDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.microkde/";
qDebug("KStandardDirs::addKDEDefaults: 1 has to be fixed");
}
}
//US localKdeDir = appDir();
//US
// qDebug("KStandardDirs::addKDEDefaults: localKdeDir=%s", localKdeDir.latin1());
if (localKdeDir != "-/")
{
localKdeDir = KShell::tildeExpand(localKdeDir);
addPrefix(localKdeDir);
}
for (QStringList::ConstIterator it = kdedirList.begin();
it != kdedirList.end(); it++)
{
QString dir = KShell::tildeExpand(*it);
addPrefix(dir);
}
// end KDEDIRS
// begin XDG_CONFIG_XXX
QStringList xdgdirList;
QString xdgdirs = readEnvPath("XDG_CONFIG_DIRS");
if (!xdgdirs.isEmpty())
{
tokenize(xdgdirList, xdgdirs, ":");
}
else
{
xdgdirList.clear();
xdgdirList.append("/etc/xdg");
}
QString localXdgDir = readEnvPath("XDG_CONFIG_HOME");
if (!localXdgDir.isEmpty())
{
if (localXdgDir.at(localXdgDir.length()-1) != '/')
localXdgDir += '/';
}
else
{
//US if (getuid())
if (true)
{
localXdgDir = QDir::homeDirPath() + "/.config/";
}
else
{
//US struct passwd *pw = getpwuid(0);
//US localXdgDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.config/";
qDebug("KStandardDirs::addKDEDefaults: 2 has to be fixed");
}
}
localXdgDir = KShell::tildeExpand(localXdgDir);
addXdgConfigPrefix(localXdgDir);
for (QStringList::ConstIterator it = xdgdirList.begin();
it != xdgdirList.end(); it++)
{
QString dir = KShell::tildeExpand(*it);
addXdgConfigPrefix(dir);
}
// end XDG_CONFIG_XXX
// begin XDG_DATA_XXX
xdgdirs = readEnvPath("XDG_DATA_DIRS");
if (!xdgdirs.isEmpty())
{
tokenize(xdgdirList, xdgdirs, ":");
}
else
{
xdgdirList.clear();
for (QStringList::ConstIterator it = kdedirList.begin();
it != kdedirList.end(); it++)
{
QString dir = *it;
if (dir.at(dir.length()-1) != '/')
dir += '/';
xdgdirList.append(dir+"share/");
}
xdgdirList.append("/usr/local/share/");
xdgdirList.append("/usr/share/");
}
localXdgDir = readEnvPath("XDG_DATA_HOME");
if (!localXdgDir.isEmpty())
{
if (localXdgDir.at(localXdgDir.length()-1) != '/')
localXdgDir += '/';
}
else
{
//US if (getuid())
if (true)
{
localXdgDir = QDir::homeDirPath() + "/.local/share/";
}
else
{
//US struct passwd *pw = getpwuid(0);
//US localXdgDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.local/share/";
qDebug("KStandardDirs::addKDEDefaults: 3 has to be fixed");
}
}
localXdgDir = KShell::tildeExpand(localXdgDir);
addXdgDataPrefix(localXdgDir);
for (QStringList::ConstIterator it = xdgdirList.begin();
it != xdgdirList.end(); it++)
{
QString dir = KShell::tildeExpand(*it);
addXdgDataPrefix(dir);
}
// end XDG_DATA_XXX
uint index = 0;
while (types[index] != 0) {
addResourceType(types[index], kde_default(types[index]));
index++;
}
addResourceDir("home", QDir::homeDirPath());
}
void KStandardDirs::checkConfig() const
{
/*US
if (!addedCustoms && KGlobal::_instance && KGlobal::_instance->_config)
const_cast<KStandardDirs*>(this)->addCustomized(KGlobal::_instance->_config);
*/
if (!addedCustoms && KGlobal::config())
const_cast<KStandardDirs*>(this)->addCustomized(KGlobal::config());
}
bool KStandardDirs::addCustomized(KConfig *config)
{
if (addedCustoms) // there are already customized entries
return false; // we just quite and hope they are the right ones
// save the numbers of config directories. If this changes,
// we will return true to give KConfig a chance to reparse
uint configdirs = resourceDirs("config").count();
// reading the prefixes in
QString oldGroup = config->group();
config->setGroup("Directories");
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp
index 92cb8d2..79b0f9d 100644
--- a/microkde/kdeui/ktoolbar.cpp
+++ b/microkde/kdeui/ktoolbar.cpp
@@ -835,385 +835,385 @@ void KToolBar::hideItem (int id)
void KToolBar::showItem (int id)
{
QWidget *w = getWidget(id);
if ( w )
w->show();
}
int KToolBar::itemIndex (int id)
{
QWidget *w = getWidget(id);
return w ? widgets.findRef(w) : -1;
}
void KToolBar::setFullSize(bool flag )
{
setHorizontalStretchable( flag );
setVerticalStretchable( flag );
}
bool KToolBar::fullSize() const
{
return isHorizontalStretchable() || isVerticalStretchable();
}
void KToolBar::enableMoving(bool flag )
{
//US setMovingEnabled(flag);
this->mainWindow()->setToolBarsMovable(flag);
}
void KToolBar::setBarPos (BarPosition bpos)
{
if ( !mainWindow() )
return;
//US mainWindow()->moveDockWindow( this, (Dock)bpos );
mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos );
}
KToolBar::BarPosition KToolBar::barPos()
{
if ( !(QMainWindow*)mainWindow() )
return KToolBar::Top;
//US Dock dock;
QMainWindow::ToolBarDock dock;
int dm1, dm2;
bool dm3;
((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 );
//US if ( dock == DockUnmanaged ) {
if ( dock == QMainWindow::Unmanaged ) {
return (KToolBar::BarPosition)Top;
}
return (BarPosition)dock;
}
bool KToolBar::enable(BarStatus stat)
{
bool mystat = isVisible();
if ( (stat == Toggle && mystat) || stat == Hide )
hide();
else
show();
return isVisible() == mystat;
}
void KToolBar::setMaxHeight ( int h )
{
setMaximumHeight( h );
}
int KToolBar::maxHeight()
{
return maximumHeight();
}
void KToolBar::setMaxWidth (int dw)
{
setMaximumWidth( dw );
}
int KToolBar::maxWidth()
{
return maximumWidth();
}
void KToolBar::setTitle (const QString& _title)
{
setLabel( _title );
}
void KToolBar::enableFloating (bool )
{
}
void KToolBar::setIconText(IconText it)
{
setIconText( it, true );
}
void KToolBar::setIconText(IconText icontext, bool update)
{
bool doUpdate=false;
if (icontext != d->m_iconText) {
d->m_iconText = icontext;
doUpdate=true;
}
if (update == false)
return;
if (doUpdate)
emit modechange(); // tell buttons what happened
// ugly hack to force a QMainWindow::triggerLayout( TRUE )
if ( mainWindow() ) {
QMainWindow *mw = mainWindow();
mw->setUpdatesEnabled( FALSE );
mw->setToolBarsMovable( !mw->toolBarsMovable() );
mw->setToolBarsMovable( !mw->toolBarsMovable() );
mw->setUpdatesEnabled( TRUE );
}
}
KToolBar::IconText KToolBar::iconText() const
{
return d->m_iconText;
}
void KToolBar::setIconSize(int size)
{
setIconSize( size, true );
}
void KToolBar::setIconSize(int size, bool update)
{
bool doUpdate=false;
if ( size != d->m_iconSize ) {
d->m_iconSize = size;
doUpdate=true;
}
if (update == false)
return;
if (doUpdate)
emit modechange(); // tell buttons what happened
// ugly hack to force a QMainWindow::triggerLayout( TRUE )
if ( mainWindow() ) {
QMainWindow *mw = mainWindow();
mw->setUpdatesEnabled( FALSE );
mw->setToolBarsMovable( !mw->toolBarsMovable() );
mw->setToolBarsMovable( !mw->toolBarsMovable() );
mw->setUpdatesEnabled( TRUE );
}
}
int KToolBar::iconSize() const
{
/*US
if ( !d->m_iconSize ) // default value?
{
if (!::qstrcmp(QObject::name(), "mainToolBar"))
return KGlobal::iconLoader()->currentSize(KIcon::MainToolbar);
else
return KGlobal::iconLoader()->currentSize(KIcon::Toolbar);
}
return d->m_iconSize;
*/
int ret = 18;
- if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 )
+ if ( QApplication::desktop()->width() > 320 )
ret = 30;
return ret;
}
void KToolBar::setEnableContextMenu(bool enable )
{
d->m_enableContext = enable;
}
bool KToolBar::contextMenuEnabled() const
{
return d->m_enableContext;
}
void KToolBar::setItemNoStyle(int id, bool no_style )
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
KToolBarButton * button = (KToolBarButton *)( *it );
if (button)
button->setNoStyle( no_style );
}
void KToolBar::setFlat (bool flag)
{
if ( !mainWindow() )
return;
if ( flag )
//US mainWindow()->moveDockWindow( this, DockMinimized );
mainWindow()->moveToolBar( this, QMainWindow::Minimized );
else
//US mainWindow()->moveDockWindow( this, DockTop );
mainWindow()->moveToolBar( this, QMainWindow::Top );
// And remember to save the new look later
/*US
if ( mainWindow()->inherits( "KMainWindow" ) )
static_cast<KMainWindow *>(mainWindow())->setSettingsDirty();
*/
}
int KToolBar::count() const
{
return id2widget.count();
}
void KToolBar::saveState()
{
/*US
// first, try to save to the xml file
if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() ) {
// go down one level to get to the right tags
QDomElement elem = d->m_xmlguiClient->domDocument().documentElement().toElement();
elem = elem.firstChild().toElement();
QString barname(!::qstrcmp(name(), "unnamed") ? "mainToolBar" : name());
QDomElement current;
// now try to find our toolbar
d->modified = false;
for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) {
current = elem;
if ( current.tagName().lower() != "toolbar" )
continue;
QString curname(current.attribute( "name" ));
if ( curname == barname ) {
saveState( current );
break;
}
}
// if we didn't make changes, then just return
if ( !d->modified )
return;
// now we load in the (non-merged) local file
QString local_xml(KXMLGUIFactory::readConfigFile(d->m_xmlguiClient->xmlFile(), true, d->m_xmlguiClient->instance()));
QDomDocument local;
local.setContent(local_xml);
// make sure we don't append if this toolbar already exists locally
bool just_append = true;
elem = local.documentElement().toElement();
KXMLGUIFactory::removeDOMComments( elem );
elem = elem.firstChild().toElement();
for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) {
if ( elem.tagName().lower() != "toolbar" )
continue;
QString curname(elem.attribute( "name" ));
if ( curname == barname ) {
just_append = false;
local.documentElement().replaceChild( current, elem );
break;
}
}
if (just_append)
local.documentElement().appendChild( current );
KXMLGUIFactory::saveConfigFile(local, d->m_xmlguiClient->localXMLFile(), d->m_xmlguiClient->instance() );
return;
}
*/
// if that didn't work, we save to the config file
KConfig *config = KGlobal::config();
saveSettings(config, QString::null);
config->sync();
}
QString KToolBar::settingsGroup()
{
QString configGroup;
if (!::qstrcmp(name(), "unnamed") || !::qstrcmp(name(), "mainToolBar"))
configGroup = "Toolbar style";
else
configGroup = QString(name()) + " Toolbar style";
if ( this->mainWindow() )
{
configGroup.prepend(" ");
configGroup.prepend( this->mainWindow()->name() );
}
return configGroup;
}
void KToolBar::saveSettings(KConfig *config, const QString &_configGroup)
{
QString configGroup = _configGroup;
if (configGroup.isEmpty())
configGroup = settingsGroup();
//kdDebug(220) << "KToolBar::saveSettings group=" << _configGroup << " -> " << configGroup << endl;
QString position, icontext;
int index;
getAttributes( position, icontext, index );
//kdDebug(220) << "KToolBar::saveSettings " << name() << " newLine=" << newLine << endl;
KConfigGroupSaver saver(config, configGroup);
if ( position != d->PositionDefault )
config->writeEntry("Position", position);
else
config->deleteEntry("Position");
if ( icontext != d->IconTextDefault )
config->writeEntry("IconText", icontext);
else
config->deleteEntry("IconText");
if ( iconSize() != d->IconSizeDefault )
config->writeEntry("IconSize", iconSize());
else
config->deleteEntry("IconSize");
if ( isHidden() != d->HiddenDefault )
config->writeEntry("Hidden", isHidden());
else
config->deleteEntry("Hidden");
if ( index != d->IndexDefault )
config->writeEntry( "Index", index );
else
config->deleteEntry("Index");
//US the older version of KDE (used on the Zaurus) has no Offset property
/* if ( offset() != d->OffsetDefault )
config->writeEntry( "Offset", offset() );
else
*/
config->deleteEntry("Offset");
//US the older version of KDE (used on the Zaurus) has no NewLine property
/*
if ( newLine() != d->NewLineDefault )
config->writeEntry( "NewLine", newLine() );
else
*/
config->deleteEntry("NewLine");
}
void KToolBar::setXMLGUIClient( KXMLGUIClient *client )
{
d->m_xmlguiClient = client;
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp
index 827ec38..2253de4 100644
--- a/microkde/kresources/factory.cpp
+++ b/microkde/kresources/factory.cpp
@@ -1,222 +1,223 @@
/*
This file is part of libkresources.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.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 <kdebug.h>
#include <klocale.h>
#include <ksimpleconfig.h>
#include <kstandarddirs.h>
#include <kstaticdeleter.h>
+//#ifndef DESKTOP_VERSION
#include <klibloader.h>
-
+//#endif
#include <qfile.h>
#include "resource.h"
#include "factory.h"
using namespace KRES;
QDict<Factory> *Factory::mSelves = 0;
static KStaticDeleter< QDict<Factory> > staticDeleter;
Factory *Factory::self( const QString& resourceFamily )
{
Factory *factory = 0;
if ( !mSelves )
{
mSelves = staticDeleter.setObject( new QDict<Factory> );
}
factory = mSelves->find( resourceFamily );
if ( !factory ) {
factory = new Factory( resourceFamily );
mSelves->insert( resourceFamily, factory );
}
return factory;
}
Factory::Factory( const QString& resourceFamily ) :
mResourceFamily( resourceFamily )
{
//US so far we have three types available for resourceFamily "contact"
// and that are "file", "dir", "ldap"
/*US
KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin", QString( "[X-KDE-ResourceFamily] == '%1'" )
.arg( resourceFamily ) );
KTrader::OfferList::ConstIterator it;
for ( it = plugins.begin(); it != plugins.end(); ++it ) {
QVariant type = (*it)->property( "X-KDE-ResourceType" );
if ( !type.toString().isEmpty() )
mTypeMap.insert( type.toString(), *it );
}
*/
//US new
PluginInfo* info = new PluginInfo;
info->library = "microkabc_file";
info->nameLabel = i18n( "file" );
info->descriptionLabel = i18n( "Choose one file" );
mTypeMap.insert( "file", info );
info = new PluginInfo;
info->library = "microkabc_dir";
info->nameLabel = i18n( "dir" );
info->descriptionLabel = i18n( "Choose a directory with may files" );
mTypeMap.insert( "dir", info );
info = new PluginInfo;
info->library = "microkabc_ldap";
info->nameLabel = i18n( "ldap" );
info->descriptionLabel = i18n( "No description available" );
mTypeMap.insert( "ldap", info );
//US add opie plugin only, if the library exists
QString libname = "microkabc_opie";
QString path = KLibLoader::findLibrary( QFile::encodeName( libname ) );
if ( !path.isEmpty() )
{
info = new PluginInfo;
info->library = libname;
info->nameLabel = i18n( "opie" );
info->descriptionLabel = i18n( "Opie PIM Addressbook." );
mTypeMap.insert( "opie", info );
}
//US add qtopia plugin only, if the library exists
libname = "microkabc_qtopia";
path = KLibLoader::findLibrary( QFile::encodeName( libname ) );
if ( !path.isEmpty() )
{
info = new PluginInfo;
info->library = libname;
info->nameLabel = i18n( "qtopia" );
info->descriptionLabel = i18n( "Qtopia PIM Addressbook." );
mTypeMap.insert( "qtopia", info );
}
}
Factory::~Factory()
{
}
QStringList Factory::typeNames() const
{
//US method QMap::keys() not available yet. SO collect the data manually
//US return mTypeMap.keys();
QStringList result;
QMap<QString, PluginInfo*>::ConstIterator it;
for( it = mTypeMap.begin(); it != mTypeMap.end(); ++it ) {
result << it.key().latin1();
// qDebug("Factory::typeNames() : %s ", it.key().latin1());
}
return result;
}
ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent )
{
if ( type.isEmpty() || !mTypeMap.contains( type ) )
return 0;
//US KService::Ptr ptr = mTypeMap[ type ];
//US KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() );
PluginInfo* pi = mTypeMap[ type ];
KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() );
if ( !factory ) {
qDebug("KRES::Factory::configWidget(): Factory creation failed for library %s", pi->library.latin1());
kdDebug() << "KRES::Factory::configWidget(): Factory creation failed" << endl;
return 0;
}
PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory );
if ( !pluginFactory ) {
qDebug("KRES::Factory::configWidget(): no plugin factory for library %s", pi->library.latin1());
kdDebug() << "KRES::Factory::configWidget(): no plugin factory." << endl;
return 0;
}
ConfigWidget *wdg = pluginFactory->configWidget( parent );
if ( !wdg ) {
//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl;
qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1());
return 0;
}
return wdg;
}
QString Factory::typeName( const QString &type ) const
{
if ( type.isEmpty() || !mTypeMap.contains( type ) )
return QString();
//US KService::Ptr ptr = mTypeMap[ type ];
//US return ptr->name();
PluginInfo* pi = mTypeMap[ type ];
return pi->nameLabel;
}
QString Factory::typeDescription( const QString &type ) const
{
if ( type.isEmpty() || !mTypeMap.contains( type ) )
return QString();
//US KService::Ptr ptr = mTypeMap[ type ];
//US return ptr->comment();
PluginInfo* pi = mTypeMap[ type ];
return pi->descriptionLabel;
}
Resource *Factory::resource( const QString& type, const KConfig *config )
{
if ( type.isEmpty() || !mTypeMap.contains( type ) )
return 0;
/*US load the lib not dynamicly. !!
KService::Ptr ptr = mTypeMap[ type ];
KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() );
if ( !factory ) {
kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl;
return 0;
}
*/
PluginInfo* pi = mTypeMap[ type ];
KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() );
if ( !factory ) {
qDebug("KRES::Factory::resource(): Factory creation failed for library %s", pi->library.latin1());
kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl;
return 0;
}
diff --git a/microkde/microkde.pro b/microkde/microkde.pro
index 1e9b022..05833a9 100644
--- a/microkde/microkde.pro
+++ b/microkde/microkde.pro
@@ -1,170 +1,168 @@
TEMPLATE = lib
CONFIG += qt warn_on
#INCLUDEPATH += $(QTDIR)/include .
#DEPENDPATH += $(QTDIR)/include
INCLUDEPATH += . ../ ../kabc ./kdecore ./kdeui ./kio/kfile
#LIBS += -lqtcompat
TARGET = microkde
DESTDIR= ../bin
DEFINES += DESKTOP_VERSION KDE_QT_ONLY
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
include( ../variables.pri )
HEADERS = \
qlayoutengine_p.h \
KDGanttMinimizeSplitter.h \
kapplication.h \
kaudioplayer.h \
kcalendarsystem.h \
kcalendarsystemgregorian.h \
kcolorbutton.h \
kcolordialog.h \
kcombobox.h \
kconfig.h \
kdatetbl.h \
kdebug.h \
kdialog.h \
kdialogbase.h \
kdirwatch.h \
keditlistbox.h \
kemailsettings.h \
kfiledialog.h \
kfontdialog.h \
kglobal.h \
kglobalsettings.h \
kiconloader.h \
klineedit.h \
klineeditdlg.h \
kmessagebox.h \
knotifyclient.h \
kprinter.h \
kprocess.h \
krestrictedline.h \
krun.h \
ksimpleconfig.h \
kstaticdeleter.h \
ksystemtray.h \
ktempfile.h \
ktextedit.h \
kunload.h \
kurl.h \
kdeui/kguiitem.h \
kdeui/kcmodule.h \
kdeui/kbuttonbox.h \
kdeui/klistbox.h \
kdeui/klistview.h \
kdeui/kjanuswidget.h \
kdeui/kseparator.h \
kdeui/knuminput.h \
kdeui/knumvalidator.h \
kdeui/ksqueezedtextlabel.h \
kio/job.h \
kio/kfile/kurlrequester.h \
kresources/resource.h \
kresources/factory.h \
kresources/managerimpl.h \
kresources/manager.h \
kresources/selectdialog.h \
kresources/configpage.h \
kresources/configwidget.h \
kresources/configdialog.h \
kresources/kcmkresources.h \
kdecore/kmdcodec.h \
kdecore/kconfigbase.h \
kdecore/klocale.h \
kdecore/kcatalogue.h \
kdecore/ksharedptr.h \
kdecore/kshell.h \
kdecore/kstandarddirs.h \
kdecore/kstringhandler.h \
kdecore/kshortcut.h \
kutils/kcmultidialog.h \
kdeui/kxmlguiclient.h \
kdeui/kstdaction.h \
kdeui/kmainwindow.h \
kdeui/ktoolbar.h \
kdeui/ktoolbarbutton.h \
kdeui/ktoolbarhandler.h \
kdeui/kaction.h \
kdeui/kactionclasses.h \
- kdeui/kactioncollection.h
+ kdeui/kactioncollection.h \
+ kdecore/klibloader.h
# kdecore/klibloader.h \
SOURCES = \
KDGanttMinimizeSplitter.cpp \
kapplication.cpp \
kcalendarsystem.cpp \
kcalendarsystemgregorian.cpp \
kcolorbutton.cpp \
kcolordialog.cpp \
kconfig.cpp \
kdatetbl.cpp \
kdialog.cpp \
kdialogbase.cpp \
keditlistbox.cpp \
kemailsettings.cpp \
kfontdialog.cpp \
kfiledialog.cpp \
kglobal.cpp \
kglobalsettings.cpp \
kiconloader.cpp \
kmessagebox.cpp \
ktextedit.cpp \
kprocess.cpp \
krun.cpp \
ksystemtray.cpp \
ktempfile.cpp \
kurl.cpp \
kdecore/kcatalogue.cpp \
kdecore/klocale.cpp \
kdecore/kmdcodec.cpp \
kdecore/kshell.cpp \
kdecore/kstandarddirs.cpp \
kdecore/kstringhandler.cpp \
kdeui/kbuttonbox.cpp \
kdeui/kcmodule.cpp \
kdeui/kguiitem.cpp \
kdeui/kjanuswidget.cpp \
kdeui/klistbox.cpp \
kdeui/klistview.cpp \
kdeui/knuminput.cpp \
kdeui/knumvalidator.cpp \
kdeui/kseparator.cpp \
kdeui/ksqueezedtextlabel.cpp \
kio/kfile/kurlrequester.cpp \
kresources/configpage.cpp \
kresources/configdialog.cpp \
kresources/configwidget.cpp \
kresources/factory.cpp \
kresources/kcmkresources.cpp \
kresources/managerimpl.cpp \
kresources/resource.cpp \
kresources/selectdialog.cpp \
kutils/kcmultidialog.cpp \
kdeui/kaction.cpp \
kdeui/kactionclasses.cpp \
kdeui/kactioncollection.cpp \
kdeui/kmainwindow.cpp \
kdeui/ktoolbar.cpp \
kdeui/ktoolbarbutton.cpp \
kdeui/ktoolbarhandler.cpp \
kdeui/kstdaction.cpp \
- kdeui/kxmlguiclient.cpp
-
-
-
-# kdecore/klibloader.cpp \ \ No newline at end of file
+ kdeui/kxmlguiclient.cpp \
+ kdecore/klibloader.cpp \ No newline at end of file